BUG: DEShybrid: store the factor field on the mesh (fixes #2425)

The blendingFactor function object overwrites the DEShybrid:Factor
field internally when blendedSchemeBase debug flag is active.
However, users are allowed to write out the original DEShybrid:Factor
field by executing the writeObjects function object before
any blendingFactor function object execution.
This commit is contained in:
Kutalmis Bercin
2022-03-25 14:58:31 +00:00
committed by Andrew Heather
parent a5f7fb6ad2
commit e28bed59e2
2 changed files with 53 additions and 18 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd. Copyright (C) 2015-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -226,32 +226,60 @@ class DEShybrid
) )
); );
const volScalarField factor
const word factorName(IOobject::scopedName(typeName, "Factor"));
const fvMesh& mesh = this->mesh();
const IOobject factorIO
( (
IOobject factorName,
( mesh.time().timeName(),
typeName + ":Factor", mesh,
this->mesh().time().timeName(), IOobject::NO_READ,
this->mesh(), IOobject::NO_WRITE
IOobject::NO_READ,
IOobject::NO_WRITE
),
max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_)
); );
if (blendedSchemeBaseName::debug) if (blendedSchemeBaseName::debug)
{ {
factor.write(); auto* factorPtr = mesh.getObjectPtr<volScalarField>(factorName);
}
return tmp<surfaceScalarField> if (!factorPtr)
( {
new surfaceScalarField factorPtr =
new volScalarField
(
factorIO,
mesh,
dimensionedScalar(dimless, Zero)
);
const_cast<fvMesh&>(mesh).objectRegistry::store(factorPtr);
}
auto& factor = *factorPtr;
factor = max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_);
return tmp<surfaceScalarField>::New
( (
vf.name() + "BlendingFactor", vf.name() + "BlendingFactor",
fvc::interpolate(factor) fvc::interpolate(factor)
) );
); }
else
{
const volScalarField factor
(
factorIO,
max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_)
);
return tmp<surfaceScalarField>::New
(
vf.name() + "BlendingFactor",
fvc::interpolate(factor)
);
}
} }

View File

@ -85,6 +85,13 @@ Usage
Usage by the \c postProcess utility is not available. Usage by the \c postProcess utility is not available.
Note
- The \c blendingFactor function object overwrites the \c DEShybrid:Factor
field internally when \c blendedSchemeBase debug flag is active.
However, users are allowed to write out the original \c DEShybrid:Factor
field by executing the \c writeObjects function object before
any \c blendingFactor function object execution.
SourceFiles SourceFiles
blendingFactor.C blendingFactor.C
blendingFactorTemplates.C blendingFactorTemplates.C