29 #include "surfaceInterpolate.H" 45 void SLTSDdtScheme<Type>::relaxedDiag
59 diag[owner[facei]] +=
phi[facei];
60 rD[neighbour[facei]] +=
phi[facei];
64 diag[neighbour[facei]] -=
phi[facei];
65 rD[owner[facei]] -=
phi[facei];
72 const labelUList& faceCells = pphi.patch().patch().faceCells();
76 if (pphi[patchFacei] > 0.0)
78 diag[faceCells[patchFacei]] += pphi[patchFacei];
82 rD[faceCells[patchFacei]] -= pphi[patchFacei];
87 rD += (1.0/alpha_ - 2.0)*
diag;
92 tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT()
const 95 mesh().objectRegistry::template
96 lookupObject<surfaceScalarField>(phiName_);
112 extrapolatedCalculatedFvPatchScalarField::typeName
118 relaxedDiag(rDeltaT,
phi);
120 if (
phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
122 rDeltaT.primitiveFieldRef() =
max 124 rDeltaT.primitiveField()/
mesh().V(),
125 scalar(1)/deltaT.value()
128 else if (
phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
131 mesh().objectRegistry::template lookupObject<volScalarField>
136 rDeltaT.primitiveFieldRef() =
max 138 rDeltaT.primitiveField()/(
rho.primitiveField()*
mesh().V()),
139 scalar(1)/deltaT.value()
145 <<
"Incorrect dimensions of phi: " <<
phi.dimensions()
149 rDeltaT.correctBoundaryConditions();
166 "ddt("+dt.
name()+
')',
167 mesh().time().timeName(),
183 tdtdt.
ref().primitiveFieldRef() =
215 "ddt("+vf.
name()+
')',
216 mesh().time().timeName(),
243 return tmp<GeometricField<Type, fvPatchField, volMesh>>
245 new GeometricField<Type, fvPatchField, volMesh>
267 "ddt("+
rho.name()+
','+vf.
name()+
')',
268 mesh().time().timeName(),
295 return tmp<GeometricField<Type, fvPatchField, volMesh>>
297 new GeometricField<Type, fvPatchField, volMesh>
319 "ddt("+
rho.name()+
','+vf.
name()+
')',
320 mesh().time().timeName(),
336 -
rho.oldTime().primitiveField()
342 -
rho.oldTime().boundaryField()
350 return tmp<GeometricField<Type, fvPatchField, volMesh>>
352 new GeometricField<Type, fvPatchField, volMesh>
376 mesh().time().timeName(),
392 alpha.primitiveField()
393 *
rho.primitiveField()
396 -
alpha.oldTime().primitiveField()
397 *
rho.oldTime().primitiveField()
402 alpha.boundaryField()
406 -
alpha.oldTime().boundaryField()
407 *
rho.oldTime().boundaryField()
415 return tmp<GeometricField<Type, fvPatchField, volMesh>>
417 new GeometricField<Type, fvPatchField, volMesh>
449 scalarField rDeltaT(SLrDeltaT()().primitiveField());
484 scalarField rDeltaT(SLrDeltaT()().primitiveField());
521 scalarField rDeltaT(SLrDeltaT()().primitiveField());
523 fvm.
diag() = rDeltaT*
rho.primitiveField()*
mesh().V();
528 *
rho.oldTime().primitiveField()
534 *
rho.oldTime().primitiveField()
561 scalarField rDeltaT(SLrDeltaT()().primitiveField());
564 rDeltaT*
alpha.primitiveField()*
rho.primitiveField()*
mesh().Vsc();
569 *
alpha.oldTime().primitiveField()
570 *
rho.oldTime().primitiveField()
576 *
alpha.oldTime().primitiveField()
577 *
rho.oldTime().primitiveField()
595 fluxFieldType phiUf0(
mesh().Sf() &
Uf.oldTime());
596 fluxFieldType phiCorr
607 "ddtCorr(" +
U.name() +
',' +
Uf.name() +
')',
608 mesh().time().timeName(),
611 this->fvcDdtPhiCoeff(
U.oldTime(), phiUf0, phiCorr)
623 const fluxFieldType&
phi 628 fluxFieldType phiCorr
639 "ddtCorr(" +
U.name() +
',' +
phi.name() +
')',
640 mesh().time().timeName(),
643 this->fvcDdtPhiCoeff(
U.oldTime(),
phi.oldTime(), phiCorr)
669 rho.oldTime()*
U.oldTime()
672 fluxFieldType phiUf0(
mesh().Sf() &
Uf.oldTime());
682 +
rho.name() +
',' +
U.name() +
',' +
Uf.name() +
')',
683 mesh().time().timeName(),
686 this->fvcDdtPhiCoeff(rhoU0, phiUf0, phiCorr,
rho.oldTime())
697 fluxFieldType phiUf0(
mesh().Sf() &
Uf.oldTime());
698 fluxFieldType phiCorr
710 +
rho.name() +
',' +
U.name() +
',' +
Uf.name() +
')',
711 mesh().time().timeName(),
727 <<
"dimensions of Uf are not correct" 730 return fluxFieldType::null();
741 const fluxFieldType&
phi 754 rho.oldTime()*
U.oldTime()
757 fluxFieldType phiCorr
769 +
rho.name() +
',' +
U.name() +
',' +
phi.name() +
')',
770 mesh().time().timeName(),
789 fluxFieldType phiCorr
794 return tmp<fluxFieldType>
801 +
rho.name() +
',' +
U.name() +
',' +
phi.name() +
')',
802 mesh().time().timeName(),
818 <<
"dimensions of phi are not correct" 821 return fluxFieldType::null();
850 tmeshPhi.ref().setOriented();
fvsPatchField< scalar > fvsPatchScalarField
const Type & value() const noexcept
Return const reference to value.
const GeometricField< Type, PatchField, GeoMesh > & oldTime() const
Return old time field.
Info<< "Creating field kinetic energy K\"<< endl;volScalarField K("K", 0.5 *magSqr(U));if(U.nOldTimes()){ volVectorField *Uold=&U.oldTime();volScalarField *Kold=&K.oldTime();*Kold==0.5 *magSqr(*Uold);while(Uold->nOldTimes()) { Uold=&Uold-> oldTime()
const Internal::FieldType & primitiveField() const noexcept
Return a const-reference to the internal field values.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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.
static tmp< GeometricField< typename innerProduct< vector, Type >::type, fvsPatchField, surfaceMesh > > dotInterpolate(const surfaceVectorField &Sf, const GeometricField< Type, fvPatchField, volMesh > &tvf)
Interpolate field onto faces.
const dimensionSet dimVol(dimVolume)
Older spelling for dimVolume.
Generic dimensioned Type class.
Ignore writing from objectRegistry::writeObject()
const dimensionSet dimless
Dimensionless.
UList< label > labelUList
A UList of labels.
#define forAll(list, i)
Loop across all elements in list.
GeometricField< scalar, fvPatchField, volMesh > volScalarField
const dimensionSet dimVolume(pow3(dimLength))
void diag(pointPatchField< vector > &, const pointPatchField< tensor > &)
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
tmp< GeometricField< Type, fvPatchField, volMesh > > fvcDdt(const dimensioned< Type > &)
This boundary condition is not designed to be evaluated; it is assmued that the value is assigned via...
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
autoPtr< surfaceVectorField > Uf
const dimensionSet & dimensions() const noexcept
Return const reference to dimensions.
tmp< fluxFieldType > fvcDdtUfCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const GeometricField< Type, fvsPatchField, surfaceMesh > &Uf)
errorManip< error > abort(error &err)
static tmp< GeometricField< Type, fvsPatchField, surfaceMesh > > interpolate(const GeometricField< Type, fvPatchField, volMesh > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
const dimensionSet dimDensity
const word & name() const noexcept
Return const reference to name.
Field< Type > & source() noexcept
dimensioned< scalar > dimensionedScalar
Dimensioned scalar obtained from generic dimensioned type.
tmp< surfaceScalarField > meshPhi(const GeometricField< Type, fvPatchField, volMesh > &)
const dimensionSet dimTime(0, 0, 1, 0, 0, 0, 0)
A special matrix type and solver, designed for finite volume solutions of scalar equations.
A class for managing temporary objects.
GeometricField< scalar, fvsPatchField, surfaceMesh > surfaceScalarField
tmp< fluxFieldType > fvcDdtPhiCorr(const GeometricField< Type, fvPatchField, volMesh > &U, const fluxFieldType &phi)
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
tmp< volScalarField > trDeltaT
Defines the attributes of an object for which implicit objectRegistry management is supported...
tmp< fvMatrix< Type > > fvmDdt(const GeometricField< Type, fvPatchField, volMesh > &)
const Boundary & boundaryField() const noexcept
Return const-reference to the boundary field.
const dimensionSet dimArea(sqr(dimLength))
const dimensionSet & dimensions() const noexcept
Return dimensions.
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity