mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Reacting solvers: Added check for the existence of the inert specie
This commit is contained in:
@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
radiation->correct();
|
radiation->correct();
|
||||||
combustion->correct();
|
combustion->correct();
|
||||||
dQ = combustion->dQ();
|
dQ = combustion->dQ();
|
||||||
label inertIndex = -1;
|
|
||||||
volScalarField Yt(0.0*Y[0]);
|
volScalarField Yt(0.0*Y[0]);
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
if (Y[i].name() != inertSpecie)
|
if (i != inertIndex)
|
||||||
{
|
{
|
||||||
volScalarField& Yi = Y[i];
|
volScalarField& Yi = Y[i];
|
||||||
|
|
||||||
@ -44,10 +43,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
Yi.max(0.0);
|
Yi.max(0.0);
|
||||||
Yt += Yi;
|
Yt += Yi;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inertIndex = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y[inertIndex] = scalar(1) - Yt;
|
Y[inertIndex] = scalar(1) - Yt;
|
||||||
|
|||||||
@ -1,3 +1,4 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
filmModelType& surfaceFilm = tsurfaceFilm();
|
filmModelType& surfaceFilm = tsurfaceFilm();
|
||||||
|
const label inertIndex(composition.species()[inertSpecie]);
|
||||||
|
|||||||
@ -19,6 +19,13 @@ basicMultiComponentMixture& composition = thermo.composition();
|
|||||||
PtrList<volScalarField>& Y = composition.Y();
|
PtrList<volScalarField>& Y = composition.Y();
|
||||||
|
|
||||||
const 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);
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "Creating field rho\n" << endl;
|
Info<< "Creating field rho\n" << endl;
|
||||||
volScalarField rho
|
volScalarField rho
|
||||||
|
|||||||
@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
{
|
{
|
||||||
reaction->correct();
|
reaction->correct();
|
||||||
dQ = reaction->dQ();
|
dQ = reaction->dQ();
|
||||||
label inertIndex = -1;
|
|
||||||
volScalarField Yt(0.0*Y[0]);
|
volScalarField Yt(0.0*Y[0]);
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
if (Y[i].name() != inertSpecie)
|
if (i != inertIndex)
|
||||||
{
|
{
|
||||||
volScalarField& Yi = Y[i];
|
volScalarField& Yi = Y[i];
|
||||||
|
|
||||||
@ -42,10 +41,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
Yi.max(0.0);
|
Yi.max(0.0);
|
||||||
Yt += Yi;
|
Yt += Yi;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inertIndex = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y[inertIndex] = scalar(1) - Yt;
|
Y[inertIndex] = scalar(1) - Yt;
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
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();
|
basicMultiComponentMixture& composition = thermo.composition();
|
||||||
PtrList<volScalarField>& Y = composition.Y();
|
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
|
volScalarField rho
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
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();
|
basicMultiComponentMixture& composition = thermo.composition();
|
||||||
PtrList<volScalarField>& Y = composition.Y();
|
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
|
volScalarField rho
|
||||||
(
|
(
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
const volScalarField& T = thermo.T();
|
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();
|
basicMultiComponentMixture& composition = thermo.composition();
|
||||||
PtrList<volScalarField>& Y = composition.Y();
|
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
|
volScalarField rho
|
||||||
(
|
(
|
||||||
|
|||||||
@ -13,12 +13,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
{
|
{
|
||||||
combustion->correct();
|
combustion->correct();
|
||||||
dQ = combustion->dQ();
|
dQ = combustion->dQ();
|
||||||
label inertIndex = -1;
|
|
||||||
volScalarField Yt(0.0*Y[0]);
|
volScalarField Yt(0.0*Y[0]);
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
if (Y[i].name() != inertSpecie)
|
if (i != inertIndex)
|
||||||
{
|
{
|
||||||
volScalarField& Yi = Y[i];
|
volScalarField& Yi = Y[i];
|
||||||
|
|
||||||
@ -44,10 +43,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
Yi.max(0.0);
|
Yi.max(0.0);
|
||||||
Yt += Yi;
|
Yt += Yi;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inertIndex = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y[inertIndex] = scalar(1) - Yt;
|
Y[inertIndex] = scalar(1) - Yt;
|
||||||
|
|||||||
@ -55,6 +55,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createRDeltaT.H"
|
#include "createRDeltaT.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
|
#include "createFieldRefs.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
#include "initContinuityErrs.H"
|
#include "initContinuityErrs.H"
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
const label inertIndex(composition.species()[inertSpecie]);
|
||||||
@ -16,13 +16,12 @@ basicSpecieMixture& composition = thermo.composition();
|
|||||||
PtrList<volScalarField>& Y = composition.Y();
|
PtrList<volScalarField>& Y = composition.Y();
|
||||||
|
|
||||||
const word inertSpecie(thermo.lookup("inertSpecie"));
|
const word inertSpecie(thermo.lookup("inertSpecie"));
|
||||||
|
if (!composition.species().found(inertSpecie))
|
||||||
if (!composition.contains(inertSpecie))
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalIOErrorIn(args.executable().c_str(), thermo)
|
||||||
<< "Specified inert specie '" << inertSpecie << "' not found in "
|
<< "Inert specie " << inertSpecie << " not found in available species "
|
||||||
<< "species list. Available species:" << composition.species()
|
<< composition.species()
|
||||||
<< exit(FatalError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField& p = thermo.p();
|
volScalarField& p = thermo.p();
|
||||||
|
|||||||
@ -13,12 +13,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
{
|
{
|
||||||
combustion->correct();
|
combustion->correct();
|
||||||
dQ = combustion->dQ();
|
dQ = combustion->dQ();
|
||||||
label inertIndex = -1;
|
|
||||||
volScalarField Yt(0.0*Y[0]);
|
volScalarField Yt(0.0*Y[0]);
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
if (Y[i].name() != inertSpecie)
|
if (i != inertIndex)
|
||||||
{
|
{
|
||||||
volScalarField& Yi = Y[i];
|
volScalarField& Yi = Y[i];
|
||||||
|
|
||||||
@ -45,10 +44,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
Yi.max(0.0);
|
Yi.max(0.0);
|
||||||
Yt += Yi;
|
Yt += Yi;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inertIndex = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y[inertIndex] = scalar(1) - Yt;
|
Y[inertIndex] = scalar(1) - Yt;
|
||||||
|
|||||||
@ -0,0 +1 @@
|
|||||||
|
const label inertIndex(composition.species()[inertSpecie]);
|
||||||
@ -14,6 +14,13 @@ basicSpecieMixture& composition = thermo.composition();
|
|||||||
PtrList<volScalarField>& Y = composition.Y();
|
PtrList<volScalarField>& Y = composition.Y();
|
||||||
|
|
||||||
const 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);
|
||||||
|
}
|
||||||
|
|
||||||
Info<< "Creating field rho\n" << endl;
|
Info<< "Creating field rho\n" << endl;
|
||||||
volScalarField rho
|
volScalarField rho
|
||||||
|
|||||||
@ -52,6 +52,7 @@ int main(int argc, char *argv[])
|
|||||||
#include "createControl.H"
|
#include "createControl.H"
|
||||||
#include "createTimeControls.H"
|
#include "createTimeControls.H"
|
||||||
#include "createFields.H"
|
#include "createFields.H"
|
||||||
|
#include "createFieldRefs.H"
|
||||||
#include "createFvOptions.H"
|
#include "createFvOptions.H"
|
||||||
#include "compressibleCourantNo.H"
|
#include "compressibleCourantNo.H"
|
||||||
#include "setInitialDeltaT.H"
|
#include "setInitialDeltaT.H"
|
||||||
|
|||||||
@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
{
|
{
|
||||||
combustion->correct();
|
combustion->correct();
|
||||||
dQ = combustion->dQ();
|
dQ = combustion->dQ();
|
||||||
label inertIndex = -1;
|
|
||||||
volScalarField Yt(0.0*Y[0]);
|
volScalarField Yt(0.0*Y[0]);
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
if (Y[i].name() != inertSpecie)
|
if (i != inertIndex)
|
||||||
{
|
{
|
||||||
volScalarField& Yi = Y[i];
|
volScalarField& Yi = Y[i];
|
||||||
|
|
||||||
@ -43,10 +42,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
Yi.max(0.0);
|
Yi.max(0.0);
|
||||||
Yt += Yi;
|
Yt += Yi;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inertIndex = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y[inertIndex] = scalar(1) - Yt;
|
Y[inertIndex] = scalar(1) - Yt;
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
const volScalarField& T = thermo.T();
|
const volScalarField& T = thermo.T();
|
||||||
const volScalarField& psi = thermo.psi();
|
const volScalarField& psi = thermo.psi();
|
||||||
|
const label inertIndex(composition.species()[inertSpecie]);
|
||||||
|
|||||||
@ -16,13 +16,12 @@ basicSpecieMixture& composition = thermo.composition();
|
|||||||
PtrList<volScalarField>& Y = composition.Y();
|
PtrList<volScalarField>& Y = composition.Y();
|
||||||
|
|
||||||
const word inertSpecie(thermo.lookup("inertSpecie"));
|
const word inertSpecie(thermo.lookup("inertSpecie"));
|
||||||
|
if (!composition.species().found(inertSpecie))
|
||||||
if (!composition.contains(inertSpecie))
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalIOErrorIn(args.executable().c_str(), thermo)
|
||||||
<< "Specified inert specie '" << inertSpecie << "' not found in "
|
<< "Inert specie " << inertSpecie << " not found in available species "
|
||||||
<< "species list. Available species:" << composition.species()
|
<< composition.species()
|
||||||
<< exit(FatalError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField& p = thermo.p();
|
volScalarField& p = thermo.p();
|
||||||
|
|||||||
@ -12,12 +12,11 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
{
|
{
|
||||||
combustion->correct();
|
combustion->correct();
|
||||||
dQ = combustion->dQ();
|
dQ = combustion->dQ();
|
||||||
label inertIndex = -1;
|
|
||||||
volScalarField Yt(0.0*Y[0]);
|
volScalarField Yt(0.0*Y[0]);
|
||||||
|
|
||||||
forAll(Y, i)
|
forAll(Y, i)
|
||||||
{
|
{
|
||||||
if (Y[i].name() != inertSpecie)
|
if (i != inertIndex)
|
||||||
{
|
{
|
||||||
volScalarField& Yi = Y[i];
|
volScalarField& Yi = Y[i];
|
||||||
|
|
||||||
@ -42,10 +41,6 @@ tmp<fv::convectionScheme<scalar>> mvConvection
|
|||||||
Yi.max(0.0);
|
Yi.max(0.0);
|
||||||
Yt += Yi;
|
Yt += Yi;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
inertIndex = i;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Y[inertIndex] = scalar(1) - Yt;
|
Y[inertIndex] = scalar(1) - Yt;
|
||||||
|
|||||||
@ -16,13 +16,12 @@ basicSpecieMixture& composition = thermo.composition();
|
|||||||
PtrList<volScalarField>& Y = composition.Y();
|
PtrList<volScalarField>& Y = composition.Y();
|
||||||
|
|
||||||
const word inertSpecie(thermo.lookup("inertSpecie"));
|
const word inertSpecie(thermo.lookup("inertSpecie"));
|
||||||
|
if (!composition.species().found(inertSpecie))
|
||||||
if (!composition.contains(inertSpecie))
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalIOErrorIn(args.executable().c_str(), thermo)
|
||||||
<< "Specified inert specie '" << inertSpecie << "' not found in "
|
<< "Inert specie " << inertSpecie << " not found in available species "
|
||||||
<< "species list. Available species:" << composition.species()
|
<< composition.species()
|
||||||
<< exit(FatalError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField& p = thermo.p();
|
volScalarField& p = thermo.p();
|
||||||
|
|||||||
@ -16,13 +16,12 @@ basicSpecieMixture& composition = thermo.composition();
|
|||||||
PtrList<volScalarField>& Y = composition.Y();
|
PtrList<volScalarField>& Y = composition.Y();
|
||||||
|
|
||||||
const word inertSpecie(thermo.lookup("inertSpecie"));
|
const word inertSpecie(thermo.lookup("inertSpecie"));
|
||||||
|
if (!composition.species().found(inertSpecie))
|
||||||
if (!composition.contains(inertSpecie))
|
|
||||||
{
|
{
|
||||||
FatalErrorInFunction
|
FatalIOErrorIn(args.executable().c_str(), thermo)
|
||||||
<< "Specified inert specie '" << inertSpecie << "' not found in "
|
<< "Inert specie " << inertSpecie << " not found in available species "
|
||||||
<< "species list. Available species:" << composition.species()
|
<< composition.species()
|
||||||
<< exit(FatalError);
|
<< exit(FatalIOError);
|
||||||
}
|
}
|
||||||
|
|
||||||
volScalarField& p = thermo.p();
|
volScalarField& p = thermo.p();
|
||||||
|
|||||||
@ -103,6 +103,9 @@ public:
|
|||||||
//- Append an element at the end of the list
|
//- Append an element at the end of the list
|
||||||
void append(const word&);
|
void append(const word&);
|
||||||
|
|
||||||
|
//- Does the list contain the specified name
|
||||||
|
inline bool found(const word&) const;
|
||||||
|
|
||||||
//- Does the list contain the specified name
|
//- Does the list contain the specified name
|
||||||
inline bool contains(const word&) const;
|
inline bool contains(const word&) const;
|
||||||
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
========= |
|
========= |
|
||||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||||
\\ / O peration |
|
\\ / O peration |
|
||||||
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
|
\\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
\\/ M anipulation |
|
\\/ M anipulation |
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
License
|
License
|
||||||
@ -25,6 +25,12 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
inline bool Foam::hashedWordList::found(const word& name) const
|
||||||
|
{
|
||||||
|
return indices_.found(name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool Foam::hashedWordList::contains(const word& name) const
|
inline bool Foam::hashedWordList::contains(const word& name) const
|
||||||
{
|
{
|
||||||
return indices_.found(name);
|
return indices_.found(name);
|
||||||
|
|||||||
Reference in New Issue
Block a user