functionObjects: phaseScalarTransport: Made writing of alpha*s switchable
This commit is contained in:
@ -313,21 +313,7 @@ Foam::functionObjects::phaseScalarTransport::phaseScalarTransport
|
|||||||
),
|
),
|
||||||
mesh_
|
mesh_
|
||||||
),
|
),
|
||||||
alphaS_
|
alphaSPtr_(nullptr),
|
||||||
(
|
|
||||||
IOobject
|
|
||||||
(
|
|
||||||
"alpha"
|
|
||||||
+ word(toupper(fieldName_[0]))
|
|
||||||
+ fieldName_(1, fieldName_.size() - 1),
|
|
||||||
mesh_.time().timeName(),
|
|
||||||
mesh_,
|
|
||||||
IOobject::NO_READ,
|
|
||||||
IOobject::AUTO_WRITE
|
|
||||||
),
|
|
||||||
mesh_,
|
|
||||||
dimensionedScalar(s_.dimensions(), Zero)
|
|
||||||
),
|
|
||||||
PhiPtr_(nullptr)
|
PhiPtr_(nullptr)
|
||||||
{
|
{
|
||||||
if (phaseName_ == word::null)
|
if (phaseName_ == word::null)
|
||||||
@ -383,6 +369,7 @@ bool Foam::functionObjects::phaseScalarTransport::read(const dictionary& dict)
|
|||||||
|
|
||||||
dict.readIfPresent("nCorr", nCorr_);
|
dict.readIfPresent("nCorr", nCorr_);
|
||||||
dict.readIfPresent("residualAlpha", residualAlpha_);
|
dict.readIfPresent("residualAlpha", residualAlpha_);
|
||||||
|
writeAlphaField_ = dict.lookupOrDefault<bool>("writeAlphaField", true);
|
||||||
|
|
||||||
if (dict.found("fvOptions"))
|
if (dict.found("fvOptions"))
|
||||||
{
|
{
|
||||||
@ -479,7 +466,39 @@ bool Foam::functionObjects::phaseScalarTransport::execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Update
|
// Update
|
||||||
alphaS_ = alpha*s_;
|
if (writeAlphaField_)
|
||||||
|
{
|
||||||
|
if (!alphaSPtr_.valid())
|
||||||
|
{
|
||||||
|
alphaSPtr_.set
|
||||||
|
(
|
||||||
|
new volScalarField
|
||||||
|
(
|
||||||
|
IOobject
|
||||||
|
(
|
||||||
|
"alpha"
|
||||||
|
+ word(toupper(fieldName_[0]))
|
||||||
|
+ fieldName_(1, fieldName_.size() - 1),
|
||||||
|
mesh_.time().timeName(),
|
||||||
|
mesh_,
|
||||||
|
IOobject::NO_READ,
|
||||||
|
IOobject::AUTO_WRITE
|
||||||
|
),
|
||||||
|
mesh_,
|
||||||
|
dimensionedScalar(s_.dimensions(), Zero)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
alphaSPtr_() = alpha*s_;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (alphaSPtr_.valid())
|
||||||
|
{
|
||||||
|
alphaSPtr_().clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Info<< endl;
|
Info<< endl;
|
||||||
|
|
||||||
|
|||||||
@ -48,14 +48,16 @@ Description
|
|||||||
|
|
||||||
Usage
|
Usage
|
||||||
\table
|
\table
|
||||||
Property | Description | Req'd? | Default
|
Property | Description | Req'd? | Default
|
||||||
alpha | Name of the volume-fraction field | no \\
|
alpha | Name of the volume-fraction field | no\\
|
||||||
| alpha.<phase-name>
|
| alpha.<phase-name>
|
||||||
alphaPhi | Name of the phase-flux field | no \\
|
alphaPhi | Name of the phase-flux field | no\\
|
||||||
| alphaPhi.<phase-name>
|
| alphaPhi.<phase-name>
|
||||||
p | Name of the pressure field | no | p
|
p | Name of the pressure field | no | p
|
||||||
residualAlpha | Small volume fraction used to stabilise the solution \\
|
residualAlpha | Small volume fraction used to stabilise the solution\\
|
||||||
| no | rootSmall
|
| no | rootSmall
|
||||||
|
writeAlphaField | Also write out alpha multiplied by the field\\
|
||||||
|
| no | true
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Example specification for interFoam:
|
Example specification for interFoam:
|
||||||
@ -158,6 +160,10 @@ class phaseScalarTransport
|
|||||||
//- Name of field whose schemes are used (optional)
|
//- Name of field whose schemes are used (optional)
|
||||||
word schemesField_;
|
word schemesField_;
|
||||||
|
|
||||||
|
//- Flag to indicate whether to write the field multiplied by the phase
|
||||||
|
// fraction
|
||||||
|
bool writeAlphaField_;
|
||||||
|
|
||||||
//- Run-time selectable finite volume options, e.g. sources, constraints
|
//- Run-time selectable finite volume options, e.g. sources, constraints
|
||||||
fv::optionList fvOptions_;
|
fv::optionList fvOptions_;
|
||||||
|
|
||||||
@ -165,7 +171,7 @@ class phaseScalarTransport
|
|||||||
volScalarField s_;
|
volScalarField s_;
|
||||||
|
|
||||||
//- The field multiplied by the phase fraction
|
//- The field multiplied by the phase fraction
|
||||||
volScalarField alphaS_;
|
autoPtr<volScalarField> alphaSPtr_;
|
||||||
|
|
||||||
//- Potential field used to generate the phase flux
|
//- Potential field used to generate the phase flux
|
||||||
autoPtr<volScalarField> PhiPtr_;
|
autoPtr<volScalarField> PhiPtr_;
|
||||||
|
|||||||
Reference in New Issue
Block a user