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

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2016-2020 OpenCFD Ltd. Copyright (C) 2016-2022 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -31,26 +31,14 @@ Group
grpFieldFunctionObjects grpFieldFunctionObjects
Description Description
Computes the blending coefficient employed by blended divergence schemes, Computes blending factor as an indicator about which
giving an indicator as to which of the schemes is active across the domain. of the schemes is active across the domain.
Blended schemes combine contributions from two schemes, i.e. \f$\phi_1\f$ Blending factor values mean:
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:
\verbatim \verbatim
0 = scheme 0 0 = scheme 0
1 = scheme 1 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 \endverbatim
Operands: Operands:
@ -66,25 +54,23 @@ Usage
\verbatim \verbatim
blendingFactor1 blendingFactor1
{ {
// Mandatory entries (unmodifiable) // Mandatory entries
type blendingFactor; type blendingFactor;
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
// Mandatory (inherited) entry (runtime modifiable)
field <field>; field <field>;
// Optional entries (runtime modifiable) // Optional entries
phi phi; phi phi;
tolerance 0.001; tolerance 0.001;
// Optional (inherited) entries // Inherited entries
... ...
} }
\endverbatim \endverbatim
where the entries mean: where the entries mean:
\table \table
Property | Description | Type | Req'd | Deflt Property | Description | Type | Reqd | Deflt
type | Type name: blendingFactor | word | yes | - type | Type name: blendingFactor | word | yes | -
libs | Library name: fieldFunctionObjects | word | yes | - libs | Library name: fieldFunctionObjects | word | yes | -
field | Name of the operand field | word | yes | - field | Name of the operand field | word | yes | -
@ -99,14 +85,6 @@ Usage
Usage by the \c postProcess utility is not available. 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 SourceFiles
blendingFactor.C blendingFactor.C
blendingFactorTemplates.C blendingFactorTemplates.C

View File

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