diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options index 71580ca21d..636fc5d8bb 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/Make/options @@ -5,6 +5,7 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options index a255d65f6c..599e1e7502 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/Make/options @@ -7,6 +7,7 @@ EXE_INC = \ -I$(LIB_SRC)/finiteVolume/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \ -I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \ diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H index 1e78cc297a..179480249d 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/chtMultiRegionSimpleFoam/solid/setRegionSolidFields.H @@ -4,7 +4,7 @@ tmp trho = thermo.rho(); const volScalarField& rho = trho(); - tmp tcp = thermo.cp(); + tmp tcp = thermo.Cp(); const volScalarField& cp = tcp(); tmp tK = thermo.K(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H index 1e78cc297a..a843ed8bd7 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/setRegionSolidFields.H @@ -4,11 +4,12 @@ tmp trho = thermo.rho(); const volScalarField& rho = trho(); - tmp tcp = thermo.cp(); + tmp tcp = thermo.Cp(); const volScalarField& cp = tcp(); tmp tK = thermo.K(); //tmp tK = thermo.directionalK(); const volScalarField& K = tK(); + //const volSymmTensorField& K = tK(); volScalarField& T = thermo.T(); diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C index c0a5277e88..322628b9ec 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.C @@ -55,4 +55,35 @@ Foam::scalar Foam::solidRegionDiffNo } +Foam::scalar Foam::solidRegionDiffNo +( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& Cprho, + const volSymmTensorField& Kdirectional +) +{ + scalar DiNum = 0.0; + scalar meanDiNum = 0.0; + + volScalarField K = mag(Kdirectional); + + //- Take care: can have fluid domains with 0 cells so do not test for + // zero internal faces. + surfaceScalarField KrhoCpbyDelta = + mesh.surfaceInterpolation::deltaCoeffs() + * fvc::interpolate(K) + / fvc::interpolate(Cprho); + + DiNum = gMax(KrhoCpbyDelta.internalField())*runTime.deltaT().value(); + + meanDiNum = (average(KrhoCpbyDelta)).value()*runTime.deltaT().value(); + + Info<< "Region: " << mesh.name() << " Diffusion Number mean: " << meanDiNum + << " max: " << DiNum << endl; + + return DiNum; +} + + // ************************************************************************* // diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H index 333ef7a3eb..afb21252ac 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solidRegionDiffNo.H @@ -41,6 +41,15 @@ namespace Foam const volScalarField& Cprho, const volScalarField& K ); + + scalar solidRegionDiffNo + ( + const fvMesh& mesh, + const Time& runTime, + const volScalarField& Cprho, + const volSymmTensorField& K + ); + } #endif diff --git a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H index 05b26d1626..d8aa03283b 100644 --- a/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H +++ b/applications/solvers/heatTransfer/chtMultiRegionFoam/solid/solveSolid.H @@ -18,6 +18,8 @@ if (finalIter) Info<< "Min/max T:" << min(T) << ' ' << max(T) << endl; } +thermo.correct(); + if (finalIter) { mesh.data::remove("finalIteration"); diff --git a/applications/solvers/lagrangian/coalChemistryFoam/Make/options b/applications/solvers/lagrangian/coalChemistryFoam/Make/options index c6daa2b570..329dffc84d 100644 --- a/applications/solvers/lagrangian/coalChemistryFoam/Make/options +++ b/applications/solvers/lagrangian/coalChemistryFoam/Make/options @@ -10,8 +10,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -33,8 +33,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options index 6e117fc63b..7596b87bbd 100644 --- a/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/porousExplicitSourceReactingParcelFoam/Make/options @@ -10,8 +10,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -32,8 +32,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options index 230a08dfad..34867be0b4 100644 --- a/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFilmFoam/Make/options @@ -5,8 +5,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solids/lnInclude \ - -I$(LIB_SRC)/thermophysicalModels/solidMixture/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquids/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/liquidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ @@ -26,8 +26,8 @@ EXE_LIBS = \ -lcompressibleLESModels \ -lspecie \ -lbasicThermophysicalModels \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/reactingParcelFoam/Make/options b/applications/solvers/lagrangian/reactingParcelFoam/Make/options index 3954a34ea3..2dbb2590f7 100644 --- a/applications/solvers/lagrangian/reactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/reactingParcelFoam/Make/options @@ -9,8 +9,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -31,8 +31,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options b/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options index 6e117fc63b..7596b87bbd 100644 --- a/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options +++ b/applications/solvers/lagrangian/steadyReactingParcelFoam/Make/options @@ -10,8 +10,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/thermophysicalFunctions/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ @@ -32,8 +32,8 @@ EXE_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lthermophysicalFunctions \ -lreactionThermophysicalModels \ -lSLGThermo \ diff --git a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options index b43dc7a7d1..804d519386 100644 --- a/applications/utilities/miscellaneous/foamDebugSwitches/Make/options +++ b/applications/utilities/miscellaneous/foamDebugSwitches/Make/options @@ -47,9 +47,9 @@ EXE_LIBS = \ -lrandomProcesses \ -lreactionThermophysicalModels \ -lsampling \ - -lsolidMixture \ + -lpointSolidMixture \ -lsolidParticle \ - -lsolids \ + -lpointSolids \ -lspecie \ -lsurfMesh \ -lsystemCall \ diff --git a/src/lagrangian/coalCombustion/Make/options b/src/lagrangian/coalCombustion/Make/options index 2dabd03766..763b6cc248 100644 --- a/src/lagrangian/coalCombustion/Make/options +++ b/src/lagrangian/coalCombustion/Make/options @@ -8,8 +8,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ @@ -30,8 +30,8 @@ LIB_LIBS = \ -lbasicThermophysicalModels \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lreactionThermophysicalModels \ -lSLGThermo \ -lcompressibleRASModels \ diff --git a/src/lagrangian/intermediate/Make/options b/src/lagrangian/intermediate/Make/options index 7a20845453..db20632300 100644 --- a/src/lagrangian/intermediate/Make/options +++ b/src/lagrangian/intermediate/Make/options @@ -7,8 +7,8 @@ EXE_INC = \ -I$(LIB_SRC)/thermophysicalModels/basic/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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/radiation/lnInclude \ @@ -27,8 +27,8 @@ LIB_LIBS = \ -lpdf \ -lliquids \ -lliquidMixture \ - -lsolids \ - -lsolidMixture \ + -lpointSolids \ + -lpointSolidMixture \ -lspecie \ -lbasicThermophysicalModels \ -lreactionThermophysicalModels \ diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C index 6cf80b2c17..2e88774afa 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.C @@ -100,7 +100,7 @@ const Foam::liquidMixture& Foam::CompositionModel::liquids() const template -const Foam::solidMixture& Foam::CompositionModel::solids() const +const Foam::pointSolidMixture& Foam::CompositionModel::solids() const { return thermo_.solids(); } diff --git a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H index 7becea4551..74a4a87a20 100644 --- a/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H +++ b/src/lagrangian/intermediate/submodels/Reacting/CompositionModel/CompositionModel/CompositionModel.H @@ -143,7 +143,7 @@ public: const liquidMixture& liquids() const; //- Return the global (additional) solids - const solidMixture& solids() const; + const pointSolidMixture& solids() const; //- Return the list of phase properties const phasePropertiesList& phaseProps() const; diff --git a/src/surfaceFilmModels/Make/options b/src/surfaceFilmModels/Make/options index bd04197ec3..3b0199a09b 100644 --- a/src/surfaceFilmModels/Make/options +++ b/src/surfaceFilmModels/Make/options @@ -5,8 +5,8 @@ EXE_INC = \ -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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/SLGThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/pdfs/lnInclude \ diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake index 07ac10719b..7b1b586b56 100755 --- a/src/thermophysicalModels/Allwmake +++ b/src/thermophysicalModels/Allwmake @@ -3,11 +3,12 @@ cd ${0%/*} || exit 1 # run from this directory set -x wmake libso specie +wmake libso solid wmake libso thermophysicalFunctions wmake libso liquids wmake libso liquidMixture -wmake libso solids -wmake libso solidMixture +wmake libso pointSolids +wmake libso pointSolidMixture wmake libso basic wmake libso reactionThermo diff --git a/src/thermophysicalModels/SLGThermo/Make/options b/src/thermophysicalModels/SLGThermo/Make/options index 4a54dad0d4..6121f1c83e 100644 --- a/src/thermophysicalModels/SLGThermo/Make/options +++ b/src/thermophysicalModels/SLGThermo/Make/options @@ -4,8 +4,8 @@ EXE_INC = \ -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/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/pointSolidMixture/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude LIB_LIBS = \ diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C index 5eb9dffedc..ce9048a5ac 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.C @@ -72,7 +72,7 @@ Foam::SLGThermo::SLGThermo(const fvMesh& mesh, basicThermo& thermo) if (thermo.found("solids")) { - solids_ = solidMixture::New(thermo.subDict("solids")); + solids_ = pointSolidMixture::New(thermo.subDict("solids")); Info<< " solids - " << solids_->components().size() << " components" << endl; } @@ -128,13 +128,13 @@ const Foam::liquidMixture& Foam::SLGThermo::liquids() const } -const Foam::solidMixture& Foam::SLGThermo::solids() const +const Foam::pointSolidMixture& Foam::SLGThermo::solids() const { if (!solids_.valid()) { FatalErrorIn ( - "const Foam::solidMixture& Foam::SLGThermo::solids() const" + "const Foam::pointSolidtMixture& Foam::SLGThermo::solids() const" ) << "solids requested, but object is not allocated" << abort(FatalError); } diff --git a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H index 36fb8f3bb3..f4ba8299a8 100644 --- a/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H +++ b/src/thermophysicalModels/SLGThermo/SLGThermo/SLGThermo.H @@ -49,7 +49,7 @@ SourceFiles #include "basicThermo.H" #include "basicMultiComponentMixture.H" #include "liquidMixture.H" -#include "solidMixture.H" +#include "pointSolidMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -76,7 +76,7 @@ class SLGThermo autoPtr liquids_; //- Additional solid properties data - autoPtr solids_; + autoPtr solids_; public: @@ -108,7 +108,7 @@ public: const liquidMixture& liquids() const; //- Return reference to the global (additional) solids - const solidMixture& solids() const; + const pointSolidMixture& solids() const; // Index retrieval diff --git a/src/thermophysicalModels/basicSolidThermo/Make/files b/src/thermophysicalModels/basicSolidThermo/Make/files index e550ce2035..c5e9c11d42 100644 --- a/src/thermophysicalModels/basicSolidThermo/Make/files +++ b/src/thermophysicalModels/basicSolidThermo/Make/files @@ -1,7 +1,13 @@ -constSolidThermo/constSolidThermo.C -directionalSolidThermo/directionalSolidThermo.C basicSolidThermo/basicSolidThermo.C -basicSolidThermo/basicSolidThermoNew.C +basicSolidThermo/newBasicSolidThermo.C + +constSolidThermo/constSolidThermo.C +directionalKSolidThermo/directionalKSolidThermo.C interpolatedSolidThermo/interpolatedSolidThermo.C +interpolatedSolidThermo/interpolateSolid/interpolateSolid.C +isotropicKSolidThermo/isotropicKSolidThermo.C + +solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C +solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C LIB = $(FOAM_LIBBIN)/libbasicSolidThermo diff --git a/src/thermophysicalModels/basicSolidThermo/Make/options b/src/thermophysicalModels/basicSolidThermo/Make/options index f3070a731e..e2cff82d80 100644 --- a/src/thermophysicalModels/basicSolidThermo/Make/options +++ b/src/thermophysicalModels/basicSolidThermo/Make/options @@ -1,7 +1,10 @@ EXE_INC = \ -I$(LIB_SRC)/meshTools/lnInclude \ - -I$(LIB_SRC)/finiteVolume/lnInclude + -I$(LIB_SRC)/finiteVolume/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude LIB_LIBS = \ -lmeshTools \ - -lfiniteVolume + -lfiniteVolume \ + -lsolid diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C index e0c65a91d7..2888eeea17 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,10 +23,11 @@ License \*---------------------------------------------------------------------------*/ - #include "basicSolidThermo.H" +#include "fvMesh.H" +#include "HashTable.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ namespace Foam { @@ -34,6 +35,7 @@ namespace Foam defineRunTimeSelectionTable(basicSolidThermo, mesh); } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) @@ -45,7 +47,7 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) "solidThermophysicalProperties", mesh.time().constant(), mesh, - IOobject::MUST_READ_IF_MODIFIED, + IOobject::MUST_READ, IOobject::NO_WRITE ) ), @@ -61,7 +63,60 @@ Foam::basicSolidThermo::basicSolidThermo(const fvMesh& mesh) IOobject::AUTO_WRITE ), mesh + ), + rho_ + ( + IOobject + ( + "rho", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimMass/dimVolume + ), + kappa_ + ( + IOobject + ( + "kappa", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless/dimLength + ), + sigmaS_ + ( + IOobject + ( + "sigmaS", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless/dimLength + ), + emissivity_ + ( + IOobject + ( + "emissivity", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimless ) + {} @@ -73,6 +128,117 @@ Foam::basicSolidThermo::~basicSolidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +Foam::volScalarField& Foam::basicSolidThermo::T() +{ + return T_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::T() const +{ + return T_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::rho() const +{ + return rho_; +} + + +Foam::volScalarField& Foam::basicSolidThermo::rho() +{ + return rho_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::kappa() const +{ + return kappa_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::sigmaS() const +{ + return sigmaS_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::emissivity() const +{ + return emissivity_; +} + + +const Foam::volScalarField& Foam::basicSolidThermo::K() const +{ + notImplemented("basicSolidThermo::K()"); + return volScalarField::null(); +} + + +const Foam::volSymmTensorField& Foam::basicSolidThermo::directionalK() const +{ + notImplemented("basicSolidThermo::directionalK()"); + return const_cast(volSymmTensorField::null()); +} + + +Foam::basicSolidMixture& Foam::basicSolidThermo::composition() +{ + notImplemented("basicSolidThermo::composition()"); + return *reinterpret_cast(0); +} + + +const Foam::basicSolidMixture& Foam::basicSolidThermo::composition() const +{ + notImplemented("basicSolidThermo::composition() const"); + return *reinterpret_cast(0); +} + + +Foam::tmp Foam::basicSolidThermo::hs() const +{ + notImplemented("basicSolidThermo::hs()"); + return volScalarField::null(); +} + + +Foam::tmp Foam::basicSolidThermo::hs(const label patchI) +const +{ + notImplemented("basicSolidThermo::hs(const label)"); + return scalarField::null(); +} + + +Foam::tmp Foam::basicSolidThermo::K +( + const label patchI +)const +{ + notImplemented("basicSolidThermo::K(const label)"); + return scalarField::null(); +} + + +Foam::tmp Foam::basicSolidThermo::directionalK +( + const label +)const +{ + notImplemented("basicSolidThermo::directionalK(const label)"); + return symmTensorField::null(); +} + + +bool Foam::basicSolidThermo::read() +{ + return regIOobject::read(); +} + + bool Foam::basicSolidThermo::writeData(Ostream& os) const { return true; diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H index ddd2750668..cc12c10e11 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,20 +25,24 @@ Class Foam::basicSolidThermo Description - The thermophysical properties of a basicSolidThermo + + Basic solid thermodynamic properties SourceFiles basicSolidThermo.C - newBasicSolidThermo.C + newBasicThermo.C \*---------------------------------------------------------------------------*/ #ifndef basicSolidThermo_H #define basicSolidThermo_H -#include "runTimeSelectionTables.H" #include "volFields.H" +#include "runTimeSelectionTables.H" #include "fvMesh.H" +#include "IOdictionary.H" +#include "autoPtr.H" +#include "basicSolidMixture.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -46,21 +50,36 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class basicSolidThermo Declaration + Class basicSolidThermo Declaration \*---------------------------------------------------------------------------*/ class basicSolidThermo : public IOdictionary { + protected: // Protected data const fvMesh& mesh_; - //- Temperature [K] - volScalarField T_; + // Fields + + //- Temperature [K] + volScalarField T_; + + //- Density [kg/m3] + volScalarField rho_; + + //- Absorption coefficient [1/m] + volScalarField kappa_; + + //- Scatter coeffcient [1/m] + volScalarField sigmaS_; + + //- Emissivity coeffcient [] + volScalarField emissivity_; public: @@ -68,8 +87,7 @@ public: //- Runtime type information TypeName("basicSolidThermo"); - - //- Declare run-time constructor selection tables + // Declare run-time constructor selection tables declareRunTimeSelectionTable ( autoPtr, @@ -91,100 +109,106 @@ public: //- Destructor - virtual ~basicSolidThermo(); + + virtual ~basicSolidThermo(); - // Member Functions + // Member functions //- Update properties virtual void correct() = 0; + //- Return the composition of the solid mixture + virtual basicSolidMixture& composition(); - // Physical constants which define the basicSolidThermo + //- Return the composition of the solid mixture + virtual const basicSolidMixture& composition() const; + + + // Access to thermodynamic state variables + + //- Density [kg/m^3] + const volScalarField& rho() const; + + //- Thermal conductivity [W/m/K] + virtual const volScalarField& K() const; + + //- Thermal conductivity [W/m/K] + virtual const volSymmTensorField& directionalK() const; + + //- Absorption coefficient [1/m] + const volScalarField& kappa() const; + + //- Emissivity coefficient + const volScalarField& sigmaS() const; + + //- Emissivity coefficient [1/m] + const volScalarField& emissivity() const; //- Temperature [K] - inline const volScalarField& T() const; + const volScalarField& T() const; - //- Temperature [K] - inline volScalarField& T(); + //- non-const access for T + volScalarField& T(); - //- Density [kg/m3] - virtual tmp rho() const = 0; + //- non-const access for rho + volScalarField& rho(); - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp() const = 0; - //- Thermal conductivity [W/(m.K)] - virtual tmp K() const = 0; + // Derived thermal properties - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK() const = 0; + //- Specific heat capacity [J/kg/K] + virtual tmp Cp() const = 0; - //- Heat of formation [J/kg] + //- Sensible enthalpy [J/kg] + virtual tmp hs() const; + + //- Heat of formation [J/kg] virtual tmp Hf() const = 0; + + // Per patch calculation + + //- Density [kg/m3] + virtual tmp rho(const label patchI) const = 0; + + //- Specific heat capacity [J/kg/K)] + virtual tmp Cp(const label patchI) const = 0; + + //- Sensible enthalpy [J/kg] + virtual tmp hs(const label patchI) const; + + //- Thermal conductivity [W//m/K] + virtual tmp K(const label patchI) const; + + //- Thermal conductivity [W//m/K] + virtual tmp directionalK(const label) const; + + //- Heat of formation [J/kg] + virtual tmp Hf(const label patchI) const = 0; + + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label) const = 0; + + //- Absorption coefficient [1/m] + virtual tmp kappa(const label) const = 0; + //- Emissivity [] - virtual tmp emissivity() const = 0; + virtual tmp emissivity(const label) const = 0; + // I-O - // Per patch calculation - - //- Density [kg/m3] - virtual tmp rho(const label patchI) const = 0; - - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp(const label patchI) const = 0; - - //- Thermal conductivity [W/(m.K)] - virtual tmp K(const label patchI) const = 0; - - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK(const label) const =0; - - //- Heat of formation [J/kg] - virtual tmp Hf(const label patchI) const = 0; - - //- Emissivity [] - virtual tmp emissivity(const label) const = 0; - - -// // Point wise properties -// -// //- Density [kg/m3] -// virtual scalar rho(const scalar T) const = 0; -// -// //- Specific heat capacity [J/(kg.K)] -// virtual scalar cp(const scalar T) const = 0; -// -// //- Thermal conductivity [W/(m.K)] -// virtual scalar K(const scalar T) const = 0; -// -// //- Heat of formation [J/kg] -// virtual scalar Hf(const scalar T) const = 0; -// -// //- Emissivity [] -// virtual scalar emissivity(const scalar T) const = 0; - - - // I-O - - //- Write the basicSolidThermo properties - virtual bool writeData(Ostream& os) const = 0; - - //- Read solidThermophysicalProperties dictionary - virtual bool read() = 0; + //- Write the basicSolidThermo properties + virtual bool writeData(Ostream& os) const = 0; + //- Read thermophysicalProperties dictionary + virtual bool read() = 0; // Ostream Operator - friend Ostream& operator<<(Ostream& os, const basicSolidThermo& s); }; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#include "basicSolidThermoI.H" - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C index 34d3400a03..a398516f2a 100644 --- a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/basicSolidThermoNew.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License diff --git a/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C new file mode 100644 index 0000000000..b308cfea1e --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/basicSolidThermo/newBasicSolidThermo.C @@ -0,0 +1,77 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "basicSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::basicSolidThermo::New +( + const fvMesh& mesh +) +{ + if (debug) + { + Info<< "basicSolidThermo::New(const fvMesh&): " + << "constructing basicSolidThermo" + << endl; + } + + const word thermoType + ( + IOdictionary + ( + IOobject + ( + "solidThermophysicalProperties", + mesh.time().constant(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE, + false + ) + ).lookup("thermoType") + ); + + meshConstructorTable::iterator cstrIter = + meshConstructorTablePtr_->find(thermoType); + + if (cstrIter == meshConstructorTablePtr_->end()) + { + FatalErrorIn + ( + "basicSolidThermo::New(const fvMesh&, const word&)" + ) << "Unknown solidThermo type " << thermoType + << endl << endl + << "Valid solidThermo types are :" << endl + << meshConstructorTablePtr_->toc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(mesh)); +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C index 0f9f65d2b0..abe9b7c5d0 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -40,14 +40,39 @@ namespace Foam Foam::constSolidThermo::constSolidThermo(const fvMesh& mesh) : basicSolidThermo(mesh), - constRho_("zero", dimDensity, 0.0), - constCp_("zero", dimEnergy/(dimMass*dimTemperature), 0.0), - constK_("zero", dimEnergy/dimTime/(dimLength*dimTemperature), 0.0), - constHf_("zero", dimEnergy/dimMass, 0.0), - constEmissivity_("zero", dimless, 0.0) + dict_(subDict(typeName + "Coeffs")), + constK_(dimensionedScalar(dict_.lookup("K"))), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + constK_ + ), + constRho_(dimensionedScalar(dict_.lookup("rho"))), + constCp_(dimensionedScalar(dict_.lookup("Cp"))), + constHf_(dimensionedScalar(dict_.lookup("Hf"))), + constEmissivity_(dimensionedScalar(dict_.lookup("emissivity"))), + constKappa_(dimensionedScalar(dict_.lookup("kappa"))), + constSigmaS_(dimensionedScalar(dict_.lookup("sigmaS"))) { read(); - correct(); + + K_ = constK_; + + rho_ = constRho_; + + emissivity_ = constEmissivity_; + + kappa_ = constKappa_; + + sigmaS_ = constSigmaS_; } @@ -63,7 +88,7 @@ void Foam::constSolidThermo::correct() {} -Foam::tmp Foam::constSolidThermo::rho() const +Foam::tmp Foam::constSolidThermo::Cp() const { return tmp ( @@ -71,28 +96,7 @@ Foam::tmp Foam::constSolidThermo::rho() const ( IOobject ( - "rho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - constRho_ - ) - ); -} - - -Foam::tmp Foam::constSolidThermo::cp() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "cp", + "Cp", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -105,79 +109,13 @@ Foam::tmp Foam::constSolidThermo::cp() const } -//Foam::tmp Foam::constSolidThermo::K() const -//{ -// vector v(eigenValues(constK_.value())); -// -// if (mag(v.x() - v.z()) > SMALL) -// { -// FatalErrorIn("directionalSolidThermo::K() const") -// << "Supplied K " << constK_ -// << " are not isotropic. Eigenvalues are " -// << v << exit(FatalError); -// } -// -// return tmp -// ( -// new volScalarField -// ( -// IOobject -// ( -// "K", -// mesh_.time().timeName(), -// mesh_, -// IOobject::NO_READ, -// IOobject::NO_WRITE -// ), -// mesh_, -// v.x() -// ) -// ); -//} - - -Foam::tmp Foam::constSolidThermo::K() const +const Foam::volScalarField& Foam::constSolidThermo::K() const { - return tmp - ( - new volScalarField - ( - IOobject - ( - "K", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - constK_ - ) - ); + return K_; } -//Foam::tmp Foam::constSolidThermo::directionalK() -//const -//{ -// return tmp -// ( -// new volSymmTensorField -// ( -// IOobject -// ( -// "K", -// mesh_.time().timeName(), -// mesh_, -// IOobject::NO_READ, -// IOobject::NO_WRITE -// ), -// mesh_, -// constK_ -// ) -// ); -//} -Foam::tmp Foam::constSolidThermo::directionalK() const +const Foam::volSymmTensorField& Foam::constSolidThermo::directionalK() const { dimensionedSymmTensor t ( @@ -233,27 +171,6 @@ Foam::tmp Foam::constSolidThermo::Hf() const } -Foam::tmp Foam::constSolidThermo::emissivity() const -{ - return tmp - ( - new volScalarField - ( - IOobject - ( - "emissivity", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - constEmissivity_ - ) - ); -} - - Foam::tmp Foam::constSolidThermo::rho ( const label patchI @@ -270,7 +187,7 @@ Foam::tmp Foam::constSolidThermo::rho } -Foam::tmp Foam::constSolidThermo::cp +Foam::tmp Foam::constSolidThermo::Cp ( const label patchI ) const @@ -359,6 +276,38 @@ Foam::tmp Foam::constSolidThermo::emissivity } +Foam::tmp Foam::constSolidThermo::kappa +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + T_.boundaryField()[patchI].size(), + constKappa_.value() + ) + ); +} + + +Foam::tmp Foam::constSolidThermo::sigmaS +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + T_.boundaryField()[patchI].size(), + constSigmaS_.value() + ) + ); +} + + bool Foam::constSolidThermo::read() { return read(subDict(typeName + "Coeffs")); @@ -368,17 +317,21 @@ bool Foam::constSolidThermo::read() bool Foam::constSolidThermo::read(const dictionary& dict) { constRho_ = dimensionedScalar(dict.lookup("rho")); - constCp_ = dimensionedScalar(dict.lookup("cp")); + constCp_ = dimensionedScalar(dict.lookup("Cp")); constK_ = dimensionedScalar(dict.lookup("K")); constHf_ = dimensionedScalar(dict.lookup("Hf")); constEmissivity_ = dimensionedScalar(dict.lookup("emissivity")); + constKappa_ = dimensionedScalar(dict_.lookup("kappa")); + constSigmaS_ = dimensionedScalar(dict_.lookup("sigmaS")); Info<< "Constructed constSolidThermo with" << nl << " rho : " << constRho_ << nl - << " cp : " << constCp_ << nl + << " Cp : " << constCp_ << nl << " K : " << constK_ << nl << " Hf : " << constHf_ << nl << " emissivity : " << constEmissivity_ << nl + << " kappa : " << constKappa_ << nl + << " sigmaS : " << constSigmaS_ << nl << endl; return true; @@ -389,9 +342,11 @@ bool Foam::constSolidThermo::writeData(Ostream& os) const { bool ok = basicSolidThermo::writeData(os); os.writeKeyword("rho") << constRho_ << token::END_STATEMENT << nl; - os.writeKeyword("cp") << constCp_ << token::END_STATEMENT << nl; + os.writeKeyword("Cp") << constCp_ << token::END_STATEMENT << nl; os.writeKeyword("K") << constK_ << token::END_STATEMENT << nl; os.writeKeyword("Hf") << constHf_ << token::END_STATEMENT << nl; + os.writeKeyword("kappa") << constKappa_ << token::END_STATEMENT << nl; + os.writeKeyword("sigmaS") << constSigmaS_ << token::END_STATEMENT << nl; os.writeKeyword("emissivity") << constEmissivity_ << token::END_STATEMENT << nl; return ok && os.good(); diff --git a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H index 41b92bd18d..33966637db 100644 --- a/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/constSolidThermo/constSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -50,22 +50,38 @@ class constSolidThermo : public basicSolidThermo { +private: + + // Private data + + //- Dictionary + dictionary dict_; + + //- Constant thermal conductivity [W/(m.K)] + dimensionedScalar constK_; + + //- Thermal conductivity field[W/(m.K)] + volScalarField K_; + //- Density [kg/m3] dimensionedScalar constRho_; //- Specific heat capacity [J/(kg.K)] dimensionedScalar constCp_; - //- Thermal conductivity [W/(m.K)] - //dimensionedSymmTensor constK_; - dimensionedScalar constK_; - //- Heat of formation [J/kg] dimensionedScalar constHf_; //- Emissivity dimensionedScalar constEmissivity_; + //- Absorptivity [1/m] + dimensionedScalar constKappa_; + + //- Scatter [1/m] + dimensionedScalar constSigmaS_; + + public: //- Runtime type information @@ -77,9 +93,8 @@ public: //- Construct from mesh constSolidThermo(const fvMesh& mesh); - // Destructor - - virtual ~constSolidThermo(); + //- Destructor + virtual ~constSolidThermo(); // Member Functions @@ -87,24 +102,23 @@ public: //- Update properties virtual void correct(); - //- Density [kg/m3] - virtual tmp rho() const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp() const; + // Acces functions + + //- Constant access to K + virtual const volScalarField& K() const; //- Thermal conductivity [W/(m.K)] - // Note: needs supplied K to be isotropic - virtual tmp K() const; + virtual const volSymmTensorField& directionalK() const; - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK() const; - //- Heat of formation [J/kg] - virtual tmp Hf() const; + // Derived properties - //- Emissivity [] - virtual tmp emissivity() const; + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp() const; + + //- Heat of formation [J/kg] + virtual tmp Hf() const; // Per patch calculation @@ -112,19 +126,25 @@ public: //- Density [kg/m3] virtual tmp rho(const label patchI) const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp(const label patchI) const; + //- Specific heat capacity [J/kg/K)] + virtual tmp Cp(const label patchI) const; - //- Thermal conductivity [W/(m.K)] + //- Thermal conductivity [W//m/K] virtual tmp K(const label patchI) const; - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK(const label patchI) const; + //- Thermal conductivity [W//m/K] + virtual tmpdirectionalK(const label) const; //- Heat of formation [J/kg] virtual tmp Hf(const label patchI) const; - //- Emissivity [] + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label) const; + + //- Absorption coefficient [1/m] + virtual tmp kappa(const label) const; + + //- Emissivity [] virtual tmp emissivity(const label) const; diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C new file mode 100644 index 0000000000..1e06ece31a --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.C @@ -0,0 +1,493 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "directionalKSolidThermo.H" +#include "addToRunTimeSelectionTable.H" +#include "transform.H" +#include "transformField.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(directionalKSolidThermo, 0); + addToRunTimeSelectionTable + ( + basicSolidThermo, + directionalKSolidThermo, + mesh + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::directionalKSolidThermo::directionalKSolidThermo(const fvMesh& mesh) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs"), + directionalK_ + ( + IOobject + ( + "K", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + ccTransforms_ + ( + IOobject + ( + "ccTransforms", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimLength + ) +{ + KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + + // Determine transforms for cell centres + forAll(mesh.C(), cellI) + { + vector dir = mesh.C()[cellI] - coordSys_.origin(); + dir /= mag(dir); + + // Define local coordinate system with + // - e1 : axis from cc to centre + // - e3 : rotation axis + coordinateSystem cs + ( + "cc", + coordSys_.origin(), + coordSys_.e3(), //z',e3 + dir //x',e1 + ); + + ccTransforms_[cellI] = cs.R(); + } + + forAll(mesh.C().boundaryField(), patchI) + { + const fvPatchVectorField& patchC = mesh.C().boundaryField()[patchI]; + fvPatchTensorField& patchT = ccTransforms_.boundaryField()[patchI]; + + tensorField tc(patchT.size()); + forAll(tc, i) + { + vector dir = patchC[i] - coordSys_.origin(); + dir /= mag(dir); + + coordinateSystem cs + ( + "cc", + coordSys_.origin(), + coordSys_.e3(), //z',e3 + dir //x',e1 + ); + + tc[i] = cs.R(); + } + patchT = tc; + } + + if (debug) + { + Info<< "directionalKSolidThermo : dumping converted Kxx, Kyy, Kzz" + << endl; + { + volVectorField Kxx + ( + IOobject + ( + "Kxx", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimless + ); + Kxx.internalField() = transform + ( + ccTransforms_.internalField(), + vectorField + ( + ccTransforms_.internalField().size(), + point(1, 0, 0) + ) + ); + forAll(Kxx.boundaryField(), patchI) + { + Kxx.boundaryField()[patchI] = transform + ( + ccTransforms_.boundaryField()[patchI], + vectorField + ( + ccTransforms_.boundaryField()[patchI].size(), + point(1, 0, 0) + ) + ); + } + Kxx.write(); + } + { + volVectorField Kyy + ( + IOobject + ( + "Kyy", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimless + ); + Kyy.internalField() = transform + ( + ccTransforms_.internalField(), + vectorField + ( + ccTransforms_.internalField().size(), + point(0, 1, 0) + ) + ); + forAll(Kyy.boundaryField(), patchI) + { + Kyy.boundaryField()[patchI] = transform + ( + ccTransforms_.boundaryField()[patchI], + vectorField + ( + ccTransforms_.boundaryField()[patchI].size(), + point(0, 1, 0) + ) + ); + } + Kyy.write(); + } + { + volVectorField Kzz + ( + IOobject + ( + "Kzz", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE, + false + ), + mesh, + dimless + ); + Kzz.internalField() = transform + ( + ccTransforms_.internalField(), + vectorField + ( + ccTransforms_.internalField().size(), + point(0, 0, 1) + ) + ); + forAll(Kzz.boundaryField(), patchI) + { + Kzz.boundaryField()[patchI] = transform + ( + ccTransforms_.boundaryField()[patchI], + vectorField + ( + ccTransforms_.boundaryField()[patchI].size(), + point(0, 0, 1) + ) + ); + } + Kzz.write(); + } + } + + correct(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::directionalKSolidThermo::~directionalKSolidThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::symmTensor Foam::directionalKSolidThermo::transformPrincipal +( + const tensor& tt, + const vector& st +) const +{ + return symmTensor + ( + tt.xx()*st.x()*tt.xx() + + tt.xy()*st.y()*tt.xy() + + tt.xz()*st.z()*tt.xz(), + + tt.xx()*st.x()*tt.yx() + + tt.xy()*st.y()*tt.yy() + + tt.xz()*st.z()*tt.yz(), + + tt.xx()*st.x()*tt.zx() + + tt.xy()*st.y()*tt.zy() + + tt.xz()*st.z()*tt.zz(), + + tt.yx()*st.x()*tt.yx() + + tt.yy()*st.y()*tt.yy() + + tt.yz()*st.z()*tt.yz(), + + tt.yx()*st.x()*tt.zx() + + tt.yy()*st.y()*tt.zy() + + tt.yz()*st.z()*tt.zz(), + + tt.zx()*st.x()*tt.zx() + + tt.zy()*st.y()*tt.zy() + + tt.zz()*st.z()*tt.zz() + ); +} + + +void Foam::directionalKSolidThermo::transformField +( + symmTensorField& fld, + const tensorField& tt, + const vectorField& st +) const +{ + fld.setSize(tt.size()); + forAll(fld, i) + { + fld[i] = transformPrincipal(tt[i], st[i]); + } +} + + +void Foam::directionalKSolidThermo::correct() +{ + calculate(); + interpolatedSolidThermo::calculate(); +} + + +const Foam::volSymmTensorField& Foam::directionalKSolidThermo:: +directionalK() const +{ + return directionalK_; +} + + +void Foam::directionalKSolidThermo::calculate() +{ + // Correct directionalK + Field localK + ( + interpolateXY + ( + T_.internalField(), + TValues_, + KValues_ + ) + ); + + // Transform into global coordinate system + transformField + ( + directionalK_.internalField(), + ccTransforms_.internalField(), + localK + ); + + forAll(directionalK_.boundaryField(), patchI) + { + directionalK_.boundaryField()[patchI] == this->directionalK(patchI)(); + } +} + + +const Foam::volScalarField& Foam::directionalKSolidThermo::K() const +{ + forAll(KValues_, i) + { + const vector& v = KValues_[i]; + if + ( + v.x() != v.y() + || v.x() != v.z() + || v.y() != v.z() + ) + { + FatalErrorIn("directionalKSolidThermo::K() const") + << "Supplied K values " << KValues_ + << " are not isotropic." << exit(FatalError); + } + } + + // Get temperature interpolated properties (principal directions) + Field localK + ( + interpolateXY + ( + T_.internalField(), + TValues_, + KValues_ + ) + ); + + tmp tK + ( + new volScalarField + ( + IOobject + ( + "K", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/dimTime/(dimLength*dimTemperature) + ) + ); + volScalarField& K = tK(); + + K.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + KValues_.component(0)() + ); + + forAll(K.boundaryField(), patchI) + { + K.boundaryField()[patchI] == this->K(patchI)(); + } + + return tK; +} + + +Foam::tmp Foam::directionalKSolidThermo::K +( + const label patchI +) const +{ + forAll(KValues_, i) + { + const vector& v = KValues_[i]; + if + ( + v.x() != v.y() + || v.x() != v.z() + || v.y() != v.z() + ) + { + FatalErrorIn("directionalKSolidThermo::K() const") + << "Supplied K values " << KValues_ + << " are not isotropic." << exit(FatalError); + } + } + + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + KValues_.component(0)() + ) + ) + ); +} + + +Foam::tmp Foam::directionalKSolidThermo::directionalK +( + const label patchI +) const +{ + const fvPatchScalarField& patchT = T_.boundaryField()[patchI]; + + Field localK(interpolateXY(patchT, TValues_, KValues_)); + + tmp tglobalK(new symmTensorField(localK.size())); + transformField(tglobalK(), ccTransforms_.boundaryField()[patchI], localK); + + return tglobalK; +} + + +bool Foam::directionalKSolidThermo::read() +{ + return read(subDict(typeName + "Coeffs")); +} + + +bool Foam::directionalKSolidThermo::read(const dictionary& dict) +{ + coordSys_ = coordinateSystem(dict, mesh_); + KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + return true; +} + + +bool Foam::directionalKSolidThermo::writeData(Ostream& os) const +{ + bool ok = interpolatedSolidThermo::writeData(os); + os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl; + return ok && os.good(); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const directionalKSolidThermo& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H new file mode 100644 index 0000000000..b0fcfd5c8c --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/directionalKSolidThermo/directionalKSolidThermo.H @@ -0,0 +1,158 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::directionalKSolidThermo + +Description + Directional conductivity + table interpolation. + +SourceFiles + directionalKSolidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directionalKSolidThermo_H +#define directionalKSolidThermo_H + +#include "coordinateSystem.H" +#include "interpolatedSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class directionalKSolidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class directionalKSolidThermo +: + public interpolatedSolidThermo +{ + // Private data + + //- Thermal conductivity [W/(m.K)] + volSymmTensorField directionalK_; + + //- Thermal conductivity vector + Field KValues_; + + //- Coordinate system used for the directional properties + coordinateSystem coordSys_; + + //- Transformation for cell centres + volTensorField ccTransforms_; + + + // Private Member Functions + + //- Transform principal values of symmTensor + symmTensor transformPrincipal + ( + const tensor& tt, + const vector& st + ) const; + + //- Transform principal values of symmTensor + void transformField + ( + symmTensorField& fld, + const tensorField& tt, + const vectorField& st + ) const; + + //- Calculate properties + void calculate(); + + +public: + + //- Runtime type information + TypeName("directionalKSolidThermo"); + + + // Constructors + + //- Construct from mesh + directionalKSolidThermo(const fvMesh& mesh); + + + // Destructor + virtual ~directionalKSolidThermo(); + + + // Member Functions + + //- Update properties + virtual void correct(); + + //- Access functions + + //- Thermal conductivity [W/(m.K)] + virtual const volSymmTensorField& directionalK() const; + + //- Iostropic thermal conductivity [W/(m.K)] + virtual const volScalarField& K() const; + + // Per patch calculation + + //- Thermal conductivity [W//m/K] + virtual tmp K(const label patchI) const; + + //- Thermal conductivity [W//m/K] + virtual tmp directionalK(const label) const; + + + // I-O + + //- Write the directionalKSolidThermo properties + virtual bool writeData(Ostream& os) const; + + //- Read the directionalKSolidThermo properties + virtual bool read(); + + //- Read the directionalKSolidThermo properties + bool read(const dictionary& dict); + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream& os, + const directionalKSolidThermo& s + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C new file mode 100644 index 0000000000..03fad75d4a --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.C @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "interpolateSolid.H" +#include "interpolateXY.H" + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::interpolateSolid::interpolateSolid(const dictionary& dict) +{ + + read(dict); + + Info<< "Constructed directionalKSolidThermo with samples" << nl + << " T : " << TValues_ << nl + << " rho : " << rhoValues_ << nl + << " cp : " << cpValues_ << nl + << " Hf : " << HfValues_ << nl + << " emissivity : " << emissivityValues_ << nl + << " kappa : " << kappaValues_ << nl + << " sigmaS : " << sigmaSValues_ << nl + << endl; + + + if + ( + (TValues_.size() != rhoValues_.size()) + && (TValues_.size() != cpValues_.size()) + && (TValues_.size() != rhoValues_.size()) + && (TValues_.size() != HfValues_.size()) + && (TValues_.size() != emissivityValues_.size()) + ) + { + FatalIOErrorIn("interpolateSolid::read()", dict) + << "Size of property tables should be equal to size of Temperature" + << " values " << TValues_.size() + << exit(FatalIOError); + } + + for (label i = 1; i < TValues_.size(); i++) + { + if (TValues_[i] <= TValues_[i-1]) + { + FatalIOErrorIn("interpolateSolid::read()", dict) + << "Temperature values are not in increasing order " + << TValues_ << exit(FatalIOError); + } + } +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::interpolateSolid::~interpolateSolid() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +bool Foam::interpolateSolid::writeData(Ostream& os) const +{ + + os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl; + os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl; + os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl; + os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl; + os.writeKeyword("emissivityValues") << emissivityValues_ << nl; + os.writeKeyword("kappaValues") << kappaValues_ << nl; + os.writeKeyword("sigmaSValues") << sigmaSValues_ + << token::END_STATEMENT << nl; + + return os.good(); +} + + +bool Foam::interpolateSolid::read(const dictionary& dict) +{ + TValues_ = Field(dict.lookup("TValues")); + rhoValues_ = Field(dict.lookup("rhoValues")); + cpValues_ = Field(dict.lookup("cpValues")); + kappaValues_ = Field(dict.lookup("kappaValues")); + sigmaSValues_ = Field(dict.lookup("sigmaSValues")); + HfValues_ = Field(dict.lookup("HfValues")); + emissivityValues_ = Field(dict.lookup("emissivityValues")); + sigmaSValues_ = Field(dict.lookup("sigmaSValues")); + return true; +} +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H new file mode 100644 index 0000000000..20d72d35db --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolateSolid/interpolateSolid.H @@ -0,0 +1,104 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::interpolateSolid + +Description + Helping class for T-interpolated solid thermo. + +SourceFiles + interpolateSolid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef interpolateSolid_H +#define interpolateSolid_H +#include "volFields.H" +#include "dictionary.H" +#include "interpolateXY.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class interpolateSolid Declaration +\*---------------------------------------------------------------------------*/ + +class interpolateSolid +{ +protected: + + // Protected data + + Field TValues_; + + Field rhoValues_; + + Field cpValues_; + + Field HfValues_; + + Field emissivityValues_; + + Field kappaValues_; + + Field sigmaSValues_; + + +public: + + // Constructors + + //- Construct from mesh + interpolateSolid(const dictionary&); + + + //- Destructor + + virtual ~interpolateSolid(); + + + // Member Functions + + // I-O + + //- Read the interpolateSolid properties + bool read(const dictionary& dict); + + //- Write the interpolateSolid properties + bool writeData(Ostream& os) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C index ca298f3373..431e6c98b4 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -27,28 +27,20 @@ License #include "addToRunTimeSelectionTable.H" #include "interpolateXY.H" -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -namespace Foam -{ - defineTypeNameAndDebug(interpolatedSolidThermo, 0); - addToRunTimeSelectionTable - ( - basicSolidThermo, - interpolatedSolidThermo, - mesh - ); -} - // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::interpolatedSolidThermo::interpolatedSolidThermo(const fvMesh& mesh) +Foam::interpolatedSolidThermo::interpolatedSolidThermo +( + const fvMesh& mesh, + const word dictName + ) : - basicSolidThermo(mesh) + basicSolidThermo(mesh), + interpolateSolid(subDict(dictName)), + dict_(subDict(dictName)) { - read(); - correct(); + calculate(); } @@ -60,55 +52,73 @@ Foam::interpolatedSolidThermo::~interpolatedSolidThermo() // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::interpolatedSolidThermo::correct() -{} - - -Foam::tmp Foam::interpolatedSolidThermo::rho() const +void Foam::interpolatedSolidThermo::calculate() { - tmp trho - ( - new volScalarField - ( - IOobject - ( - "rho", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimDensity - ) - ); - volScalarField& rho = trho(); - - rho.internalField() = interpolateXY + // Correct rho + rho_.internalField() = interpolateXY ( T_.internalField(), TValues_, rhoValues_ ); - forAll(rho.boundaryField(), patchI) + forAll(rho_.boundaryField(), patchI) { - rho.boundaryField()[patchI] == this->rho(patchI)(); + rho_.boundaryField()[patchI] == this->rho(patchI)(); } - return trho; + // Correct emissivity + emissivity_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + emissivityValues_ + ); + + forAll(emissivity_.boundaryField(), patchI) + { + emissivity_.boundaryField()[patchI] == this->emissivity(patchI)(); + } + + + // Correct absorptivity + kappa_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + kappaValues_ + ); + + forAll(kappa_.boundaryField(), patchI) + { + kappa_.boundaryField()[patchI] == this->kappa(patchI)(); + } + + + // Correct scatter + sigmaS_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + sigmaSValues_ + ); + + forAll(sigmaS_.boundaryField(), patchI) + { + sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)(); + } } -Foam::tmp Foam::interpolatedSolidThermo::cp() const +Foam::tmp Foam::interpolatedSolidThermo::Cp() const { - tmp tcp + tmp tCp ( new volScalarField ( IOobject ( - "cp", + "Cp", mesh_.time().timeName(), mesh_, IOobject::NO_READ, @@ -118,107 +128,21 @@ Foam::tmp Foam::interpolatedSolidThermo::cp() const dimEnergy/(dimMass*dimTemperature) ) ); - volScalarField& cp = tcp(); + volScalarField& Cp = tCp(); - cp.internalField() = interpolateXY + Cp.internalField() = interpolateXY ( T_.internalField(), TValues_, cpValues_ ); - forAll(cp.boundaryField(), patchI) + forAll(Cp.boundaryField(), patchI) { - cp.boundaryField()[patchI] == this->cp(patchI)(); + Cp.boundaryField()[patchI] == this->Cp(patchI)(); } - return tcp; -} - - -Foam::tmp Foam::interpolatedSolidThermo::K() const -{ - tmp tK - ( - new volScalarField - ( - IOobject - ( - "K", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimEnergy/dimTime/(dimLength*dimTemperature) - ) - ); - volScalarField& K = tK(); - - K.internalField() = interpolateXY - ( - T_.internalField(), - TValues_, - KValues_ - ); - - forAll(K.boundaryField(), patchI) - { - K.boundaryField()[patchI] == this->K(patchI)(); - } - - return tK; -} - - -Foam::tmp -Foam::interpolatedSolidThermo::directionalK() -const -{ - tmp tK - ( - new volSymmTensorField - ( - IOobject - ( - "K", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimensionedSymmTensor - ( - "zero", - dimEnergy/dimTime/(dimLength*dimTemperature), - symmTensor::zero - ) - ) - ); - volSymmTensorField& K = tK(); - - Field scalarK - ( - interpolateXY - ( - T_.internalField(), - TValues_, - KValues_ - ) - ); - - K.internalField().replace(symmTensor::XX, scalarK); - K.internalField().replace(symmTensor::YY, scalarK); - K.internalField().replace(symmTensor::ZZ, scalarK); - - forAll(K.boundaryField(), patchI) - { - K.boundaryField()[patchI] == this->directionalK(patchI)(); - } - - return tK; + return tCp; } @@ -258,43 +182,6 @@ Foam::tmp Foam::interpolatedSolidThermo::Hf() const } -Foam::tmp -Foam::interpolatedSolidThermo::emissivity() const -{ - tmp temissivity - ( - new volScalarField - ( - IOobject - ( - "emissivity", - mesh_.time().timeName(), - mesh_, - IOobject::NO_READ, - IOobject::NO_WRITE - ), - mesh_, - dimless - ) - ); - volScalarField& emissivity = temissivity(); - - emissivity.internalField() = interpolateXY - ( - T_.internalField(), - TValues_, - emissivityValues_ - ); - - forAll(emissivity.boundaryField(), patchI) - { - emissivity.boundaryField()[patchI] == this->emissivity(patchI)(); - } - - return temissivity; -} - - Foam::tmp Foam::interpolatedSolidThermo::rho ( const label patchI @@ -315,7 +202,7 @@ Foam::tmp Foam::interpolatedSolidThermo::rho } -Foam::tmp Foam::interpolatedSolidThermo::cp +Foam::tmp Foam::interpolatedSolidThermo::Cp ( const label patchI ) const @@ -335,53 +222,6 @@ Foam::tmp Foam::interpolatedSolidThermo::cp } -Foam::tmp Foam::interpolatedSolidThermo::K -( - const label patchI -) const -{ - return tmp - ( - new scalarField - ( - interpolateXY - ( - T_.boundaryField()[patchI], - TValues_, - KValues_ - ) - ) - ); -} - - -Foam::tmp Foam::interpolatedSolidThermo::directionalK -( - const label patchI -) const -{ - const fvPatchScalarField& patchT = T_.boundaryField()[patchI]; - - Field scalarK(interpolateXY(patchT, TValues_, KValues_)); - - tmp tfld - ( - new symmTensorField - ( - scalarK.size(), - symmTensor::zero - ) - ); - symmTensorField& fld = tfld(); - - fld.replace(symmTensor::XX, scalarK); - fld.replace(symmTensor::YY, scalarK); - fld.replace(symmTensor::ZZ, scalarK); - - return tfld; -} - - Foam::tmp Foam::interpolatedSolidThermo::Hf ( const label patchI @@ -422,69 +262,63 @@ Foam::tmp Foam::interpolatedSolidThermo::emissivity } +Foam::tmp Foam::interpolatedSolidThermo::kappa +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + kappaValues_ + ) + ) + ); +} + + +Foam::tmp Foam::interpolatedSolidThermo::sigmaS +( + const label patchI +) const +{ + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + sigmaSValues_ + ) + ) + ); +} + + bool Foam::interpolatedSolidThermo::read() { - return read(subDict(typeName + "Coeffs")); + return read(dict_); } bool Foam::interpolatedSolidThermo::read(const dictionary& dict) { - TValues_ = Field(dict.lookup("TValues")); - rhoValues_ = Field(dict.lookup("rhoValues")); - cpValues_ = Field(dict.lookup("cpValues")); - KValues_ = Field(dict.lookup("KValues")); - HfValues_ = Field(dict.lookup("HfValues")); - emissivityValues_ = Field(dict.lookup("emissivityValues")); - - Info<< "Constructed interpolatedSolidThermo with samples" << nl - << " T : " << TValues_ << nl - << " rho : " << rhoValues_ << nl - << " cp : " << cpValues_ << nl - << " K : " << KValues_ << nl - << " Hf : " << HfValues_ << nl - << " emissivity : " << emissivityValues_ << nl - << endl; - - if - ( - (TValues_.size() != rhoValues_.size()) - && (TValues_.size() != cpValues_.size()) - && (TValues_.size() != rhoValues_.size()) - && (TValues_.size() != KValues_.size()) - && (TValues_.size() != HfValues_.size()) - && (TValues_.size() != emissivityValues_.size()) - ) - { - FatalIOErrorIn("interpolatedSolidThermo::read()", dict) - << "Size of property tables should be equal to size of Temperature" - << " values " << TValues_.size() - << exit(FatalIOError); - } - - for (label i = 1; i < TValues_.size(); i++) - { - if (TValues_[i] <= TValues_[i-1]) - { - FatalIOErrorIn("interpolatedSolidThermo::read()", dict) - << "Temperature values are not in increasing order " - << TValues_ << exit(FatalIOError); - } - } - return true; + bool ok = interpolateSolid::read(dict); + return ok; } bool Foam::interpolatedSolidThermo::writeData(Ostream& os) const { bool ok = basicSolidThermo::writeData(os); - os.writeKeyword("TValues") << TValues_ << token::END_STATEMENT << nl; - os.writeKeyword("rhoValues") << rhoValues_ << token::END_STATEMENT << nl; - os.writeKeyword("cpValues") << cpValues_ << token::END_STATEMENT << nl; - os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl; - os.writeKeyword("HfValues") << HfValues_ << token::END_STATEMENT << nl; - os.writeKeyword("emissivityValues") << emissivityValues_ - << token::END_STATEMENT << nl; + ok = interpolateSolid::writeData(os); return ok && os.good(); } diff --git a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H index 571138e023..24bb8ac695 100644 --- a/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H +++ b/src/thermophysicalModels/basicSolidThermo/interpolatedSolidThermo/interpolatedSolidThermo.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,7 +25,7 @@ Class Foam::interpolatedSolidThermo Description - Table interpolated solid thermo. + Table interpolated solid thermo SourceFiles interpolatedSolidThermo.C @@ -36,6 +36,7 @@ SourceFiles #define interpolatedSolidThermo_H #include "basicSolidThermo.H" +#include "interpolateSolid.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -43,67 +44,47 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class interpolatedSolidThermo Declaration + Class interpolatedSolidThermo Declaration \*---------------------------------------------------------------------------*/ class interpolatedSolidThermo : - public basicSolidThermo + public basicSolidThermo, + public interpolateSolid { +private: + // Private data - //- Temperature samples - Field TValues_; + //- Dictionary + const dictionary dict_; - //- Density at given temperatures - Field rhoValues_; - - Field cpValues_; - - Field KValues_; - - Field HfValues_; - - Field emissivityValues_; public: - //- Runtime type information - TypeName("interpolatedSolidThermo"); - - // Constructors //- Construct from mesh - interpolatedSolidThermo(const fvMesh& mesh); + interpolatedSolidThermo(const fvMesh& mesh, const word); - // Destructor - virtual ~interpolatedSolidThermo(); + //- Destructor + virtual ~interpolatedSolidThermo(); // Member Functions - //- Update properties - virtual void correct(); + //- Calculate properties + void calculate(); - //- Density [kg/m3] - virtual tmp rho() const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp() const; + // Derived properties - //- Thermal conductivity [W/(m.K)] - virtual tmp K() const; + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp() const; - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK() const; - - //- Heat of formation [J/kg] - virtual tmp Hf() const; - - //- Emissivity [] - virtual tmp emissivity() const; + //- Heat of formation [J/kg] + virtual tmp Hf() const; // Per patch calculation @@ -111,20 +92,19 @@ public: //- Density [kg/m3] virtual tmp rho(const label patchI) const; - //- Specific heat capacity [J/(kg.K)] - virtual tmp cp(const label patchI) const; - - //- Thermal conductivity [W/(m.K)] - // Note: needs Kvalues to be isotropic - virtual tmp K(const label patchI) const; - - //- Thermal conductivity [W/(m.K)] - virtual tmp directionalK(const label patchI) const; + //- Specific heat capacity [J/kg/K)] + virtual tmp Cp(const label patchI) const; //- Heat of formation [J/kg] virtual tmp Hf(const label patchI) const; - //- Emissivity [] + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label) const; + + //- Absorption coefficient [1/m] + virtual tmp kappa(const label) const; + + //- Emissivity [] virtual tmp emissivity(const label) const; diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C new file mode 100644 index 0000000000..9b1a7d3858 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.C @@ -0,0 +1,129 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "isotropicKSolidThermo.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(isotropicKSolidThermo, 0); + addToRunTimeSelectionTable + ( + basicSolidThermo, + isotropicKSolidThermo, + mesh + ); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::isotropicKSolidThermo::isotropicKSolidThermo(const fvMesh& mesh) +: + interpolatedSolidThermo(mesh, typeName + "Coeffs"), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ), + KValues_ (Field(subDict(typeName + "Coeffs").lookup("KValues"))) +{ + correct(); +} + + +void Foam::isotropicKSolidThermo::correct() +{ + + // Correct K + K_.internalField() = interpolateXY + ( + T_.internalField(), + TValues_, + KValues_ + ); + + forAll(K_.boundaryField(), patchI) + { + K_.boundaryField()[patchI] == this->K(patchI)(); + } + + interpolatedSolidThermo::calculate(); +} + + +Foam::tmp Foam::isotropicKSolidThermo::K +( + const label patchI +) const +{ + + return tmp + ( + new scalarField + ( + interpolateXY + ( + T_.boundaryField()[patchI], + TValues_, + KValues_ + ) + ) + ); +} + + +bool Foam::isotropicKSolidThermo::read() +{ + KValues_ = Field(subDict(typeName + "Coeffs").lookup("KValues")); + return true; +} + + +bool Foam::isotropicKSolidThermo::writeData(Ostream& os) const +{ + os.writeKeyword("KValues") << KValues_ << token::END_STATEMENT << nl; + bool ok = interpolatedSolidThermo::writeData(os); + + return ok && os.good(); +} + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::isotropicKSolidThermo::~isotropicKSolidThermo() +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H new file mode 100644 index 0000000000..6366d8e473 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/isotropicKSolidThermo/isotropicKSolidThermo.H @@ -0,0 +1,124 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::isotropicKSolidThermo + +Description + Directional conductivity + table interpolation. + +SourceFiles + isotropicKSolidThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef directionalSolidThermo_H +#define directionalSolidThermo_H + +#include "interpolatedSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class isotropicKSolidThermo Declaration +\*---------------------------------------------------------------------------*/ + +class isotropicKSolidThermo +: + public interpolatedSolidThermo +{ + // Private data + + //- Thermal conductivity [W/(m.K)] + volScalarField K_; + + //- Thermal conductivity vector + Field KValues_; + + +public: + + //- Runtime type information + TypeName("isotropicKSolidThermo"); + + + // Constructors + + //- Construct from mesh + isotropicKSolidThermo(const fvMesh& mesh); + + + // Destructor + virtual ~isotropicKSolidThermo(); + + // Member functions + + //- Update properties + virtual void correct(); + + // Access functions + + //- Constant access to K + virtual const volScalarField& K() const + { + return K_; + } + + + // Per patch calculation + + //- Thermal conductivity [W//m/K] + virtual tmp K(const label patchI) const; + + + // I-O + + //- Read solidThermophysicalProperties dictionary + virtual bool read(); + + //- Write properties + virtual bool writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream& os, + const isotropicKSolidThermo& s + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C new file mode 100644 index 0000000000..bbf3e348a2 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.C @@ -0,0 +1,105 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "basicSolidMixture.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::basicSolidMixture::basicSolidMixture +( + const wordList& solidNames, + const fvMesh& mesh +) +: + components_(solidNames), + Y_(components_.size()) +{ + forAll(components_, i) + { + IOobject header + ( + "Y" + components_[i], + mesh.time().timeName(), + mesh, + IOobject::NO_READ + ); + + // check if field exists and can be read + if (header.headerOk()) + { + Y_.set + ( + i, + new volScalarField + ( + IOobject + ( + "Y" + components_[i], + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::AUTO_WRITE + ), + mesh + ) + ); + } + else + { + volScalarField Ydefault + ( + IOobject + ( + "Ydefault", + mesh.time().timeName(), + mesh, + IOobject::MUST_READ, + IOobject::NO_WRITE + ), + mesh + ); + + Y_.set + ( + i, + new volScalarField + ( + IOobject + ( + "Y" + components_[i], + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + Ydefault + ) + ); + } + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H new file mode 100644 index 0000000000..c862152526 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixture.H @@ -0,0 +1,154 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::basicSolidMixture + +Description + Foam::basicSolidMixture + +\*---------------------------------------------------------------------------*/ + +#ifndef basicSolidMixture_H +#define basicSolidMixture_H + +#include "volFields.H" +#include "speciesTable.H" +#include "PtrList.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class basicSolidMixture Declaration +\*---------------------------------------------------------------------------*/ + +class basicSolidMixture +{ + +protected: + + // Protected data + + typedef speciesTable solidsTable; + + //- The names of the solids + solidsTable components_; + + //- Solid mass fractions + PtrList Y_; + + +public: + + // Constructors + + //- Construct from word list and mesh + basicSolidMixture + ( + const wordList& solidNames, + const fvMesh& + ); + + + //- Destructor + virtual ~basicSolidMixture() + {} + + + // Member Functions + + //- Return the solid table + const solidsTable& components() const + { + return components_; + } + + //- Return the mass-fraction fields + inline PtrList& Y(); + + //- Return the const mass-fraction fields + inline const PtrList& Y() const; + + //- Return the mass-fraction field for a specie given by index + inline volScalarField& Y(const label i); + + //- Return the const mass-fraction field for a specie given by index + inline const volScalarField& Y(const label i) const; + + //- Return the mass-fraction field for a specie given by name + inline volScalarField& Y(const word& specieName); + + //- Return the const mass-fraction field for a specie given by name + inline const volScalarField& Y(const word& specieName) const; + + //- Does the mixture include this specie? + inline bool contains(const word& specieName) const; + + + // Derived cell based properties. + + //- Density + virtual scalar rho(scalar T, label celli) const = 0; + + //- Absorption coefficient + virtual scalar kappa(scalar T, label celli) const = 0; + + //- Scatter coefficient + virtual scalar sigmaS(scalar T, label celli) const = 0; + + //- Thermal conductivity + virtual scalar K(scalar T, label celli) const = 0; + + //- Emissivity coefficient + virtual scalar emissivity(scalar T, label celli) const = 0; + + //- Formation enthalpy + virtual scalar hf(scalar T, label celli) const = 0; + + //- Sensible enthalpy + virtual scalar hs(scalar T, label celli) const = 0; + + //- Total enthalpy + virtual scalar h(scalar T, label celli) const = 0; + + //- Specific heat capacity + virtual scalar Cp(scalar T, label celli) const = 0; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +# include "basicSolidMixtureI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H new file mode 100644 index 0000000000..831ea6819d --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/basicSolidMixture/basicSolidMixtureI.H @@ -0,0 +1,75 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + + +inline Foam::PtrList& Foam::basicSolidMixture::Y() +{ + return Y_; +} + + +inline const Foam::PtrList& Foam::basicSolidMixture::Y() const +{ + return Y_; +} + + +inline Foam::volScalarField& Foam::basicSolidMixture::Y(const label i) +{ + return Y_[i]; +} + + +inline const Foam::volScalarField& Foam::basicSolidMixture::Y +( + const label i +) const +{ + return Y_[i]; +} + + +inline Foam::volScalarField& Foam::basicSolidMixture::Y(const word& specieName) +{ + return Y_[components_[specieName]]; +} + + +inline const Foam::volScalarField& Foam::basicSolidMixture::Y +( + const word& specieName +) const +{ + return Y_[components_[specieName]]; +} + + +inline bool Foam::basicSolidMixture::contains(const word& specieName) const +{ + return components_.contains(specieName); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C new file mode 100644 index 0000000000..f43f4866b9 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.C @@ -0,0 +1,250 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "multiComponentSolidMixture.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::multiComponentSolidMixture::correctMassFractions() +{ + volScalarField Yt = Y_[0]; + + for (label n=1; n +Foam::scalar Foam::multiComponentSolidMixture::X +( + label iComp, label celli, scalar T +) const +{ + scalar rhoInv = 0.0; + forAll(solidData_, i) + { + rhoInv += Y_[i][celli]/solidData_[i].rho(T); + } + + scalar X = Y_[iComp][celli]/solidData_[iComp].rho(T); + + return (X/rhoInv); +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::multiComponentSolidMixture::multiComponentSolidMixture +( + const dictionary& thermoSolidDict, + const fvMesh& mesh +) +: + basicSolidMixture + ( + thermoSolidDict.lookup("solidComponents"), + mesh + ), + solidData_(components_.size()) +{ + + forAll(components_, i) + { + solidData_.set + ( + i, + new ThermoSolidType + ( + thermoSolidDict.subDict(components_[i] + "Coeffs") + ) + ); + } + correctMassFractions(); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::multiComponentSolidMixture::rho +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].rho(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::hf +( + scalar, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].hf()*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::hs +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].hs(T)*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::h +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].h(T)*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::kappa +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].kappa(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::sigmaS +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].sigmaS(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::K +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].K(T)*X(i, celli, T); + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::emissivity +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].emissivity(T)*Y_[i][celli]; + } + return tmp; +} + + +template +Foam::scalar Foam::multiComponentSolidMixture::Cp +( + scalar T, label celli +) const +{ + scalar tmp = 0.0; + forAll(solidData_, i) + { + tmp += solidData_[i].Cp(T)*Y_[i][celli]; + } + return tmp; +} + + +template +void Foam::multiComponentSolidMixture::read +( + const dictionary& thermoDict +) +{ + forAll(components_, i) + { + solidData_[i] = + ThermoSolidType(thermoDict.subDict(components_[i] + "Coeffs")); + } +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H new file mode 100644 index 0000000000..54519fe2f9 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/multiComponentSolidMixture/multiComponentSolidMixture.H @@ -0,0 +1,141 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::multiComponentSolidMixture + +Description + Foam::multiComponentSolidMixture + +\*---------------------------------------------------------------------------*/ + +#ifndef multiComponentSolidMixture_H +#define multiComponentSolidMixture_H + +#include "PtrList.H" +#include "autoPtr.H" +#include "basicSolidMixture.H" + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class multiComponentSolidMixture Declaration +\*---------------------------------------------------------------------------*/ +template +class multiComponentSolidMixture +: + public basicSolidMixture +{ + + // Private data + + //- Solid data + PtrList solidData_; + + + // Private Member Functions + + //- Correct the mass fractions to sum to 1 + void correctMassFractions(); + + //- Return molar fraction for component i in celli and at T + scalar X(label i, label celli, scalar T) const; + +public: + + + // Constructors + + //- Construct from dictionary and mesh + multiComponentSolidMixture(const dictionary&, const fvMesh&); + + + //- Destructor + + virtual ~multiComponentSolidMixture() + {} + + + // Member Functions + + //- Return the raw solid data + const PtrList& solidData() const + { + return solidData_; + } + + //- Read dictionary + void read(const dictionary&); + + + // Cell based properties. + + //- Density + virtual scalar rho(scalar T, label celli) const; + + //- Absorption coefficient + virtual scalar kappa(scalar T, label celli) const; + + //- Scatter coefficient + virtual scalar sigmaS(scalar T, label celli) const; + + //- Thermal conductivity + virtual scalar K(scalar T, label celli) const; + + //- Emissivity coefficient + virtual scalar emissivity(scalar T, label celli) const; + + //- Formation enthalpy + virtual scalar hf(scalar T, label celli) const; + + //- Sensible enthalpy + virtual scalar hs(scalar T, label celli) const; + + //- Total enthalpy + virtual scalar h(scalar T, label celli) const; + + //- Cp + virtual scalar Cp(scalar T, label celli) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "multiComponentSolidMixture.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C new file mode 100644 index 0000000000..47fbbdd3dc --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.C @@ -0,0 +1,64 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "reactingSolidMixture.H" +#include "fvMesh.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::reactingSolidMixture::reactingSolidMixture +( + const dictionary& thermoDict, + const fvMesh& mesh +) +: + multiComponentSolidMixture + ( + thermoDict, + mesh + ), + PtrList + ( + mesh.lookupObject + ("chemistryProperties").lookup("reactions"), + solidReaction::iNew + ( + this->components_, + mesh.lookupObject + ("chemistryProperties").lookup("species") + ) + ) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::reactingSolidMixture::read(const dictionary& thermoDict) +{} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H new file mode 100644 index 0000000000..d13de54c2b --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/mixtures/reactingSolidMixture/reactingSolidMixture.H @@ -0,0 +1,103 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::reactingSolidMixture + +Description + Foam::reactingSolidMixture + +SourceFiles + reactingSolidMixture.C + +\*---------------------------------------------------------------------------*/ + +#ifndef reactingSolidMixture_H +#define reactingSolidMixture_H + +#include "multiComponentSolidMixture.H" +#include "solidReaction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class reactingSolidMixture Declaration +\*---------------------------------------------------------------------------*/ + +template +class reactingSolidMixture +: + public multiComponentSolidMixture, + public PtrList +{ + // Private Member Functions + + //- Disallow default bitwise copy construct + reactingSolidMixture(const reactingSolidMixture&); + + //- Disallow default bitwise assignment + void operator=(const reactingSolidMixture&); + + +public: + + //- The type of thermo package this mixture is instantiated for + typedef ThermoSolidType thermoType; + + + // Constructors + + //- Construct from dictionary and mesh + reactingSolidMixture(const dictionary&, const fvMesh&); + + + //- Destructor + virtual ~reactingSolidMixture() + {} + + + // Member functions + + //- Read dictionary + void read(const dictionary&); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "reactingSolidMixture.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H new file mode 100644 index 0000000000..94c4880a1d --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/makeSolidMixtureThermo.H @@ -0,0 +1,62 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +InClass + Foam::solidMixtureThermo + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSolidMixtureThermo_H +#define makeSolidMixtureThermo_H + +#include "addToRunTimeSelectionTable.H" +#include "solidMixtureThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSolidMixtureThermo(CThermo,MixtureThermo,Mixture,Transport,Radiation,Thermo,Rho)\ + \ +typedef MixtureThermo > > > > \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho; \ + \ +defineTemplateTypeNameAndDebugWithName \ +( \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \ + #MixtureThermo \ + "<"#Mixture"<"#Transport"<"#Radiation"<"#Thermo"<"#Rho">>>>>", \ + 0 \ +); \ + \ +addToRunTimeSelectionTable \ +( \ + CThermo, \ + MixtureThermo##Mixture##Transport##Radiation##Thermo##Rho, \ + mesh \ +); \ + \ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C new file mode 100644 index 0000000000..9824445cfc --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.C @@ -0,0 +1,431 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "solidMixtureThermo.H" +#include "fvMesh.H" + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::solidMixtureThermo::calculate() +{ + + scalarField& rhoCells = rho_.internalField(); + scalarField& KCells = K_.internalField(); + scalarField& kappaCells = kappa_.internalField(); + scalarField& sigmaSCells = sigmaS_.internalField(); + scalarField& emissivityCells = emissivity_.internalField(); + + forAll(T_.internalField(), celli) + { + rhoCells[celli] = MixtureType::rho(T_[celli], celli); + kappaCells[celli] = MixtureType::kappa(T_[celli], celli); + sigmaSCells[celli] = MixtureType::sigmaS(T_[celli], celli); + KCells[celli] = MixtureType::K(T_[celli], celli); + emissivityCells[celli] = MixtureType::emissivity(T_[celli], celli); + } + + forAll(T_.boundaryField(), patchI) + { + rho_.boundaryField()[patchI] == this->rho(patchI)(); + K_.boundaryField()[patchI] == this->K(patchI)(); + kappa_.boundaryField()[patchI] == this->kappa(patchI)(); + sigmaS_.boundaryField()[patchI] == this->sigmaS(patchI)(); + emissivity_.boundaryField()[patchI] == this->emissivity(patchI)(); + } +} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::solidMixtureThermo::solidMixtureThermo +( + const fvMesh& mesh +) +: + basicSolidThermo(mesh), + MixtureType(*this, mesh), + K_ + ( + IOobject + ( + "K", + mesh.time().timeName(), + mesh, + IOobject::NO_READ, + IOobject::AUTO_WRITE + ), + mesh, + dimEnergy/dimTime/(dimLength*dimTemperature) + ) +{ + calculate(); +} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +template +Foam::solidMixtureThermo::~solidMixtureThermo() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +void Foam::solidMixtureThermo::correct() +{ + calculate(); +} + + +template +const Foam::volScalarField& +Foam::solidMixtureThermo::K() const +{ + return K_; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Cp() const +{ + tmp tCp + ( + new volScalarField + ( + IOobject + ( + "Cp", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/(dimMass*dimTemperature) + ) + ); + volScalarField& Cp = tCp(); + + forAll(T_.internalField(), celli) + { + Cp[celli] = MixtureType::Cp(T_[celli], celli); + } + + forAll(Cp.boundaryField(), patchI) + { + Cp.boundaryField()[patchI] == this->Cp(patchI)(); + } + + return tCp; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::hs() const +{ + tmp ths + ( + new volScalarField + ( + IOobject + ( + "Hs", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/(dimMass*dimTemperature) + ) + ); + volScalarField& hs = ths(); + + forAll(T_.internalField(), celli) + { + hs[celli] = MixtureType::hs(T_[celli], celli); + } + + forAll(hs.boundaryField(), patchI) + { + hs.boundaryField()[patchI] == this->hs(patchI)(); + } + + return ths; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Hf() const +{ + tmp thF + ( + new volScalarField + ( + IOobject + ( + "hF", + mesh_.time().timeName(), + mesh_, + IOobject::NO_READ, + IOobject::NO_WRITE + ), + mesh_, + dimEnergy/(dimMass*dimTemperature) + ) + ); + volScalarField& hf = thF(); + + forAll(T_.internalField(), celli) + { + hf[celli] = MixtureType::hf(T_[celli], celli); + } + + forAll(hf.boundaryField(), patchI) + { + hf.boundaryField()[patchI] == this->Hf(patchI)(); + } + + return thF; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::rho +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tRho(new scalarField(patchT.size())); + scalarField& Rho = tRho(); + + forAll(patchT, celli) + { + Rho[celli] = MixtureType::rho(patchT[celli], cells[celli]); + } + + return tRho; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Cp +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tCp(new scalarField(patchT.size())); + scalarField& Cp = tCp(); + + forAll(patchT, celli) + { + Cp[celli] = MixtureType::Cp(patchT[celli], cells[celli]); + } + + return tCp; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::hs +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp ths(new scalarField(patchT.size())); + scalarField& hs = ths(); + + forAll(patchT, celli) + { + hs[celli] = MixtureType::hs(patchT[celli], cells[celli]); + } + + return ths; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::K +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tK(new scalarField(patchT.size())); + scalarField& K = tK(); + + forAll(patchT, celli) + { + K[celli] = MixtureType::K(patchT[celli], cells[celli]); + } + + return tK; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::Hf +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tHf(new scalarField(patchT.size())); + scalarField& Hf = tHf(); + + forAll(patchT, celli) + { + Hf[celli] = MixtureType::hf(patchT[celli], cells[celli]); + } + + return tHf; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::sigmaS +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tsigmaS(new scalarField(patchT.size())); + scalarField& sigmaS = tsigmaS(); + + forAll(patchT, celli) + { + sigmaS[celli] = + MixtureType::sigmaS(patchT[celli], cells[celli]); + } + + return tsigmaS; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::kappa +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp tKappa(new scalarField(patchT.size())); + scalarField& kappa = tKappa(); + + forAll(patchT, celli) + { + kappa[celli] = + MixtureType::kappa(patchT[celli], cells[celli]); + } + + return tKappa; +} + + +template +Foam::tmp +Foam::solidMixtureThermo::emissivity +( + const label patchI +) const +{ + const scalarField& patchT = T_.boundaryField()[patchI]; + const polyPatch& pp = mesh_.boundaryMesh()[patchI]; + const unallocLabelList& cells = pp.faceCells(); + + tmp te(new scalarField(patchT.size())); + scalarField& e = te(); + + forAll(patchT, celli) + { + e[celli] = MixtureType::emissivity(patchT[celli], cells[celli]); + } + + return te; +} + + +template +bool Foam::solidMixtureThermo::read() +{ + if (basicSolidThermo::read()) + { + MixtureType::read(*this); + return true; + } + else + { + return false; + } +} + + +template +bool Foam::solidMixtureThermo::writeData(Ostream& os) const +{ + bool ok = basicSolidThermo::writeData(os); + return ok && os.good(); +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H new file mode 100644 index 0000000000..d9b2fdf157 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermo.H @@ -0,0 +1,175 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::solidMixtureThermo + +Description + Foam::solidMixtureThermo + +SourceFiles + solidMixtureThermo.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solidMixtureThermo_H +#define solidMixtureThermo_H + +#include "basicSolidThermo.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class solidMixtureThermo Declaration +\*---------------------------------------------------------------------------*/ + +template +class solidMixtureThermo +: + public basicSolidThermo, + public MixtureType +{ +protected: + + // Protected data + + //- Thermal conductivity [W/m/K] + volScalarField K_; + + +private: + + // Private Member Functions + + //- Calculate K + void calculate(); + + +public: + + //- Runtime type information + TypeName("solidMixtureThermo"); + + + // Constructors + + //- Construct from mesh + solidMixtureThermo(const fvMesh&); + + + //- Destructor + + virtual ~solidMixtureThermo(); + + + // Member functions + + //- Return the compostion of the solid mixture + virtual MixtureType& composition() + { + return *this; + } + + //- Return the compostion of the solid mixture + virtual const MixtureType& composition() const + { + return *this; + } + + //- Update properties + virtual void correct(); + + // Access functions + + //- Thermal conductivity [W/m/K] + virtual const volScalarField& K() const; + + + // Derived properties + + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp() const; + + //- Heat of formation [J/kg] + virtual tmp Hf() const; + + //- Sensible enthalpy [J/(kg.K)] + virtual tmp hs() const; + + + // Patches variables + + + //- Density [kg/m3] + virtual tmp rho(const label patchI) const; + + //- Specific heat capacity [J/(kg.K)] + virtual tmp Cp(const label patchI) const; + + //- Sensible enthalpy [J/(kg.K)] + virtual tmp hs(const label patchI) const; + + //- Thermal conductivity [W/(m.K)] + virtual tmp K(const label patchI) const; + + //- Heat of formation [J/kg] + virtual tmp Hf(const label patchI) const; + + //- Scatter coefficient [1/m] + virtual tmp sigmaS(const label patchI) const; + + //- Absorptivity [1/m] + virtual tmp kappa(const label patchI) const; + + //- Emissivity [] + virtual tmp emissivity(const label patchI) const; + + + + //- Read thermophysicalProperties dictionary + virtual bool read(); + + //- Write the basicSolidThermo properties + virtual bool writeData(Ostream& os) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "solidMixtureThermo.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C new file mode 100644 index 0000000000..66f42b9b96 --- /dev/null +++ b/src/thermophysicalModels/basicSolidThermo/solidMixtureThermo/solidMixtureThermo/solidMixtureThermos.C @@ -0,0 +1,99 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "makeSolidMixtureThermo.H" + +#include "constRho.H" + +#include "constSolidThermo.H" +#include "exponentialSolidThermo.H" + +#include "constSolidTransport.H" +#include "exponentialSolidTransport.H" + +#include "constSolidRad.H" + +#include "basicSolidThermo.H" + +#include "multiComponentSolidMixture.H" +#include "reactingSolidMixture.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + multiComponentSolidMixture, + constSolidTransport, + constSolidRad, + constSolidThermo, + constRho +); + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + multiComponentSolidMixture, + exponentialSolidTransport, + constSolidRad, + exponentialSolidThermo, + constRho +); + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + reactingSolidMixture, + exponentialSolidTransport, + constSolidRad, + exponentialSolidThermo, + constRho +); + +makeSolidMixtureThermo +( + basicSolidThermo, + solidMixtureThermo, + reactingSolidMixture, + constSolidTransport, + constSolidRad, + constSolidThermo, + constRho +); + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolidMixture/Make/files b/src/thermophysicalModels/pointSolidMixture/Make/files new file mode 100644 index 0000000000..17cad4937b --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/Make/files @@ -0,0 +1,3 @@ +pointSolidMixture/pointSolidMixture.C + +LIB = $(FOAM_LIBBIN)/libpointSolidMixture diff --git a/src/thermophysicalModels/pointSolidMixture/Make/options b/src/thermophysicalModels/pointSolidMixture/Make/options new file mode 100644 index 0000000000..db6f1fe921 --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/Make/options @@ -0,0 +1,3 @@ +EXE_INC = \ + -I${LIB_SRC}/thermophysicalModels/pointSolids/lnInclude \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude diff --git a/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C new file mode 100644 index 0000000000..cb6440c604 --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.C @@ -0,0 +1,128 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "pointSolidMixture.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::pointSolidMixture::pointSolidMixture +( + const dictionary& thermophysicalProperties +) +: + components_(thermophysicalProperties.lookup("solidComponents")), + properties_(components_.size()) +{ + // can use sub-dictionary "solidProperties" to avoid + // collisions with identically named gas-phase entries + const dictionary* subDictPtr = thermophysicalProperties.subDictPtr + ( + "solidProperties" + ); + + const dictionary& props = + ( + subDictPtr ? *subDictPtr : thermophysicalProperties + ); + + forAll(components_, i) + { + properties_.set(i, pointSolid::New(props.subDict(components_[i]))); + } +} + + +Foam::pointSolidMixture::pointSolidMixture(const pointSolidMixture& s) +: + components_(s.components_), + properties_(s.properties_.size()) +{ + forAll(properties_, i) + { + properties_.set(i, s.properties_(i)->clone()); + } +} + + +// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::pointSolidMixture::New +( + const dictionary& thermophysicalProperties +) +{ + return autoPtr(new +pointSolidMixture(thermophysicalProperties)); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +Foam::scalarField Foam::pointSolidMixture::X +( + const scalarField& Y +) const +{ + scalarField X(Y.size()); + scalar rhoInv = 0.0; + forAll(X, i) + { + rhoInv += Y[i]/properties_[i].rho(); + X[i] = Y[i]/properties_[i].rho(); + } + + return X/rhoInv; +} + + +Foam::scalar Foam::pointSolidMixture::rho +( + const scalarField& X +) const +{ + scalar val = 0.0; + forAll(properties_, i) + { + val += properties_[i].rho()*X[i]; + } + return val; +} + + +Foam::scalar Foam::pointSolidMixture::Cp +( + const scalarField& Y +) const +{ + scalar val = 0.0; + forAll(properties_, i) + { + val += properties_[i].Cp()*Y[i]; + } + return val; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H new file mode 100644 index 0000000000..7c8967b707 --- /dev/null +++ b/src/thermophysicalModels/pointSolidMixture/pointSolidMixture/pointSolidMixture.H @@ -0,0 +1,144 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +Class + Foam::pointSolidMixture + +Description + A mixture of solids. + +Note + The dictionary constructor searches for the entry @c solidComponents, + which is a wordList. The pointSolid properties of each component can either + be contained within a @c solidProperties sub-dictionary or (for legacy + purposes) can be found directly in the dictionary. + The @c solidProperties sub-dictionary entry should be used when possible + to avoid conflicts with identically named gas-phase entries. + +SeeAlso + Foam::pointSolidMixture + +\*---------------------------------------------------------------------------*/ + +#ifndef pointSolidMixture_H +#define pointSolidMixture_H + +#include "scalarField.H" +#include "PtrList.H" +#include "pointSolid.H" +#include "autoPtr.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class pointSolidMixture Declaration +\*---------------------------------------------------------------------------*/ + +class pointSolidMixture +{ + // Private data + + //- The names of the solids + List components_; + + //- The pointSolid properties + PtrList properties_; + + +public: + + // Constructors + + //- Construct from dictionary + pointSolidMixture(const dictionary&); + + //- Construct copy + pointSolidMixture(const pointSolidMixture& lm); + + //- Construct and return a clone + virtual autoPtr clone() const + { + return autoPtr(new pointSolidMixture(*this)); + } + + + //- Destructor + virtual ~pointSolidMixture() + {} + + + // Selectors + + //- Select construct from dictionary + static autoPtr New(const dictionary&); + + + // Member Functions + + //- Return the pointSolid names + inline const List& components() const + { + return components_; + } + + //- Return the pointSolid properties + inline const PtrList& properties() const + { + return properties_; + } + + //- Return the number of solids in the mixture + inline label size() const + { + return components_.size(); + } + + + //- Returns the mass fractions, given mole fractions + scalarField Y(const scalarField& X) const; + + //- Returns the mole fractions, given mass fractions + scalarField X(const scalarField& Y) const; + + //- Calculate the mixture density [kg/m^3] as a function of + // volume fractions + scalar rho(const scalarField& X) const; + + //- Calculate the mixture heat capacity [J/(kg K)] as a function + // of mass fractions + scalar Cp(const scalarField& Y) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/C/C.C b/src/thermophysicalModels/pointSolids/C/C.C new file mode 100644 index 0000000000..e8d4d52a97 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/C/C.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "C.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(C, 0); + addToRunTimeSelectionTable(pointSolid, C,); + addToRunTimeSelectionTable(pointSolid, C, Istream); + addToRunTimeSelectionTable(pointSolid, C, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::C::C() +: + pointSolid(2010, 710, 0.04, 0.0, 1.0) +{ + if (debug) + { + WarningIn("C::C()") + << "Properties of graphite need to be checked!!!" + << endl; + } +} + + +Foam::C::C(const pointSolid& s) +: + pointSolid(s) +{} + + +Foam::C::C(Istream& is) +: + pointSolid(is) +{} + + +Foam::C::C(const dictionary& dict) +: + pointSolid(dict) +{} + + +Foam::C::C(const C& s) +: + pointSolid(s) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::C::writeData(Ostream& os) const +{ + pointSolid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const C& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/C/C.H b/src/thermophysicalModels/pointSolids/C/C.H new file mode 100644 index 0000000000..260e19bf04 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/C/C.H @@ -0,0 +1,111 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +Class + Foam::C + +Description + Graphite + +SourceFiles + C.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_C_H +#define solid_C_H + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class C; + +Ostream& operator<< +( + Ostream&, + const C& +); + + +/*---------------------------------------------------------------------------*\ + Class C Declaration +\*---------------------------------------------------------------------------*/ + +class C +: + public pointSolid +{ +public: + + //- Runtime type information + TypeName("C"); + + + // Constructors + + //- Construct null + C(); + + //- Construct from pointSolid + C(const pointSolid& s); + + //- Construct from Istream + C(Istream& is); + + //- Construct from dictionary + C(const dictionary& dict); + + //- Construct copy + C(const C& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new C(*this)); + } + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + //- Ostream Operator + friend Ostream& operator<<(Ostream& os, const C& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C new file mode 100644 index 0000000000..909724793c --- /dev/null +++ b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "CaCO3.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(CaCO3, 0); + addToRunTimeSelectionTable(pointSolid, CaCO3,); + addToRunTimeSelectionTable(pointSolid, CaCO3, Istream); + addToRunTimeSelectionTable(pointSolid, CaCO3, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::CaCO3::CaCO3() +: + pointSolid(2710, 850, 1.3, 0.0, 1.0) +{ + if (debug) + { + WarningIn("CaCO3::CaCO3()") + << "Properties of CaCO3 need to be checked!!!" + << endl; + } +} + + +Foam::CaCO3::CaCO3(const pointSolid& s) +: + pointSolid(s) +{} + + +Foam::CaCO3::CaCO3(Istream& is) +: + pointSolid(is) +{} + + +Foam::CaCO3::CaCO3(const dictionary& dict) +: + pointSolid(dict) +{} + + +Foam::CaCO3::CaCO3(const CaCO3& s) +: + pointSolid(s) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::CaCO3::writeData(Ostream& os) const +{ + pointSolid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const CaCO3& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H new file mode 100644 index 0000000000..ff3bd29a92 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/CaCO3/CaCO3.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +Class + Foam::CaCO3 + +Description + Calcium carbonate (limestone) + +SourceFiles + CaCO3.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_CaCO3_H +#define solid_CaCO3_H + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class CaCO3; + +Ostream& operator<< +( + Ostream&, + const CaCO3& +); + + +/*---------------------------------------------------------------------------*\ + Class CaCO3 Declaration +\*---------------------------------------------------------------------------*/ + +class CaCO3 +: + public pointSolid +{ + +public: + + //- Runtime type information + TypeName("CaCO3"); + + + // Constructors + + //- Construct null + CaCO3(); + + //- Construct from pointSolid + CaCO3(const pointSolid& s); + + //- Construct from Istream + CaCO3(Istream& is); + + //- Construct from dictionary + CaCO3(const dictionary& dict); + + //- Construct copy + CaCO3(const CaCO3& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new CaCO3(*this)); + } + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream& os, const CaCO3& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/Make/files b/src/thermophysicalModels/pointSolids/Make/files new file mode 100644 index 0000000000..526d251970 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/Make/files @@ -0,0 +1,8 @@ +pointSolid/pointSolid.C +pointSolid/pointSolidNew.C + +ash/ash.C +C/C.C +CaCO3/CaCO3.C + +LIB = $(FOAM_LIBBIN)/libpointSolids diff --git a/src/thermophysicalModels/pointSolids/Make/options b/src/thermophysicalModels/pointSolids/Make/options new file mode 100644 index 0000000000..d10d7744b5 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/Make/options @@ -0,0 +1,3 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude + diff --git a/src/thermophysicalModels/pointSolids/ash/ash.C b/src/thermophysicalModels/pointSolids/ash/ash.C new file mode 100644 index 0000000000..e8457ad401 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/ash/ash.C @@ -0,0 +1,95 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "ash.H" +#include "addToRunTimeSelectionTable.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(ash, 0); + addToRunTimeSelectionTable(pointSolid, ash,); + addToRunTimeSelectionTable(pointSolid, ash, Istream); + addToRunTimeSelectionTable(pointSolid, ash, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::ash::ash() +: + pointSolid(2010, 710, 0.04, 0.0, 1.0) +{ + if (debug) + { + WarningIn("ash::ash()") + << "Properties of ash need to be checked!!!" + << endl; + } +} + + +Foam::ash::ash(const pointSolid& s) +: + pointSolid(s) +{} + + +Foam::ash::ash(Istream& is) +: + pointSolid(is) +{} + + +Foam::ash::ash(const dictionary& dict) +: + pointSolid(dict) +{} + + +Foam::ash::ash(const ash& s) +: + pointSolid(s) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::ash::writeData(Ostream& os) const +{ + pointSolid::writeData(os); +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const ash& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/ash/ash.H b/src/thermophysicalModels/pointSolids/ash/ash.H new file mode 100644 index 0000000000..4d0f249576 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/ash/ash.H @@ -0,0 +1,113 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +Class + Foam::ash + +Description + Coal ash + +SourceFiles + ash.C + +\*---------------------------------------------------------------------------*/ + +#ifndef solid_ash_H +#define solid_ash_H + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class ash; + +Ostream& operator<< +( + Ostream&, + const ash& +); + + +/*---------------------------------------------------------------------------*\ + Class ash Declaration +\*---------------------------------------------------------------------------*/ + +class ash +: + public pointSolid +{ + +public: + + //- Runtime type information + TypeName("ash"); + + + // Constructors + + //- Construct null + ash(); + + //- Construct from pointSolid + ash(const pointSolid& s); + + //- Construct from Istream + ash(Istream& is); + + //- Construct from dictionary + ash(const dictionary& dict); + + //- Construct copy + ash(const ash& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new ash(*this)); + } + + + // I-O + + //- Write the function coefficients + void writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream& os, const ash& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C new file mode 100644 index 0000000000..e4e74da8d4 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.C @@ -0,0 +1,108 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "pointSolid.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(pointSolid, 0); + defineRunTimeSelectionTable(pointSolid,); + defineRunTimeSelectionTable(pointSolid, Istream); + defineRunTimeSelectionTable(pointSolid, dictionary); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::pointSolid::pointSolid +( + scalar rho, + scalar Cp, + scalar K, + scalar Hf, + scalar emissivity +) +: + rho_(rho), + Cp_(Cp), + K_(K), + Hf_(Hf), + emissivity_(emissivity) +{} + + +Foam::pointSolid::pointSolid(Istream& is) +: + rho_(readScalar(is)), + Cp_(readScalar(is)), + K_(readScalar(is)), + Hf_(readScalar(is)), + emissivity_(readScalar(is)) +{} + + +Foam::pointSolid::pointSolid(const dictionary& dict) +: + rho_(readScalar(dict.lookup("rho"))), + Cp_(readScalar(dict.lookup("Cp"))), + K_(readScalar(dict.lookup("K"))), + Hf_(readScalar(dict.lookup("Hf"))), + emissivity_(readScalar(dict.lookup("emissivity"))) +{} + + +Foam::pointSolid::pointSolid(const pointSolid& s) +: + rho_(s.rho_), + Cp_(s.Cp_), + K_(s.K_), + Hf_(s.Hf_), + emissivity_(s.emissivity_) +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::pointSolid::writeData(Ostream& os) const +{ + os << rho_ << token::SPACE + << Cp_ << token::SPACE + << K_ << token::SPACE + << Hf_ << token::SPACE + << emissivity_; +} + + +// * * * * * * * * * * * * * * IOStream operators * * * * * * * * * * * * * // + +Foam::Ostream& Foam::operator<<(Ostream& os, const pointSolid& s) +{ + s.writeData(os); + return os; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H new file mode 100644 index 0000000000..fba0d739ae --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolid.H @@ -0,0 +1,210 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +Class + Foam::pointSolid + +Description + The thermophysical properties of a pointSolid + +SourceFiles + pointSolid.C + +\*---------------------------------------------------------------------------*/ + +#ifndef pointSolid_H +#define pointSolid_H + +#include "typeInfo.H" +#include "autoPtr.H" +#include "runTimeSelectionTables.H" +#include "dictionary.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +class pointSolid; + +Ostream& operator<< +( + Ostream&, + const pointSolid& +); + + +/*---------------------------------------------------------------------------*\ + Class pointSolid Declaration +\*---------------------------------------------------------------------------*/ + +class pointSolid +{ + + // Private data + + //- Density [kg/m3] + scalar rho_; + + //- Specific heat capacity [J/(kg.K)] + scalar Cp_; + + //- Thermal conductivity [W/(m.K)] + scalar K_; + + //- Heat of formation [J/kg] + scalar Hf_; + + //- Emissivity + scalar emissivity_; + + +public: + + //- Runtime type information + TypeName("pointSolid"); + + + // Declare run-time constructor selection tables + + declareRunTimeSelectionTable + ( + autoPtr, + pointSolid, + , + (), + () + ); + + declareRunTimeSelectionTable + ( + autoPtr, + pointSolid, + Istream, + (Istream& is), + (is) + ); + + declareRunTimeSelectionTable + ( + autoPtr, + pointSolid, + dictionary, + (const dictionary& dict), + (dict) + ); + + + // Constructors + + //- Construct from components + pointSolid + ( + scalar rho, + scalar Cp, + scalar K, + scalar Hf, + scalar emissivity + ); + + //- Construct from Istream + pointSolid(Istream& is); + + //- Construct from dictionary + pointSolid(const dictionary& dict); + + //- Construct copy + pointSolid(const pointSolid& s); + + //- Construct and return clone + virtual autoPtr clone() const + { + return autoPtr(new pointSolid(*this)); + } + + + // Selectors + + //- Return a pointer to a new pointSolid created from input + static autoPtr New(Istream& is); + + //- Return a pointer to a new pointSolid created from dictionary + static autoPtr New(const dictionary& dict); + + + //- Destructor + virtual ~pointSolid() + {} + + + // Member Functions + + // Physical constants which define the pointSolid + + //- Density [kg/m3] + inline scalar rho() const; + + //- Specific heat capacity [J/(kg.K)] + inline scalar Cp() const; + + //- Thermal conductivity [W/(m.K)] + inline scalar K() const; + + //- Heat of formation [J/kg] + inline scalar Hf() const; + + //- Total enthalpy - reference to Tstd [J/kg] + inline scalar H(const scalar T) const; + + //- Sensible enthalpy - reference to Tstd [J/kg] + inline scalar Hs(const scalar T) const; + + //- Emissivity [] + inline scalar emissivity() const; + + + // I-O + + //- Write the pointSolid properties + virtual void writeData(Ostream& os) const; + + + // Ostream Operator + + friend Ostream& operator<<(Ostream& os, const pointSolid& s); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "pointSolidI.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H new file mode 100644 index 0000000000..f4c6773454 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidI.H @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "specie.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +inline Foam::scalar Foam::pointSolid::rho() const +{ + return rho_; +} + + +inline Foam::scalar Foam::pointSolid::Cp() const +{ + return Cp_; +} + + +inline Foam::scalar Foam::pointSolid::K() const +{ + return K_; +} + + +inline Foam::scalar Foam::pointSolid::Hf() const +{ + return Hf_; +} + + +inline Foam::scalar Foam::pointSolid::H(const scalar T) const +{ + return Hs(T) + Hf_; +} + + +inline Foam::scalar Foam::pointSolid::Hs(const scalar T) const +{ + return Cp_*(T - specie::Tstd); +} + + +inline Foam::scalar Foam::pointSolid::emissivity() const +{ + return emissivity_; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C new file mode 100644 index 0000000000..74096983e2 --- /dev/null +++ b/src/thermophysicalModels/pointSolids/pointSolid/pointSolidNew.C @@ -0,0 +1,132 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 1991-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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "pointSolid.H" +#include "Switch.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +Foam::autoPtr Foam::pointSolid::New(Istream& is) +{ + if (debug) + { + Info<< "pointSolid::New(Istream&): constructing pointSolid" << endl; + } + + const word solidType(is); + const word coeffs(is); + + if (coeffs == "defaultCoeffs") + { + ConstructorTable::iterator cstrIter = + ConstructorTablePtr_->find(solidType); + + if (cstrIter == ConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(Istream&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << ConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()()); + } + else if (coeffs == "coeffs") + { + IstreamConstructorTable::iterator cstrIter = + IstreamConstructorTablePtr_->find(solidType); + + if (cstrIter == IstreamConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(Istream&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << IstreamConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(is)); + } + else + { + FatalErrorIn("pointSolid::New(Istream&)") + << "pointSolid type " << solidType + << ", option " << coeffs << " given" + << ", should be coeffs or defaultCoeffs" + << exit(FatalError); + + return autoPtr(NULL); + } +} + + +Foam::autoPtr Foam::pointSolid::New(const dictionary& dict) +{ + if (debug) + { + Info<< "pointSolid::New(const dictionary&): constructing pointSolid" + << endl; + } + + const word solidType(dict.dictName()); + const Switch defaultCoeffs(dict.lookup("defaultCoeffs")); + + if (defaultCoeffs) + { + ConstructorTable::iterator cstrIter = + ConstructorTablePtr_->find(solidType); + + if (cstrIter == ConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(const dictionary&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << ConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()()); + } + else + { + dictionaryConstructorTable::iterator cstrIter = + dictionaryConstructorTablePtr_->find(solidType); + + if (cstrIter == dictionaryConstructorTablePtr_->end()) + { + FatalErrorIn("pointSolid::New(const dictionary&)") + << "Unknown pointSolid type " << solidType << nl << nl + << "Valid pointSolid types are :" << endl + << dictionaryConstructorTablePtr_->sortedToc() + << exit(FatalError); + } + + return autoPtr(cstrIter()(dict)); + } +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/thermophysicalModels/solid/Make/files b/src/thermophysicalModels/solid/Make/files new file mode 100644 index 0000000000..b9ccaf886f --- /dev/null +++ b/src/thermophysicalModels/solid/Make/files @@ -0,0 +1,8 @@ +rhoType/const/constRho.C + +reaction/Reactions/solidReaction/solidReaction.C + +reaction/reactions/makeSolidReactionThermoReactions.C + + +LIB = $(FOAM_LIBBIN)/libsolid diff --git a/src/thermophysicalModels/solid/Make/options b/src/thermophysicalModels/solid/Make/options new file mode 100644 index 0000000000..848cce789f --- /dev/null +++ b/src/thermophysicalModels/solid/Make/options @@ -0,0 +1,2 @@ +EXE_INC = \ + -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude diff --git a/src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H b/src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H new file mode 100644 index 0000000000..1eb9b34740 --- /dev/null +++ b/src/thermophysicalModels/solid/include/solidThermoPhysicsTypes.H @@ -0,0 +1,71 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Typedefs + Foam::solidThermoPhysicsTypes + +Description + Type definitions for solid-thermo-physics models + +\*---------------------------------------------------------------------------*/ + +#ifndef solidThermoPhysicsTypes_H +#define solidThermoPhysicsTypes_H + +#include "constRho.H" + +#include "constSolidThermo.H" +#include "exponentialSolidThermo.H" + +#include "constSolidTransport.H" +#include "exponentialSolidTransport.H" + +#include "constSolidRad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + typedef constSolidTransport > > + constSolidThermoPhysics; + + typedef constSolidTransport + < + constSolidRad + < + exponentialSolidThermo + < + constRho + > + > + > + expoSolidThermoPhysics; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // + diff --git a/src/thermophysicalModels/solid/radiation/const/constSolidRad.C b/src/thermophysicalModels/solid/radiation/const/constSolidRad.C new file mode 100644 index 0000000000..b4ec108951 --- /dev/null +++ b/src/thermophysicalModels/solid/radiation/const/constSolidRad.C @@ -0,0 +1,72 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "constSolidRad.H" +#include "IOstreams.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +constSolidRad::constSolidRad(const dictionary& dict) +: + thermo(dict), + kappa_(readScalar(dict.subDict("radiativeProperties").lookup("kappa"))), + sigmaS_ + ( + readScalar + ( + dict.subDict("radiativeProperties").lookup("sigmaS") + ) + ), + emissivity_ + ( + readScalar(dict.subDict("radiativeProperties").lookup("emissivity")) + ) +{} + + +// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * // + +template +Ostream& operator<<(Ostream& os, const constSolidRad& pg) +{ + os << static_cast(pg); + os << tab << pg.kappa_ << tab << pg.sigmaS_ << tab << pg.emissivity_; + + os.check("Ostream& operator<<(Ostream& os, const constSolidRad& st)"); + return os; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/radiation/const/constSolidRad.H b/src/thermophysicalModels/solid/radiation/const/constSolidRad.H new file mode 100644 index 0000000000..28d537cf39 --- /dev/null +++ b/src/thermophysicalModels/solid/radiation/const/constSolidRad.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::constSolidRad + +Description + Constant radiative properties + +SourceFiles + constSolidRadI.H + constSolidRad.C + +\*---------------------------------------------------------------------------*/ + +#ifndef constSolidRad_H +#define constSolidRad_H + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +template class constSolidRad; + +template +Ostream& operator<< +( + Ostream&, + const constSolidRad& +); + +/*---------------------------------------------------------------------------*\ + Class constSolidRad Declaration +\*---------------------------------------------------------------------------*/ + +template +class constSolidRad +: + public thermo +{ + // Private data + + //- Absorption coefficient + scalar kappa_; + + //- Scattering coefficient + scalar sigmaS_; + + //- Emissivity coefficient + scalar emissivity_; + + + //- Construct from components + inline constSolidRad + ( + const thermo& t, + const scalar kappa, + const scalar sigmaS, + const scalar emissivity + ); + + +public: + + // Constructors + + //- Construct from Istream + constSolidRad(const dictionary&); + + //- Construct as named copy + inline constSolidRad(const word& name, const constSolidRad&); + + //- Construct and return a clone + inline autoPtr clone() const; + + // Selector from Istream + inline static autoPtr New(Istream& is); + + + // Member functions + + //- Return absorption coefficient [1/m] + inline scalar kappa(scalar T) const; + + //- Return scattering [1/m] + inline scalar sigmaS(scalar T) const; + + //- Return emissivity[] + inline scalar emissivity(scalar T) const; + + + // Ostream Operator + + friend Ostream& operator<< + ( + Ostream&, + const constSolidRad& + ); +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#include "constSolidRadI.H" + +#ifdef NoRepository +# include "constSolidRad.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/radiation/const/constSolidRadI.H b/src/thermophysicalModels/solid/radiation/const/constSolidRadI.H new file mode 100644 index 0000000000..82a99474e9 --- /dev/null +++ b/src/thermophysicalModels/solid/radiation/const/constSolidRadI.H @@ -0,0 +1,109 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "constSolidRad.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +inline constSolidRad::constSolidRad +( + const thermo& t, + const scalar kappa, + const scalar sigmaS, + const scalar emissivity +) +: + thermo(t), + kappa_(kappa), + sigmaS_(sigmaS), + emissivity_(emissivity) +{} + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + + +template +inline constSolidRad::constSolidRad +( + const word& name, + const constSolidRad& pg +) +: + thermo(name, pg), + kappa_(pg.kappa_), + sigmaS_(pg.sigmaS_), + emissivity_(pg.emissivity_) +{} + + +template +inline autoPtr > constSolidRad::clone() const +{ + return autoPtr >(new constSolidRad(*this)); +} + + +template +inline autoPtr > constSolidRad::New(Istream& is) +{ + return autoPtr >(new constSolidRad(is)); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +inline scalar constSolidRad::kappa(scalar) const +{ + return kappa_; +} + + +template +inline scalar constSolidRad::sigmaS(scalar) const +{ + return sigmaS_; +} + + +template +inline scalar constSolidRad::emissivity(scalar) const +{ + return emissivity_; +} + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C new file mode 100644 index 0000000000..c181cd9847 --- /dev/null +++ b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.C @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "IrreversibleSolidReaction.H" + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +template +Foam::IrreversibleSolidReaction::IrreversibleSolidReaction +( + const solidReaction& reaction, + const ReactionRate& k, + const scalar nReact +) +: + solidReaction(reaction), + k_(k), + nReact_(nReact) +{} + + +template +Foam::IrreversibleSolidReaction::IrreversibleSolidReaction +( + const speciesTable& components, + Istream& is, + const speciesTable& pyrolysisGases +) +: + solidReaction(components, is, pyrolysisGases), + k_(components, is), + nReact_(readScalar(is)) +{ + is.readEnd("solidArrheniusReactionRate(Istream&)"); +} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +template +Foam::scalar Foam::IrreversibleSolidReaction::kf +( + const scalar T, + const scalar p, + const scalarField& c +) const +{ + return k_(T, p, c); +} + + +template +Foam::scalar Foam::IrreversibleSolidReaction::nReact() const +{ + return nReact_; +} + + +template +void Foam::IrreversibleSolidReaction::write +( + Ostream& os +) const +{ + solidReaction::write(os); + os << token::SPACE << "Reaction order: " << nReact_ << nl << k_; +} + + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H new file mode 100644 index 0000000000..b134416506 --- /dev/null +++ b/src/thermophysicalModels/solid/reaction/Reactions/IrreversibleSolidReaction/IrreversibleSolidReaction.H @@ -0,0 +1,139 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +Class + Foam::IrreversibleSolidReaction + +Description + Simple extension of Reaction to handle reversible reactions + +SourceFiles + IrreversibleSolidReaction.C + +\*---------------------------------------------------------------------------*/ + +#ifndef IrreversibleSolidReaction_H +#define IrreversibleSolidReaction_H + +#include "solidReaction.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class IrreversibleSolidReaction Declaration +\*---------------------------------------------------------------------------*/ + +template +class IrreversibleSolidReaction +: + public solidReaction +{ + // Private data + + // Reaction rate + ReactionRate k_; + + // Reaction order + scalar nReact_; + + + // Private Member Functions + + //- Disallow default bitwise assignment + void operator= + ( + const IrreversibleSolidReaction& + ); + + +public: + + //- Runtime type information + TypeName("irreversible"); + + + // Constructors + + //- Construct from components + IrreversibleSolidReaction + ( + const solidReaction& reaction, + const ReactionRate& reactionRate, + const scalar nReact + ); + + + //- Construct from Istream + IrreversibleSolidReaction + ( + const speciesTable& components, + Istream& is, + const speciesTable& pyrolysisGases + ); + + + //- Destructor + virtual ~IrreversibleSolidReaction() + {} + + + // Member Functions + + // IrreversibleSolidReaction rate coefficients + + //- Forward rate constant + virtual scalar kf + ( + const scalar T, + const scalar p, + const scalarField& c + ) const; + + + //- Reaction order + virtual scalar nReact() const; + + + //- Write + virtual void write(Ostream&) const; +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository +# include "IrreversibleSolidReaction.C" +#endif + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C b/src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C new file mode 100644 index 0000000000..feb993e6aa --- /dev/null +++ b/src/thermophysicalModels/solid/reaction/Reactions/solidReaction/solidReaction.C @@ -0,0 +1,325 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / 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 3 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, see . + +\*---------------------------------------------------------------------------*/ + +#include "solidReaction.H" +#include "DynamicList.H" + +/* * * * * * * * * * * * * * * private static data * * * * * * * * * * * * * */ + +namespace Foam +{ + defineTypeNameAndDebug(solidReaction, 0); + defineRunTimeSelectionTable(solidReaction, Istream); +} + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::solidReaction::solidReaction +( + const speciesTable& componets, + const speciesTable& pyrolisisGases, + const List