Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2013-09-02 14:25:35 +01:00
36 changed files with 284 additions and 187 deletions

View File

@ -1,5 +1,4 @@
EXE_INC = \ EXE_INC = \
-I../rhoPorousMRFPimpleFoam \
-I.. \ -I.. \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \

View File

@ -269,9 +269,10 @@ void selectCurvatureCells
querySurf.surface(), querySurf.surface(),
querySurf, querySurf,
pointField(1, mesh.cellCentres()[0]), pointField(1, mesh.cellCentres()[0]),
false, false, // includeCut
false, false, // includeInside
false, false, // includeOutside
false, // geometricOnly
nearDist, nearDist,
curvature curvature
); );

View File

@ -143,6 +143,9 @@ FoamFile
// sourceInfo // sourceInfo
// { // {
// file "www.avl.com-geometry.stl"; // file "www.avl.com-geometry.stl";
// useSurfaceOrientation false; // use closed surface inside/outside
// // test (ignores includeCut,
// // outsidePoints)
// outsidePoints ((-99 -99 -59)); // definition of outside // outsidePoints ((-99 -99 -59)); // definition of outside
// includeCut false; // cells cut by surface // includeCut false; // cells cut by surface
// includeInside false; // cells not on outside of surf // includeInside false; // cells not on outside of surf

View File

@ -165,6 +165,10 @@ surfaces
//- Optional: restrict to a particular zone //- Optional: restrict to a particular zone
// zone zone1; // zone zone1;
//- Optional: do not triangulate (only for surfaceFormats that support
// polygons)
//triangulate false;
} }
interpolatedPlane interpolatedPlane

View File

@ -39,6 +39,14 @@ namespace functionEntries
{ {
defineTypeNameAndDebug(codeStream, 0); defineTypeNameAndDebug(codeStream, 0);
addToMemberFunctionSelectionTable
(
functionEntry,
codeStream,
execute,
dictionaryIstream
);
addToMemberFunctionSelectionTable addToMemberFunctionSelectionTable
( (
functionEntry, functionEntry,
@ -364,6 +372,38 @@ bool Foam::functionEntries::codeStream::execute
IStringStream resultStream(os.str()); IStringStream resultStream(os.str());
entry.read(parentDict, resultStream); entry.read(parentDict, resultStream);
return true;
}
bool Foam::functionEntries::codeStream::execute
(
dictionary& parentDict,
Istream& is
)
{
Info<< "Using #codeStream at line " << is.lineNumber()
<< " in file " << parentDict.name() << endl;
dynamicCode::checkSecurity
(
"functionEntries::codeStream::execute(..)",
parentDict
);
// get code dictionary
// must reference parent for stringOps::expand to work nicely
dictionary codeDict("#codeStream", parentDict, is);
streamingFunctionType function = getFunction(parentDict, codeDict);
// use function to write stream
OStringStream os(is.format());
(*function)(os, parentDict);
// get the entry from this stream
IStringStream resultStream(os.str());
parentDict.read(resultStream);
return true; return true;
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -160,6 +160,10 @@ public:
// Member Functions // Member Functions
//- Execute the functionEntry in a sub-dict context
static bool execute(dictionary& parentDict, Istream&);
//- Execute the functionEntry in a primitiveEntry context
static bool execute static bool execute
( (
const dictionary& parentDict, const dictionary& parentDict,

View File

@ -157,7 +157,30 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
{ {
cpuTime timer; cpuTime timer;
if (includeCut_ || includeInside_ || includeOutside_)
if (useSurfaceOrientation_ && (includeInside_ || includeOutside_))
{
const meshSearch queryMesh(mesh_);
//- Calculate for each searchPoint inside/outside status.
boolList isInside(querySurf().calcInside(mesh_.cellCentres()));
Info<< " Marked inside/outside using surface orientation in = "
<< timer.cpuTimeIncrement() << " s" << endl << endl;
forAll(isInside, cellI)
{
if (isInside[cellI] && includeInside_)
{
addOrDelete(set, cellI, add);
}
else if (!isInside[cellI] && includeOutside_)
{
addOrDelete(set, cellI, add);
}
}
}
else if (includeCut_ || includeInside_ || includeOutside_)
{ {
// //
// Cut cells with surface and classify cells // Cut cells with surface and classify cells
@ -166,7 +189,7 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
// Construct search engine on mesh // Construct search engine on mesh
meshSearch queryMesh(mesh_); const meshSearch queryMesh(mesh_);
// Check all 'outside' points // Check all 'outside' points
@ -196,10 +219,10 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const
); );
Info<< " Marked inside/outside in = " Info<< " Marked inside/outside using surface intersection in = "
<< timer.cpuTimeIncrement() << " s" << endl << endl; << timer.cpuTimeIncrement() << " s" << endl << endl;
//- Add/remove cells using set
forAll(cellType, cellI) forAll(cellType, cellI)
{ {
label cType = cellType[cellI]; label cType = cellType[cellI];
@ -326,6 +349,18 @@ void Foam::surfaceToCell::checkSettings() const
<< " or set curvature to a value -1 .. 1." << " or set curvature to a value -1 .. 1."
<< exit(FatalError); << exit(FatalError);
} }
if (useSurfaceOrientation_ && includeCut_)
{
FatalErrorIn
(
"surfaceToCell:checkSettings()"
) << "Illegal include cell specification."
<< " You cannot specify both 'useSurfaceOrientation'"
<< " and 'includeCut'"
<< " since 'includeCut' specifies a topological split"
<< exit(FatalError);
}
} }
@ -340,6 +375,7 @@ Foam::surfaceToCell::surfaceToCell
const bool includeCut, const bool includeCut,
const bool includeInside, const bool includeInside,
const bool includeOutside, const bool includeOutside,
const bool useSurfaceOrientation,
const scalar nearDist, const scalar nearDist,
const scalar curvature const scalar curvature
) )
@ -350,6 +386,7 @@ Foam::surfaceToCell::surfaceToCell
includeCut_(includeCut), includeCut_(includeCut),
includeInside_(includeInside), includeInside_(includeInside),
includeOutside_(includeOutside), includeOutside_(includeOutside),
useSurfaceOrientation_(useSurfaceOrientation),
nearDist_(nearDist), nearDist_(nearDist),
curvature_(curvature), curvature_(curvature),
surfPtr_(new triSurface(surfName_)), surfPtr_(new triSurface(surfName_)),
@ -371,6 +408,7 @@ Foam::surfaceToCell::surfaceToCell
const bool includeCut, const bool includeCut,
const bool includeInside, const bool includeInside,
const bool includeOutside, const bool includeOutside,
const bool useSurfaceOrientation,
const scalar nearDist, const scalar nearDist,
const scalar curvature const scalar curvature
) )
@ -381,6 +419,7 @@ Foam::surfaceToCell::surfaceToCell
includeCut_(includeCut), includeCut_(includeCut),
includeInside_(includeInside), includeInside_(includeInside),
includeOutside_(includeOutside), includeOutside_(includeOutside),
useSurfaceOrientation_(useSurfaceOrientation),
nearDist_(nearDist), nearDist_(nearDist),
curvature_(curvature), curvature_(curvature),
surfPtr_(&surf), surfPtr_(&surf),
@ -404,6 +443,10 @@ Foam::surfaceToCell::surfaceToCell
includeCut_(readBool(dict.lookup("includeCut"))), includeCut_(readBool(dict.lookup("includeCut"))),
includeInside_(readBool(dict.lookup("includeInside"))), includeInside_(readBool(dict.lookup("includeInside"))),
includeOutside_(readBool(dict.lookup("includeOutside"))), includeOutside_(readBool(dict.lookup("includeOutside"))),
useSurfaceOrientation_
(
dict.lookupOrDefault<bool>("useSurfaceOrientation", false)
),
nearDist_(readScalar(dict.lookup("nearDistance"))), nearDist_(readScalar(dict.lookup("nearDistance"))),
curvature_(readScalar(dict.lookup("curvature"))), curvature_(readScalar(dict.lookup("curvature"))),
surfPtr_(new triSurface(surfName_)), surfPtr_(new triSurface(surfName_)),
@ -427,6 +470,7 @@ Foam::surfaceToCell::surfaceToCell
includeCut_(readBool(checkIs(is))), includeCut_(readBool(checkIs(is))),
includeInside_(readBool(checkIs(is))), includeInside_(readBool(checkIs(is))),
includeOutside_(readBool(checkIs(is))), includeOutside_(readBool(checkIs(is))),
useSurfaceOrientation_(false),
nearDist_(readScalar(checkIs(is))), nearDist_(readScalar(checkIs(is))),
curvature_(readScalar(checkIs(is))), curvature_(readScalar(checkIs(is))),
surfPtr_(new triSurface(surfName_)), surfPtr_(new triSurface(surfName_)),

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,6 +29,8 @@ Description
Selects: Selects:
- all cells inside/outside/cut by surface - all cells inside/outside/cut by surface
- all cells inside/outside surface ('useSurfaceOrientation', requires closed
surface)
- cells with centre nearer than XXX to surface - cells with centre nearer than XXX to surface
- cells with centre nearer than XXX to surface \b and with normal - cells with centre nearer than XXX to surface \b and with normal
at nearest point to centre and cell-corners differing by at nearest point to centre and cell-corners differing by
@ -67,27 +69,31 @@ class surfaceToCell
static addToUsageTable usage_; static addToUsageTable usage_;
//- Name of surface file //- Name of surface file
fileName surfName_; const fileName surfName_;
//- Points which are outside //- Points which are outside
pointField outsidePoints_; const pointField outsidePoints_;
//- Include cut cells //- Include cut cells
bool includeCut_; const bool includeCut_;
//- Include inside cells //- Include inside cells
bool includeInside_; const bool includeInside_;
//- Include outside cells //- Include outside cells
bool includeOutside_; const bool includeOutside_;
//- Determine inside/outside purely using geometric test
// (does not allow includeCut)
const bool useSurfaceOrientation_;
//- if > 0 : include cells with distance from cellCentre to surface //- if > 0 : include cells with distance from cellCentre to surface
// less than nearDist. // less than nearDist.
scalar nearDist_; const scalar nearDist_;
//- if > -1 : include cells with normals at nearest surface points //- if > -1 : include cells with normals at nearest surface points
// varying more than curvature_. // varying more than curvature_.
scalar curvature_; const scalar curvature_;
//- triSurface to search on. On pointer since can be external. //- triSurface to search on. On pointer since can be external.
const triSurface* surfPtr_; const triSurface* surfPtr_;
@ -97,7 +103,7 @@ class surfaceToCell
//- whether I allocated above surface ptrs or whether they are //- whether I allocated above surface ptrs or whether they are
// external. // external.
bool IOwnPtrs_; const bool IOwnPtrs_;
// Private Member Functions // Private Member Functions
@ -155,6 +161,7 @@ public:
const bool includeCut, const bool includeCut,
const bool includeInside, const bool includeInside,
const bool includeOutside, const bool includeOutside,
const bool useSurfaceOrientation,
const scalar nearDist, const scalar nearDist,
const scalar curvature const scalar curvature
); );
@ -170,6 +177,7 @@ public:
const bool includeCut, const bool includeCut,
const bool includeInside, const bool includeInside,
const bool includeOutside, const bool includeOutside,
const bool useSurfaceOrientation,
const scalar nearDist, const scalar nearDist,
const scalar curvature const scalar curvature
); );

View File

@ -472,7 +472,6 @@ void Foam::topoSet::invert(const label maxLen)
insert(cellI); insert(cellI);
} }
} }
} }
@ -550,20 +549,6 @@ void Foam::topoSet::writeDebug(Ostream& os, const label maxLen) const
} }
//void Foam::topoSet::writeDebug
//(
// Ostream&,
// const primitiveMesh&,
// const label
//) const
//{
// notImplemented
// (
// "topoSet::writeDebug(Ostream&, const primitiveMesh&, const label)"
// );
//}
bool Foam::topoSet::writeData(Ostream& os) const bool Foam::topoSet::writeData(Ostream& os) const
{ {
return (os << *this).good(); return (os << *this).good();
@ -576,14 +561,6 @@ void Foam::topoSet::updateMesh(const mapPolyMesh&)
} }
////- Return max index+1.
//label topoSet::maxSize(const polyMesh&) const
//{
// notImplemented("topoSet::maxSize(const polyMesh&)");
//
// return -1;
//}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::topoSet::operator=(const topoSet& rhs) void Foam::topoSet::operator=(const topoSet& rhs)

View File

@ -32,6 +32,7 @@ License
#include "fvcVolumeIntegrate.H" #include "fvcVolumeIntegrate.H"
#include "fvMatrices.H" #include "fvMatrices.H"
#include "absorptionEmissionModel.H" #include "absorptionEmissionModel.H"
#include "fvcLaplacian.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -61,6 +62,9 @@ void reactingOneDim::readReactingOneDimControls()
coeffs().lookup("gasHSource") >> gasHSource_; coeffs().lookup("gasHSource") >> gasHSource_;
coeffs().lookup("QrHSource") >> QrHSource_; coeffs().lookup("QrHSource") >> QrHSource_;
useChemistrySolvers_ =
coeffs().lookupOrDefault<bool>("useChemistrySolvers", true);
} }
@ -321,6 +325,8 @@ void reactingOneDim::solveEnergy()
( (
fvm::ddt(rho_, h_) fvm::ddt(rho_, h_)
- fvm::laplacian(alpha, h_) - fvm::laplacian(alpha, h_)
+ fvc::laplacian(alpha, h_)
- fvc::laplacian(kappa(), T())
== ==
chemistrySh_ chemistrySh_
- fvm::Sp(solidChemistry_->RRg(), h_) - fvm::Sp(solidChemistry_->RRg(), h_)
@ -462,7 +468,8 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
totalGasMassFlux_(0.0), totalGasMassFlux_(0.0),
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)), totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)),
gasHSource_(false), gasHSource_(false),
QrHSource_(false) QrHSource_(false),
useChemistrySolvers_(true)
{ {
if (active_) if (active_)
{ {
@ -560,7 +567,8 @@ reactingOneDim::reactingOneDim
totalGasMassFlux_(0.0), totalGasMassFlux_(0.0),
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)), totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)),
gasHSource_(false), gasHSource_(false),
QrHSource_(false) QrHSource_(false),
useChemistrySolvers_(true)
{ {
if (active_) if (active_)
{ {
@ -681,11 +689,18 @@ void reactingOneDim::evolveRegion()
{ {
Info<< "\nEvolving pyrolysis in region: " << regionMesh().name() << endl; Info<< "\nEvolving pyrolysis in region: " << regionMesh().name() << endl;
if (useChemistrySolvers_)
{
solidChemistry_->solve solidChemistry_->solve
( (
time().value() - time().deltaTValue(), time().value() - time().deltaTValue(),
time().deltaTValue() time().deltaTValue()
); );
}
else
{
solidChemistry_->calculate();
}
solveContinuity(); solveContinuity();

View File

@ -154,6 +154,9 @@ protected:
//- Add in depth radiation source term //- Add in depth radiation source term
bool QrHSource_; bool QrHSource_;
//- Use chemistry solvers (ode or sequential)
bool useChemistrySolvers_;
// Protected member functions // Protected member functions

View File

@ -45,12 +45,14 @@ Foam::sampledPlane::sampledPlane
const word& name, const word& name,
const polyMesh& mesh, const polyMesh& mesh,
const plane& planeDesc, const plane& planeDesc,
const keyType& zoneKey const keyType& zoneKey,
const bool triangulate
) )
: :
sampledSurface(name, mesh), sampledSurface(name, mesh),
cuttingPlane(planeDesc), cuttingPlane(planeDesc),
zoneKey_(zoneKey), zoneKey_(zoneKey),
triangulate_(triangulate),
needsUpdate_(true) needsUpdate_(true)
{ {
if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0) if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0)
@ -71,6 +73,7 @@ Foam::sampledPlane::sampledPlane
sampledSurface(name, mesh, dict), sampledSurface(name, mesh, dict),
cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))), cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))),
zoneKey_(keyType::null), zoneKey_(keyType::null),
triangulate_(dict.lookupOrDefault("triangulate", true)),
needsUpdate_(true) needsUpdate_(true)
{ {
// make plane relative to the coordinateSystem (Cartesian) // make plane relative to the coordinateSystem (Cartesian)
@ -138,11 +141,11 @@ bool Foam::sampledPlane::update()
if (selectedCells.empty()) if (selectedCells.empty())
{ {
reCut(mesh(), true); // always triangulate. Note:Make option? reCut(mesh(), triangulate_);
} }
else else
{ {
reCut(mesh(), true, selectedCells); reCut(mesh(), triangulate_, selectedCells);
} }
if (debug) if (debug)
@ -250,6 +253,7 @@ void Foam::sampledPlane::print(Ostream& os) const
os << "sampledPlane: " << name() << " :" os << "sampledPlane: " << name() << " :"
<< " base:" << refPoint() << " base:" << refPoint()
<< " normal:" << normal() << " normal:" << normal()
<< " triangulate:" << triangulate_
<< " faces:" << faces().size() << " faces:" << faces().size()
<< " points:" << points().size(); << " points:" << points().size();
} }

View File

@ -25,7 +25,7 @@ Class
Foam::sampledPlane Foam::sampledPlane
Description Description
A sampledSurface defined by a cuttingPlane. Always triangulated. A sampledSurface defined by a cuttingPlane. Triangulated by default.
Note Note
Does not actually cut until update() called. Does not actually cut until update() called.
@ -60,6 +60,9 @@ class sampledPlane
//- If restricted to zones, name of this zone or a regular expression //- If restricted to zones, name of this zone or a regular expression
keyType zoneKey_; keyType zoneKey_;
//- Triangulated faces or keep faces as is
const bool triangulate_;
//- Track if the surface needs an update //- Track if the surface needs an update
mutable bool needsUpdate_; mutable bool needsUpdate_;
@ -92,7 +95,8 @@ public:
const word& name, const word& name,
const polyMesh& mesh, const polyMesh& mesh,
const plane& planeDesc, const plane& planeDesc,
const keyType& zoneKey = word::null const keyType& zoneKey = word::null,
const bool triangulate = true
); );
//- Construct from dictionary //- Construct from dictionary

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -140,6 +140,12 @@ public:
const label i const label i
) const = 0; ) const = 0;
//- Return access to chemical source terms [kg/m3/s]
virtual DimensionedField<scalar, volMesh>& RR
(
const label i
) = 0;
// Chemistry solution // Chemistry solution

View File

@ -211,6 +211,12 @@ public:
const label i const label i
) const; ) const;
//- Return non const access to chemical source terms [kg/m3/s]
virtual DimensionedField<scalar, volMesh>& RR
(
const label i
);
//- Solve the reaction system for the given start time and time //- Solve the reaction system for the given start time and time
// step and return the characteristic time // step and return the characteristic time
virtual scalar solve(const scalar t0, const scalar deltaT); virtual scalar solve(const scalar t0, const scalar deltaT);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -78,5 +78,15 @@ Foam::chemistryModel<CompType, ThermoType>::RR
return RR_[i]; return RR_[i];
} }
template<class CompType, class ThermoType>
Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::chemistryModel<CompType, ThermoType>::RR
(
const label i
)
{
return RR_[i];
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -53,4 +53,35 @@ Foam::basicSolidChemistryModel::~basicSolidChemistryModel()
{} {}
const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicSolidChemistryModel::RR(const label i) const
{
notImplemented
(
"const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&"
"basicSolidChemistryModel::RR(const label)"
);
return (DimensionedField<scalar, volMesh>::null());
}
Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicSolidChemistryModel::RR(const label i)
{
notImplemented
(
"Foam::DimensionedField<Foam::scalar, Foam::volMesh>&"
"basicSolidChemistryModel::RR(const label)"
);
return dynamic_cast<DimensionedField<scalar, volMesh>&>
(
const_cast<DimensionedField<scalar, volMesh>& >
(
DimensionedField<scalar, volMesh>::null()
)
);
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -149,6 +149,15 @@ public:
//- Calculates the reaction rates //- Calculates the reaction rates
virtual void calculate() = 0; virtual void calculate() = 0;
//- Return const access to the total source terms
virtual const DimensionedField<scalar, volMesh>& RR
(
const label i
) const;
//- Return non-const access to the total source terms
virtual DimensionedField<scalar, volMesh>& RR(const label i);
}; };

View File

@ -535,14 +535,21 @@ updateConcsInReactionI
c[si] = max(0.0, c[si]); c[si] = max(0.0, c[si]);
} }
scalar sr = 0.0;
forAll(R.rhs(), s) forAll(R.rhs(), s)
{ {
label si = R.rhs()[s].index; label si = R.rhs()[s].index;
const scalar rhoR = this->solidThermo_[si].rho(p, T); const scalar rhoR = this->solidThermo_[si].rho(p, T);
const scalar sr = rhoR/rhoL; sr = rhoR/rhoL;
c[si] += dt*sr*omeg; c[si] += dt*sr*omeg;
c[si] = max(0.0, c[si]); c[si] = max(0.0, c[si]);
} }
forAll(R.grhs(), g)
{
label gi = R.grhs()[g].index;
c[gi + this->nSolids_] += (1.0 - sr)*omeg*dt;
}
} }
@ -561,24 +568,11 @@ updateRRInReactionI
simpleMatrix<scalar>& RR simpleMatrix<scalar>& RR
) const ) const
{ {
const Reaction<SolidThermo>& R = this->reactions_[index]; notImplemented
scalar rhoL = 0.0; (
forAll(R.lhs(), s) "void Foam::pyrolysisChemistryModel<CompType, SolidThermo,GasThermo>::"
{ "updateRRInReactionI"
label si = R.lhs()[s].index; );
rhoL = this->solidThermo_[si].rho(p, T);
RR[si][rRef] -= pr*corr;
RR[si][lRef] += pf*corr;
}
forAll(R.rhs(), s)
{
label si = R.rhs()[s].index;
const scalar rhoR = this->solidThermo_[si].rho(p, T);
const scalar sr = rhoR/rhoL;
RR[si][lRef] -= sr*pf*corr;
RR[si][rRef] += sr*pr*corr;
}
} }
@ -666,7 +660,6 @@ Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::solve
scalar newCp = 0.0; scalar newCp = 0.0;
scalar newhi = 0.0; scalar newhi = 0.0;
scalar invRho = 0.0;
scalarList dcdt = (c - c0)/dt; scalarList dcdt = (c - c0)/dt;
for (label i=0; i<this->nSolids_; i++) for (label i=0; i<this->nSolids_; i++)
@ -675,7 +668,6 @@ Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::solve
scalar Yi = c[i]/cTot; scalar Yi = c[i]/cTot;
newCp += Yi*this->solidThermo_[i].Cp(pi, Ti); newCp += Yi*this->solidThermo_[i].Cp(pi, Ti);
newhi -= dYi*this->solidThermo_[i].Hc(); newhi -= dYi*this->solidThermo_[i].Hc();
invRho += Yi/this->solidThermo_[i].rho(pi, Ti);
} }
scalar dTi = (newhi/newCp)*dt; scalar dTi = (newhi/newCp)*dt;

View File

@ -137,8 +137,9 @@ public:
const bool updateC0 = false const bool updateC0 = false
) const; ) const;
//- Return the reaction rate for reaction r and the reference //- Return the reaction rate for reaction r
// species and charateristic times // NOTE: Currently does not calculate reference specie and
// characteristic times (pf, cf,l Ref, etc.)
virtual scalar omega virtual scalar omega
( (
const Reaction<SolidThermo>& r, const Reaction<SolidThermo>& r,
@ -153,8 +154,10 @@ public:
label& rRef label& rRef
) const; ) const;
//- Return the reaction rate for iReaction and the reference
// species and charateristic times //- Return the reaction rate for iReaction
// NOTE: Currently does not calculate reference specie and
// characteristic times (pf, cf,l Ref, etc.)
virtual scalar omegaI virtual scalar omegaI
( (
label iReaction, label iReaction,
@ -169,6 +172,7 @@ public:
label& rRef label& rRef
) const; ) const;
//- Calculates the reaction rates //- Calculates the reaction rates
virtual void calculate(); virtual void calculate();
@ -186,6 +190,7 @@ public:
//- Update matrix RR for reaction i. Used by EulerImplicit //- Update matrix RR for reaction i. Used by EulerImplicit
// (Not implemented)
virtual void updateRRInReactionI virtual void updateRRInReactionI
( (
const label i, const label i,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -65,6 +65,9 @@ class solidChemistryModel
{ {
// Private Member Functions // Private Member Functions
//- Disallow copy constructor
solidChemistryModel(const solidChemistryModel&);
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const solidChemistryModel&); void operator=(const solidChemistryModel&);
@ -151,6 +154,7 @@ public:
label& rRef label& rRef
) const = 0; ) const = 0;
//- Return the reaction rate for iReaction and the reference //- Return the reaction rate for iReaction and the reference
// species and charateristic times // species and charateristic times
virtual scalar omegaI virtual scalar omegaI
@ -167,6 +171,10 @@ public:
label& rRef label& rRef
) const = 0; ) const = 0;
//- Calculates the reaction rates
virtual void calculate() = 0;
//- Update concentrations in reaction i given dt and reaction rate //- Update concentrations in reaction i given dt and reaction rate
// omega used by sequential solver // omega used by sequential solver
virtual void updateConcsInReactionI virtual void updateConcsInReactionI
@ -194,11 +202,8 @@ public:
simpleMatrix<scalar>& RR simpleMatrix<scalar>& RR
) const = 0; ) const = 0;
//- Calculates the reaction rates
virtual void calculate() = 0;
// Solid Chemistry model functions
// Chemistry model functions
//- Return const access to the chemical source terms for solids //- Return const access to the chemical source terms for solids
inline const DimensionedField<scalar, volMesh>& RRs inline const DimensionedField<scalar, volMesh>& RRs
@ -209,13 +214,6 @@ public:
//- Return total solid source term //- Return total solid source term
inline tmp<DimensionedField<scalar, volMesh> > RRs() const; inline tmp<DimensionedField<scalar, volMesh> > RRs() const;
//- Return const access to the total source terms
inline const DimensionedField<scalar, volMesh>& RR
(
const label i
) const;
//- Solve the reaction system for the given start time and time //- Solve the reaction system for the given start time and time
// step and return the characteristic time // step and return the characteristic time
virtual scalar solve(const scalar t0, const scalar deltaT) = 0; virtual scalar solve(const scalar t0, const scalar deltaT) = 0;

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -95,16 +95,4 @@ Foam::solidChemistryModel<CompType, SolidThermo>::RRs() const
} }
template<class CompType, class SolidThermo>
inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::solidChemistryModel<CompType, SolidThermo>::RR
(
const label i
) const
{
notImplemented("solidChemistryModel::RR(const label)");
return (DimensionedField<scalar, volMesh>::null());
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -52,9 +52,8 @@ namespace Foam
defineTemplateTypeNameAndDebugWithName \ defineTemplateTypeNameAndDebugWithName \
( \ ( \
SS##Schem##Comp##SThermo##GThermo, \ SS##Schem##Comp##SThermo##GThermo, \
(#SS"<" + word(Schem::typeName_()) \ (#SS"<"#Schem"<"#Comp"," + SThermo::typeName() + "," \
+ "<"#Comp"," + SThermo::typeName() \ + GThermo::typeName() + ">>").c_str(), \
+ "," + GThermo::typeName() + ">>").c_str(), \
0 \ 0 \
); \ ); \
\ \
@ -77,14 +76,6 @@ namespace Foam
GThermo \ GThermo \
); \ ); \
\ \
makeSolidChemistrySolverType \
( \
EulerImplicit, \
SolidChem, \
Comp, \
SThermo, \
GThermo \
); \
\ \
makeSolidChemistrySolverType \ makeSolidChemistrySolverType \
( \ ( \
@ -104,7 +95,6 @@ namespace Foam
GThermo \ GThermo \
); );
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam } // End namespace Foam

View File

@ -30,7 +30,7 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef makeSolidThermo_H #ifndef makeSolidThermo_H
#define makesolidThermo_H #define makeSolidThermo_H
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha1; object alpha.air;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha1; object alpha.mercury;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -10,7 +10,7 @@ FoamFile
version 2.0; version 2.0;
format ascii; format ascii;
class volScalarField; class volScalarField;
object alpha1; object alpha.oil;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,44 +0,0 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: dev |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
object alpha1;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 0 0 0 0 0];
internalField uniform 0;
boundaryField
{
rotor
{
type zeroGradient;
}
stator
{
type zeroGradient;
}
front
{
type empty;
}
back
{
type empty;
}
}
// ************************************************************************* //

View File

@ -11,7 +11,7 @@ FoamFile
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0"; location "0";
object alphaair; object alpha.air;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -11,7 +11,7 @@ FoamFile
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0"; location "0";
object alphamercury; object alpha.mercury;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -11,7 +11,7 @@ FoamFile
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0"; location "0";
object alphaoil; object alpha.oil;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -11,7 +11,7 @@ FoamFile
format ascii; format ascii;
class volScalarField; class volScalarField;
location "0"; location "0";
object alphawater; object alpha.water;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -32,12 +32,14 @@ FoamFile
front front
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 3072; nFaces 3072;
startFace 6336; startFace 6336;
} }
back back
{ {
type empty; type empty;
inGroups 1(empty);
nFaces 3072; nFaces 3072;
startFace 9408; startFace 9408;
} }

View File

@ -46,8 +46,6 @@ phases
} }
); );
refPhase air;
sigmas sigmas
( (
(air water) 0.07 (air water) 0.07

View File

@ -17,10 +17,10 @@ FoamFile
defaultFieldValues defaultFieldValues
( (
volScalarFieldValue alphaair 1 volScalarFieldValue alpha.air 1
volScalarFieldValue alphawater 0 volScalarFieldValue alpha.water 0
volScalarFieldValue alphaoil 0 volScalarFieldValue alpha.oil 0
volScalarFieldValue alphamercury 0 volScalarFieldValue alpha.mercury 0
); );
regions regions
@ -30,10 +30,10 @@ regions
box (0 0 -1) (1 1 1); box (0 0 -1) (1 1 1);
fieldValues fieldValues
( (
volScalarFieldValue alphawater 1 volScalarFieldValue alpha.water 1
volScalarFieldValue alphaoil 0 volScalarFieldValue alpha.oil 0
volScalarFieldValue alphamercury 0 volScalarFieldValue alpha.mercury 0
volScalarFieldValue alphaair 0 volScalarFieldValue alpha.air 0
); );
} }
boxToCell boxToCell
@ -41,10 +41,10 @@ regions
box (0 -1 -1) (1 0 1); box (0 -1 -1) (1 0 1);
fieldValues fieldValues
( (
volScalarFieldValue alphawater 0 volScalarFieldValue alpha.water 0
volScalarFieldValue alphaoil 1 volScalarFieldValue alpha.oil 1
volScalarFieldValue alphamercury 0 volScalarFieldValue alpha.mercury 0
volScalarFieldValue alphaair 0 volScalarFieldValue alpha.air 0
); );
} }
boxToCell boxToCell
@ -52,10 +52,10 @@ regions
box (-1 -1 -1) (0 0 1); box (-1 -1 -1) (0 0 1);
fieldValues fieldValues
( (
volScalarFieldValue alphawater 0 volScalarFieldValue alpha.water 0
volScalarFieldValue alphaoil 0 volScalarFieldValue alpha.oil 0
volScalarFieldValue alphamercury 1 volScalarFieldValue alpha.mercury 1
volScalarFieldValue alphaair 0 volScalarFieldValue alpha.air 0
); );
} }
); );