From 7b069d85bf15480c339a89ed7238721b0d13bf28 Mon Sep 17 00:00:00 2001 From: andy <a.heather@opencfd.co.uk> Date: Wed, 4 Mar 2009 19:31:56 +0000 Subject: [PATCH] further developments towards evap model --- src/lagrangian/intermediate/Make/files | 5 + .../evaporationProperties.C | 80 ++++ .../evaporationProperties.H | 117 ++++++ .../evaporationPropertiesIO.C | 130 +++++++ ...eactingMultiphaseParcelPhaseChangeModels.C | 7 + ...makeBasicReactingParcelPhaseChangeModels.C | 7 + .../phaseProperties/phaseProperties.C.bakNew | 357 ------------------ .../phaseProperties/phaseProperties.H.bakNew | 177 --------- .../IO/DataEntry/Constant/Constant.C | 13 + .../IO/DataEntry/Constant/Constant.H | 24 +- .../IO/DataEntry/Constant/ConstantIO.C | 63 ++++ .../IO/DataEntry/DataEntry/DataEntry.C | 12 + .../IO/DataEntry/DataEntry/DataEntry.H | 24 +- .../IO/DataEntry/DataEntry/DataEntryIO.C | 48 +++ .../submodels/IO/DataEntry/Table/Table.C | 13 + .../submodels/IO/DataEntry/Table/Table.H | 24 +- .../submodels/IO/DataEntry/Table/TableIO.C | 63 ++++ .../LiquidEvaporation.C} | 151 ++++---- .../LiquidEvaporation.H} | 38 +- .../NoPhaseChange/NoPhaseChange.C | 2 +- .../NoPhaseChange/NoPhaseChange.H | 2 +- .../PhaseChangeModel/PhaseChangeModel.H | 2 +- 22 files changed, 720 insertions(+), 639 deletions(-) create mode 100644 src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.C create mode 100644 src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.H create mode 100644 src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationPropertiesIO.C delete mode 100644 src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew delete mode 100644 src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew create mode 100644 src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C create mode 100644 src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C create mode 100644 src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C rename src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/{liquidEvaporation/liquidEvaporation.C => LiquidEvaporation/LiquidEvaporation.C} (53%) rename src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/{liquidEvaporation/liquidEvaporation.H => LiquidEvaporation/LiquidEvaporation.H} (80%) diff --git a/src/lagrangian/intermediate/Make/files b/src/lagrangian/intermediate/Make/files index 7e2bd41a8ee..8ba5b4e0a08 100644 --- a/src/lagrangian/intermediate/Make/files +++ b/src/lagrangian/intermediate/Make/files @@ -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 diff --git a/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.C b/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.C new file mode 100644 index 00000000000..49a353a18a2 --- /dev/null +++ b/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.C @@ -0,0 +1,80 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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_(); +} + + +// ************************************************************************* // + diff --git a/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.H b/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.H new file mode 100644 index 00000000000..1ee2ed1c6ab --- /dev/null +++ b/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationProperties.H @@ -0,0 +1,117 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 + +Class + Foam::evaporationProperties + +Description + Helper class to manage evaporation properties + +SourceFiles + evaporationProperties.C + +\*---------------------------------------------------------------------------*/ + +#ifndef evaporationProperties_H +#define evaporationProperties_H + +#include "DataEntry.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class evaporationProperties Declaration +\*---------------------------------------------------------------------------*/ + +class evaporationProperties +{ + // Private data + + //- Name of specie + word name_; + + //- Diffusion coefficient + scalar Dab_; + + //- Data entry for saturation pressure as a function of temperature + autoPtr<DataEntry<scalar> > TvsPSat_; + + + // Private member functions + + + +public: + + // Constructors + + //- Null constructor + evaporationProperties(); + + //- Construct from Istream + evaporationProperties(Istream&); + + //- Construct as copy + evaporationProperties(const evaporationProperties&); + + + //- Destructor + ~evaporationProperties(); + + + // Public member functions + + // Access + + //- Return const access to the specie name + const word& name() const; + + //- Return const access to the diffusion coefficient + scalar Dab() const; + + //- Return const access to the saturation pressure as a function + // of temperature + const DataEntry<scalar>& TvsPSat() const; + + + // IOstream Operators + + friend Istream& operator>>(Istream&, evaporationProperties&); + friend Ostream& operator<<(Ostream&, const evaporationProperties&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationPropertiesIO.C b/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationPropertiesIO.C new file mode 100644 index 00000000000..3eed20d37bb --- /dev/null +++ b/src/lagrangian/intermediate/evaporationProperties/evaporationProperties/evaporationPropertiesIO.C @@ -0,0 +1,130 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/submodels/makeBasicReactingMultiphaseParcelPhaseChangeModels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/submodels/makeBasicReactingMultiphaseParcelPhaseChangeModels.C index 88300dffb16..99e9dfb89ba 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/submodels/makeBasicReactingMultiphaseParcelPhaseChangeModels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingMultiphaseParcel/submodels/makeBasicReactingMultiphaseParcelPhaseChangeModels.C @@ -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 + ); }; diff --git a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/submodels/makeBasicReactingParcelPhaseChangeModels.C b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/submodels/makeBasicReactingParcelPhaseChangeModels.C index 65118fa8f71..f8ce035ada1 100644 --- a/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/submodels/makeBasicReactingParcelPhaseChangeModels.C +++ b/src/lagrangian/intermediate/parcels/derived/basicReactingParcel/submodels/makeBasicReactingParcelPhaseChangeModels.C @@ -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 + ); }; diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew deleted file mode 100644 index fe690e0ab6b..00000000000 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.C.bakNew +++ /dev/null @@ -1,357 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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) -: - phase_(UNKNOWN), - names_(0), - fractions_(0), - globalIds_(0) -{ - is.check("Foam::phaseProperties::phaseProperties(Istream& is)"); - - Tuple2<word, List<Tuple2<word, scalar> > > components(is); - - phase_ = phaseTypeNames_.read(components.first()); - - label nComponents = components.second().size(); - names_.setSize(nComponents); - fractions_.setSize(nComponents); - - forAll(components.second(), cmptI) - { - names_[cmptI] = components.second()[cmptI].first(); - fractions_[cmptI] = components.second()[cmptI].second(); - } - - // initialise global ids to -1 - globalIds_.setSize(nComponents, -1); - - checkTotalMassFraction(); -} - - -Foam::phaseProperties::phaseProperties(const phaseProperties& pp) -: - phase_(pp.phase_), - names_(pp.names_), - fractions_(pp.fractions_), - globalIds_(pp.globalIds_) -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -Foam::phaseProperties::~phaseProperties() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -void Foam::phaseProperties::initialiseGlobalIds -( - const PtrList<volScalarField>& YGas, - const wordList& liquidNames, - const wordList& solidNames -) -{ - // determine the addressing to map between components listed in the phase - // with those given in the (main) thermo properties - switch (phase_) - { - case GAS: - { - setGlobalGasIds(YGas); - break; - } - case LIQUID: - { - setGlobalIds(liquidNames); - break; - } - case SOLID: - { - setGlobalIds(solidNames); - break; - } - default: - { - FatalErrorIn - ( - "Foam::phaseProperties::setGlobalIds\n" - "(\n" - " const PtrList<specieReactingProperties>& gases,\n" - " const wordList& liquidNames,\n" - " const wordList& solidNames\n" - ")" - ) << "Invalid phase: " << phaseTypeNames_[phase_] << nl - << " phase must be gas, liquid or solid" << nl - << exit(FatalError); - } -} - - -Foam::phaseProperties::phaseType Foam::phaseProperties::phase() const -{ - return phase_; -} - - -Foam::word Foam::phaseProperties::phaseTypeName() const -{ - return phaseTypeNames_[phase_]; -} - - -const Foam::List<Foam::Tuple2<Foam::word, Foam::scalar> >& -Foam::phaseProperties::components() const -{ - return components_; -} - - -const Foam::word& Foam::phaseProperties::name(const label cmptI) const -{ - if (cmptI >= components_.size()) - { - FatalErrorIn - ( - "const Foam::word& Foam::phaseProperties::name" - "(" - " const label cmptI" - ") const" - ) << "Requested component " << cmptI << "out of range" << nl - << "Available phase components:" << nl << components_ << nl - << exit(FatalError); - } - - return components_[cmptI].first(); -} - - -const Foam::wordList Foam::phaseProperties::names() const -{ - wordList cmptNames(components_.size()); - - forAll(components_, cmptI) - { - cmptNames[cmptI] = components_[cmptI].first(); - } - - return cmptNames; -} - - -Foam::label Foam::phaseProperties::id(const word& cmptName) const -{ - forAll(components_, cmptI) - { - if (components_[cmptI].first() == cmptName) - { - return cmptI; - } - } - - return -1; -} - - -Foam::label Foam::phaseProperties::globalId(const word& cmptName) const -{ - label id = this->id(cmptName); - - if (id < 0) - { - return id; - } - else - { - return globalIds_[id]; - } - -} - - -const Foam::labelList& Foam::phaseProperties::globalIds() const -{ - return globalIds_; -} - - -Foam::scalar& Foam::phaseProperties::Y(const label cmptI) -{ - if (cmptI >= components_.size()) - { - FatalErrorIn - ( - "const Foam::scalar& Foam::phaseProperties::Y" - "(" - " const label cmptI" - ") const" - ) << "Requested component " << cmptI << "out of range" << nl - << "Available phase components:" << nl << components_ << nl - << exit(FatalError); - } - - return components_[cmptI].second(); -} - - -const Foam::scalarList Foam::phaseProperties::Y() const -{ - scalarList cmptYs(components_.size(), 0.0); - - forAll(cmptYs, i) - { - cmptYs[i] = components_[i].second(); - } - - return cmptYs; -} - - -// ************************************************************************* // - diff --git a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew b/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew deleted file mode 100644 index b7ca4287157..00000000000 --- a/src/lagrangian/intermediate/phaseProperties/phaseProperties/phaseProperties.H.bakNew +++ /dev/null @@ -1,177 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 - -Class - Foam::phaseProperties - -Description - Helper class to manage multi-component phase properties - -SourceFiles - phaseProperties.C - -\*---------------------------------------------------------------------------*/ - -#ifndef phaseProperties_H -#define phaseProperties_H - -#include "NamedEnum.H" -#include "Tuple2.H" -#include "PtrList.H" -#include "volFields.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class phaseProperties Declaration -\*---------------------------------------------------------------------------*/ - -class phaseProperties -{ -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_; - - //- List of component names - List<word> names_; - - //- List of component mass fractions - List<scalar> fractions_; - - //- Global ids - labelList globalIds_; - - - // 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: - - // Constructors - - //- Null constructor - phaseProperties(); - - //- Construct from Istream - phaseProperties(Istream&); - - //- Construct as copy - phaseProperties(const phaseProperties&); - - - //- Destructor - ~phaseProperties(); - - - // 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; - - //- Return const acccess to the global ids - const labelList& globalIds() const; - - //- Return non-const access to a component mass fraction - scalar& Y(const label cmptI); - - //- Return const access to all component mass fractions - const scalarList Y() const; - - - // IOstream Operators - - friend Istream& operator>>(Istream&, phaseProperties&); - friend Ostream& operator<<(Ostream&, const phaseProperties&); -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C b/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C index cc1676805b2..658fca8e7ee 100644 --- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.C @@ -36,6 +36,14 @@ Foam::Constant<Type>::Constant(const word& entryName, Istream& is) {} +template<class Type> +Foam::Constant<Type>::Constant(const Constant<Type>& cnst) +: + DataEntry<Type>(cnst), + value_(cnst.value_) +{} + + template<> Foam::Constant<Foam::label>::Constant(const word& entryName, Istream& is) : @@ -75,4 +83,9 @@ Type Foam::Constant<Type>::integrate(const scalar x1, const scalar x2) const } +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "ConstantIO.C" + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H b/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H index 6183f3a2ab9..ff82343c1ed 100644 --- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/Constant.H @@ -48,6 +48,16 @@ SourceFiles namespace Foam { +template<class Type> +class Constant; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const Constant<Type>& +); + /*---------------------------------------------------------------------------*\ Class Constant Declaration \*---------------------------------------------------------------------------*/ @@ -65,9 +75,6 @@ class Constant // Private Member Functions - //- Disallow default bitwise copy construct - Constant(const Constant<Type>&); - //- Disallow default bitwise assignment void operator=(const Constant<Type>&); @@ -83,6 +90,9 @@ public: //- Construct from entry name and Istream Constant(const word& entryName, Istream& is); + //- Copy constructor + Constant(const Constant<Type>& cnst); + //- Destructor virtual ~Constant(); @@ -95,6 +105,14 @@ public: //- Integrate between two values Type integrate(const scalar x1, const scalar x2) const; + + + //- Ostream Operator + friend Ostream& operator<< <Type> + ( + Ostream&, + const Constant<Type>& + ); }; diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C b/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C new file mode 100644 index 00000000000..51212f9dbc3 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/Constant/ConstantIO.C @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "DataEntry.H" + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const Constant<Type>& de +) +{ + if (os.format() == IOstream::ASCII) + { + os << static_cast<const DataEntry<Type>& >(de) + << token::SPACE << de.value_; + } + else + { + os << static_cast<const DataEntry<Type>& >(de); + os.write + ( + reinterpret_cast<const char*>(&de.value_), + sizeof(de.value_) + ); + } + + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const Constant<Type>&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C b/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C index d4bcbc03735..b107a35010c 100644 --- a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.C @@ -35,6 +35,13 @@ Foam::DataEntry<Type>::DataEntry(const word& entryName) {} +template<class Type> +Foam::DataEntry<Type>::DataEntry(const DataEntry<Type>& de) +: + name_(de.name_) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class Type> @@ -51,4 +58,9 @@ const Foam::word& Foam::DataEntry<Type>::name() const } +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "DataEntryIO.C" + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H b/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H index 965b7afdf70..b3a670433d9 100644 --- a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntry.H @@ -47,6 +47,16 @@ SourceFiles namespace Foam { +template<class Type> +class DataEntry; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const DataEntry<Type>& +); + /*---------------------------------------------------------------------------*\ Class DataEntry Declaration \*---------------------------------------------------------------------------*/ @@ -56,9 +66,6 @@ class DataEntry { // Private Member Functions - //- Disallow default bitwise copy construct - DataEntry(const DataEntry<Type>&); - //- Disallow default bitwise assignment void operator=(const DataEntry<Type>&); @@ -95,6 +102,9 @@ public: //- Construct from entry name DataEntry(const word& entryName); + //- Copy constructor + DataEntry(const DataEntry<Type>& de); + //- Selector static autoPtr<DataEntry<Type> > New @@ -123,6 +133,14 @@ public: //- Integrate between two (scalar) values virtual Type integrate(const scalar x1, const scalar x2) const = 0; + + + //- Ostream Operator + friend Ostream& operator<< <Type> + ( + Ostream&, + const DataEntry<Type>& + ); }; diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C b/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C new file mode 100644 index 00000000000..7afa2ef2015 --- /dev/null +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/DataEntry/DataEntryIO.C @@ -0,0 +1,48 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "DataEntry.H" + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const DataEntry<Type>& +) +{ + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const DataEntry<Type>&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C b/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C index fd08858157a..98abaf6e67e 100644 --- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C @@ -43,6 +43,14 @@ Foam::Table<Type>::Table(const word& entryName, Istream& is) } +template<class Type> +Foam::Table<Type>::Table(const Table<Type>& tbl) +: + DataEntry<Type>(tbl), + table_(tbl.table_) +{} + + // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template<class Type> @@ -132,4 +140,9 @@ Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const } +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +#include "TableIO.C" + + // ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H b/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H index 97bd77f1717..f96c79a816f 100644 --- a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H @@ -54,6 +54,16 @@ SourceFiles namespace Foam { +template<class Type> +class Table; + +template<class Type> +Ostream& operator<< +( + Ostream&, + const Table<Type>& +); + /*---------------------------------------------------------------------------*\ Class Table Declaration \*---------------------------------------------------------------------------*/ @@ -71,9 +81,6 @@ class Table // Private Member Functions - //- Disallow default bitwise copy construct - Table(const Table<Type>&); - //- Disallow default bitwise assignment void operator=(const Table<Type>&); @@ -89,6 +96,9 @@ public: //- Construct from entry name and Istream Table(const word& entryName, Istream& is); + //- Copy constructor + Table(const Table<Type>& tbl); + //- Destructor virtual ~Table(); @@ -101,6 +111,14 @@ public: //- Integrate between two (scalar) values Type integrate(const scalar x1, const scalar x2) const; + + + //- Ostream Operator + friend Ostream& operator<< <Type> + ( + Ostream&, + const Constant<Type>& + ); }; diff --git a/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C b/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C new file mode 100644 index 00000000000..8ee842c4c3f --- /dev/null +++ b/src/lagrangian/intermediate/submodels/IO/DataEntry/Table/TableIO.C @@ -0,0 +1,63 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 "DataEntry.H" + +// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * // + +template<class Type> +Foam::Ostream& Foam::operator<< +( + Ostream& os, + const Table<Type>& de +) +{ + if (os.format() == IOstream::ASCII) + { + os << static_cast<const DataEntry<Type>& >(de) + << token::SPACE << de.table_; + } + else + { + os << static_cast<const DataEntry<Type>& >(de); + os.write + ( + reinterpret_cast<const char*>(&de.table_), + sizeof(de.table_) + ); + } + + // Check state of Ostream + os.check + ( + "Ostream& operator<<(Ostream&, const Table<Type>&)" + ); + + return os; +} + + +// ************************************************************************* // diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C similarity index 53% rename from src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.C rename to src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C index 8bba9d784d1..b72c34f9bcf 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.C @@ -24,102 +24,101 @@ License \*---------------------------------------------------------------------------*/ -#include "liquidEvaporation.H" +#include "LiquidEvaporation.H" #include "specie.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template <class CloudType> -Foam::scalar Foam::liquidEvaporation<CloudType>::Sh +Foam::label Foam::LiquidEvaporation<CloudType>::carrierSpecieId ( - const scalar Re, - const scalar Sc + const word& specieName ) const { - return 2.0 + 0.6*Foam::sqrt(Re)*pow(Sc, 0.333); + forAll (this->owner().carrierThermo().composition().Y(), i) + { + if + ( + this->owner().carrierThermo().composition().Y()[i].name() + == specieName + ) + { + return i; + } + } + + wordList species(this->owner().carrierThermo().composition().Y().size()); + forAll (this->owner().carrierThermo().composition().Y(), i) + { + species[i] = this->owner().carrierThermo().composition().Y()[i].name(); + } + + FatalErrorIn + ( + "Foam::label Foam::LiquidEvaporation<CloudType>::carrierSpecieId" + "(" + "const word&" + ") const" + ) << "Could not find " << specieName << " in species list" << nl + << "Avialable species:" << nl << species + << nl << exit(FatalError); + + return -1; } template <class CloudType> -Foam::scalar Foam::liquidEvaporation<CloudType>::pSat +Foam::scalar Foam::LiquidEvaporation<CloudType>::Sh ( - const label i, - const scalar T + const scalar Re, + const scalar Sc ) const { - const List<Tuple2<scalar, scalar> >& pSat = pSat_[i]; - - label id = 0; - label nT = pSat.size(); - while ((id < nT) && (pSat[id].first() < T)) - { - id++; - } - - if (id == 0 || id == nT - 1) - { - return pSat[id].second(); - } - else - { - return - (pSat[id].first() - T) - /(pSat[id].first() - pSat[id-1].first()) - *(pSat[id].second() - pSat[id-1].second()) - + pSat[id-1].second(); - } + return 2.0 + 0.6*Foam::sqrt(Re)*pow(Sc, 0.333); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // template <class CloudType> -Foam::liquidEvaporation<CloudType>::liquidEvaporation +Foam::LiquidEvaporation<CloudType>::LiquidEvaporation ( const dictionary& dict, CloudType& owner ) : PhaseChangeModel<CloudType>(dict, owner, typeName), - gases_(owner.gases()), liquids_ ( liquidMixture::New ( owner.mesh().objectRegistry::lookupObject<dictionary> ( - owner.carrierThermo().name().name() + owner.carrierThermo().name() ) ) ), - Tvap_(readScalar(coeffDict().lookup("Tvap"))), - Dm_(coeffDict().lookup("DiffusionCoeffs")), - pSat_(coeffDict().lookup("pSat")) + Tvap_(readScalar(this->coeffDict().lookup("Tvap"))), + evapProps_(this->coeffDict().lookup("activeLiquids")), + liqToGasMap_(evapProps_.size()) { - if (liquids_.size() != Dm_.size()) + if (evapProps_.size() == 0) { - FatalErrorIn + WarningIn ( - "Foam::liquidEvaporation<CloudType>::liquidEvaporation\n" - "(\n" - " const dictionary& dict,\n" - " CloudType& cloud\n" - ")\n" - ) << "Size of diffusionCoeffs list not equal to the number of liquid " - << "species" << nl << exit(FatalError); + "Foam::LiquidEvaporation<CloudType>::LiquidEvaporation" + "(" + "const dictionary& dict, " + "CloudType& owner" + ")" + ) << "Evaporation model selected, but no active liquids defined" + << nl << endl; } - if (liquids_.size() != pSat_.size()) + // Calculate mapping between liquid and carrier phase species + forAll(evapProps_, i) { - FatalErrorIn - ( - "Foam::liquidEvaporation<CloudType>::liquidEvaporation\n" - "(\n" - " const dictionary& dict,\n" - " CloudType& cloud\n" - ")\n" - ) << "Size of saturation pressure lists not equal to the number of " - << "liquid species" << nl << exit(FatalError); + liqToGasMap_[i] = carrierSpecieId(evapProps_[i].name()); } } @@ -127,75 +126,79 @@ Foam::liquidEvaporation<CloudType>::liquidEvaporation // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // template <class CloudType> -Foam::liquidEvaporation<CloudType>::~liquidEvaporation() +Foam::LiquidEvaporation<CloudType>::~LiquidEvaporation() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // template<class CloudType> -bool Foam::liquidEvaporation<CloudType>::active() const +bool Foam::LiquidEvaporation<CloudType>::active() const { return true; } template<class CloudType> -Foam::scalar Foam::liquidEvaporation<CloudType>::calculate +Foam::scalar Foam::LiquidEvaporation<CloudType>::calculate ( const scalar T, const scalar d, const scalarField& Xc, - const scalarList& dMassMT, - const vector& Ur + scalarList& dMassMT, + const vector& Ur, const scalar Tc, const scalar pc, - const scalar nuc - const scalar dt, + const scalar nuc, + const scalar dt ) const { scalar dMassTot = 0.0; if (T < Tvap_) { - // not reached temperature threshold - return 0.0; + // not reached model activation temperature + return dMassTot; } else { // droplet area scalar A = mathematicalConstant::pi*sqr(d); - // universal gas constant - const scalar R = specie::RR.value(); - // Reynolds number scalar Re = mag(Ur)*d/(nuc + ROOTVSMALL); - // calculate mass transfer of each specie - forAll(dMassMT, i) + // Calculate mass transfer of each specie in liquid + forAll(evapProps_, i) { + // Diffusion coefficient for species i + scalar Dab = evapProps_[i].Dab(); + + // Saturation pressure for species i at temperature T + scalar pSat = evapProps_[i].TvsPSat().value(T); + // Schmidt number - scalar Sc = nuc/(Dm_[i] + ROOTVSMALL); + scalar Sc = nuc/(Dab + ROOTVSMALL); // Sherwood number scalar Sh = this->Sh(Re, Sc); // mass transfer coefficient [m/s] - scalar kc = Sh*Dm_[i]/(d + ROOTVSMALL); + scalar kc = Sh*Dab/(d + ROOTVSMALL); // vapour concentration at droplet surface [kgmol/m3] - scalar Cs = pSat(i, T)/(R*T); + scalar Cs = pSat/(specie::RR*T); // vapour concentration in bulk gas [kgmol/m3] - scalar Cinf = Xc[i]*pc/(R*Tc); + scalar Cinf = Xc[i]*pc/(specie::RR*Tc); // molar flux of vapour [kgmol/m2/s] scalar Ni = max(kc*(Cs - Cinf), 0.0); // mass transfer - scalar dm = Ni*A*liquids_.properies()[i].W()*dt; - dMassMT[i] -= dm; + label globalLiqId = liqToGasMap_[i]; + scalar dm = Ni*A*liquids_->properties()[globalLiqId].W()*dt; + dMassMT[globalLiqId] -= dm; dMassTot += dm; } } diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H similarity index 80% rename from src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.H rename to src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H index a7e2325f17b..0224b1bd5da 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/liquidEvaporation/liquidEvaporation.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/LiquidEvaporation/LiquidEvaporation.H @@ -23,30 +23,32 @@ License Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Class - Foam::liquidEvaporation + Foam::LiquidEvaporation Description Liquid evaporation model \*---------------------------------------------------------------------------*/ -#ifndef liquidEvaporation_H -#define liquidEvaporation_H +#ifndef LiquidEvaporation_H +#define LiquidEvaporation_H #include "PhaseChangeModel.H" #include "liquidMixture.H" #include "Tuple2.H" +#include "evaporationProperties.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class liquidEvaporation Declaration + Class LiquidEvaporation Declaration \*---------------------------------------------------------------------------*/ template<class CloudType> -class liquidEvaporation +class LiquidEvaporation : public PhaseChangeModel<CloudType> { @@ -62,34 +64,32 @@ protected: // allowed scalar Tvap_; - //- Component diffusion coefficients - one per specie - // Note: need to be in same order as defined by liquids in thermo - // props - scalarList Dm_; + //- List of evaporation properties + List<evaporationProperties> evapProps_; - //- Component saturation pressure vs temperature - List<List<Tuple2<scalar, scalar> > > pSat_; + //- Mapping between liquid and carrier gas species + List<label> liqToGasMap_; // Protected member functions + //- Return the id of species specieName in the carrier phase + label carrierSpecieId(const word& specieName) const; + //- Sherwood number as a function of Reynolds and Schmidt numbers scalar Sh(const scalar Re, const scalar Sc) const; - //- Return the saturation pressure for species i at temperature, T - scalar pSat(const label i, const scalar T) const; - public: //- Runtime type information - TypeName("liquidEvaporation"); + TypeName("LiquidEvaporation"); // Constructors //- Construct from dictionary - liquidEvaporation + LiquidEvaporation ( const dictionary& dict, CloudType& cloud @@ -97,7 +97,7 @@ public: //- Destructor - virtual ~liquidEvaporation(); + virtual ~LiquidEvaporation(); // Member Functions @@ -111,7 +111,7 @@ public: const scalar T, const scalar d, const scalarField& Xc, - const scalarList& dMassMT, + scalarList& dMassMT, const vector& Ur, const scalar Tc, const scalar pc, @@ -128,7 +128,7 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #ifdef NoRepository -# include "liquidEvaporation.C" +# include "LiquidEvaporation.C" #endif // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C index 06035d7224f..360f0b39262 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.C @@ -61,7 +61,7 @@ Foam::scalar Foam::NoPhaseChange<CloudType>::calculate const scalar, const scalar, const scalarField&, - const scalarList&, + scalarList&, const vector&, const scalar, const scalar, diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H index 92a9dd22e5d..d360e36d09e 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/NoPhaseChange/NoPhaseChange.H @@ -75,7 +75,7 @@ public: const scalar T, const scalar d, const scalarField& Xc, - const scalarList& dMassMT, + scalarList& dMassMT, const vector& Ur, const scalar Tc, const scalar pc, diff --git a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H index 22f12088b48..d0d40badc47 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/PhaseChangeModel/PhaseChangeModel/PhaseChangeModel.H @@ -141,7 +141,7 @@ public: const scalar T, const scalar d, const scalarField& Xc, - const scalarList& dMassMT, + scalarList& dMassMT, const vector& Ur, const scalar Tc, const scalar pc, -- GitLab