Skip to main content

stabilityBlendingFactor

Description

The stabilityBlendingFactor function object computes the stabilityBlendingFactor to be used by the local blended convection scheme. The output is a surface field weight between 0-1.

The weight of a blended scheme, i.e. w, is given by a function of the blending factor, f:

w=fscheme1+(1fscheme2) w = f_{scheme_1} + (1 - f_{scheme_2})

The factor is calculated based on six criteria:

  1. mesh non-orthogonality field
  2. magnitude of cell centres gradient
  3. convergence rate of residuals
  4. faceWeight
  5. skewness
  6. Courant number

The user can enable them individually.

For option 1, the following relation is used, where ϕ1\phi_1 is the non-orthogonality:

fNon=min(max(0.0,(ϕ1max(ϕ1))/(min(ϕ1)max(ϕ1))),1.0)fNon = min ( max ( 0.0, (\phi_1 - max(\phi_1)) /(min(\phi_1) - max(\phi_1)) ), 1.0 )

For option 2, the following relation is used, where ϕ2\phi_2 is the magnitude of cell centres gradient (Note that ϕ2=3\phi_2 = 3 for orthogonal meshes):

fMagGradCc=min(max(0.0,(ϕ2max(ϕ2))/(min(ϕ2)max(ϕ2))),1.0)fMagGradCc = min ( max ( 0.0, (\phi_2 - max(\phi_2)) / (min(\phi_2) - max(\phi_2)) ), 1.0 )

For option 3, a PID control is used in order to control residual unbounded fluctuations for individual cells.

factor=Presidual+IresidualIntegral+DresidualDifferentialfactor = P*residual + I*residualIntegral + D*residualDifferential

where P, I and D are user inputs.

The following relation is used:

fRes=(factormeanRes)/(maxResmeanRes); fRes = (factor - meanRes)/(maxRes*meanRes);

where

meanResmeanRes : Average(residual)

maxResmaxRes : User input

Note that fResf_{Res} will blend more towards one as the cell residual is larger then the domain mean residuals.

For option 4, the following relation is used, where ϕ4\phi_4 is the face weight (Note that ϕ4=0.5\phi_4 = 0.5 for orthogonal meshes):

ffaceWeight=min(max(0.0,(min(ϕ4)ϕ4)/(min(ϕ4)max(ϕ4))),1.0) ffaceWeight = min ( max ( 0.0, (min(\phi_4) - \phi_4) / (min(\phi_4) - max(\phi_4)) ), 1.0 )

For option 5, the following relation is used, where ϕ5\phi_5 is the cell skewness:

fskewness=min(max(0.0,(ϕ5max(ϕ5))/(min(ϕ5)max(ϕ5))),1.0) fskewness = min ( max ( 0.0, (\phi_5 - max(\phi_5)) / (min(\phi_5) - max(\phi_5)) ), 1.0 )

For option 6, the following relation is used:

fCoWeight=min(max((CoCo1)/(Co2Co1),0),1) fCoWeight = min(max((Co - Co1)/(Co2 - Co1), 0), 1)

where

Co1 : Courant number below which scheme2 is used

Co2 : Courant number above which scheme1 is used

The final factor is determined by:

f=max(fNon,fMagGradCc,fRes,ffaceWeight,fskewness,fCoWeight) f = max(fNon, fMagGradCc, fRes, ffaceWeight, fskewness, fCoWeight)

An indicator (volume) field, named blendedIndicator is generated if the log flag is on:

1 : represent scheme1 as active,

0 : represent scheme2 as active.

Additional reporting is written to the standard output, providing statistics as to the number of cells used by each scheme.

Operands

OperandTypeLocation
input--
output filedat$FOAM_CASE/postProcessing/<FO>/<time>/<file>
output fieldvolScalarField$FOAM_CASE/<time>/<outField>

Usage

Example of the stabilityBlendingFactor function object by using functions sub-dictionary in system/controlDict file:

stabilityBlendingFactor1
{
// Mandatory entries (unmodifiable)
type stabilityBlendingFactor;
libs (fieldFunctionObjects);

// Mandatory entries (unmodifiable)
field <field>; // U;
result <outField>; // UBlendingFactor;

// Optional entries (runtime modifiable)
tolerance 0.001;

// Any of the options can be chosen in combinations

// Option-1
switchNonOrtho true;
nonOrthogonality nonOrthoAngle;
maxNonOrthogonality 20;
minNonOrthogonality 60;

// Option-2
switchGradCc true;
maxGradCc 3;
minGradCc 4;

// Option-3
switchResiduals true;
maxResidual 10;
residual initialResidual:p;
P 1.5;
I 0;
D 0.5;

// Option-4
switchFaceWeight true;
maxFaceWeight 0.3;
minFaceWeight 0.2;

// Option-5
switchSkewness true;
maxSkewness 2;
minSkewness 3;

// Option-6
switchCo true;
U U;
Co1 1;
Co2 10;

// Optional (inherited) entries
writePrecision 8;
writeToFile true;
useUserTime true;
region region0;
enabled true;
log true;
timeStart 0;
timeEnd 1000;
executeControl timeStep;
executeInterval 1;
writeControl timeStep;
writeInterval 1;
}

where the entries mean:

PropertyDescriptionTypeRequiredDefault
typeType name: stabilityBlendingFactorwordyes-
libsLibrary name: fieldFunctionObjectswordyes-
fieldName of the operand fieldwordyes-
resultName of surface field used in the localBlended schemewordyes-
switchNonOrthoSelect non-orthogonal methodboolnofalse
nonOrthogonalityName of the non-orthogonal fieldwordnononOrthoAngle
maxNonOrthogonalityMaximum non-orthogonal for scheme2scalarno20
minNonOrthogonalityMinimum non-orthogonal for scheme1scalarno60
switchGradCcSelect cell centre gradient methodboolnofalse
maxGradCcMaximum gradient for scheme2scalarno2
minGradCcMinimum gradient for scheme1scalarno4
switchResidualsSelect residual evolution methodboolnofalse
residualName of the residual fieldwordnoinitialResidual:p
maxResidualMaximum residual-mean ratio for scheme1scalarno10
PProportional factor for PIDscalarno3
IIntegral factor for PIDscalarno0
DDifferential factor for PIDscalarno0.25
switchFaceWeightSelect face weight methodboolnofalse
faceWeightName of the faceWeight fieldwordnofaceWeight
maxFaceWeightMaximum face weight for scheme1scalarno0.2
minFaceWeightMinimum face weight for scheme2scalarno0.3
switchSkewnessSelect skewness methodboolnofalse
skewnessName of the skewness fieldwordnoskewness
maxSkewnessMaximum skewness for scheme2scalarno2
minSkewnessMinimum skewness for scheme1scalarno3
switchCoSelect Co blended methodboolnofalse
UName of the flux field for Co blendedwordnoU
Co1Courant number below which scheme2 is usedscalarno1
Co2Courant number above which scheme1 is usedscalarno10
toleranceTolerance for number of blended cellsscalarno0.001

The result entry is the field which is read by the localBlended scheme specified in fvSchemes. This name is determined by the localBlended class.

The inherited entries are elaborated in:

Usage by the postProcess utility is not available.

Further information

Tutorial:

Source code:

API:

History: Introduced in version v1806