Skip to content
Snippets Groups Projects
Commit e28bed59 authored by Kutalmış Berçin's avatar Kutalmış Berçin Committed by Andrew Heather
Browse files

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.
parent a5f7fb6a
Branches
Tags
1 merge request!530BUG: 2022-1: Various bug fixes
......@@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
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
(
typeName + ":Factor",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_)
factorName,
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
);
if (blendedSchemeBaseName::debug)
{
factor.write();
auto* factorPtr = mesh.getObjectPtr<volScalarField>(factorName);
if (!factorPtr)
{
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",
fvc::interpolate(factor)
);
}
else
{
const volScalarField factor
(
factorIO,
max(sigmaMax_*tanh(pow(A, CH1_)), sigmaMin_)
);
return tmp<surfaceScalarField>
(
new surfaceScalarField
return tmp<surfaceScalarField>::New
(
vf.name() + "BlendingFactor",
fvc::interpolate(factor)
)
);
);
}
}
......
......@@ -85,6 +85,13 @@ Usage
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
blendingFactor.C
blendingFactorTemplates.C
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment