STYLE: changes to Time and TimeState

- update TimeState access methods

- use writeTime() instead of old method name outputTime()

- use deltaTValue() instead of deltaT().value()
  to avoids pointless construct of intermediate
This commit is contained in:
Mark Olesen
2023-06-28 10:11:01 +02:00
parent 7a857b318a
commit d5a0eaeeee
56 changed files with 218 additions and 185 deletions

View File

@ -18,6 +18,6 @@ dimensionedScalar rho("rho", dimDensity, transportProperties);
scalar MaxCo = scalar MaxCo =
max(mesh.surfaceInterpolation::deltaCoeffs()*c0).value() max(mesh.surfaceInterpolation::deltaCoeffs()*c0).value()
*runTime.deltaT().value(); *runTime.deltaTValue();
Info<< "Max acoustic Courant Number = " << MaxCo << endl; Info<< "Max acoustic Courant Number = " << MaxCo << endl;

View File

@ -1,5 +1,5 @@
if (adjustTimeStep) if (adjustTimeStep)
{ {
runTime.setDeltaT(min(dtChem, maxDeltaT)); runTime.setDeltaT(min(dtChem, maxDeltaT));
Info<< "deltaT = " << runTime.deltaT().value() << endl; Info<< "deltaT = " << runTime.deltaTValue() << endl;
} }

View File

@ -1,3 +1,3 @@
dtChem = chemistry.solve(runTime.deltaT().value()); dtChem = chemistry.solve(runTime.deltaTValue());
scalar Qdot = chemistry.Qdot()()[0]/rho[0]; scalar Qdot = chemistry.Qdot()()[0]/rho[0];
integratedHeat += Qdot*runTime.deltaT().value(); integratedHeat += Qdot*runTime.deltaTValue();

View File

@ -7,7 +7,7 @@
*mag(aMesh.edgeInterpolation::deltaCoeffs()) *mag(aMesh.edgeInterpolation::deltaCoeffs())
/rhol /rhol
) )
).value()*runTime.deltaT().value(); ).value()*runTime.deltaTValue();
Info<< "Max Capillary Courant Number = " << CoNumSigma << '\n' << endl; Info<< "Max Capillary Courant Number = " << CoNumSigma << '\n' << endl;
} }

View File

@ -47,10 +47,10 @@ if (aMesh.nInternalEdges())
); );
CoNum = max(SfUfbyDelta/aMesh.magLe()) CoNum = max(SfUfbyDelta/aMesh.magLe())
.value()*runTime.deltaT().value(); .value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(aMesh.magLe())) meanCoNum = (sum(SfUfbyDelta)/sum(aMesh.magLe()))
.value()*runTime.deltaT().value(); .value()*runTime.deltaTValue();
velMag = max(mag(phis)/aMesh.magLe()).value(); velMag = max(mag(phis)/aMesh.magLe()).value();
} }

View File

@ -49,11 +49,11 @@ if (adjustTimeStep)
( (
min min
( (
min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaT().value(), min(maxCo/CoNum, maxDi/DiNum)*runTime.deltaTValue(),
min(runTime.deltaTValue(), maxDeltaT) min(runTime.deltaTValue(), maxDeltaT)
) )
); );
Info<< "deltaT = " << runTime.deltaT().value() << endl; Info<< "deltaT = " << runTime.deltaTValue() << endl;
} }
} }

View File

@ -59,12 +59,12 @@ if (adjustTimeStep)
( (
min min
( (
min(deltaTFluid, maxDeltaTSolid)*runTime.deltaT().value(), min(deltaTFluid, maxDeltaTSolid)*runTime.deltaTValue(),
maxDeltaT maxDeltaT
) )
); );
Info<< "deltaT = " << runTime.deltaT().value() << endl; Info<< "deltaT = " << runTime.deltaTValue() << endl;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -1075,7 +1075,7 @@ void Foam::multiphaseMixtureThermo::solveAlphas
MULES::limit MULES::limit
( (
1.0/mesh_.time().deltaT().value(), 1.0/mesh_.time().deltaTValue(),
geometricOneField(), geometricOneField(),
alpha, alpha,
phi_, phi_,

View File

@ -699,7 +699,7 @@ void Foam::radiation::laserDTRM::calculate()
scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V()); scalar totalQ = gSum(Q_.primitiveFieldRef()*mesh_.V());
Info << "Total energy absorbed [W]: " << totalQ << endl; Info << "Total energy absorbed [W]: " << totalQ << endl;
if (mesh_.time().outputTime()) if (mesh_.time().writeTime())
{ {
reflectingCellsVol.write(); reflectingCellsVol.write();
nHat.write(); nHat.write();

View File

@ -124,7 +124,7 @@ Foam::temperaturePhaseChangeTwoPhaseMixtures::constant::mDot() const
* max(TSat - T, T0) * max(TSat - T, T0)
); );
if (mesh_.time().outputTime()) if (mesh_.time().writeTime())
{ {
mDotC.write(); mDotC.write();
mDotE.write(); mDotE.write();

View File

@ -96,7 +96,7 @@
MULES::limiter MULES::limiter
( (
allLambda, allLambda,
1.0/runTime.deltaT().value(), 1.0/runTime.deltaTValue(),
geometricOneField(), geometricOneField(),
alpha1, alpha1,
alphaPhi1BD, alphaPhi1BD,
@ -164,7 +164,7 @@
MULES::limiter MULES::limiter
( (
allLambda, allLambda,
1.0/runTime.deltaT().value(), 1.0/runTime.deltaTValue(),
geometricOneField(), geometricOneField(),
alpha2, alpha2,
alphaPhi2BD, alphaPhi2BD,

View File

@ -628,7 +628,7 @@ void Foam::multiphaseMixture::solveAlphas
MULES::limit MULES::limit
( (
1.0/mesh_.time().deltaT().value(), 1.0/mesh_.time().deltaTValue(),
geometricOneField(), geometricOneField(),
alpha, alpha,
phi_, phi_,

View File

@ -20,7 +20,7 @@
IOobject rhoIO IOobject rhoIO
( (
"rho", "rho",
runTime.timeName(0), Time::timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -75,7 +75,7 @@
IOobject EHeader IOobject EHeader
( (
"E", "E",
runTime.timeName(0), Time::timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -127,7 +127,7 @@
IOobject nuIO IOobject nuIO
( (
"nu", "nu",
runTime.timeName(0), Time::timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -51,7 +51,7 @@ if (thermalStress)
IOobject CIO IOobject CIO
( (
"C", "C",
runTime.timeName(0), Time::timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -106,7 +106,7 @@ if (thermalStress)
IOobject rhoKIO IOobject rhoKIO
( (
"k", "k",
runTime.timeName(0), Time::timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
@ -161,7 +161,7 @@ if (thermalStress)
IOobject alphaIO IOobject alphaIO
( (
"alpha", "alpha",
runTime.timeName(0), Time::timeName(0),
mesh, mesh,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::NO_WRITE IOobject::NO_WRITE

View File

@ -73,7 +73,7 @@ Foam::Time::writeControlNames
}); });
Foam::Time::fmtflags Foam::Time::format_(Foam::Time::general); Foam::Time::fmtflags Foam::Time::format_(Foam::Time::fmtflags::general);
int Foam::Time::precision_(6); int Foam::Time::precision_(6);
@ -777,19 +777,13 @@ Foam::Time::~Time()
Foam::word Foam::Time::timeName(const scalar t, const int precision) Foam::word Foam::Time::timeName(const scalar t, const int precision)
{ {
std::ostringstream buf; std::ostringstream buf;
buf.setf(ios_base::fmtflags(format_), ios_base::floatfield); buf.setf(std::ios_base::fmtflags(format_), std::ios_base::floatfield);
buf.precision(precision); buf.precision(precision);
buf << t; buf << t;
return buf.str(); return buf.str();
} }
Foam::word Foam::Time::timeName() const
{
return dimensionedScalar::name();
}
Foam::word Foam::Time::findInstance Foam::word Foam::Time::findInstance
( (
const fileName& dir, const fileName& dir,
@ -1003,18 +997,14 @@ bool Foam::Time::isAdjustTimeStep() const
void Foam::Time::setTime(const Time& t) void Foam::Time::setTime(const Time& t)
{ {
value() = t.value(); resetTimeState(t.timeName(), t.value(), t.timeIndex());
dimensionedScalar::name() = t.dimensionedScalar::name();
timeIndex_ = t.timeIndex_;
fileHandler().setTime(*this); fileHandler().setTime(*this);
} }
void Foam::Time::setTime(const instant& inst, const label newIndex) void Foam::Time::setTime(const instant& inst, const label newIndex)
{ {
value() = inst.value(); resetTimeState(inst.name(), inst.value(), newIndex);
dimensionedScalar::name() = inst.name();
timeIndex_ = newIndex;
IOdictionary timeDict IOdictionary timeDict
( (
@ -1045,9 +1035,12 @@ void Foam::Time::setTime(const dimensionedScalar& newTime, const label newIndex)
void Foam::Time::setTime(const scalar newTime, const label newIndex) void Foam::Time::setTime(const scalar newTime, const label newIndex)
{ {
value() = newTime; resetTimeState
dimensionedScalar::name() = timeName(timeToUserTime(newTime)); (
timeIndex_ = newIndex; timeName(timeToUserTime(newTime)),
newTime,
newIndex
);
fileHandler().setTime(*this); fileHandler().setTime(*this);
} }

View File

@ -347,7 +347,17 @@ public:
// Member Functions // Member Functions
// Database functions // TimeState Functions
//- Return the current time name
using TimeState::timeName;
//- Return a time name for the given scalar time value
//- formatted with the given precision
static word timeName(const scalar t, const int precision = precision_);
// Database Functions
//- Return name from objectRegistry and not TimePaths //- Return name from objectRegistry and not TimePaths
using objectRegistry::name; using objectRegistry::name;
@ -365,7 +375,7 @@ public:
} }
//- Return read access to the controlDict dictionary //- Return read access to the controlDict dictionary
const dictionary& controlDict() const const dictionary& controlDict() const noexcept
{ {
return controlDict_; return controlDict_;
} }
@ -487,17 +497,6 @@ public:
// Access // Access
//- Return time name of given scalar time
//- formatted with the given precision
static word timeName
(
const scalar t,
const int precision = precision_
);
//- Return current time name
virtual word timeName() const;
//- Return start time index //- Return start time index
virtual label startTimeIndex() const; virtual label startTimeIndex() const;
@ -514,7 +513,7 @@ public:
virtual bool isAdjustTimeStep() const; virtual bool isAdjustTimeStep() const;
//- Return the list of function objects //- Return the list of function objects
const functionObjectList& functionObjects() const const functionObjectList& functionObjects() const noexcept
{ {
return functionObjects_; return functionObjects_;
} }
@ -644,13 +643,13 @@ public:
virtual void endSubCycle(); virtual void endSubCycle();
//- Return non-const access to the list of function objects //- Return non-const access to the list of function objects
functionObjectList& functionObjects() functionObjectList& functionObjects() noexcept
{ {
return functionObjects_; return functionObjects_;
} }
// Member operators // Member Operators
//- Set deltaT to that specified and increment time via operator++() //- Set deltaT to that specified and increment time via operator++()
virtual Time& operator+=(const dimensionedScalar& deltaT); virtual Time& operator+=(const dimensionedScalar& deltaT);

View File

@ -335,20 +335,20 @@ void Foam::Time::readDict()
if (formatName == "general") if (formatName == "general")
{ {
format_ = general; format_ = fmtflags::general;
} }
else if (formatName == "fixed") else if (formatName == "fixed")
{ {
format_ = fixed; format_ = fmtflags::fixed;
} }
else if (formatName == "scientific") else if (formatName == "scientific")
{ {
format_ = scientific; format_ = fmtflags::scientific;
} }
else else
{ {
WarningInFunction WarningInFunction
<< "unsupported time format " << formatName << "Unsupported time format " << formatName
<< endl; << endl;
} }
} }
@ -373,6 +373,7 @@ void Foam::Time::readDict()
endTime_ = 0; endTime_ = 0;
} }
// Adjust the TimeState name
dimensionedScalar::name() = timeName(value()); dimensionedScalar::name() = timeName(value());
if (controlDict_.found("writeVersion")) if (controlDict_.found("writeVersion"))

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2021 OpenCFD Ltd. Copyright (C) 2018-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -53,8 +53,19 @@ class TimeState
: :
public dimensionedScalar public dimensionedScalar
{ {
// Private Member Functions
// //- Dimensions for 1/time
// inline static dimensionSet dimInvTime()
// {
// return dimensionSet(0, 0, -1, 0, 0, 0, 0);
// }
protected: protected:
// Protected Data
label timeIndex_; label timeIndex_;
label writeTimeIndex_; label writeTimeIndex_;
@ -66,6 +77,22 @@ protected:
bool writeTime_; bool writeTime_;
// Protected Member Functions
//- Reset some of TimeState (name, value, index)
void resetTimeState
(
const word& newName,
const scalar newValue,
const label newIndex
)
{
dimensionedScalar::name() = newName;
dimensionedScalar::value() = newValue;
timeIndex_ = newIndex;
}
public: public:
// Constructors // Constructors
@ -78,43 +105,50 @@ public:
virtual ~TimeState() = default; virtual ~TimeState() = default;
// Member functions // Member Functions
// Access // Conversion
//- Convert the user-time (e.g. CA deg) to real-time (s). //- Convert the user-time (e.g. CA deg) to real-time (s).
virtual scalar userTimeToTime(const scalar theta) const; virtual scalar userTimeToTime(const scalar theta) const;
//- Convert the real-time (s) into user-time (e.g. CA deg) //- Convert the real-time (s) into user-time (e.g. CA deg)
virtual scalar timeToUserTime(const scalar t) const; virtual scalar timeToUserTime(const scalar t) const;
//- Return current time value
inline scalar timeOutputValue() const;
//- Return current time index
inline label timeIndex() const noexcept;
//- Return time step value
inline scalar deltaTValue() const noexcept;
//- Return old time step value
inline scalar deltaT0Value() const noexcept;
//- Return time step
inline dimensionedScalar deltaT() const;
//- Return old time step
inline dimensionedScalar deltaT0() const;
// Check // Access
//- True if this is a write time //- Return the current user-time value.
inline bool writeTime() const noexcept; //- (ie, after applying any timeToUserTime() conversion)
inline scalar timeOutputValue() const;
//- Deprecated(2016-05) return true if this is a write time. //- Return the current time name
// \deprecated(2016-05) - use writeTime() method inline const word& timeName() const noexcept;
bool outputTime() const noexcept { return this->writeTime(); }
//- Return the current time index
inline label timeIndex() const noexcept;
//- Return time step value
inline scalar deltaTValue() const noexcept;
//- Return old time step value
inline scalar deltaT0Value() const noexcept;
//- Return time step
inline dimensionedScalar deltaT() const;
//- Return old time step
inline dimensionedScalar deltaT0() const;
//- True if this is a write interval
inline bool writeTime() const noexcept;
// Housekeeping
//- Deprecated(2016-05) return true if this is a write time.
// \deprecated(2016-05) - use writeTime() method
bool outputTime() const noexcept { return this->writeTime(); }
}; };

View File

@ -30,10 +30,23 @@ License
inline Foam::scalar Foam::TimeState::timeOutputValue() const inline Foam::scalar Foam::TimeState::timeOutputValue() const
{ {
return timeToUserTime(value()); return timeToUserTime(dimensionedScalar::value());
} }
inline const Foam::word& Foam::TimeState::timeName() const noexcept
{
return dimensionedScalar::name();
}
// FUTURE?
// inline Foam::scalar Foam::TimeState::timeValue() const noexcept
// {
// return dimensionedScalar::value();
// }
inline Foam::label Foam::TimeState::timeIndex() const noexcept inline Foam::label Foam::TimeState::timeIndex() const noexcept
{ {
return timeIndex_; return timeIndex_;

View File

@ -283,11 +283,11 @@ Foam::scalar Foam::expressions::exprDriver::deltaT() const
{ {
if (timeStatePtr_) if (timeStatePtr_)
{ {
return timeStatePtr_->deltaT().value(); return timeStatePtr_->deltaTValue();
} }
else if (obrPtr_) else if (obrPtr_)
{ {
return obrPtr_->time().deltaT().value(); return obrPtr_->time().deltaTValue();
} }
return 0; return 0;
} }

View File

@ -48,7 +48,7 @@ namespace Foam
bool Foam::writeFreeSurface::writeData() bool Foam::writeFreeSurface::writeData()
{ {
if (time_.outputTime()) if (time_.writeTime())
{ {
const fvMesh& mesh = const fvMesh& mesh =
time_.lookupObject<fvMesh>(polyMesh::defaultRegion); time_.lookupObject<fvMesh>(polyMesh::defaultRegion);

View File

@ -834,8 +834,7 @@ void Foam::interfaceTrackingFvMesh::smoothFreeSurfaceMesh()
) )
); );
fsPatchPointMeshU == fsPatchPointMeshU == displacement/mesh().time().deltaTValue();
displacement/mesh().time().deltaT().value();
dynamicMotionSolverFvMesh::update(); dynamicMotionSolverFvMesh::update();
} }
@ -1008,7 +1007,7 @@ Foam::scalar Foam::interfaceTrackingFvMesh::maxCourantNumber()
CoNum = gMax CoNum = gMax
( (
mesh().time().deltaT().value()/ mesh().time().deltaTValue()/
sqrt sqrt
( (
Foam::pow(dE, 3.0)/2.0/M_PI/(sigma().value() + SMALL) Foam::pow(dE, 3.0)/2.0/M_PI/(sigma().value() + SMALL)
@ -1027,7 +1026,7 @@ Foam::scalar Foam::interfaceTrackingFvMesh::maxCourantNumber()
CoNum = gMax CoNum = gMax
( (
mesh().time().deltaT().value()/ mesh().time().deltaTValue()/
sqrt sqrt
( (
Foam::pow(dE, 3.0)/2.0/M_PI/sigmaE Foam::pow(dE, 3.0)/2.0/M_PI/sigmaE
@ -2125,7 +2124,7 @@ bool Foam::interfaceTrackingFvMesh::update()
== fv::CrankNicolsonDdtScheme<vector>::typeName == fv::CrankNicolsonDdtScheme<vector>::typeName
) )
{ {
sweptVolCorr *= (1.0/2.0)*mesh().time().deltaT().value(); sweptVolCorr *= (1.0/2.0)*mesh().time().deltaTValue();
} }
else if else if
( (
@ -2133,7 +2132,7 @@ bool Foam::interfaceTrackingFvMesh::update()
== fv::EulerDdtScheme<vector>::typeName == fv::EulerDdtScheme<vector>::typeName
) )
{ {
sweptVolCorr *= mesh().time().deltaT().value(); sweptVolCorr *= mesh().time().deltaTValue();
} }
else if else if
( (
@ -2143,11 +2142,11 @@ bool Foam::interfaceTrackingFvMesh::update()
{ {
if (mesh().time().timeIndex() == 1) if (mesh().time().timeIndex() == 1)
{ {
sweptVolCorr *= mesh().time().deltaT().value(); sweptVolCorr *= mesh().time().deltaTValue();
} }
else else
{ {
sweptVolCorr *= (2.0/3.0)*mesh().time().deltaT().value(); sweptVolCorr *= (2.0/3.0)*mesh().time().deltaTValue();
} }
} }
else else
@ -2212,8 +2211,7 @@ bool Foam::interfaceTrackingFvMesh::update()
) )
); );
fsPatchPointMeshU == fsPatchPointMeshU == displacement/mesh().time().deltaTValue();
displacement/mesh().time().deltaT().value();
dynamicMotionSolverFvMesh::update(); dynamicMotionSolverFvMesh::update();
@ -2245,8 +2243,7 @@ bool Foam::interfaceTrackingFvMesh::update()
) )
); );
fsPatchPointMeshU == fsPatchPointMeshU == displacement/mesh().time().deltaTValue();
displacement/mesh().time().deltaT().value();
dynamicMotionSolverFvMesh::update(); dynamicMotionSolverFvMesh::update();
} }

View File

@ -143,7 +143,7 @@ void Foam::fa::jouleHeatingSource::addSup
// Add the Joule heating contribution // Add the Joule heating contribution
areaVectorField gradV("gradV", fac::grad(V_)); areaVectorField gradV("gradV", fac::grad(V_));
if (debug > 1 && mesh().time().outputTime()) if (debug > 1 && mesh().time().writeTime())
{ {
areaScalarField qgradV("gradVSource", (gradV & gradV)); areaScalarField qgradV("gradVSource", (gradV & gradV));
qgradV.write(); qgradV.write();

View File

@ -44,14 +44,14 @@ namespace fa
template<class Type> template<class Type>
scalar EulerFaD2dt2Scheme<Type>::deltaT_() const scalar EulerFaD2dt2Scheme<Type>::deltaT_() const
{ {
return mesh().time().deltaT().value(); return mesh().time().deltaTValue();
} }
template<class Type> template<class Type>
scalar EulerFaD2dt2Scheme<Type>::deltaT0_() const scalar EulerFaD2dt2Scheme<Type>::deltaT0_() const
{ {
return mesh().time().deltaT0().value(); return mesh().time().deltaT0Value();
} }

View File

@ -456,7 +456,7 @@ EulerFaDdtScheme<Type>::famDdt
faMatrix<Type>& fam = tfam.ref(); faMatrix<Type>& fam = tfam.ref();
scalar rDeltaT = 1.0/mesh().time().deltaT().value(); scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fam.diag() = rDeltaT*mesh().S(); fam.diag() = rDeltaT*mesh().S();
@ -491,7 +491,7 @@ EulerFaDdtScheme<Type>::famDdt
); );
faMatrix<Type>& fam = tfam.ref(); faMatrix<Type>& fam = tfam.ref();
scalar rDeltaT = 1.0/mesh().time().deltaT().value(); scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fam.diag() = rDeltaT*rho.value()*mesh().S(); fam.diag() = rDeltaT*rho.value()*mesh().S();
@ -528,7 +528,7 @@ EulerFaDdtScheme<Type>::famDdt
); );
faMatrix<Type>& fam = tfam.ref(); faMatrix<Type>& fam = tfam.ref();
scalar rDeltaT = 1.0/mesh().time().deltaT().value(); scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fam.diag() = rDeltaT*rho.primitiveField()*mesh().S(); fam.diag() = rDeltaT*rho.primitiveField()*mesh().S();

View File

@ -44,14 +44,14 @@ namespace fa
template<class Type> template<class Type>
scalar backwardFaDdtScheme<Type>::deltaT_() const scalar backwardFaDdtScheme<Type>::deltaT_() const
{ {
return mesh().time().deltaT().value(); return mesh().time().deltaTValue();
} }
template<class Type> template<class Type>
scalar backwardFaDdtScheme<Type>::deltaT0_() const scalar backwardFaDdtScheme<Type>::deltaT0_() const
{ {
return mesh().time().deltaT0().value(); return mesh().time().deltaT0Value();
} }
@ -65,7 +65,7 @@ scalar backwardFaDdtScheme<Type>::deltaT0_(const GeoField& vf) const
} }
else else
{ {
return deltaT0_(); return mesh().time().deltaT0Value();
} }
} }

View File

@ -43,13 +43,13 @@ namespace fa
scalar boundedBackwardFaDdtScheme::deltaT_() const scalar boundedBackwardFaDdtScheme::deltaT_() const
{ {
return mesh().time().deltaT().value(); return mesh().time().deltaTValue();
} }
scalar boundedBackwardFaDdtScheme::deltaT0_() const scalar boundedBackwardFaDdtScheme::deltaT0_() const
{ {
return mesh().time().deltaT0().value(); return mesh().time().deltaT0Value();
} }

View File

@ -279,7 +279,7 @@ void Foam::expressions::fvExprDriver::createWriterAndRead(const word& name)
void Foam::expressions::fvExprDriver::tryWrite() const void Foam::expressions::fvExprDriver::tryWrite() const
{ {
if (writer_ && mesh().time().outputTime()) if (writer_ && mesh().time().writeTime())
{ {
writer_->write(); writer_->write();
} }

View File

@ -303,7 +303,7 @@ void Foam::activePressureForceBaffleVelocityFvPatchVectorField::updateCoeffs()
openFraction_ openFraction_
+ min + min
( (
this->db().time().deltaT().value()/openingTime_, this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_ maxOpenFractionDelta_
) )
); );

View File

@ -68,7 +68,7 @@ functions
timeEnd 10; timeEnd 10;
evaluateControl timeStep; evaluateControl timeStep;
evaluateInterval 1; evaluateInterval 1;
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
... ...
} }

View File

@ -887,7 +887,7 @@ bool Foam::DMDModels::STDMD::read(const dictionary& dict)
"interval", "interval",
( (
dict.getCheck<label>("executeInterval", labelMinMax::ge(1)) dict.getCheck<label>("executeInterval", labelMinMax::ge(1))
*mesh_.time().deltaT().value() *mesh_.time().deltaTValue()
), ),
scalarMinMax::ge(0) scalarMinMax::ge(0)
); );

View File

@ -95,7 +95,7 @@ calculateSpeciesRR
); );
auto& RR = RRt.ref(); auto& RR = RRt.ref();
scalar dt = time_.deltaT().value(); scalar dt = time_.deltaTValue();
endTime_ += dt; endTime_ += dt;
@ -131,9 +131,9 @@ writeSpeciesRR()
{ {
consFilePtr_() << "time : " << mesh_.time().value() << tab << nl; consFilePtr_() << "time : " << mesh_.time().value() << tab << nl;
consFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl; consFilePtr_() << "delta T : "<< mesh_.time().deltaTValue() << nl << nl;
prodFilePtr_() << "time : " << mesh_.time().value() << tab << nl; prodFilePtr_() << "time : " << mesh_.time().value() << tab << nl;
prodFilePtr_() << "delta T : "<< mesh_.time().deltaT().value() << nl << nl; prodFilePtr_() << "delta T : "<< mesh_.time().deltaTValue() << nl << nl;
consIntFilePtr_() << "start time : " << startTime_ << tab consIntFilePtr_() << "start time : " << startTime_ << tab
<< "end time :" << endTime_ << nl; << "end time :" << endTime_ << nl;

View File

@ -39,7 +39,7 @@ Description
{ {
type sizeDistribution; type sizeDistribution;
libs (reactingEulerFoamFunctionObjects); libs (reactingEulerFoamFunctionObjects);
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
log true; log true;
... ...

View File

@ -53,7 +53,7 @@ Usage
libs (energyTransportFunctionObjects); libs (energyTransportFunctionObjects);
enabled true; enabled true;
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
field T; field T;
@ -99,7 +99,7 @@ Usage
libs (energyTransportFunctionObjects); libs (energyTransportFunctionObjects);
enabled true; enabled true;
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
field T; field T;

View File

@ -84,7 +84,7 @@ Usage
libs (solverFunctionObjects); libs (solverFunctionObjects);
enabled true; enabled true;
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
field s; field s;

View File

@ -38,7 +38,7 @@ Description
libs (utilityFunctionObjects); libs (utilityFunctionObjects);
// Write at same frequency as fields // Write at same frequency as fields
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
// Fields to be sampled // Fields to be sampled

View File

@ -306,7 +306,7 @@ void objective::accumulateJMean()
const scalar time = mesh_.time().value(); const scalar time = mesh_.time().value();
if (isWithinIntegrationTime()) if (isWithinIntegrationTime())
{ {
const scalar dt = mesh_.time().deltaT().value(); const scalar dt = mesh_.time().deltaTValue();
const scalar elapsedTime = time - integrationStartTimePtr_(); const scalar elapsedTime = time - integrationStartTimePtr_();
const scalar denom = elapsedTime + dt; const scalar denom = elapsedTime + dt;
JMean_ = (JMean_*elapsedTime + J_*dt)/denom; JMean_ = (JMean_*elapsedTime + J_*dt)/denom;

View File

@ -505,7 +505,7 @@ void Foam::cellCellStencil::walkFront
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -656,7 +656,7 @@ void Foam::cellCellStencil::walkFront
fraction.transfer(newFraction); fraction.transfer(newFraction);
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -708,7 +708,7 @@ void Foam::cellCellStencil::walkFront
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (

View File

@ -657,7 +657,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
markPatchCells(partMesh, partCellMap, allPatchTypes); markPatchCells(partMesh, partCellMap, allPatchTypes);
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -794,7 +794,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -840,7 +840,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -864,7 +864,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
// Mark unreachable bits // Mark unreachable bits
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes); findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -910,7 +910,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
); );
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -1024,16 +1024,13 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
} }
// Write to volField for debugging // Write to volField for debugging
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
if ((debug&2) && (mesh_.time().outputTime())) tmp<volScalarField> tfld
{ (
tmp<volScalarField> tfld createField(mesh_, "allCellTypes_final", allCellTypes)
( );
createField(mesh_, "allCellTypes_final", allCellTypes) tfld().write();
);
tfld().write();
}
} }
@ -1066,7 +1063,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
); );
// Dump interpolation stencil // Dump interpolation stencil
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
// Dump weight // Dump weight
cellInterpolationWeight_.instance() = mesh_.time().timeName(); cellInterpolationWeight_.instance() = mesh_.time().timeName();

View File

@ -1478,7 +1478,7 @@ void Foam::cellCellStencils::inverseDistance::holeExtrapolationStencil
} }
} }
if (debug&2) if (debug & 2)
{ {
reduce(nSpecialNear, sumOp<label>()); reduce(nSpecialNear, sumOp<label>());
reduce(nSpecialFar, sumOp<label>()); reduce(nSpecialFar, sumOp<label>());
@ -2051,7 +2051,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
} }
} }
if ((debug&2)&& (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -2089,7 +2089,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
} }
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -2108,7 +2108,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes); findHoles(globalCells, mesh_, zoneID, allStencil, allCellTypes);
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -2116,7 +2116,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
); );
tfld().write(); tfld().write();
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
labelList stencilSize(mesh_.nCells()); labelList stencilSize(mesh_.nCells());
forAll(allStencil, celli) forAll(allStencil, celli)
@ -2172,7 +2172,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
// } // }
// } // }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -2216,7 +2216,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
useLayer useLayer
); );
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -2365,7 +2365,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
>(cellInterpolationWeight_.boundaryFieldRef(), false); >(cellInterpolationWeight_.boundaryFieldRef(), false);
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
// Dump mesh // Dump mesh
mesh_.time().write(); mesh_.time().write();
@ -2404,9 +2404,8 @@ bool Foam::cellCellStencils::inverseDistance::update()
holeExtrapolationStencil(globalCells); holeExtrapolationStencil(globalCells);
} }
if ((debug&2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
// Dump weight // Dump weight
cellInterpolationWeight_.instance() = mesh_.time().timeName(); cellInterpolationWeight_.instance() = mesh_.time().timeName();
cellInterpolationWeight_.write(); cellInterpolationWeight_.write();

View File

@ -834,7 +834,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
DebugInfo<< FUNCTION_NAME << " : Determined holes and donor-acceptors" DebugInfo<< FUNCTION_NAME << " : Determined holes and donor-acceptors"
<< endl; << endl;
if ((debug & 2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -875,7 +875,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
} }
DebugInfo<< FUNCTION_NAME << " : Removed bad donors" << endl; DebugInfo<< FUNCTION_NAME << " : Removed bad donors" << endl;
if ((debug & 2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -894,7 +894,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes); findHoles(globalCells_, mesh_, zoneID, allStencil, allCellTypes);
DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl; DebugInfo<< FUNCTION_NAME << " : Flood-filled holes" << endl;
if ((debug & 2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -947,7 +947,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
dict_.getOrDefault("useLayer", -1) dict_.getOrDefault("useLayer", -1)
); );
if ((debug & 2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
tmp<volScalarField> tfld tmp<volScalarField> tfld
( (
@ -1063,7 +1063,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
>(cellInterpolationWeight_.boundaryFieldRef(), false); >(cellInterpolationWeight_.boundaryFieldRef(), false);
if ((debug & 2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
// Dump mesh // Dump mesh
mesh_.time().write(); mesh_.time().write();
@ -1106,7 +1106,7 @@ bool Foam::cellCellStencils::trackingInverseDistance::update()
} }
if ((debug & 2) && (mesh_.time().outputTime())) if ((debug & 2) && mesh_.time().writeTime())
{ {
// Dump weight // Dump weight
cellInterpolationWeight_.instance() = mesh_.time().timeName(); cellInterpolationWeight_.instance() = mesh_.time().timeName();

View File

@ -744,7 +744,7 @@ Foam::SolverPerformance<Type> Foam::oversetFvMeshBase::solveOverset
// Calculate stabilised diagonal as normalisation for interpolation // Calculate stabilised diagonal as normalisation for interpolation
const scalarField norm(normalisation(m)); const scalarField norm(normalisation(m));
if (debug && mesh_.time().outputTime()) if (debug && mesh_.time().writeTime())
{ {
volScalarField scale volScalarField scale
( (

View File

@ -119,7 +119,7 @@ void Foam::multiphaseSystem::solveAlphas()
MULES::limit MULES::limit
( (
1.0/mesh_.time().deltaT().value(), 1.0/mesh_.time().deltaTValue(),
geometricOneField(), geometricOneField(),
phase, phase,
phi_, phi_,

View File

@ -68,7 +68,7 @@ Foam::porousModels::VollerPrakash::S() const
const volScalarField& solidAlpha = const volScalarField& solidAlpha =
mesh_.lookupObject<volScalarField>(solidPhase_); mesh_.lookupObject<volScalarField>(solidPhase_);
if (mesh_.time().outputTime() && debug) if (debug && mesh_.time().writeTime())
{ {
volScalarField Su volScalarField Su
( (

View File

@ -198,7 +198,7 @@ Foam::meltingEvaporationModels::diffusionGasEvaporation<Thermo, OtherThermo>
*C_*rhog*Dvg*gradYgm*interfaceArea_ *C_*rhog*Dvg*gradYgm*interfaceArea_
/(1 - YvSat); /(1 - YvSat);
if (debug && mesh.time().outputTime()) if (debug && mesh.time().writeTime())
{ {
volScalarField pSat("pSat", saturationModelPtr_->pSat(T)); volScalarField pSat("pSat", saturationModelPtr_->pSat(T));
pSat.write(); pSat.write();

View File

@ -305,7 +305,7 @@ void Foam::multiphaseInter::multiphaseSystem::solveAlphas()
MULES::limit MULES::limit
( (
1.0/mesh_.time().deltaT().value(), 1.0/mesh_.time().deltaTValue(),
geometricOneField(), geometricOneField(),
alpha1, alpha1,
phi, phi,
@ -479,7 +479,7 @@ Foam::multiphaseInter::multiphaseSystem::maxDiffNo() const
maxVal = max(maxVal, max(iter()->diffNo()).value()); maxVal = max(maxVal, max(iter()->diffNo()).value());
} }
return maxVal * mesh_.time().deltaT().value(); return maxVal * mesh_.time().deltaTValue();
} }

View File

@ -324,7 +324,7 @@ void Foam::MultiComponentPhaseModel<BasePhaseModel, phaseThermo>::solveYi
MULES::limit MULES::limit
( (
1.0/mesh.time().deltaT().value(), 1.0/mesh.time().deltaTValue(),
geometricOneField(), geometricOneField(),
Yi, Yi,
phi, phi,

View File

@ -261,7 +261,7 @@ scalar liquidFilmBase::CourantNumber() const
); );
CoNum = CoNum =
max(SfUfbyDelta/regionMesh().magLe()).value()*time().deltaT().value(); max(SfUfbyDelta/regionMesh().magLe()).value()*time().deltaTValue();
velMag = max(mag(phif_)/regionMesh().magLe()).value(); velMag = max(mag(phif_)/regionMesh().magLe()).value();

View File

@ -46,7 +46,7 @@ Description
name probes; name probes;
// Write at same frequency as fields // Write at same frequency as fields
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
// Fields to be probed // Fields to be probed

View File

@ -41,7 +41,7 @@ Description
libs (sampling); libs (sampling);
// Write at same frequency as fields // Write at same frequency as fields
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
// Fields to be sampled // Fields to be sampled

View File

@ -366,7 +366,7 @@ bool Foam::movingConeTopoFvMesh::update()
topoChangeMap().preMotionPoints() topoChangeMap().preMotionPoints()
+ ( + (
pos0(0.5 - mag(motionMask_)) // cells above the body pos0(0.5 - mag(motionMask_)) // cells above the body
)*curMotionVel_*time().deltaT().value(); )*curMotionVel_*time().deltaTValue();
} }
else else
{ {
@ -385,7 +385,7 @@ bool Foam::movingConeTopoFvMesh::update()
points() points()
+ ( + (
pos0(0.5 - mag(motionMask_)) // cells above the body pos0(0.5 - mag(motionMask_)) // cells above the body
)*curMotionVel_*time().deltaT().value(); )*curMotionVel_*time().deltaTValue();
} }
} }
else else
@ -396,7 +396,7 @@ bool Foam::movingConeTopoFvMesh::update()
points() points()
+ ( + (
pos0(0.5 - mag(motionMask_)) // cells above the body pos0(0.5 - mag(motionMask_)) // cells above the body
)*curMotionVel_*time().deltaT().value(); )*curMotionVel_*time().deltaTValue();
} }
// The mesh now contains the cells with zero volume // The mesh now contains the cells with zero volume

View File

@ -234,7 +234,7 @@ void Foam::isoAdvection::boundFlux
{ {
addProfilingInFunction(geometricVoF); addProfilingInFunction(geometricVoF);
DebugInFunction << endl; DebugInFunction << endl;
scalar rDeltaT = 1/mesh_.time().deltaTValue(); const scalar rDeltaT = 1.0/mesh_.time().deltaTValue();
correctedFaces.clear(); correctedFaces.clear();
const scalar aTol = 100*SMALL; // Note: tolerances const scalar aTol = 100*SMALL; // Note: tolerances
@ -400,7 +400,7 @@ void Foam::isoAdvection::advect(const SpType& Sp, const SuType& Su)
scalar advectionStartTime = mesh_.time().elapsedCpuTime(); scalar advectionStartTime = mesh_.time().elapsedCpuTime();
const scalar rDeltaT = 1/mesh_.time().deltaTValue(); const scalar rDeltaT = 1.0/mesh_.time().deltaTValue();
// reconstruct the interface // reconstruct the interface
surf_->reconstruct(); surf_->reconstruct();

View File

@ -106,7 +106,7 @@ int main(int argc, char *argv[])
vector r0(x, y, 0); vector r0(x, y, 0);
fsPatchU[pointI] = (scale - 1.0)*r0/runTime.deltaT().value(); fsPatchU[pointI] = (scale - 1.0)*r0/runTime.deltaTValue();
} }
fixedValuePointPatchVectorField& fsPatchPointMeshU = fixedValuePointPatchVectorField& fsPatchPointMeshU =

View File

@ -54,7 +54,7 @@ area
libs (utilityFunctionObjects); libs (utilityFunctionObjects);
// Write at same frequency as fields // Write at same frequency as fields
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
fields (U p hf_film ); fields (U p hf_film );

View File

@ -100,7 +100,7 @@ int main(int argc, char *argv[])
vector vector
( (
0, 0,
a0*::cos(M_PI*x/L)/runTime.deltaT().value(), a0*::cos(M_PI*x/L)/runTime.deltaTValue(),
0 0
); );
} }

View File

@ -77,7 +77,7 @@ functions
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
field T; field T;
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
htcModel fixedReferenceTemperature; htcModel fixedReferenceTemperature;
patches (bottom); patches (bottom);
@ -90,7 +90,7 @@ functions
libs (fieldFunctionObjects); libs (fieldFunctionObjects);
patches (bottom); patches (bottom);
writeControl outputTime; writeControl writeTime;
writeInterval 1; writeInterval 1;
} }
} }