Commit 15ae2968 authored by Henry Weller's avatar Henry Weller
Browse files

basicMultiComponentMixture: Improved the handling of Ydefault

parent f2c263b9
......@@ -46,48 +46,90 @@ Foam::basicMultiComponentMixture::basicMultiComponentMixture
active_(species_.size(), true),
Y_(species_.size())
{
tmp<volScalarField> tYdefault;
forAll(species_, i)
{
word YdefaultName(IOobject::groupName("Ydefault", phaseName));
volScalarField Ydefault
IOobject header
(
IOobject
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
(
YdefaultName,
exists(mesh.time().path()/mesh.time().timeName()/YdefaultName)
? mesh.time().timeName()
: (
exists
i,
new volScalarField
(
IOobject
(
mesh.time().path()/mesh.time().constant()/YdefaultName
)
? mesh.time().constant()
: Time::timeName(0)
),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
mesh
);
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));
Y_.set
(
i,
new volScalarField
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
(
IOobject
i,
new volScalarField
(
IOobject::groupName(species_[i], phaseName),
mesh.time().timeName(),
mesh,
IOobject::READ_IF_PRESENT,
IOobject::AUTO_WRITE
),
Ydefault
)
);
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
......
......@@ -11,7 +11,7 @@ FoamFile
format ascii;
class volScalarField;
location "0";
object Ydefault;
object Ydefault.gas;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment