ENH: use tmp field factory methods [5] (#2723)

- src/lagrangian
This commit is contained in:
Mark Olesen
2024-01-23 10:07:00 +01:00
parent 33f20edbb1
commit 995a9705e2
21 changed files with 415 additions and 600 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -473,8 +473,9 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
cloudName + "Properties", cloudName + "Properties",
mesh_.time().constant(), mesh_.time().constant(),
mesh_, mesh_,
IOobject::MUST_READ_IF_MODIFIED, IOobject::READ_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::REGISTER
) )
), ),
typeIdList_(particleProperties_.lookup("typeIdList")), typeIdList_(particleProperties_.lookup("typeIdList")),
@ -488,7 +489,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -496,7 +498,7 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
( (
IOobject IOobject
( (
this->name() + ":collisionSelectionRemainder", IOobject::scopedName(this->name(), "collisionSelectionRemainder"),
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_ mesh_
), ),
@ -511,7 +513,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -523,7 +526,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -535,7 +539,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -547,7 +552,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -559,7 +565,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -571,7 +578,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -583,7 +591,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -595,7 +604,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -607,7 +617,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -621,7 +632,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -633,7 +645,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_ mesh_
), ),
@ -698,8 +711,9 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
cloudName + "Properties", cloudName + "Properties",
mesh_.time().constant(), mesh_.time().constant(),
mesh_, mesh_,
IOobject::MUST_READ_IF_MODIFIED, IOobject::READ_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::REGISTER
) )
), ),
typeIdList_(particleProperties_.lookup("typeIdList")), typeIdList_(particleProperties_.lookup("typeIdList")),
@ -713,7 +727,8 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_, mesh_,
IOobject::NO_READ, IOobject::NO_READ,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_, mesh_,
dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero), dimensionedScalar(dimensionSet(0, 3, -1, 0, 0), Zero),
@ -723,7 +738,7 @@ Foam::DSMCCloud<ParcelType>::DSMCCloud
( (
IOobject IOobject
( (
this->name() + ":collisionSelectionRemainder", IOobject::scopedName(this->name(), "collisionSelectionRemainder"),
mesh_.time().timeName(), mesh_.time().timeName(),
mesh_ mesh_
), ),

View File

@ -32,24 +32,14 @@ License
Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>> Foam::tmp<Foam::DimensionedField<Foam::vector, Foam::volMesh>>
Foam::coalCloudList::UTrans() const Foam::coalCloudList::UTrans() const
{ {
tmp<volVectorField::Internal> tfld auto tfld = volVectorField::Internal::New
( (
new volVectorField::Internal "UTransEff",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedVector(dimMass*dimVelocity, Zero)
"UTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedVector(dimMass*dimVelocity, Zero)
)
); );
auto& fld = tfld.ref();
volVectorField::Internal& fld = tfld.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -65,8 +55,8 @@ Foam::tmp<Foam::fvVectorMatrix> Foam::coalCloudList::SU
volVectorField& U volVectorField& U
) const ) const
{ {
tmp<fvVectorMatrix> tfvm(new fvVectorMatrix(U, dimForce)); auto tfvm = tmp<fvVectorMatrix>::New(U, dimForce);
fvVectorMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -80,24 +70,14 @@ Foam::tmp<Foam::fvVectorMatrix> Foam::coalCloudList::SU
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::coalCloudList::hsTrans() const Foam::coalCloudList::hsTrans() const
{ {
tmp<volScalarField::Internal> tfld auto tfld = volScalarField::Internal::New
( (
new volScalarField::Internal "hsTransEff",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimEnergy, Zero)
"hsTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(dimEnergy, Zero)
)
); );
auto& fld = tfld.ref();
volScalarField::Internal& fld = tfld.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -113,8 +93,8 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::Sh
volScalarField& hs volScalarField& hs
) const ) const
{ {
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(hs, dimEnergy/dimTime)); auto tfvm = tmp<fvScalarMatrix>::New(hs, dimEnergy/dimTime);
fvScalarMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -131,8 +111,8 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::SYi
volScalarField& Yi volScalarField& Yi
) const ) const
{ {
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(Yi, dimMass/dimTime)); auto tfvm = tmp<fvScalarMatrix>::New(Yi, dimMass/dimTime);
fvScalarMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -146,24 +126,14 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::SYi
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::coalCloudList::rhoTrans() const Foam::coalCloudList::rhoTrans() const
{ {
tmp<volScalarField::Internal> tfld auto tfld = volScalarField::Internal::New
( (
new volScalarField::Internal "rhoTransEff",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimMass, Zero)
"rhoTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(dimMass, Zero)
)
); );
auto& fld = tfld.ref();
volScalarField::Internal& fld = tfld.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -177,29 +147,17 @@ Foam::coalCloudList::rhoTrans() const
} }
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::coalCloudList::Srho() const Foam::coalCloudList::Srho() const
{ {
tmp<volScalarField::Internal> tfld auto tfld = volScalarField::Internal::New
( (
new volScalarField::Internal "rhoTransEff",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimDensity/dimTime, Zero)
"rhoTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(dimDensity/dimTime, Zero)
)
); );
auto& fld = tfld.ref();
volScalarField::Internal& fld = tfld.ref();
forAll(*this, i) forAll(*this, i)
{ {
@ -216,24 +174,14 @@ Foam::coalCloudList::Srho
const label i const label i
) const ) const
{ {
tmp<volScalarField::Internal> tfld auto tfld = volScalarField::Internal::New
( (
new volScalarField::Internal "rhoTransEff",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimDensity/dimTime, Zero)
"rhoTransEff",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar(dimDensity/dimTime, Zero)
)
); );
auto& fld = tfld.ref();
volScalarField::Internal& fld = tfld.ref();
forAll(*this, j) forAll(*this, j)
{ {
@ -249,8 +197,8 @@ Foam::tmp<Foam::fvScalarMatrix> Foam::coalCloudList::Srho
volScalarField& rho volScalarField& rho
) const ) const
{ {
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(rho, dimMass/dimTime)); auto tfvm = tmp<fvScalarMatrix>::New(rho, dimMass/dimTime);
fvScalarMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
forAll(*this, i) forAll(*this, i)
{ {

View File

@ -360,8 +360,9 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
cloudName + "Properties", cloudName + "Properties",
mesh_.time().constant(), mesh_.time().constant(),
mesh_, mesh_,
IOobject::MUST_READ_IF_MODIFIED, IOobject::READ_MODIFIED,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::REGISTER
) )
), ),
outputProperties_ outputProperties_
@ -373,7 +374,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
"uniform"/cloud::prefix/cloudName, "uniform"/cloud::prefix/cloudName,
mesh_, mesh_,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::REGISTER
) )
), ),
solution_(mesh_, particleProperties_.subDict("solution")), solution_(mesh_, particleProperties_.subDict("solution")),
@ -438,7 +440,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_, mesh_,
dimensionedScalar(dimMass, Zero) dimensionedScalar(dimMass, Zero)
@ -454,7 +457,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_, mesh_,
dimensionedVector(dimMass*dimVelocity, Zero) dimensionedVector(dimMass*dimVelocity, Zero)
@ -470,7 +474,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh_, mesh_,
dimensionedScalar(dimMass, Zero) dimensionedScalar(dimMass, Zero)
@ -571,7 +576,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
( (
IOobject IOobject
( (
name + ":UCoeff", IOobject::scopedName(this->name(), "UCoeff"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -515,24 +515,15 @@ Foam::KinematicCloud<CloudType>::Srhok() const
return rhokTrans()/this->db().time().deltaT()/this->mesh().V(); return rhokTrans()/this->db().time().deltaT()/this->mesh().V();
} }
return return tmp<volScalarField::Internal>::New
tmp<volScalarField::Internal>::New (
this->newIOobject(IOobject::scopedName(this->name(), "rhokTrans")),
this->mesh(),
dimensionedScalar
( (
IOobject rhokTrans().dimensions()/dimTime/dimVolume, Zero
( )
IOobject::scopedName(this->name(), "rhokTrans"), );
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar
(
rhokTrans().dimensions()/dimTime/dimVolume, Zero
)
);
} }
@ -571,8 +562,8 @@ const
} }
else else
{ {
tmp<fvVectorMatrix> tfvm(new fvVectorMatrix(U, dim)); auto tfvm = tmp<fvVectorMatrix>::New(U, dim);
fvVectorMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
fvm.source() = -UTrans()/(this->db().time().deltaT()); fvm.source() = -UTrans()/(this->db().time().deltaT());
@ -588,26 +579,15 @@ template<class CloudType>
inline const Foam::tmp<Foam::volScalarField> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::vDotSweep() const Foam::KinematicCloud<CloudType>::vDotSweep() const
{ {
tmp<volScalarField> tvDotSweep auto tvDotSweep = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject(IOobject::scopedName(this->name(), "vDotSweep")),
( mesh_,
IOobject dimensionedScalar(dimless/dimTime, Zero),
( fvPatchFieldBase::extrapolatedCalculatedType()
IOobject::scopedName(this->name(), "vDotSweep"),
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimless/dimTime, Zero),
fvPatchFieldBase::extrapolatedCalculatedType()
)
); );
auto& vDotSweep = tvDotSweep.ref();
volScalarField& vDotSweep = tvDotSweep.ref();
for (const parcelType& p : *this) for (const parcelType& p : *this)
{ {
const label celli = p.cell(); const label celli = p.cell();
@ -626,26 +606,15 @@ template<class CloudType>
inline const Foam::tmp<Foam::volScalarField> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::theta() const Foam::KinematicCloud<CloudType>::theta() const
{ {
tmp<volScalarField> ttheta auto ttheta = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject(IOobject::scopedName(this->name(), "theta")),
( mesh_,
IOobject dimensionedScalar(dimless, Zero),
( fvPatchFieldBase::extrapolatedCalculatedType()
IOobject::scopedName(this->name(), "theta"),
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimless, Zero),
fvPatchFieldBase::extrapolatedCalculatedType()
)
); );
auto& theta = ttheta.ref();
volScalarField& theta = ttheta.ref();
for (const parcelType& p : *this) for (const parcelType& p : *this)
{ {
const label celli = p.cell(); const label celli = p.cell();
@ -664,22 +633,11 @@ template<class CloudType>
inline const Foam::tmp<Foam::volScalarField> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::alpha() const Foam::KinematicCloud<CloudType>::alpha() const
{ {
tmp<volScalarField> talpha auto talpha = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject(IOobject::scopedName(this->name(), "alpha")),
( mesh_,
IOobject dimensionedScalar(dimless, Zero)
(
IOobject::scopedName(this->name(), "alpha"),
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimless, Zero)
)
); );
scalarField& alpha = talpha.ref().primitiveFieldRef(); scalarField& alpha = talpha.ref().primitiveFieldRef();
@ -700,22 +658,11 @@ template<class CloudType>
inline const Foam::tmp<Foam::volScalarField> inline const Foam::tmp<Foam::volScalarField>
Foam::KinematicCloud<CloudType>::rhoEff() const Foam::KinematicCloud<CloudType>::rhoEff() const
{ {
tmp<volScalarField> trhoEff auto trhoEff = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject(IOobject::scopedName(this->name(), "rhoEff")),
( mesh_,
IOobject dimensionedScalar(dimDensity, Zero)
(
IOobject::scopedName(this->name(), "rhoEff"),
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimDensity, Zero)
)
); );
scalarField& rhoEff = trhoEff.ref().primitiveFieldRef(); scalarField& rhoEff = trhoEff.ref().primitiveFieldRef();

View File

@ -120,7 +120,15 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
// Set storage for mass source fields and initialise to zero // Set storage for mass source fields and initialise to zero
forAll(rhoTrans_, i) forAll(rhoTrans_, i)
{ {
const word& specieName = thermo.carrier().species()[i]; const word fieldName
(
IOobject::scopedName
(
this->name(),
"rhoTrans_" + thermo.carrier().species()[i]
)
);
rhoTrans_.set rhoTrans_.set
( (
i, i,
@ -128,11 +136,12 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
( (
IOobject IOobject
( (
this->name() + ":rhoTrans_" + specieName, fieldName,
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh(), this->mesh(),
dimensionedScalar(dimMass, Zero) dimensionedScalar(dimMass, Zero)
@ -164,7 +173,15 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
{ {
forAll(c.rhoTrans_, i) forAll(c.rhoTrans_, i)
{ {
const word& specieName = this->thermo().carrier().species()[i]; const word fieldName
(
IOobject::scopedName
(
this->name(),
"rhoTrans_" + this->thermo().carrier().species()[i]
)
);
rhoTrans_.set rhoTrans_.set
( (
i, i,
@ -172,7 +189,7 @@ Foam::ReactingCloud<CloudType>::ReactingCloud
( (
IOobject IOobject
( (
this->name() + ":rhoTrans_" + specieName, fieldName,
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -144,25 +145,14 @@ inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
{ {
if (this->solution().semiImplicit("Yi")) if (this->solution().semiImplicit("Yi"))
{ {
tmp<volScalarField> trhoTrans auto trhoTrans = volScalarField::New
( (
new volScalarField IOobject::scopedName(this->name(), "rhoTrans"),
( IOobject::NO_REGISTER,
IOobject this->mesh(),
( dimensionedScalar(dimMass/dimTime/dimVolume, Zero)
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar(dimMass/dimTime/dimVolume, Zero)
)
); );
auto& sourceField = trhoTrans.ref();
volScalarField& sourceField = trhoTrans.ref();
sourceField.primitiveFieldRef() = sourceField.primitiveFieldRef() =
rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V()); rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V());
@ -175,8 +165,8 @@ inline Foam::tmp<Foam::fvScalarMatrix> Foam::ReactingCloud<CloudType>::SYi
} }
else else
{ {
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(Yi, dimMass/dimTime)); auto tfvm = tmp<fvScalarMatrix>::New(Yi, dimMass/dimTime);
fvScalarMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
fvm.source() = -rhoTrans_[i]/this->db().time().deltaTValue(); fvm.source() = -rhoTrans_[i]/this->db().time().deltaTValue();
@ -192,30 +182,20 @@ template<class CloudType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::ReactingCloud<CloudType>::Srho(const label i) const Foam::ReactingCloud<CloudType>::Srho(const label i) const
{ {
tmp<volScalarField::Internal> tRhoi auto tRhoi = volScalarField::Internal::New
( (
new volScalarField::Internal IOobject::scopedName(this->name(), "rhoTrans"),
IOobject::NO_REGISTER,
this->mesh(),
dimensionedScalar
( (
IOobject rhoTrans_[0].dimensions()/dimTime/dimVolume, Zero
(
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar
(
rhoTrans_[0].dimensions()/dimTime/dimVolume, Zero
)
) )
); );
scalarField& rhoi = tRhoi.ref();
if (this->solution().coupled()) if (this->solution().coupled())
{ {
scalarField& rhoi = tRhoi.ref();
rhoi = rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V()); rhoi = rhoTrans_[i]/(this->db().time().deltaTValue()*this->mesh().V());
} }
@ -227,30 +207,20 @@ template<class CloudType>
inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh>>
Foam::ReactingCloud<CloudType>::Srho() const Foam::ReactingCloud<CloudType>::Srho() const
{ {
tmp<volScalarField::Internal> trhoTrans auto trhoTrans = volScalarField::Internal::New
( (
new volScalarField::Internal IOobject::scopedName(this->name(), "rhoTrans"),
IOobject::NO_REGISTER,
this->mesh(),
dimensionedScalar
( (
IOobject rhoTrans_[0].dimensions()/dimTime/dimVolume, Zero
(
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar
(
rhoTrans_[0].dimensions()/dimTime/dimVolume, Zero
)
) )
); );
scalarField& sourceField = trhoTrans.ref();
if (this->solution().coupled()) if (this->solution().coupled())
{ {
scalarField& sourceField = trhoTrans.ref();
forAll(rhoTrans_, i) forAll(rhoTrans_, i)
{ {
sourceField += rhoTrans_[i]; sourceField += rhoTrans_[i];
@ -269,29 +239,17 @@ Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
{ {
if (this->solution().coupled()) if (this->solution().coupled())
{ {
tmp<volScalarField> trhoTrans auto trhoTrans = volScalarField::New
( (
new volScalarField IOobject::scopedName(this->name(), "rhoTrans"),
( IOobject::NO_REGISTER,
IOobject this->mesh(),
( dimensionedScalar(dimMass/dimTime/dimVolume, Zero)
this->name() + ":rhoTrans",
this->db().time().timeName(),
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar(dimMass/dimTime/dimVolume, Zero)
)
); );
scalarField& sourceField = trhoTrans.ref(); scalarField& sourceField = trhoTrans.ref();
if (this->solution().semiImplicit("rho")) if (this->solution().semiImplicit("rho"))
{ {
forAll(rhoTrans_, i) forAll(rhoTrans_, i)
{ {
sourceField += rhoTrans_[i]; sourceField += rhoTrans_[i];
@ -302,8 +260,8 @@ Foam::ReactingCloud<CloudType>::Srho(volScalarField& rho) const
} }
else else
{ {
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(rho, dimMass/dimTime)); auto tfvm = tmp<fvScalarMatrix>::New(rho, dimMass/dimTime);
fvScalarMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
forAll(rhoTrans_, i) forAll(rhoTrans_, i)
{ {

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -64,11 +64,12 @@ void Foam::ThermoCloud<CloudType>::setModels()
( (
IOobject IOobject
( (
this->name() + ":radAreaP", IOobject::scopedName(this->name(), "radAreaP"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh(), this->mesh(),
dimensionedScalar(dimArea, Zero) dimensionedScalar(dimArea, Zero)
@ -81,11 +82,12 @@ void Foam::ThermoCloud<CloudType>::setModels()
( (
IOobject IOobject
( (
this->name() + ":radT4", IOobject::scopedName(this->name(), "radT4"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh(), this->mesh(),
dimensionedScalar(pow4(dimTemperature), Zero) dimensionedScalar(pow4(dimTemperature), Zero)
@ -98,11 +100,12 @@ void Foam::ThermoCloud<CloudType>::setModels()
( (
IOobject IOobject
( (
this->name() + ":radAreaPT4", IOobject::scopedName(this->name(), "radAreaPT4"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh(), this->mesh(),
dimensionedScalar(sqr(dimLength)*pow4(dimTemperature), Zero) dimensionedScalar(sqr(dimLength)*pow4(dimTemperature), Zero)
@ -164,11 +167,12 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":hsTrans", IOobject::scopedName(this->name(), "hsTrans"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh(), this->mesh(),
dimensionedScalar(dimEnergy, Zero) dimensionedScalar(dimEnergy, Zero)
@ -180,11 +184,12 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":hsCoeff", IOobject::scopedName(this->name(), "hsCoeff"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
this->mesh(), this->mesh(),
dimensionedScalar(dimEnergy/dimTemperature, Zero) dimensionedScalar(dimEnergy/dimTemperature, Zero)
@ -235,7 +240,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":hsTrans", IOobject::scopedName(this->name(), "hsTrans"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -251,7 +256,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":hsCoeff", IOobject::scopedName(this->name(), "hsCoeff"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -270,7 +275,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":radAreaP", IOobject::scopedName(this->name(), "radAreaP"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -287,7 +292,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":radT4", IOobject::scopedName(this->name(), "radT4"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,
@ -304,7 +309,7 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
( (
IOobject IOobject
( (
this->name() + ":radAreaPT4", IOobject::scopedName(this->name(), "radAreaPT4"),
this->db().time().timeName(), this->db().time().timeName(),
this->db(), this->db(),
IOobject::NO_READ, IOobject::NO_READ,

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019-2022 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -260,8 +260,8 @@ Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
} }
else else
{ {
tmp<fvScalarMatrix> tfvm(new fvScalarMatrix(hs, dimEnergy/dimTime)); auto tfvm = tmp<fvScalarMatrix>::New(hs, dimEnergy/dimTime);
fvScalarMatrix& fvm = tfvm.ref(); auto& fvm = tfvm.ref();
fvm.source() = -hsTrans()/(this->db().time().deltaT()); fvm.source() = -hsTrans()/(this->db().time().deltaT());
@ -276,22 +276,14 @@ Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
template<class CloudType> template<class CloudType>
inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
{ {
tmp<volScalarField> tEp auto tEp = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject
( (
IOobject IOobject::scopedName(this->name(), "radiation", "Ep")
( ),
this->name() + ":radiation:Ep", this->mesh(),
this->db().time().timeName(), dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
); );
if (radiation_) if (radiation_)
@ -312,22 +304,14 @@ inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::Ep() const
template<class CloudType> template<class CloudType>
inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const inline Foam::tmp<Foam::volScalarField> Foam::ThermoCloud<CloudType>::ap() const
{ {
tmp<volScalarField> tap auto tap = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject
( (
IOobject IOobject::scopedName(this->name(), "radiation", "ap")
( ),
this->name() + ":radiation:ap", this->mesh(),
this->db().time().timeName(), dimensionedScalar(dimless/dimLength, Zero)
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar(dimless/dimLength, Zero)
)
); );
if (radiation_) if (radiation_)
@ -349,22 +333,14 @@ template<class CloudType>
inline Foam::tmp<Foam::volScalarField> inline Foam::tmp<Foam::volScalarField>
Foam::ThermoCloud<CloudType>::sigmap() const Foam::ThermoCloud<CloudType>::sigmap() const
{ {
tmp<volScalarField> tsigmap auto tsigmap = tmp<volScalarField>::New
( (
new volScalarField this->newIOobject
( (
IOobject IOobject::scopedName(this->name(), "radiation", "sigmap")
( ),
this->name() + ":radiation:sigmap", this->mesh(),
this->db().time().timeName(), dimensionedScalar(dimless/dimLength, Zero)
this->db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
this->mesh(),
dimensionedScalar(dimless/dimLength, Zero)
)
); );
if (radiation_) if (radiation_)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -73,7 +73,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":volumeAverage", IOobject::scopedName(cloud.name(), "volumeAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -87,7 +87,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":radiusAverage", IOobject::scopedName(cloud.name(), "radiusAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -101,7 +101,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":rhoAverage", IOobject::scopedName(cloud.name(), "rhoAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -115,7 +115,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":uAverage", IOobject::scopedName(cloud.name(), "uAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -129,7 +129,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":uSqrAverage", IOobject::scopedName(cloud.name(), "uSqrAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -143,7 +143,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":frequencyAverage", IOobject::scopedName(cloud.name(), "frequencyAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -157,7 +157,7 @@ inline Foam::KinematicParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":massAverage", IOobject::scopedName(cloud.name(), "massAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -287,7 +287,7 @@ updateAverages
( (
IOobject IOobject
( (
cloud.name() + ":weightAverage", IOobject::scopedName(cloud.name(), "weightAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -366,4 +366,5 @@ updateAverages
frequencyAverage_->average(weightAverage); frequencyAverage_->average(weightAverage);
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -45,7 +45,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":volumeAverage", IOobject::scopedName(cloud.name(), "volumeAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -59,7 +59,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":radiusAverage", IOobject::scopedName(cloud.name(), "radiusAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -73,7 +73,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":rhoAverage", IOobject::scopedName(cloud.name(), "rhoAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -87,7 +87,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":uAverage", IOobject::scopedName(cloud.name(), "uAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -101,7 +101,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":uSqrAverage", IOobject::scopedName(cloud.name(), "uSqrAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -115,7 +115,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":frequencyAverage", IOobject::scopedName(cloud.name(), "frequencyAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -129,7 +129,7 @@ inline Foam::MPPICParcel<ParcelType>::trackingData::trackingData
( (
IOobject IOobject
( (
cloud.name() + ":massAverage", IOobject::scopedName(cloud.name(), "massAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),
@ -164,7 +164,7 @@ inline void Foam::MPPICParcel<ParcelType>::trackingData::updateAverages
( (
IOobject IOobject
( (
cloud.name() + ":weightAverage", IOobject::scopedName(cloud.name(), "weightAverage"),
cloud.db().time().timeName(), cloud.db().time().timeName(),
cloud.mesh() cloud.mesh()
), ),

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2018 OpenFOAM Foundation Copyright (C) 2018 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -39,36 +39,42 @@ void Foam::PatchCollisionDensity<CloudType>::write()
{ {
const scalarField z(this->owner().mesh().nCells(), Zero); const scalarField z(this->owner().mesh().nCells(), Zero);
volScalarField {
( volScalarField
IOobject
( (
this->owner().name() + ":collisionDensity", this->owner().mesh().newIOobject
this->owner().mesh().time().timeName(), (
this->owner().mesh() IOobject::scopedName
), (
this->owner().mesh(), this->owner().name(),
dimless/dimArea, "collisionDensity"
z, )
collisionDensity_ ),
) this->owner().mesh(),
.write(); dimless/dimArea,
z,
collisionDensity_
).write();
}
volScalarField {
( volScalarField
IOobject
( (
this->owner().name() + ":collisionDensityRate", this->owner().mesh().newIOobject
this->owner().mesh().time().timeName(), (
this->owner().mesh() IOobject::scopedName
), (
this->owner().mesh(), this->owner().name(),
dimless/dimArea/dimTime, "collisionDensityRate"
z, )
(collisionDensity_ - collisionDensity0_) ),
/(this->owner().mesh().time().value() - time0_) this->owner().mesh(),
) dimless/dimArea/dimTime,
.write(); z,
(collisionDensity_ - collisionDensity0_)
/(this->owner().mesh().time().value() - time0_)
).write();
}
collisionDensity0_ == collisionDensity_; collisionDensity0_ == collisionDensity_;
time0_ = this->owner().mesh().time().value(); time0_ = this->owner().mesh().time().value();
@ -106,11 +112,11 @@ Foam::PatchCollisionDensity<CloudType>::PatchCollisionDensity
IOobject io IOobject io
( (
this->owner().name() + ":collisionDensity", this->owner().mesh().newIOobject
this->owner().mesh().time().timeName(), (
this->owner().mesh(), IOobject::scopedName(this->owner().name(), "collisionDensity"),
IOobject::MUST_READ, IOobject::MUST_READ
IOobject::NO_WRITE )
); );
if (io.typeHeaderOk<volScalarField>()) if (io.typeHeaderOk<volScalarField>())

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com \\ / A nd | www.openfoam.com
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -50,7 +50,7 @@ void Foam::PatchInteractionFields<CloudType>::clearOrReset
{ {
if (fieldPtr) if (fieldPtr)
{ {
fieldPtr->primitiveFieldRef() = 0.0; fieldPtr->primitiveFieldRef() = scalar(0);
} }
else else
{ {
@ -62,11 +62,17 @@ void Foam::PatchInteractionFields<CloudType>::clearOrReset
( (
IOobject IOobject
( (
this->owner().name() + ":" + this->modelName() + ":" + fieldName, IOobject::scopedName
(
this->owner().name(),
this->modelName(),
fieldName
),
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh,
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE IOobject::NO_WRITE,
IOobject::NO_REGISTER
), ),
mesh, mesh,
dimensionedScalar(dims, Zero) dimensionedScalar(dims, Zero)

View File

@ -75,9 +75,9 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
if (writeFields_) if (writeFields_)
{ {
Info<< " Interaction fields will be written to " Info<< " Interaction fields will be written to "
<< this->owner().name() << ":massEscape" << IOobject::scopedName(this->owner().name(), "massEscape")
<< " and " << " and "
<< this->owner().name() << ":massStick" << endl; << IOobject::scopedName(this->owner().name(), "massStick") << endl;
(void)massEscape(); (void)massEscape();
(void)massStick(); (void)massStick();
@ -164,11 +164,12 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massEscape()
( (
IOobject IOobject
( (
this->owner().name() + ":massEscape", IOobject::scopedName(this->owner().name(), "massEscape"),
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh.thisDb(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh, mesh,
dimensionedScalar(dimMass, Zero) dimensionedScalar(dimMass, Zero)
@ -193,11 +194,12 @@ Foam::volScalarField& Foam::LocalInteraction<CloudType>::massStick()
( (
IOobject IOobject
( (
this->owner().name() + ":massStick", IOobject::scopedName(this->owner().name(), "massStick"),
mesh.time().timeName(), mesh.time().timeName(),
mesh, mesh.thisDb(),
IOobject::READ_IF_PRESENT, IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE IOobject::AUTO_WRITE,
IOobject::REGISTER
), ),
mesh, mesh,
dimensionedScalar(dimMass, Zero) dimensionedScalar(dimMass, Zero)

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2019-2021 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -146,50 +146,41 @@ bool Foam::AveragingMethod<Type>::write(const bool writeOnProc) const
Field<scalar> pointVolume(mesh_.nPoints(), Zero); Field<scalar> pointVolume(mesh_.nPoints(), Zero);
// output fields // output fields
GeometricField<Type, fvPatchField, volMesh> cellValue auto tcellValue = GeometricField<Type, fvPatchField, volMesh>::New
( (
IOobject IOobject::scopedName(this->name(), "cellValue"),
( IOobject::NO_REGISTER,
this->name() + ":cellValue",
this->time().timeName(),
mesh_
),
mesh_, mesh_,
dimensioned<Type>(dimless, Zero) dimensioned<Type>(dimless, Zero)
); );
GeometricField<TypeGrad, fvPatchField, volMesh> cellGrad auto& cellValue = tcellValue.ref();
auto tcellGrad = GeometricField<TypeGrad, fvPatchField, volMesh>::New
( (
IOobject IOobject::scopedName(this->name(), "cellGrad"),
( IOobject::NO_REGISTER,
this->name() + ":cellGrad",
this->time().timeName(),
mesh_
),
mesh_, mesh_,
dimensioned<TypeGrad>(dimless, Zero) dimensioned<TypeGrad>(dimless, Zero)
); );
GeometricField<Type, pointPatchField, pointMesh> pointValue auto& cellGrad = tcellGrad.ref();
auto tpointValue = GeometricField<Type, pointPatchField, pointMesh>::New
( (
IOobject IOobject::scopedName(this->name(), "pointValue"),
( IOobject::NO_REGISTER,
this->name() + ":pointValue",
this->time().timeName(),
mesh_
),
pointMesh_, pointMesh_,
dimensioned<Type>(dimless, Zero) dimensioned<Type>(dimless, Zero)
); );
GeometricField<TypeGrad, pointPatchField, pointMesh> pointGrad auto& pointValue = tpointValue.ref();
auto tpointGrad = GeometricField<TypeGrad, pointPatchField, pointMesh>::New
( (
IOobject IOobject::scopedName(this->name(), "pointGrad"),
( IOobject::NO_REGISTER,
this->name() + ":pointGrad",
this->time().timeName(),
mesh_
),
pointMesh_, pointMesh_,
dimensioned<TypeGrad>(dimless, Zero) dimensioned<TypeGrad>(dimless, Zero)
); );
auto& pointGrad = tpointGrad.ref();
// Barycentric coordinates of the tet vertices // Barycentric coordinates of the tet vertices
const FixedList<barycentric, 4> const FixedList<barycentric, 4>

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -72,30 +73,30 @@ void Foam::DampingModels::Relaxation<CloudType>::cacheFields(const bool store)
const fvMesh& mesh = this->owner().mesh(); const fvMesh& mesh = this->owner().mesh();
const word& cloudName = this->owner().name(); const word& cloudName = this->owner().name();
const AveragingMethod<scalar>& volumeAverage = const auto& volumeAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":volumeAverage" IOobject::scopedName(cloudName, "volumeAverage")
); );
const AveragingMethod<scalar>& radiusAverage = const auto& radiusAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":radiusAverage" IOobject::scopedName(cloudName, "radiusAverage")
); );
const AveragingMethod<vector>& uAverage = const auto& uAverage =
mesh.lookupObject<AveragingMethod<vector>> mesh.lookupObject<AveragingMethod<vector>>
( (
cloudName + ":uAverage" IOobject::scopedName(cloudName, "uAverage")
); );
const AveragingMethod<scalar>& uSqrAverage = const auto& uSqrAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":uSqrAverage" IOobject::scopedName(cloudName, "uSqrAverage")
); );
const AveragingMethod<scalar>& frequencyAverage = const auto& frequencyAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":frequencyAverage" IOobject::scopedName(cloudName, "frequencyAverage")
); );
uAverage_ = &uAverage; uAverage_ = &uAverage;
@ -106,7 +107,7 @@ void Foam::DampingModels::Relaxation<CloudType>::cacheFields(const bool store)
( (
IOobject IOobject
( (
cloudName + ":oneByTimeScaleAverage", IOobject::scopedName(cloudName, "oneByTimeScaleAverage"),
this->owner().db().time().timeName(), this->owner().db().time().timeName(),
mesh mesh
), ),

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd. Copyright (C) 2019-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -105,35 +105,35 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
const scalar oneBySqrtThree = sqrt(1.0/3.0); const scalar oneBySqrtThree = sqrt(1.0/3.0);
const AveragingMethod<scalar>& volumeAverage = const auto& volumeAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
this->owner().name() + ":volumeAverage" IOobject::scopedName(this->owner().name(), "volumeAverage")
); );
const AveragingMethod<scalar>& radiusAverage = const auto& radiusAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
this->owner().name() + ":radiusAverage" IOobject::scopedName(this->owner().name(), "radiusAverage")
); );
const AveragingMethod<vector>& uAverage = const auto& uAverage =
mesh.lookupObject<AveragingMethod<vector>> mesh.lookupObject<AveragingMethod<vector>>
( (
this->owner().name() + ":uAverage" IOobject::scopedName(this->owner().name(), "uAverage")
); );
const AveragingMethod<scalar>& uSqrAverage = const auto& uSqrAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
this->owner().name() + ":uSqrAverage" IOobject::scopedName(this->owner().name(), "uSqrAverage")
); );
const AveragingMethod<scalar>& frequencyAverage = const auto& frequencyAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
this->owner().name() + ":frequencyAverage" IOobject::scopedName(this->owner().name(), "frequencyAverage")
); );
const AveragingMethod<scalar>& massAverage = const auto& massAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
this->owner().name() + ":massAverage" IOobject::scopedName(this->owner().name(), "massAverage")
); );
// calculate time scales and pdf exponent // calculate time scales and pdf exponent
@ -143,7 +143,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
( (
IOobject IOobject
( (
this->owner().name() + ":exponentAverage", IOobject::scopedName(this->owner().name(), "exponentAverage"),
this->owner().db().time().timeName(), this->owner().db().time().timeName(),
mesh mesh
), ),
@ -191,7 +191,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
( (
IOobject IOobject
( (
this->owner().name() + ":uTildeAverage", IOobject::scopedName(this->owner().name(), "uTildeAverage"),
this->owner().db().time().timeName(), this->owner().db().time().timeName(),
mesh mesh
), ),
@ -213,7 +213,7 @@ void Foam::IsotropyModels::Stochastic<CloudType>::calculate()
( (
IOobject IOobject
( (
this->owner().name() + ":uTildeSqrAverage", IOobject::scopedName(this->owner().name(), "uTildeSqrAverage"),
this->owner().db().time().timeName(), this->owner().db().time().timeName(),
mesh mesh
), ),

View File

@ -6,7 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2020 OpenCFD Ltd. Copyright (C) 2020-2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -83,25 +83,25 @@ void Foam::PackingModels::Explicit<CloudType>::cacheFields(const bool store)
const fvMesh& mesh = this->owner().mesh(); const fvMesh& mesh = this->owner().mesh();
const word& cloudName = this->owner().name(); const word& cloudName = this->owner().name();
const AveragingMethod<scalar>& volumeAverage = const auto& volumeAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":volumeAverage" IOobject::scopedName(cloudName, "volumeAverage")
); );
const AveragingMethod<scalar>& rhoAverage = const auto& rhoAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":rhoAverage" IOobject::scopedName(cloudName, "rhoAverage")
); );
const AveragingMethod<vector>& uAverage = const auto& uAverage =
mesh.lookupObject<AveragingMethod<vector>> mesh.lookupObject<AveragingMethod<vector>>
( (
cloudName + ":uAverage" IOobject::scopedName(cloudName, "uAverage")
); );
const AveragingMethod<scalar>& uSqrAverage = const auto& uSqrAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":uSqrAverage" IOobject::scopedName(cloudName, "uSqrAverage")
); );
volumeAverage_ = &volumeAverage; volumeAverage_ = &volumeAverage;
@ -113,7 +113,7 @@ void Foam::PackingModels::Explicit<CloudType>::cacheFields(const bool store)
( (
IOobject IOobject
( (
cloudName + ":stressAverage", IOobject::scopedName(cloudName, "stressAverage"),
this->owner().db().time().timeName(), this->owner().db().time().timeName(),
mesh mesh
), ),

View File

@ -6,6 +6,7 @@
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Copyright (C) 2013-2017 OpenFOAM Foundation Copyright (C) 2013-2017 OpenFOAM Foundation
Copyright (C) 2023 OpenCFD Ltd.
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
This file is part of OpenFOAM. This file is part of OpenFOAM.
@ -48,7 +49,7 @@ Foam::PackingModels::Implicit<CloudType>::Implicit
( (
IOobject IOobject
( (
this->owner().name() + ":alpha", IOobject::scopedName(this->owner().name(), "alpha"),
this->owner().db().time().timeName(), this->owner().db().time().timeName(),
this->owner().mesh(), this->owner().mesh(),
IOobject::NO_READ, IOobject::NO_READ,
@ -112,20 +113,20 @@ void Foam::PackingModels::Implicit<CloudType>::cacheFields(const bool store)
const dimensionedVector& g = this->owner().g(); const dimensionedVector& g = this->owner().g();
const volScalarField& rhoc = this->owner().rho(); const volScalarField& rhoc = this->owner().rho();
const AveragingMethod<scalar>& rhoAverage = const auto& rhoAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":rhoAverage" IOobject::scopedName(cloudName, "rhoAverage")
); );
const AveragingMethod<vector>& uAverage = const auto& uAverage =
mesh.lookupObject<AveragingMethod<vector>> mesh.lookupObject<AveragingMethod<vector>>
( (
cloudName + ":uAverage" IOobject::scopedName(cloudName, "uAverage")
); );
const AveragingMethod<scalar>& uSqrAverage = const auto& uSqrAverage =
mesh.lookupObject<AveragingMethod<scalar>> mesh.lookupObject<AveragingMethod<scalar>>
( (
cloudName + ":uSqrAverage" IOobject::scopedName(cloudName, "uSqrAverage")
); );
mesh.setFluxRequired(alpha_.name()); mesh.setFluxRequired(alpha_.name());
@ -138,20 +139,15 @@ void Foam::PackingModels::Implicit<CloudType>::cacheFields(const bool store)
alpha_.correctBoundaryConditions(); alpha_.correctBoundaryConditions();
// average density // average density
volScalarField rho auto trho = volScalarField::New
( (
IOobject IOobject::scopedName(cloudName, "rho"),
(
cloudName + ":rho",
this->owner().db().time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh, mesh,
dimensionedScalar(dimDensity, Zero), dimensionedScalar(dimDensity, Zero),
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
auto& rho = trho.ref();
rho.primitiveFieldRef() = max(rhoAverage.primitiveField(), rhoMin_); rho.primitiveFieldRef() = max(rhoAverage.primitiveField(), rhoMin_);
rho.correctBoundaryConditions(); rho.correctBoundaryConditions();
@ -159,20 +155,14 @@ void Foam::PackingModels::Implicit<CloudType>::cacheFields(const bool store)
// ~~~~~~~~~~~~ // ~~~~~~~~~~~~
// stress derivative wrt volume fraction // stress derivative wrt volume fraction
volScalarField tauPrime auto ttauPrime = volScalarField::New
( (
IOobject IOobject::scopedName(cloudName, "tauPrime"),
(
cloudName + ":tauPrime",
this->owner().db().time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh, mesh,
dimensionedScalar(dimPressure, Zero), dimensionedScalar(dimPressure, Zero),
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
auto& tauPrime = ttauPrime.ref();
tauPrime.primitiveFieldRef() = tauPrime.primitiveFieldRef() =
this->particleStressModel_->dTaudTheta this->particleStressModel_->dTaudTheta
@ -191,27 +181,24 @@ void Foam::PackingModels::Implicit<CloudType>::cacheFields(const bool store)
tmp<surfaceScalarField> phiGByA; tmp<surfaceScalarField> phiGByA;
if (applyGravity_) if (applyGravity_)
( {
phiGByA = tmp<surfaceScalarField> phiGByA = surfaceScalarField::New
( (
new surfaceScalarField "phiGByA",
( IOobject::NO_REGISTER,
"phiGByA", deltaT*(g & mesh.Sf())*fvc::interpolate(1.0 - rhoc/rho)
deltaT*(g & mesh.Sf())*fvc::interpolate(1.0 - rhoc/rho) );
) }
)
);
// Implicit solution for the volume fraction // Implicit solution for the volume fraction
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
surfaceScalarField surfaceScalarField tauPrimeByRhoAf
tauPrimeByRhoAf (
( "tauPrimeByRhoAf",
"tauPrimeByRhoAf", fvc::interpolate(deltaT*tauPrime/rho)
fvc::interpolate(deltaT*tauPrime/rho) );
);
fvScalarMatrix alphaEqn fvScalarMatrix alphaEqn
( (
@ -232,38 +219,32 @@ void Foam::PackingModels::Implicit<CloudType>::cacheFields(const bool store)
// ~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~
// correction volumetric flux // correction volumetric flux
phiCorrect_ = tmp<surfaceScalarField> phiCorrect_ = surfaceScalarField::New
( (
new surfaceScalarField IOobject::scopedName(cloudName, "phiCorrect"),
( IOobject::NO_REGISTER,
cloudName + ":phiCorrect", alphaEqn.flux()/fvc::interpolate(alpha_)
alphaEqn.flux()/fvc::interpolate(alpha_)
)
); );
// limit the correction flux // limit the correction flux
if (applyLimiting_) if (applyLimiting_)
{ {
volVectorField U auto tU = volVectorField::New
( (
IOobject IOobject::scopedName(cloudName, "U"),
( IOobject::NO_REGISTER,
cloudName + ":U",
this->owner().db().time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh, mesh,
dimensionedVector(dimVelocity, Zero), dimensionedVector(dimVelocity, Zero),
fvPatchFieldBase::zeroGradientType() fvPatchFieldBase::zeroGradientType()
); );
auto& U = tU.ref();
U.primitiveFieldRef() = uAverage.primitiveField(); U.primitiveFieldRef() = uAverage.primitiveField();
U.correctBoundaryConditions(); U.correctBoundaryConditions();
surfaceScalarField phi surfaceScalarField phi
( (
cloudName + ":phi", IOobject::scopedName(cloudName, "phi"),
linearInterpolate(U) & mesh.Sf() linearInterpolate(U) & mesh.Sf()
); );
@ -303,14 +284,11 @@ void Foam::PackingModels::Implicit<CloudType>::cacheFields(const bool store)
} }
// correction velocity // correction velocity
uCorrect_ = tmp<volVectorField> uCorrect_ = volVectorField::New
( (
new volVectorField IOobject::scopedName(cloudName, "uCorrect"),
( IOobject::NO_REGISTER,
cloudName + ":uCorrect", fvc::reconstruct(phiCorrect_())
fvc::reconstruct(phiCorrect_())
)
); );
uCorrect_->correctBoundaryConditions(); uCorrect_->correctBoundaryConditions();

View File

@ -107,17 +107,15 @@ Foam::ParticleStressModel::tau
const FieldField<Field, scalar>& uRms const FieldField<Field, scalar>& uRms
) const ) const
{ {
tmp<FieldField<Field, scalar>> value auto tvalue = tmp<FieldField<Field, scalar>>::New(alpha.size());
( auto& value = tvalue.ref();
new FieldField<Field, scalar>(alpha.size())
);
forAll(alpha, i) forAll(alpha, i)
{ {
value->set(i, tau(alpha[i], rho[i], uRms[i])); value.set(i, tau(alpha[i], rho[i], uRms[i]));
} }
return value; return tvalue;
} }

View File

@ -72,29 +72,19 @@ Foam::radiation::cloudAbsorptionEmission::~cloudAbsorptionEmission()
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::radiation::cloudAbsorptionEmission::aDisp(const label) const Foam::radiation::cloudAbsorptionEmission::aDisp(const label) const
{ {
tmp<volScalarField> ta auto ta = volScalarField::New
( (
new volScalarField "a",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimless/dimLength, Zero)
"a",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimless/dimLength, Zero)
)
); );
forAll(cloudNames_, i) for (const word& cldName : cloudNames_)
{ {
const thermoCloud& tc const thermoCloud& tc
( (
mesh_.objectRegistry::lookupObject<thermoCloud>(cloudNames_[i]) mesh_.objectRegistry::lookupObject<thermoCloud>(cldName)
); );
ta.ref() += tc.ap(); ta.ref() += tc.ap();
@ -107,17 +97,10 @@ Foam::radiation::cloudAbsorptionEmission::aDisp(const label) const
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::radiation::cloudAbsorptionEmission::eDisp(const label bandI) const Foam::radiation::cloudAbsorptionEmission::eDisp(const label bandI) const
{ {
return tmp<volScalarField>::New return volScalarField::New
( (
IOobject "e",
( IOobject::NO_REGISTER,
"e",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_, mesh_,
dimensionedScalar(dimless/dimLength, Zero) dimensionedScalar(dimless/dimLength, Zero)
); );
@ -127,29 +110,19 @@ Foam::radiation::cloudAbsorptionEmission::eDisp(const label bandI) const
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::radiation::cloudAbsorptionEmission::EDisp(const label bandI) const Foam::radiation::cloudAbsorptionEmission::EDisp(const label bandI) const
{ {
tmp<volScalarField> tE auto tE = volScalarField::New
( (
new volScalarField "E",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
"E",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimMass/dimLength/pow3(dimTime), Zero)
)
); );
forAll(cloudNames_, i) for (const word& cldName : cloudNames_)
{ {
const thermoCloud& tc const thermoCloud& tc
( (
mesh_.objectRegistry::lookupObject<thermoCloud>(cloudNames_[i]) mesh_.objectRegistry::lookupObject<thermoCloud>(cldName)
); );
tE.ref() += tc.Ep(); tE.ref() += tc.Ep();

View File

@ -72,30 +72,18 @@ Foam::radiation::cloudScatter::~cloudScatter()
Foam::tmp<Foam::volScalarField> Foam::tmp<Foam::volScalarField>
Foam::radiation::cloudScatter::sigmaEff() const Foam::radiation::cloudScatter::sigmaEff() const
{ {
tmp<volScalarField> tsigma auto tsigma = volScalarField::New
( (
new volScalarField "sigma",
( IOobject::NO_REGISTER,
IOobject mesh_,
( dimensionedScalar(dimless/dimLength, Zero)
"sigma",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
IOobject::NO_REGISTER
),
mesh_,
dimensionedScalar(dimless/dimLength, Zero)
)
); );
forAll(cloudNames_, i) for (const word& cloudName : cloudNames_)
{ {
const thermoCloud& tc const auto& tc =
( mesh_.objectRegistry::lookupObject<thermoCloud>(cloudName);
mesh_.objectRegistry::lookupObject<thermoCloud>(cloudNames_[i])
);
tsigma.ref() += tc.sigmap(); tsigma.ref() += tc.sigmap();
} }