diff --git a/src/functionObjects/field/PecletNo/PecletNo.C b/src/functionObjects/field/PecletNo/PecletNo.C index 45509542075a5c2f89b7b8cb9eac3cf4bba98354..8ef656db1da266a8c28aa1712e6dd749e3734775 100644 --- a/src/functionObjects/field/PecletNo/PecletNo.C +++ b/src/functionObjects/field/PecletNo/PecletNo.C @@ -79,16 +79,10 @@ bool Foam::functionObjects::PecletNo::calc() const dictionary& model = mesh_.lookupObject<dictionary>("transportProperties"); - nuEff = tmp<volScalarField>::New + nuEff = volScalarField::New ( - IOobject - ( - "nuEff", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "nuEff", + IOobject::NO_REGISTER, mesh_, dimensionedScalar("nu", dimViscosity, model) ); diff --git a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C index 3829d78322321d23ceb1caaab48303a101723ac4..c8e2c76cb505851c14def8c44476d0cfa89cf543 100644 --- a/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C +++ b/src/functionObjects/field/extractEulerianParticles/extractEulerianParticles/extractEulerianParticles.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2015-2020 OpenCFD Ltd. + Copyright (C) 2015-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -531,9 +531,10 @@ bool Foam::functionObjects::extractEulerianParticles::execute() const volScalarField& alpha = mesh_.lookupObject<volScalarField>(alphaName_); - const surfaceScalarField alphaf + auto talphaf = surfaceScalarField::New ( - typeName + ":alphaf", + IOobject::scopedName(typeName, "alphaf"), + IOobject::NO_REGISTER, fvc::interpolate(alpha) ); @@ -546,7 +547,7 @@ bool Foam::functionObjects::extractEulerianParticles::execute() // Set the blocked faces, i.e. where alpha > alpha threshold value boolList blockedFaces(fz.size(), false); - setBlockedFaces(alphaf, fz, blockedFaces); + setBlockedFaces(talphaf(), fz, blockedFaces); // Split the faceZone according to the blockedFaces // - Returns a list of (disconnected) region index per face zone face @@ -567,7 +568,7 @@ bool Foam::functionObjects::extractEulerianParticles::execute() // Process latest region information tmp<surfaceScalarField> tphi = phiU(); - accumulateParticleInfo(alphaf, tphi(), regionFaceIDs, fz); + accumulateParticleInfo(talphaf(), tphi(), regionFaceIDs, fz); Log << " Collected particles : " << nCollectedParticles_ << nl << " Collected volume : " << collectedVolume_ << nl diff --git a/src/functionObjects/field/limitFields/limitFieldsTemplates.C b/src/functionObjects/field/limitFields/limitFieldsTemplates.C index 0b20a6cbe2b1973274e5b0b4bdb60f2506c2ca49..25ab497be0d0f112ae4de9a8271c6e2f642e458e 100644 --- a/src/functionObjects/field/limitFields/limitFieldsTemplates.C +++ b/src/functionObjects/field/limitFields/limitFieldsTemplates.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2019 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -49,22 +49,36 @@ bool Foam::functionObjects::limitFields::limitField(const word& fieldName) if (withBounds_ & limitType::CLAMP_MIN) { - volScalarField mField(typeName + ":mag" + field.name(), mag(field)); + auto tmField = volScalarField::New + ( + IOobject::scopedName(typeName, "mag" + field.name()), + IOobject::NO_REGISTER, + mag(field) + ); + auto& mField = tmField.ref(); + Log << " min(|" << gMin(mField) << "|)"; //field.normalise(); field /= mag(field) + eps; mField.clamp_min(min_); - field *= mField; + field *= tmField; } if (withBounds_ & limitType::CLAMP_MAX) { - volScalarField mField(typeName + ":mag" + field.name(), mag(field)); + auto tmField = volScalarField::New + ( + IOobject::scopedName(typeName, "mag" + field.name()), + IOobject::NO_REGISTER, + mag(field) + ); + auto& mField = tmField.ref(); + Log << " max(|" << gMax(mField) << "|)"; //field.normalise(); field /= mag(field) + eps; mField.clamp_max(max_); - field *= mField; + field *= tmField; } return true; diff --git a/src/functionObjects/field/pressure/pressure.C b/src/functionObjects/field/pressure/pressure.C index be7d849a2f33c153c8d907d9ce66c26e5b463469..712557669c6d1308c2618992657c85b1553c98b1 100644 --- a/src/functionObjects/field/pressure/pressure.C +++ b/src/functionObjects/field/pressure/pressure.C @@ -131,17 +131,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::rhoScale { if (p.dimensions() == dimPressure) { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "rhoScale", - p.mesh().time().timeName(), - p.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "rhoScale", + IOobject::NO_REGISTER, p, fvPatchFieldBase::calculatedType() ); @@ -236,21 +229,14 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::calcPressure ) const { // Initialise to the pressure reference level - auto tresult = - tmp<volScalarField>::New - ( - IOobject - ( - scopedName("p"), - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ - ), - mesh_, - dimensionedScalar("p", dimPressure, pRef_) - ); - - volScalarField& result = tresult.ref(); + auto tresult = volScalarField::New + ( + scopedName("p"), + IOobject::NO_REGISTER, + mesh_, + dimensionedScalar("p", dimPressure, pRef_) + ); + auto& result = tresult.ref(); addHydrostaticContribution(p, result); @@ -304,7 +290,7 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::coeff if (mode_ & COEFF) { tmp<volScalarField> tpCoeff(tp.ptr()); - volScalarField& pCoeff = tpCoeff.ref(); + auto& pCoeff = tpCoeff.ref(); pCoeff -= dimensionedScalar("pInf", dimPressure, pInf_); @@ -325,21 +311,16 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::pressure::coeff bool Foam::functionObjects::pressure::calc() { - if (foundObject<volScalarField>(fieldName_)) + const auto* pptr = cfindObject<volScalarField>(fieldName_); + + if (pptr) { - const volScalarField& p = lookupObject<volScalarField>(fieldName_); + const auto& p = *pptr; - auto tp = tmp<volScalarField>::New + auto tp = volScalarField::New ( - IOobject - ( - resultName_, - p.mesh().time().timeName(), - p.mesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::REGISTER - ), + resultName_, + IOobject::REGISTER, coeff(calcPressure(p, rhoScale(p))) ); diff --git a/src/functionObjects/field/proudmanAcousticPower/proudmanAcousticPower.C b/src/functionObjects/field/proudmanAcousticPower/proudmanAcousticPower.C index 0718ae315f7406d702513501a4417e011e9706bd..4a002caeb250284d66ff94dd1d573d84ae2dc133 100644 --- a/src/functionObjects/field/proudmanAcousticPower/proudmanAcousticPower.C +++ b/src/functionObjects/field/proudmanAcousticPower/proudmanAcousticPower.C @@ -87,18 +87,13 @@ Foam::functionObjects::proudmanAcousticPower::a() const return sqrt(thermo.gamma()*thermo.p()/thermo.rho()); } - return - tmp<volScalarField>::New - ( - IOobject - ( - scopedName("a"), - mesh_.time().timeName(), - mesh_ - ), - mesh_, - aRef_ - ); + return volScalarField::New + ( + scopedName("a"), + IOobject::NO_REGISTER, + mesh_, + aRef_ + ); } diff --git a/src/functionObjects/field/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C b/src/functionObjects/field/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C index a0bc517f954172a1fa353032ec567b2e35686c75..4429bb803ba98b2f3506784d2cbc2e884ace1f8b 100644 --- a/src/functionObjects/field/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C +++ b/src/functionObjects/field/reactionSensitivityAnalysis/reactionsSensitivityAnalysis.C @@ -80,20 +80,14 @@ calculateSpeciesRR const basicChemistryModel& basicChemistry ) { - auto RRt = tmp<DimensionedField<scalar, volMesh>>::New + auto tRR = volScalarField::Internal::New ( - IOobject - ( - "RR", - time_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "RR", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); - auto& RR = RRt.ref(); + auto& RR = tRR.ref(); scalar dt = time_.deltaTValue(); diff --git a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C index a15639fe34362b71694d976e63a4512324456477..c5e86068c65b0f145ebf0f6259155e804bda377e 100644 --- a/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C +++ b/src/functionObjects/field/regionSizeDistribution/regionSizeDistribution.C @@ -449,7 +449,8 @@ bool Foam::functionObjects::regionSizeDistribution::write() mesh_.time().timeName(), mesh_, IOobjectOption::MUST_READ, - IOobjectOption::NO_WRITE + IOobjectOption::NO_WRITE, + IOobjectOption::NO_REGISTER ), mesh_ ) @@ -535,18 +536,11 @@ bool Foam::functionObjects::regionSizeDistribution::write() { volScalarField region ( - IOobject - ( - "region", - mesh_.time().timeName(), - mesh_, - IOobjectOption::NO_READ, - IOobjectOption::NO_WRITE, - IOobjectOption::NO_REGISTER - ), + mesh_.newIOobject("region"), mesh_, dimensionedScalar(dimless, Zero) ); + Info<< " Dumping region as volScalarField to " << region.name() << endl; diff --git a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C index ca01a013fa73aa984a49005560a3dbb2b59de842..947545c828e7d2847146c14106cb764d84669fad 100644 --- a/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C +++ b/src/functionObjects/field/resolutionIndex/resolutionIndexModels/resolutionIndexModel/resolutionIndexModel.C @@ -45,17 +45,10 @@ namespace Foam Foam::tmp<Foam::volScalarField> Foam::resolutionIndexModel::V() const { - auto tV = tmp<volScalarField>::New + auto tV = volScalarField::New ( - IOobject - ( - "V", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "V", + IOobject::NO_REGISTER, mesh_, dimVolume, fvPatchFieldBase::zeroGradientType() diff --git a/src/functionObjects/field/setFlow/setFlow.C b/src/functionObjects/field/setFlow/setFlow.C index e2e165e7df78e6217dd372479de81d8d3c618339..dd26dccb607187329ac67545243cb564ee8132c2 100644 --- a/src/functionObjects/field/setFlow/setFlow.C +++ b/src/functionObjects/field/setFlow/setFlow.C @@ -5,7 +5,7 @@ \\ / A nd | www.openfoam.com \\/ M anipulation | ------------------------------------------------------------------------------- - Copyright (C) 2017-2020 OpenCFD Ltd. + Copyright (C) 2017-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -240,7 +240,7 @@ bool Foam::functionObjects::setFlow::execute() const volVectorField& C = mesh_.C(); const volVectorField d ( - typeName + ":d", + IOobject::scopedName(typeName, "d"), C - dimensionedVector("origin", dimLength, origin_) ); const scalarField x(d.component(vector::X)); @@ -286,7 +286,7 @@ bool Foam::functionObjects::setFlow::execute() const volVectorField d ( - typeName + ":d", + IOobject::scopedName(typeName, "d"), C - dimensionedVector("origin", dimLength, origin_) ); const scalarField x(d.component(vector::X)); @@ -350,7 +350,7 @@ bool Foam::functionObjects::setFlow::execute() const volVectorField d ( - typeName + ":d", + IOobject::scopedName(typeName, "d"), C - dimensionedVector("origin", dimLength, origin_) ); const scalarField x(d.component(vector::X)); diff --git a/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C b/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C index 134427f7ba5d99db2a6136bde316c2036de9a4bb..27a2371d19eec032294de753d43f3d4d04374a50 100644 --- a/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C +++ b/src/functionObjects/field/stabilityBlendingFactor/stabilityBlendingFactor.C @@ -321,16 +321,10 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first) << exit(FatalError); } - auto tmagGradCC = tmp<volScalarField>::New + auto tmagGradCC = volScalarField::New ( - IOobject - ( - "magGradCC", - time_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "magGradCC", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimless, Zero), fvPatchFieldBase::zeroGradientType() @@ -340,20 +334,16 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first) for (direction i=0; i<vector::nComponents; i++) { // Create field with zero grad - volScalarField cci + auto tcci = volScalarField::New ( - IOobject - ( - "cc" + word(vector::componentNames[i]), - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "cc" + word(vector::componentNames[i]), + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimLength, Zero), fvPatchFieldBase::zeroGradientType() ); + auto& cci = tcci.ref(); + cci = mesh_.C().component(i); cci.correctBoundaryConditions(); magGradCC += mag(fvc::grad(cci)).ref(); @@ -394,21 +384,14 @@ bool Foam::functionObjects::stabilityBlendingFactor::init(bool first) << exit(FatalError); } - auto CoPtr = tmp<volScalarField>::New + auto CoPtr = volScalarField::New ( - IOobject - ( - "Co", - time_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "Co", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimless, Zero), fvPatchFieldBase::zeroGradientType() ); - auto& Co = CoPtr.ref(); Co.primitiveFieldRef() = @@ -533,17 +516,10 @@ Foam::functionObjects::stabilityBlendingFactor::stabilityBlendingFactor read(dict); setResultName(typeName, ""); - auto faceBlendedPtr = tmp<surfaceScalarField>::New + auto faceBlendedPtr = surfaceScalarField::New ( - IOobject - ( - resultName_, - time_.timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::REGISTER - ), + resultName_, + IOobject::REGISTER, mesh_, dimensionedScalar(dimless, Zero) ); diff --git a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C index e30d45d52244127c5e0da0e5726c616ae60ea26e..a2a8ba5efcc4dfb110fcb8aa7ad5efee01ab89bc 100644 --- a/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C +++ b/src/functionObjects/field/turbulenceFields/turbulenceFieldsTemplates.C @@ -77,9 +77,10 @@ Foam::functionObjects::turbulenceFields::nuTilda { const dimensionedScalar omega0(dimless/dimTime, SMALL); - return tmp<volScalarField>::New + return volScalarField::New ( "nuTilda.tmp", + IOobject::NO_REGISTER, model.k()/(model.omega() + omega0) ); } @@ -96,9 +97,10 @@ Foam::functionObjects::turbulenceFields::L const scalar Cmu = 0.09; const dimensionedScalar eps0(sqr(dimVelocity)/dimTime, SMALL); - return tmp<volScalarField>::New + return volScalarField::New ( "L.tmp", + IOobject::NO_REGISTER, pow(Cmu, 0.75)*pow(model.k(), 1.5)/(model.epsilon() + eps0) ); } @@ -116,9 +118,10 @@ Foam::functionObjects::turbulenceFields::I const volScalarField uPrime(sqrt((2.0/3.0)*model.k())); const dimensionedScalar U0(dimVelocity, SMALL); - return tmp<volScalarField>::New + return volScalarField::New ( "I.tmp", + IOobject::NO_REGISTER, uPrime/max(max(uPrime, mag(model.U())), U0) ); } diff --git a/src/functionObjects/forces/forces/forces.C b/src/functionObjects/forces/forces/forces.C index ac6667839484f12dc20da2e430bb703dfc2cb8c3..fd7ab2f8760b62c994f2e86f3453d0a010060903 100644 --- a/src/functionObjects/forces/forces/forces.C +++ b/src/functionObjects/forces/forces/forces.C @@ -311,14 +311,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::forces::rho() const { if (rhoName_ == "rhoInf") { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "rho", - mesh_.time().timeName(), - mesh_ - ), + "rho", + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimDensity, rhoRef_) ); diff --git a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C index 75c6f8509f2824f31d0ae041c18606907f5e9832..1a98fad13cb730a77c80709efb0c33abf8697fa4 100644 --- a/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C +++ b/src/functionObjects/initialisation/hydrostaticPressure/hydrostaticPressure.C @@ -182,7 +182,7 @@ Foam::functionObjects::hydrostaticPressure::hydrostaticPressure if (read(dict)) { // Read and store the initial ph_rgh field - volScalarField* ph_rghPtr = + volScalarField* ptr = new volScalarField ( IOobject @@ -197,7 +197,7 @@ Foam::functionObjects::hydrostaticPressure::hydrostaticPressure mesh_ ); - regIOobject::store(ph_rghPtr); + regIOobject::store(ptr); bool reInitialise = dict.getOrDefault("reInitialise", false); diff --git a/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C b/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C index a3d4588ec7de29142a7a1ba976fe7078efd3e785..c6038cec9b3870dcc572e302f6bc5e459ac71c1a 100644 --- a/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C +++ b/src/functionObjects/phaseSystems/sizeDistribution/sizeDistribution.C @@ -243,7 +243,7 @@ Foam::functionObjects::sizeDistribution::filterField const scalarField& field ) const { - return tmp<scalarField>(new scalarField(field, cellId_)); + return tmp<scalarField>::New(field, cellId_); } diff --git a/src/functionObjects/solvers/electricPotential/electricPotential.C b/src/functionObjects/solvers/electricPotential/electricPotential.C index 4b5dd5d8551d7f8c96b96d01840394597b0172d8..ff931d858305837562e225ec5f5f4116ffc2a68d 100644 --- a/src/functionObjects/solvers/electricPotential/electricPotential.C +++ b/src/functionObjects/solvers/electricPotential/electricPotential.C @@ -78,12 +78,7 @@ Foam::functionObjects::electricPotential::sigma() const { const IOobject sigmaIO ( - IOobject::scopedName(typeName, "sigma"), - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER + mesh_.thisDb().newIOobject(IOobject::scopedName(typeName, "sigma")) ); if (phases_.size()) @@ -125,12 +120,7 @@ Foam::functionObjects::electricPotential::epsilonm() const const IOobject epsilonrIO ( - IOobject::scopedName(typeName, "epsilonr"), - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER + mesh_.thisDb().newIOobject(IOobject::scopedName(typeName, "epsilonr")) ); if (phases_.size()) @@ -409,17 +399,10 @@ bool Foam::functionObjects::electricPotential::write() // Write the current density field tmp<volScalarField> tsigma = this->sigma(); - auto eJ = tmp<volVectorField>::New + auto eJ = volVectorField::New ( - IOobject - ( - IOobject::scopedName(typeName, "J"), - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "J"), + IOobject::NO_REGISTER, -tsigma*fvc::grad(eV), fvPatchFieldBase::calculatedType() ); @@ -432,17 +415,10 @@ bool Foam::functionObjects::electricPotential::write() // Write the free-charge density field tmp<volScalarField> tepsilonm = this->epsilonm(); - auto erho = tmp<volScalarField>::New + auto erho = volScalarField::New ( - IOobject - ( - IOobject::scopedName(typeName, "rho"), - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "rho"), + IOobject::NO_REGISTER, fvc::div(tepsilonm*(-fvc::grad(eV))), fvPatchFieldBase::calculatedType() ); diff --git a/src/functionObjects/solvers/energyTransport/energyTransport.C b/src/functionObjects/solvers/energyTransport/energyTransport.C index ea5b022f117853cb267d42d18c7ca1c25b41a7cf..2a0ac81eba1c3d7b3e4bac39155d755f2765e978 100644 --- a/src/functionObjects/solvers/energyTransport/energyTransport.C +++ b/src/functionObjects/solvers/energyTransport/energyTransport.C @@ -93,9 +93,10 @@ Foam::functionObjects::energyTransport::kappaEff() const if (turbPtr) { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField + "kappaEff", + IOobject::NO_REGISTER, ( kappa() + Cp()*turbPtr->nut()*rho()/Prt_ ) @@ -113,17 +114,10 @@ Foam::functionObjects::energyTransport::kappaEff() const Foam::tmp<Foam::volScalarField> Foam::functionObjects::energyTransport::rho() const { - auto trho = tmp<volScalarField>::New + auto trho = volScalarField::New ( - IOobject - ( - "trho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "trho", + IOobject::NO_REGISTER, mesh_, rho_ ); @@ -150,17 +144,10 @@ Foam::functionObjects::energyTransport::Cp() const return tCp; } - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "tCp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "tCp", + IOobject::NO_REGISTER, mesh_, Cp_ ); @@ -181,22 +168,16 @@ Foam::functionObjects::energyTransport::kappa() const return tkappa; } - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "tkappa", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "tkappa", + IOobject::NO_REGISTER, mesh_, kappa_ ); } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::functionObjects::energyTransport::energyTransport @@ -404,16 +385,10 @@ bool Foam::functionObjects::energyTransport::execute() const surfaceScalarField CpPhi(rhoCp*phi); - auto trhoCp = tmp<volScalarField>::New + auto trhoCp = volScalarField::New ( - IOobject - ( - "trhoCp", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), + "trhoCp", + IOobject::NO_REGISTER, mesh_, rhoCp ); diff --git a/src/functionObjects/solvers/scalarTransport/scalarTransport.C b/src/functionObjects/solvers/scalarTransport/scalarTransport.C index ec36978276013c0150671fadddad2263deb44362..f418519024d1bdad66f2dbd5a9245fef639de3f8 100644 --- a/src/functionObjects/solvers/scalarTransport/scalarTransport.C +++ b/src/functionObjects/solvers/scalarTransport/scalarTransport.C @@ -96,16 +96,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D if (constantD_) { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - Dname, - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), + Dname, + IOobject::NO_REGISTER, mesh_, dimensionedScalar(Dname, phi.dimensions()/dimLength, D_) ); @@ -129,9 +123,10 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D if (turb) { - return tmp<volScalarField>::New + return volScalarField::New ( Dname, + IOobject::NO_REGISTER, alphaD_ * turb->nu() + alphaDt_ * turb->nut() ); } @@ -147,25 +142,20 @@ Foam::tmp<Foam::volScalarField> Foam::functionObjects::scalarTransport::D if (turb) { - return tmp<volScalarField>::New + return volScalarField::New ( Dname, + IOobject::NO_REGISTER, alphaD_ * turb->mu() + alphaDt_ * turb->mut() ); } } - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - Dname, - mesh_.time().timeName(), - mesh_.time(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), + Dname, + IOobject::NO_REGISTER, mesh_, dimensionedScalar(phi.dimensions()/dimLength, Zero) );