51 const fvMesh&
mesh = vsf.mesh();
53 tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf,
name);
71 const scalar rk = (1.0/k_ - 1.0);
75 const label own = owner[facei];
76 const label nei = neighbour[facei];
78 const scalar vsfOwn = vsf[own];
79 const scalar vsfNei = vsf[nei];
81 scalar maxFace =
max(vsfOwn, vsfNei);
82 scalar minFace =
min(vsfOwn, vsfNei);
83 const scalar maxMinFace = rk*(maxFace - minFace);
84 maxFace += maxMinFace;
85 minFace -= maxMinFace;
91 maxFace - vsfOwn, minFace - vsfOwn,
92 (Cf[facei] -
C[own]) &
g[own]
99 maxFace - vsfNei, minFace - vsfNei,
100 (Cf[facei] -
C[nei]) &
g[nei]
104 const volScalarField::Boundary& bsf = vsf.boundaryField();
111 const vectorField& pCf = Cf.boundaryField()[patchi];
115 const scalarField psfNei(psf.patchNeighbourField());
119 const label own = pOwner[pFacei];
121 const scalar vsfOwn = vsf[own];
122 const scalar vsfNei = psfNei[pFacei];
124 scalar maxFace =
max(vsfOwn, vsfNei);
125 scalar minFace =
min(vsfOwn, vsfNei);
126 const scalar maxMinFace = rk*(maxFace - minFace);
127 maxFace += maxMinFace;
128 minFace -= maxMinFace;
133 maxFace - vsfOwn, minFace - vsfOwn,
134 (pCf[pFacei] -
C[own]) &
g[own]
138 else if (psf.fixesValue())
142 const label own = pOwner[pFacei];
144 const scalar vsfOwn = vsf[own];
145 const scalar vsfNei = psf[pFacei];
147 scalar maxFace =
max(vsfOwn, vsfNei);
148 scalar minFace =
min(vsfOwn, vsfNei);
149 const scalar maxMinFace = rk*(maxFace - minFace);
150 maxFace += maxMinFace;
151 minFace -= maxMinFace;
156 maxFace - vsfOwn, minFace - vsfOwn,
157 (pCf[pFacei] -
C[own]) &
g[own]
165 Info<<
"gradient limiter for: " << vsf.name()
172 g.correctBoundaryConditions();
207 const scalar rk = (1.0/k_ - 1.0);
211 const label own = owner[facei];
212 const label nei = neighbour[facei];
214 const vector& vvfOwn = vvf[own];
215 const vector& vvfNei = vvf[nei];
218 vector gradf((Cf[facei] -
C[own]) &
g[own]);
220 scalar vsfOwn = gradf & vvfOwn;
221 scalar vsfNei = gradf & vvfNei;
223 scalar maxFace =
max(vsfOwn, vsfNei);
224 scalar minFace =
min(vsfOwn, vsfNei);
225 const scalar maxMinFace = rk*(maxFace - minFace);
226 maxFace += maxMinFace;
227 minFace -= maxMinFace;
232 maxFace - vsfOwn, minFace - vsfOwn,
238 gradf = (Cf[facei] -
C[nei]) &
g[nei];
240 vsfOwn = gradf & vvfOwn;
241 vsfNei = gradf & vvfNei;
243 maxFace =
max(vsfOwn, vsfNei);
244 minFace =
min(vsfOwn, vsfNei);
249 maxFace - vsfNei, minFace - vsfNei,
266 const vectorField psfNei(psf.patchNeighbourField());
270 const label own = pOwner[pFacei];
272 const vector& vvfOwn = vvf[own];
273 const vector& vvfNei = psfNei[pFacei];
275 const vector gradf((pCf[pFacei] -
C[own]) &
g[own]);
277 const scalar vsfOwn = gradf & vvfOwn;
278 const scalar vsfNei = gradf & vvfNei;
280 scalar maxFace =
max(vsfOwn, vsfNei);
281 scalar minFace =
min(vsfOwn, vsfNei);
282 const scalar maxMinFace = rk*(maxFace - minFace);
283 maxFace += maxMinFace;
284 minFace -= maxMinFace;
289 maxFace - vsfOwn, minFace - vsfOwn,
294 else if (psf.fixesValue())
298 const label own = pOwner[pFacei];
300 const vector& vvfOwn = vvf[own];
301 const vector& vvfNei = psf[pFacei];
303 const vector gradf((pCf[pFacei] -
C[own]) &
g[own]);
305 const scalar vsfOwn = gradf & vvfOwn;
306 const scalar vsfNei = gradf & vvfNei;
308 scalar maxFace =
max(vsfOwn, vsfNei);
309 scalar minFace =
min(vsfOwn, vsfNei);
310 const scalar maxMinFace = rk*(maxFace - minFace);
311 maxFace += maxMinFace;
312 minFace -= maxMinFace;
317 maxFace - vsfOwn, minFace - vsfOwn,
326 Info<<
"gradient limiter for: " << vvf.
name()
333 g.correctBoundaryConditions();
Graphite solid properties.
void size(const label n)
Older name for setAddressableSize.
fvPatchField< vector > fvPatchVectorField
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
Type gMin(const FieldField< Field, Type > &f)
makeFvGradScheme(faceLimitedGrad)
const word & name() const noexcept
Return the object name.
T & ref() const
Return non-const reference to the contents of a non-null managed pointer.
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< vector, fvsPatchField, surfaceMesh > surfaceVectorField
cellMask correctBoundaryConditions()
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< areaScalarField > limiter(const areaScalarField &phi)
GeometricField< vector, fvPatchField, volMesh > volVectorField
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
fvPatchField< scalar > fvPatchScalarField
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
const Mesh & mesh() const noexcept
Return mesh.
const uniformDimensionedVectorField & g
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
Type gAverage(const FieldField< Field, Type > &f)
Mesh data needed to do the Finite Volume discretisation.
messageStream Info
Information stream (stdout output on master, null elsewhere)
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, fvPatchField, volMesh > > calcGrad(const GeometricField< Type, fvPatchField, volMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
Field< vector > vectorField
Specialisation of Field<T> for vector.
A class for managing temporary objects.
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)