30 #include "surfaceInterpolate.H" 46 void SLTSDdtScheme<Type>::relaxedDiag
60 diag[owner[facei]] +=
phi[facei];
61 rD[neighbour[facei]] +=
phi[facei];
65 diag[neighbour[facei]] -=
phi[facei];
66 rD[owner[facei]] -=
phi[facei];
73 const labelUList& faceCells = pphi.patch().patch().faceCells();
77 if (pphi[patchFacei] > 0.0)
79 diag[faceCells[patchFacei]] += pphi[patchFacei];
83 rD[faceCells[patchFacei]] -= pphi[patchFacei];
88 rD += (1.0/alpha_ - 2.0)*
diag;
93 tmp<volScalarField> SLTSDdtScheme<Type>::SLrDeltaT()
const 96 mesh().objectRegistry::template
97 lookupObject<surfaceScalarField>(phiName_);
119 relaxedDiag(rDeltaT,
phi);
121 if (
phi.dimensions() == dimensionSet(0, 3, -1, 0, 0))
123 rDeltaT.primitiveFieldRef() =
max 125 rDeltaT.primitiveField()/
mesh().V(),
126 scalar(1)/deltaT.value()
129 else if (
phi.dimensions() == dimensionSet(1, 0, -1, 0, 0))
132 mesh().objectRegistry::template lookupObject<volScalarField>
137 rDeltaT.primitiveFieldRef() =
max 139 rDeltaT.primitiveField()/(
rho.primitiveField()*
mesh().V()),
140 scalar(1)/deltaT.value()
146 <<
"Incorrect dimensions of phi: " <<
phi.dimensions()
150 rDeltaT.correctBoundaryConditions();
167 "ddt("+dt.
name()+
')',
168 mesh().time().timeName(),
184 tdtdt.
ref().primitiveFieldRef() =
189 tdtdt.ref().boundaryFieldRef().
190 template evaluateCoupled<coupledFvPatch>();
221 "ddt("+vf.
name()+
')',
222 mesh().time().timeName(),
249 tdtdt.
ref().boundaryFieldRef().
250 template evaluateCoupled<coupledFvPatch>();
256 return tmp<GeometricField<Type, fvPatchField, volMesh>>
258 new GeometricField<Type, fvPatchField, volMesh>
280 "ddt("+
rho.name()+
','+vf.
name()+
')',
281 mesh().time().timeName(),
308 tdtdt.
ref().boundaryFieldRef().
309 template evaluateCoupled<coupledFvPatch>();
315 return tmp<GeometricField<Type, fvPatchField, volMesh>>
317 new GeometricField<Type, fvPatchField, volMesh>
339 "ddt("+
rho.name()+
','+vf.
name()+
')',
340 mesh().time().timeName(),
356 -
rho.oldTime().primitiveField()
362 -
rho.oldTime().boundaryField()
370 tdtdt.
ref().boundaryFieldRef().
371 template evaluateCoupled<coupledFvPatch>();
377 return tmp<GeometricField<Type, fvPatchField, volMesh>>
379 new GeometricField<Type, fvPatchField, volMesh>
403 mesh().time().timeName(),
419 alpha.primitiveField()
420 *
rho.primitiveField()
423 -
alpha.oldTime().primitiveField()
424 *
rho.oldTime().primitiveField()
429 alpha.boundaryField()
433 -
alpha.oldTime().boundaryField()
434 *
rho.oldTime().boundaryField()
442 tdtdt.
ref().boundaryFieldRef().
443 template evaluateCoupled<coupledFvPatch>();
449 return tmp<GeometricField<Type, fvPatchField, volMesh>>
451 new GeometricField<Type, fvPatchField, volMesh>
483 scalarField rDeltaT(SLrDeltaT()().primitiveField());
518 scalarField rDeltaT(SLrDeltaT()().primitiveField());
555 scalarField rDeltaT(SLrDeltaT()().primitiveField());
557 fvm.
diag() = rDeltaT*
rho.primitiveField()*
mesh().V();
562 *
rho.oldTime().primitiveField()
568 *
rho.oldTime().primitiveField()
595 scalarField rDeltaT(SLrDeltaT()().primitiveField());
598 rDeltaT*
alpha.primitiveField()*
rho.primitiveField()*
mesh().Vsc();
603 *
alpha.oldTime().primitiveField()
604 *
rho.oldTime().primitiveField()
610 *
alpha.oldTime().primitiveField()
611 *
rho.oldTime().primitiveField()
629 fluxFieldType phiUf0(
mesh().Sf() &
Uf.oldTime());
630 fluxFieldType phiCorr
641 "ddtCorr(" +
U.name() +
',' +
Uf.name() +
')',
642 mesh().time().timeName(),
645 this->fvcDdtPhiCoeff(
U.oldTime(), phiUf0, phiCorr)
657 const fluxFieldType&
phi 662 fluxFieldType phiCorr
673 "ddtCorr(" +
U.name() +
',' +
phi.name() +
')',
674 mesh().time().timeName(),
677 this->fvcDdtPhiCoeff(
U.oldTime(),
phi.oldTime(), phiCorr)
703 rho.oldTime()*
U.oldTime()
706 fluxFieldType phiUf0(
mesh().Sf() &
Uf.oldTime());
716 +
rho.name() +
',' +
U.name() +
',' +
Uf.name() +
')',
717 mesh().time().timeName(),
720 this->fvcDdtPhiCoeff(rhoU0, phiUf0, phiCorr,
rho.oldTime())
731 fluxFieldType phiUf0(
mesh().Sf() &
Uf.oldTime());
732 fluxFieldType phiCorr
744 +
rho.name() +
',' +
U.name() +
',' +
Uf.name() +
')',
745 mesh().time().timeName(),
761 <<
"dimensions of Uf are not correct" 764 return fluxFieldType::null();
775 const fluxFieldType&
phi 788 rho.oldTime()*
U.oldTime()
791 fluxFieldType phiCorr
803 +
rho.name() +
',' +
U.name() +
',' +
phi.name() +
')',
804 mesh().time().timeName(),
823 fluxFieldType phiCorr
828 return tmp<fluxFieldType>
835 +
rho.name() +
',' +
U.name() +
',' +
phi.name() +
')',
836 mesh().time().timeName(),
852 <<
"dimensions of phi are not correct" 855 return fluxFieldType::null();
884 tmeshPhi.ref().setOriented();
fvsPatchField< scalar > fvsPatchScalarField
const scalarField & diag() const
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 > &)
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 > &)
static const word & calculatedType() noexcept
The type name for calculated patch fields.
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
static const word & extrapolatedCalculatedType() noexcept
The type name for extrapolatedCalculated patch fields combines zero-gradient and calculated.
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.
Do not request registration (bool: false)
const dimensionSet dimArea(sqr(dimLength))
const dimensionSet & dimensions() const noexcept
Return dimensions.
static constexpr const zero Zero
Global zero (0)
const dimensionSet dimVelocity