fixedGradientCorrected
Overview
fixedGradientCorrected is a Neumann condition for fields of any type
(scalar, vector, sphericalTensor, symmTensor, tensor). It prescribes the
patch-normal gradient. Its patch value and value coefficients include a
non-orthogonal correction $\mathbf{c}\cdot\nabla\phi_P$, evaluated on a small
sub-mesh around the patch. Unlike fixedValueCorrected,
the correction enters the matrix directly, through valueBoundaryCoeffs. It
comes from the foam-extend interface-tracking solver (interTrackFoam,
Tuković). The BC is compiled into libinterfaceTrackingFvMesh. It derives
from the common base correctedFvPatchField (type corrected). The base
class, the sub-mesh machinery, the corrected type and the porting status
(interTrackFluid disabled, patchCorrected snGrad not ported) are
described on the fixedValueCorrected page.
Mathematical Formulation
$$ \left.\frac{\partial\phi}{\partial n}\right|_b = g \quad \text{on } \partial\Omega, \qquad \phi_b = \phi_P + \phi_c + \delta\, g $$with the correction from the base class
$$ \mathbf{c} = \boldsymbol{\Delta} - \mathbf{n}\,(\mathbf{n}\cdot\boldsymbol{\Delta}), \qquad \phi_c = \mathbf{c}\cdot(\nabla\phi)_P $$Matrix coefficients:
| Coefficient | Value |
|---|---|
valueInternalCoeffs | $1$ |
valueBoundaryCoeffs | $\phi_c + \delta\,g$ |
gradientInternalCoeffs | $0$ |
gradientBoundaryCoeffs | $g$ |
snGrad() | $g$ |
| Symbol | Description | Unit |
|---|---|---|
| $\phi$ | Patch field | field unit |
| $g$ | Prescribed normal gradient (gradient) | field unit/m |
| $\mathbf{n}$ | Patch unit normal | – |
| $\boldsymbol{\Delta}$ | Patch delta vector (patch().delta()) | m |
| $\mathbf{c}$ | Correction vector | m |
| $\phi_c$ | Stored correction (corrVecGrad), updated in updateCoeffs() | field unit |
| $\delta$ | $1/$patch().deltaCoeffs() | m |
Note on OpenFOAM.com. fvPatch::delta() is patch-normal for every
non-coupled patch in OpenFOAM.com, so $\mathbf{c} \equiv \mathbf{0}$ and
$\phi_c \equiv 0$. The coefficients reduce to those of stock fixedGradient.
Implementation
- Construction: the base class reads
volFieldName(required) and the optionalcorrVecGrad. This class then readsgradient(required). Ifvalueis given, it is used as the initial patch value. Otherwise $\phi_P + \delta g + \phi_c$ is used, with $\phi_c = 0$ at that point unlesscorrVecGradwas given.nGradInternalis set to $g$. updateCoeffs()(base class): recomputes $\mathbf{c}$ if the mesh moves, rebuilds $\phi_c$ on the patch sub-mesh (gradient schemesnGradCorr(<volFieldName>)). It is called whenever anfvMatrixfor the field is constructed, sovalueBoundaryCoeffsalways uses the current $\phi_c$.evaluate(): the class declaresevaluate()without thePstream::commsTypesargument. It therefore does not overridefvPatchField::evaluate(const Pstream::commsTypes), whichcorrectBoundaryConditions()calls. In practice the baseevaluateruns, and that only resets theupdatedflag. The patch value is not recomputed from $\phi_P + \phi_c + \delta g$ after a solve. It keeps its initial value unless code assigns it explicitly. Only the matrix coefficients follow the formula above.- Mapping:
autoMap/rmapmap the value andgradient. - Sub-mesh motion:
interfaceTrackingFvMesh::update()moves the sub-mesh only forUandp. write():type,volFieldName,corrVecGrad,gradient,value.
Dictionary Entries
| Keyword | Description | Required | Default |
|---|---|---|---|
type | fixedGradientCorrected | yes | – |
volFieldName | Name of the volume field this patch field belongs to | yes | – (no default) |
gradient | Prescribed normal gradient $g$ | yes | – |
value | Initial patch value | no | $\phi_P + \delta g + \phi_c$ |
corrVecGrad | Initial stored correction $\phi_c$ | no | zero |
The library must be loaded with
libs ("libinterfaceTrackingFvMesh.so"); in system/controlDict.
Usage
outlet
{
type fixedGradientCorrected;
volFieldName p;
gradient uniform 0;
value uniform 0;
}
Known Limitations
- Patch value not updated by
correctBoundaryConditions()because theevaluate()signature does not match (see Implementation). Explicit operators that use patch values (fvc::grad,fvc::interpolate, face fluxes) see a stale value. - No correction in OpenFOAM.com (patch-normal
delta()). The cost of the sub-mesh gradient remains on everyupdateCoeffs(). - Interface-tracking context not available:
interTrackFluidis disabled andpatchCorrectedis not ported (see fixedValueCorrected). volFieldNamehas no default and must match the field name.- Sub-mesh motion only for
Uandp.
In practice, use the stock fixedGradient instead.
Tutorials
No tutorial uses fixedGradientCorrected.
References
- Tuković, Ž., Jasak, H., A moving mesh finite volume interface tracking method for surface tension dominated interfacial fluid flow, Computers & Fluids 55, 2012. DOI: 10.1016/j.compfluid.2011.11.003
- Alkfri, A., Habes, C., Marschall, H., multiRegionFoam: A Unified Multiphysics Framework for Multi-Region Coupled Continuum-Physical Problems, Engineering with Computers, 2023. DOI: 10.1007/s00366-024-01974-4