Commit 26a3e56c authored by Henry Weller's avatar Henry Weller
Browse files

Reacting solvers: Added check for the existence of the inert specie

parent 36adf970
......@@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
radiation->correct();
combustion->correct();
dQ = combustion->dQ();
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
if (i != inertIndex)
{
volScalarField& Yi = Y[i];
......@@ -44,10 +43,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
......
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
filmModelType& surfaceFilm = tsurfaceFilm();
const label inertIndex(composition.species()[inertSpecie]);
......@@ -19,6 +19,13 @@ basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.species().found(inertSpecie))
{
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
}
Info<< "Creating field rho\n" << endl;
volScalarField rho
......
......@@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
{
reaction->correct();
dQ = reaction->dQ();
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
if (i != inertIndex)
{
volScalarField& Yi = Y[i];
......@@ -42,10 +41,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
......
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
const label inertIndex(composition.species()[inertSpecie]);
......@@ -11,7 +11,14 @@ thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.species().found(inertSpecie))
{
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
}
volScalarField rho
(
......
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
const label inertIndex(composition.species()[inertSpecie]);
......@@ -11,7 +11,14 @@ thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.species().found(inertSpecie))
{
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
}
volScalarField rho
(
......
const volScalarField& psi = thermo.psi();
const volScalarField& T = thermo.T();
const label inertIndex(composition.species()[inertSpecie]);
......@@ -11,7 +11,14 @@ thermo.validate(args.executable(), "h", "e");
basicMultiComponentMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
word inertSpecie(thermo.lookup("inertSpecie"));
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.species().found(inertSpecie))
{
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
}
volScalarField rho
(
......
......@@ -13,12 +13,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
{
combustion->correct();
dQ = combustion->dQ();
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
if (i != inertIndex)
{
volScalarField& Yi = Y[i];
......@@ -44,10 +43,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
......
......@@ -55,6 +55,7 @@ int main(int argc, char *argv[])
#include "createTimeControls.H"
#include "createRDeltaT.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createFvOptions.H"
#include "initContinuityErrs.H"
......
const label inertIndex(composition.species()[inertSpecie]);
......@@ -16,13 +16,12 @@ basicSpecieMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.contains(inertSpecie))
if (!composition.species().found(inertSpecie))
{
FatalErrorInFunction
<< "Specified inert specie '" << inertSpecie << "' not found in "
<< "species list. Available species:" << composition.species()
<< exit(FatalError);
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
}
volScalarField& p = thermo.p();
......
......@@ -13,12 +13,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
{
combustion->correct();
dQ = combustion->dQ();
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
if (i != inertIndex)
{
volScalarField& Yi = Y[i];
......@@ -45,10 +44,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
......
const label inertIndex(composition.species()[inertSpecie]);
......@@ -14,6 +14,13 @@ basicSpecieMixture& composition = thermo.composition();
PtrList<volScalarField>& Y = composition.Y();
const word inertSpecie(thermo.lookup("inertSpecie"));
if (!composition.species().found(inertSpecie))
{
FatalIOErrorIn(args.executable().c_str(), thermo)
<< "Inert specie " << inertSpecie << " not found in available species "
<< composition.species()
<< exit(FatalIOError);
}
Info<< "Creating field rho\n" << endl;
volScalarField rho
......
......@@ -52,6 +52,7 @@ int main(int argc, char *argv[])
#include "createControl.H"
#include "createTimeControls.H"
#include "createFields.H"
#include "createFieldRefs.H"
#include "createFvOptions.H"
#include "compressibleCourantNo.H"
#include "setInitialDeltaT.H"
......
......@@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
{
combustion->correct();
dQ = combustion->dQ();
label inertIndex = -1;
volScalarField Yt(0.0*Y[0]);
forAll(Y, i)
{
if (Y[i].name() != inertSpecie)
if (i != inertIndex)
{
volScalarField& Yi = Y[i];
......@@ -43,10 +42,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
Yi.max(0.0);
Yt += Yi;
}
else
{
inertIndex = i;
}
}
Y[inertIndex] = scalar(1) - Yt;
......
const volScalarField& T = thermo.T();
const volScalarField& psi = thermo.psi();
const label inertIndex(composition.species()[inertSpecie]);
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