54 inline void edgeLimitedGrad<Type>::limitEdge
57 const scalar maxDelta,
58 const scalar minDelta,
59 const scalar extrapolate
62 if (extrapolate > maxDelta + VSMALL)
66 else if (extrapolate < minDelta - VSMALL)
82 const faMesh&
mesh = vsf.mesh();
84 tmp<areaVectorField> tGrad = basicGradScheme_().calcGrad(vsf,
name);
102 scalar rk = (1.0/k_ - 1.0);
106 label own = owner[edgei];
107 label nei = neighbour[edgei];
109 scalar vsfOwn = vsf[own];
110 scalar vsfNei = vsf[nei];
112 scalar maxEdge =
max(vsfOwn, vsfNei);
113 scalar minEdge =
min(vsfOwn, vsfNei);
114 scalar maxMinEdge = rk*(maxEdge - minEdge);
115 maxEdge += maxMinEdge;
116 minEdge -= maxMinEdge;
122 maxEdge - vsfOwn, minEdge - vsfOwn,
123 (Cf[edgei] -
C[own]) &
g[own]
130 maxEdge - vsfNei, minEdge - vsfNei,
131 (Cf[edgei] -
C[nei]) &
g[nei]
142 const vectorField& pCf = Cf.boundaryField()[patchi];
146 const scalarField psfNei(psf.patchNeighbourField());
150 label own = pOwner[pEdgei];
152 scalar vsfOwn = vsf[own];
153 scalar vsfNei = psfNei[pEdgei];
155 scalar maxEdge =
max(vsfOwn, vsfNei);
156 scalar minEdge =
min(vsfOwn, vsfNei);
157 scalar maxMinEdge = rk*(maxEdge - minEdge);
158 maxEdge += maxMinEdge;
159 minEdge -= maxMinEdge;
164 maxEdge - vsfOwn, minEdge - vsfOwn,
165 (pCf[pEdgei] -
C[own]) &
g[own]
169 else if (psf.fixesValue())
173 label own = pOwner[pEdgei];
175 scalar vsfOwn = vsf[own];
176 scalar vsfNei = psf[pEdgei];
178 scalar maxEdge =
max(vsfOwn, vsfNei);
179 scalar minEdge =
min(vsfOwn, vsfNei);
180 scalar maxMinEdge = rk*(maxEdge - minEdge);
181 maxEdge += maxMinEdge;
182 minEdge -= maxMinEdge;
187 maxEdge - vsfOwn, minEdge - vsfOwn,
188 (pCf[pEdgei] -
C[own]) &
g[own]
196 Info<<
"gradient limiter for: " << vsf.name()
203 g.correctBoundaryConditions();
217 const faMesh&
mesh = vvf.mesh();
219 tmp<areaTensorField> tGrad = basicGradScheme_().grad(vvf,
name);
237 scalar rk = (1.0/k_ - 1.0);
241 label own = owner[edgei];
242 label nei = neighbour[edgei];
248 vector gradf = (Cf[edgei] -
C[own]) &
g[own];
250 scalar vsfOwn = gradf & vvfOwn;
251 scalar vsfNei = gradf & vvfNei;
253 scalar maxEdge =
max(vsfOwn, vsfNei);
254 scalar minEdge =
min(vsfOwn, vsfNei);
255 scalar maxMinEdge = rk*(maxEdge - minEdge);
256 maxEdge += maxMinEdge;
257 minEdge -= maxMinEdge;
262 maxEdge - vsfOwn, minEdge - vsfOwn,
268 gradf = (Cf[edgei] -
C[nei]) &
g[nei];
270 vsfOwn = gradf & vvfOwn;
271 vsfNei = gradf & vvfNei;
273 maxEdge =
max(vsfOwn, vsfNei);
274 minEdge =
min(vsfOwn, vsfNei);
279 maxEdge - vsfNei, minEdge - vsfNei,
292 const vectorField& pCf = Cf.boundaryField()[patchi];
296 const vectorField psfNei(psf.patchNeighbourField());
300 label own = pOwner[pEdgei];
303 vector vvfNei = psfNei[pEdgei];
305 vector gradf = (pCf[pEdgei] -
C[own]) &
g[own];
307 scalar vsfOwn = gradf & vvfOwn;
308 scalar vsfNei = gradf & vvfNei;
310 scalar maxEdge =
max(vsfOwn, vsfNei);
311 scalar minEdge =
min(vsfOwn, vsfNei);
312 scalar maxMinEdge = rk*(maxEdge - minEdge);
313 maxEdge += maxMinEdge;
314 minEdge -= maxMinEdge;
319 maxEdge - vsfOwn, minEdge - vsfOwn,
324 else if (psf.fixesValue())
328 label own = pOwner[pEdgei];
331 vector vvfNei = psf[pEdgei];
333 vector gradf = (pCf[pEdgei] -
C[own]) &
g[own];
335 scalar vsfOwn = gradf & vvfOwn;
336 scalar vsfNei = gradf & vvfNei;
338 scalar maxEdge =
max(vsfOwn, vsfNei);
339 scalar minEdge =
min(vsfOwn, vsfNei);
340 scalar maxMinEdge = rk*(maxEdge - minEdge);
341 maxEdge += maxMinEdge;
342 minEdge -= maxMinEdge;
347 maxEdge - vsfOwn, minEdge - vsfOwn,
356 Info<<
"gradient limiter for: " << vvf.name()
363 g.correctBoundaryConditions();
faPatchField< scalar > faPatchScalarField
Type gMin(const FieldField< Field, Type > &f)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricBoundaryField< scalar, faPatchField, areaMesh > Boundary
Type of boundary fields.
makeFaGradScheme(edgeLimitedGrad)
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
tmp< areaScalarField > limiter(const areaScalarField &phi)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
GeometricField< vector, faePatchField, edgeMesh > edgeVectorField
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
GeometricField< tensor, faPatchField, areaMesh > areaTensorField
const uniformDimensionedVectorField & g
int debug
Static debugging option.
Type gMax(const FieldField< Field, Type > &f)
Type gAverage(const FieldField< Field, Type > &f)
static void correctBoundaryConditions(const GeometricField< Type, faPatchField, areaMesh > &, GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > &)
Correct the boundary values of the gradient using the patchField.
faPatchField< vector > faPatchVectorField
messageStream Info
Information stream (stdout output on master, null elsewhere)
Field< vector > vectorField
Specialisation of Field<T> for vector.
virtual tmp< GeometricField< typename outerProduct< vector, Type >::type, faPatchField, areaMesh > > calcGrad(const GeometricField< Type, faPatchField, areaMesh > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad for optional caching.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
GeometricField< scalar, faPatchField, areaMesh > areaScalarField