mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: more explicit use of REGISTER when storing fields
ENH: add phaseScopedName convenience method - unites IOobject::scopedName + phasePropertyName
This commit is contained in:
@ -899,7 +899,8 @@ int main(int argc, char *argv[])
|
||||
runTime.system(),
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
args.getOrDefault<fileName>("decomposeParDict", "")
|
||||
)
|
||||
|
||||
@ -171,7 +171,8 @@ int main(int argc, char *argv[])
|
||||
runTime.system(),
|
||||
runTime,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
args.getOrDefault<fileName>("decomposeParDict", "")
|
||||
)
|
||||
|
||||
@ -537,7 +537,9 @@ Foam::expressions::fvExprDriver::regionMesh
|
||||
regionName,
|
||||
mesh.time().constant(),
|
||||
mesh.time(),
|
||||
IOobject::MUST_READ
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -151,11 +151,11 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter
|
||||
|
||||
if (this->mesh().cache("limiter"))
|
||||
{
|
||||
if (!mesh.foundObject<surfaceScalarField>(limiterFieldName))
|
||||
auto* fldptr = mesh.getObjectPtr<surfaceScalarField>(limiterFieldName);
|
||||
|
||||
if (!fldptr)
|
||||
{
|
||||
surfaceScalarField* limiterField
|
||||
(
|
||||
new surfaceScalarField
|
||||
fldptr = new surfaceScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -163,18 +163,16 @@ Foam::LimitedScheme<Type, Limiter, LimitFunc>::limiter
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh,
|
||||
dimless
|
||||
)
|
||||
);
|
||||
|
||||
mesh.objectRegistry::store(limiterField);
|
||||
mesh.objectRegistry::store(fldptr);
|
||||
}
|
||||
|
||||
surfaceScalarField& limiterField =
|
||||
mesh.lookupObjectRef<surfaceScalarField>(limiterFieldName);
|
||||
auto& limiterField = *fldptr;
|
||||
|
||||
calcLimiter(phi, limiterField);
|
||||
|
||||
|
||||
@ -78,17 +78,11 @@ bool Foam::functionObjects::CourantNo::calc()
|
||||
)
|
||||
);
|
||||
|
||||
if (foundObject<volScalarField>(resultName_, false))
|
||||
{
|
||||
volScalarField& Co =
|
||||
lookupObjectRef<volScalarField>(resultName_);
|
||||
auto* resultPtr = getObjectPtr<volScalarField>(resultName_);
|
||||
|
||||
Co.ref() = Coi();
|
||||
Co.correctBoundaryConditions();
|
||||
}
|
||||
else
|
||||
if (!resultPtr)
|
||||
{
|
||||
auto tCo = tmp<volScalarField>::New
|
||||
resultPtr = new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -96,16 +90,19 @@ bool Foam::functionObjects::CourantNo::calc()
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero),
|
||||
fvPatchFieldBase::zeroGradientType()
|
||||
);
|
||||
tCo.ref().ref() = Coi();
|
||||
tCo.ref().correctBoundaryConditions();
|
||||
mesh_.objectRegistry::store(tCo.ptr());
|
||||
mesh_.objectRegistry::store(resultPtr);
|
||||
}
|
||||
auto& Co = *resultPtr;
|
||||
|
||||
Co.internalFieldRef() = Coi;
|
||||
Co.correctBoundaryConditions();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -80,7 +80,8 @@ Foam::functionObjects::DESModelRegions::DESModelRegions
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
|
||||
@ -92,7 +92,8 @@ Foam::functionObjects::blendingFactor::blendingFactor
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero),
|
||||
|
||||
@ -66,7 +66,8 @@ int Foam::functionObjects::ddt2::apply(const word& inputName, int& state)
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dims, Zero)
|
||||
|
||||
@ -143,7 +143,8 @@ void Foam::functionObjects::fieldAverage::restoreWindowFieldsType
|
||||
obr().time().timeName(obr().time().startTime().value()),
|
||||
obr(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
);
|
||||
|
||||
if (io.typeHeaderOk<Type>(true))
|
||||
|
||||
@ -82,7 +82,8 @@ Foam::functionObjects::heatTransferCoeff::heatTransferCoeff
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
||||
|
||||
@ -138,7 +138,8 @@ Foam::functionObjects::multiphaseInterHtcModel::multiphaseInterHtcModel
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
||||
|
||||
@ -147,7 +147,8 @@ Foam::functionObjects::reactingEulerHtcModel::reactingEulerHtcModel
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimPower/dimArea/dimTemperature, Zero)
|
||||
|
||||
@ -173,7 +173,8 @@ Foam::functionObjects::momentumError::momentumError
|
||||
subMesh.time().timeName(),
|
||||
subMesh,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
subMesh,
|
||||
dimensionedVector(momDims)
|
||||
@ -192,7 +193,8 @@ Foam::functionObjects::momentumError::momentumError
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector(momDims)
|
||||
|
||||
@ -332,7 +332,8 @@ bool Foam::functionObjects::pressure::calc()
|
||||
p.mesh().time().timeName(),
|
||||
p.mesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
coeff(calcPressure(p, rhoScale(p)))
|
||||
);
|
||||
|
||||
@ -65,10 +65,11 @@ Foam::functionObjects::processorField::processorField
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Pstream::myProcNo())
|
||||
dimensionedScalar(dimless, UPstream::myProcNo())
|
||||
)
|
||||
);
|
||||
|
||||
@ -92,7 +93,7 @@ bool Foam::functionObjects::processorField::execute()
|
||||
mesh_.lookupObjectRef<volScalarField>("processorID");
|
||||
|
||||
procField ==
|
||||
dimensionedScalar("proci", dimless, Pstream::myProcNo());
|
||||
dimensionedScalar("proci", dimless, UPstream::myProcNo());
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -123,10 +124,11 @@ void Foam::functionObjects::processorField::updateMesh(const mapPolyMesh& mpm)
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Pstream::myProcNo())
|
||||
dimensionedScalar(dimless, UPstream::myProcNo())
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -541,7 +541,8 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
@ -565,7 +566,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
|
||||
if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false))
|
||||
{
|
||||
volScalarField* vfPtr = new volScalarField(fieldHeader, mesh_);
|
||||
auto* vfPtr = new volScalarField(fieldHeader, mesh_);
|
||||
mesh_.objectRegistry::store(vfPtr);
|
||||
}
|
||||
else
|
||||
@ -595,7 +596,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
|
||||
if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false))
|
||||
{
|
||||
volScalarField* vfPtr = new volScalarField(fieldHeader, mesh_);
|
||||
auto* vfPtr = new volScalarField(fieldHeader, mesh_);
|
||||
mesh_.objectRegistry::store(vfPtr);
|
||||
}
|
||||
else
|
||||
@ -623,7 +624,7 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor
|
||||
|
||||
if (fieldHeader.typeHeaderOk<volScalarField>(true, true, false))
|
||||
{
|
||||
volScalarField* vfPtr(new volScalarField(fieldHeader, mesh_));
|
||||
auto* vfPtr = new volScalarField(fieldHeader, mesh_);
|
||||
mesh_.objectRegistry::store(vfPtr);
|
||||
}
|
||||
else
|
||||
|
||||
@ -404,10 +404,11 @@ Foam::tmp<Foam::pointScalarField> Foam::functionObjects::streamFunction::calc
|
||||
|
||||
bool Foam::functionObjects::streamFunction::calc()
|
||||
{
|
||||
if (foundObject<surfaceScalarField>(fieldName_))
|
||||
const auto* phiPtr = findObject<surfaceScalarField>(fieldName_);
|
||||
|
||||
if (phiPtr)
|
||||
{
|
||||
const surfaceScalarField& phi =
|
||||
mesh_.lookupObject<surfaceScalarField>(fieldName_);
|
||||
const surfaceScalarField& phi = *phiPtr;
|
||||
|
||||
return store(resultName_, calc(phi));
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ Foam::functionObjects::surfaceDistance::surfaceDistance
|
||||
{
|
||||
read(dict);
|
||||
|
||||
volScalarField* procFieldPtr
|
||||
volScalarField* distPtr
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
@ -63,14 +63,15 @@ Foam::functionObjects::surfaceDistance::surfaceDistance
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimLength, Zero)
|
||||
)
|
||||
);
|
||||
|
||||
mesh_.objectRegistry::store(procFieldPtr);
|
||||
mesh_.objectRegistry::store(distPtr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -119,7 +119,8 @@ Foam::functionObjects::wallHeatFlux::wallHeatFlux
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimMass/pow3(dimTime), Zero)
|
||||
|
||||
@ -106,7 +106,8 @@ Foam::functionObjects::wallShearStress::wallShearStress
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedVector(sqr(dimLength)/sqr(dimTime), Zero)
|
||||
|
||||
@ -87,7 +87,8 @@ Foam::functionObjects::yPlus::yPlus
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::AUTO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
|
||||
@ -92,7 +92,8 @@ int Foam::functionObjects::zeroGradient::apply
|
||||
time_.timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensioned<Type>(input.dimensions(), Zero),
|
||||
|
||||
@ -191,7 +191,8 @@ Foam::functionObjects::hydrostaticPressure::hydrostaticPressure
|
||||
runTime.timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE // To enable restart
|
||||
IOobject::AUTO_WRITE, // To enable restart
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
@ -57,7 +57,8 @@ Foam::functionObjects::electricPotential::operandField()
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
@ -67,7 +67,8 @@ Foam::volScalarField& Foam::functionObjects::energyTransport::transportedField()
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
IOobject::AUTO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
@ -69,7 +69,8 @@ Foam::volScalarField& Foam::functionObjects::scalarTransport::transportedField()
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_
|
||||
);
|
||||
|
||||
@ -91,7 +91,9 @@ void Foam::functionObjects::solverInfo::createResidualField
|
||||
IOobject::scopedName("initialResidual", fieldName)
|
||||
);
|
||||
|
||||
if (!mesh_.foundObject<IOField<scalar>>(residualName))
|
||||
auto* fieldPtr = mesh_.getObjectPtr<IOField<scalar>>(residualName);
|
||||
|
||||
if (!fieldPtr)
|
||||
{
|
||||
auto* fieldPtr =
|
||||
new IOField<scalar>
|
||||
|
||||
@ -64,11 +64,11 @@ void Foam::HeatTransferCoeff<CloudType>::postEvolve
|
||||
const auto& tc =
|
||||
static_cast<const ThermoCloud<KinematicCloud<Cloud<parcelType>>>&>(c);
|
||||
|
||||
auto* htcPtr = c.template getObjectPtr<IOField<scalar>>("htc");
|
||||
auto* resultPtr = c.template getObjectPtr<IOField<scalar>>("htc");
|
||||
|
||||
if (!htcPtr)
|
||||
if (!resultPtr)
|
||||
{
|
||||
htcPtr = new IOField<scalar>
|
||||
resultPtr = new IOField<scalar>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -81,9 +81,9 @@ void Foam::HeatTransferCoeff<CloudType>::postEvolve
|
||||
)
|
||||
);
|
||||
|
||||
htcPtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
auto& htc = *htcPtr;
|
||||
auto& htc = *resultPtr;
|
||||
|
||||
htc.resize(c.size());
|
||||
|
||||
|
||||
@ -61,11 +61,11 @@ void Foam::KinematicReynoldsNumber<CloudType>::postEvolve
|
||||
{
|
||||
auto& c = this->owner();
|
||||
|
||||
auto* RePtr = c.template getObjectPtr<IOField<scalar>>("Re");
|
||||
auto* resultPtr = c.template getObjectPtr<IOField<scalar>>("Re");
|
||||
|
||||
if (!RePtr)
|
||||
if (!resultPtr)
|
||||
{
|
||||
RePtr = new IOField<scalar>
|
||||
resultPtr = new IOField<scalar>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -78,9 +78,9 @@ void Foam::KinematicReynoldsNumber<CloudType>::postEvolve
|
||||
)
|
||||
);
|
||||
|
||||
RePtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
auto& Re = *RePtr;
|
||||
auto& Re = *resultPtr;
|
||||
|
||||
Re.resize(c.size());
|
||||
|
||||
|
||||
@ -64,11 +64,11 @@ void Foam::NusseltNumber<CloudType>::postEvolve
|
||||
const auto& tc =
|
||||
static_cast<const ThermoCloud<KinematicCloud<Cloud<parcelType>>>&>(c);
|
||||
|
||||
auto* NuPtr = c.template getObjectPtr<IOField<scalar>>("Nu");
|
||||
auto* resultPtr = c.template getObjectPtr<IOField<scalar>>("Nu");
|
||||
|
||||
if (!NuPtr)
|
||||
if (!resultPtr)
|
||||
{
|
||||
NuPtr = new IOField<scalar>
|
||||
resultPtr = new IOField<scalar>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -81,9 +81,9 @@ void Foam::NusseltNumber<CloudType>::postEvolve
|
||||
)
|
||||
);
|
||||
|
||||
NuPtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
auto& Nu = *NuPtr;
|
||||
auto& Nu = *resultPtr;
|
||||
|
||||
Nu.resize(c.size());
|
||||
|
||||
|
||||
@ -64,11 +64,11 @@ void Foam::ParticleDose<CloudType>::postEvolve
|
||||
{
|
||||
auto& c = this->owner();
|
||||
|
||||
auto* DPtr = c.template getObjectPtr<IOField<scalar>>("D");
|
||||
auto* resultPtr = c.template getObjectPtr<IOField<scalar>>("D");
|
||||
|
||||
if (!DPtr)
|
||||
if (!resultPtr)
|
||||
{
|
||||
DPtr = new IOField<scalar>
|
||||
resultPtr = new IOField<scalar>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -81,9 +81,9 @@ void Foam::ParticleDose<CloudType>::postEvolve
|
||||
)
|
||||
);
|
||||
|
||||
DPtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
auto& D = *DPtr;
|
||||
auto& D = *resultPtr;
|
||||
|
||||
D.resize(c.size(), Zero);
|
||||
|
||||
|
||||
@ -62,11 +62,11 @@ void Foam::ThermoReynoldsNumber<CloudType>::postEvolve
|
||||
{
|
||||
auto& c = this->owner();
|
||||
|
||||
auto* RePtr = c.template getObjectPtr<IOField<scalar>>("Re");
|
||||
auto* resultPtr = c.template getObjectPtr<IOField<scalar>>("Re");
|
||||
|
||||
if (!RePtr)
|
||||
if (!resultPtr)
|
||||
{
|
||||
RePtr = new IOField<scalar>
|
||||
resultPtr = new IOField<scalar>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -79,9 +79,9 @@ void Foam::ThermoReynoldsNumber<CloudType>::postEvolve
|
||||
)
|
||||
);
|
||||
|
||||
RePtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
auto& Re = *RePtr;
|
||||
auto& Re = *resultPtr;
|
||||
|
||||
Re.resize(c.size());
|
||||
|
||||
|
||||
@ -62,11 +62,11 @@ void Foam::WeberNumberReacting<CloudType>::postEvolve
|
||||
{
|
||||
const auto& c = this->owner();
|
||||
|
||||
auto* WePtr = c.template getObjectPtr<IOField<scalar>>("We");
|
||||
auto* resultPtr = c.template getObjectPtr<IOField<scalar>>("We");
|
||||
|
||||
if (!WePtr)
|
||||
if (!resultPtr)
|
||||
{
|
||||
WePtr = new IOField<scalar>
|
||||
resultPtr = new IOField<scalar>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -79,9 +79,9 @@ void Foam::WeberNumberReacting<CloudType>::postEvolve
|
||||
)
|
||||
);
|
||||
|
||||
WePtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
auto& We = *WePtr;
|
||||
auto& We = *resultPtr;
|
||||
|
||||
We.resize(c.size());
|
||||
|
||||
|
||||
@ -67,26 +67,28 @@ Foam::InterfaceForce<CloudType>::~InterfaceForce()
|
||||
template<class CloudType>
|
||||
void Foam::InterfaceForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
static word fName("gradAlpha");
|
||||
static word resultName("gradAlpha");
|
||||
|
||||
bool fieldExists =
|
||||
this->mesh().template foundObject<volVectorField>(fName);
|
||||
volVectorField* resultPtr =
|
||||
this->mesh().template getObjectPtr<volVectorField>(resultName);
|
||||
|
||||
if (store)
|
||||
{
|
||||
if (!fieldExists)
|
||||
if (!resultPtr)
|
||||
{
|
||||
const volScalarField& alpha = this->mesh().template
|
||||
lookupObject<volScalarField>(alphaName_);
|
||||
|
||||
volVectorField* gradInterForcePtr =
|
||||
new volVectorField(fName, fvc::grad(alpha*(1-alpha)));
|
||||
resultPtr = new volVectorField
|
||||
(
|
||||
resultName,
|
||||
fvc::grad(alpha*(1-alpha))
|
||||
);
|
||||
|
||||
gradInterForcePtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
|
||||
const volVectorField& gradInterForce = this->mesh().template
|
||||
lookupObject<volVectorField>(fName);
|
||||
const volVectorField& gradInterForce = *resultPtr;
|
||||
|
||||
gradInterForceInterpPtr_.reset
|
||||
(
|
||||
@ -101,12 +103,9 @@ void Foam::InterfaceForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
gradInterForceInterpPtr_.clear();
|
||||
|
||||
if (fieldExists)
|
||||
if (resultPtr)
|
||||
{
|
||||
volVectorField& gradInterForce =
|
||||
this->mesh().template lookupObjectRef<volVectorField>(fName);
|
||||
|
||||
gradInterForce.checkOut();
|
||||
resultPtr->checkOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -84,25 +84,24 @@ Foam::LiftForce<CloudType>::~LiftForce()
|
||||
template<class CloudType>
|
||||
void Foam::LiftForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
static word fName("curlUcDt");
|
||||
static word resultName("curlUcDt");
|
||||
|
||||
bool fieldExists = this->mesh().template foundObject<volVectorField>(fName);
|
||||
volVectorField* resultPtr =
|
||||
this->mesh().template getObjectPtr<volVectorField>(resultName);
|
||||
|
||||
if (store)
|
||||
{
|
||||
if (!fieldExists)
|
||||
if (!resultPtr)
|
||||
{
|
||||
const volVectorField& Uc = this->mesh().template
|
||||
lookupObject<volVectorField>(UName_);
|
||||
|
||||
volVectorField* curlUcPtr =
|
||||
new volVectorField(fName, fvc::curl(Uc));
|
||||
resultPtr = new volVectorField(resultName, fvc::curl(Uc));
|
||||
|
||||
curlUcPtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
|
||||
const volVectorField& curlUc = this->mesh().template
|
||||
lookupObject<volVectorField>(fName);
|
||||
const volVectorField& curlUc = *resultPtr;
|
||||
|
||||
curlUcInterpPtr_.reset
|
||||
(
|
||||
@ -117,12 +116,9 @@ void Foam::LiftForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
curlUcInterpPtr_.clear();
|
||||
|
||||
if (fieldExists)
|
||||
if (resultPtr)
|
||||
{
|
||||
volVectorField& curlUc =
|
||||
this->mesh().template lookupObjectRef<volVectorField>(fName);
|
||||
|
||||
curlUc.checkOut();
|
||||
resultPtr->checkOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,28 +71,27 @@ Foam::PressureGradientForce<CloudType>::~PressureGradientForce()
|
||||
template<class CloudType>
|
||||
void Foam::PressureGradientForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
static word fName("DUcDt");
|
||||
static word resultName("DUcDt");
|
||||
|
||||
bool fieldExists = this->mesh().template foundObject<volVectorField>(fName);
|
||||
volVectorField* resultPtr =
|
||||
this->mesh().template getObjectPtr<volVectorField>(resultName);
|
||||
|
||||
if (store)
|
||||
{
|
||||
if (!fieldExists)
|
||||
if (!resultPtr)
|
||||
{
|
||||
const volVectorField& Uc = this->mesh().template
|
||||
lookupObject<volVectorField>(UName_);
|
||||
|
||||
volVectorField* DUcDtPtr = new volVectorField
|
||||
resultPtr = new volVectorField
|
||||
(
|
||||
fName,
|
||||
resultName,
|
||||
fvc::ddt(Uc) + (Uc & fvc::grad(Uc))
|
||||
);
|
||||
|
||||
DUcDtPtr->store();
|
||||
resultPtr->store();
|
||||
}
|
||||
|
||||
const volVectorField& DUcDt = this->mesh().template
|
||||
lookupObject<volVectorField>(fName);
|
||||
const volVectorField& DUcDt = *resultPtr;
|
||||
|
||||
DUcDtInterpPtr_.reset
|
||||
(
|
||||
@ -107,12 +106,9 @@ void Foam::PressureGradientForce<CloudType>::cacheFields(const bool store)
|
||||
{
|
||||
DUcDtInterpPtr_.clear();
|
||||
|
||||
if (fieldExists)
|
||||
if (resultPtr)
|
||||
{
|
||||
volVectorField& DUcDt =
|
||||
this->mesh().template lookupObjectRef<volVectorField>(fName);
|
||||
|
||||
DUcDt.checkOut();
|
||||
resultPtr->checkOut();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -186,15 +186,15 @@ Foam::lumpedPointDisplacementPointPatchVectorField::movement() const
|
||||
lumpedPointIOMovement* ptr =
|
||||
lumpedPointIOMovement::getMovementObject(obr);
|
||||
|
||||
if (ptr)
|
||||
if (!ptr)
|
||||
{
|
||||
return *ptr; // Already exists
|
||||
}
|
||||
|
||||
// Create and register with this patch as the owner
|
||||
ptr = lumpedPointIOMovement::New(obr, this->patch().index()).ptr();
|
||||
|
||||
return objectRegistry::store(ptr);
|
||||
objectRegistry::store(ptr);
|
||||
}
|
||||
|
||||
return *ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -292,7 +292,7 @@ bool Foam::mappedPatchBase::constructIOField
|
||||
|
||||
if (tok.isCompound() && tok.compoundToken().type() == tag)
|
||||
{
|
||||
IOField<Type>* fldPtr = obr.findObject<IOField<Type>>(name);
|
||||
IOField<Type>* fldPtr = obr.getObjectPtr<IOField<Type>>(name);
|
||||
if (fldPtr)
|
||||
{
|
||||
fldPtr->transfer
|
||||
@ -305,14 +305,15 @@ bool Foam::mappedPatchBase::constructIOField
|
||||
}
|
||||
else
|
||||
{
|
||||
IOField<Type>* fldPtr = new IOField<Type>
|
||||
fldPtr = new IOField<Type>
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
name,
|
||||
obr,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
label(0)
|
||||
);
|
||||
@ -342,7 +343,7 @@ void Foam::mappedPatchBase::storeField
|
||||
const Field<Type>& values
|
||||
)
|
||||
{
|
||||
IOField<Type>* fldPtr = obr.findObject<IOField<Type>>(fieldName);
|
||||
IOField<Type>* fldPtr = obr.getObjectPtr<IOField<Type>>(fieldName);
|
||||
if (fldPtr)
|
||||
{
|
||||
*fldPtr = values;
|
||||
@ -356,7 +357,8 @@ void Foam::mappedPatchBase::storeField
|
||||
fieldName,
|
||||
obr,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
values
|
||||
);
|
||||
|
||||
@ -47,17 +47,20 @@ namespace regionModels
|
||||
|
||||
void Foam::regionModels::regionModel::constructMeshObjects()
|
||||
{
|
||||
if (!time_.foundObject<fvMesh>(regionName_))
|
||||
fvMesh* regionMeshPtr = time_.getObjectPtr<fvMesh>(regionName_);
|
||||
|
||||
if (!regionMeshPtr)
|
||||
{
|
||||
fvMesh* regionMeshPtr =
|
||||
new fvMesh
|
||||
regionMeshPtr = new fvMesh
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
regionName_,
|
||||
time_.timeName(),
|
||||
time_,
|
||||
IOobject::MUST_READ
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
Copyright (C) 2011-2017 OpenFOAM Foundation
|
||||
Copyright (C) 2017-2021 OpenCFD Ltd.
|
||||
Copyright (C) 2017-2023 OpenCFD Ltd.
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
@ -43,8 +43,8 @@ SourceFiles
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef basicThermo_H
|
||||
#define basicThermo_H
|
||||
#ifndef Foam_basicThermo_H
|
||||
#define Foam_basicThermo_H
|
||||
|
||||
#include "volFields.H"
|
||||
#include "typeInfo.H"
|
||||
@ -219,7 +219,7 @@ public:
|
||||
static autoPtr<Thermo> New
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName=word::null
|
||||
const word& phaseName = word::null
|
||||
);
|
||||
|
||||
//- Generic New for each of the related thermodynamics packages
|
||||
@ -228,7 +228,7 @@ public:
|
||||
(
|
||||
const fvMesh&,
|
||||
const dictionary&,
|
||||
const word& phaseName=word::null
|
||||
const word& phaseName = word::null
|
||||
);
|
||||
|
||||
//- Generic New for each of the related thermodynamics packages
|
||||
@ -244,7 +244,7 @@ public:
|
||||
static autoPtr<basicThermo> New
|
||||
(
|
||||
const fvMesh&,
|
||||
const word& phaseName=word::null
|
||||
const word& phaseName = word::null
|
||||
);
|
||||
|
||||
|
||||
@ -254,22 +254,34 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- The dictionary name ("thermophysicalProperties")
|
||||
static const word dictName;
|
||||
|
||||
static word phasePropertyName
|
||||
(
|
||||
const word& name,
|
||||
const word& phaseName
|
||||
)
|
||||
//- The phase property name as property.phase
|
||||
//- \sa IOobject::groupName
|
||||
static word phasePropertyName(const word& name, const word& phaseName)
|
||||
{
|
||||
return IOobject::groupName(name, phaseName);
|
||||
}
|
||||
|
||||
//- The phase property name as property.phase (using phaseName_)
|
||||
//- \sa IOobject::groupName
|
||||
word phasePropertyName(const word& name) const
|
||||
{
|
||||
return IOobject::groupName(name, phaseName_);
|
||||
}
|
||||
|
||||
//- The phase property name scoped as scope:property.phase
|
||||
//- \sa IOobject::groupName and \sa IOobject::scopedName
|
||||
word phaseScopedName(const std::string& scope, const word& name) const
|
||||
{
|
||||
return IOobject::groupName
|
||||
(
|
||||
IOobject::scopedName(scope, name),
|
||||
phaseName_
|
||||
);
|
||||
}
|
||||
|
||||
static const basicThermo& lookupThermo(const fvPatchScalarField& pf);
|
||||
|
||||
//- Print (filtered) table of thermo names, splits on \c " ,<>"
|
||||
|
||||
@ -58,9 +58,11 @@ namespace functionObjects
|
||||
|
||||
void Foam::functionObjects::BilgerMixtureFraction::calcBilgerMixtureFraction()
|
||||
{
|
||||
if (!mesh_.foundObject<volScalarField>(resultName_, false))
|
||||
auto* resultPtr = mesh_.getObjectPtr<volScalarField>(resultName_);
|
||||
|
||||
if (!resultPtr)
|
||||
{
|
||||
auto tCo = tmp<volScalarField>::New
|
||||
resultPtr = new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
@ -68,15 +70,15 @@ void Foam::functionObjects::BilgerMixtureFraction::calcBilgerMixtureFraction()
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
IOobject::NO_WRITE,
|
||||
IOobject::REGISTER
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar(dimless, Zero)
|
||||
);
|
||||
mesh_.objectRegistry::store(tCo.ptr());
|
||||
mesh_.objectRegistry::store(resultPtr);
|
||||
}
|
||||
|
||||
auto& f_Bilger = mesh_.lookupObjectRef<volScalarField>(resultName_);
|
||||
auto& f_Bilger = *resultPtr;
|
||||
|
||||
auto& Y = thermo_.Y();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user