diff --git a/src/regionModels/Allwmake b/src/regionModels/Allwmake
index 86638a3ff3..b5074c5001 100755
--- a/src/regionModels/Allwmake
+++ b/src/regionModels/Allwmake
@@ -4,7 +4,7 @@ makeType=${1:-libso}
set -x
wmake $makeType regionModel
-#wmake $makeType pyrolysisModels
+wmake $makeType pyrolysisModels
wmake $makeType surfaceFilmModels
wmake $makeType thermoBaffleModels
#wmake $makeType regionCoupling
diff --git a/src/regionModels/pyrolysisModels/Make/files b/src/regionModels/pyrolysisModels/Make/files
new file mode 100644
index 0000000000..cc875c46ca
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/Make/files
@@ -0,0 +1,15 @@
+/* derived patches */
+
+derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
+derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C
+derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
+derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
+
+
+/* Pyrolysis models */
+pyrolysisModel/pyrolysisModel.C
+pyrolysisModel/pyrolysisModelNew.C
+reactingOneDim/reactingOneDim.C
+noPyrolysis/noPyrolysis.C
+
+LIB = $(FOAM_LIBBIN)/libpyrolysisModels
diff --git a/src/regionModels/pyrolysisModels/Make/options b/src/regionModels/pyrolysisModels/Make/options
new file mode 100644
index 0000000000..4b69dbaac2
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/Make/options
@@ -0,0 +1,25 @@
+
+EXE_INC = \
+ -I$(LIB_SRC)/finiteVolume/lnInclude \
+ -I$(LIB_SRC)/meshTools/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/chemistryModel/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
+ -I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
+ -I$(LIB_SRC)/turbulenceModels \
+ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
+ -I$(LIB_SRC)/turbulenceModels/compressible/RAS/lnInclude \
+ -I$(LIB_SRC)/turbulenceModels/compressible/LES/lnInclude \
+ -I$(LIB_SRC)/turbulenceModels/LES/LESdeltas/lnInclude \
+ -I$(LIB_SRC)/regionModels/regionModel/lnInclude
+
+
+EXE_LIBS = \
+ -lregionModels \
+ -lsolidChemistryModel \
+ -lsolidThermo \
+ -lfiniteVolume \
+ -lmeshTools \
+ -lcompressibleLESModels
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C b/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C
new file mode 100644
index 0000000000..2e0afc81da
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.C
@@ -0,0 +1,223 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2006-2011 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 "flowRateInletVelocityCoupledFvPatchVectorField.H"
+#include "volFields.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "directMappedPatchBase.H"
+#include "mapDistribute.H"
+#include "regionProperties.H"
+#include "basicThermo.H"
+#include "surfaceFields.H"
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+Foam::flowRateInletVelocityCoupledFvPatchVectorField::
+flowRateInletVelocityCoupledFvPatchVectorField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ fixedValueFvPatchField(p, iF),
+ nbrPhiName_("none"),
+ phiName_("phi"),
+ rhoName_("rho")
+{}
+
+
+Foam::flowRateInletVelocityCoupledFvPatchVectorField::
+flowRateInletVelocityCoupledFvPatchVectorField
+(
+ const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ fixedValueFvPatchField(ptf, p, iF, mapper),
+ nbrPhiName_(ptf.nbrPhiName_),
+ phiName_(ptf.phiName_),
+ rhoName_(ptf.rhoName_)
+{}
+
+
+Foam::flowRateInletVelocityCoupledFvPatchVectorField::
+flowRateInletVelocityCoupledFvPatchVectorField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ fixedValueFvPatchField(p, iF, dict),
+ nbrPhiName_(dict.lookupOrDefault("nbrPhi", "phi")),
+ phiName_(dict.lookupOrDefault("phi", "phi")),
+ rhoName_(dict.lookupOrDefault("rho", "rho"))
+{}
+
+
+Foam::flowRateInletVelocityCoupledFvPatchVectorField::
+flowRateInletVelocityCoupledFvPatchVectorField
+(
+ const flowRateInletVelocityCoupledFvPatchVectorField& ptf
+)
+:
+ fixedValueFvPatchField(ptf),
+ nbrPhiName_(ptf.nbrPhiName_),
+ phiName_(ptf.phiName_),
+ rhoName_(ptf.rhoName_)
+{}
+
+
+Foam::flowRateInletVelocityCoupledFvPatchVectorField::
+flowRateInletVelocityCoupledFvPatchVectorField
+(
+ const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
+ const DimensionedField& iF
+)
+:
+ fixedValueFvPatchField(ptf, iF),
+ nbrPhiName_(ptf.nbrPhiName_),
+ phiName_(ptf.phiName_),
+ rhoName_(ptf.rhoName_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ // Get the coupling information from the directMappedPatchBase
+ const directMappedPatchBase& mpp = refCast
+ (
+ patch().patch()
+ );
+ const polyMesh& nbrMesh = mpp.sampleMesh();
+ const fvPatch& nbrPatch = refCast
+ (
+ nbrMesh
+ ).boundary()[mpp.samplePolyPatch().index()];
+
+ // Force recalculation of mapping and schedule
+ const mapDistribute& distMap = mpp.map();
+
+ scalarList phi =
+ nbrPatch.lookupPatchField(nbrPhiName_);
+
+ mapDistribute::distribute
+ (
+ Pstream::defaultCommsType,
+ distMap.schedule(),
+ distMap.constructSize(),
+ distMap.subMap(), // what to send
+ distMap.constructMap(), // what to receive
+ phi
+ );
+
+ const surfaceScalarField& phiName =
+ db().lookupObject(phiName_);
+
+
+ // a simpler way of doing this would be nice
+ //scalar avgU = -flowRate_/gSum(patch().magSf());
+ scalarField U = -phi/patch().magSf();
+
+ vectorField n = patch().nf();
+
+// const surfaceScalarField& phi =
+// db().lookupObject(phiName_);
+
+ if (phiName.dimensions() == dimVelocity*dimArea)
+ {
+ // volumetric flow-rate
+ operator==(n*U);
+ }
+ else if (phiName.dimensions() == dimDensity*dimVelocity*dimArea)
+ {
+ const fvPatchField& rhop =
+ patch().lookupPatchField(rhoName_);
+
+ // mass flow-rate
+ operator==(n*U/rhop);
+
+ if (debug)
+ {
+ scalar phi = gSum(rhop*(*this) & patch().Sf());
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " <- "
+ << nbrMesh.name() << ':'
+ << nbrPatch.name() << ':'
+ << this->dimensionedInternalField().name() << " :"
+ << " mass flux[Kg/s]:" << -phi
+ << endl;
+ }
+ }
+ else
+ {
+ FatalErrorIn
+ (
+ "flowRateInletVelocityCoupledFvPatchVectorField::updateCoeffs()"
+ ) << "dimensions of " << phiName_ << " are incorrect" << nl
+ << " on patch " << this->patch().name()
+ << " of field " << this->dimensionedInternalField().name()
+ << " in file " << this->dimensionedInternalField().objectPath()
+ << nl << exit(FatalError);
+ }
+
+ fixedValueFvPatchField::updateCoeffs();
+}
+
+
+void Foam::flowRateInletVelocityCoupledFvPatchVectorField::write(Ostream& os) const
+{
+ fvPatchField::write(os);
+ writeEntryIfDifferent(os, "phi", "phi", phiName_);
+ writeEntryIfDifferent(os, "rho", "rho", rhoName_);
+ os.writeKeyword("nbrPhi") << nbrPhiName_ << token::END_STATEMENT << nl;
+ writeEntry("value", os);
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ makePatchTypeField
+ (
+ fvPatchVectorField,
+ flowRateInletVelocityCoupledFvPatchVectorField
+ );
+}
+
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.H b/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.H
new file mode 100644
index 0000000000..e44a26bf1f
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/flowRateInletVelocityCoupled/flowRateInletVelocityCoupledFvPatchVectorField.H
@@ -0,0 +1,180 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2006-2011 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::flowRateInletVelocityCoupledFvPatchVectorField
+
+Description
+ Describes a volumetric/mass flow normal vector boundary condition by its
+ magnitude as an integral over its area.
+
+ The inlet mass flux is taken from the neighbor region.
+
+ phi is used to determine if the flow is compressible or incompressible.
+
+ The basis of the patch (volumetric or mass) is determined by the
+ dimensions of the flux, phi.
+ The current density is used to correct the velocity when applying the
+ mass basis.
+
+ Example of the boundary condition specification:
+ @verbatim
+ inlet
+ {
+ type flowRateInletVelocityCoupled;
+ phi phi;
+ rho rho;
+ neigPhi neigPhiName_; // Volumetric/mass flow rate [m3/s or kg/s]
+ value uniform (0 0 0); // placeholder
+ }
+ @endverbatim
+
+Note
+ - The value is positive inwards
+ - May not work correctly for transonic inlets
+ - Strange behaviour with potentialFoam since the U equation is not solved
+
+SourceFiles
+ flowRateInletVelocityCoupledFvPatchVectorField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef flowRateInletVelocityCoupledFvPatchVectorField_H
+#define flowRateInletVelocityCoupledFvPatchVectorField_H
+
+#include "fixedValueFvPatchFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+/*---------------------------------------------------------------------------*\
+ Class flowRateInletVelocityFvPatch Declaration
+\*---------------------------------------------------------------------------*/
+
+class flowRateInletVelocityCoupledFvPatchVectorField
+:
+ public fixedValueFvPatchVectorField
+{
+ // Private data
+
+ //- Name of the neighbor flux setting the inlet mass flux
+ word nbrPhiName_;
+
+ //- Name of the local mass flux
+ word phiName_;
+
+ //- Name of the density field used to normalize the mass flux
+ word rhoName_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("flowRateInletVelocityCoupled");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ flowRateInletVelocityCoupledFvPatchVectorField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ flowRateInletVelocityCoupledFvPatchVectorField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given
+ // flowRateInletVelocityCoupledFvPatchVectorField
+ // onto a new patch
+ flowRateInletVelocityCoupledFvPatchVectorField
+ (
+ const flowRateInletVelocityCoupledFvPatchVectorField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ flowRateInletVelocityCoupledFvPatchVectorField
+ (
+ const flowRateInletVelocityCoupledFvPatchVectorField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new flowRateInletVelocityCoupledFvPatchVectorField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ flowRateInletVelocityCoupledFvPatchVectorField
+ (
+ const flowRateInletVelocityCoupledFvPatchVectorField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new flowRateInletVelocityCoupledFvPatchVectorField(*this, iF)
+ );
+ }
+
+
+ // Member functions
+
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+ //- Write
+ virtual void write(Ostream&) const;
+
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C b/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
new file mode 100644
index 0000000000..23e11fe5c0
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
@@ -0,0 +1,211 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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 "totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "surfaceFields.H"
+#include "IOobjectList.H"
+#include "LESModel.H"
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
+totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchField(p, iF),
+ phiName_("phi"),
+ rhoName_("none")
+{
+ refValue() = 0.0;
+ refGrad() = 0.0;
+ valueFraction() = 0.0;
+}
+
+
+Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
+totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ mixedFvPatchField(p, iF),
+ phiName_(dict.lookupOrDefault("phi", "phi")),
+ rhoName_(dict.lookupOrDefault("rho", "none"))
+{
+
+ refValue() = 1.0;
+ refGrad() = 0.0;
+ valueFraction() = 0.0;
+
+ if (dict.found("value"))
+ {
+ fvPatchField::operator=
+ (
+ Field("value", dict, p.size())
+ );
+ }
+ else
+ {
+ fvPatchField::operator=(refValue());
+ }
+}
+
+Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
+totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+(
+ const totalFlowRateAdvectiveDiffusiveFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mixedFvPatchField(ptf, p, iF, mapper),
+ phiName_(ptf.phiName_),
+ rhoName_(ptf.rhoName_)
+{}
+
+
+Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
+totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+(
+ const totalFlowRateAdvectiveDiffusiveFvPatchScalarField& tppsf
+)
+:
+ mixedFvPatchField(tppsf),
+ phiName_(tppsf.phiName_),
+ rhoName_(tppsf.rhoName_)
+{}
+
+Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
+totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+(
+ const totalFlowRateAdvectiveDiffusiveFvPatchScalarField& tppsf,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchField(tppsf, iF),
+ phiName_(tppsf.phiName_),
+ rhoName_(tppsf.rhoName_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::autoMap
+(
+ const fvPatchFieldMapper& m
+)
+{
+ scalarField::autoMap(m);
+}
+
+
+void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::rmap
+(
+ const fvPatchScalarField& ptf,
+ const labelList& addr
+)
+{
+ mixedFvPatchField::rmap(ptf, addr);
+}
+
+void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::updateCoeffs()
+{
+
+ if (this->updated())
+ {
+ return;
+ }
+
+ const label patchI = patch().index();
+
+ const compressible::LESModel& turbulence =
+ db().lookupObject
+ (
+ "LESProperties"
+ );
+
+ const fvsPatchField& phip =
+ patch().lookupPatchField(phiName_);
+
+ const scalarField alphap = turbulence.alphaEff()().boundaryField()[patchI];
+
+ refValue() = 1.0;
+ refGrad() = 0.0;
+
+ valueFraction() =
+ 1.0
+ /
+ (
+ 1.0 +
+ alphap*patch().deltaCoeffs()*patch().magSf()/max(mag(phip), SMALL)
+ );
+
+ mixedFvPatchField::updateCoeffs();
+
+ if (debug)
+ {
+ scalar phi = gSum(-phip*(*this));// + alphap*snGrad());
+
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " :"
+ << " mass flux[Kg/s]:" << phi
+ << endl;
+ }
+}
+
+
+void Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
+write(Ostream& os) const
+{
+ fvPatchField::write(os);
+ os.writeKeyword("phi") << phiName_ << token::END_STATEMENT << nl;
+ os.writeKeyword("rho") << rhoName_ << token::END_STATEMENT << nl;
+ this->writeEntry("value", os);
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+ makePatchTypeField
+ (
+ fvPatchScalarField,
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ );
+
+}
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H b/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H
new file mode 100644
index 0000000000..e0120ea8e0
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/totalFlowRateAdvectiveDiffusiveFvPatchScalarField/totalFlowRateAdvectiveDiffusiveFvPatchScalarField.H
@@ -0,0 +1,186 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+
+Description
+ Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+
+SourceFiles
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef totalFlowRateAdvectiveDiffusiveFvPatchScalarField_H
+#define totalFlowRateAdvectiveDiffusiveFvPatchScalarField_H
+
+#include "mixedFvPatchField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+/*---------------------------------------------------------------------------*\
+ Class totalFlowRateAdvectiveDiffusiveFvPatchScalarField Declaration
+\*---------------------------------------------------------------------------*/
+
+class totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+:
+ public mixedFvPatchField
+{
+ // Private data
+
+ //- Name of the flux transporting the field
+ word phiName_;
+
+ //- Name of the density field used to normalise the mass flux
+ // if neccessary
+ word rhoName_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("totalFlowRateAdvectiveDiffusive");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given
+ // totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ // onto a new patch
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ (
+ const totalFlowRateAdvectiveDiffusiveFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct as copy
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ (
+ const totalFlowRateAdvectiveDiffusiveFvPatchScalarField&
+ );
+
+ //- Construct and return a clone
+ virtual tmp > clone() const
+ {
+ return tmp >
+ (
+ new
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField(*this)
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ (
+ const totalFlowRateAdvectiveDiffusiveFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp > clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp >
+ (
+ new
+ totalFlowRateAdvectiveDiffusiveFvPatchScalarField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member functions
+
+ // Access
+
+ //- Return reference to the name of the flux field
+ word& phiName()
+ {
+ return phiName_;
+ }
+
+
+ // Mapping functions
+
+ //- Map (and resize as needed) from self given a mapping object
+ virtual void autoMap
+ (
+ const fvPatchFieldMapper&
+ );
+
+ //- Reverse map the given fvPatchField onto this fvPatchField
+ virtual void rmap
+ (
+ const fvPatchScalarField&,
+ const labelList&
+ );
+
+
+ // Evaluation functions
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+
+#endif
+
+// ************************************************************************* //
+
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
new file mode 100644
index 0000000000..b1c813fa09
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
@@ -0,0 +1,327 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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 "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "directMappedPatchBase.H"
+#include "mapDistribute.H"
+#include "basicThermo.H"
+#include "LESModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace compressible
+{
+namespace LESModels
+{
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchScalarField(p, iF),
+ nbrFieldName_("undefined-nbrFieldName"),
+ KName_("undefined-K")
+{
+ this->refValue() = 0.0;
+ this->refGrad() = 0.0;
+ this->valueFraction() = 1.0;
+}
+
+
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+(
+ const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mixedFvPatchScalarField(ptf, p, iF, mapper),
+ nbrFieldName_(ptf.nbrFieldName_),
+ KName_(ptf.KName_)
+{}
+
+
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ mixedFvPatchScalarField(p, iF),
+ nbrFieldName_(dict.lookup("nbrFieldName")),
+ KName_(dict.lookup("K"))
+{
+ if (!isA(this->patch().patch()))
+ {
+ FatalErrorIn
+ (
+ "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::"
+ "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2\n"
+ "(\n"
+ " const fvPatch& p,\n"
+ " const DimensionedField& iF,\n"
+ " const dictionary& dict\n"
+ ")\n"
+ ) << "\n patch type '" << p.type()
+ << "' not type '" << directMappedPatchBase::typeName << "'"
+ << "\n for patch " << p.name()
+ << " of field " << dimensionedInternalField().name()
+ << " in file " << dimensionedInternalField().objectPath()
+ << exit(FatalError);
+ }
+
+ fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
+
+ if (dict.found("refValue"))
+ {
+ // Full restart
+ refValue() = scalarField("refValue", dict, p.size());
+ refGrad() = scalarField("refGradient", dict, p.size());
+ valueFraction() = scalarField("valueFraction", dict, p.size());
+ }
+ else
+ {
+ // Start from user entered data. Assume fixedValue.
+ refValue() = *this;
+ refGrad() = 0.0;
+ valueFraction() = 1.0;
+ }
+}
+
+
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+(
+ const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& wtcsf,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchScalarField(wtcsf, iF),
+ nbrFieldName_(wtcsf.nbrFieldName_),
+ KName_(wtcsf.KName_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+tmp
+turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K() const
+{
+ const fvMesh& mesh = patch().boundaryMesh().mesh();
+
+ if (KName_ == "none")
+ {
+ const LESModel& model = db().lookupObject("LESProperties");
+
+ const basicThermo& thermo =
+ db().lookupObject("thermophysicalProperties");
+
+ return
+ model.alphaEff()().boundaryField()[patch().index()]
+ *thermo.Cp()().boundaryField()[patch().index()];
+ }
+ else if (mesh.objectRegistry::foundObject(KName_))
+ {
+ return patch().lookupPatchField(KName_);
+ }
+ else if (mesh.objectRegistry::foundObject(KName_))
+ {
+ const symmTensorField& KWall =
+ patch().lookupPatchField(KName_);
+
+ vectorField n = patch().nf();
+
+ return n & KWall & n;
+ }
+ else
+ {
+ FatalErrorIn
+ (
+ "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::K()"
+ " const"
+ ) << "Did not find field " << KName_
+ << " on mesh " << mesh.name() << " patch " << patch().name()
+ << endl
+ << "Please set 'K' to 'none', a valid volScalarField"
+ << " or a valid volSymmTensorField." << exit(FatalError);
+
+ return scalarField(0);
+ }
+}
+
+
+void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ // Get the coupling information from the directMappedPatchBase
+ const directMappedPatchBase& mpp = refCast
+ (
+ patch().patch()
+ );
+ const polyMesh& nbrMesh = mpp.sampleMesh();
+ const fvPatch& nbrPatch = refCast
+ (
+ nbrMesh
+ ).boundary()[mpp.samplePolyPatch().index()];
+
+ // Force recalculation of mapping and schedule
+ const mapDistribute& distMap = mpp.map();
+
+ tmp intFld = patchInternalField();
+
+
+ // Calculate the temperature by harmonic averaging
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+ const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2& nbrField =
+ refCast
+ <
+ const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ >
+ (
+ nbrPatch.lookupPatchField
+ (
+ nbrFieldName_
+ )
+ );
+
+ // Swap to obtain full local values of neighbour internal field
+ scalarField nbrIntFld = nbrField.patchInternalField();
+ mapDistribute::distribute
+ (
+ Pstream::defaultCommsType,
+ distMap.schedule(),
+ distMap.constructSize(),
+ distMap.subMap(), // what to send
+ distMap.constructMap(), // what to receive
+ nbrIntFld
+ );
+
+ // Swap to obtain full local values of neighbour K*delta
+ scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
+ mapDistribute::distribute
+ (
+ Pstream::defaultCommsType,
+ distMap.schedule(),
+ distMap.constructSize(),
+ distMap.subMap(), // what to send
+ distMap.constructMap(), // what to receive
+ nbrKDelta
+ );
+
+ tmp myKDelta = K()*patch().deltaCoeffs();
+
+
+ // Both sides agree on
+ // - temperature : (myKDelta*fld + nbrKDelta*nbrFld)/(myKDelta+nbrKDelta)
+ // - gradient : (temperature-fld)*delta
+ // We've got a degree of freedom in how to implement this in a mixed bc.
+ // (what gradient, what fixedValue and mixing coefficient)
+ // Two reasonable choices:
+ // 1. specify above temperature on one side (preferentially the high side)
+ // and above gradient on the other. So this will switch between pure
+ // fixedvalue and pure fixedgradient
+ // 2. specify gradient and temperature such that the equations are the
+ // same on both sides. This leads to the choice of
+ // - refGradient = zero gradient
+ // - refValue = neighbour value
+ // - mixFraction = nbrKDelta / (nbrKDelta + myKDelta())
+
+
+ this->refValue() = nbrIntFld;
+
+ this->refGrad() = 0.0;
+
+ this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta());
+
+ mixedFvPatchScalarField::updateCoeffs();
+
+
+ if (debug)
+ {
+ scalar Q = gSum(K()*patch().magSf()*snGrad());
+
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " <- "
+ << nbrMesh.name() << ':'
+ << nbrPatch.name() << ':'
+ << this->dimensionedInternalField().name() << " :"
+ << " heat[W]:" << Q
+ << " walltemperature "
+ << " min:" << gMin(*this)
+ << " max:" << gMax(*this)
+ << " avg:" << gAverage(*this)
+ << endl;
+ }
+}
+
+
+void turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2::write
+(
+ Ostream& os
+) const
+{
+ mixedFvPatchScalarField::write(os);
+ os.writeKeyword("nbrFieldName")<< nbrFieldName_
+ << token::END_STATEMENT << nl;
+ os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePatchTypeField
+(
+ fvPatchScalarField,
+ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+);
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace compressible
+} // End namespace Foam
+} // End namespace LESModels
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H
new file mode 100644
index 0000000000..7e2a1634ed
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureCoupledBaffleMixed/turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.H
@@ -0,0 +1,188 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+
+Description
+ Mixed boundary condition for temperature, to be used for heat-transfer
+ on back-to-back baffles.
+
+ If my temperature is T1, neighbour is T2:
+
+ T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
+
+
+ Example usage:
+ myInterfacePatchName
+ {
+ type compressible::turbulentTemperatureCoupledBaffleMixed;
+ nbrFieldName T;
+ K K; // or none
+ value uniform 300;
+ }
+
+ Needs to be on underlying directMapped(Wall)FvPatch.
+
+ Note: if K is "none" looks up RASModel and basicThermo, otherwise expects
+ the solver to calculate a 'K' field.
+
+ Note: runs in parallel with arbitrary decomposition. Uses directMapped
+ functionality to calculate exchange.
+
+ Note: lags interface data so both sides use same data.
+ - problem: schedule to calculate average would interfere
+ with standard processor swaps.
+ - so: updateCoeffs sets both to same Twall. Only need to do
+ this for last outer iteration but don't have access to this.
+
+SourceFiles
+ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
+#define turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2_H
+
+#include "mixedFvPatchFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace compressible
+{
+namespace LESModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 Declaration
+\*---------------------------------------------------------------------------*/
+
+class turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+:
+ public mixedFvPatchScalarField
+{
+ // Private data
+
+ //- Name of field on the neighbour region
+ const word nbrFieldName_;
+
+ //- Name of thermal conductivity field
+ const word KName_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("compressible::turbulentTemperatureCoupledBaffleMixed2");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given
+ // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2 onto a
+ // new patch
+ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ (
+ const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ (
+ *this
+ )
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ (
+ const turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new turbulentTemperatureCoupledBaffleMixedFvPatchScalarField2
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member functions
+
+ //- Get corresponding K field
+ tmp K() const;
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace LESModels
+} // End namespace compressible
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
new file mode 100644
index 0000000000..3f46e158b5
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
@@ -0,0 +1,539 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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 "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H"
+#include "addToRunTimeSelectionTable.H"
+#include "fvPatchFieldMapper.H"
+#include "volFields.H"
+#include "directMappedPatchBase.H"
+#include "mapDistribute.H"
+#include "regionProperties.H"
+#include "basicThermo.H"
+#include "LESModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace compressible
+{
+
+template<>
+const char*
+NamedEnum
+<
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+ operationMode,
+ 4
+>::names[] =
+{
+ "radiative_flux_from_neighbouring_region",
+ "radiative_flux_from_this_region",
+ "no_radiation_contribution",
+ "unknown"
+};
+
+const NamedEnum
+<
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+ operationMode,
+ 4
+>
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+operationModeNames;
+
+
+// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchScalarField(p, iF),
+ neighbourFieldName_("undefined-neighbourFieldName"),
+ neighbourFieldRadiativeName_("undefined-neigbourFieldRadiativeName"),
+ fieldRadiativeName_("undefined-fieldRadiativeName"),
+ KName_("undefined-K"),
+ oldMode_(unknown)
+{
+ this->refValue() = 0.0;
+ this->refGrad() = 0.0;
+ this->valueFraction() = 1.0;
+}
+
+
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+(
+ const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField& ptf,
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const fvPatchFieldMapper& mapper
+)
+:
+ mixedFvPatchScalarField(ptf, p, iF, mapper),
+ neighbourFieldName_(ptf.neighbourFieldName_),
+ neighbourFieldRadiativeName_(ptf.neighbourFieldRadiativeName_),
+ fieldRadiativeName_(ptf.fieldRadiativeName_),
+ KName_(ptf.KName_),
+ oldMode_(ptf.oldMode_)
+{}
+
+
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+(
+ const fvPatch& p,
+ const DimensionedField& iF,
+ const dictionary& dict
+)
+:
+ mixedFvPatchScalarField(p, iF),
+ neighbourFieldName_(dict.lookup("neighbourFieldName")),
+ neighbourFieldRadiativeName_(dict.lookup("neighbourFieldRadiativeName")),
+ fieldRadiativeName_(dict.lookup("fieldRadiativeName")),
+ KName_(dict.lookup("K")),
+ oldMode_(unknown)
+{
+ if (!isA(this->patch().patch()))
+ {
+ FatalErrorIn
+ (
+ "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::"
+ "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField\n"
+ "(\n"
+ " const fvPatch& p,\n"
+ " const DimensionedField& iF,\n"
+ " const dictionary& dict\n"
+ ")\n"
+ ) << "\n patch type '" << p.type()
+ << "' not type '" << directMappedPatchBase::typeName << "'"
+ << "\n for patch " << p.name()
+ << " of field " << dimensionedInternalField().name()
+ << " in file " << dimensionedInternalField().objectPath()
+ << exit(FatalError);
+ }
+
+ fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
+
+ if (dict.found("refValue"))
+ {
+ // Full restart
+ refValue() = scalarField("refValue", dict, p.size());
+ refGrad() = scalarField("refGradient", dict, p.size());
+ valueFraction() = scalarField("valueFraction", dict, p.size());
+ }
+ else
+ {
+ // Start from user entered data. Assume fixedValue.
+ refValue() = *this;
+ refGrad() = 0.0;
+ valueFraction() = 1.0;
+ }
+}
+
+
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+(
+ const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&
+ wtcsf,
+ const DimensionedField& iF
+)
+:
+ mixedFvPatchScalarField(wtcsf, iF),
+ neighbourFieldName_(wtcsf.neighbourFieldName_),
+ neighbourFieldRadiativeName_(wtcsf.neighbourFieldRadiativeName_),
+ fieldRadiativeName_(wtcsf.fieldRadiativeName_),
+ KName_(wtcsf.KName_),
+ oldMode_(wtcsf.oldMode_)
+{}
+
+
+// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
+
+tmp
+turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::K() const
+{
+ const fvMesh& mesh = patch().boundaryMesh().mesh();
+
+ if (KName_ == "none")
+ {
+ const compressible::LESModel& model =
+ db().lookupObject("LESProperties");
+
+ const basicThermo& thermo =
+ db().lookupObject("thermophysicalProperties");
+
+ return
+ model.alphaEff()().boundaryField()[patch().index()]
+ *thermo.Cp()().boundaryField()[patch().index()];
+ }
+ else if (mesh.objectRegistry::foundObject(KName_))
+ {
+ return patch().lookupPatchField(KName_);
+ }
+ else if (mesh.objectRegistry::foundObject(KName_))
+ {
+ const symmTensorField& KWall =
+ patch().lookupPatchField(KName_);
+
+ vectorField n = patch().nf();
+
+ return n & KWall & n;
+ }
+ else
+ {
+ FatalErrorIn
+ (
+ "turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::K()"
+ " const"
+ ) << "Did not find field " << KName_
+ << " on mesh " << mesh.name() << " patch " << patch().name()
+ << endl
+ << "Please set 'K' to 'none', a valid volScalarField"
+ << " or a valid volSymmTensorField." << exit(FatalError);
+
+ return scalarField(0);
+ }
+}
+
+
+void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::
+updateCoeffs()
+{
+ if (updated())
+ {
+ return;
+ }
+
+ // Get the coupling information from the directMappedPatchBase
+ const directMappedPatchBase& mpp = refCast
+ (
+ patch().patch()
+ );
+ const polyMesh& nbrMesh = mpp.sampleMesh();
+ const fvPatch& nbrPatch = refCast
+ (
+ nbrMesh
+ ).boundary()[mpp.samplePolyPatch().index()];
+
+ // Force recalculation of mapping and schedule
+ const mapDistribute& distMap = mpp.map();
+
+ scalarField intFld = patchInternalField();
+
+ const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&
+ nbrField =
+ refCast
+ <
+ const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ >
+ (
+ nbrPatch.lookupPatchField
+ (
+ neighbourFieldName_
+ )
+ );
+
+ // Swap to obtain full local values of neighbour internal field
+ scalarField nbrIntFld = nbrField.patchInternalField();
+ mapDistribute::distribute
+ (
+ Pstream::defaultCommsType,
+ distMap.schedule(),
+ distMap.constructSize(),
+ distMap.subMap(), // what to send
+ distMap.constructMap(), // what to receive
+ nbrIntFld
+ );
+
+ if (debug)
+ {
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " :"
+ << " internalT "
+ << " min:" << gMin(*this)
+ << " max:" << gMax(*this)
+ << " avg:" << gAverage(*this)
+ << endl;
+
+ Info<< nbrMesh.name() << ':'
+ << nbrPatch.name() << ':'
+ << this->dimensionedInternalField().name() << " :"
+ << " internalT "
+ << " min:" << gMin(nbrIntFld)
+ << " max:" << gMax(nbrIntFld)
+ << " avg:" << gAverage(nbrIntFld)
+ << endl;
+ }
+
+
+
+ // Check how to operate
+ operationMode mode = unknown;
+ {
+ if (neighbourFieldRadiativeName_ != "none")
+ {
+ if
+ (
+ nbrMesh.foundObject
+ (
+ neighbourFieldRadiativeName_
+ )
+ )
+ {
+ mode = radFromNeighbour;
+ }
+ else
+ {
+ mode = noRad;
+ }
+ }
+ else
+ {
+ if
+ (
+ patch().boundaryMesh().mesh().foundObject
+ (
+ fieldRadiativeName_
+ )
+ )
+ {
+ mode = radFromMe;
+ }
+ else
+ {
+ mode = noRad;
+ }
+ }
+
+ // Do some warnings if change of mode.
+ if (mode != oldMode_)
+ {
+ WarningIn
+ (
+ "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField"
+ "::updateCoeffs()"
+ ) << "Switched from mode " << operationModeNames[oldMode_]
+ << " to mode " << operationModeNames[mode]
+ << endl;
+ }
+ oldMode_ = mode;
+ }
+
+
+
+ // Swap to obtain full local values of neighbour K*delta
+ scalarField nbrKDelta = nbrField.K()*nbrPatch.deltaCoeffs();
+ mapDistribute::distribute
+ (
+ Pstream::defaultCommsType,
+ distMap.schedule(),
+ distMap.constructSize(),
+ distMap.subMap(), // what to send
+ distMap.constructMap(), // what to receive
+ nbrKDelta
+ );
+
+ scalarField myKDelta = K()*patch().deltaCoeffs();
+
+ scalarField nbrConvFlux = nbrKDelta*(*this - nbrIntFld);
+
+ scalarField nbrTotalFlux = nbrConvFlux;
+ scalarList nbrRadField(nbrPatch.size(), 0.0);
+ scalarList myRadField(patch().size(), 0.0);
+
+ // solid
+ if (mode == radFromNeighbour)
+ {
+ nbrRadField =
+ nbrPatch.lookupPatchField
+ (
+ neighbourFieldRadiativeName_
+ );
+
+ // Note: the Qr radiative flux is positive outgoing.
+ // For a hot solid radiating into a cold fluid Qr will be negative.
+
+
+ // Swap to obtain full local values of neighbour radiative heat flux
+ // field
+ mapDistribute::distribute
+ (
+ Pstream::defaultCommsType,
+ distMap.schedule(),
+ distMap.constructSize(),
+ distMap.subMap(), // what to send
+ distMap.constructMap(), // what to receive
+ nbrRadField
+ );
+
+ nbrTotalFlux -= nbrRadField;
+
+ const scalarField Twall =
+ (nbrRadField + myKDelta*intFld + nbrKDelta*nbrIntFld)
+ /(myKDelta + nbrKDelta);
+
+
+ if (debug)
+ {
+ scalar Qr = gSum(nbrRadField*patch().magSf());
+
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " :" << nl
+ << " radiative heat [W] : " << Qr << nl
+ << " predicted wallT [K] : " << gAverage(Twall) << nl
+ << endl;
+ }
+
+ label nFixed = 0;
+
+ forAll(*this, i)
+ {
+
+ this->refValue()[i] = Twall[i];
+ this->refGrad()[i] = 0.0; // not used
+ this->valueFraction()[i] = 1.0;
+ nFixed++;
+ }
+
+ if (debug)
+ {
+ Pout<< "Using " << nFixed << " fixedValue out of " << this->size()
+ << endl;
+ }
+ }
+ else if (mode == radFromMe) //fluid
+ {
+ const scalarField& myRadField =
+ patch().lookupPatchField
+ (
+ fieldRadiativeName_
+ );
+
+ const scalarField Twall =
+ (myRadField + myKDelta*intFld + nbrKDelta*nbrIntFld)
+ /(myKDelta + nbrKDelta);
+
+ if (debug)
+ {
+ scalar Qr = gSum(myRadField*patch().magSf());
+
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " :" << nl
+ << " radiative heat [W] : " << Qr << nl
+ << " predicted wallT [K] : " << gAverage(Twall) << nl
+ << endl;
+ }
+
+ this->refValue() = Twall;
+ this->refGrad() = 0.0; // not used
+ this->valueFraction() = 1.0;
+ }
+ else if (mode == noRad)
+ {
+ this->refValue() = nbrIntFld;
+ this->refGrad() = 0.0;
+ this->valueFraction() = nbrKDelta / (nbrKDelta + myKDelta);
+ }
+ else
+ {
+ FatalErrorIn
+ (
+ "turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField"
+ "::updateCoeffs()"
+ ) << "Illegal mode " << operationModeNames[mode]
+ << exit(FatalError);
+ }
+
+ mixedFvPatchScalarField::updateCoeffs();
+
+ if (debug)
+ {
+ scalar Qc = gSum(nbrConvFlux*patch().magSf());
+ scalar Qr = gSum(nbrRadField*patch().magSf());
+ scalar Qt = gSum(nbrTotalFlux*patch().magSf());
+
+ Info<< patch().boundaryMesh().mesh().name() << ':'
+ << patch().name() << ':'
+ << this->dimensionedInternalField().name() << " <- "
+ << nbrMesh.name() << ':'
+ << nbrPatch.name() << ':'
+ << this->dimensionedInternalField().name() << " :" << nl
+ << " convective heat[W] : " << Qc << nl
+ << " radiative heat [W] : " << Qr << nl
+ << " total heat [W] : " << Qt << nl
+ << " walltemperature "
+ << " min:" << gMin(*this)
+ << " max:" << gMax(*this)
+ << " avg:" << gAverage(*this)
+ << endl;
+ }
+}
+
+
+void turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField::write
+(
+ Ostream& os
+) const
+{
+ mixedFvPatchScalarField::write(os);
+ os.writeKeyword("neighbourFieldName")<< neighbourFieldName_
+ << token::END_STATEMENT << nl;
+ os.writeKeyword("neighbourFieldRadiativeName")<<
+ neighbourFieldRadiativeName_ << token::END_STATEMENT << nl;
+ os.writeKeyword("fieldRadiativeName")<< fieldRadiativeName_
+ << token::END_STATEMENT << nl;
+ os.writeKeyword("K") << KName_ << token::END_STATEMENT << nl;
+// temperatureCoupledBase::write(os);
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+makePatchTypeField
+(
+ fvPatchScalarField,
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+);
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace compressible
+} // End namespace Foam
+
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H
new file mode 100644
index 0000000000..b4dad730b7
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/derivedFvPatchFields/turbulentTemperatureRadiativeCoupledMixed/turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.H
@@ -0,0 +1,218 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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::
+ compressible::
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+
+Description
+ Mixed boundary condition for temperature, to be used for heat-transfer
+ on back-to-back baffles.
+
+ If my temperature is T1, neighbour is T2:
+
+ T1 > T2: my side becomes fixedValue T2 bc, other side becomes fixedGradient.
+
+
+ Example usage:
+ myInterfacePatchName
+ {
+ type compressible::turbulentTemperatureRadiationCoupledMixedST;
+ neighbourFieldName T;
+ K lookup;
+ KName K;
+
+ neighbourFieldRadiativeName Qr; // or none. Use on solid side
+ fieldRadiativeName Qr; // fluid. Use on fluid side
+
+ value uniform 300;
+ }
+
+ Needs to be on underlying directMapped(Wall)FvPatch.
+
+ Note: K : heat conduction at patch. Gets supplied how to lookup/calculate K:
+ - 'lookup' : lookup volScalarField (or volSymmTensorField) with name
+ - 'basicThermo' : use basicThermo and compressible::RASmodel to calculate K
+ - 'solidThermo' : use basicSolidThermo K()
+ - 'directionalSolidThermo' directionalK()
+
+ Note: runs in parallel with arbitrary decomposition. Uses directMapped
+ functionality to calculate exchange.
+
+ Note: lags interface data so both sides use same data.
+ - problem: schedule to calculate average would interfere
+ with standard processor swaps.
+ - so: updateCoeffs sets both to same Twall. Only need to do
+ this for last outer iteration but don't have access to this.
+
+SourceFiles
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H
+#define turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField_H
+
+#include "mixedFvPatchFields.H"
+//#include "temperatureCoupledBase.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace compressible
+{
+
+/*---------------------------------------------------------------------------*\
+ Class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ Declaration
+\*---------------------------------------------------------------------------*/
+
+class turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+:
+ public mixedFvPatchScalarField
+// public temperatureCoupledBase
+{
+ // Private data
+
+ //- Name of field on the neighbour region
+ const word neighbourFieldName_;
+
+ //- Name of the radiative heat flux in the neighbout region
+ const word neighbourFieldRadiativeName_;
+
+ //- Name of the radiative heat flux in the my region
+ const word fieldRadiativeName_;
+
+ //- Name of thermal conductivity field
+ const word KName_;
+
+ //- how to obtain radiative flux
+ enum operationMode
+ {
+ radFromNeighbour,
+ radFromMe,
+ noRad,
+ unknown
+ };
+ static const NamedEnum operationModeNames;
+
+ //- Previous iteration mode
+ operationMode oldMode_;
+
+
+public:
+
+ //- Runtime type information
+ TypeName("compressible::turbulentTemperatureRadiationCoupledMixedST");
+
+
+ // Constructors
+
+ //- Construct from patch and internal field
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&
+ );
+
+ //- Construct from patch, internal field and dictionary
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ (
+ const fvPatch&,
+ const DimensionedField&,
+ const dictionary&
+ );
+
+ //- Construct by mapping given
+ // turbulentTemperatureCoupledBaffleMixedFvPatchScalarField onto a
+ // new patch
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ (
+ const
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&,
+ const fvPatch&,
+ const DimensionedField&,
+ const fvPatchFieldMapper&
+ );
+
+ //- Construct and return a clone
+ virtual tmp clone() const
+ {
+ return tmp
+ (
+ new turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ (
+ *this
+ )
+ );
+ }
+
+ //- Construct as copy setting internal field reference
+ turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ (
+ const turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField&,
+ const DimensionedField&
+ );
+
+ //- Construct and return a clone setting internal field reference
+ virtual tmp clone
+ (
+ const DimensionedField& iF
+ ) const
+ {
+ return tmp
+ (
+ new turbulentTemperatureRadiationCoupledMixedSTFvPatchScalarField
+ (
+ *this,
+ iF
+ )
+ );
+ }
+
+
+ // Member functions
+
+ //- Get corresponding K field
+ tmp K() const;
+
+ //- Update the coefficients associated with the patch field
+ virtual void updateCoeffs();
+
+ //- Write
+ virtual void write(Ostream&) const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace compressible
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
new file mode 100644
index 0000000000..7c3499b4e2
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
@@ -0,0 +1,147 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-2011 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 "noPyrolysis.H"
+#include "addToRunTimeSelectionTable.H"
+#include "volFields.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(noPyrolysis, 0);
+addToRunTimeSelectionTable(pyrolysisModel, noPyrolysis, mesh);
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+bool noPyrolysis::read()
+{
+ if (pyrolysisModel::read())
+ {
+ // no additional info to read
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+noPyrolysis::noPyrolysis(const word& modelType, const fvMesh& mesh)
+:
+ pyrolysisModel(mesh)
+{}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+noPyrolysis::~noPyrolysis()
+{}
+
+
+// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
+
+const volScalarField& noPyrolysis::rho() const
+{
+ FatalErrorIn("const volScalarField& noPyrolysis::rho() const")
+ << "rho field not available for " << type() << abort(FatalError);
+ return volScalarField::null();
+}
+
+
+const volScalarField& noPyrolysis::T() const
+{
+ FatalErrorIn("const volScalarField& noPyrolysis::T() const")
+ << "T field not available for " << type() << abort(FatalError);
+ return volScalarField::null();
+}
+
+
+const tmp noPyrolysis::Cp() const
+{
+ FatalErrorIn("const tmp& noPyrolysis::Cp() const")
+ << "Cp field not available for " << type() << abort(FatalError);
+
+ return tmp
+ (
+ new volScalarField
+ (
+ IOobject
+ (
+ "noPyrolysis::Cp",
+ time().timeName(),
+ primaryMesh(),
+ IOobject::NO_READ,
+ IOobject::NO_WRITE,
+ false
+ ),
+ primaryMesh(),
+ dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
+ )
+ );
+}
+
+
+const volScalarField& noPyrolysis::kappa() const
+{
+ FatalErrorIn("const volScalarField& noPyrolysis::kappa() const")
+ << "kappa field not available for " << type() << abort(FatalError);
+ return volScalarField::null();
+}
+
+
+const volScalarField& noPyrolysis::K() const
+{
+ FatalErrorIn("const volScalarField& noPyrolysis::K() const")
+ << "K field not available for " << type() << abort(FatalError);
+ return volScalarField::null();
+}
+
+
+const surfaceScalarField& noPyrolysis::phiGas() const
+{
+ FatalErrorIn("const volScalarField& noPyrolysis::phiGas() const")
+ << "phiGas field not available for " << type() << abort(FatalError);
+ return surfaceScalarField::null();
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace surfaceFilmModels
+} // End namespace regionModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
new file mode 100644
index 0000000000..4be55df5d1
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
@@ -0,0 +1,127 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-2011 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::noPyrolysis
+
+Description
+ Dummy surface pyrolysis model for 'none'
+
+SourceFiles
+ noPyrolysis.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef noPyrolysis_H
+#define noPyrolysis_H
+
+#include "pyrolysisModel.H"
+#include "volFieldsFwd.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class noPyrolysis Declaration
+\*---------------------------------------------------------------------------*/
+
+class noPyrolysis
+:
+ public pyrolysisModel
+{
+private:
+
+ // Private member functions
+
+ //- Disallow default bitwise copy construct
+ noPyrolysis(const noPyrolysis&);
+
+ //- Disallow default bitwise assignment
+ void operator=(const noPyrolysis&);
+
+
+protected:
+
+ // Protected member functions
+
+ //- Read control parameters from dictionary
+ virtual bool read();
+
+
+public:
+
+ //- Runtime type information
+ TypeName("none");
+
+
+ // Constructors
+
+ //- Construct from type name and mesh
+ noPyrolysis(const word& modelType, const fvMesh& mesh);
+
+
+ //- Destructor
+ virtual ~noPyrolysis();
+
+
+ // Member Functions
+
+ // Fields
+
+ //- Return density [kg/m3]
+ virtual const volScalarField& rho() const;
+
+ //- Return const temperature [K]
+ virtual const volScalarField& T() const;
+
+ //- Return specific heat capacity [J/kg/K]
+ virtual const tmp Cp() const;
+
+ //- Return the region absorptivity [1/m]
+ virtual const volScalarField& kappa() const;
+
+ //- Return the region thermal conductivity [W/m/k]
+ virtual const volScalarField& K() const;
+
+ //- Return the total gas mass flux to primary region [kg/m2/s]
+ virtual const surfaceScalarField& phiGas() const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace pyrolysisModels
+} // End namespace regionModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C
new file mode 100644
index 0000000000..290117e26d
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C
@@ -0,0 +1,182 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-2011 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 "pyrolysisModel.H"
+#include "fvMesh.H"
+#include "directMappedFieldFvPatchField.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(pyrolysisModel, 0);
+defineRunTimeSelectionTable(pyrolysisModel, mesh);
+
+// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
+
+void pyrolysisModel::constructMeshObjects()
+{
+ // construct filmDelta field if coupled to film model
+ if (filmCoupled_)
+ {
+ filmDeltaPtr_.reset
+ (
+ new volScalarField
+ (
+ IOobject
+ (
+ "filmDelta",
+ time_.timeName(),
+ regionMesh(),
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ regionMesh()
+ )
+ );
+
+ const volScalarField& filmDelta = filmDeltaPtr_();
+
+ bool foundCoupledPatch = false;
+ forAll(filmDelta.boundaryField(), patchI)
+ {
+ const fvPatchField& fvp = filmDelta.boundaryField()[patchI];
+ if (isA >(fvp))
+ {
+ foundCoupledPatch = true;
+ break;
+ }
+ }
+
+ if (!foundCoupledPatch)
+ {
+ WarningIn("void pyrolysisModels::constructMeshObjects()")
+ << "filmCoupled flag set to true, but no "
+ << directMappedFieldFvPatchField::typeName
+ << " patches found on " << filmDelta.name() << " field"
+ << endl;
+ }
+ }
+}
+
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+bool pyrolysisModel::read()
+{
+ if (regionModel1D::read())
+ {
+ filmCoupled_ = readBool(coeffs_.lookup("filmCoupled"));
+ reactionDeltaMin_ =
+ coeffs_.lookupOrDefault("reactionDeltaMin", 0.0);
+
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+pyrolysisModel::pyrolysisModel(const fvMesh& mesh)
+:
+ regionModel1D(mesh),
+ filmCoupled_(false),
+ filmDeltaPtr_(NULL),
+ reactionDeltaMin_(0.0)
+{}
+
+
+pyrolysisModel::pyrolysisModel(const word& modelType, const fvMesh& mesh)
+:
+ regionModel1D(mesh, "pyrolysis", modelType),
+ filmCoupled_(false),
+ filmDeltaPtr_(NULL),
+ reactionDeltaMin_(0.0)
+{
+ if (active_)
+ {
+ read();
+ constructMeshObjects();
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+pyrolysisModel::~pyrolysisModel()
+{}
+
+
+// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
+
+scalar pyrolysisModel::addMassSources
+(
+ const label patchI,
+ const label faceI
+)
+{
+ return 0.0;
+}
+
+
+void pyrolysisModel::preEvolveRegion()
+{
+ if (filmCoupled_)
+ {
+ filmDeltaPtr_->correctBoundaryConditions();
+ }
+}
+
+
+scalar pyrolysisModel::solidRegionDiffNo() const
+{
+ return VSMALL;
+}
+
+
+scalar pyrolysisModel::maxDiff() const
+{
+ return GREAT;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace surfaceFilmModels
+} // End namespace regionModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H
new file mode 100644
index 0000000000..756cd2d257
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H
@@ -0,0 +1,199 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-2011 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::pyrolysisModel
+
+Description
+
+SourceFiles
+ pyrolysisModelI.H
+ pyrolysisModel.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef pyrolysisModel_H
+#define pyrolysisModel_H
+
+#include "runTimeSelectionTables.H"
+#include "volFieldsFwd.H"
+#include "solidChemistryModel.H"
+#include "basicSolidThermo.H"
+#include "regionModel1D.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// Forward declaration of classes
+class fvMesh;
+class Time;
+
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+/*---------------------------------------------------------------------------*\
+ Class pyrolysisModel Declaration
+\*---------------------------------------------------------------------------*/
+
+class pyrolysisModel
+:
+ public regionModel1D
+{
+private:
+
+ // Private Member Functions
+
+ //- Construct fields
+ void constructMeshObjects();
+
+ //- Disallow default bitwise copy construct
+ pyrolysisModel(const pyrolysisModel&);
+
+ //- Disallow default bitwise assignment
+ void operator=(const pyrolysisModel&);
+
+
+protected:
+
+ // Protected Data
+
+ //- Flag to indicate whether pyrolysis region coupled to a film region
+ bool filmCoupled_;
+
+ //- Pointer to film thickness field
+ autoPtr filmDeltaPtr_;
+
+ //- Film height below which reactions can occur [m]
+ scalar reactionDeltaMin_;
+
+
+ // Protected Member Functions
+
+ //- Read control parameters from dictionary
+ virtual bool read();
+
+
+public:
+
+ //- Runtime type information
+ TypeName("pyrolysisModel");
+
+
+ // Declare runtime constructor selection table
+
+ declareRunTimeSelectionTable
+ (
+ autoPtr,
+ pyrolysisModel,
+ mesh,
+ (
+ const word& modelType,
+ const fvMesh& mesh
+ ),
+ (modelType, mesh)
+ );
+
+ // Constructors
+
+ //- Construct null from mesh
+ pyrolysisModel(const fvMesh& mesh);
+
+ //- Construct from type name and mesh
+ pyrolysisModel(const word& modelType, const fvMesh& mesh);
+
+
+ // Selectors
+
+ //- Return a reference to the selected surface film model
+ static autoPtr New(const fvMesh& mesh);
+
+
+ //- Destructor
+ virtual ~pyrolysisModel();
+
+
+ // Member Functions
+
+ // Access
+
+ // Fields
+
+ //- Return density [kg/m3]
+ virtual const volScalarField& rho() const = 0;
+
+ //- Return const temperature [K]
+ virtual const volScalarField& T() const = 0;
+
+ //- Return specific heat capacity [J/kg/K]
+ virtual const tmp Cp() const = 0;
+
+ //- Return the region absorptivity [1/m]
+ virtual const volScalarField& kappa() const = 0;
+
+ //- Return the region thermal conductivity [W/m/k]
+ virtual const volScalarField& K() const = 0;
+
+ //- Return the total gas mass flux to primary region [kg/m2/s]
+ virtual const surfaceScalarField& phiGas() const = 0;
+
+ // Sources
+
+ //- External hook to add mass to the primary region
+ virtual scalar addMassSources
+ (
+ const label patchI,
+ const label faceI
+ );
+
+
+ // Evolution
+
+ //- Pre-evolve region
+ virtual void preEvolveRegion();
+
+
+ // Helper function
+
+ //- Mean diffusion number of the solid region
+ virtual scalar solidRegionDiffNo() const;
+
+ //- Return max diffusivity allowed in the solid
+ virtual scalar maxDiff() const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace pyrolysisModels
+} // End namespace regionModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelI.H b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelI.H
new file mode 100644
index 0000000000..19f7fe165c
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelI.H
@@ -0,0 +1,44 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-2011 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 "pyrolysisModel.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+inline const Foam::Switch&
+Foam::pyrolysisModels::pyrolysisModel::active() const
+{
+ return active_;
+}
+
+
+inline const Foam::dictionary&
+Foam::pyrolysisModels::pyrolysisModel::coeffs() const
+{
+ return coeffs_;
+}
+
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelNew.C b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelNew.C
new file mode 100644
index 0000000000..88d31f6cd5
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModelNew.C
@@ -0,0 +1,84 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-2011 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 "pyrolysisModel.H"
+#include "fvMesh.H"
+#include "Time.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
+
+autoPtr pyrolysisModel::New(const fvMesh& mesh)
+{
+ // get model name, but do not register the dictionary
+ const word modelType
+ (
+ IOdictionary
+ (
+ IOobject
+ (
+ "pyrolysisProperties",
+ mesh.time().constant(),
+ mesh,
+ IOobject::MUST_READ,
+ IOobject::NO_WRITE,
+ false
+ )
+ ).lookup("pyrolysisModel")
+ );
+
+ Info<< "Selecting pyrolysisModel " << modelType << endl;
+
+ meshConstructorTable::iterator cstrIter =
+ meshConstructorTablePtr_->find(modelType);
+
+ if (cstrIter == meshConstructorTablePtr_->end())
+ {
+ FatalErrorIn("pyrolysisModel::New(const fvMesh&)")
+ << "Unknown pyrolysisModel type " << modelType
+ << nl << nl << "Valid pyrolisisModel types are:" << nl
+ << meshConstructorTablePtr_->sortedToc()
+ << exit(FatalError);
+ }
+
+ return autoPtr(cstrIter()(modelType, mesh));
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace surfaceFilmModels
+} // End namespace regionModels
+} // End namespace Foam
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
new file mode 100644
index 0000000000..90e28643db
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
@@ -0,0 +1,609 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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 "reactingOneDim.H"
+#include "addToRunTimeSelectionTable.H"
+#include "directMappedPatchBase.H"
+#include "mapDistribute.H"
+#include "zeroGradientFvPatchFields.H"
+#include "surfaceInterpolate.H"
+#include "fvm.H"
+#include "fvcDiv.H"
+#include "fvcVolumeIntegrate.H"
+#include "fvMatrices.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
+
+defineTypeNameAndDebug(reactingOneDim, 0);
+
+addToRunTimeSelectionTable(pyrolysisModel, reactingOneDim, mesh);
+
+// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
+
+bool reactingOneDim::read()
+{
+ if (pyrolysisModel::read())
+ {
+ const dictionary& solution = this->solution().subDict("SIMPLE");
+ solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
+ time_.controlDict().lookup("maxDi") >> maxDiff_;
+
+ coeffs().lookup("radFluxName") >> primaryRadFluxName_;
+ coeffs().lookup("minimumDelta") >> minimumDelta_;
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+
+void reactingOneDim::updateQr()
+{
+ // Retrieve field from coupled region using mapped boundary conditions
+ QrCoupled_.correctBoundaryConditions();
+
+ // Update local Qr from coupled Qr field
+ Qr_ == dimensionedScalar("zero", Qr_.dimensions(), 0.0);
+ forAll(intCoupledPatchIDs_, i)
+ {
+ const label patchI = intCoupledPatchIDs_[i];
+
+ scalarField& Qrp = Qr_.boundaryField()[patchI];
+
+ // Qr is negative going out the solid
+ // If the surface is emitting the radiative flux is set to zero
+ Qrp = max(Qrp, 0.0);
+ }
+
+ // Propagate Qr through 1-D regions
+ forAll(intCoupledPatchIDs_, i)
+ {
+ const label patchI = intCoupledPatchIDs_[i];
+
+ const scalarField& Qrp = Qr_.boundaryField()[patchI];
+ const vectorField& Cf = regionMesh().Cf().boundaryField()[patchI];
+
+ forAll(Qrp, faceI)
+ {
+ const scalar Qr0 = Qrp[faceI];
+ point Cf0 = Cf[faceI];
+ const labelList& cells = boundaryFaceCells_[faceI];
+ scalar kappaInt = 0.0;
+ forAll(cells, k)
+ {
+ const label cellI = cells[k];
+ const point& Cf1 = regionMesh().cellCentres()[cellI];
+ const scalar delta = mag(Cf1 - Cf0);
+ kappaInt += kappa_[cellI]*delta;
+ Qr_[cellI] = Qr0*exp(-kappaInt);
+ Cf0 = Cf1;
+ }
+ }
+ }
+
+ Qr_.correctBoundaryConditions();
+}
+
+
+void reactingOneDim::updatePhiGas()
+{
+ phiHsGas_ == dimensionedScalar("zero", phiHsGas_.dimensions(), 0.0);
+ phiGas_ == dimensionedScalar("zero", phiGas_.dimensions(), 0.0);
+
+ const speciesTable& gasTable = solidChemistry_->gasTable();
+
+ forAll(gasTable, gasI)
+ {
+ tmp tHsiGas = solidChemistry_->gasHs(T_, gasI);
+ tmp tRRiGas = solidChemistry_->RRg(gasI);
+
+ const volScalarField& HsiGas = tHsiGas();
+ const volScalarField& RRiGas = tRRiGas();
+
+ const surfaceScalarField HsiGasf = fvc::interpolate(HsiGas);
+ const surfaceScalarField RRiGasf = fvc::interpolate(RRiGas);
+
+ forAll(intCoupledPatchIDs_, i)
+ {
+ const label patchI = intCoupledPatchIDs_[i];
+ const scalarField& phiGasp = phiHsGas_.boundaryField()[patchI];
+
+ forAll(phiGasp, faceI)
+ {
+ const labelList& cells = boundaryFaceCells_[faceI];
+ scalar massInt = 0.0;
+ forAllReverse(cells, k)
+ {
+ const label cellI = cells[k];
+ massInt += RRiGas[cellI]*regionMesh().V()[cellI];
+ phiHsGas_[cellI] += massInt*HsiGas[cellI];
+ }
+
+ phiGas_.boundaryField()[patchI][faceI] += massInt;
+
+ if (debug)
+ {
+ Info<< " Gas : " << gasTable[gasI]
+ << " on patch : " << patchI
+ << " mass produced at face(local) : "
+ << faceI
+ << " is : " << massInt
+ << " [kg/s] " << endl;
+ }
+ }
+ }
+ tHsiGas().clear();
+ }
+}
+
+
+void reactingOneDim::updateFields()
+{
+ updateQr();
+
+ updatePhiGas();
+}
+
+
+void reactingOneDim::updateMesh(const scalarField& mass0)
+{
+ if (!moveMesh_)
+ {
+ return;
+ }
+
+ const scalarField newV = mass0/rho_;
+
+ Info<< "Initial/final volumes = " << gSum(regionMesh().V()) << ", "
+ << gSum(newV) << " [m3]" << endl;
+
+ // move the mesh
+ const labelList moveMap = moveMesh(regionMesh().V() - newV, minimumDelta_);
+
+ // flag any cells that have not moved as non-reacting
+ forAll(moveMap, i)
+ {
+ if (moveMap[i] == 0)
+ {
+ solidChemistry_->setCellReacting(i, false);
+ }
+ }
+}
+
+
+void reactingOneDim::solveContinuity()
+{
+ if (debug)
+ {
+ Info<< "reactingOneDim::solveContinuity()" << endl;
+ }
+
+ solve
+ (
+ fvm::ddt(rho_)
+ ==
+ - solidChemistry_->RRg()
+ );
+}
+
+
+void reactingOneDim::solveSpeciesMass()
+{
+ if (debug)
+ {
+ Info<< "reactingOneDim::solveSpeciesMass()" << endl;
+ }
+
+ volScalarField Yt = 0.0*Ys_[0];
+
+ for (label i=0; iRRs(i)
+ );
+
+ if (moveMesh_)
+ {
+ surfaceScalarField phiRhoMesh =
+ fvc::interpolate(Yi*rho_)*regionMesh().phi();
+
+ YiEqn -= fvc::div(phiRhoMesh);
+ }
+
+ YiEqn.solve(regionMesh().solver("Yi"));
+ Yi.max(0.0);
+ Yt += Yi;
+ }
+
+ Ys_[Ys_.size() - 1] = 1.0 - Yt;
+}
+
+
+void reactingOneDim::solveEnergy()
+{
+ if (debug)
+ {
+ Info<< "reactingOneDim::solveEnergy()" << endl;
+ }
+
+ const volScalarField rhoCp = rho_*solidThermo_.Cp();
+
+ const surfaceScalarField phiQr = fvc::interpolate(Qr_)*nMagSf();
+
+ const surfaceScalarField phiGas = fvc::interpolate(phiHsGas_);
+
+ fvScalarMatrix TEqn
+ (
+ fvm::ddt(rhoCp, T_)
+ - fvm::laplacian(K_, T_)
+ ==
+ chemistrySh_
+ + fvc::div(phiQr)
+ + fvc::div(phiGas)
+ );
+
+ if (moveMesh_)
+ {
+ surfaceScalarField phiMesh =
+ fvc::interpolate(rhoCp*T_)*regionMesh().phi();
+
+ TEqn -= fvc::div(phiMesh);
+ }
+
+ TEqn.relax();
+ TEqn.solve();
+
+ Info<< "pyrolysis min/max(T) = " << min(T_).value() << ", "
+ << max(T_).value() << endl;
+}
+
+
+void reactingOneDim::calculateMassTransfer()
+{
+ totalGasMassFlux_ = 0;
+ forAll(intCoupledPatchIDs_, i)
+ {
+ const label patchI = intCoupledPatchIDs_[i];
+ totalGasMassFlux_ += gSum(phiGas_.boundaryField()[patchI]);
+ }
+
+ if (infoOutput_)
+ {
+ totalHeatRR_ = fvc::domainIntegrate(chemistrySh_);
+
+ addedGasMass_ +=
+ fvc::domainIntegrate(solidChemistry_->RRg())*time_.deltaT();
+ lostSolidMass_ +=
+ fvc::domainIntegrate(solidChemistry_->RRs())*time_.deltaT();
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
+
+reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
+:
+ pyrolysisModel(modelType, mesh),
+ solidChemistry_(solidChemistryModel::New(regionMesh())),
+ solidThermo_(solidChemistry_->solidThermo()),
+ kappa_(solidThermo_.kappa()),
+ K_(solidThermo_.K()),
+ rho_(solidThermo_.rho()),
+ Ys_(solidThermo_.composition().Y()),
+ T_(solidThermo_.T()),
+ primaryRadFluxName_(coeffs().lookupOrDefault("radFluxName", "Qr")),
+ nNonOrthCorr_(-1),
+ maxDiff_(10),
+ minimumDelta_(1e-4),
+
+ phiGas_
+ (
+ IOobject
+ (
+ "phiGas",
+ time().timeName(),
+ regionMesh(),
+ IOobject::NO_READ,
+ IOobject::AUTO_WRITE
+ ),
+ regionMesh(),
+ dimensionedScalar("zero", dimMass/dimTime, 0.0)
+ ),
+
+ phiHsGas_
+ (
+ IOobject
+ (
+ "phiHsGas",
+ time().timeName(),
+ regionMesh(),
+ IOobject::NO_READ,
+ IOobject::NO_WRITE
+ ),
+ regionMesh(),
+ dimensionedScalar("zero", dimEnergy/dimTime, 0.0)
+ ),
+
+ chemistrySh_
+ (
+ IOobject
+ (
+ "chemistrySh",
+ time().timeName(),
+ regionMesh(),
+ IOobject::NO_READ,
+ IOobject::AUTO_WRITE
+ ),
+ regionMesh(),
+ dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0)
+ ),
+
+ QrCoupled_
+ (
+ IOobject
+ (
+ primaryRadFluxName_,
+ time().timeName(),
+ regionMesh(),
+ IOobject::MUST_READ,
+ IOobject::AUTO_WRITE
+ ),
+ regionMesh()
+ ),
+
+ Qr_
+ (
+ IOobject
+ (
+ "QrPyr",
+ time().timeName(),
+ regionMesh(),
+ IOobject::NO_READ,
+ IOobject::AUTO_WRITE
+ ),
+ regionMesh(),
+ dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0),
+ zeroGradientFvPatchVectorField::typeName
+ ),
+
+ lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)),
+ addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)),
+ totalGasMassFlux_(0.0),
+ totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0))
+{
+ if (active_)
+ {
+ read();
+ }
+}
+
+
+// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
+
+reactingOneDim::~reactingOneDim()
+{}
+
+
+// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
+
+scalar reactingOneDim::addMassSources(const label patchI, const label faceI)
+{
+ label index = 0;
+ forAll(primaryPatchIDs_, i)
+ {
+ if (primaryPatchIDs_[i] == patchI)
+ {
+ index = i;
+ break;
+ }
+ }
+
+ const label localPatchId = intCoupledPatchIDs_[index];
+
+ const scalar massAdded = phiGas_.boundaryField()[localPatchId][faceI];
+
+ if (debug)
+ {
+ Info<< "\nPyrolysis region: " << type() << "added mass : "
+ << massAdded << endl;
+ }
+
+ return massAdded;
+}
+
+
+scalar reactingOneDim::solidRegionDiffNo() const
+{
+ scalar DiNum = 0.0;
+ scalar meanDiNum = 0.0;
+ if (regionMesh().nInternalFaces() > 0)
+ {
+ surfaceScalarField KrhoCpbyDelta =
+ regionMesh().surfaceInterpolation::deltaCoeffs()
+ * fvc::interpolate(K_)
+ / fvc::interpolate(Cp()*rho_);
+
+ DiNum = max(KrhoCpbyDelta.internalField())*time_.deltaTValue();
+
+ meanDiNum = average(KrhoCpbyDelta.internalField())*time().deltaTValue();
+ }
+
+ return DiNum;
+}
+
+
+scalar reactingOneDim::maxDiff() const
+{
+ return maxDiff_;
+}
+
+
+const volScalarField& reactingOneDim::rho() const
+{
+ return rho_;
+}
+
+
+const volScalarField& reactingOneDim::T() const
+{
+ return T_;
+}
+
+
+const tmp reactingOneDim::Cp() const
+{
+ return solidThermo_.Cp();
+}
+
+
+const volScalarField& reactingOneDim::kappa() const
+{
+ return kappa_;
+}
+
+
+const volScalarField& reactingOneDim::K() const
+{
+ return K_;
+}
+
+
+const surfaceScalarField& reactingOneDim::phiGas() const
+{
+ return phiGas_;
+}
+
+
+void reactingOneDim::preEvolveRegion()
+{
+ pyrolysisModel::preEvolveRegion();
+
+ // Initialise all cells as able to react
+ forAll(T_, cellI)
+ {
+ solidChemistry_->setCellReacting(cellI, true);
+ }
+
+ // De-activate reactions if pyrolysis region coupled to (valid) film
+ if (filmCoupled_)
+ {
+ const volScalarField& filmDelta = filmDeltaPtr_();
+
+ forAll(intCoupledPatchIDs_, i)
+ {
+ const label patchI = intCoupledPatchIDs_[i];
+ const scalarField& filmDeltap = filmDelta.boundaryField()[patchI];
+
+ forAll(filmDeltap, faceI)
+ {
+ const scalar filmDelta0 = filmDeltap[faceI];
+ if (filmDelta0 > reactionDeltaMin_)
+ {
+ const labelList& cells = boundaryFaceCells_[faceI];
+
+ // TODO: only limit cell adjacent to film?
+ //solidChemistry_->setCellNoReacting(cells[0])
+
+ // Propagate flag through 1-D region
+ forAll(cells, k)
+ {
+ solidChemistry_->setCellReacting(cells[k], false);
+ }
+ }
+ }
+ }
+ }
+}
+
+
+void reactingOneDim::evolveRegion()
+{
+ const scalarField mass0 = rho_*regionMesh().V();
+
+ solidChemistry_->solve
+ (
+ time().value() - time().deltaTValue(),
+ time().deltaTValue()
+ );
+
+ solveContinuity();
+
+ updateMesh(mass0);
+
+ chemistrySh_ = solidChemistry_->Sh()();
+
+ updateFields();
+
+ solveSpeciesMass();
+
+ for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
+ {
+ solveEnergy();
+ }
+
+ calculateMassTransfer();
+
+ solidThermo_.correct();
+}
+
+
+void reactingOneDim::info() const
+{
+ Info<< "\nPyrolysis: " << type() << endl;
+
+ Info<< indent << "Total gas mass produced [kg] = "
+ << addedGasMass_.value() << nl
+ << indent << "Total solid mass lost [kg] = "
+ << lostSolidMass_.value() << nl
+ << indent << "Total pyrolysis gases [kg/s] = "
+ << totalGasMassFlux_ << nl
+ << indent << "Total heat release rate [J/s] = "
+ << totalHeatRR_.value() << nl;
+}
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+} // End namespace regionModels
+} // End namespace pyrolysisModels
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
new file mode 100644
index 0000000000..aadc429160
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
@@ -0,0 +1,284 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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::reactingOneDim
+
+Description
+ Reacting, 1-D pyrolysis model
+
+SourceFiles
+ reactingOneDim.C
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef reactingOneDim_H
+#define reactingOneDim_H
+
+#include "pyrolysisModel.H"
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+namespace regionModels
+{
+namespace pyrolysisModels
+{
+
+
+/*---------------------------------------------------------------------------*\
+ Class reactingOneDim Declaration
+\*---------------------------------------------------------------------------*/
+
+class reactingOneDim
+:
+ public pyrolysisModel
+{
+private:
+
+ // Private member functions
+
+ //- Disallow default bitwise copy construct
+ reactingOneDim(const reactingOneDim&);
+
+ //- Disallow default bitwise assignment
+ void operator=(const reactingOneDim&);
+
+
+protected:
+
+ // Protected data
+
+ //- Reference to the solid chemistry model
+ autoPtr solidChemistry_;
+
+ //- Reference to solid thermo
+ basicSolidThermo& solidThermo_;
+
+
+ // Reference to solid thermo properties
+
+ //- Absorption coefficient [1/m]
+ const volScalarField& kappa_;
+
+ //- Thermal conductivity [W/m/K]
+ const volScalarField& K_;
+
+ //- Density [kg/m3]
+ volScalarField& rho_;
+
+ //- List of solid components
+ PtrList& Ys_;
+
+ // Non-const access to temperature
+ volScalarField& T_;
+
+
+ //- Name of the radiative flux in the primary region
+ word primaryRadFluxName_;
+
+
+ // Solution parameters
+
+ //- Number of non-orthogonal correctors
+ label nNonOrthCorr_;
+
+ //- Maximum diffussivity
+ scalar maxDiff_;
+
+ //- Minimum delta for combustion
+ scalar minimumDelta_;
+
+
+ // Fields
+
+ //- Total gas mass flux to the primary region [kg/m2/s]
+ surfaceScalarField phiGas_;
+
+ //- Sensible enthalpy gas flux [J/m2/s]
+ volScalarField phiHsGas_;
+
+ //- Heat release [J/s/m3]
+ volScalarField chemistrySh_;
+
+
+ // Source term fields
+
+ //- Coupled region radiative heat flux [W/m2]
+ // Requires user to input mapping info for coupled patches
+ volScalarField QrCoupled_;
+
+ //- In depth radiative heat flux [W/m2]
+ volScalarField Qr_;
+
+
+ // Checks
+
+ //- Cumulative lost mass of the condensed phase [kg]
+ dimensionedScalar lostSolidMass_;
+
+ //- Cumulative mass generation of the gas phase [kg]
+ dimensionedScalar addedGasMass_;
+
+ //- Total mass gas flux at the pyrolysing walls [kg/s]
+ scalar totalGasMassFlux_;
+
+ //- Total heat release rate [J/s]
+ dimensionedScalar totalHeatRR_;
+
+
+ // Protected member functions
+
+ //- Read control parameters from dictionary
+ bool read();
+
+ //- Update submodels
+ void updateFields();
+
+ //- Update/move mesh based on change in mass
+ void updateMesh(const scalarField& mass0);
+
+ //- Update radiative flux in pyrolysis region
+ void updateQr();
+
+ //- Update enthalpy flux for pyrolysis gases
+ void updatePhiGas();
+
+ //- Mass check
+ void calculateMassTransfer();
+
+
+ // Equations
+
+ //- Solve continuity equation
+ void solveContinuity();
+
+ //- Solve energy
+ void solveEnergy();
+
+ //- Solve solid species mass conservation
+ void solveSpeciesMass();
+
+
+public:
+
+ //- Runtime type information
+ TypeName("reactingOneDim");
+
+
+ // Constructors
+
+ //- Construct from type name and mesh
+ reactingOneDim(const word& modelType, const fvMesh& mesh);
+
+
+ //- Destructor
+ virtual ~reactingOneDim();
+
+
+ // Member Functions
+
+ // Access
+
+ //- Fields
+
+ //- Return density [kg/m3]
+ virtual const volScalarField& rho() const;
+
+ //- Return const temperature [K]
+ virtual const volScalarField& T() const;
+
+ //- Return specific heat capacity [J/kg/K]
+ virtual const tmp Cp() const;
+
+ //- Return the region absorptivity [1/m]
+ virtual const volScalarField& kappa() const;
+
+ //- Return the region thermal conductivity [W/m/k]
+ virtual const volScalarField& K() const;
+
+ //- Return the total gas mass flux to primary region [kg/m2/s]
+ virtual const surfaceScalarField& phiGas() const;
+
+
+ // Solution parameters
+
+ //- Return the number of non-orthogonal correctors
+ inline label nNonOrthCorr() const;
+
+ //- Return max diffusivity allowed in the solid
+ virtual scalar maxDiff() const;
+
+
+ // Helper functions
+
+ //- External hook to add mass to the primary region
+ virtual scalar addMassSources
+ (
+ const label patchI, // patchI on primary region
+ const label faceI // faceI of patchI
+ );
+
+ //- Mean diffusion number of the solid region
+ virtual scalar solidRegionDiffNo() const;
+
+
+ // Source fields (read/write access)
+
+ //- In depth radiative heat flux
+ inline const volScalarField& Qr() const;
+
+
+ // Evolution
+
+ //- Pre-evolve region
+ virtual void preEvolveRegion();
+
+ //- Evolve the pyrolysis equations
+ virtual void evolveRegion();
+
+
+ // I-O
+
+ //- Provide some feedback
+ virtual void info() const;
+};
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace pyrolysisModels
+} // End namespace regionModels
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#include "reactingOneDimI.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H
new file mode 100644
index 0000000000..352ddad9ea
--- /dev/null
+++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDimI.H
@@ -0,0 +1,44 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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 "reactingOneDim.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+inline Foam::label
+Foam::regionModels::pyrolysisModels::reactingOneDim::nNonOrthCorr() const
+{
+ return nNonOrthCorr_;
+}
+
+
+inline const Foam::volScalarField&
+Foam::regionModels::pyrolysisModels::reactingOneDim::Qr() const
+{
+ return Qr_;
+}
+
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/Allwmake b/src/thermophysicalModels/Allwmake
index 07d4cbf033..c27c4b6648 100755
--- a/src/thermophysicalModels/Allwmake
+++ b/src/thermophysicalModels/Allwmake
@@ -18,6 +18,9 @@ wmake $makeType SLGThermo
# Should be combined with solids&solidMixture
wmake $makeType basicSolidThermo
+wmake $makeType solidChemistryModel
+
+wmake $makeType combustionModels
wmake $makeType radiationModels
diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C
index 6b06924cb3..4ebc3929eb 100644
--- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C
+++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -33,7 +33,7 @@ template
Foam::ODEChemistryModel::ODEChemistryModel
(
const fvMesh& mesh,
- const word& compTypeName,
+ const word& ODEModelName,
const word& thermoTypeName
)
:
@@ -56,16 +56,6 @@ Foam::ODEChemistryModel::ODEChemistryModel
nSpecie_(Y_.size()),
nReaction_(reactions_.size()),
- solver_
- (
- chemistrySolver::New
- (
- *this,
- compTypeName,
- thermoTypeName
- )
- ),
-
RR_(nSpecie_)
{
// create the fields for the chemistry sources
@@ -135,6 +125,88 @@ Foam::ODEChemistryModel::omega
}
+template
+Foam::scalar Foam::ODEChemistryModel::omegaI
+(
+ const label index,
+ const scalarField& c,
+ const scalar T,
+ const scalar p,
+ scalar& pf,
+ scalar& cf,
+ label& lRef,
+ scalar& pr,
+ scalar& cr,
+ label& rRef
+) const
+{
+
+ const Reaction& R = reactions_[index];
+ scalar w = omega(R, c, T, p, pf, cf, lRef, pr, cr, rRef);
+ return(w);
+}
+
+
+template
+void Foam::ODEChemistryModel::updateConcsInReactionI
+(
+ const label index,
+ const scalar dt,
+ const scalar omeg,
+ scalarField& c
+) const
+{
+ // update species
+ const Reaction& R = reactions_[index];
+ forAll(R.lhs(), s)
+ {
+ label si = R.lhs()[s].index;
+ scalar sl = R.lhs()[s].stoichCoeff;
+ c[si] -= dt*sl*omeg;
+ c[si] = max(0.0, c[si]);
+ }
+
+ forAll(R.rhs(), s)
+ {
+ label si = R.rhs()[s].index;
+ scalar sr = R.rhs()[s].stoichCoeff;
+ c[si] += dt*sr*omeg;
+ c[si] = max(0.0, c[si]);
+ }
+}
+
+
+template
+void Foam::ODEChemistryModel::updateRRInReactionI
+(
+ const label index,
+ const scalar pr,
+ const scalar pf,
+ const scalar corr,
+ const label lRef,
+ const label rRef,
+ simpleMatrix& RR
+) const
+{
+ const Reaction& R = reactions_[index];
+ forAll(R.lhs(), s)
+ {
+ label si = R.lhs()[s].index;
+ scalar sl = R.lhs()[s].stoichCoeff;
+ RR[si][rRef] -= sl*pr*corr;
+ RR[si][lRef] += sl*pf*corr;
+ }
+
+ forAll(R.rhs(), s)
+ {
+ label si = R.rhs()[s].index;
+ scalar sr = R.rhs()[s].stoichCoeff;
+ RR[si][lRef] -= sr*pf*corr;
+ RR[si][rRef] += sr*pr*corr;
+ }
+}
+
+
template
Foam::scalar Foam::ODEChemistryModel::omega
(
@@ -731,7 +803,7 @@ Foam::scalar Foam::ODEChemistryModel::solve
// calculate the chemical source terms
while (timeLeft > SMALL)
{
- tauC = solver().solve(c, Ti, pi, t, dt);
+ tauC = this->solve(c, Ti, pi, t, dt);
t += dt;
// update the temperature
@@ -763,4 +835,28 @@ Foam::scalar Foam::ODEChemistryModel::solve
}
+template
+Foam::scalar Foam::ODEChemistryModel::solve
+(
+ scalarField &c,
+ const scalar T,
+ const scalar p,
+ const scalar t0,
+ const scalar dt
+) const
+{
+ notImplemented
+ (
+ "ODEChemistryModel::solve"
+ "scalarField&, "
+ "const scalar, "
+ "const scalar, "
+ "const scalar, "
+ "const scalar"
+ );
+
+ return (0);
+}
+
+
// ************************************************************************* //
diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H
index d9cc946458..33391fab9d 100644
--- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H
+++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModel.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -41,6 +41,7 @@ SourceFiles
#include "Reaction.H"
#include "ODE.H"
#include "volFieldsFwd.H"
+#include "simpleMatrix.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -50,9 +51,6 @@ namespace Foam
// Forward declaration of classes
class fvMesh;
-template
-class chemistrySolver;
-
/*---------------------------------------------------------------------------*\
Class ODEChemistryModel Declaration
\*---------------------------------------------------------------------------*/
@@ -65,6 +63,9 @@ class ODEChemistryModel
{
// Private Member Functions
+ //- Disallow copy constructor
+ ODEChemistryModel(const ODEChemistryModel&);
+
//- Disallow default bitwise assignment
void operator=(const ODEChemistryModel&);
@@ -88,9 +89,6 @@ protected:
//- Number of reactions
label nReaction_;
- //- Chemistry solver
- autoPtr > solver_;
-
//- List of reaction rate per specie [kg/m3/s]
PtrList RR_;
@@ -114,7 +112,7 @@ public:
ODEChemistryModel
(
const fvMesh& mesh,
- const word& compTypeName,
+ const word& ODEModelName,
const word& thermoTypeName
);
@@ -137,9 +135,6 @@ public:
//- The number of reactions
inline label nReaction() const;
- //- Return the chemisty solver
- inline const chemistrySolver& solver() const;
-
//- dc/dt = omega, rate of change in concentration, for each species
virtual tmp omega
(
@@ -164,9 +159,48 @@ public:
label& rRef
) const;
+
+ //- Return the reaction rate for iReaction and the reference
+ // species and charateristic times
+ virtual scalar omegaI
+ (
+ label iReaction,
+ const scalarField& c,
+ const scalar T,
+ const scalar p,
+ scalar& pf,
+ scalar& cf,
+ label& lRef,
+ scalar& pr,
+ scalar& cr,
+ label& rRef
+ ) const;
+
//- Calculates the reaction rates
virtual void calculate();
+ //- Update concentrations in reaction i given dt and reaction rate omega
+ // used by sequential solver
+ void updateConcsInReactionI
+ (
+ const label i,
+ const scalar dt,
+ const scalar omega,
+ scalarField& c
+ ) const;
+
+ //- Update matrix RR for reaction i. Used by EulerImplicit
+ void updateRRInReactionI
+ (
+ const label i,
+ const scalar pr,
+ const scalar pf,
+ const scalar corr,
+ const label lRef,
+ const label rRef,
+ simpleMatrix& RR
+ ) const;
+
// Chemistry model functions (overriding abstract functions in
// basicChemistryModel.H)
@@ -207,6 +241,15 @@ public:
scalarField& dcdt,
scalarSquareMatrix& dfdc
) const;
+
+ virtual scalar solve
+ (
+ scalarField &c,
+ const scalar T,
+ const scalar p,
+ const scalar t0,
+ const scalar dt
+ ) const;
};
diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H
index e97593e37b..fbd408fe3b 100644
--- a/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H
+++ b/src/thermophysicalModels/chemistryModel/chemistryModel/ODEChemistryModel/ODEChemistryModelI.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2009-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -68,14 +68,6 @@ Foam::ODEChemistryModel::nReaction() const
}
-template
-inline const Foam::chemistrySolver&
-Foam::ODEChemistryModel::solver() const
-{
- return solver_;
-}
-
-
template
inline Foam::tmp
Foam::ODEChemistryModel::RR
diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/makeChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/makeChemistryModel.H
new file mode 100644
index 0000000000..faf2608a2b
--- /dev/null
+++ b/src/thermophysicalModels/chemistryModel/chemistryModel/makeChemistryModel.H
@@ -0,0 +1,88 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2009-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 .
+
+Description
+ Macros for instantiating chemistry models based on compressibility and
+ transport types
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef makeChemistryModel_H
+#define makeChemistryModel_H
+
+#include "addToRunTimeSelectionTable.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+namespace Foam
+{
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#define makeChemistryModel(SS, Comp, Thermo) \
+ \
+ typedef SS SS##Comp##Thermo; \
+ \
+ defineTemplateTypeNameAndDebugWithName \
+ ( \
+ SS##Comp##Thermo, \
+ #SS"<"#Comp","#Thermo">", \
+ 0 \
+ ); \
+ \
+ addToRunTimeSelectionTable \
+ ( \
+ Comp, \
+ SS##Comp##Thermo, \
+ fvMesh \
+ );
+
+
+#define makeSolidChemistryModel(SS, Comp, SThermo, GThermo) \
+ \
+ typedef SS SS##Comp##SThermo##GThermo; \
+ \
+ defineTemplateTypeNameAndDebugWithName \
+ ( \
+ SS##Comp##SThermo##GThermo, \
+ #SS"<"#Comp","#SThermo","#GThermo">", \
+ 0 \
+ ); \
+ \
+ addToRunTimeSelectionTable \
+ ( \
+ Comp, \
+ SS##Comp##SThermo##GThermo, \
+ fvMesh \
+ );
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+} // End namespace Foam
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C
index e090c5d991..a2fbbe497a 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.C
@@ -29,15 +29,16 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-template
-Foam::EulerImplicit::EulerImplicit
+template
+Foam::EulerImplicit::EulerImplicit
(
- ODEChemistryModel& model,
- const word& modelName
+ const fvMesh& mesh,
+ const word& ODEModelName,
+ const word& thermoType
)
:
- chemistrySolver(model, modelName),
- coeffsDict_(model.subDict(modelName + "Coeffs")),
+ chemistrySolver(mesh, ODEModelName, thermoType),
+ coeffsDict_(this->subDict(ODEModelName + "Coeffs")),
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
{}
@@ -45,15 +46,15 @@ Foam::EulerImplicit::EulerImplicit
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-template
-Foam::EulerImplicit::~EulerImplicit()
+template
+Foam::EulerImplicit::~EulerImplicit()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-template
-Foam::scalar Foam::EulerImplicit::solve
+template
+Foam::scalar Foam::EulerImplicit::solve
(
scalarField &c,
const scalar T,
@@ -62,7 +63,10 @@ Foam::scalar Foam::EulerImplicit::solve
const scalar dt
) const
{
- const label nSpecie = this->model_.nSpecie();
+ scalar pf, cf, pr, cr;
+ label lRef, rRef;
+
+ const label nSpecie = this->nSpecie();
simpleMatrix RR(nSpecie, 0, 0);
for (label i = 0; i < nSpecie; i++)
@@ -75,17 +79,9 @@ Foam::scalar Foam::EulerImplicit::solve
RR.source()[i] = c[i]/dt;
}
- forAll(this->model_.reactions(), i)
+ forAll(this->reactions(), i)
{
- const Reaction& R = this->model_.reactions()[i];
-
- scalar pf, cf, pr, cr;
- label lRef, rRef;
-
- scalar omegai = this->model_.omega
- (
- R, c, T, p, pf, cf, lRef, pr, cr, rRef
- );
+ scalar omegai = this->omegaI(i, c, T, p, pf, cf, lRef, pr, cr, rRef);
scalar corr = 1.0;
if (eqRateLimiter_)
@@ -100,21 +96,7 @@ Foam::scalar Foam::EulerImplicit::solve
}
}
- forAll(R.lhs(), specieI)
- {
- const label id = R.lhs()[specieI].index;
- const scalar sc = R.lhs()[specieI].stoichCoeff;
- RR[id][rRef] -= sc*pr*corr;
- RR[id][lRef] += sc*pf*corr;
- }
-
- forAll(R.rhs(), specieI)
- {
- const label id = R.rhs()[specieI].index;
- const scalar sc = R.rhs()[specieI].stoichCoeff;
- RR[id][lRef] -= sc*pf*corr;
- RR[id][rRef] += sc*pr*corr;
- }
+ this->updateRRInReactionI(i, pr, pf, corr, lRef, rRef, RR);
}
@@ -131,7 +113,7 @@ Foam::scalar Foam::EulerImplicit::solve
// estimate the next time step
scalar tMin = GREAT;
- const label nEqns = this->model_.nEqns();
+ const label nEqns = this->nEqns();
scalarField c1(nEqns, 0.0);
for (label i = 0; i < nSpecie; i++)
@@ -142,7 +124,7 @@ Foam::scalar Foam::EulerImplicit::solve
c1[nSpecie+1] = p;
scalarField dcdt(nEqns, 0.0);
- this->model_.derivatives(0.0, c1, dcdt);
+ this->derivatives(0.0, c1, dcdt);
const scalar sumC = sum(c);
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H
index fffa5a93d8..1ce3148939 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/EulerImplicit/EulerImplicit.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -42,18 +42,14 @@ SourceFiles
namespace Foam
{
-// Forward declaration of classes
-template
-class EulerImplicit;
-
/*---------------------------------------------------------------------------*\
Class EulerImplicit Declaration
\*---------------------------------------------------------------------------*/
-template
+template
class EulerImplicit
:
- public chemistrySolver
+ public chemistrySolver
{
// Private data
@@ -81,8 +77,9 @@ public:
//- Construct from components
EulerImplicit
(
- ODEChemistryModel& model,
- const word& modelName
+ const fvMesh& mesh,
+ const word& ODEmodelName,
+ const word& thermoType
);
@@ -93,7 +90,7 @@ public:
// Member Functions
//- Update the concentrations and return the chemical time
- scalar solve
+ virtual scalar solve
(
scalarField &c,
const scalar T,
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C
index ade0485af1..c5b40c1a71 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.C
@@ -27,22 +27,23 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-template
-Foam::chemistrySolver::chemistrySolver
+template
+Foam::chemistrySolver::chemistrySolver
(
- ODEChemistryModel& model,
- const word& modelName
+ const fvMesh& mesh,
+ const word& ODEModelName,
+ const word& thermoType
)
:
- model_(model),
- name_(modelName)
+ ODEChemistryType(mesh, ODEModelName, thermoType),
+ name_(ODEModelName)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-template
-Foam::chemistrySolver::~chemistrySolver()
+template
+Foam::chemistrySolver::~chemistrySolver()
{}
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H
index a3c2e477c3..f837a4a154 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolver.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -46,24 +46,19 @@ SourceFiles
namespace Foam
{
-// Forward declaration of classes
-template
-class chemistrySolver;
-
/*---------------------------------------------------------------------------*\
Class chemistrySolver Declaration
\*---------------------------------------------------------------------------*/
-template
+template
class chemistrySolver
+:
+ public ODEChemistryType
{
protected:
// Protected data
- //- Reference to the chemistry model
- ODEChemistryModel& model_;
-
//- Name of the chemistry solver
const word name_;
@@ -81,10 +76,11 @@ public:
chemistrySolver,
dictionary,
(
- ODEChemistryModel& model,
- const word& modelName
+ const fvMesh& mesh,
+ const word& ODEModelName,
+ const word& thermoType
),
- (model, modelName)
+ (mesh, ODEModelName, thermoType)
);
@@ -93,20 +89,12 @@ public:
//- Construct from components
chemistrySolver
(
- ODEChemistryModel& model,
- const word& modelName
+ const fvMesh& mesh,
+ const word& ODEModelName,
+ const word& thermoType
);
- //- Selector
- static autoPtr New
- (
- ODEChemistryModel& model,
- const word& compTypeName,
- const word& thermoTypeName
- );
-
-
//- Destructor
virtual ~chemistrySolver();
@@ -131,46 +119,60 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-#define makeChemistrySolver(Comp, Thermo) \
- \
- typedef chemistrySolver \
- chemistrySolver##Comp##Thermo; \
+#define makeChemistrySolver(ODEChem) \
\
defineTemplateTypeNameAndDebugWithName \
( \
- chemistrySolver##Comp##Thermo, \
- "chemistryModel<"#Comp","#Thermo">", \
+ chemistrySolver, \
+ "chemistrySolver<"#ODEChem">", \
0 \
- ); \
- \
- defineTemplateRunTimeSelectionTable \
- ( \
- chemistrySolver##Comp##Thermo, \
- dictionary \
);
-#define makeChemistrySolverType(SS, Comp, Thermo) \
+
+#define makeChemistrySolverType(SS, ODEChem, Comp, Thermo) \
\
- typedef SS SS##Comp##Thermo; \
+ typedef SS > SS##ODEChem##Comp##Thermo; \
\
defineTemplateTypeNameAndDebugWithName \
( \
- SS##Comp##Thermo, \
- #SS"<"#Comp","#Thermo">", \
+ SS##ODEChem##Comp##Thermo, \
+ #SS"<"#ODEChem"<"#Comp","#Thermo">>", \
0 \
); \
\
- chemistrySolver:: \
- adddictionaryConstructorToTable > \
- add##SS##Comp##Thermo##ConstructorToTable_;
+ addToRunTimeSelectionTable \
+ ( \
+ Comp, \
+ SS##ODEChem##Comp##Thermo, \
+ fvMesh \
+ );
+
+
+#define makeSolidChemistrySolverType(SS, ODEChem, Comp, SThermo, GThermo) \
+ \
+ typedef SS > \
+ SS##ODEChem##Comp##SThermo##GThermo; \
+ \
+ defineTemplateTypeNameAndDebugWithName \
+ ( \
+ SS##ODEChem##Comp##SThermo##GThermo, \
+ #SS"<"#ODEChem"<"#Comp","#SThermo","#GThermo">>", \
+ 0 \
+ ); \
+ \
+ addToRunTimeSelectionTable \
+ ( \
+ Comp, \
+ SS##ODEChem##Comp##SThermo##GThermo, \
+ fvMesh \
+ );
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "chemistrySolver.C"
-# include "chemistrySolverNew.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolverNew.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolverNew.C
deleted file mode 100644
index f7eab4c2d7..0000000000
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/chemistrySolverNew.C
+++ /dev/null
@@ -1,80 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | Copyright (C) 2004-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 "chemistrySolver.H"
-
-// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
-
-template
-Foam::autoPtr >
-Foam::chemistrySolver::New
-(
- ODEChemistryModel& model,
- const word& compTypeName,
- const word& thermoTypeName
-)
-{
- const word modelName(model.lookup("chemistrySolver"));
-
- const word chemistrySolverType =
- modelName + '<' + compTypeName + ',' + thermoTypeName + '>';
-
- Info<< "Selecting chemistrySolver " << modelName << endl;
-
- typename dictionaryConstructorTable::iterator cstrIter =
- dictionaryConstructorTablePtr_->find(chemistrySolverType);
-
- if (cstrIter == dictionaryConstructorTablePtr_->end())
- {
- wordList models = dictionaryConstructorTablePtr_->sortedToc();
- forAll(models, i)
- {
- models[i] = models[i].replace
- (
- '<' + compTypeName + ',' + thermoTypeName + '>',
- ""
- );
- }
-
- FatalErrorIn
- (
- "chemistrySolver::New"
- "("
- "const ODEChemistryModel&, "
- "const word&, "
- "const word&"
- ")"
- ) << "Unknown chemistrySolver type "
- << modelName << nl << nl
- << "Valid chemistrySolver types are:" << nl
- << models << nl << exit(FatalError);
- }
-
- return autoPtr >
- (cstrIter()(model, modelName));
-}
-
-
-// ************************************************************************* //
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolverTypes.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolverTypes.H
new file mode 100644
index 0000000000..ef217617f3
--- /dev/null
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolverTypes.H
@@ -0,0 +1,83 @@
+/*---------------------------------------------------------------------------*\
+ ========= |
+ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
+ \\ / O peration |
+ \\ / A nd | Copyright (C) 2010-2011 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 .
+
+\*---------------------------------------------------------------------------*/
+
+#ifndef makeChemistrySolverTypes_H
+#define makeChemistrySolverTypes_H
+
+#include "chemistrySolver.H"
+
+#include "ODEChemistryModel.H"
+
+#include "noChemistrySolver.H"
+#include "EulerImplicit.H"
+#include "ode.H"
+#include "sequential.H"
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#define makeChemistrySolverTypes(CompChemModel,Thermo) \
+ \
+ typedef ODEChemistryModel CompChemModel##Thermo; \
+ \
+ makeChemistrySolver(CompChemModel##Thermo); \
+ \
+ makeChemistrySolverType \
+ ( \
+ noChemistrySolver, \
+ ODEChemistryModel, \
+ CompChemModel, \
+ Thermo \
+ ); \
+ \
+ makeChemistrySolverType \
+ ( \
+ EulerImplicit, \
+ ODEChemistryModel, \
+ CompChemModel, \
+ Thermo \
+ ); \
+ \
+ makeChemistrySolverType \
+ ( \
+ ode, \
+ ODEChemistryModel, \
+ CompChemModel, \
+ Thermo \
+ ); \
+ \
+ makeChemistrySolverType \
+ ( \
+ sequential, \
+ ODEChemistryModel, \
+ CompChemModel, \
+ Thermo \
+ );
+
+
+// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
+
+#endif
+
+// ************************************************************************* //
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C
index f9ae6bca25..82b29fb37b 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/chemistrySolver/makeChemistrySolvers.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -23,85 +23,20 @@ License
\*---------------------------------------------------------------------------*/
-#include "thermoPhysicsTypes.H"
-#include "chemistrySolver.H"
+#include "makeChemistrySolverTypes.H"
+#include "thermoPhysicsTypes.H"
#include "psiChemistryModel.H"
#include "rhoChemistryModel.H"
-#include "noChemistrySolver.H"
-
-#include "EulerImplicit.H"
-#include "ode.H"
-#include "sequential.H"
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
- makeChemistrySolver(psiChemistryModel, gasThermoPhysics)
- makeChemistrySolverType
- (
- noChemistrySolver,
- psiChemistryModel,
- gasThermoPhysics
- )
- makeChemistrySolverType(EulerImplicit, psiChemistryModel, gasThermoPhysics)
- makeChemistrySolverType(ode, psiChemistryModel, gasThermoPhysics)
- makeChemistrySolverType(sequential, psiChemistryModel, gasThermoPhysics)
-
- makeChemistrySolver(psiChemistryModel, icoPoly8ThermoPhysics)
- makeChemistrySolverType
- (
- noChemistrySolver,
- psiChemistryModel,
- icoPoly8ThermoPhysics
- )
- makeChemistrySolverType
- (
- EulerImplicit,
- psiChemistryModel,
- icoPoly8ThermoPhysics
- )
- makeChemistrySolverType(ode, psiChemistryModel, icoPoly8ThermoPhysics)
- makeChemistrySolverType
- (
- sequential,
- psiChemistryModel,
- icoPoly8ThermoPhysics
- )
-
- makeChemistrySolver(rhoChemistryModel, gasThermoPhysics)
- makeChemistrySolverType
- (
- noChemistrySolver,
- rhoChemistryModel,
- gasThermoPhysics
- )
- makeChemistrySolverType(EulerImplicit, rhoChemistryModel, gasThermoPhysics)
- makeChemistrySolverType(ode, rhoChemistryModel, gasThermoPhysics)
- makeChemistrySolverType(sequential, rhoChemistryModel, gasThermoPhysics)
-
- makeChemistrySolver(rhoChemistryModel, icoPoly8ThermoPhysics)
- makeChemistrySolverType
- (
- noChemistrySolver,
- rhoChemistryModel,
- icoPoly8ThermoPhysics
- )
- makeChemistrySolverType
- (
- EulerImplicit,
- rhoChemistryModel,
- icoPoly8ThermoPhysics
- )
- makeChemistrySolverType(ode, rhoChemistryModel, icoPoly8ThermoPhysics)
- makeChemistrySolverType
- (
- sequential,
- rhoChemistryModel,
- icoPoly8ThermoPhysics
- )
+ makeChemistrySolverTypes(psiChemistryModel, gasThermoPhysics);
+ makeChemistrySolverTypes(psiChemistryModel, icoPoly8ThermoPhysics);
+ makeChemistrySolverTypes(rhoChemistryModel, gasThermoPhysics);
+ makeChemistrySolverTypes(rhoChemistryModel, icoPoly8ThermoPhysics);
}
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.C b/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.C
index 0d64b3fb85..822f8266b1 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.C
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.C
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -28,28 +28,29 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-template
-Foam::noChemistrySolver::noChemistrySolver
+template
+Foam::noChemistrySolver::noChemistrySolver
(
- ODEChemistryModel& model,
- const word& modelName
+ const fvMesh& mesh,
+ const word& ODEModelName,
+ const word& thermoType
)
:
- chemistrySolver(model, modelName)
+ chemistrySolver(mesh, ODEModelName, thermoType)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-template
-Foam::noChemistrySolver::~noChemistrySolver()
+template
+Foam::noChemistrySolver::~noChemistrySolver()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-template
-Foam::scalar Foam::noChemistrySolver::solve
+template
+Foam::scalar Foam::noChemistrySolver::solve
(
scalarField&,
const scalar,
diff --git a/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.H b/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.H
index 7382beba85..752c8d6177 100644
--- a/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.H
+++ b/src/thermophysicalModels/chemistryModel/chemistrySolver/noChemistrySolver/noChemistrySolver.H
@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
- \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
+ \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
@@ -43,18 +43,14 @@ SourceFiles
namespace Foam
{
-// Forward declaration of classes
-template
-class noChemistrySolver;
-
/*---------------------------------------------------------------------------*\
- Class noChemistrySolver Declaration
+ Class noChemistrySolver Declaration
\*---------------------------------------------------------------------------*/
-template
+template