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