46 const fvMesh&
mesh = vsf.mesh();
48 tmp<volVectorField> tGrad = basicGradScheme_().calcGrad(vsf,
name);
66 scalar rk = (1.0/k_ - 1.0);
70 label own = owner[facei];
71 label nei = neighbour[facei];
73 scalar vsfOwn = vsf[own];
74 scalar vsfNei = vsf[nei];
76 scalar maxFace =
max(vsfOwn, vsfNei);
77 scalar minFace =
min(vsfOwn, vsfNei);
78 scalar maxMinFace = rk*(maxFace - minFace);
79 maxFace += maxMinFace;
80 minFace -= maxMinFace;
86 maxFace - vsfOwn, minFace - vsfOwn,
87 (Cf[facei] -
C[own]) & g[own]
94 maxFace - vsfNei, minFace - vsfNei,
95 (Cf[facei] -
C[nei]) & g[nei]
99 const volScalarField::Boundary& bsf = vsf.boundaryField();
110 const scalarField psfNei(psf.patchNeighbourField());
114 label own = pOwner[pFacei];
116 scalar vsfOwn = vsf[own];
117 scalar vsfNei = psfNei[pFacei];
119 scalar maxFace =
max(vsfOwn, vsfNei);
120 scalar minFace =
min(vsfOwn, vsfNei);
121 scalar maxMinFace = rk*(maxFace - minFace);
122 maxFace += maxMinFace;
123 minFace -= maxMinFace;
128 maxFace - vsfOwn, minFace - vsfOwn,
129 (pCf[pFacei] -
C[own]) & g[own]
133 else if (psf.fixesValue())
137 label own = pOwner[pFacei];
139 scalar vsfOwn = vsf[own];
140 scalar vsfNei = psf[pFacei];
142 scalar maxFace =
max(vsfOwn, vsfNei);
143 scalar minFace =
min(vsfOwn, vsfNei);
144 scalar maxMinFace = rk*(maxFace - minFace);
145 maxFace += maxMinFace;
146 minFace -= maxMinFace;
151 maxFace - vsfOwn, minFace - vsfOwn,
152 (pCf[pFacei] -
C[own]) & g[own]
160 Info<<
"gradient limiter for: " << vsf.name()
166 g.primitiveFieldRef() *=
limiter;
167 g.correctBoundaryConditions();
202 scalar rk = (1.0/k_ - 1.0);
206 label own = owner[facei];
207 label nei = neighbour[facei];
213 vector gradf = (Cf[facei] -
C[own]) & g[own];
215 scalar vsfOwn = gradf & vvfOwn;
216 scalar vsfNei = gradf & vvfNei;
218 scalar maxFace =
max(vsfOwn, vsfNei);
219 scalar minFace =
min(vsfOwn, vsfNei);
220 scalar maxMinFace = rk*(maxFace - minFace);
221 maxFace += maxMinFace;
222 minFace -= maxMinFace;
227 maxFace - vsfOwn, minFace - vsfOwn,
233 gradf = (Cf[facei] -
C[nei]) & g[nei];
235 vsfOwn = gradf & vvfOwn;
236 vsfNei = gradf & vvfNei;
238 maxFace =
max(vsfOwn, vsfNei);
239 minFace =
min(vsfOwn, vsfNei);
244 maxFace - vsfNei, minFace - vsfNei,
265 label own = pOwner[pFacei];
268 vector vvfNei = psfNei[pFacei];
270 vector gradf = (pCf[pFacei] -
C[own]) & g[own];
272 scalar vsfOwn = gradf & vvfOwn;
273 scalar vsfNei = gradf & vvfNei;
275 scalar maxFace =
max(vsfOwn, vsfNei);
276 scalar minFace =
min(vsfOwn, vsfNei);
277 scalar maxMinFace = rk*(maxFace - minFace);
278 maxFace += maxMinFace;
279 minFace -= maxMinFace;
284 maxFace - vsfOwn, minFace - vsfOwn,
293 label own = pOwner[pFacei];
296 vector vvfNei = psf[pFacei];
298 vector gradf = (pCf[pFacei] -
C[own]) & g[own];
300 scalar vsfOwn = gradf & vvfOwn;
301 scalar vsfNei = gradf & vvfNei;
303 scalar maxFace =
max(vsfOwn, vsfNei);
304 scalar minFace =
min(vsfOwn, vsfNei);
305 scalar maxMinFace = rk*(maxFace - minFace);
306 maxFace += maxMinFace;
307 minFace -= maxMinFace;
312 maxFace - vsfOwn, minFace - vsfOwn,
321 Info<<
"gradient limiter for: " << vvf.
name()
#define forAll(list, i)
Loop across all elements in list.
Graphite solid properties.
const GeoMesh & mesh() const
Return mesh.
Generic GeometricBoundaryField class.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
Internal::FieldType & primitiveFieldRef()
Return a reference to the primitive field.
const Internal::FieldType & primitiveField() const
Return a const-reference to the primitive field.
void correctBoundaryConditions()
Correct boundary field.
const word & name() const
Return name.
Mesh data needed to do the Finite Volume discretisation.
const volVectorField & C() const
Return cell centres.
const labelUList & owner() const
Internal face owner.
const fvBoundaryMesh & boundary() const
Return reference to boundary mesh.
const surfaceVectorField & Cf() const
Return face centres.
const labelUList & neighbour() const
Internal face neighbour.
Abstract base class with a fat-interface to all derived classes covering all possible ways in which t...
virtual bool fixesValue() const
Return true if this patch field fixes a value.
virtual bool coupled() const
Return true if this patch field is coupled.
virtual tmp< Field< Type > > patchNeighbourField(const Pstream::commsTypes commsType=Pstream::commsTypes::blocking) const
Return patchField on the opposite patch of a coupled patch.
virtual tmp< VolField< typename outerProduct< vector, Type >::type > > calcGrad(const VolField< Type > &vsf, const word &name) const
Return the gradient of the given field to the gradScheme::grad.
A class for managing temporary objects.
T & ref() const
Return non-const reference or generate a fatal error.
A class for handling words, derived from string.
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
makeFvGradScheme(faceLimitedGrad)
volScalarField scalarField(fieldObject, mesh)
volVectorField vectorField(fieldObject, mesh)
U correctBoundaryConditions()
void limiter(const control &controls, surfaceScalarField &lambda, const RdeltaTType &rDeltaT, const RhoType &rho, const volScalarField &psi, const scalarField &SuCorr, const surfaceScalarField &phi, const surfaceScalarField &phiCorr, const SpType &Sp, const PsiMaxType &psiMax, const PsiMinType &psiMin)
static const coefficient C("C", dimTemperature, 234.5)
Type gMin(const UList< Type > &f, const label comm)
VolField< vector > volVectorField
Type gAverage(const UList< Type > &f, const label comm)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
VolField< scalar > volScalarField
dimensioned< Type > min(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
Type gMax(const UList< Type > &f, const label comm)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
SurfaceField< vector > surfaceVectorField
tmp< DimensionedField< scalar, GeoMesh, Field > > magSqr(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
UList< label > labelUList
dimensioned< Type > max(const DimensionedField< Type, GeoMesh, PrimitiveField > &df)
fvPatchField< scalar > fvPatchScalarField