53inline void edgeLimitedGrad<Type>::limitEdge
56 const scalar maxDelta,
57 const scalar minDelta,
58 const scalar extrapolate
61 if (extrapolate > maxDelta + VSMALL)
65 else if (extrapolate < minDelta - VSMALL)
75tmp<areaVectorField> edgeLimitedGrad<scalar>::grad
80 const faMesh&
mesh = vsf.mesh();
82 tmp<areaVectorField> tGrad = basicGradScheme_().grad(vsf);
100 scalar rk = (1.0/k_ - 1.0);
104 label own = owner[edgei];
105 label nei = neighbour[edgei];
107 scalar vsfOwn = vsf[own];
108 scalar vsfNei = vsf[nei];
110 scalar maxEdge =
max(vsfOwn, vsfNei);
111 scalar minEdge =
min(vsfOwn, vsfNei);
112 scalar maxMinEdge = rk*(maxEdge - minEdge);
113 maxEdge += maxMinEdge;
114 minEdge -= maxMinEdge;
120 maxEdge - vsfOwn, minEdge - vsfOwn,
121 (Cf[edgei] -
C[own]) &
g[own]
128 maxEdge - vsfNei, minEdge - vsfNei,
129 (Cf[edgei] -
C[nei]) &
g[nei]
140 const vectorField& pCf = Cf.boundaryField()[patchi];
144 const scalarField psfNei(psf.patchNeighbourField());
148 label own = pOwner[pEdgei];
150 scalar vsfOwn = vsf[own];
151 scalar vsfNei = psfNei[pEdgei];
153 scalar maxEdge =
max(vsfOwn, vsfNei);
154 scalar minEdge =
min(vsfOwn, vsfNei);
155 scalar maxMinEdge = rk*(maxEdge - minEdge);
156 maxEdge += maxMinEdge;
157 minEdge -= maxMinEdge;
162 maxEdge - vsfOwn, minEdge - vsfOwn,
163 (pCf[pEdgei] -
C[own]) &
g[own]
167 else if (psf.fixesValue())
171 label own = pOwner[pEdgei];
173 scalar vsfOwn = vsf[own];
174 scalar vsfNei = psf[pEdgei];
176 scalar maxEdge =
max(vsfOwn, vsfNei);
177 scalar minEdge =
min(vsfOwn, vsfNei);
178 scalar maxMinEdge = rk*(maxEdge - minEdge);
179 maxEdge += maxMinEdge;
180 minEdge -= maxMinEdge;
185 maxEdge - vsfOwn, minEdge - vsfOwn,
186 (pCf[pEdgei] -
C[own]) &
g[own]
194 Info<<
"gradient limiter for: " << vsf.name()
201 g.correctBoundaryConditions();
209tmp<areaTensorField> edgeLimitedGrad<vector>::grad
214 const faMesh&
mesh = vvf.mesh();
216 tmp<areaTensorField> tGrad = basicGradScheme_().grad(vvf);
234 scalar rk = (1.0/k_ - 1.0);
238 label own = owner[edgei];
239 label nei = neighbour[edgei];
245 vector gradf = (Cf[edgei] -
C[own]) &
g[own];
247 scalar vsfOwn = gradf & vvfOwn;
248 scalar vsfNei = gradf & vvfNei;
250 scalar maxEdge =
max(vsfOwn, vsfNei);
251 scalar minEdge =
min(vsfOwn, vsfNei);
252 scalar maxMinEdge = rk*(maxEdge - minEdge);
253 maxEdge += maxMinEdge;
254 minEdge -= maxMinEdge;
259 maxEdge - vsfOwn, minEdge - vsfOwn,
265 gradf = (Cf[edgei] -
C[nei]) &
g[nei];
267 vsfOwn = gradf & vvfOwn;
268 vsfNei = gradf & vvfNei;
270 maxEdge =
max(vsfOwn, vsfNei);
271 minEdge =
min(vsfOwn, vsfNei);
276 maxEdge - vsfNei, minEdge - vsfNei,
289 const vectorField& pCf = Cf.boundaryField()[patchi];
293 const vectorField psfNei(psf.patchNeighbourField());
297 label own = pOwner[pEdgei];
300 vector vvfNei = psfNei[pEdgei];
302 vector gradf = (pCf[pEdgei] -
C[own]) &
g[own];
304 scalar vsfOwn = gradf & vvfOwn;
305 scalar vsfNei = gradf & vvfNei;
307 scalar maxEdge =
max(vsfOwn, vsfNei);
308 scalar minEdge =
min(vsfOwn, vsfNei);
309 scalar maxMinEdge = rk*(maxEdge - minEdge);
310 maxEdge += maxMinEdge;
311 minEdge -= maxMinEdge;
316 maxEdge - vsfOwn, minEdge - vsfOwn,
321 else if (psf.fixesValue())
325 label own = pOwner[pEdgei];
328 vector vvfNei = psf[pEdgei];
330 vector gradf = (pCf[pEdgei] -
C[own]) &
g[own];
332 scalar vsfOwn = gradf & vvfOwn;
333 scalar vsfNei = gradf & vvfNei;
335 scalar maxEdge =
max(vsfOwn, vsfNei);
336 scalar minEdge =
min(vsfOwn, vsfNei);
337 scalar maxMinEdge = rk*(maxEdge - minEdge);
338 maxEdge += maxMinEdge;
339 minEdge -= maxMinEdge;
344 maxEdge - vsfOwn, minEdge - vsfOwn,
353 Info<<
"gradient limiter for: " << vvf.name()
360 g.correctBoundaryConditions();
const uniformDimensionedVectorField & g
GeometricBoundaryField< scalar, faPatchField, areaMesh > Boundary
Type of boundary fields.
void correctBoundaryConditions()
Correct boundary field.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
#define makeFaGradScheme(SS)
label max(const labelHashSet &set, label maxValue=labelMin)
Find the max value in labelHashSet, optionally limited by second argument.
GeometricField< vector, faePatchField, edgeMesh > edgeVectorField
messageStream Info
Information stream (stdout output on master, null elsewhere)
GeometricField< tensor, faPatchField, areaMesh > areaTensorField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
faPatchField< vector > faPatchVectorField
Ostream & endl(Ostream &os)
Add newline and flush stream.
GeometricField< vector, faPatchField, areaMesh > areaVectorField
label min(const labelHashSet &set, label minValue=labelMax)
Find the min value in labelHashSet, optionally limited by second argument.
GeometricField< scalar, faPatchField, areaMesh > areaScalarField
Field< vector > vectorField
Specialisation of Field<T> for vector.
Type gAverage(const FieldField< Field, Type > &f)
Type gMin(const FieldField< Field, Type > &f)
UList< label > labelUList
A UList of labels.
Type gMax(const FieldField< Field, Type > &f)
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
faPatchField< scalar > faPatchScalarField
tmp< areaScalarField > limiter(const areaScalarField &phi)
#define forAll(list, i)
Loop across all elements in list.