27 #include "surfaceInterpolate.H"
44 scalar backwardDdtScheme<Type>::deltaT_()
const
46 return mesh().time().deltaTValue();
51 scalar backwardDdtScheme<Type>::deltaT0_()
const
53 return mesh().time().deltaT0Value();
58 template<
class GeoField>
59 scalar backwardDdtScheme<Type>::deltaT0_(
const GeoField& vf)
const
61 if (vf.nOldTimes() < 2)
83 const word ddtName(
"ddt("+dt.
name()+
')');
85 const scalar deltaT = deltaT_();
86 const scalar deltaT0 = deltaT0_();
88 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
89 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
90 const scalar coefft0 = coefft + coefft00;
109 tdtdt.
ref().primitiveFieldRef() = rDeltaT.
value()*dt.
value()*
111 coefft - (coefft0*mesh().V0() - coefft00*mesh().V00())/mesh().V()
146 const word ddtName(
"ddt("+vf.
name()+
')');
148 const scalar deltaT = deltaT_();
149 const scalar deltaT0 = deltaT0_(vf);
151 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
152 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
153 const scalar coefft0 = coefft + coefft00;
166 coefft0*vf.
oldTime()()*mesh().V0()
167 - coefft00*vf.
oldTime().oldTime()()
175 coefft0*vf.
oldTime().boundaryField()
176 - coefft00*vf.
oldTime().oldTime().boundaryField()
193 + coefft00*vf.
oldTime().oldTime()
211 const word ddtName(
"ddt("+
rho.name()+
','+vf.
name()+
')');
213 const scalar deltaT = deltaT_();
214 const scalar deltaT0 = deltaT0_(vf);
216 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
217 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
218 const scalar coefft0 = coefft + coefft00;
231 coefft0*vf.
oldTime()()*mesh().V0()
232 - coefft00*vf.
oldTime().oldTime()()
240 coefft0*vf.
oldTime().boundaryField()
241 - coefft00*vf.
oldTime().oldTime().boundaryField()
258 + coefft00*vf.
oldTime().oldTime()
276 const word ddtName(
"ddt("+
rho.name()+
','+vf.
name()+
')');
278 const scalar deltaT = deltaT_();
279 const scalar deltaT0 = deltaT0_(vf);
281 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
282 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
283 const scalar coefft0 = coefft + coefft00;
296 coefft0*
rho.oldTime()()
298 - coefft00*
rho.oldTime().oldTime()()
299 *vf.
oldTime().oldTime()()*mesh().V00()
306 coefft0*
rho.oldTime().boundaryField()
308 - coefft00*
rho.oldTime().oldTime().boundaryField()
309 *vf.
oldTime().oldTime().boundaryField()
326 + coefft00*
rho.oldTime().oldTime()*vf.
oldTime().oldTime()
347 const scalar deltaT = deltaT_();
348 const scalar deltaT0 = deltaT0_(vf);
350 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
351 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
352 const scalar coefft0 = coefft + coefft00;
369 *
alpha.oldTime().oldTime()()*
rho.oldTime().oldTime()()
370 *vf.
oldTime().oldTime()()*mesh().V00()
376 *
alpha.boundaryField()
381 *
alpha.oldTime().boundaryField()
382 *
rho.oldTime().boundaryField()
386 *
alpha.oldTime().oldTime().boundaryField()
387 *
rho.oldTime().oldTime().boundaryField()
388 *vf.
oldTime().oldTime().boundaryField()
405 + coefft00*
alpha.oldTime().oldTime()
406 *
rho.oldTime().oldTime()*vf.
oldTime().oldTime()
432 const scalar rDeltaT = 1.0/deltaT_();
434 const scalar deltaT = deltaT_();
435 const scalar deltaT0 = deltaT0_(vf);
437 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
438 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
439 const scalar coefft0 = coefft + coefft00;
441 fvm.
diag() = (coefft*rDeltaT)*mesh().V();
447 coefft0*vf.
oldTime().primitiveField()*mesh().V0()
448 - coefft00*vf.
oldTime().oldTime().primitiveField()
454 fvm.
source() = rDeltaT*mesh().V()*
456 coefft0*vf.
oldTime().primitiveField()
457 - coefft00*vf.
oldTime().oldTime().primitiveField()
483 const scalar rDeltaT = 1.0/deltaT_();
485 const scalar deltaT = deltaT_();
486 const scalar deltaT0 = deltaT0_(vf);
488 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
489 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
490 const scalar coefft0 = coefft + coefft00;
492 fvm.
diag() = (coefft*rDeltaT*
rho.value())*mesh().V();
498 coefft0*vf.
oldTime().primitiveField()*mesh().V0()
499 - coefft00*vf.
oldTime().oldTime().primitiveField()
505 fvm.
source() = rDeltaT*mesh().V()*
rho.value()*
507 coefft0*vf.
oldTime().primitiveField()
508 - coefft00*vf.
oldTime().oldTime().primitiveField()
534 const scalar rDeltaT = 1.0/deltaT_();
536 const scalar deltaT = deltaT_();
537 const scalar deltaT0 = deltaT0_(vf);
539 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
540 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
541 const scalar coefft0 = coefft + coefft00;
543 fvm.
diag() = (coefft*rDeltaT)*
rho.primitiveField()*mesh().V();
549 coefft0*
rho.oldTime().primitiveField()
550 *vf.
oldTime().primitiveField()*mesh().V0()
551 - coefft00*
rho.oldTime().oldTime().primitiveField()
552 *vf.
oldTime().oldTime().primitiveField()*mesh().V00()
557 fvm.
source() = rDeltaT*mesh().V()*
559 coefft0*
rho.oldTime().primitiveField()
561 - coefft00*
rho.oldTime().oldTime().primitiveField()
562 *vf.
oldTime().oldTime().primitiveField()
593 const scalar rDeltaT = 1.0/deltaT_();
595 const scalar deltaT = deltaT_();
596 const scalar deltaT0 = deltaT0_(vf);
598 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
599 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
600 const scalar coefft0 = coefft + coefft00;
603 (coefft*rDeltaT)*
alpha.primitiveField()*
rho.primitiveField()*mesh().V();
610 *
alpha.oldTime().primitiveField()
611 *
rho.oldTime().primitiveField()
612 *vf.
oldTime().primitiveField()*mesh().V0()
615 *
alpha.oldTime().oldTime().primitiveField()
616 *
rho.oldTime().oldTime().primitiveField()
617 *vf.
oldTime().oldTime().primitiveField()*mesh().V00()
622 fvm.
source() = rDeltaT*mesh().V()*
625 *
alpha.oldTime().primitiveField()
626 *
rho.oldTime().primitiveField()
630 *
alpha.oldTime().oldTime().primitiveField()
631 *
rho.oldTime().oldTime().primitiveField()
632 *vf.
oldTime().oldTime().primitiveField()
650 const scalar deltaT = deltaT_();
651 const scalar deltaT0 = deltaT0_(
U);
653 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
654 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
655 const scalar coefft0 = coefft + coefft00;
659 "ddtCorr(" +
U.name() +
',' + Uf.
name() +
')',
660 this->fvcDdtPhiCoeff(
U.oldTime(), (mesh().Sf() & Uf.
oldTime()))
668 coefft0*
U.oldTime() - coefft00*
U.oldTime().oldTime()
686 const scalar deltaT = deltaT_();
687 const scalar deltaT0 = deltaT0_(
U);
689 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
690 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
691 const scalar coefft0 = coefft + coefft00;
695 "ddtCorr(" +
U.name() +
',' + phi.
name() +
')',
696 this->fvcDdtPhiCoeff(
U.oldTime(), phi.
oldTime())
703 coefft0*
U.oldTime() - coefft00*
U.oldTime().oldTime()
721 const scalar deltaT = deltaT_();
722 const scalar deltaT0 = deltaT0_(
U);
724 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
725 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
726 const scalar coefft0 = coefft + coefft00;
736 rho.oldTime()*
U.oldTime()
741 rho.oldTime().oldTime()*
U.oldTime().oldTime()
746 "ddtCorr(" +
rho.name() +
',' +
U.name() +
',' + rhoUf.
name() +
')',
759 - coefft00*rhoUf.
oldTime().oldTime()
774 "ddtCorr(" +
rho.name() +
',' +
U.name() +
',' + rhoUf.
name() +
')',
787 - coefft00*rhoUf.
oldTime().oldTime()
792 - coefft00*
U.oldTime().oldTime()
801 <<
"dimensions of phi are not correct"
804 return fluxFieldType::null();
820 const scalar deltaT = deltaT_();
821 const scalar deltaT0 = deltaT0_(
U);
823 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
824 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
825 const scalar coefft0 = coefft + coefft00;
835 rho.oldTime()*
U.oldTime()
840 rho.oldTime().oldTime()*
U.oldTime().oldTime()
845 "ddtCorr(" +
rho.name() +
',' +
U.name() +
',' + phi.
name() +
')',
846 this->fvcDdtPhiCoeff(rhoU0, phi.
oldTime(),
rho.oldTime())
853 coefft0*rhoU0 - coefft00*rhoU00
866 "ddtCorr(" +
rho.name() +
',' +
U.name() +
',' + phi.
name() +
')',
867 this->fvcDdtPhiCoeff(
U.oldTime(), phi.
oldTime(),
rho.oldTime())
874 coefft0*
U.oldTime() - coefft00*
U.oldTime().oldTime()
882 <<
"dimensions of phi are not correct"
885 return fluxFieldType::null();
902 const scalar deltaT = deltaT_();
903 const scalar deltaT0 = deltaT0_(
U);
905 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
906 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
907 const scalar coefft0 = coefft + coefft00;
914 alpha.oldTime().oldTime()*
rho.oldTime().oldTime()
920 +
alpha.name() +
rho.name() +
',' +
U.name() +
',' + Uf.
name()
922 this->fvcDdtPhiCoeff(
U.oldTime(), mesh().Sf() & Uf.
oldTime())
934 coefft0*alphaRho0*
U.oldTime()
935 - coefft00*alphaRho00*
U.oldTime().oldTime()
944 <<
"dimensions of phi are not correct"
947 return fluxFieldType::null();
964 const scalar deltaT = deltaT_();
965 const scalar deltaT0 = deltaT0_(
U);
967 const scalar coefft = 1 + deltaT/(deltaT + deltaT0);
968 const scalar coefft00 = deltaT*deltaT/(deltaT0*(deltaT + deltaT0));
969 const scalar coefft0 = coefft + coefft00;
976 alpha.oldTime().oldTime()*
rho.oldTime().oldTime()
982 +
alpha.name() +
rho.name() +
',' +
U.name() +
',' + phi.
name()
984 this->fvcDdtPhiCoeff(
U.oldTime(), phi.
oldTime())
995 coefft0*alphaRho0*
U.oldTime()
996 - coefft00*alphaRho00*
U.oldTime().oldTime()
1004 <<
"dimensions of phi are not correct"
1007 return fluxFieldType::null();
1012 template<
class Type>
1018 const scalar deltaT = deltaT_();
1019 const scalar deltaT0 = deltaT0_(vf);
1022 const scalar coefft0_00 = deltaT/(deltaT + deltaT0);
1025 const scalar coefftn_0 = 1 + coefft0_00;
1029 mesh().phi().
name(),
1030 coefftn_0*mesh().phi() - coefft0_00*mesh().phi().oldTime()
1035 template<
class Type>
1042 const scalar deltaT = deltaT_();
1043 const scalar deltaT0 = deltaT0_(vf);
1046 const scalar coefft0_00 = deltaT/(deltaT + deltaT0);
1049 const scalar coefftn_0 = 1 + coefft0_00;
1053 coefftn_0*mesh().phi().boundaryField()[
patchi]
1054 - coefft0_00*mesh().phi().oldTime().boundaryField()[
patchi]
const dimensionSet & dimensions() const
Return dimensions.
Generic GeometricField class.
const Boundary & boundaryField() const
Return const-reference to the boundary field.
static tmp< GeometricField< Type, PatchField, GeoMesh > > New(const word &name, const Internal &, const PtrList< PatchField< Type >> &, const HashPtrTable< Source > &=HashPtrTable< Source >())
Return a temporary field constructed from name,.
const word & name() const
Return name.
const FieldType & oldTime() const
Return the old time field.
This boundary condition is not designed to be evaluated; it is assumed that the value is assigned via...
Generic dimensioned Type class.
const dimensionSet & dimensions() const
Return const reference to dimensions.
const Type & value() const
Return const reference to value.
const word & name() const
Return const reference to name.
A special matrix type and solver, designed for finite volume solutions of scalar equations....
virtual tmp< fluxFieldType > fvcDdtPhiCorr(const VolField< Type > &U, const fluxFieldType &phi)
virtual tmp< fvMatrix< Type > > fvmDdt(const VolField< Type > &)
virtual tmp< surfaceScalarField > meshPhi(const VolField< Type > &)
virtual tmp< VolField< Type > > fvcDdt(const dimensioned< Type > &)
virtual tmp< fluxFieldType > fvcDdtUfCorr(const VolField< Type > &U, const SurfaceField< Type > &Uf)
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.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Calculate the divergence of the given field.
volScalarField alpha(IOobject("alpha", runTime.name(), mesh, IOobject::READ_IF_PRESENT, IOobject::AUTO_WRITE), lambda *max(Ua &U, zeroSensitivity))
autoPtr< CompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const viscosity &viscosity)
static tmp< SurfaceField< Type > > interpolate(const VolField< Type > &tvf, const surfaceScalarField &faceFlux, Istream &schemeData)
Interpolate field onto faces using scheme given by Istream.
static tmp< SurfaceField< typename innerProduct< vector, Type >::type > > dotInterpolate(const surfaceVectorField &Sf, const VolField< Type > &tvf)
Interpolate field onto faces.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
word name(const bool)
Return a word representation of a bool.
const dimensionSet dimVolumetricFlux
errorManip< error > abort(error &err)
const dimensionSet dimTime
const dimensionSet dimVolume
const dimensionSet dimVelocity