basicMultiComponentMixture: Improved the handling of Ydefault
This commit is contained in:
@ -46,21 +46,61 @@ Foam::basicMultiComponentMixture::basicMultiComponentMixture
|
||||
active_(species_.size(), true),
|
||||
Y_(species_.size())
|
||||
{
|
||||
tmp<volScalarField> tYdefault;
|
||||
|
||||
forAll(species_, i)
|
||||
{
|
||||
IOobject header
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::NO_READ
|
||||
);
|
||||
|
||||
// Check if field exists and can be read
|
||||
if (header.headerOk())
|
||||
{
|
||||
Y_.set
|
||||
(
|
||||
i,
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
mesh
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Read Ydefault if not already read
|
||||
if (!tYdefault.valid())
|
||||
{
|
||||
word YdefaultName(IOobject::groupName("Ydefault", phaseName));
|
||||
|
||||
volScalarField Ydefault
|
||||
tYdefault = new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
YdefaultName,
|
||||
exists(mesh.time().path()/mesh.time().timeName()/YdefaultName)
|
||||
exists
|
||||
(
|
||||
mesh.time().path()/mesh.time().timeName()
|
||||
/YdefaultName
|
||||
)
|
||||
? mesh.time().timeName()
|
||||
: (
|
||||
exists
|
||||
(
|
||||
mesh.time().path()/mesh.time().constant()/YdefaultName
|
||||
mesh.time().path()/mesh.time().constant()
|
||||
/YdefaultName
|
||||
)
|
||||
? mesh.time().constant()
|
||||
: Time::timeName(0)
|
||||
@ -71,6 +111,7 @@ Foam::basicMultiComponentMixture::basicMultiComponentMixture
|
||||
),
|
||||
mesh
|
||||
);
|
||||
}
|
||||
|
||||
Y_.set
|
||||
(
|
||||
@ -82,13 +123,14 @@ Foam::basicMultiComponentMixture::basicMultiComponentMixture
|
||||
IOobject::groupName(species_[i], phaseName),
|
||||
mesh.time().timeName(),
|
||||
mesh,
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::NO_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
Ydefault
|
||||
tYdefault()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Do not enforce constraint of sum of mass fractions to equal 1 here
|
||||
// - not applicable to all models
|
||||
|
||||
@ -11,7 +11,7 @@ FoamFile
|
||||
format ascii;
|
||||
class volScalarField;
|
||||
location "0";
|
||||
object Ydefault;
|
||||
object Ydefault.gas;
|
||||
}
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Reference in New Issue
Block a user