From 72ad8d5cc4abf24ad6922aa4e8e3a02a4735973a Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 27 Aug 2010 13:31:12 +0100 Subject: [PATCH 01/50] BUG: removed todo items form headers - show up in doxygen --- src/OpenFOAM/db/dictionary/dictionary.H | 3 +-- src/mesh/blockMesh/curvedEdges/BSpline.H | 5 ++--- src/mesh/blockMesh/curvedEdges/CatmullRomSpline.H | 5 ++--- src/mesh/blockMesh/curvedEdges/polyLine.H | 1 - 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/src/OpenFOAM/db/dictionary/dictionary.H b/src/OpenFOAM/db/dictionary/dictionary.H index 7457d1e31f..bb5f186aad 100644 --- a/src/OpenFOAM/db/dictionary/dictionary.H +++ b/src/OpenFOAM/db/dictionary/dictionary.H @@ -38,8 +38,7 @@ Description dictionaries since, unlike the IOdictionary class, it does not use an objectRegistry itself to work. -ToDo - A merge() member function with a non-const dictionary parameter. + To add - a merge() member function with a non-const dictionary parameter? This would avoid unnecessary cloning in the add(entry*, bool) method. SourceFiles diff --git a/src/mesh/blockMesh/curvedEdges/BSpline.H b/src/mesh/blockMesh/curvedEdges/BSpline.H index 122d6e8a8c..93a8e75b43 100644 --- a/src/mesh/blockMesh/curvedEdges/BSpline.H +++ b/src/mesh/blockMesh/curvedEdges/BSpline.H @@ -47,12 +47,11 @@ Description segments. In rare cases (sections with very high curvatures), the resulting distribution may be sub-optimal. + A future implementation could also handle closed splines. + SeeAlso CatmullRomSpline -ToDo - A future implementation could also handle closed splines. - SourceFiles BSpline.C diff --git a/src/mesh/blockMesh/curvedEdges/CatmullRomSpline.H b/src/mesh/blockMesh/curvedEdges/CatmullRomSpline.H index 3726346f0f..b3ac25bc54 100644 --- a/src/mesh/blockMesh/curvedEdges/CatmullRomSpline.H +++ b/src/mesh/blockMesh/curvedEdges/CatmullRomSpline.H @@ -48,13 +48,12 @@ Description segments. In rare cases (sections with very high curvatures), the resulting distribution may be sub-optimal. + A future implementation could also handle closed splines. + SeeAlso http://www.algorithmist.net/catmullrom.html provides a nice introduction -ToDo - A future implementation could also handle closed splines. - SourceFiles CatmullRomSpline.C diff --git a/src/mesh/blockMesh/curvedEdges/polyLine.H b/src/mesh/blockMesh/curvedEdges/polyLine.H index 4014939e97..f44e61faf6 100644 --- a/src/mesh/blockMesh/curvedEdges/polyLine.H +++ b/src/mesh/blockMesh/curvedEdges/polyLine.H @@ -28,7 +28,6 @@ Description A series of straight line segments, which can also be interpreted as a series of control points for splines, etc. -ToDo A future implementation could also handle a closed polyLine. SourceFiles From 35354bab8dd65da9b5906cceafbe2329dba158a9 Mon Sep 17 00:00:00 2001 From: andy Date: Tue, 31 Aug 2010 10:02:13 +0100 Subject: [PATCH 02/50] BUG: Removed execution bits from tutorial input files --- tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs | 0 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p | 0 .../parcelInBox/constant/polyMesh/boundary | 0 10 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs mode change 100755 => 100644 tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p mode change 100755 => 100644 tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/polyMesh/boundary diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/T old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/U old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/alphaSgs old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/b old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/ft old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/fu old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/k old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/muSgs old mode 100755 new mode 100644 diff --git a/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p b/tutorials/combustion/fireFoam/les/smallPoolFire2D/0/p old mode 100755 new mode 100644 diff --git a/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/polyMesh/boundary b/tutorials/lagrangian/porousExplicitSourceReactingParcelFoam/parcelInBox/constant/polyMesh/boundary old mode 100755 new mode 100644 From 251a557d86402f8580a864cd155fd81658e9709c Mon Sep 17 00:00:00 2001 From: andy Date: Thu, 2 Sep 2010 12:39:34 +0100 Subject: [PATCH 03/50] ENH: Using local calcYPlusLam function instead of turbulence model version --- .../mutkRoughWallFunctionFvPatchScalarField.C | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C index ee7ba7ef80..d5e91dac83 100644 --- a/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C +++ b/src/turbulenceModels/compressible/RAS/derivedFvPatchFields/wallFunctions/mutWallFunctions/mutkRoughWallFunction/mutkRoughWallFunctionFvPatchScalarField.C @@ -94,7 +94,7 @@ tmp mutkRoughWallFunctionFvPatchScalarField::calcMut() const if (KsPlus > 2.25) { Edash /= fnRough(KsPlus, Cs_[faceI]); - yPlusLamNew = rasModel.yPlusLam(kappa_, Edash); + yPlusLamNew = calcYPlusLam(kappa_, Edash); } if (debug) From 470ef283a13386bcb6b3fdb89261914f1b37fd56 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 6 Sep 2010 11:42:55 +0100 Subject: [PATCH 04/50] ENH: Added SLGThermo class - container for solid, liquid and gas thermos --- src/thermophysicalModels/SLGThermo/Make/files | 3 + .../SLGThermo/Make/options | 12 + .../SLGThermo/SLGThermo/SLGThermo.C | 248 ++++++++++++++++++ .../SLGThermo/SLGThermo/SLGThermo.H | 160 +++++++++++ 4 files changed, 423 insertions(+) create mode 100644 src/thermophysicalModels/SLGThermo/Make/files create mode 100644 src/thermophysicalModels/SLGThermo/Make/options create mode 100644 src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C create mode 100644 src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H diff --git a/src/thermophysicalModels/SLGThermo/Make/files b/src/thermophysicalModels/SLGThermo/Make/files new file mode 100644 index 0000000000..0549b92c68 --- /dev/null +++ b/src/thermophysicalModels/SLGThermo/Make/files @@ -0,0 +1,3 @@ +SLGThermo/SLGThermo.C + +LIB = $(FOAM_LIBBIN)/libSLGThermo diff --git a/src/thermophysicalModels/SLGThermo/Make/options b/src/thermophysicalModels/SLGThermo/Make/options new file mode 100644 index 0000000000..4a54dad0d4 --- /dev/null +++ b/src/thermophysicalModels/SLGThermo/Make/options @@ -0,0 +1,12 @@ +EXE_INC = \ + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude + +LIB_LIBS = \ + -lfiniteVolume diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C new file mode 100644 index 0000000000..468b870d86 --- /dev/null +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C @@ -0,0 +1,248 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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 "SLGThermo.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(SLGThermo, 0); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::SLGThermo::SLGThermo(const fvMesh& mesh, basicThermo& thermo) +: + MeshObject(mesh), + thermo_(thermo), + carrier_(NULL), + liquids_(NULL), + solids_(NULL) +{ + Info<< "Creating component thermo properties:" << endl; + + if (isA(thermo)) + { + basicMultiComponentMixtureNew& mcThermo = + dynamic_cast(thermo); + carrier_ = &mcThermo; + + Info<< " multi-component carrier - " << mcThermo.species().size() + << " species" << endl; + } + else + { + Info<< " single component carrier" << endl; + } + + if (thermo.found("liquids")) + { + liquids_ = liquidMixture::New(thermo.subDict("liquids")); + Info<< " liquids - " << liquids_->components().size() + << " components" << endl; + } + else + { + Info<< " no liquid components" << endl; + } + + if (thermo.found("solids")) + { + solids_ = solidMixture::New(thermo.subDict("solids")); + Info<< " solids - " << solids_->components().size() + << " components" << endl; + } + else + { + Info<< " no solid components" << endl; + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::SLGThermo::~SLGThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +const Foam::basicThermo& Foam::SLGThermo::thermo() const +{ + return thermo_; +} + + +const Foam::basicMultiComponentMixtureNew& Foam::SLGThermo::carrier() const +{ + if (carrier_ == NULL) + { + FatalErrorIn + ( + "const Foam::basicMultiComponentMixtureNew& " + "Foam::SLGThermo::carrier() const" + ) << "carrier requested, but object is not allocated" + << abort(FatalError); + } + + return *carrier_; +} + + +const Foam::liquidMixture& Foam::SLGThermo::liquids() const +{ + if (!liquids_.valid()) + { + FatalErrorIn + ( + "const Foam::liquidMixture& Foam::SLGThermo::liquids() const" + ) << "liquids requested, but object is not allocated" + << abort(FatalError); + } + + return liquids_(); +} + + +const Foam::solidMixture& Foam::SLGThermo::solids() const +{ + if (!solids_.valid()) + { + FatalErrorIn + ( + "const Foam::solidMixture& Foam::SLGThermo::solids() const" + ) << "solids requested, but object is not allocated" + << abort(FatalError); + } + + return solids_(); +} + + +Foam::label Foam::SLGThermo::carrierId +( + const word& cmptName, + bool allowNotfound +) const +{ + forAll(carrier().species(), i) + { + if (cmptName == carrier_->species()[i]) + { + return i; + } + } + + if (!allowNotfound) + { + FatalErrorIn + ( + "Foam::label Foam::SLGThermo::carrierId(const word&, bool) const" + ) << "Unknown carrier component " << cmptName + << ". Valid carrier components are:" << nl + << carrier_->species() << exit(FatalError); + } + + return -1; +} + + +Foam::label Foam::SLGThermo::liquidId +( + const word& cmptName, + bool allowNotfound +) const +{ + forAll(liquids().components(), i) + { + if (cmptName == liquids_->components()[i]) + { + return i; + } + } + + if (!allowNotfound) + { + FatalErrorIn + ( + "Foam::label Foam::SLGThermo::liquidId(const word&, bool) const" + ) << "Unknown liquid component " << cmptName << ". Valid liquids are:" + << nl << liquids_->components() << exit(FatalError); + } + + return -1; +} + + +Foam::label Foam::SLGThermo::solidId +( + const word& cmptName, + bool allowNotfound +) const +{ + forAll(solids().components(), i) + { + if (cmptName == solids_->components()[i]) + { + return i; + } + } + + if (!allowNotfound) + { + FatalErrorIn + ( + "Foam::label Foam::SLGThermo::solidId(const word&, bool) const" + ) << "Unknown solid component " << cmptName << ". Valid solids are:" + << nl << solids_->components() << exit(FatalError); + } + + return -1; +} + + +bool Foam::SLGThermo::hasMultiComponentCarrier() const +{ + return (carrier_ != NULL); +} + + +bool Foam::SLGThermo::hasLiquids() const +{ + return liquids_.valid(); +} + + +bool Foam::SLGThermo::hasSolids() const +{ + return solids_.valid(); +} + + +// ************************************************************************* // + diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H new file mode 100644 index 0000000000..91989a0123 --- /dev/null +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H @@ -0,0 +1,160 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 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::SLGThermo + +Description + Thermo package for (S)olids (L)iquids and (G)ases + Takes reference to thermo package, and provides: + - carrier : components of thermo - access to elemental properties + - liquids : liquid components - access to elemental properties + - solids : solid components - access to elemental properties + + If thermo is not a multi-component thermo package, carrier is NULL. + Similarly, if no liquids or solids are specified, their respective + pointers will also be NULL. + + Registered to the mesh so that it can be looked-up + +SourceFiles + SLGThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef SLGThermo_H +#define SLGThermo_H + +#include "MeshObject.H" +#include "basicThermo.H" +#include "basicMultiComponentMixtureNew.H" +#include "liquidMixture.H" +#include "solidMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class SLGThermo Declaration +\*---------------------------------------------------------------------------*/ + +class SLGThermo +: + public MeshObject +{ + // Private data + + //- Thermo package + basicThermo& thermo_; + + //- Reference to the multi-component carrier phase thermo + basicMultiComponentMixtureNew* carrier_; + + //- Additional liquid properties data + autoPtr liquids_; + + //- Additional solid properties data + autoPtr solids_; + + +public: + + //- Runtime type information + TypeName("SLGThermo"); + + // Constructors + + //- Construct from mesh + SLGThermo(const fvMesh& mesh, basicThermo& thermo); + + + //- Destructor + virtual ~SLGThermo(); + + + // Member Functions + + // Access + + //- Return reference to the thermo database + const basicThermo& thermo() const; + + //- Return reference to the gaseous components + const basicMultiComponentMixtureNew& carrier() const; + + //- Return reference to the global (additional) liquids + const liquidMixture& liquids() const; + + //- Return reference to the global (additional) solids + const solidMixture& solids() const; + + + // Index retrieval + + //- Index of carrier component + label carrierId + ( + const word& cmptName, + bool allowNotFound = false + ) const; + + //- Index of liquid component + label liquidId + ( + const word& cmptName, + bool allowNotFound = false + ) const; + + //- Index of solid component + label solidId + ( + const word& cmptName, + bool allowNotFound = false + ) const; + + + // Checks + + //- Thermo database has multi-component carrier flag + bool hasMultiComponentCarrier() const; + + //- Thermo database has liquid components flag + bool hasLiquids() const; + + //- Thermo database has solid components flag + bool hasSolids() const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // From 6e52ed3aac2566edcbb2924893ccd0fab2d32adc Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 6 Sep 2010 11:44:26 +0100 Subject: [PATCH 05/50] ENH: Added constGasThermoPhysics chemistry reader option --- .../chemistryReaders/chemistryReader/makeChemistryReaders.C | 1 + 1 file changed, 1 insertion(+) diff --git a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C index 70801f562a..faab787df6 100644 --- a/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C +++ b/src/thermophysicalModels/reactionThermo/chemistryReaders/chemistryReader/makeChemistryReaders.C @@ -36,6 +36,7 @@ namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +makeChemistryReader(constGasThermoPhysics); makeChemistryReader(gasThermoPhysics); makeChemistryReader(icoPoly8ThermoPhysics); From 6e14f61f7710c77e64369a4f8dbbc513bd749f66 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 6 Sep 2010 11:45:23 +0100 Subject: [PATCH 06/50] ENH: Opened up the API to give access to per specie info --- .../basicMultiComponentMixture.H | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H index f49bb2df80..daa3a70138 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/basicMultiComponentMixture/basicMultiComponentMixture.H @@ -117,6 +117,57 @@ public: const volScalarField& ft, const dimensionedScalar& stoicRatio ) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const = 0; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const = 0; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const = 0; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const = 0; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const = 0; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const = 0; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const = 0; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const = 0; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const = 0; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const = 0; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const = 0; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const = 0; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const = 0; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const = 0; }; From 9fa8cd63eb0337f6d040866e3408d1849c804175 Mon Sep 17 00:00:00 2001 From: andy Date: Mon, 6 Sep 2010 11:46:07 +0100 Subject: [PATCH 07/50] ENH: Implemented per specie info for mixtures --- .../mixtures/dieselMixture/dieselMixture.C | 185 +++++++++++++++++ .../mixtures/dieselMixture/dieselMixture.H | 54 +++++ .../mixtures/egrMixture/egrMixture.C | 185 +++++++++++++++++ .../mixtures/egrMixture/egrMixture.H | 54 +++++ .../homogeneousMixture/homogeneousMixture.C | 182 +++++++++++++++++ .../homogeneousMixture/homogeneousMixture.H | 54 +++++ .../inhomogeneousMixture.C | 186 ++++++++++++++++++ .../inhomogeneousMixture.H | 54 +++++ .../multiComponentMixture.C | 151 ++++++++++++++ .../multiComponentMixture.H | 51 +++++ .../veryInhomogeneousMixture.C | 186 ++++++++++++++++++ .../veryInhomogeneousMixture.H | 54 +++++ 12 files changed, 1396 insertions(+) diff --git a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C index d7d312735d..014ef3da51 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.C @@ -97,4 +97,189 @@ void Foam::dieselMixture::read(const dictionary& thermoDict) } +template +const ThermoType& Foam::dieselMixture::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::dieselMixture::getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template +Foam::scalar Foam::dieselMixture::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template +Foam::scalar Foam::dieselMixture::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template +Foam::scalar Foam::dieselMixture::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template +Foam::scalar Foam::dieselMixture::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template +Foam::scalar Foam::dieselMixture::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template +Foam::scalar Foam::dieselMixture::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template +Foam::scalar Foam::dieselMixture::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template +Foam::scalar Foam::dieselMixture::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template +Foam::scalar Foam::dieselMixture::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template +Foam::scalar Foam::dieselMixture::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template +Foam::scalar Foam::dieselMixture::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template +Foam::scalar Foam::dieselMixture::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template +Foam::scalar Foam::dieselMixture::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template +Foam::scalar Foam::dieselMixture::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H index b0b46a88cc..8625818a58 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/dieselMixture/dieselMixture.H @@ -151,6 +151,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C index 7ba65975e8..06cf80a47f 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.C @@ -107,4 +107,189 @@ void Foam::egrMixture::read(const dictionary& thermoDict) } +template +const ThermoType& Foam::egrMixture::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::egrMixture::getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template +Foam::scalar Foam::egrMixture::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template +Foam::scalar Foam::egrMixture::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template +Foam::scalar Foam::egrMixture::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template +Foam::scalar Foam::egrMixture::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template +Foam::scalar Foam::egrMixture::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template +Foam::scalar Foam::egrMixture::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template +Foam::scalar Foam::egrMixture::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template +Foam::scalar Foam::egrMixture::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template +Foam::scalar Foam::egrMixture::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template +Foam::scalar Foam::egrMixture::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template +Foam::scalar Foam::egrMixture::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template +Foam::scalar Foam::egrMixture::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template +Foam::scalar Foam::egrMixture::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template +Foam::scalar Foam::egrMixture::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H index 0a9adf6aa7..95de13f321 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/egrMixture/egrMixture.H @@ -167,6 +167,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C index 89878ed40c..eca7ffd0d5 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.C @@ -89,4 +89,186 @@ void Foam::homogeneousMixture::read(const dictionary& thermoDict) } +template +const ThermoType& Foam::homogeneousMixture::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return reactants_; + } + else if (specieI == 1) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::homogeneousMixture::" + "getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..1" + << abort(FatalError); + + return reactants_; + } +} + + +template +Foam::scalar Foam::homogeneousMixture::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template +Foam::scalar Foam::homogeneousMixture::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template +Foam::scalar Foam::homogeneousMixture::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template +Foam::scalar Foam::homogeneousMixture::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template +Foam::scalar Foam::homogeneousMixture::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H index b03e63d7c7..a1fd589c83 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/homogeneousMixture/homogeneousMixture.H @@ -125,6 +125,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C index 743aeff98b..2ef52c112d 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.C @@ -101,4 +101,190 @@ void Foam::inhomogeneousMixture::read(const dictionary& thermoDict) } +template +const ThermoType& Foam::inhomogeneousMixture::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::inhomogeneousMixture::" + "getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template +Foam::scalar Foam::inhomogeneousMixture::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template +Foam::scalar Foam::inhomogeneousMixture::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H index b4f9fc5f38..163052a848 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/inhomogeneousMixture/inhomogeneousMixture.H @@ -156,6 +156,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C index a8575e037c..a30dd5dd1b 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.C @@ -160,4 +160,155 @@ void Foam::multiComponentMixture::read } +template +Foam::scalar Foam::multiComponentMixture::nMoles +( + const label specieI +) const +{ + return speciesData_[specieI].nMoles(); +} + + +template +Foam::scalar Foam::multiComponentMixture::W +( + const label specieI +) const +{ + return speciesData_[specieI].W(); +} + + +template +Foam::scalar Foam::multiComponentMixture::Cp +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].Cp(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::Cv +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].Cv(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::H +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].H(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::Hs +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].Hs(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::Hc +( + const label specieI +) const +{ + return speciesData_[specieI].Hc(); +} + + +template +Foam::scalar Foam::multiComponentMixture::S +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].S(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::E +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].E(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::G +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].G(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::A +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].A(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::mu +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].mu(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::kappa +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].kappa(T); +} + + +template +Foam::scalar Foam::multiComponentMixture::alpha +( + const label specieI, + const scalar T +) const +{ + return speciesData_[specieI].alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H index 73d27f72cc..b388e9c411 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/multiComponentMixture/multiComponentMixture.H @@ -118,6 +118,57 @@ public: //- Read dictionary void read(const dictionary&); + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C index 9781890b1a..3684fc3e09 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.C @@ -102,4 +102,190 @@ void Foam::veryInhomogeneousMixture::read } +template +const ThermoType& Foam::veryInhomogeneousMixture::getLocalThermo +( + const label specieI +) const +{ + if (specieI == 0) + { + return fuel_; + } + else if (specieI == 1) + { + return oxidant_; + } + else if (specieI == 2) + { + return products_; + } + else + { + FatalErrorIn + ( + "const ThermoType& Foam::veryInhomogeneousMixture::" + "getLocalThermo" + "(" + "const label " + ") const" + ) << "Unknown specie index " << specieI << ". Valid indices are 0..2" + << abort(FatalError); + + return fuel_; + } +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::nMoles +( + const label specieI +) const +{ + return getLocalThermo(specieI).nMoles(); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::W +( + const label specieI +) const +{ + return getLocalThermo(specieI).W(); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::Cp +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cp(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::Cv +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Cv(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::H +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).H(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::Hs +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).Hs(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::Hc +( + const label specieI +) const +{ + return getLocalThermo(specieI).Hc(); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::S +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).S(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::E +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).E(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::G +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).G(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::A +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).A(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::mu +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).mu(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::kappa +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).kappa(T); +} + + +template +Foam::scalar Foam::veryInhomogeneousMixture::alpha +( + const label specieI, + const scalar T +) const +{ + return getLocalThermo(specieI).alpha(T); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H index f58335f4e4..1ae7a36985 100644 --- a/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H +++ b/src/thermophysicalModels/reactionThermo/mixtures/veryInhomogeneousMixture/veryInhomogeneousMixture.H @@ -157,6 +157,60 @@ public: //- Read dictionary void read(const dictionary&); + + //- Return thermo based on index + const ThermoType& getLocalThermo(const label specieI) const; + + + // Per specie properties + + //- Number of moles [] + virtual scalar nMoles(const label specieI) const; + + //- Molecular weight [kg/kmol] + virtual scalar W(const label specieI) const; + + + // Per specie thermo properties + + //- Heat capacity at constant pressure [J/(kg K)] + virtual scalar Cp(const label specieI, const scalar T) const; + + //- Heat capacity at constant volume [J/(kg K)] + virtual scalar Cv(const label specieI, const scalar T) const; + + //- Enthalpy [J/kg] + virtual scalar H(const label specieI, const scalar T) const; + + //- Sensible enthalpy [J/kg] + virtual scalar Hs(const label specieI, const scalar T) const; + + //- Chemical enthalpy [J/kg] + virtual scalar Hc(const label specieI) const; + + //- Entropy [J/(kg K)] + virtual scalar S(const label specieI, const scalar T) const; + + //- Internal energy [J/kg] + virtual scalar E(const label specieI, const scalar T) const; + + //- Gibbs free energy [J/kg] + virtual scalar G(const label specieI, const scalar T) const; + + //- Helmholtz free energy [J/kg] + virtual scalar A(const label specieI, const scalar T) const; + + + // Per specie transport properties + + //- Dynamic viscosity [kg/m/s] + virtual scalar mu(const label specieI, const scalar T) const; + + //- Thermal conductivity [W/m/K] + virtual scalar kappa(const label specieI, const scalar T) const; + + //- Thermal diffusivity [kg/m/s] + virtual scalar alpha(const label specieI, const scalar T) const; }; From 44c71d5537d9571b2b5366dc2662ca99e10612ac Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Sep 2010 12:26:10 +0100 Subject: [PATCH 08/50] BUG: having patchnames with uncached mesh --- .../PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C index a73b46621e..54a1ac778a 100644 --- a/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C +++ b/applications/utilities/postProcessing/graphics/PV3Readers/PV3FoamReader/vtkPV3Foam/vtkPV3Foam.C @@ -620,6 +620,11 @@ double* Foam::vtkPV3Foam::findTimes(int& nTimeSteps) void Foam::vtkPV3Foam::renderPatchNames(vtkRenderer* renderer, const bool show) { + if (!meshPtr_) + { + return; + } + // always remove old actors first forAll(patchTextActorsPtrs_, patchI) From 2285298921e650dd29d42a88ca79ab73cb3f8b0d Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Sep 2010 12:26:25 +0100 Subject: [PATCH 09/50] STYLE: README : misspelled date --- .../incompressible/pimpleFoam/t-junction-with-fan/README.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/README.txt b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/README.txt index fd3f970be5..0ef40d8110 100644 --- a/tutorials/incompressible/pimpleFoam/t-junction-with-fan/README.txt +++ b/tutorials/incompressible/pimpleFoam/t-junction-with-fan/README.txt @@ -1,3 +1,3 @@ -300-04-16 T-junction with baffles and fan. +2010-04-16 T-junction with baffles and fan. Inlet on left, one outlet at bottom, one at top. To test multiple outlets. From 97dff2650ee9598156560daf458b7a57d7205851 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 6 Sep 2010 17:02:35 +0100 Subject: [PATCH 10/50] ENH: foamToVTK : have surface fields on faceZones --- .../dataConversion/foamToVTK/Make/files | 3 +- .../dataConversion/foamToVTK/foamToVTK.C | 65 ++++++-- .../{writePatchGeom.C => surfaceMeshWriter.C} | 61 ++++---- .../foamToVTK/surfaceMeshWriter.H | 141 ++++++++++++++++++ .../foamToVTK/surfaceMeshWriterTemplates.C | 84 +++++++++++ .../dataConversion/foamToVTK/writePatchGeom.H | 62 -------- 6 files changed, 309 insertions(+), 107 deletions(-) rename applications/utilities/postProcessing/dataConversion/foamToVTK/{writePatchGeom.C => surfaceMeshWriter.C} (59%) create mode 100644 applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.H create mode 100644 applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriterTemplates.C delete mode 100644 applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.H diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/files b/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/files index 23c2c6738c..2c10cfe303 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/files +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/Make/files @@ -1,9 +1,10 @@ +surfaceMeshWriter.C + foamToVTK.C internalWriter.C lagrangianWriter.C patchWriter.C writeFuns.C -writePatchGeom.C writeFaceSet.C writePointSet.C writeSurfFields.C diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index 2b82a234ba..272307588a 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -157,7 +157,7 @@ Note #include "writeFaceSet.H" #include "writePointSet.H" -#include "writePatchGeom.H" +#include "surfaceMeshWriter.H" #include "writeSurfFields.H" @@ -963,20 +963,42 @@ int main(int argc, char *argv[]) if (doFaceZones) { + PtrList ssf; + readFields + ( + vMesh, + vMesh.baseMesh(), + objects, + selectedFields, + ssf + ); + print(" surfScalarFields :", Info, ssf); + + PtrList svf; + readFields + ( + vMesh, + vMesh.baseMesh(), + objects, + selectedFields, + svf + ); + print(" surfVectorFields :", Info, svf); + const faceZoneMesh& zones = mesh.faceZones(); forAll(zones, zoneI) { - const faceZone& pp = zones[zoneI]; + const faceZone& fz = zones[zoneI]; - mkDir(fvPath/pp.name()); + mkDir(fvPath/fz.name()); fileName patchFileName; if (vMesh.useSubMesh()) { patchFileName = - fvPath/pp.name()/cellSetName + fvPath/fz.name()/cellSetName + "_" + timeDesc + ".vtk"; @@ -984,7 +1006,7 @@ int main(int argc, char *argv[]) else { patchFileName = - fvPath/pp.name()/pp.name() + fvPath/fz.name()/fz.name() + "_" + timeDesc + ".vtk"; @@ -992,18 +1014,31 @@ int main(int argc, char *argv[]) Info<< " FaceZone : " << patchFileName << endl; - std::ofstream ostr(patchFileName.c_str()); - - writeFuns::writeHeader(ostr, binary, pp.name()); - ostr<< "DATASET POLYDATA" << std::endl; - - writePatchGeom + indirectPrimitivePatch pp ( - binary, - pp().localFaces(), - pp().localPoints(), - ostr + IndirectList(mesh.faces(), fz), + mesh.points() ); + + surfaceMeshWriter writer + ( + vMesh, + binary, + pp, + fz.name(), + patchFileName + ); + + // Number of fields + writeFuns::writeCellDataHeader + ( + writer.os(), + pp.size(), + ssf.size()+svf.size() + ); + + writer.write(ssf); + writer.write(svf); } } diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.C similarity index 59% rename from applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C rename to applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.C index 0dd2bd9200..d947eb3de3 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/writePatchGeom.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/surfaceMeshWriter.C @@ -23,60 +23,63 @@ License \*---------------------------------------------------------------------------*/ -#include "writePatchGeom.H" -#include "OFstream.H" -#include "floatScalar.H" +#include "surfaceMeshWriter.H" #include "writeFuns.H" -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -namespace Foam -{ - -// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * // - -void writePatchGeom +Foam::surfaceMeshWriter::surfaceMeshWriter ( + const vtkMesh& vMesh, const bool binary, - const faceList& faces, - const pointField& points, - std::ofstream& ostr + const indirectPrimitivePatch& pp, + const word& name, + const fileName& fName ) +: + vMesh_(vMesh), + binary_(binary), + pp_(pp), + fName_(fName), + os_(fName.c_str()) { - ostr<< "POINTS " << points.size() << " float" << std::endl; - - DynamicList ptField(3*points.size()); - - writeFuns::insert(points, ptField); - - writeFuns::write(ostr, binary, ptField); + // Write header + writeFuns::writeHeader(os_, binary_, name); + os_ << "DATASET POLYDATA" << std::endl; + // Write topology label nFaceVerts = 0; - forAll(faces, faceI) + forAll(pp, faceI) { - nFaceVerts += faces[faceI].size() + 1; + nFaceVerts += pp[faceI].size() + 1; } - ostr<< "POLYGONS " << faces.size() << ' ' << nFaceVerts << std::endl; + os_ << "POINTS " << pp.nPoints() << " float" << std::endl; + + DynamicList ptField(3*pp.nPoints()); + writeFuns::insert(pp.localPoints(), ptField); + writeFuns::write(os_, binary, ptField); + + + os_ << "POLYGONS " << pp.size() << ' ' << nFaceVerts << std::endl; DynamicList