Bugfix: Moved case insensitive directory name clash

This commit is contained in:
Hrvoje Jasak 2016-01-05 14:09:09 +00:00
parent c6b8528c19
commit f42425370d
11 changed files with 1 additions and 1696 deletions

View file

@ -184,36 +184,6 @@ void Foam::isentropicTotalPressureFvPatchScalarField::updateCoeffs
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::snGrad() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::gradientInternalCoeffs() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
Foam::tmp<Foam::scalarField>
Foam::isentropicTotalPressureFvPatchScalarField::gradientBoundaryCoeffs() const
{
return tmp<scalarField>
(
new scalarField(this->size(), 0.0)
);
}
void Foam::isentropicTotalPressureFvPatchScalarField::write
(
Ostream& os

View file

@ -25,8 +25,7 @@ Class
Foam::isentropicTotalPressureFvPatchScalarField
Description
Isentropic total pressure boundary condition. The snGrad is set to
zero to stop back-diffusion
Foam::isentropicTotalPressureFvPatchScalarField
SourceFiles
isentropicTotalPressureFvPatchScalarField.C
@ -135,19 +134,6 @@ public:
// Access
//- Return the name of the velocity field
const word& UName() const
{
return UName_;
}
//- Return reference to the name of the velocity field
// to allow adjustment
word& UName()
{
return UName_;
}
//- Return the total pressure
const scalarField& p0() const
{
@ -186,18 +172,6 @@ public:
//- Update the coefficients associated with the patch field
virtual void updateCoeffs();
//- Return patch-normal gradient: set to zero
virtual tmp<scalarField> snGrad() const;
//- Return the matrix diagonal coefficients corresponding to the
// evaluation of the gradient of this patchField
// Removed gradient contribution
virtual tmp<scalarField> gradientInternalCoeffs() const;
//- Return the matrix source coefficients corresponding to the
// evaluation of the gradient of this patchField
virtual tmp<scalarField> gradientBoundaryCoeffs() const;
//- Write
virtual void write(Ostream&) const;

View file

@ -1,106 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "IrreversibleReaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class ReactionThermo, class ReactionRate>
IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionRate& k
)
:
Reaction<ReactionThermo>(reaction),
k_(k)
{}
// Construct from components
template<class ReactionThermo, class ReactionRate>
IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
k_(species, is)
{}
// Construct as copy given new speciesTable
template<class ReactionThermo, class ReactionRate>
IrreversibleReaction<ReactionThermo, ReactionRate>::IrreversibleReaction
(
const IrreversibleReaction<ReactionThermo, ReactionRate>& irr,
const speciesTable& species
)
:
Reaction<ReactionThermo>(irr, species),
k_(irr.k_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
scalar IrreversibleReaction<ReactionThermo, ReactionRate>::kf
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return k_(T, p, c);
}
template<class ReactionThermo, class ReactionRate>
void IrreversibleReaction<ReactionThermo, ReactionRate>::write
(
Ostream& os
) const
{
Reaction<ReactionThermo>::write(os);
os << token::SPACE << k_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,163 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::IrreversibleReaction
Description
Simple extension of Reaction to handle reversible reactions using
equilibrium thermodynamics.
SourceFiles
IrreversibleReaction.C
\*---------------------------------------------------------------------------*/
#ifndef IrreversibleReaction_H
#define IrreversibleReaction_H
#include "Reaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class IrreversibleReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo, class ReactionRate>
class IrreversibleReaction
:
public Reaction<ReactionThermo>
{
// Private data
ReactionRate k_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=
(
const IrreversibleReaction<ReactionThermo, ReactionRate>&
);
public:
//- Runtime type information
TypeName("irreversible");
// Constructors
//- Construct from components
IrreversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionRate& reactionRate
);
//- Construct as copy given new speciesTable
IrreversibleReaction
(
const IrreversibleReaction<ReactionThermo, ReactionRate>&,
const speciesTable& species
);
//- Construct from Istream
IrreversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
(
new IrreversibleReaction<ReactionThermo, ReactionRate>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
(
new IrreversibleReaction<ReactionThermo, ReactionRate>
(
*this,
species
)
);
}
// Destructor
virtual ~IrreversibleReaction()
{}
// Member Functions
// IrreversibleReaction rate coefficients
//- Forward rate constant
virtual scalar kf
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "IrreversibleReaction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,137 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "NonEquilibriumReversibleReaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class ReactionThermo, class ReactionRate>
NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
NonEquilibriumReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionRate& forwardReactionRate,
const ReactionRate& reverseReactionRate
)
:
Reaction<ReactionThermo>(reaction),
fk_(forwardReactionRate),
rk_(reverseReactionRate)
{}
// Construct from components
template<class ReactionThermo, class ReactionRate>
NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
NonEquilibriumReversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
fk_(species, is),
rk_(species, is)
{}
// Construct as copy given new speciesTable
template<class ReactionThermo, class ReactionRate>
NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::
NonEquilibriumReversibleReaction
(
const NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>& nerr,
const speciesTable& species
)
:
Reaction<ReactionThermo>(nerr, species),
fk_(nerr.fk_),
rk_(nerr.rk_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
scalar NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kf
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return fk_(T, p, c);
}
template<class ReactionThermo, class ReactionRate>
scalar NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
(
const scalar,
const scalar T,
const scalar p,
const scalarField& c
) const
{
return rk_(T, p, c);
}
template<class ReactionThermo, class ReactionRate>
scalar NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::kr
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return rk_(T, p, c);
}
template<class ReactionThermo, class ReactionRate>
void NonEquilibriumReversibleReaction<ReactionThermo, ReactionRate>::write
(
Ostream& os
) const
{
Reaction<ReactionThermo>::write(os);
os << token::SPACE << fk_ << token::SPACE << rk_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,185 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::NonEquilibriumReversibleReaction
Description
Simple extension of Reaction to handle reversible reactions using
equilibrium thermodynamics.
SourceFiles
NonEquilibriumReversibleReaction.C
\*---------------------------------------------------------------------------*/
#ifndef NonEquilibriumReversibleReaction_H
#define NonEquilibriumReversibleReaction_H
#include "Reaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class NonEquilibriumReversibleReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo, class ReactionRate>
class NonEquilibriumReversibleReaction
:
public Reaction<ReactionThermo>
{
// Private data
ReactionRate fk_;
ReactionRate rk_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=
(
const NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>&
);
public:
//- Runtime type information
TypeName("nonEquilibriumReversible");
// Constructors
//- Construct from components
NonEquilibriumReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionRate& forwardReactionRate,
const ReactionRate& reverseReactionRate
);
//- Construct as copy given new speciesTable
NonEquilibriumReversibleReaction
(
const NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>&,
const speciesTable& species
);
//- Construct from Istream
NonEquilibriumReversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
(
new NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
(
new NonEquilibriumReversibleReaction
<ReactionThermo, ReactionRate>
(*this, species)
);
}
// Destructor
virtual ~NonEquilibriumReversibleReaction()
{}
// Member Functions
// NonEquilibriumReversibleReaction rate coefficients
//- Forward rate constant
virtual scalar kf
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Reverse rate constant from the given formard rate constant
virtual scalar kr
(
const scalar kfwd,
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Reverse rate constant.
// Note this evaluates the forward rate constant and divides by the
// equilibrium constant
virtual scalar kr
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "NonEquilibriumReversibleReaction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,356 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
Simple extension of ReactionThermo to handle Reaction kinetics in addition
to the equilibrium thermodynamics already handled.
\*---------------------------------------------------------------------------*/
#include "Reaction.H"
#include "DynamicList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class ReactionThermo>
void Reaction<ReactionThermo>::setThermo
(
const HashPtrTable<ReactionThermo>& thermoDatabase
)
{
ReactionThermo::operator=
(
rhs_[0].stoichCoeff*(*thermoDatabase[species_[rhs_[0].index]])
);
for (label i=1; i<rhs_.size(); i++)
{
this->operator+=
(
rhs_[i].stoichCoeff*(*thermoDatabase[species_[rhs_[i].index]])
);
}
for (label i=0; i<lhs_.size(); i++)
{
this->operator-=
(
lhs_[i].stoichCoeff*(*thermoDatabase[species_[lhs_[i].index]])
);
}
}
// Construct from components
template<class ReactionThermo>
Reaction<ReactionThermo>::Reaction
(
const speciesTable& species,
const List<specieCoeffs>& lhs,
const List<specieCoeffs>& rhs,
const HashPtrTable<ReactionThermo>& thermoDatabase
)
:
ReactionThermo(*thermoDatabase[species[0]]),
species_(species),
lhs_(lhs),
rhs_(rhs)
{
setThermo(thermoDatabase);
}
// Construct as copy given new speciesTable
template<class ReactionThermo>
Reaction<ReactionThermo>::Reaction
(
const Reaction<ReactionThermo>& r,
const speciesTable& species
)
:
ReactionThermo(r),
species_(species),
lhs_(r.lhs_),
rhs_(r.rhs_)
{}
template<class ReactionThermo>
Reaction<ReactionThermo>::specieCoeffs::specieCoeffs
(
const speciesTable& species,
Istream& is
)
{
token t(is);
if (t.isNumber())
{
stoichCoeff = t.number();
is >> t;
}
else
{
stoichCoeff = 1.0;
}
exponent = stoichCoeff;
if (t.isWord())
{
word specieName = t.wordToken();
size_t i = specieName.find('^');
if (i != word::npos)
{
string exponentStr = specieName
(
i + 1,
specieName.size() - i - 1
);
exponent = atof(exponentStr.c_str());
specieName = specieName(0, i);
}
index = species[specieName];
}
else
{
FatalIOErrorIn("Reaction<ReactionThermo>::lrhs(Istream& is)", is)
<< "Expected a word but found " << t.info()
<< exit(FatalIOError);
}
}
template<class ReactionThermo>
void Reaction<ReactionThermo>::setLRhs(Istream& is)
{
DynamicList<specieCoeffs> dlrhs;
while (is)
{
dlrhs.append(specieCoeffs(species_, is));
token t(is);
if (t.isPunctuation())
{
if (t == token::ADD)
{
}
else if (t == token::ASSIGN)
{
lhs_ = dlrhs.shrink();
dlrhs.clear();
}
else
{
rhs_ = dlrhs.shrink();
is.putBack(t);
return;
}
}
else
{
rhs_ = dlrhs.shrink();
is.putBack(t);
return;
}
}
FatalIOErrorIn("Reaction<ReactionThermo>::lrhs(Istream& is)", is)
<< "Cannot continue reading reaction data from stream"
<< exit(FatalIOError);
}
//- Construct from Istream
template<class ReactionThermo>
Reaction<ReactionThermo>::Reaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
ReactionThermo(*thermoDatabase[species[0]]),
species_(species)
{
setLRhs(is);
setThermo(thermoDatabase);
}
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
template<class ReactionThermo>
autoPtr<Reaction<ReactionThermo> > Reaction<ReactionThermo>::New
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
{
if (is.eof())
{
FatalIOErrorIn
(
"Reaction<ReactionThermo>::New(const speciesTable& species,"
" const HashPtrTable<ReactionThermo>& thermoDatabase, Istream&)",
is
) << "Reaction type not specified" << endl << endl
<< "Valid Reaction types are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
word reactionTypeName(is);
typename IstreamConstructorTable::iterator cstrIter
= IstreamConstructorTablePtr_->find(reactionTypeName);
if (cstrIter == IstreamConstructorTablePtr_->end())
{
FatalIOErrorIn
(
"Reaction<ReactionThermo>::New(const speciesTable& species,"
" const HashPtrTable<ReactionThermo>& thermoDatabase, Istream&)",
is
) << "Unknown reaction type " << reactionTypeName << endl << endl
<< "Valid reaction types are :" << endl
<< IstreamConstructorTablePtr_->sortedToc()
<< exit(FatalIOError);
}
return autoPtr<Reaction<ReactionThermo> >
(
cstrIter()(species, thermoDatabase, is)
);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo>
void Reaction<ReactionThermo>::write(Ostream& os) const
{
os << type() << nl << " ";
forAll(lhs_, i)
{
const typename Reaction<ReactionThermo>::specieCoeffs& sc = lhs_[i];
if (sc.stoichCoeff != 1)
{
os << sc.stoichCoeff;
}
os << species_[sc.index];
if (sc.exponent != sc.stoichCoeff)
{
os << '^' << sc.exponent;
}
if (i < lhs_.size() - 1)
{
os << " + ";
}
}
os << " = ";
forAll(rhs_, i)
{
const typename Reaction<ReactionThermo>::specieCoeffs& sc = rhs_[i];
if (sc.stoichCoeff != 1)
{
os << sc.stoichCoeff;
}
os << species_[sc.index];
if (sc.exponent != sc.stoichCoeff)
{
os << '^' << sc.exponent;
}
if (i < rhs_.size() - 1)
{
os << " + ";
}
}
os << endl << " ";
}
template<class ReactionThermo>
scalar Reaction<ReactionThermo>::kf
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return 0.0;
}
template<class ReactionThermo>
scalar Reaction<ReactionThermo>::kr
(
const scalar kfwd,
const scalar T,
const scalar p,
const scalarField& c
) const
{
return 0.0;
}
template<class ReactionThermo>
scalar Reaction<ReactionThermo>::kr
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return 0.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,317 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::Reaction
Description
Simple extension of ReactionThermo to handle reaction kinetics in addition
to the equilibrium thermodynamics already handled.
SourceFiles
ReactionI.H
Reaction.C
\*---------------------------------------------------------------------------*/
#ifndef Reaction_H
#define Reaction_H
#include "speciesTable.H"
#include "HashPtrTable.H"
#include "scalarField.H"
#include "typeInfo.H"
#include "runTimeSelectionTables.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of friend functions and operators
template<class ReactionThermo>
class Reaction;
template<class ReactionThermo>
inline Ostream& operator<<(Ostream&, const Reaction<ReactionThermo>&);
/*---------------------------------------------------------------------------*\
Class Reaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo>
class Reaction
:
public ReactionThermo
{
public:
// Public data types
//- Class to hold the specie index and its coefficients in the
// reaction rate expression
struct specieCoeffs
{
label index;
scalar stoichCoeff;
scalar exponent;
specieCoeffs()
:
index(-1),
stoichCoeff(0),
exponent(1)
{}
specieCoeffs(const speciesTable& species, Istream& is);
bool operator==(const specieCoeffs& sc) const
{
return index == sc.index;
}
bool operator!=(const specieCoeffs& sc) const
{
return index != sc.index;
}
friend Ostream& operator<<(Ostream& os, const specieCoeffs& sc)
{
os << sc.index << token::SPACE
<< sc.stoichCoeff << token::SPACE
<< sc.exponent;
return os;
}
};
private:
// Private data
//- List of specie names present in reaction system
const speciesTable& species_;
//- Specie info for the left-hand-side of the reaction
List<specieCoeffs> lhs_;
//- Specie info for the right-hand-side of the reaction
List<specieCoeffs> rhs_;
// Private member functions
void setLRhs(Istream&);
void setThermo(const HashPtrTable<ReactionThermo>& thermoDatabase);
//- Disallow default bitwise assignment
void operator=(const Reaction<ReactionThermo>&);
public:
//- Runtime type information
TypeName("Reaction");
// Declare run-time constructor selection tables
declareRunTimeSelectionTable
(
autoPtr,
Reaction,
Istream,
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
),
(species, thermoDatabase, is)
);
// Public classes
//- Class used for the read-construction of PtrLists of reaction
class iNew
{
const speciesTable& species_;
const HashPtrTable<ReactionThermo>& thermoDatabase_;
public:
iNew
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase
)
:
species_(species),
thermoDatabase_(thermoDatabase)
{}
autoPtr<Reaction> operator()(Istream& is) const
{
return autoPtr<Reaction>
(
Reaction::New(species_, thermoDatabase_, is)
);
}
};
// Constructors
//- Construct from components
Reaction
(
const speciesTable& species,
const List<specieCoeffs>& lhs,
const List<specieCoeffs>& rhs,
const HashPtrTable<ReactionThermo>& thermoDatabase
);
//- Construct as copy given new speciesTable
Reaction(const Reaction<ReactionThermo>&, const speciesTable& species);
//- Construct from Istream
Reaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
(
new Reaction<ReactionThermo>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
(
new Reaction<ReactionThermo>(*this, species)
);
}
// Selectors
//- Return a pointer to a new patchField created on freestore from input
static autoPtr<Reaction<ReactionThermo> > New
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream&
);
// Destructor
virtual ~Reaction()
{}
// Member Functions
// Access
inline const List<specieCoeffs>& lhs() const;
inline const List<specieCoeffs>& rhs() const;
// Reaction rate coefficients
//- Forward rate constant
virtual scalar kf
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Reverse rate constant from the given forward rate constant
virtual scalar kr
(
const scalar kfwd,
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Reverse rate constant.
// Note this evaluates the forward rate constant and divides by the
// equilibrium constant
virtual scalar kr
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Write
virtual void write(Ostream&) const;
// Ostream Operator
friend Ostream& operator<< <ReactionThermo>
(
Ostream&,
const Reaction<ReactionThermo>&
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ReactionI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "Reaction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View file

@ -1,65 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "Reaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo>
inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&
Reaction<ReactionThermo>::lhs() const
{
return lhs_;
}
template<class ReactionThermo>
inline const List<typename Reaction<ReactionThermo>::specieCoeffs>&
Reaction<ReactionThermo>::rhs() const
{
return rhs_;
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
template<class ReactionThermo>
inline Ostream& operator<<(Ostream& os, const Reaction<ReactionThermo>& r)
{
r.write(os);
return os;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,131 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Description
\*---------------------------------------------------------------------------*/
#include "ReversibleReaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class ReactionThermo, class ReactionRate>
ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionRate& k
)
:
Reaction<ReactionThermo>(reaction),
k_(k)
{}
// Construct from components
template<class ReactionThermo, class ReactionRate>
ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
)
:
Reaction<ReactionThermo>(species, thermoDatabase, is),
k_(species, is)
{}
// Construct as copy given new speciesTable
template<class ReactionThermo, class ReactionRate>
ReversibleReaction<ReactionThermo, ReactionRate>::ReversibleReaction
(
const ReversibleReaction<ReactionThermo, ReactionRate>& rr,
const speciesTable& species
)
:
Reaction<ReactionThermo>(rr, species),
k_(rr.k_)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class ReactionThermo, class ReactionRate>
scalar ReversibleReaction<ReactionThermo, ReactionRate>::kf
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return k_(T, p, c);
}
template<class ReactionThermo, class ReactionRate>
scalar ReversibleReaction<ReactionThermo, ReactionRate>::kr
(
const scalar kfwd,
const scalar T,
const scalar p,
const scalarField& c
) const
{
return kfwd/this->Kc(T);
}
template<class ReactionThermo, class ReactionRate>
scalar ReversibleReaction<ReactionThermo, ReactionRate>::kr
(
const scalar T,
const scalar p,
const scalarField& c
) const
{
return kr(kf(T, p, c), T, p, c);
}
template<class ReactionThermo, class ReactionRate>
void ReversibleReaction<ReactionThermo, ReactionRate>::write
(
Ostream& os
) const
{
Reaction<ReactionThermo>::write(os);
os << token::SPACE << k_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View file

@ -1,179 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | foam-extend: Open Source CFD
\\ / O peration | Version: 3.2
\\ / A nd | Web: http://www.foam-extend.org
\\/ M anipulation | For copyright notice see file Copyright
-------------------------------------------------------------------------------
License
This file is part of foam-extend.
foam-extend is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, either version 3 of the License, or (at your
option) any later version.
foam-extend is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with foam-extend. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::ReversibleReaction
Description
Simple extension of Reaction to handle reversible reactions using
equilibrium thermodynamics.
SourceFiles
ReversibleReaction.C
\*---------------------------------------------------------------------------*/
#ifndef ReversibleReaction_H
#define ReversibleReaction_H
#include "Reaction.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ReversibleReaction Declaration
\*---------------------------------------------------------------------------*/
template<class ReactionThermo, class ReactionRate>
class ReversibleReaction
:
public Reaction<ReactionThermo>
{
// Private data
ReactionRate k_;
// Private Member Functions
//- Disallow default bitwise assignment
void operator=(const ReversibleReaction<ReactionThermo, ReactionRate>&);
public:
//- Runtime type information
TypeName("reversible");
// Constructors
//- Construct from components
ReversibleReaction
(
const Reaction<ReactionThermo>& reaction,
const ReactionRate& k
);
//- Construct as copy given new speciesTable
ReversibleReaction
(
const ReversibleReaction<ReactionThermo, ReactionRate>&,
const speciesTable& species
);
//- Construct from Istream
ReversibleReaction
(
const speciesTable& species,
const HashPtrTable<ReactionThermo>& thermoDatabase,
Istream& is
);
//- Construct and return a clone
virtual autoPtr<Reaction<ReactionThermo> > clone() const
{
return autoPtr<Reaction<ReactionThermo> >
(
new ReversibleReaction<ReactionThermo, ReactionRate>(*this)
);
}
//- Construct and return a clone with new speciesTable
virtual autoPtr<Reaction<ReactionThermo> > clone
(
const speciesTable& species
) const
{
return autoPtr<Reaction<ReactionThermo> >
(
new ReversibleReaction<ReactionThermo, ReactionRate>
(
*this,
species
)
);
}
// Destructor
virtual ~ReversibleReaction()
{}
// Member Functions
// ReversibleReaction rate coefficients
//- Forward rate constant
virtual scalar kf
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Reverse rate constant from the given formard rate constant
virtual scalar kr
(
const scalar kfwd,
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Reverse rate constant.
// Note this evaluates the forward rate constant and divides by the
// equilibrium constant
virtual scalar kr
(
const scalar T,
const scalar p,
const scalarField& c
) const;
//- Write
virtual void write(Ostream&) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReversibleReaction.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //