diff --git a/src/regionFaModels/KirchhoffShell/KirchhoffShell.C b/src/regionFaModels/KirchhoffShell/KirchhoffShell.C index 1b09200a935e342ca4699dca6ffd70da0f44d482..b3daab327ebb4fb8c1bc7327ecd5aa70438b100b 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 afe3dc40a0eed394ada18b0fe344124191414235..b392609c8697fda9f76fa56224fff194c0f69289 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 a6c8b42f4a00a5692e4e079cdfabce1f650a9423..93b54a3ce0b22ffebc286516695a318dc5cdc772 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 ea0c634fce266e9de8ec1f0b9195b2ca89cdfd93..78e2ed4966cbdf10a56a650859b49fac10018751 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 46599c9750006866a60e310c7430f820f753bd13..69e33a08f3b485bba4a5f8010bb4e7b76908ebc7 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 3fa2465dd9ee12c2823d3ab78120bc5ad56a1dba..ede4196f9adef7ae02ec19090f7a8685842a91c0 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 4b3e66278fcb414d29ed8a9ec435face1311a9bb..b365b5c346d138ff3aaf7ed839e82569fd73edec 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 871fdcc199ab48eab5bd20100b31fdd04c2ca597..94f659840043eccb87125cc83866e4528807e5d9 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 58a6beeb1b5bf2e992aa77a53d99e25581e0e119..a35106bc1f193072680f996b046f3ecac0c5eeb1 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 5a022e964b3a0a06e355666fa66b57d84e96acdc..9cff5b9bd705b04e7a68487cc541184c02714067 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 7cad81cd1ea7e5dfea99bdeb23197be8e01eb26b..977eb4ec839ff98a5c9bc6fff591a8ab5e6cdd15 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 92d35fc01f5bef895a69038a8bdada6b18aa7d0e..0dd56f30e6fb404301fd05c108e49aaf96b3996d 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 bded086e11522f0f2af160ba02fa37d2eaff38dd..d0a70fe70248879d41b150c01d84e1844e34bbd2 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 e91094ada8593ca2a61531ec44030b4f6d39ee02..28fc595be55a3c2d9d0d0d21fa3bb44aef6fcd93 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 e88d983f080cd5b85a41107d491f5e7b764d6f11..0394eb3a67c2697e5b4feae00d28651ce1b5c275 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 514fdb0ab8dde21c3b5ec662a26d7c7217050099..6edb0ecd7afa63f1309aa6b3e5ca1269f35bff91 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 f6ff1170d6523e903a072637cedbe447e87a9cd4..f22860ad72cce3b82c6f2b30efd6ff061771d485 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 d78200a0a66c0679940207551282c5a3ae629c5d..4b35841929347a55c453ec9d32187f72f5e5bf92 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 6972aca86c792f09dd07e6dfb5f7da5d8c8209c1..eb8962e471bc44142e9c005c8bffb46018a20f2a 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 fddbee7d3728ed984582eaf87e9e0853321e22ce..db48dc0e54d2a012eb3feab11fb273856385f714 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 11c405527ad89c3b7675d1cf81326c7dda613235..6cf20ab7bc0b3c342d8492d93b7534cbab604e8a 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 04607ad05ccd48b0938f0f662b6d455c14f9e97a..48861e403704fa9b20dc1c584bbefe796fd847b8 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 cb934c67089d9a0be5d521b8bcf3c1e3a3a039b2..3851e8e5061e3e23a1decd03830c7002c07a53f7 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 38b2b13e726de98be68fd64f6e2088cd09e52c69..b53dfa9d5eff6780d5c0a11011e8c9cff715ac08 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 fd3972557006f133d65ec2f43333210ad39f833b..9fabe064fb14a8c380153b802aac0370dc550118 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 67d8e792b89642cc96e2c2f162ecbe69602d1e77..058cb62aedd445cd8aafcb6c84419a201b8376ba 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 df4c6ab9a878ed3e83c4fdbbef2d9286dc5a2232..6bbd2cbfc900a23253e89149a4cd6761524a823a 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 9bdae5059cad06858539e82e98c74c5347020dd4..518e50b1e62e3aa23a5e5506dbd27fc465ca687f 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 dd7ecd529a46890daa9abb49c445fd9b4b05c5b9..1c36295efc546ea386cdc144ee08a5e2f3ad0587 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 13ab7a4d15c2e750086bd884eb5b4de1be91abe8..b59786b74a67da70e4833452d576e87e5c13baf1 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 9202742a838b77c842e46e5cbff82d58c37016d1..ba9bf0b0cbdd2e94ce6d732a0936c97acfccc915 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 e53bd1a16b1e4a283c446a24d5f8be212de6e7c2..3c2ef6ed1334598a12db45a63b5890120d744505 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 755c3a4e4ec4f6fb032ddfab45b96711db8eb8ff..40e96f6d932d8dc61032e38403e1b2a1384fda4c 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 75aa061458742d858facd5e31dc6191de9fad2b8..a5e915dcd39011bb79dd6af06198fa23d19893c6 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());