49 inline void edgeLimitedGrad<Type>::limitEdge
52 const scalar maxDelta,
53 const scalar minDelta,
54 const scalar extrapolate
57 if (extrapolate > maxDelta + VSMALL)
61 else if (extrapolate < minDelta - VSMALL)
77 const faMesh&
mesh = vsf.mesh();
79 tmp<areaVectorField> tGrad = basicGradScheme_().calcGrad(vsf,
name);
97 const scalar rk = (1.0/k_ - 1.0);
101 const label own = owner[edgei];
102 const label nei = neighbour[edgei];
104 const scalar vsfOwn = vsf[own];
105 const scalar vsfNei = vsf[nei];
107 scalar maxEdge =
max(vsfOwn, vsfNei);
108 scalar minEdge =
min(vsfOwn, vsfNei);
109 const scalar maxMinEdge = rk*(maxEdge - minEdge);
110 maxEdge += maxMinEdge;
111 minEdge -= maxMinEdge;
119 (Cf[edgei] -
C[own]) &
g[own]
128 (Cf[edgei] -
C[nei]) &
g[nei]
133 auto updateLimiter = [&](
const label patchi,
const scalarField&
fld) ->
void 136 const vectorField& pCf = Cf.boundaryField()[patchi];
140 const label own = pOwner[edgei];
142 const scalar vsfOwn = vsf[own];
143 const scalar vsfNei =
fld[edgei];
145 scalar maxEdge =
max(vsfOwn, vsfNei);
146 scalar minEdge =
min(vsfOwn, vsfNei);
147 const scalar maxMinEdge = rk*(maxEdge - minEdge);
148 maxEdge += maxMinEdge;
149 minEdge -= maxMinEdge;
156 (pCf[edgei] -
C[own]) &
g[own]
168 updateLimiter(patchi, psf.patchNeighbourField());
170 else if (psf.fixesValue())
172 updateLimiter(patchi, psf);
178 Info<<
"gradient limiter for: " << vsf.name()
185 g.correctBoundaryConditions();
199 const faMesh&
mesh = vvf.mesh();
201 tmp<areaTensorField> tGrad = basicGradScheme_().grad(vvf,
name);
219 const scalar rk = (1.0/k_ - 1.0);
223 const label own = owner[edgei];
224 const label nei = neighbour[edgei];
227 vector gradf((Cf[edgei] -
C[own]) &
g[own]);
229 scalar vsfOwn = gradf & vvf[own];
230 scalar vsfNei = gradf & vvf[nei];
232 scalar maxEdge =
max(vsfOwn, vsfNei);
233 scalar minEdge =
min(vsfOwn, vsfNei);
234 const scalar maxMinEdge = rk*(maxEdge - minEdge);
235 maxEdge += maxMinEdge;
236 minEdge -= maxMinEdge;
248 gradf = (Cf[edgei] -
C[nei]) &
g[nei];
250 vsfOwn = gradf & vvf[own];
251 vsfNei = gradf & vvf[nei];
253 maxEdge =
max(vsfOwn, vsfNei);
254 minEdge =
min(vsfOwn, vsfNei);
267 auto updateLimiter = [&](
const label patchi,
const vectorField&
fld) ->
void 270 const vectorField& pCf = Cf.boundaryField()[patchi];
274 const label own = pOwner[edgei];
276 const vector gradf((pCf[edgei] -
C[own]) &
g[own]);
278 const scalar vsfOwn = gradf & vvf[own];
279 const scalar vsfNei = gradf &
fld[edgei];
281 scalar maxEdge =
max(vsfOwn, vsfNei);
282 scalar minEdge =
min(vsfOwn, vsfNei);
283 const scalar maxMinEdge = rk*(maxEdge - minEdge);
284 maxEdge += maxMinEdge;
285 minEdge -= maxMinEdge;
305 updateLimiter(patchi, psf.patchNeighbourField());
307 else if (psf.fixesValue())
309 updateLimiter(patchi, psf);
315 Info<<
"gradient limiter for: " << vvf.name()
322 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.
tmp< areaScalarField > limiter(const areaScalarField &phi)
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 expressions::valueTypeCode::INVALID.
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)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< ' ';}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< ' ';}gmvFile<< nl;for(const word &name :lagrangianScalarNames){ IOField< scalar > fld(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
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