From 33f20edbb14a92fc34cc095362e350eb8860a5ae Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@esi-group.com> Date: Tue, 23 Jan 2024 10:16:59 +0100 Subject: [PATCH] ENH: use tmp field factory methods [4] (#2723) - src/regionModels src/regionFaModels --- .../KirchhoffShell/KirchhoffShell.C | 22 +--- .../liquidFilm/liquidFilmBase.C | 87 ++++---------- .../filmTurbulenceModel/filmTurbulenceModel.C | 55 ++++----- .../kinematic/force/forceList/forceList.C | 7 +- .../curvatureSeparation/curvatureSeparation.C | 6 +- .../thermalShell/thermalShell.C | 72 ++++-------- .../regionModel/regionModel1D/regionModel1D.C | 8 +- .../singleLayerRegion/singleLayerRegion.C | 6 +- .../kinematicSingleLayer.C | 78 +++--------- .../kinematicSingleLayerI.H | 60 +++------- .../surfaceFilmModels/noFilm/noFilm.C | 39 ++---- .../constantFilmThermo/constantFilmThermo.C | 106 +++++------------ .../liquidFilmThermo/liquidFilmThermo.C | 111 +++++------------- .../filmTurbulenceModel/laminar/laminar.C | 34 ++---- .../contactAngleForce/contactAngleForce.C | 36 ++---- .../distributionContactAngleForce.C | 32 ++--- ...bedTemperatureDependentContactAngleForce.C | 34 +++--- .../temperatureDependentContactAngleForce.C | 30 ++--- .../kinematic/force/forceList/forceList.C | 7 +- .../thermocapillaryForce.C | 3 +- .../curvatureSeparation/curvatureSeparation.C | 45 +++---- .../constantRadiation/constantRadiation.C | 26 ++-- .../noRadiation/noRadiation.C | 13 +- .../primaryRadiation/primaryRadiation.C | 25 ++-- .../standardRadiation/standardRadiation.C | 28 ++--- .../thixotropicViscosity.C | 6 +- .../waxSolventViscosity/waxSolventViscosity.C | 43 +++---- .../constantHeatTransfer.C | 26 ++-- .../solidification/solidification.C | 12 +- .../waxSolventEvaporation.C | 52 ++++---- .../thermoSingleLayer/thermoSingleLayer.C | 81 +++++-------- .../thermoSingleLayer/thermoSingleLayerI.H | 34 ++---- .../thermalBaffleModels/noThermo/noThermo.C | 19 +-- .../thermalBaffle/thermalBaffle.C | 23 +--- 34 files changed, 410 insertions(+), 856 deletions(-) diff --git a/src/regionFaModels/KirchhoffShell/KirchhoffShell.C b/src/regionFaModels/KirchhoffShell/KirchhoffShell.C index 1b09200a935..b3daab327eb 100644 --- a/src/regionFaModels/KirchhoffShell/KirchhoffShell.C +++ b/src/regionFaModels/KirchhoffShell/KirchhoffShell.C @@ -282,23 +282,13 @@ const tmp<areaScalarField> KirchhoffShell::D() const const tmp<areaScalarField> KirchhoffShell::rho() const { - return tmp<areaScalarField> + return areaScalarField::New ( - new areaScalarField - ( - IOobject - ( - "rhos", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - regionMesh(), - dimensionedScalar("rho", dimDensity, solid().rho()), - faPatchFieldBase::zeroGradientType() - ) + "rhos", + IOobjectOption::NO_REGISTER, + regionMesh(), + dimensionedScalar("rho", dimDensity, solid().rho()), + faPatchFieldBase::zeroGradientType() ); } diff --git a/src/regionFaModels/liquidFilm/liquidFilmBase.C b/src/regionFaModels/liquidFilm/liquidFilmBase.C index afe3dc40a0e..b392609c869 100644 --- a/src/regionFaModels/liquidFilm/liquidFilmBase.C +++ b/src/regionFaModels/liquidFilm/liquidFilmBase.C @@ -276,19 +276,12 @@ scalar liquidFilmBase::CourantNumber() const Foam::tmp<Foam::areaVectorField> liquidFilmBase::Uw() const { - tmp<areaVectorField> tUw + auto tUw = areaVectorField::New ( - new areaVectorField - ( - IOobject - ( - "tUw", - regionMesh().time().timeName(), - regionMesh().thisDb() - ), - regionMesh(), - dimensionedVector(dimVelocity, Zero) - ) + "tUw", + IOobjectOption::NO_REGISTER, + regionMesh(), + dimensionedVector(dimVelocity, Zero) ); auto& Uw = tUw.ref(); @@ -331,19 +324,12 @@ Foam::tmp<Foam::areaVectorField> liquidFilmBase::Uw() const Foam::tmp<Foam::areaVectorField> liquidFilmBase::Us() const { - tmp<areaVectorField> tUs + auto tUs = areaVectorField::New ( - new areaVectorField - ( - IOobject - ( - "tUs", - regionMesh().time().timeName(), - regionMesh().thisDb() - ), - regionMesh(), - dimensionedVector(dimVelocity, Zero) - ) + "tUs", + IOobjectOption::NO_REGISTER, + regionMesh(), + dimensionedVector(dimVelocity, Zero) ); // Uf quadratic profile @@ -358,21 +344,14 @@ Foam::tmp<Foam::areaVectorField> liquidFilmBase::Up() const const volVectorField& Uprimary = primaryMesh().lookupObject<volVectorField>(UName_); - tmp<areaVectorField> tUp + auto tUp = areaVectorField::New ( - new areaVectorField - ( - IOobject - ( - "tUp", - regionMesh().time().timeName(), - regionMesh().thisDb() - ), - regionMesh(), - dimensionedVector(dimVelocity, Zero) - ) + "tUp", + IOobjectOption::NO_REGISTER, + regionMesh(), + dimensionedVector(dimVelocity, Zero) ); - areaVectorField& Up = tUp.ref(); + auto& Up = tUp.ref(); // Set up mapping values per patch @@ -406,19 +385,12 @@ Foam::tmp<Foam::areaVectorField> liquidFilmBase::Up() const tmp<areaScalarField> liquidFilmBase::pg() const { - tmp<areaScalarField> tpg + auto tpg = areaScalarField::New ( - new areaScalarField - ( - IOobject - ( - "tpg", - regionMesh().time().timeName(), - regionMesh().thisDb() - ), - regionMesh(), - dimensionedScalar(dimPressure, Zero) - ) + "tpg", + IOobjectOption::NO_REGISTER, + regionMesh(), + dimensionedScalar(dimPressure, Zero) ); auto& pfg = tpg.ref(); @@ -439,19 +411,12 @@ tmp<areaScalarField> liquidFilmBase::pg() const tmp<areaScalarField> liquidFilmBase::alpha() const { - tmp<areaScalarField> talpha + auto talpha = areaScalarField::New ( - new areaScalarField - ( - IOobject - ( - "talpha", - regionMesh().time().timeName(), - regionMesh().thisDb() - ), - regionMesh(), - dimensionedScalar(dimless, Zero) - ) + "talpha", + IOobjectOption::NO_REGISTER, + regionMesh(), + dimensionedScalar(dimless, Zero) ); auto& alpha = talpha.ref(); diff --git a/src/regionFaModels/liquidFilm/subModels/kinematic/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C b/src/regionFaModels/liquidFilm/subModels/kinematic/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C index a6c8b42f4a0..93b54a3ce0b 100644 --- a/src/regionFaModels/liquidFilm/subModels/kinematic/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C +++ b/src/regionFaModels/liquidFilm/subModels/kinematic/filmTurbulenceModel/filmTurbulenceModel/filmTurbulenceModel.C @@ -102,18 +102,13 @@ const liquidFilmBase& filmTurbulenceModel::film() const tmp<areaScalarField> filmTurbulenceModel::Cw() const { - auto tCw = - tmp<areaScalarField>::New - ( - IOobject - ( - "tCw", - film_.regionMesh().time().timeName(), - film_.regionMesh().thisDb() - ), - film_.regionMesh(), - dimensionedScalar(dimVelocity) - ); + auto tCw = areaScalarField::New + ( + "tCw", + IOobject::NO_REGISTER, + film_.regionMesh(), + dimensionedScalar(dimVelocity, Zero) + ); auto& Cw = tCw.ref(); @@ -195,10 +190,8 @@ tmp<faVectorMatrix> filmTurbulenceModel::primaryRegionFriction areaVectorField& U ) const { - tmp<faVectorMatrix> tshearStress - ( - new faVectorMatrix(U, sqr(U.dimensions())*sqr(dimLength)) - ); + auto tshearStress = + tmp<faVectorMatrix>::New(U, sqr(U.dimensions())*sqr(dimLength)); switch (shearMethod_) { @@ -267,14 +260,10 @@ tmp<faVectorMatrix> filmTurbulenceModel::primaryRegionFriction } } - auto taForce = tmp<areaVectorField>::New + auto taForce = areaVectorField::New ( - IOobject - ( - "taForce", - film_.regionMesh().time().timeName(), - film_.regionMesh().thisDb() - ), + "taForce", + IOobject::NO_REGISTER, film_.regionMesh(), dimensionedVector(sqr(dimVelocity), Zero) ); @@ -352,32 +341,30 @@ tmp<Foam::volSymmTensorField> filmTurbulenceModel::devRhoReff() const << "No valid model for viscous stress calculation" << exit(FatalError); - return volSymmTensorField::null(); + return nullptr; } } tmp<Foam::volScalarField> filmTurbulenceModel::rho() const { - const fvMesh& m = film_.primaryMesh(); + const fvMesh& mesh = film_.primaryMesh(); + if (rhoName_ == "rhoInf") { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - "rho", - m.time().timeName(), - m - ), - m, + "rho", + IOobject::NO_REGISTER, + mesh, dimensionedScalar(dimDensity, rhoRef_) ); } - return m.lookupObject<volScalarField>(rhoName_); + return mesh.lookupObject<volScalarField>(rhoName_); } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace areaSurfaceFilmModels diff --git a/src/regionFaModels/liquidFilm/subModels/kinematic/force/forceList/forceList.C b/src/regionFaModels/liquidFilm/subModels/kinematic/force/forceList/forceList.C index ea0c634fce2..78e2ed4966c 100644 --- a/src/regionFaModels/liquidFilm/subModels/kinematic/force/forceList/forceList.C +++ b/src/regionFaModels/liquidFilm/subModels/kinematic/force/forceList/forceList.C @@ -81,11 +81,8 @@ forceList::~forceList() tmp<faVectorMatrix> forceList::correct(areaVectorField& U) { - tmp<faVectorMatrix> tResult - ( - new faVectorMatrix(U, dimForce/dimDensity) - ); - faVectorMatrix& result = tResult.ref(); + auto tResult = tmp<faVectorMatrix>::New(U, dimForce/dimDensity); + auto& result = tResult.ref(); forAll(*this, i) { diff --git a/src/regionFaModels/liquidFilm/subModels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C b/src/regionFaModels/liquidFilm/subModels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C index 46599c97500..69e33a08f3b 100644 --- a/src/regionFaModels/liquidFilm/subModels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C +++ b/src/regionFaModels/liquidFilm/subModels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C @@ -61,9 +61,11 @@ tmp<areaScalarField> curvatureSeparation::calcInvR1 { const dimensionedScalar smallU(dimVelocity, ROOTVSMALL); const areaVectorField UHat(U/(mag(U) + smallU)); - tmp<areaScalarField> tinvR1 + auto tinvR1 = areaScalarField::New ( - new areaScalarField("invR1", UHat & (UHat & -gradNHat_)) + "invR1", + IOobjectOption::NO_REGISTER, + (UHat & (UHat & -gradNHat_)) ); scalarField& invR1 = tinvR1.ref().primitiveFieldRef(); diff --git a/src/regionFaModels/thermalShell/thermalShell.C b/src/regionFaModels/thermalShell/thermalShell.C index 3fa2465dd9e..ede4196f9ad 100644 --- a/src/regionFaModels/thermalShell/thermalShell.C +++ b/src/regionFaModels/thermalShell/thermalShell.C @@ -182,73 +182,43 @@ void thermalShell::evolveRegion() const tmp<areaScalarField> thermalShell::Cp() const { - return tmp<areaScalarField> + return areaScalarField::New ( - new areaScalarField - ( - IOobject - ( - "Cps", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - regionMesh(), - dimensionedScalar(dimEnergy/dimTemperature/dimMass, thermo_.Cp()), - faPatchFieldBase::zeroGradientType() - ) + "Cps", + IOobject::NO_REGISTER, + regionMesh(), + dimensionedScalar(dimEnergy/dimTemperature/dimMass, thermo_.Cp()), + faPatchFieldBase::zeroGradientType() ); } const tmp<areaScalarField> thermalShell::rho() const { - return tmp<areaScalarField> + return areaScalarField::New ( - new areaScalarField - ( - IOobject - ( - "rhos", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - regionMesh(), - dimensionedScalar(dimDensity, thermo_.rho()), - faPatchFieldBase::zeroGradientType() - ) + "rhos", + IOobject::NO_REGISTER, + regionMesh(), + dimensionedScalar(dimDensity, thermo_.rho()), + faPatchFieldBase::zeroGradientType() ); } const tmp<areaScalarField> thermalShell::kappa() const { - return tmp<areaScalarField> + return areaScalarField::New ( - new areaScalarField + "kappas", + IOobject::NO_REGISTER, + regionMesh(), + dimensionedScalar ( - IOobject - ( - "kappas", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - regionMesh(), - dimensionedScalar - ( - dimPower/dimLength/dimTemperature, - thermo_.kappa() - ), - faPatchFieldBase::zeroGradientType() - ) + dimPower/dimLength/dimTemperature, + thermo_.kappa() + ), + faPatchFieldBase::zeroGradientType() ); } diff --git a/src/regionModels/regionModel/regionModel1D/regionModel1D.C b/src/regionModels/regionModel/regionModel1D/regionModel1D.C index 4b3e66278fc..b365b5c346d 100644 --- a/src/regionModels/regionModel/regionModel1D/regionModel1D.C +++ b/src/regionModels/regionModel/regionModel1D/regionModel1D.C @@ -42,7 +42,6 @@ namespace regionModels void Foam::regionModels::regionModel1D::constructMeshObjects() { - nMagSfPtr_.reset ( new surfaceScalarField @@ -53,7 +52,8 @@ void Foam::regionModels::regionModel1D::constructMeshObjects() time().timeName(), regionMesh(), IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::NO_REGISTER ), regionMesh(), dimensionedScalar(dimArea, Zero) @@ -197,8 +197,8 @@ Foam::tmp<Foam::labelField> Foam::regionModels::regionModel1D::moveMesh const scalar minDelta ) { - tmp<labelField> tcellMoveMap(new labelField(regionMesh().nCells(), Zero)); - labelField& cellMoveMap = tcellMoveMap.ref(); + auto tcellMoveMap = tmp<labelField>::New(regionMesh().nCells(), Zero); + auto& cellMoveMap = tcellMoveMap.ref(); if (!moveMesh_) { diff --git a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C index 871fdcc199a..94f65984004 100644 --- a/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C +++ b/src/regionModels/regionModel/singleLayerRegion/singleLayerRegion.C @@ -56,7 +56,8 @@ void Foam::regionModels::singleLayerRegion::constructMeshObjects() time_.timeName(), regionMesh(), IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::NO_REGISTER ), regionMesh(), dimensionedVector(dimless, Zero), @@ -75,7 +76,8 @@ void Foam::regionModels::singleLayerRegion::constructMeshObjects() time_.timeName(), regionMesh(), IOobject::READ_IF_PRESENT, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::NO_REGISTER ), regionMesh(), dimensionedScalar(dimArea, Zero), diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C index 58a6beeb1b5..a35106bc1f1 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayer.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2019-2020 OpenCFD Ltd. + Copyright (C) 2019-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -108,14 +108,9 @@ void kinematicSingleLayer::transferPrimaryRegionSourceFields() { DebugInFunction << endl; - volScalarField::Boundary& rhoSpPrimaryBf = - rhoSpPrimary_.boundaryFieldRef(); - - volVectorField::Boundary& USpPrimaryBf = - USpPrimary_.boundaryFieldRef(); - - volScalarField::Boundary& pSpPrimaryBf = - pSpPrimary_.boundaryFieldRef(); + auto& rhoSpPrimaryBf = rhoSpPrimary_.boundaryFieldRef(); + auto& USpPrimaryBf = USpPrimary_.boundaryFieldRef(); + auto& pSpPrimaryBf = pSpPrimary_.boundaryFieldRef(); // Convert accumulated source terms into per unit area per unit time const scalar deltaT = time_.deltaTValue(); @@ -161,18 +156,11 @@ void kinematicSingleLayer::transferPrimaryRegionSourceFields() tmp<volScalarField> kinematicSingleLayer::pu() { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField + IOobject::scopedName(typeName, "pu"), + IOobject::NO_REGISTER, ( - IOobject - ( - typeName + ":pu", - time_.timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), pPrimary_ // pressure (mapped from primary region) - pSp_ // accumulated particle impingement - fvc::laplacian(sigma_, delta_) // surface tension @@ -183,18 +171,11 @@ tmp<volScalarField> kinematicSingleLayer::pu() tmp<volScalarField> kinematicSingleLayer::pp() { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField + IOobject::scopedName(typeName, "pp"), + IOobject::NO_REGISTER, ( - IOobject - ( - typeName + ":pp", - time_.timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), -rho_*gNormClipped() // hydrostatic effect only ) ); @@ -1084,17 +1065,10 @@ void kinematicSingleLayer::info() tmp<volScalarField::Internal> kinematicSingleLayer::Srho() const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - typeName + ":Srho", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "Srho"), + IOobject::NO_REGISTER, primaryMesh(), dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); @@ -1106,17 +1080,10 @@ tmp<volScalarField::Internal> kinematicSingleLayer::Srho const label i ) const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - typeName + ":Srho(" + Foam::name(i) + ")", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "Srho(" + Foam::name(i) + ")"), + IOobject::NO_REGISTER, primaryMesh(), dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); @@ -1125,17 +1092,10 @@ tmp<volScalarField::Internal> kinematicSingleLayer::Srho tmp<volScalarField::Internal> kinematicSingleLayer::Sh() const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - typeName + ":Sh", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "Sh"), + IOobject::NO_REGISTER, primaryMesh(), dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); diff --git a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H index 5a022e964b3..9cff5b9bd70 100644 --- a/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/kinematicSingleLayer/kinematicSingleLayerI.H @@ -211,45 +211,25 @@ inline tmp<volScalarField> kinematicSingleLayer::deltaMass() const inline tmp<volScalarField> kinematicSingleLayer::gNorm() const { - tmp<volScalarField> tgNorm + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "gNorm", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - g_ & nHat() - ) + "gNorm", + IOobject::NO_REGISTER, + g_ & nHat() ); - - return tgNorm; } inline tmp<volScalarField> kinematicSingleLayer::gNormClipped() const { - tmp<volScalarField> tgNormClipped + auto tgNormClipped = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "gNormClipped", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - g_ & nHat() - ) + "gNormClipped", + IOobject::NO_REGISTER, + g_ & nHat() ); + auto& gNormClipped = tgNormClipped.ref(); - volScalarField& gNormClipped = tgNormClipped.ref(); gNormClipped.clamp_max(0); return tgNormClipped; @@ -258,25 +238,15 @@ inline tmp<volScalarField> kinematicSingleLayer::gNormClipped() const inline tmp<volVectorField> kinematicSingleLayer::gTan() const { - tmp<volVectorField> tgTan + return volVectorField::New ( - new volVectorField - ( - IOobject - ( - "gTan", - time().timeName(), - regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - g_ - nHat()*gNorm() - ) + "gTan", + IOobject::NO_REGISTER, + g_ - nHat()*gNorm() ); - - return tgTan; } + inline tmp<vectorField> kinematicSingleLayer::gTan ( const label patchI @@ -284,7 +254,7 @@ inline tmp<vectorField> kinematicSingleLayer::gTan { const vectorField& nH = nHat().boundaryField()[patchI]; const vector& g = g_.value(); - tmp<vectorField> tgTan(new vectorField(g - nH*(g & nH))); + tmp<vectorField> tgTan(g - nH*(g & nH)); return tgTan; } diff --git a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C index 7cad81cd1ea..977eb4ec839 100644 --- a/src/regionModels/surfaceFilmModels/noFilm/noFilm.C +++ b/src/regionModels/surfaceFilmModels/noFilm/noFilm.C @@ -74,17 +74,10 @@ Foam::scalar noFilm::CourantNumber() const tmp<volScalarField::Internal> noFilm::Srho() const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - "noFilm::Srho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName("noFilm", "Srho"), + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); @@ -93,17 +86,10 @@ tmp<volScalarField::Internal> noFilm::Srho() const tmp<volScalarField::Internal> noFilm::Srho(const label i) const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - "noFilm::Srho(" + Foam::name(i) + ")", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName("noFilm", "Srho(" + Foam::name(i) + ")"), + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); @@ -112,17 +98,10 @@ tmp<volScalarField::Internal> noFilm::Srho(const label i) const tmp<volScalarField::Internal> noFilm::Sh() const { - return tmp<volScalarField::Internal>::New + return volScalarField::Internal::New ( - IOobject - ( - "noFilm::Sh", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName("noFilm", "Sh"), + IOobject::NO_REGISTER, mesh_, dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C index 92d35fc01f5..0dd56f30e6f 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/constantFilmThermo/constantFilmThermo.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -261,22 +262,13 @@ scalar constantFilmThermo::Tb(const scalar p) const tmp<volScalarField> constantFilmThermo::rho() const { - tmp<volScalarField> trho + auto trho = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ':' + rho0_.name_, - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimDensity, Zero), - fvPatchFieldBase::extrapolatedCalculatedType() - ) + IOobject::scopedName(type(), rho0_.name_), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimDensity, Zero), + fvPatchFieldBase::extrapolatedCalculatedType() ); trho.ref().primitiveFieldRef() = this->rho(0, 0); @@ -288,22 +280,13 @@ tmp<volScalarField> constantFilmThermo::rho() const tmp<volScalarField> constantFilmThermo::mu() const { - tmp<volScalarField> tmu + auto tmu = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ':' + mu0_.name_, - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimPressure*dimTime, Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), mu0_.name_), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimPressure*dimTime, Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); tmu.ref().primitiveFieldRef() = this->mu(0, 0); @@ -315,22 +298,13 @@ tmp<volScalarField> constantFilmThermo::mu() const tmp<volScalarField> constantFilmThermo::sigma() const { - tmp<volScalarField> tsigma + auto tsigma = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ':' + sigma0_.name_, - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimMass/sqr(dimTime), Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), sigma0_.name_), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimMass/sqr(dimTime), Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); tsigma.ref().primitiveFieldRef() = this->sigma(0, 0); @@ -342,22 +316,13 @@ tmp<volScalarField> constantFilmThermo::sigma() const tmp<volScalarField> constantFilmThermo::Cp() const { - tmp<volScalarField> tCp + auto tCp = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ':' + Cp0_.name_, - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimEnergy/dimMass/dimTemperature, Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), Cp0_.name_), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimEnergy/dimMass/dimTemperature, Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); tCp.ref().primitiveFieldRef() = this->Cp(0, 0); @@ -369,22 +334,13 @@ tmp<volScalarField> constantFilmThermo::Cp() const tmp<volScalarField> constantFilmThermo::kappa() const { - tmp<volScalarField> tkappa + auto tkappa = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ':' + kappa0_.name_, - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimPower/dimLength/dimTemperature, Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), kappa0_.name_), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimPower/dimLength/dimTemperature, Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); tkappa.ref().primitiveFieldRef() = this->kappa(0, 0); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C index bded086e115..d0a70fe7024 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmThermoModel/liquidFilmThermo/liquidFilmThermo.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -244,24 +245,14 @@ scalar liquidFilmThermo::Tb(const scalar p) const tmp<volScalarField> liquidFilmThermo::rho() const { - tmp<volScalarField> trho + auto trho = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ":rho", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimDensity, Zero), - fvPatchFieldBase::extrapolatedCalculatedType() - ) + IOobject::scopedName(type(), "rho"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimDensity, Zero), + fvPatchFieldBase::extrapolatedCalculatedType() ); - scalarField& rho = trho.ref().primitiveFieldRef(); if (useReferenceValues_) @@ -289,24 +280,14 @@ tmp<volScalarField> liquidFilmThermo::rho() const tmp<volScalarField> liquidFilmThermo::mu() const { - tmp<volScalarField> tmu + auto tmu = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ":mu", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimPressure*dimTime, Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), "mu"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimPressure*dimTime, Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); - scalarField& mu = tmu.ref().primitiveFieldRef(); if (useReferenceValues_) @@ -334,24 +315,14 @@ tmp<volScalarField> liquidFilmThermo::mu() const tmp<volScalarField> liquidFilmThermo::sigma() const { - tmp<volScalarField> tsigma + auto tsigma = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ":sigma", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimMass/sqr(dimTime), Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), "sigma"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimMass/sqr(dimTime), Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); - scalarField& sigma = tsigma.ref().primitiveFieldRef(); if (useReferenceValues_) @@ -379,24 +350,14 @@ tmp<volScalarField> liquidFilmThermo::sigma() const tmp<volScalarField> liquidFilmThermo::Cp() const { - tmp<volScalarField> tCp + auto tCp = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ":Cp", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimEnergy/dimMass/dimTemperature, Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), "Cp"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimEnergy/dimMass/dimTemperature, Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); - scalarField& Cp = tCp.ref().primitiveFieldRef(); if (useReferenceValues_) @@ -424,24 +385,14 @@ tmp<volScalarField> liquidFilmThermo::Cp() const tmp<volScalarField> liquidFilmThermo::kappa() const { - tmp<volScalarField> tkappa + auto tkappa = volScalarField::New ( - new volScalarField - ( - IOobject - ( - type() + ":kappa", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimPower/dimLength/dimTemperature, Zero), - extrapolatedCalculatedFvPatchScalarField::typeName - ) + IOobject::scopedName(type(), "kappa"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimPower/dimLength/dimTemperature, Zero), + extrapolatedCalculatedFvPatchScalarField::typeName ); - scalarField& kappa = tkappa.ref().primitiveFieldRef(); if (useReferenceValues_) diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C index e91094ada85..28fc595be55 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/filmTurbulenceModel/laminar/laminar.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -72,22 +73,13 @@ laminar::~laminar() tmp<volVectorField> laminar::Us() const { - tmp<volVectorField> tUs + auto tUs = volVectorField::New ( - new volVectorField - ( - IOobject - ( - typeName + ":Us", - filmModel_.regionMesh().time().timeName(), - filmModel_.regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - filmModel_.regionMesh(), - dimensionedVector(dimVelocity, Zero), - fvPatchFieldBase::extrapolatedCalculatedType() - ) + IOobject::scopedName(typeName, "Us"), + IOobject::NO_REGISTER, + filmModel_.regionMesh(), + dimensionedVector(dimVelocity, Zero), + fvPatchFieldBase::extrapolatedCalculatedType() ); // apply quadratic profile @@ -100,16 +92,10 @@ tmp<volVectorField> laminar::Us() const tmp<volScalarField> laminar::mut() const { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - typeName + ":mut", - filmModel_.regionMesh().time().timeName(), - filmModel_.regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), + IOobject::scopedName(typeName, "mut"), + IOobject::NO_REGISTER, filmModel_.regionMesh(), dimensionedScalar(dimMass/dimLength/dimTime, Zero) ); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C index e88d983f080..0394eb3a67c 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/contactAngleForce/contactAngleForce.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2018-2020 OpenCFD Ltd. + Copyright (C) 2018-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -107,14 +107,15 @@ contactAngleForce::contactAngleForce ( IOobject ( - typeName + ":contactForceMask", + IOobject::scopedName(typeName, "contactForceMask"), filmModel_.time().timeName(), filmModel_.regionMesh(), IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::NO_REGISTER ), filmModel_.regionMesh(), - dimensionedScalar("mask", dimless, 1.0) + dimensionedScalar(word::null, dimless, 1.0) ) { initialise(); @@ -131,24 +132,14 @@ contactAngleForce::~contactAngleForce() tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) { - tmp<volVectorField> tForce + auto tForce = volVectorField::New ( - new volVectorField - ( - IOobject - ( - typeName + ":contactForce", - filmModel_.time().timeName(), - filmModel_.regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - filmModel_.regionMesh(), - dimensionedVector(dimForce/dimArea, Zero) - ) + IOobject::scopedName(typeName, "contactForce"), + IOobject::NO_REGISTER, + filmModel_.regionMesh(), + dimensionedVector(dimForce/dimArea, Zero) ); - - vectorField& force = tForce.ref().primitiveFieldRef(); + auto& force = tForce.ref().primitiveFieldRef(); const labelUList& own = filmModel_.regionMesh().owner(); const labelUList& nbr = filmModel_.regionMesh().neighbour(); @@ -226,10 +217,7 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U) tForce().write(); } - tmp<fvVectorMatrix> tfvm - ( - new fvVectorMatrix(U, dimForce/dimArea*dimVolume) - ); + auto tfvm = tmp<fvVectorMatrix>::New(U, dimForce/dimArea*dimVolume); tfvm.ref() += tForce; diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/distribution/distributionContactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/distribution/distributionContactAngleForce.C index 514fdb0ab8d..6edb0ecd7af 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/distribution/distributionContactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/distribution/distributionContactAngleForce.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -74,34 +75,26 @@ distributionContactAngleForce::~distributionContactAngleForce() tmp<volScalarField> distributionContactAngleForce::theta() const { - tmp<volScalarField> ttheta + auto ttheta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - typeName + ":theta", - filmModel_.time().timeName(), - filmModel_.regionMesh() - ), - filmModel_.regionMesh(), - dimensionedScalar(dimless, Zero) - ) + IOobject::scopedName(typeName, "theta"), + IOobject::NO_REGISTER, + filmModel_.regionMesh(), + dimensionedScalar(dimless, Zero) ); + auto& thetaIf = ttheta.ref().internalFieldRef(); + auto& thetaBf = ttheta.ref().boundaryFieldRef(); - volScalarField& theta = ttheta.ref(); - volScalarField::Internal& thetai = theta.ref(); - - forAll(thetai, celli) + forAll(thetaIf, celli) { - thetai[celli] = distribution_->sample(); + thetaIf[celli] = distribution_->sample(); } - forAll(theta.boundaryField(), patchi) + forAll(thetaBf, patchi) { if (!filmModel_.isCoupledPatch(patchi)) { - fvPatchField<scalar>& thetaf = theta.boundaryFieldRef()[patchi]; + fvPatchField<scalar>& thetaf = thetaBf[patchi]; forAll(thetaf, facei) { @@ -113,6 +106,7 @@ tmp<volScalarField> distributionContactAngleForce::theta() const return ttheta; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/perturbedTemperatureDependent/perturbedTemperatureDependentContactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/perturbedTemperatureDependent/perturbedTemperatureDependentContactAngleForce.C index f6ff1170d65..f22860ad72c 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/perturbedTemperatureDependent/perturbedTemperatureDependentContactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/perturbedTemperatureDependent/perturbedTemperatureDependentContactAngleForce.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -83,40 +84,32 @@ perturbedTemperatureDependentContactAngleForce:: tmp<volScalarField> perturbedTemperatureDependentContactAngleForce::theta() const { - tmp<volScalarField> ttheta + auto ttheta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - typeName + ":theta", - filmModel_.time().timeName(), - filmModel_.regionMesh() - ), - filmModel_.regionMesh(), - dimensionedScalar(dimless, Zero) - ) + IOobject::scopedName(typeName, "theta"), + IOobject::NO_REGISTER, + filmModel_.regionMesh(), + dimensionedScalar(dimless, Zero) ); - - volScalarField& theta = ttheta.ref(); - volScalarField::Internal& thetai = theta.ref(); + auto& thetaIf = ttheta.ref().internalFieldRef(); + auto& thetaBf = ttheta.ref().boundaryFieldRef(); const volScalarField& T = filmModel_.T(); // Initialize with the function of temperature - thetai.field() = thetaPtr_->value(T()); + thetaIf.field() = thetaPtr_->value(T()); // Add the stochastic perturbation - forAll(thetai, celli) + forAll(thetaIf, celli) { - thetai[celli] += distribution_->sample(); + thetaIf[celli] += distribution_->sample(); } - forAll(theta.boundaryField(), patchi) + forAll(thetaBf, patchi) { if (!filmModel_.isCoupledPatch(patchi)) { - fvPatchField<scalar>& thetaf = theta.boundaryFieldRef()[patchi]; + fvPatchField<scalar>& thetaf = thetaBf[patchi]; // Initialize with the function of temperature thetaf = thetaPtr_->value(T.boundaryField()[patchi]); @@ -132,6 +125,7 @@ perturbedTemperatureDependentContactAngleForce::theta() const return ttheta; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/temperatureDependent/temperatureDependentContactAngleForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/temperatureDependent/temperatureDependentContactAngleForce.C index d78200a0a66..4b358419293 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/temperatureDependent/temperatureDependentContactAngleForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/contactAngleForces/temperatureDependent/temperatureDependentContactAngleForce.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -71,39 +72,32 @@ temperatureDependentContactAngleForce::~temperatureDependentContactAngleForce() tmp<volScalarField> temperatureDependentContactAngleForce::theta() const { - tmp<volScalarField> ttheta + auto ttheta = volScalarField::New ( - new volScalarField - ( - IOobject - ( - typeName + ":theta", - filmModel_.time().timeName(), - filmModel_.regionMesh() - ), - filmModel_.regionMesh(), - dimensionedScalar(dimless, Zero) - ) + IOobject::scopedName(typeName, "theta"), + IOobject::NO_REGISTER, + filmModel_.regionMesh(), + dimensionedScalar(dimless, Zero) ); - - volScalarField& theta = ttheta.ref(); + auto& thetaIf = ttheta.ref().internalFieldRef(); + auto& thetaBf = ttheta.ref().boundaryFieldRef(); const volScalarField& T = filmModel_.T(); - theta.ref().field() = thetaPtr_->value(T()); + thetaIf.field() = thetaPtr_->value(T()); - forAll(theta.boundaryField(), patchi) + forAll(thetaBf, patchi) { if (!filmModel_.isCoupledPatch(patchi)) { - theta.boundaryFieldRef()[patchi] = - thetaPtr_->value(T.boundaryField()[patchi]); + thetaBf[patchi] = thetaPtr_->value(T.boundaryField()[patchi]); } } return ttheta; } + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace surfaceFilmModels diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C index 6972aca86c7..eb8962e471b 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/forceList/forceList.C @@ -79,11 +79,8 @@ forceList::~forceList() tmp<fvVectorMatrix> forceList::correct(volVectorField& U) { - tmp<fvVectorMatrix> tResult - ( - new fvVectorMatrix(U, dimForce/dimArea*dimVolume) - ); - fvVectorMatrix& result = tResult.ref(); + auto tResult = tmp<fvVectorMatrix>::New(U, dimForce/dimArea*dimVolume); + auto& result = tResult.ref(); forAll(*this, i) { diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C index fddbee7d372..db48dc0e54d 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/force/thermocapillaryForce/thermocapillaryForce.C @@ -68,8 +68,7 @@ tmp<fvVectorMatrix> thermocapillaryForce::correct(volVectorField& U) const volScalarField& alpha = filmModel_.alpha(); const volScalarField& sigma = filmModel_.sigma(); - tmp<fvVectorMatrix> - tfvm(new fvVectorMatrix(U, dimForce/dimArea*dimVolume)); + auto tfvm = tmp<fvVectorMatrix>::New(U, dimForce/dimArea*dimVolume); tfvm.ref() += alpha*fvc::grad(sigma); diff --git a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C index 11c405527ad..6cf20ab7bc0 100644 --- a/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C +++ b/src/regionModels/surfaceFilmModels/submodels/kinematic/injectionModel/curvatureSeparation/curvatureSeparation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,21 +66,20 @@ tmp<volScalarField> curvatureSeparation::calcInvR1 { // method 1 /* - tmp<volScalarField> tinvR1 - ( - new volScalarField("invR1", fvc::div(film().nHat())) - ); + auto tinvR1 = volScalarField::New("invR1", fvc::div(film().nHat())); */ // method 2 dimensionedScalar smallU("smallU", dimVelocity, ROOTVSMALL); volVectorField UHat(U/(mag(U) + smallU)); - tmp<volScalarField> tinvR1 + + auto tinvR1 = volScalarField::New ( - new volScalarField("invR1", UHat & (UHat & gradNHat_)) + "invR1", + IOobject::NO_REGISTER, + UHat & (UHat & gradNHat_) ); - scalarField& invR1 = tinvR1.ref().primitiveFieldRef(); // apply defined patch radii @@ -197,21 +196,16 @@ tmp<scalarField> curvatureSeparation::calcCosAngle // checks if (debug && mesh.time().writeTime()) { - volScalarField volCosAngle + auto tvolCosAngle = volScalarField::New ( - IOobject - ( - "cosAngle", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "cosAngle", + IOobject::NO_REGISTER, mesh, dimensionedScalar(dimless, Zero), fvPatchFieldBase::zeroGradientType() ); + auto& volCosAngle = tvolCosAngle.ref(); + volCosAngle.primitiveFieldRef() = cosAngle; volCosAngle.correctBoundaryConditions(); volCosAngle.write(); @@ -341,21 +335,16 @@ void curvatureSeparation::correct if (debug && mesh.time().writeTime()) { - volScalarField volFnet + auto tvolFnet = volScalarField::New ( - IOobject - ( - "Fnet", - mesh.time().timeName(), - mesh, - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + "Fnet", + IOobject::NO_REGISTER, mesh, dimensionedScalar(dimForce, Zero), fvPatchFieldBase::zeroGradientType() ); + auto& volFnet = tvolFnet.ref(); + volFnet.primitiveFieldRef() = Fnet; volFnet.correctBoundaryConditions(); volFnet.write(); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C index 04607ad05cc..48861e40370 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/constantRadiation/constantRadiation.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -62,7 +63,7 @@ constantRadiation::constantRadiation ( IOobject ( - typeName + ":qrConst", + IOobject::scopedName(typeName, "qrConst"), film.time().timeName(), film.regionMesh().thisDb(), IOobject::MUST_READ, @@ -74,7 +75,7 @@ constantRadiation::constantRadiation ( IOobject ( - typeName + ":mask", + IOobject::scopedName(typeName, "mask"), film.time().timeName(), film.regionMesh().thisDb(), IOobject::READ_IF_PRESENT, @@ -105,28 +106,19 @@ void constantRadiation::correct() tmp<volScalarField> constantRadiation::Shs() { - tmp<volScalarField> tShs + auto tShs = volScalarField::New ( - new volScalarField - ( - IOobject - ( - typeName + ":Shs", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimMass/pow3(dimTime), Zero) - ) + IOobject::scopedName(typeName, "Shs"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimMass/pow3(dimTime), Zero) ); + auto& Shs = tShs.ref().primitiveFieldRef(); const scalar time = film().time().value(); if ((time >= timeStart_) && (time <= timeStart_ + duration_)) { - scalarField& Shs = tShs.ref(); const scalarField& qr = qrConst_; const scalarField& alpha = filmModel_.alpha(); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C index cb934c67089..3851e8e5061 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/noRadiation/noRadiation.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,16 +76,10 @@ void noRadiation::correct() tmp<volScalarField> noRadiation::Shs() { - return tmp<volScalarField>::New + return volScalarField::New ( - IOobject - ( - typeName + ":Shs", - film().time().timeName(), - film().regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), + IOobject::scopedName(typeName, "Shs"), + IOobject::NO_REGISTER, film().regionMesh(), dimensionedScalar(dimMass/pow3(dimTime), Zero) ); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C index 38b2b13e726..b53dfa9d5ef 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/primaryRadiation/primaryRadiation.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2012-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -66,7 +67,8 @@ primaryRadiation::primaryRadiation film.time().timeName(), film.regionMesh().thisDb(), IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimMass/pow3(dimTime), Zero), @@ -92,24 +94,15 @@ void primaryRadiation::correct() tmp<volScalarField> primaryRadiation::Shs() { - tmp<volScalarField> tShs + auto tShs = volScalarField::New ( - new volScalarField - ( - IOobject - ( - typeName + ":Shs", - film().time().timeName(), - film().regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimMass/pow3(dimTime), Zero) - ) + IOobject::scopedName(typeName, "Shs"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimMass/pow3(dimTime), Zero) ); - scalarField& Shs = tShs.ref(); + const scalarField& qinP = qinPrimary_; const scalarField& alpha = filmModel_.alpha(); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C index fd397255700..9fabe064fb1 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmRadiationModel/standardRadiation/standardRadiation.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -67,7 +68,8 @@ standardRadiation::standardRadiation film.time().timeName(), film.regionMesh().thisDb(), IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimMass/pow3(dimTime), Zero), @@ -81,7 +83,8 @@ standardRadiation::standardRadiation film.time().timeName(), film.regionMesh().thisDb(), IOobject::NO_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimMass/pow3(dimTime), Zero), @@ -103,24 +106,15 @@ void standardRadiation::correct() tmp<volScalarField> standardRadiation::Shs() { - tmp<volScalarField> tShs + auto tShs = volScalarField::New ( - new volScalarField - ( - IOobject - ( - typeName + ":Shs", - film().time().timeName(), - film().regionMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - film().regionMesh(), - dimensionedScalar(dimMass/pow3(dimTime), Zero) - ) + IOobject::scopedName(typeName, "Shs"), + IOobject::NO_REGISTER, + film().regionMesh(), + dimensionedScalar(dimMass/pow3(dimTime), Zero) ); - scalarField& Shs = tShs.ref(); + const scalarField& qinP = qinPrimary_; const scalarField& delta = filmModel_.delta(); const scalarField& alpha = filmModel_.alpha(); diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C index 67d8e792b89..058cb62aedd 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/thixotropicViscosity/thixotropicViscosity.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -76,11 +77,12 @@ thixotropicViscosity::thixotropicViscosity ( IOobject ( - typeName + ":lambda", + IOobject::scopedName(typeName, "lambda"), film.regionMesh().time().timeName(), film.regionMesh().thisDb(), IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), film.regionMesh() ) diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/waxSolventViscosity/waxSolventViscosity.C b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/waxSolventViscosity/waxSolventViscosity.C index df4c6ab9a87..6bbd2cbfc90 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/waxSolventViscosity/waxSolventViscosity.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/filmViscosityModel/waxSolventViscosity/waxSolventViscosity.C @@ -6,6 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation + Copyright (C) 2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -57,37 +58,29 @@ void waxSolventViscosity::correctMu() { const kinematicSingleLayer& film = filmType<kinematicSingleLayer>(); - const uniformDimensionedScalarField Wwax - ( + const auto& Wwax = film.regionMesh().lookupObject<uniformDimensionedScalarField> ( - waxSolventEvaporation::typeName + ":Wwax" - ) - ); + IOobject::scopedName(waxSolventEvaporation::typeName, "Wwax") + ); - const uniformDimensionedScalarField Wsolvent - ( + const auto& Wsolvent = film.regionMesh().lookupObject<uniformDimensionedScalarField> ( - waxSolventEvaporation::typeName + ":Wsolvent" - ) - ); + IOobject::scopedName(waxSolventEvaporation::typeName, "Wsolvent") + ); - const uniformDimensionedScalarField Ysolvent0 - ( + const auto& Ysolvent0 = film.regionMesh().lookupObject<uniformDimensionedScalarField> ( - waxSolventEvaporation::typeName + ":Ysolvent0" - ) - ); + IOobject::scopedName(waxSolventEvaporation::typeName, "Ysolvent0") + ); - const volScalarField& Ysolvent - ( + const auto& Ysolvent = film.regionMesh().lookupObject<volScalarField> ( - waxSolventEvaporation::typeName + ":Ysolvent" - ) - ); + IOobject::scopedName(waxSolventEvaporation::typeName, "Ysolvent") + ); const volScalarField Xsolvent ( @@ -118,11 +111,12 @@ waxSolventViscosity::waxSolventViscosity ( IOobject ( - typeName + ":muWax", + IOobject::scopedName(typeName, "muWax"), film.regionMesh().time().timeName(), film.regionMesh().thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimDynamicViscosity, Zero), @@ -141,11 +135,12 @@ waxSolventViscosity::waxSolventViscosity ( IOobject ( - typeName + ":muSolvent", + IOobject::scopedName(typeName, "muSolvent"), film.regionMesh().time().timeName(), film.regionMesh().thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimDynamicViscosity, Zero), diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C b/src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C index 9bdae5059ca..518e50b1e62 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/heatTransferModel/constantHeatTransfer/constantHeatTransfer.C @@ -76,26 +76,16 @@ void constantHeatTransfer::correct() tmp<volScalarField> constantHeatTransfer::h() const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField + "htc", + IOobject::NO_REGISTER, + filmModel_.regionMesh(), + dimensionedScalar ( - IOobject - ( - "htc", - filmModel_.time().timeName(), - filmModel_.regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - filmModel_.regionMesh(), - dimensionedScalar - ( - "c0", - dimEnergy/dimTime/sqr(dimLength)/dimTemperature, - c0_ - ) + "c0", + dimEnergy/dimTime/sqr(dimLength)/dimTemperature, + c0_ ) ); } diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C index dd7ecd529a4..1c36295efc5 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/solidification/solidification.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2013-2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -75,11 +75,12 @@ solidification::solidification ( IOobject ( - typeName + ":mass", + IOobject::scopedName(typeName, "mass"), film.regionMesh().time().timeName(), film.regionMesh().thisDb(), IOobject::READ_IF_PRESENT, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimMass, Zero), @@ -89,11 +90,12 @@ solidification::solidification ( IOobject ( - typeName + ":thickness", + IOobject::scopedName(typeName, "thickness"), film.regionMesh().time().timeName(), film.regionMesh().thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), film.regionMesh(), dimensionedScalar(dimLength, Zero), diff --git a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/waxSolventEvaporation/waxSolventEvaporation.C b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/waxSolventEvaporation/waxSolventEvaporation.C index 13ab7a4d15c..b59786b74a6 100644 --- a/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/waxSolventEvaporation/waxSolventEvaporation.C +++ b/src/regionModels/surfaceFilmModels/submodels/thermo/phaseChangeModel/waxSolventEvaporation/waxSolventEvaporation.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2017 OpenFOAM Foundation - Copyright (C) 2020 OpenCFD Ltd. + Copyright (C) 2020-2023 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -88,9 +88,12 @@ waxSolventEvaporation::waxSolventEvaporation ( IOobject ( - typeName + ":Wwax", + IOobject::scopedName(typeName, "Wwax"), film.regionMesh().time().constant(), - film.regionMesh().thisDb() + film.regionMesh().thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + IOobject::REGISTER ), coeffDict_.get<scalar>("Wwax") ), @@ -98,9 +101,12 @@ waxSolventEvaporation::waxSolventEvaporation ( IOobject ( - typeName + ":Wsolvent", + IOobject::scopedName(typeName, "Wsolvent"), film.regionMesh().time().constant(), - film.regionMesh().thisDb() + film.regionMesh().thisDb(), + IOobject::NO_READ, + IOobject::NO_WRITE, + IOobject::REGISTER ), coeffDict_.get<scalar>("Wsolvent") ), @@ -108,22 +114,24 @@ waxSolventEvaporation::waxSolventEvaporation ( IOobject ( - typeName + ":Ysolvent0", + IOobject::scopedName(typeName, "Ysolvent0"), film.regionMesh().time().constant(), film.regionMesh().thisDb(), IOobject::MUST_READ, - IOobject::NO_WRITE + IOobject::NO_WRITE, + IOobject::REGISTER ) ), Ysolvent_ ( IOobject ( - typeName + ":Ysolvent", + IOobject::scopedName(typeName, "Ysolvent"), film.regionMesh().time().timeName(), film.regionMesh().thisDb(), IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), film.regionMesh() ), @@ -187,35 +195,21 @@ void waxSolventEvaporation::correctModel const scalar Wwax = Wwax_.value(); const scalar Wsolvent = Wsolvent_.value(); - volScalarField::Internal evapRateCoeff + auto tevapRateCoeff = volScalarField::Internal::New ( - IOobject - ( - typeName + ":evapRateCoeff", - film.regionMesh().time().timeName(), - film.regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "evapRateCoeff"), film.regionMesh(), dimensionedScalar(dimDensity*dimVelocity, Zero) ); + auto& evapRateCoeff = tevapRateCoeff.ref(); - volScalarField::Internal evapRateInf + auto tevapRateInf = volScalarField::Internal::New ( - IOobject - ( - typeName + ":evapRateInf", - film.regionMesh().time().timeName(), - film.regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), + IOobject::scopedName(typeName, "evapRateInf"), film.regionMesh(), dimensionedScalar(dimDensity*dimVelocity, Zero) ); + auto& evapRateInf = tevapRateInf.ref(); bool filmPresent = false; diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C index 9202742a838..ba9bf0b0cbd 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayer.C @@ -327,7 +327,8 @@ thermoSingleLayer::thermoSingleLayer regionMesh().time().timeName(), regionMesh().thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), regionMesh(), dimensionedScalar(dimEnergy/dimMass/dimTemperature, Zero), @@ -341,7 +342,8 @@ thermoSingleLayer::thermoSingleLayer regionMesh().time().timeName(), regionMesh().thisDb(), IOobject::NO_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), regionMesh(), dimensionedScalar(dimEnergy/dimTime/dimLength/dimTemperature, Zero), @@ -356,7 +358,8 @@ thermoSingleLayer::thermoSingleLayer regionMesh().time().timeName(), regionMesh().thisDb(), IOobject::MUST_READ, - IOobject::AUTO_WRITE + IOobject::AUTO_WRITE, + IOobject::REGISTER ), regionMesh() ), @@ -705,38 +708,28 @@ void thermoSingleLayer::info() tmp<volScalarField::Internal> thermoSingleLayer::Srho() const { - tmp<volScalarField::Internal> tSrho + auto tSrho = volScalarField::Internal::New ( - new volScalarField::Internal - ( - IOobject - ( - typeName + ":Srho", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - primaryMesh(), - dimensionedScalar(dimMass/dimVolume/dimTime, Zero) - ) + IOobject::scopedName(typeName, "Srho"), + IOobject::NO_REGISTER, + primaryMesh(), + dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); - scalarField& Srho = tSrho.ref(); + const scalarField& V = primaryMesh().V(); const scalar dt = time_.deltaTValue(); forAll(intCoupledPatchIDs(), i) { const label filmPatchi = intCoupledPatchIDs()[i]; + const label primaryPatchi = primaryPatchIDs()[i]; scalarField patchMass = primaryMassTrans_.boundaryField()[filmPatchi]; toPrimary(filmPatchi, patchMass); - const label primaryPatchi = primaryPatchIDs()[i]; const labelUList& cells = primaryMesh().boundaryMesh()[primaryPatchi].faceCells(); @@ -757,40 +750,30 @@ tmp<volScalarField::Internal> thermoSingleLayer::Srho { const label vapId = thermo_.carrierId(filmThermo_->name()); - tmp<volScalarField::Internal> tSrho + auto tSrho = volScalarField::Internal::New ( - new volScalarField::Internal - ( - IOobject - ( - typeName + ":Srho(" + Foam::name(i) + ")", - time_.timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - primaryMesh(), - dimensionedScalar(dimMass/dimVolume/dimTime, Zero) - ) + IOobject::scopedName(typeName, "Srho(" + Foam::name(i) + ")"), + IOobject::NO_REGISTER, + primaryMesh(), + dimensionedScalar(dimMass/dimVolume/dimTime, Zero) ); + scalarField& Srho = tSrho.ref(); if (vapId == i) { - scalarField& Srho = tSrho.ref(); const scalarField& V = primaryMesh().V(); const scalar dt = time().deltaTValue(); forAll(intCoupledPatchIDs_, i) { const label filmPatchi = intCoupledPatchIDs_[i]; + const label primaryPatchi = primaryPatchIDs()[i]; scalarField patchMass = primaryMassTrans_.boundaryField()[filmPatchi]; toPrimary(filmPatchi, patchMass); - const label primaryPatchi = primaryPatchIDs()[i]; const labelUList& cells = primaryMesh().boundaryMesh()[primaryPatchi].faceCells(); @@ -807,38 +790,28 @@ tmp<volScalarField::Internal> thermoSingleLayer::Srho tmp<volScalarField::Internal> thermoSingleLayer::Sh() const { - tmp<volScalarField::Internal> tSh + auto tSh = volScalarField::Internal::New ( - new volScalarField::Internal - ( - IOobject - ( - typeName + ":Sh", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - primaryMesh(), - dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) - ) + IOobject::scopedName(typeName, "Sh"), + IOobject::NO_REGISTER, + primaryMesh(), + dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); - scalarField& Sh = tSh.ref(); + const scalarField& V = primaryMesh().V(); const scalar dt = time_.deltaTValue(); forAll(intCoupledPatchIDs_, i) { const label filmPatchi = intCoupledPatchIDs_[i]; + const label primaryPatchi = primaryPatchIDs()[i]; scalarField patchEnergy = primaryEnergyTrans_.boundaryField()[filmPatchi]; toPrimary(filmPatchi, patchEnergy); - const label primaryPatchi = primaryPatchIDs()[i]; const labelUList& cells = primaryMesh().boundaryMesh()[primaryPatchi].faceCells(); diff --git a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H index e53bd1a16b1..3c2ef6ed133 100644 --- a/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H +++ b/src/regionModels/surfaceFilmModels/thermoSingleLayer/thermoSingleLayerI.H @@ -64,20 +64,11 @@ inline tmp<volScalarField> thermoSingleLayer::hs const volScalarField& T ) const { - return tmp<volScalarField> + return volScalarField::New ( - new volScalarField - ( - IOobject - ( - "hs(" + T.name() + ")", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - Cp_*(T - Tref) - ) + "hs(" + T.name() + ")", + IOobject::NO_REGISTER, + Cp_*(T - Tref) ); } @@ -87,20 +78,11 @@ inline tmp<volScalarField> thermoSingleLayer::T const volScalarField& hs ) const { - tmp<volScalarField> tT + auto tT = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "T(" + hs.name() + ")", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE - ), - hs/Cp_ + Tref - ) + "T(" + hs.name() + ")", + IOobject::NO_REGISTER, + hs/Cp_ + Tref ); if (limitType::CLAMP_MIN == withTbounds_) diff --git a/src/regionModels/thermalBaffleModels/noThermo/noThermo.C b/src/regionModels/thermalBaffleModels/noThermo/noThermo.C index 755c3a4e4ec..40e96f6d932 100644 --- a/src/regionModels/thermalBaffleModels/noThermo/noThermo.C +++ b/src/regionModels/thermalBaffleModels/noThermo/noThermo.C @@ -92,24 +92,7 @@ const tmp<volScalarField> noThermo::Cp() const FatalErrorInFunction << "Cp field not available for " << type() << abort(FatalError); - - return tmp<volScalarField> - ( - new volScalarField - ( - IOobject - ( - "noThermo::Cp", - time().timeName(), - primaryMesh(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - primaryMesh(), - dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) - ) - ); + return nullptr; } const volScalarField& noThermo::kappaRad() const diff --git a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C index 75aa0614587..a5e915dcd39 100644 --- a/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C +++ b/src/regionModels/thermalBaffleModels/thermalBaffle/thermalBaffle.C @@ -72,25 +72,14 @@ void thermalBaffle::solveEnergy() const polyBoundaryMesh& rbm = regionMesh().boundaryMesh(); - tmp<volScalarField> tQ + auto tQ = volScalarField::New ( - new volScalarField - ( - IOobject - ( - "tQ", - regionMesh().time().timeName(), - regionMesh().thisDb(), - IOobject::NO_READ, - IOobject::NO_WRITE, - IOobject::NO_REGISTER - ), - regionMesh(), - dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) - ) + "tQ", + IOobject::NO_REGISTER, + regionMesh(), + dimensionedScalar(dimEnergy/dimVolume/dimTime, Zero) ); - - volScalarField& Q = tQ.ref(); + auto& Q = tQ.ref(); volScalarField rho("rho", thermo_->rho()); volScalarField alpha("alpha", thermo_->alpha()); -- GitLab