BUG: blendingFactor: fix DEShybrid blending-factor inconsistency (fixes #2419)

This commit is contained in:
Kutalmis Bercin
2022-03-22 13:44:04 +00:00
committed by Andrew Heather
parent abc38e1cfc
commit a5f7fb6ad2
3 changed files with 28 additions and 41 deletions

View File

@ -14,6 +14,7 @@ EXE_INC = \
-I$(LIB_SRC)/TurbulenceModels/turbulenceModels/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/incompressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/compressible/lnInclude \
-I$(LIB_SRC)/TurbulenceModels/schemes/lnInclude \
-I$(LIB_SRC)/transportModels/compressible/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/solidThermo/lnInclude \
@ -39,6 +40,7 @@ LIB_LIBS = \
-lcompressibleTransportModels \
-lincompressibleTurbulenceModels \
-lcompressibleTurbulenceModels \
-lturbulenceModelSchemes \
-lchemistryModel \
-lreactionThermophysicalModels \
-lpairPatchAgglomeration

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -31,26 +31,14 @@ Group
grpFieldFunctionObjects
Description
Computes the blending coefficient employed by blended divergence schemes,
giving an indicator as to which of the schemes is active across the domain.
Computes blending factor as an indicator about which
of the schemes is active across the domain.
Blended schemes combine contributions from two schemes, i.e. \f$\phi_1\f$
and \f$\phi_2\f$, using a weight field, i.e. \f$w\f$, such that the
effective scheme value, i.e. \f$\phi_{eff}\f$, is computed as follows:
\f[
\phi_{eff} = w \phi_1 + (1 - w) \phi_2
\f]
The weight field, i.e. \f$w\f$, is surface field and converted to a volume
field for easier post-processing by setting the cell value to one minus
the minimum of the face values.
This conversion leads to blending indicator field whose values mean:
Blending factor values mean:
\verbatim
0 = scheme 0
1 = scheme 1
0-1 = a blend between scheme 0 and scheme 1
0-1 = a blending factor between scheme 0 and scheme 1
\endverbatim
Operands:
@ -66,25 +54,23 @@ Usage
\verbatim
blendingFactor1
{
// Mandatory entries (unmodifiable)
// Mandatory entries
type blendingFactor;
libs (fieldFunctionObjects);
// Mandatory (inherited) entry (runtime modifiable)
field <field>;
// Optional entries (runtime modifiable)
// Optional entries
phi phi;
tolerance 0.001;
// Optional (inherited) entries
// Inherited entries
...
}
\endverbatim
where the entries mean:
\table
Property | Description | Type | Req'd | Deflt
Property | Description | Type | Reqd | Deflt
type | Type name: blendingFactor | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of the operand field | word | yes | -
@ -99,14 +85,6 @@ Usage
Usage by the \c postProcess utility is not available.
See also
- Foam::functionObject
- Foam::functionObjects::fieldExpression
- Foam::functionObjects::fvMeshFunctionObject
- Foam::functionObjects::writeFile
- Foam::CoBlended
- ExtendedCodeGuide::functionObjects::field::blendingFactor
SourceFiles
blendingFactor.C
blendingFactorTemplates.C

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2016 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -30,6 +30,7 @@ License
#include "boundedConvectionScheme.H"
#include "blendedSchemeBase.H"
#include "fvcCellReduce.H"
#include "DEShybrid.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -72,12 +73,18 @@ void Foam::functionObjects::blendingFactor::calcBlendingFactor
// Convert into vol field whose values represent the local face minima
// Note:
// - factor applied to 1st scheme, and (1-factor) to 2nd scheme
// - not using the store(...) mechanism due to need to correct BCs
volScalarField& indicator =
lookupObjectRef<volScalarField>(resultName_);
auto& indicator = lookupObjectRef<volScalarField>(resultName_);
if (isA<DEShybrid<Type>>(blendedScheme))
{
indicator = fvc::cellReduce(factorf, minEqOp<scalar>(), GREAT);
}
else
{
indicator = 1 - fvc::cellReduce(factorf, minEqOp<scalar>(), GREAT);
}
indicator.correctBoundaryConditions();
}