Commit d204ebfc authored by andy's avatar andy
Browse files

ENH: Initial check-in of updated pyrolysis models + supporting libs

parent 3a899a1b
...@@ -4,7 +4,7 @@ makeType=${1:-libso} ...@@ -4,7 +4,7 @@ makeType=${1:-libso}
set -x set -x
wmake $makeType regionModel wmake $makeType regionModel
#wmake $makeType pyrolysisModels wmake $makeType pyrolysisModels
wmake $makeType surfaceFilmModels wmake $makeType surfaceFilmModels
wmake $makeType thermoBaffleModels wmake $makeType thermoBaffleModels
#wmake $makeType regionCoupling #wmake $makeType regionCoupling
......
/* 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
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
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(p, iF),
nbrPhiName_("none"),
phiName_("phi"),
rhoName_("rho")
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
fixedValueFvPatchField<vector>(ptf, p, iF, mapper),
nbrPhiName_(ptf.nbrPhiName_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
(
const fvPatch& p,
const DimensionedField<vector, volMesh>& iF,
const dictionary& dict
)
:
fixedValueFvPatchField<vector>(p, iF, dict),
nbrPhiName_(dict.lookupOrDefault<word>("nbrPhi", "phi")),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField& ptf
)
:
fixedValueFvPatchField<vector>(ptf),
nbrPhiName_(ptf.nbrPhiName_),
phiName_(ptf.phiName_),
rhoName_(ptf.rhoName_)
{}
Foam::flowRateInletVelocityCoupledFvPatchVectorField::
flowRateInletVelocityCoupledFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField& ptf,
const DimensionedField<vector, volMesh>& iF
)
:
fixedValueFvPatchField<vector>(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<const directMappedPatchBase>
(
patch().patch()
);
const polyMesh& nbrMesh = mpp.sampleMesh();
const fvPatch& nbrPatch = refCast<const fvMesh>
(
nbrMesh
).boundary()[mpp.samplePolyPatch().index()];
// Force recalculation of mapping and schedule
const mapDistribute& distMap = mpp.map();
scalarList phi =
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(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<surfaceScalarField>(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<surfaceScalarField>(phiName_);
if (phiName.dimensions() == dimVelocity*dimArea)
{
// volumetric flow-rate
operator==(n*U);
}
else if (phiName.dimensions() == dimDensity*dimVelocity*dimArea)
{
const fvPatchField<scalar>& rhop =
patch().lookupPatchField<volScalarField, scalar>(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<vector>::updateCoeffs();
}
void Foam::flowRateInletVelocityCoupledFvPatchVectorField::write(Ostream& os) const
{
fvPatchField<vector>::write(os);
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
os.writeKeyword("nbrPhi") << nbrPhiName_ << token::END_STATEMENT << nl;
writeEntry("value", os);
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makePatchTypeField
(
fvPatchVectorField,
flowRateInletVelocityCoupledFvPatchVectorField
);
}
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
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<vector, volMesh>&
);
//- Construct from patch, internal field and dictionary
flowRateInletVelocityCoupledFvPatchVectorField
(
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// flowRateInletVelocityCoupledFvPatchVectorField
// onto a new patch
flowRateInletVelocityCoupledFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField&,
const fvPatch&,
const DimensionedField<vector, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
flowRateInletVelocityCoupledFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField&
);
//- Construct and return a clone
virtual tmp<fvPatchVectorField> clone() const
{
return tmp<fvPatchVectorField>
(
new flowRateInletVelocityCoupledFvPatchVectorField(*this)
);
}
//- Construct as copy setting internal field reference
flowRateInletVelocityCoupledFvPatchVectorField
(
const flowRateInletVelocityCoupledFvPatchVectorField&,
const DimensionedField<vector, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchVectorField> clone
(
const DimensionedField<vector, volMesh>& iF
) const
{
return tmp<fvPatchVectorField>
(
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
// ************************************************************************* //
/*---------------------------------------------------------------------------*\
========= |
\\ / 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 <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#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<scalar, volMesh>& iF
)
:
mixedFvPatchField<scalar>(p, iF),
phiName_("phi"),
rhoName_("none")
{
refValue() = 0.0;
refGrad() = 0.0;
valueFraction() = 0.0;
}
Foam::totalFlowRateAdvectiveDiffusiveFvPatchScalarField::
totalFlowRateAdvectiveDiffusiveFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mixedFvPatchField<scalar>(p, iF),
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
rhoName_(dict.lookupOrDefault<word>("rho", "none"))
{
refValue() = 1.0;
refGrad() = 0.0;
valueFraction() = 0.0;
if (dict.found("value"))
{
fvPatchField<scalar>::operator=
(
Field<scalar>("value", dict, p.size())
);
}
else
{