Commit 7b069d85 authored by Andrew Heather's avatar Andrew Heather
Browse files

further developments towards evap model

parent a19fe748
......@@ -72,6 +72,11 @@ phaseProperties/phaseProperties/phaseProperties.C
phaseProperties/phaseProperties/phasePropertiesIO.C
phaseProperties/phasePropertiesList/phasePropertiesList.C
/* evaporation properties */
evaporationProperties/evaporationProperties/evaporationProperties.C
evaporationProperties/evaporationProperties/evaporationPropertiesIO.C
/* data entries */
submodels/IO/DataEntry/makeDataEntries.C
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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 2 of the License, or (at your
option) any later version.
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "evaporationProperties.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::evaporationProperties::evaporationProperties()
:
name_("unknownSpecie"),
Dab_(0.0),
TvsPSat_()
{}
Foam::evaporationProperties::evaporationProperties
(
const evaporationProperties& pp
)
:
name_(pp.name_),
Dab_(pp.Dab_),
TvsPSat_(pp.TvsPSat_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::evaporationProperties::~evaporationProperties()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::word& Foam::evaporationProperties::name() const
{
return name_;
}
Foam::scalar Foam::evaporationProperties::Dab() const
{
return Dab_;
}
const Foam::DataEntry<Foam::scalar>&
Foam::evaporationProperties::TvsPSat() const
{
return TvsPSat_();
}
// ************************************************************************* //
......@@ -23,23 +23,21 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::phaseProperties
Foam::evaporationProperties
Description
Helper class to manage multi-component phase properties
Helper class to manage evaporation properties
SourceFiles
phaseProperties.C
evaporationProperties.C
\*---------------------------------------------------------------------------*/
#ifndef phaseProperties_H
#define phaseProperties_H
#ifndef evaporationProperties_H
#define evaporationProperties_H
#include "NamedEnum.H"
#include "Tuple2.H"
#include "PtrList.H"
#include "volFields.H"
#include "DataEntry.H"
#include "autoPtr.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -47,55 +45,25 @@ namespace Foam
{
/*---------------------------------------------------------------------------*\
Class phaseProperties Declaration
Class evaporationProperties Declaration
\*---------------------------------------------------------------------------*/
class phaseProperties
class evaporationProperties
{
public:
// Public data
//- Phase type enumeration
enum phaseType
{
GAS,
LIQUID,
SOLID,
UNKNOWN
};
//- Corresponding word representations for phase type enumerations
static const NamedEnum<phaseType, 4> phaseTypeNames_;
private:
// Private data
//- Phase type
phaseType phase_;
//- Name of specie
word name_;
//- List of component names
List<word> names_;
//- Diffusion coefficient
scalar Dab_;
//- List of component mass fractions
List<scalar> fractions_;
//- Global ids
labelList globalIds_;
//- Data entry for saturation pressure as a function of temperature
autoPtr<DataEntry<scalar> > TvsPSat_;
// Private member functions
//- Set global ids - specialisation for carrier gas phases
void setGlobalGasIds(const PtrList<volScalarField>& YGas);
//- Set global ids - liquid and solid phases
void setGlobalIds(const wordList& globalNames);
//- Check the total mass fraction
void checkTotalMassFraction() const;
public:
......@@ -103,66 +71,38 @@ public:
// Constructors
//- Null constructor
phaseProperties();
evaporationProperties();
//- Construct from Istream
phaseProperties(Istream&);
evaporationProperties(Istream&);
//- Construct as copy
phaseProperties(const phaseProperties&);
evaporationProperties(const evaporationProperties&);
//- Destructor
~phaseProperties();
~evaporationProperties();
// Public member functions
//- Initialise the global ids
void initialiseGlobalIds
(
const PtrList<volScalarField>& YGas,
const wordList& liquidNames,
const wordList& solidNames
);
//- Return const access to the phase type
phaseType phase() const;
//- Return word representation of the phase type
word phaseTypeName() const;
//- Return const access to the component name vs mass fraction list
const List<Tuple2<word, scalar> >& components() const;
//- Return const access to a component name
const word& name(const label cmptI) const;
//- Return a list of component names
const wordList names() const;
//- Return the id of a component in the local list by name
// Returns -1 if not found
label id(const word& cmptName) const;
//- Return the global id of a component in the local list by name
// Returns -1 if not found
label globalId(const word& cmptName) const;
// Access
//- Return const acccess to the global ids
const labelList& globalIds() const;
//- Return const access to the specie name
const word& name() const;
//- Return non-const access to a component mass fraction
scalar& Y(const label cmptI);
//- Return const access to the diffusion coefficient
scalar Dab() const;
//- Return const access to all component mass fractions
const scalarList Y() const;
//- Return const access to the saturation pressure as a function
// of temperature
const DataEntry<scalar>& TvsPSat() const;
// IOstream Operators
friend Istream& operator>>(Istream&, phaseProperties&);
friend Ostream& operator<<(Ostream&, const phaseProperties&);
friend Istream& operator>>(Istream&, evaporationProperties&);
friend Ostream& operator<<(Ostream&, const evaporationProperties&);
};
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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 2 of the License, or (at your
option) any later version.
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "evaporationProperties.H"
#include "dictionaryEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::evaporationProperties::evaporationProperties(Istream& is)
:
name_("unknown"),
Dab_(0.0),
TvsPSat_(NULL)
{
is.check
(
"Foam::evaporationProperties::evaporationProperties(Istream& is)"
);
dictionaryEntry evapInfo(dictionary::null, is);
if (!evapInfo.isDict())
{
FatalErrorIn
(
"Foam::evaporationProperties::evaporationProperties(Istream& is)"
) << "Evaporation properties should be given in dictionary entries"
<< nl << exit(FatalError);
}
name_ = evapInfo.keyword();
evapInfo.lookup("Dab") >> Dab_;
TvsPSat_.reset(DataEntry<scalar>::New("TvsPSat", evapInfo.dict()).ptr());
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, evaporationProperties& ep)
{
is.check
(
"Foam::Istream& Foam::operator>>"
"("
"Foam::Istream&,"
"Foam::evaporationProperties&"
")"
);
dictionaryEntry evapInfo(dictionary::null, is);
if (!evapInfo.isDict())
{
FatalErrorIn
(
"Foam::Istream& Foam::operator>>"
"("
"Istream& is,"
"evaporationProperties& pp"
")"
) << "Evaporation properties should be given in dictionary entries"
<< nl << exit(FatalError);
}
ep.name_ = evapInfo.keyword();
evapInfo.lookup("Dab") >> ep.Dab_;
ep.TvsPSat_.reset(DataEntry<scalar>::New("TvsPSat", evapInfo.dict()).ptr());
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const evaporationProperties& ep)
{
os.check
(
"Foam::Ostream& Foam::operator<<"
"("
"Foam::Ostream&,"
"const Foam::evaporationProperties&"
")"
);
os << ep.name_ << nl << token::BEGIN_BLOCK << nl
<< incrIndent;
os.writeKeyword("Dab") << ep.Dab_ << token::END_STATEMENT << nl;
// os << ep.TvsPSat_() << nl;
os << decrIndent << token::END_BLOCK << nl;
os.check
(
"Foam::Ostream& Foam::operator<<"
"("
"Foam::Ostream&,"
"const Foam::evaporationProperties&"
")"
);
return os;
}
// ************************************************************************* //
......@@ -28,6 +28,7 @@ License
#include "ReactingCloud.H"
#include "NoPhaseChange.H"
#include "LiquidEvaporation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -45,6 +46,12 @@ namespace Foam
ReactingCloud,
basicReactingMultiphaseParcel
);
makePhaseChangeModelType
(
LiquidEvaporation,
ReactingCloud,
basicReactingMultiphaseParcel
);
};
......
......@@ -28,6 +28,7 @@ License
#include "ReactingCloud.H"
#include "NoPhaseChange.H"
#include "LiquidEvaporation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
......@@ -42,6 +43,12 @@ namespace Foam
ReactingCloud,
basicReactingParcel
);
makePhaseChangeModelType
(
LiquidEvaporation,
ReactingCloud,
basicReactingParcel
);
};
......
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM 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 2 of the License, or (at your
option) any later version.
OpenFOAM 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 OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "phaseProperties.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<>
const char* Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>::names[] =
{
"gas",
"liquid",
"solid",
"unknown"
};
const Foam::NamedEnum<Foam::phaseProperties::phaseType, 4>
Foam::phaseProperties::phaseTypeNames_;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::phaseProperties::setGlobalGasIds
(
const PtrList<volScalarField>& YGas
)
{
forAll(components_, i)
{
forAll (YGas, j)
{
word specieName = YGas[j].name();
if (specieName == components_[i].first())
{
globalIds_[i] = j;
break;
}
}
if (globalIds_[i] == -1)
{
wordList globalGasNames(YGas.size());
forAll (YGas, k)
{
globalGasNames[k] = YGas[k].name();
}
FatalErrorIn
(
"void phaseProperties::setGlobalGasIds"
"("
" const hCombustionThermo&"
")"
) << "Could not find gas species " << components_[i].first()
<< " in species list" << nl
<< "Available species are: " << nl << globalGasNames << nl
<< exit(FatalError);
}
}
}
void Foam::phaseProperties::setGlobalIds(const wordList& globalNames)
{
forAll(components_, i)
{
forAll(globalNames, j)
{
if (globalNames[j] == components_[i].first())
{
globalIds_[i] = j;
break;
}
}
if (globalIds_[i] == -1)
{
FatalErrorIn
(
"void Foam::phaseProperties::setGlobalGasIds\n"
"(\n"
" const PtrList<volScalarField>& YGas\n"
")"
) << "Could not find specie " << components_[i].first()
<< " in species list" << nl
<< "Available species are: " << nl << globalNames << nl
<< exit(FatalError);
}
}
}
void Foam::phaseProperties::checkTotalMassFraction() const
{
scalar total = 0.0;
forAll(fractions_, cmptI)
{
total += fractions_[cmptI];
}
if (mag(total - 1.0) > SMALL)
{
FatalErrorIn
(
"void Foam::phaseProperties::checkTotalMassFraction() const"
) << "Component fractions must total to unity" << nl
<< "Components: " << nl << components_ << nl << exit(FatalError);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::phaseProperties::phaseProperties()
:
phase_(UNKNOWN),
names_(0),
fractions_(0),
globalIds_(0)
{}
Foam::phaseProperties::phaseProperties(Istream& is)
: