alphatWallBoilingWallFunction: Added missing mapping and cloning functionality

This commit is contained in:
Will Bainbridge
2020-06-26 12:00:52 +01:00
parent 393d8e17fd
commit 4d0661ccd0
32 changed files with 376 additions and 96 deletions

View File

@ -205,6 +205,34 @@ dmdtLf(const phasePairKey& phasePair) const
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
alphatPhaseJayatillekeWallFunctionFvPatchScalarField::autoMap(m);
m(dmdtf_, dmdtf_);
m(dmdtLf_, dmdtLf_);
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
alphatPhaseJayatillekeWallFunctionFvPatchScalarField::rmap(ptf, addr);
const alphatPhaseChangeWallFunctionFvPatchScalarField& tiptf =
refCast<const alphatPhaseChangeWallFunctionFvPatchScalarField>(ptf);
dmdtf_.rmap(tiptf.dmdtf_, addr);
dmdtLf_.rmap(tiptf.dmdtLf_, addr);
}
void alphatPhaseChangeWallFunctionFvPatchScalarField::write(Ostream& os) const
{
alphatPhaseJayatillekeWallFunctionFvPatchScalarField::write(os);

View File

@ -123,7 +123,6 @@ public:
// Member Functions
//- Is there phase change mass transfer for this phasePair
bool activePhasePair(const phasePairKey&) const;
@ -140,6 +139,17 @@ public:
const scalarField& dmdtLf(const phasePairKey&) const;
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
// Used to update fields following mesh topology change
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
// Used to reconstruct fields
virtual void rmap(const fvPatchScalarField&, const labelList&);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -208,14 +208,14 @@ alphatWallBoilingWallFunctionFvPatchScalarField
mapper
),
phaseType_(psf.phaseType_),
AbyV_(psf.AbyV_),
AbyV_(mapper(psf.AbyV_)),
alphatConv_(mapper(psf.alphatConv_)),
dDep_(mapper(psf.dDep_)),
qq_(mapper(psf.qq_)),
partitioningModel_(psf.partitioningModel_),
nucleationSiteModel_(psf.nucleationSiteModel_),
departureDiamModel_(psf.departureDiamModel_),
departureFreqModel_(psf.departureFreqModel_)
partitioningModel_(psf.partitioningModel_, false),
nucleationSiteModel_(psf.nucleationSiteModel_, false),
departureDiamModel_(psf.departureDiamModel_, false),
departureFreqModel_(psf.departureFreqModel_, false)
{}
@ -231,10 +231,10 @@ alphatWallBoilingWallFunctionFvPatchScalarField
alphatConv_(psf.alphatConv_),
dDep_(psf.dDep_),
qq_(psf.qq_),
partitioningModel_(psf.partitioningModel_),
nucleationSiteModel_(psf.nucleationSiteModel_),
departureDiamModel_(psf.departureDiamModel_),
departureFreqModel_(psf.departureFreqModel_)
partitioningModel_(psf.partitioningModel_, false),
nucleationSiteModel_(psf.nucleationSiteModel_, false),
departureDiamModel_(psf.departureDiamModel_, false),
departureFreqModel_(psf.departureFreqModel_, false)
{}
@ -251,15 +251,47 @@ alphatWallBoilingWallFunctionFvPatchScalarField
alphatConv_(psf.alphatConv_),
dDep_(psf.dDep_),
qq_(psf.qq_),
partitioningModel_(psf.partitioningModel_),
nucleationSiteModel_(psf.nucleationSiteModel_),
departureDiamModel_(psf.departureDiamModel_),
departureFreqModel_(psf.departureFreqModel_)
partitioningModel_(psf.partitioningModel_, false),
nucleationSiteModel_(psf.nucleationSiteModel_, false),
departureDiamModel_(psf.departureDiamModel_, false),
departureFreqModel_(psf.departureFreqModel_, false)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
void alphatWallBoilingWallFunctionFvPatchScalarField::autoMap
(
const fvPatchFieldMapper& m
)
{
alphatPhaseChangeWallFunctionFvPatchScalarField::autoMap(m);
m(AbyV_, AbyV_);
m(alphatConv_, alphatConv_);
m(dDep_, dDep_);
m(qq_, qq_);
}
void alphatWallBoilingWallFunctionFvPatchScalarField::rmap
(
const fvPatchScalarField& ptf,
const labelList& addr
)
{
alphatPhaseChangeWallFunctionFvPatchScalarField::rmap(ptf, addr);
const alphatWallBoilingWallFunctionFvPatchScalarField& tiptf =
refCast<const alphatWallBoilingWallFunctionFvPatchScalarField>(ptf);
AbyV_.rmap(tiptf.AbyV_, addr);
alphatConv_.rmap(tiptf.alphatConv_, addr);
dDep_.rmap(tiptf.dDep_, addr);
qq_.rmap(tiptf.qq_, addr);
}
void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
{
if (updated())
@ -267,14 +299,6 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
return;
}
// Check that partitioningModel has been constructed
if (!partitioningModel_.valid())
{
FatalErrorInFunction
<< "partitioningModel has not been constructed!"
<< abort(FatalError);
}
// Lookup the fluid model
const phaseSystem& fluid =
db().lookupObject<phaseSystem>("phaseProperties");
@ -287,20 +311,15 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
{
case vaporPhase:
{
const phaseModel& vapor
(
fluid.phases()[internalField().group()]
);
const phaseModel& vapor = fluid.phases()[internalField().group()];
// Vapor Liquid phase fraction at the wall
const scalarField vaporw(vapor.boundaryField()[patchi]);
// Vapor phase fraction at the wall
const scalarField& vaporw = vapor.boundaryField()[patchi];
// Partitioning
// NOTE! Assumes 1-thisPhase for liquid fraction in
// multiphase simulations
const scalarField fLiquid
(
partitioningModel_->fLiquid(1-vaporw)
);
const scalarField fLiquid(partitioningModel_->fLiquid(1 - vaporw));
operator==
(
@ -310,47 +329,16 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
}
case liquidPhase:
{
const phaseModel& liquid = fluid.phases()[internalField().group()];
const phaseModel& vapor = fluid.phases()[otherPhaseName_];
// Check that nucleationSiteModel has been constructed
if (!nucleationSiteModel_.valid())
{
FatalErrorInFunction
<< "nucleationSiteModel has not been constructed!"
<< abort(FatalError);
}
// Check that departureDiameterModel has been constructed
if (!departureDiamModel_.valid())
{
FatalErrorInFunction
<< "departureDiameterModel has not been constructed!"
<< abort(FatalError);
}
// Check that nucleationSiteModel has been constructed
if (!departureFreqModel_.valid())
{
FatalErrorInFunction
<< "departureFrequencyModel has not been constructed!"
<< abort(FatalError);
}
const phaseModel& liquid
(
fluid.phases()[internalField().group()]
);
const phaseModel& vapor(fluid.phases()[otherPhaseName_]);
const phasePair pair(vapor, liquid);
if
(
db().foundObject<saturationModel>
(
IOobject::groupName
(
"saturationModel",
phasePair(vapor,liquid).name()
)
IOobject::groupName("saturationModel", pair.name())
)
)
{
@ -387,8 +375,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
const rhoThermo& lThermo = liquid.thermo();
const rhoThermo& vThermo = vapor.thermo();
const tmp<scalarField> talphaw = lThermo.alpha(patchi);
const scalarField& alphaw = talphaw();
const scalarField& alphaw = lThermo.alpha(patchi);
const tmp<volScalarField> tk = turbModel.k();
const volScalarField& k = tk();
@ -405,6 +392,12 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
const fvPatchScalarField& rhoVaporw =
vaporTurbModel.rho().boundaryField()[patchi];
const fvPatchScalarField& hew =
lThermo.he().boundaryField()[patchi];
const fvPatchScalarField& pw =
lThermo.p().boundaryField()[patchi];
const fvPatchScalarField& Tw =
lThermo.T().boundaryField()[patchi];
@ -430,26 +423,13 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
const saturationModel& satModel =
db().lookupObject<saturationModel>
(
IOobject::groupName
(
"saturationModel",
phasePair(vapor,liquid).name()
)
IOobject::groupName("saturationModel", pair.name())
);
const tmp<volScalarField> tTsat =
satModel.Tsat(lThermo.p());
const tmp<volScalarField> tTsat = satModel.Tsat(lThermo.p());
const volScalarField& Tsat = tTsat();
const fvPatchScalarField& Tsatw(Tsat.boundaryField()[patchi]);
const scalarField Tsatc(Tsatw.patchInternalField());
const fvPatchScalarField& pw =
lThermo.p().boundaryField()[patchi];
const fvPatchScalarField& hew =
lThermo.he().boundaryField()[patchi];
// Latent heat
scalarField liquidHaw(lThermo.ha(Tc, patchi));
scalarField vaporHaw(vThermo.ha(Tsatw, patchi));
@ -487,6 +467,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
// Liquid phase fraction at the wall
const scalarField liquidw(liquid.boundaryField()[patchi]);
// Partitioning
const scalarField fLiquid(partitioningModel_->fLiquid(liquidw));
// Convective thermal diffusivity
@ -569,7 +550,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
const scalarField Al
(
fLiquid*4.8*exp( min(-Ja/80, log(vGreat)))
fLiquid*4.8*exp(min(-Ja/80, log(vGreat)))
);
scalarField A2(min(pi*sqr(dDep_)*N*Al/4, scalar(1)));
@ -694,8 +675,7 @@ void alphatWallBoilingWallFunctionFvPatchScalarField::updateCoeffs()
}
else
{
Info<< "Saturation model for phase pair "
<< phasePair(vapor,liquid).name()
Info<< "Saturation model for phase pair " << pair.name()
<< " not found. Wall boiling disabled." << endl;
operator== (alphatConv_);

View File

@ -295,6 +295,17 @@ public:
}
// Mapping functions
//- Map (and resize as needed) from self given a mapping object
// Used to update fields following mesh topology change
virtual void autoMap(const fvPatchFieldMapper&);
//- Reverse map the given fvPatchField onto this fvPatchField
// Used to reconstruct fields
virtual void rmap(const fvPatchScalarField&, const labelList&);
// Evaluation functions
//- Update the coefficients associated with the patch field

View File

@ -64,6 +64,18 @@ KocamustafaogullariIshiiDepartureDiameter
{}
Foam::wallBoilingModels::departureDiameterModels::
KocamustafaogullariIshiiDepartureDiameter::
KocamustafaogullariIshiiDepartureDiameter
(
const KocamustafaogullariIshiiDepartureDiameter& model
)
:
departureDiameterModel(),
phi_(model.phi_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureDiameterModels::

View File

@ -80,6 +80,21 @@ public:
//- Construct from a dictionary
KocamustafaogullariIshiiDepartureDiameter(const dictionary& dict);
//- Copy construct
KocamustafaogullariIshiiDepartureDiameter
(
const KocamustafaogullariIshiiDepartureDiameter& model
);
//- Construct and return a clone
virtual autoPtr<departureDiameterModel> clone() const
{
return autoPtr<departureDiameterModel>
(
new KocamustafaogullariIshiiDepartureDiameter(*this)
);
}
//- Destructor
virtual ~KocamustafaogullariIshiiDepartureDiameter();

View File

@ -61,6 +61,19 @@ TolubinskiKostanchuk::TolubinskiKostanchuk
{}
Foam::wallBoilingModels::departureDiameterModels::
TolubinskiKostanchuk::TolubinskiKostanchuk
(
const TolubinskiKostanchuk& model
)
:
departureDiameterModel(),
dRef_(model.dRef_),
dMax_(model.dMax_),
dMin_(model.dMin_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureDiameterModels::

View File

@ -85,6 +85,18 @@ public:
//- Construct from a dictionary
TolubinskiKostanchuk(const dictionary& dict);
//- Copy construct
TolubinskiKostanchuk(const TolubinskiKostanchuk& model);
//- Construct and return a clone
virtual autoPtr<departureDiameterModel> clone() const
{
return autoPtr<departureDiameterModel>
(
new TolubinskiKostanchuk(*this)
);
}
//- Destructor
virtual ~TolubinskiKostanchuk();

View File

@ -43,6 +43,13 @@ Foam::wallBoilingModels::departureDiameterModel::departureDiameterModel()
{}
Foam::wallBoilingModels::departureDiameterModel::departureDiameterModel
(
const departureDiameterModel&
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureDiameterModel::~departureDiameterModel()

View File

@ -79,8 +79,11 @@ public:
//- Construct null
departureDiameterModel();
//- Disallow default bitwise copy construction
departureDiameterModel(const departureDiameterModel&) = delete;
//- Copy constructor
departureDiameterModel(const departureDiameterModel&);
//- Construct and return a clone
virtual autoPtr<departureDiameterModel> clone() const = 0;
// Selectors

View File

@ -58,6 +58,13 @@ Cole::Cole(const dictionary& dict)
{}
Foam::wallBoilingModels::departureFrequencyModels::
Cole::Cole(const Cole& model)
:
departureFrequencyModel(model)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureFrequencyModels::

View File

@ -73,6 +73,15 @@ public:
//- Construct from a dictionary
Cole(const dictionary& dict);
//- Copy construct
Cole(const Cole& model);
//- Construct and return a clone
virtual autoPtr<departureFrequencyModel> clone() const
{
return autoPtr<departureFrequencyModel>(new Cole(*this));
}
//- Destructor
virtual ~Cole();

View File

@ -61,6 +61,18 @@ KocamustafaogullariIshiiDepartureFrequency(const dictionary& dict)
{}
Foam::wallBoilingModels::departureFrequencyModels::
KocamustafaogullariIshiiDepartureFrequency::
KocamustafaogullariIshiiDepartureFrequency
(
const KocamustafaogullariIshiiDepartureFrequency& model
)
:
departureFrequencyModel(model),
Cf_(model.Cf_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureFrequencyModels::

View File

@ -80,6 +80,21 @@ public:
//- Construct from a dictionary
KocamustafaogullariIshiiDepartureFrequency(const dictionary& dict);
//- Copy construct
KocamustafaogullariIshiiDepartureFrequency
(
const KocamustafaogullariIshiiDepartureFrequency& model
);
//- Construct and return a clone
virtual autoPtr<departureFrequencyModel> clone() const
{
return autoPtr<departureFrequencyModel>
(
new KocamustafaogullariIshiiDepartureFrequency(*this)
);
}
//- Destructor
virtual ~KocamustafaogullariIshiiDepartureFrequency();

View File

@ -43,6 +43,13 @@ Foam::wallBoilingModels::departureFrequencyModel::departureFrequencyModel()
{}
Foam::wallBoilingModels::departureFrequencyModel::departureFrequencyModel
(
const departureFrequencyModel& model
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::departureFrequencyModel::~departureFrequencyModel()

View File

@ -79,8 +79,11 @@ public:
//- Construct null
departureFrequencyModel();
//- Disallow default bitwise copy construction
departureFrequencyModel(const departureFrequencyModel&) = delete;
//- Copy construct
departureFrequencyModel(const departureFrequencyModel& model);
//- Construct and return a clone
virtual autoPtr<departureFrequencyModel> clone() const = 0;
// Selectors

View File

@ -60,6 +60,17 @@ KocamustafaogullariIshiiNucleationSite::KocamustafaogullariIshiiNucleationSite
{}
Foam::wallBoilingModels::nucleationSiteModels::
KocamustafaogullariIshiiNucleationSite::KocamustafaogullariIshiiNucleationSite
(
const KocamustafaogullariIshiiNucleationSite& model
)
:
nucleationSiteModel(),
Cn_(model.Cn_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::nucleationSiteModels::

View File

@ -78,6 +78,21 @@ public:
//- Construct from a dictionary
KocamustafaogullariIshiiNucleationSite(const dictionary& dict);
//- Copy construct
KocamustafaogullariIshiiNucleationSite
(
const KocamustafaogullariIshiiNucleationSite& model
);
//- Construct and return a clone
virtual autoPtr<nucleationSiteModel> clone() const
{
return autoPtr<nucleationSiteModel>
(
new KocamustafaogullariIshiiNucleationSite(*this)
);
}
//- Destructor
virtual ~KocamustafaogullariIshiiNucleationSite();

View File

@ -60,6 +60,18 @@ Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::LemmertChawla
{}
Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::LemmertChawla
(
const LemmertChawla& model
)
:
nucleationSiteModel(),
Cn_(model.Cn_),
NRef_(model.NRef_),
deltaTRef_(model.deltaTRef_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::nucleationSiteModels::LemmertChawla::~LemmertChawla()

View File

@ -89,6 +89,15 @@ public:
//- Construct from a dictionary
LemmertChawla(const dictionary& dict);
//- Copy construct
LemmertChawla(const LemmertChawla& model);
//- Construct and return a clone
virtual autoPtr<nucleationSiteModel> clone() const
{
return autoPtr<nucleationSiteModel>(new LemmertChawla(*this));
}
//- Destructor
virtual ~LemmertChawla();

View File

@ -43,6 +43,13 @@ Foam::wallBoilingModels::nucleationSiteModel::nucleationSiteModel()
{}
Foam::wallBoilingModels::nucleationSiteModel::nucleationSiteModel
(
const nucleationSiteModel& model
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::nucleationSiteModel::~nucleationSiteModel()

View File

@ -79,8 +79,11 @@ public:
//- Construct null
nucleationSiteModel();
//- Disallow default bitwise copy construction
nucleationSiteModel(const nucleationSiteModel&) = delete;
//- Copy construct
nucleationSiteModel(const nucleationSiteModel& model);
//- Construct and return a clone
virtual autoPtr<nucleationSiteModel> clone() const = 0;
// Selectors

View File

@ -56,6 +56,14 @@ Lavieville::Lavieville(const dictionary& dict)
{}
Foam::wallBoilingModels::partitioningModels::
Lavieville::Lavieville(const Lavieville& model)
:
partitioningModel(model),
alphaCrit_(model.alphaCrit_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::partitioningModels::

View File

@ -82,6 +82,15 @@ public:
//- Construct from a dictionary
Lavieville(const dictionary& dict);
//- Copy construct
Lavieville(const Lavieville& model);
//- Construct and return a clone
virtual autoPtr<partitioningModel> clone() const
{
return autoPtr<partitioningModel>(new Lavieville(*this));
}
//- Destructor
virtual ~Lavieville();

View File

@ -57,6 +57,15 @@ cosine::cosine(const dictionary& dict)
{}
Foam::wallBoilingModels::partitioningModels::
cosine::cosine(const cosine& model)
:
partitioningModel(model),
alphaLiquid1_(model.alphaLiquid1_),
alphaLiquid0_(model.alphaLiquid0_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::partitioningModels::

View File

@ -84,6 +84,15 @@ public:
//- Construct from a dictionary
cosine(const dictionary& dict);
//- Copy construct
cosine(const cosine& model);
//- Construct and return a clone
virtual autoPtr<partitioningModel> clone() const
{
return autoPtr<partitioningModel>(new cosine(*this));
}
//- Destructor
virtual ~cosine();

View File

@ -57,6 +57,15 @@ linear::linear(const dictionary& dict)
{}
Foam::wallBoilingModels::partitioningModels::
linear::linear(const linear& model)
:
partitioningModel(model),
alphaLiquid1_(model.alphaLiquid1_),
alphaLiquid0_(model.alphaLiquid0_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::partitioningModels::

View File

@ -85,6 +85,15 @@ public:
//- Construct from a dictionary
linear(const dictionary& dict);
//- Copy construct
linear(const linear& model);
//- Construct and return a clone
virtual autoPtr<partitioningModel> clone() const
{
return autoPtr<partitioningModel>(new linear(*this));
}
//- Destructor
virtual ~linear();

View File

@ -43,6 +43,13 @@ Foam::wallBoilingModels::partitioningModel::partitioningModel()
{}
Foam::wallBoilingModels::partitioningModel::partitioningModel
(
const partitioningModel& model
)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::partitioningModel::~partitioningModel()

View File

@ -77,8 +77,11 @@ public:
//- Construct null
partitioningModel();
//- Disallow default bitwise copy construction
partitioningModel(const partitioningModel&) = delete;
//- Copy construct
partitioningModel(const partitioningModel&);
//- Construct and return a clone
virtual autoPtr<partitioningModel> clone() const = 0;
// Selectors

View File

@ -55,6 +55,13 @@ phaseFraction::phaseFraction(const dictionary& dict)
{}
Foam::wallBoilingModels::partitioningModels::
phaseFraction::phaseFraction(const phaseFraction& model)
:
partitioningModel(model)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::wallBoilingModels::partitioningModels::

View File

@ -66,6 +66,15 @@ public:
//- Construct from a dictionary
phaseFraction(const dictionary& dict);
//- Copy construct
phaseFraction(const phaseFraction& model);
//- Construct and return a clone
virtual autoPtr<partitioningModel> clone() const
{
return autoPtr<partitioningModel>(new phaseFraction(*this));
}
//- Destructor
virtual ~phaseFraction();