STYLE: spelling and misc code style for interfaceHeatResistance

This commit is contained in:
Mark Olesen
2020-04-21 10:46:30 +02:00
parent a686491187
commit a14a231f09
15 changed files with 128 additions and 182 deletions

View File

@ -94,7 +94,6 @@ SourceFiles
#include "InterfaceCompositionModel.H" #include "InterfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
namespace Foam namespace Foam
@ -103,7 +102,7 @@ namespace meltingEvaporationModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class Lee Class Lee Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo> template<class Thermo, class OtherThermo>
@ -111,7 +110,7 @@ class Lee
: :
public InterfaceCompositionModel<Thermo, OtherThermo> public InterfaceCompositionModel<Thermo, OtherThermo>
{ {
// Private data // Private Data
//- Condensation coefficient [1/s] //- Condensation coefficient [1/s]
dimensionedScalar C_; dimensionedScalar C_;
@ -168,10 +167,9 @@ public:
//- Return T transition between phases //- Return T transition between phases
virtual const dimensionedScalar& Tactivate() const; virtual const dimensionedScalar& Tactivate() const;
//- Adds and substract alpha*div(U) as a source term //- Add/subtract alpha*div(U) as a source term
// for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2) //- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU(); virtual bool includeDivU();
}; };

View File

@ -65,7 +65,7 @@ Foam::interfaceCompositionModel::interfaceCompositionModel
modelVariable::T modelVariable::T
) )
), ),
includeVolChange_(dict.lookupOrDefault<bool>("includeVolChange", true)), includeVolChange_(dict.lookupOrDefault("includeVolChange", true)),
pair_(pair), pair_(pair),
speciesName_(dict.lookupOrDefault<word>("species", "none")), speciesName_(dict.lookupOrDefault<word>("species", "none")),
mesh_(pair_.from().mesh()) mesh_(pair_.from().mesh())

View File

@ -39,16 +39,17 @@ SourceFiles
#ifndef interfaceCompositionModel_H #ifndef interfaceCompositionModel_H
#define interfaceCompositionModel_H #define interfaceCompositionModel_H
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "volFields.H" #include "volFields.H"
#include "dictionary.H" #include "dictionary.H"
#include "runTimeSelectionTables.H" #include "runTimeSelectionTables.H"
#include "Enum.H" #include "Enum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
// Forward Declarations
class phaseModel; class phaseModel;
class phasePair; class phasePair;
@ -82,7 +83,7 @@ public:
protected: protected:
// Protected data // Protected Data
//- Phase pair //- Phase pair
const phasePair& pair_; const phasePair& pair_;
@ -197,8 +198,8 @@ public:
//- Reference value //- Reference value
virtual const dimensionedScalar& Tactivate() const = 0; virtual const dimensionedScalar& Tactivate() const = 0;
//- Adds and substract alpha*div(U) as a source term //- Add/subtract alpha*div(U) as a source term
// for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2) //- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU(); virtual bool includeDivU();
//- Add volume change in pEq //- Add volume change in pEq

View File

@ -195,23 +195,20 @@ Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
updateInterface(T); updateInterface(T);
tmp<volScalarField> tdeltaT auto tdeltaT = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "tdeltaT",
( mesh.time().timeName(),
"tdeltaT", mesh
mesh.time().timeName(), ),
mesh mesh,
), dimensionedScalar(dimTemperature, Zero)
mesh,
dimensionedScalar(dimTemperature, Zero)
)
); );
volScalarField& deltaT = tdeltaT.ref(); auto& deltaT = tdeltaT.ref();
dimensionedScalar T0("T0", dimTemperature, Zero); const dimensionedScalar T0(dimTemperature, Zero);
if (sign(R_.value()) > 0) if (sign(R_.value()) > 0)
{ {
@ -257,7 +254,7 @@ Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
mDotc_ = interfaceArea_*htc_*deltaT; mDotc_ = interfaceArea_*htc_*deltaT;
return tmp<volScalarField>(new volScalarField(mDotc_)); return tmp<volScalarField>::New(mDotc_);
} }
@ -283,10 +280,8 @@ Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
return(coeff*pos(Tactivate_ - refValue)); return(coeff*pos(Tactivate_ - refValue));
} }
} }
else
{ return nullptr;
return tmp<volScalarField> ();
}
} }
@ -314,12 +309,10 @@ Foam::meltingEvaporationModels::interfaceHeatResistance<Thermo, OtherThermo>
} }
else if (interfaceCompositionModel::P == variable) else if (interfaceCompositionModel::P == variable)
{ {
return tmp<volScalarField>(new volScalarField(mDotcSpread_)); return tmp<volScalarField>::New(mDotcSpread_);
}
else
{
return tmp<volScalarField> ();
} }
return nullptr;
} }
@ -340,4 +333,5 @@ interfaceHeatResistance<Thermo, OtherThermo>::includeDivU()
return true; return true;
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -74,7 +74,6 @@ SourceFiles
#ifndef meltingEvaporationModels_interfaceHeatResistance_H #ifndef meltingEvaporationModels_interfaceHeatResistance_H
#define meltingEvaporationModels_interfaceHeatResistance_H #define meltingEvaporationModels_interfaceHeatResistance_H
#include "InterfaceCompositionModel.H" #include "InterfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
@ -82,13 +81,14 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class phasePair; class phasePair;
namespace meltingEvaporationModels namespace meltingEvaporationModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class interfaceHeatResistance Class interfaceHeatResistance Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo> template<class Thermo, class OtherThermo>
@ -96,7 +96,7 @@ class interfaceHeatResistance
: :
public InterfaceCompositionModel<Thermo, OtherThermo> public InterfaceCompositionModel<Thermo, OtherThermo>
{ {
// Private data // Private Data
//- Heat transfer coefficient [1/s/K] //- Heat transfer coefficient [1/s/K]
dimensionedScalar R_; dimensionedScalar R_;
@ -123,7 +123,7 @@ class interfaceHeatResistance
scalar spread_; scalar spread_;
// Private member // Private Member Functions
//- Update interface //- Update interface
void updateInterface(const volScalarField& T); void updateInterface(const volScalarField& T);
@ -173,8 +173,8 @@ public:
//- Return Tactivate //- Return Tactivate
virtual const dimensionedScalar& Tactivate() const; virtual const dimensionedScalar& Tactivate() const;
//- Adds and substract alpha*div(U) as a source term //- Add/subtract alpha*div(U) as a source term
// for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2) //- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU(); virtual bool includeDivU();
}; };

View File

@ -63,13 +63,10 @@ void Foam::meltingEvaporationModels::kineticGasEvaporation<Thermo, OtherThermo>
} }
} }
const polyBoundaryMesh& pbm = mesh.boundaryMesh(); for (const polyPatch& pp : mesh.boundaryMesh())
forAll(pbm, patchi)
{ {
if (isA<wallPolyPatch>(pbm[patchi])) if (isA<wallPolyPatch>(pp))
{ {
const polyPatch& pp = pbm[patchi];
forAll(pp.faceCells(), faceI) forAll(pp.faceCells(), faceI)
{ {
const label pCelli = pp.faceCells()[faceI]; const label pCelli = pp.faceCells()[faceI];

View File

@ -115,7 +115,6 @@ SourceFiles
#ifndef meltingEvaporationModels_kineticGasEvaporation_H #ifndef meltingEvaporationModels_kineticGasEvaporation_H
#define meltingEvaporationModels_kineticGasEvaporation_H #define meltingEvaporationModels_kineticGasEvaporation_H
#include "InterfaceCompositionModel.H" #include "InterfaceCompositionModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *// // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *//
@ -123,13 +122,14 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class phasePair; class phasePair;
namespace meltingEvaporationModels namespace meltingEvaporationModels
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class kineticGasEvaporation Class kineticGasEvaporation Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Thermo, class OtherThermo> template<class Thermo, class OtherThermo>
@ -137,7 +137,7 @@ class kineticGasEvaporation
: :
public InterfaceCompositionModel<Thermo, OtherThermo> public InterfaceCompositionModel<Thermo, OtherThermo>
{ {
// Private data // Private Data
//- Evaporation coefficient //- Evaporation coefficient
dimensionedScalar C_; dimensionedScalar C_;
@ -161,7 +161,7 @@ class kineticGasEvaporation
scalar isoAlpha_; scalar isoAlpha_;
// Private member // Private Member Functions
//- Update interface //- Update interface
void updateInterface(const volScalarField& T); void updateInterface(const volScalarField& T);
@ -212,8 +212,8 @@ public:
//- Return Tactivate //- Return Tactivate
virtual const dimensionedScalar& Tactivate() const; virtual const dimensionedScalar& Tactivate() const;
//- Adds and substract alpha*div(U) as a source term //- Add/subtract alpha*div(U) as a source term
// for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2) //- for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
virtual bool includeDivU(); virtual bool includeDivU();
}; };

View File

@ -26,9 +26,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "MassTransferPhaseSystem.H" #include "MassTransferPhaseSystem.H"
#include "HashPtrTable.H" #include "HashPtrTable.H"
#include "fvcDiv.H" #include "fvcDiv.H"
#include "fvmSup.H" #include "fvmSup.H"
#include "fvMatrix.H" #include "fvMatrix.H"
@ -85,23 +83,20 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::calculateL
const volScalarField& T const volScalarField& T
) const ) const
{ {
tmp<volScalarField> tL auto tL = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "tL",
( this->mesh().time().timeName(),
"tL",
this->mesh().time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(), this->mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero) IOobject::NO_READ,
) IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar(dimEnergy/dimMass, Zero)
); );
volScalarField& L = tL.ref(); auto& L = tL.ref();
if (massTransferModels_.found(keyik)) if (massTransferModels_.found(keyik))
{ {
@ -110,10 +105,7 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::calculateL
word speciesName = interfacePtr->transferSpecie(); word speciesName = interfacePtr->transferSpecie();
auto tempOpen = speciesName.find('.'); const word species(speciesName.substr(0, speciesName.find('.')));
//const word species(speciesName(0, tempOpen));
const word species(speciesName.substr(0, tempOpen));
L -= neg(dmdtNetki)*interfacePtr->L(species, T); L -= neg(dmdtNetki)*interfacePtr->L(species, T);
} }
@ -125,9 +117,7 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::calculateL
word speciesName = interfacePtr->transferSpecie(); word speciesName = interfacePtr->transferSpecie();
auto tempOpen = speciesName.find('.'); const word species(speciesName.substr(0, speciesName.find('.')));
const word species(speciesName.substr(0, tempOpen));
L += pos(dmdtNetki)*interfacePtr->L(species, T); L += pos(dmdtNetki)*interfacePtr->L(species, T);
} }
@ -145,22 +135,18 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::dmdt
const phasePairKey& key const phasePairKey& key
) const ) const
{ {
tmp<volScalarField> tdmdt auto tdmdt = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "dmdt",
( this->mesh().time().timeName(),
"dmdt", this->mesh()
this->mesh().time().timeName(), ),
this->mesh() this->mesh(),
), dimensionedScalar(dimDensity/dimTime, Zero)
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
)
); );
auto& dmdt = tdmdt.ref();
volScalarField& dmdt = tdmdt.ref();
if (dmdt_.found(key)) if (dmdt_.found(key))
{ {
@ -178,12 +164,8 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::heatTransfer
const volScalarField& T const volScalarField& T
) )
{ {
tmp<fvScalarMatrix> tEqnPtr auto teqn = tmp<fvScalarMatrix>::New(T, dimEnergy/dimTime);
( auto& eqn = teqn.ref();
new fvScalarMatrix(T, dimEnergy/dimTime)
);
fvScalarMatrix& eqn = tEqnPtr.ref();
forAllConstIters(this->phaseModels_, iteri) forAllConstIters(this->phaseModels_, iteri)
{ {
@ -204,53 +186,44 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::heatTransfer
const phasePairKey keyki(phasek.name(), phasei.name(), true); const phasePairKey keyki(phasek.name(), phasei.name(), true);
// Net mass transfer from k to i phase // Net mass transfer from k to i phase
tmp<volScalarField> tdmdtNetki auto tdmdtNetki = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "tdmdtYki",
( this->mesh().time().timeName(),
"tdmdtYki", this->mesh()
this->mesh().time().timeName(), ),
this->mesh() this->mesh(),
), dimensionedScalar(dimDensity/dimTime, Zero)
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
)
); );
volScalarField& dmdtNetki = tdmdtNetki.ref(); auto& dmdtNetki = tdmdtNetki.ref();
tmp<volScalarField> tSp auto tSp = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "Sp",
( this->mesh().time().timeName(),
"Sp", this->mesh()
this->mesh().time().timeName(), ),
this->mesh() this->mesh(),
), dimensionedScalar(dimDensity/dimTime/dimTemperature, Zero)
this->mesh(),
dimensionedScalar(dimDensity/dimTime/dimTemperature, Zero)
)
); );
volScalarField& Sp = tSp.ref(); auto& Sp = tSp.ref();
tmp<volScalarField> tSu auto tSu = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "Su",
( this->mesh().time().timeName(),
"Su", this->mesh()
this->mesh().time().timeName(), ),
this->mesh() this->mesh(),
), dimensionedScalar(dimDensity/dimTime, Zero)
this->mesh(),
dimensionedScalar(dimDensity/dimTime, Zero)
)
); );
volScalarField& Su = tSu.ref(); auto& Su = tSu.ref();
if (massTransferModels_.found(keyik)) if (massTransferModels_.found(keyik))
@ -322,7 +295,7 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::heatTransfer
} }
} }
} }
return tEqnPtr; return teqn;
} }
@ -333,44 +306,34 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::volTransfer
const volScalarField& p const volScalarField& p
) )
{ {
tmp<fvScalarMatrix> tEqnPtr auto teqn = tmp<fvScalarMatrix>::New(p, dimVolume/dimTime);
( auto& eqn = teqn.ref();
new fvScalarMatrix(p, dimVolume/dimTime)
);
fvScalarMatrix& eqn = tEqnPtr.ref(); auto tSp = tmp<volScalarField>::New
tmp<volScalarField> tSp
( (
new volScalarField IOobject
( (
IOobject "Sp",
( this->mesh().time().timeName(),
"Sp", this->mesh()
this->mesh().time().timeName(), ),
this->mesh() this->mesh(),
), dimensionedScalar(dimless/dimTime/dimPressure, Zero)
this->mesh(),
dimensionedScalar(dimless/dimTime/dimPressure, Zero)
)
); );
volScalarField& Sp = tSp.ref(); auto& Sp = tSp.ref();
tmp<volScalarField> tSu auto tSu = tmp<volScalarField>::New
( (
new volScalarField IOobject
( (
IOobject "Su",
( this->mesh().time().timeName(),
"Su", this->mesh()
this->mesh().time().timeName(), ),
this->mesh() this->mesh(),
), dimensionedScalar(dimless/dimTime, Zero)
this->mesh(),
dimensionedScalar(dimless/dimTime, Zero)
)
); );
volScalarField& Su = tSu.ref(); auto& Su = tSu.ref();
forAllConstIters(this->totalPhasePairs(), iter) forAllConstIters(this->totalPhasePairs(), iter)
{ {
@ -482,7 +445,7 @@ Foam::MassTransferPhaseSystem<BasePhaseSystem>::volTransfer
} }
eqn += fvm::Sp(Sp, p) + Su; eqn += fvm::Sp(Sp, p) + Su;
return tEqnPtr; return teqn;
} }
@ -544,7 +507,7 @@ void Foam::MassTransferPhaseSystem<BasePhaseSystem>::alphaTransfer
SuSpTable& Sp SuSpTable& Sp
) )
{ {
// This term adds and substract alpha*div(U) as a source term // This term adds/subtracts alpha*div(U) as a source term
// for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2) // for alpha, substituting div(U) = mDot(1/rho1 - 1/rho2)
bool includeDivU(true); bool includeDivU(true);

View File

@ -85,7 +85,7 @@ protected:
dmdtTable; dmdtTable;
// Protected data // Protected Data
//- Overall inter-phase mass transfer rates [Kg/s] //- Overall inter-phase mass transfer rates [Kg/s]
dmdtTable dmdt_; dmdtTable dmdt_;
@ -94,7 +94,7 @@ protected:
massTransferModelTable massTransferModels_; massTransferModelTable massTransferModels_;
// Protected memebers // Protected Member Functions
//- Calculate L between phases //- Calculate L between phases
tmp<volScalarField> calculateL tmp<volScalarField> calculateL
@ -111,7 +111,7 @@ public:
// Constructors // Constructors
//- Construct from fvMesh //- Construct from fvMesh
MassTransferPhaseSystem(const fvMesh&); explicit MassTransferPhaseSystem(const fvMesh&);
//- Destructor //- Destructor

View File

@ -53,6 +53,7 @@ SourceFiles
namespace Foam namespace Foam
{ {
// Forward Declarations
class surfaceTensionModel; class surfaceTensionModel;
class porousModel; class porousModel;
@ -267,7 +268,7 @@ public:
// Energy related thermo functionaliy functions // Energy related thermo functionaliy functions
//- Return access to the inernal energy field [J/Kg] //- Return access to the inernal energy field [J/Kg]
// NOTE: this mixture thermo is prepared to to work with T // \note this mixture thermo is prepared to work with T
virtual volScalarField& he() virtual volScalarField& he()
{ {
NotImplemented; NotImplemented;
@ -275,7 +276,7 @@ public:
} }
//- Return access to the inernal energy field [J/Kg] //- Return access to the inernal energy field [J/Kg]
// NOTE: this mixture thermo is prepared to to work with T // \note this mixture thermo is prepared to work with T
virtual const volScalarField& he() const virtual const volScalarField& he() const
{ {
NotImplemented; NotImplemented;
@ -552,7 +553,7 @@ public:
} }
//- Correct the turbulence //- Correct the turbulence
// (NOTE: Each phase could have its own turbulence) // \note Each phase could have its own turbulence
virtual void correctTurbulence(); virtual void correctTurbulence();
//- Read base phaseProperties dictionary //- Read base phaseProperties dictionary

View File

@ -227,16 +227,8 @@ TSource() const
{ {
const volScalarField& T = mesh_.lookupObject<volScalarField>("T"); const volScalarField& T = mesh_.lookupObject<volScalarField>("T");
tmp<fvScalarMatrix> tTSource auto tTSource = tmp<fvScalarMatrix>::New(T, dimEnergy/dimTime);
( auto& TSource = tTSource.ref();
new fvScalarMatrix
(
T,
dimEnergy/dimTime
)
);
fvScalarMatrix& TSource = tTSource.ref();
const twoPhaseMixtureEThermo& thermo = const twoPhaseMixtureEThermo& thermo =
refCast<const twoPhaseMixtureEThermo> refCast<const twoPhaseMixtureEThermo>

View File

@ -109,6 +109,7 @@ public:
const fvMesh& mesh const fvMesh& mesh
); );
//- Destructor //- Destructor
virtual ~interfaceHeatResistance() = default; virtual ~interfaceHeatResistance() = default;

View File

@ -949,7 +949,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
); );
// alphat is added alphal and multiplied by phase // alphat is added alphal and multiplied by phase
// alphaFilm in the coupled BC. We substract // alphaFilm in the coupled BC. We subtract
// alpha and divide by phase to get a net alphaFilm // alpha and divide by phase to get a net alphaFilm
this->operator[](i) = this->operator[](i) =
( (

View File

@ -3,5 +3,4 @@ kineticGasEvaporation model test case
Still evaporating pool with heat flux from bottom. Still evaporating pool with heat flux from bottom.
The theoretical area-averaged mass flux evaporating is 1.2e-4 Kg/s. The theoretical area-averaged mass flux evaporating is 1.2e-4 Kg/s.
This averaged value is reached approximately at 110 secs This averaged value is reached approximately at 110 secs.

View File

@ -14,7 +14,7 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
convertToMeters 0.25; scale 0.25;
vertices vertices
( (