mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' into cvm
This commit is contained in:
@ -60,6 +60,7 @@ wmake $makeType randomProcesses
|
||||
thermophysicalModels/Allwmake $*
|
||||
transportModels/Allwmake $*
|
||||
turbulenceModels/Allwmake $*
|
||||
wmake $makeType combustionModels
|
||||
regionModels/Allwmake $*
|
||||
lagrangian/Allwmake $*
|
||||
postProcessing/Allwmake $*
|
||||
|
||||
@ -714,7 +714,7 @@ Foam::point Foam::indexedOctree<Type>::pushPoint
|
||||
)
|
||||
{
|
||||
// Get local length scale.
|
||||
const vector perturbVec = perturbTol_*(bb.span());
|
||||
const vector perturbVec = perturbTol_*bb.span();
|
||||
|
||||
point perturbedPt(pt);
|
||||
|
||||
|
||||
@ -525,7 +525,6 @@ void Foam::globalMeshData::calcGlobalPointSlaves() const
|
||||
|
||||
// Calculate connected points for master points.
|
||||
globalPoints globalData(mesh_, coupledPatch(), true, true);
|
||||
globalPointNumberingPtr_.reset(new globalIndex(globalData.globalIndices()));
|
||||
|
||||
globalPointSlavesPtr_.reset
|
||||
(
|
||||
@ -1564,6 +1563,42 @@ void Foam::globalMeshData::calcGlobalPointBoundaryCells() const
|
||||
}
|
||||
|
||||
|
||||
void Foam::globalMeshData::calcGlobalCoPointSlaves() const
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalCoPointSlaves() :"
|
||||
<< " calculating coupled master to collocated"
|
||||
<< " slave point addressing." << endl;
|
||||
}
|
||||
|
||||
// Calculate connected points for master points.
|
||||
globalPoints globalData(mesh_, coupledPatch(), true, false);
|
||||
|
||||
globalCoPointSlavesPtr_.reset
|
||||
(
|
||||
new labelListList
|
||||
(
|
||||
globalData.pointPoints().xfer()
|
||||
)
|
||||
);
|
||||
globalCoPointSlavesMapPtr_.reset
|
||||
(
|
||||
new mapDistribute
|
||||
(
|
||||
globalData.map().xfer()
|
||||
)
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "globalMeshData::calcGlobalCoPointSlaves() :"
|
||||
<< " finished calculating coupled master to collocated"
|
||||
<< " slave point addressing." << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from polyMesh
|
||||
@ -1639,6 +1674,10 @@ void Foam::globalMeshData::clearOut()
|
||||
globalPointBoundaryCellsPtr_.clear();
|
||||
globalPointTransformedBoundaryCellsPtr_.clear();
|
||||
globalPointBoundaryCellsMapPtr_.clear();
|
||||
|
||||
// Other: collocated points
|
||||
globalCoPointSlavesPtr_.clear();
|
||||
globalCoPointSlavesMapPtr_.clear();
|
||||
}
|
||||
|
||||
|
||||
@ -1971,7 +2010,10 @@ const Foam::globalIndex& Foam::globalMeshData::globalPointNumbering() const
|
||||
{
|
||||
if (!globalPointNumberingPtr_.valid())
|
||||
{
|
||||
calcGlobalPointSlaves();
|
||||
globalPointNumberingPtr_.reset
|
||||
(
|
||||
new globalIndex(coupledPatch().nPoints())
|
||||
);
|
||||
}
|
||||
return globalPointNumberingPtr_();
|
||||
}
|
||||
@ -2161,6 +2203,26 @@ const
|
||||
}
|
||||
|
||||
|
||||
const Foam::labelListList& Foam::globalMeshData::globalCoPointSlaves() const
|
||||
{
|
||||
if (!globalCoPointSlavesPtr_.valid())
|
||||
{
|
||||
calcGlobalCoPointSlaves();
|
||||
}
|
||||
return globalCoPointSlavesPtr_();
|
||||
}
|
||||
|
||||
|
||||
const Foam::mapDistribute& Foam::globalMeshData::globalCoPointSlavesMap() const
|
||||
{
|
||||
if (!globalCoPointSlavesMapPtr_.valid())
|
||||
{
|
||||
calcGlobalCoPointSlaves();
|
||||
}
|
||||
return globalCoPointSlavesMapPtr_();
|
||||
}
|
||||
|
||||
|
||||
Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
(
|
||||
labelList& pointToGlobal,
|
||||
@ -2168,33 +2230,70 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
) const
|
||||
{
|
||||
const indirectPrimitivePatch& cpp = coupledPatch();
|
||||
const labelListList& pointSlaves = globalPointSlaves();
|
||||
const mapDistribute& pointSlavesMap = globalPointSlavesMap();
|
||||
const globalIndex& globalCoupledPoints = globalPointNumbering();
|
||||
// Use collocated only
|
||||
const labelListList& pointSlaves = globalCoPointSlaves();
|
||||
const mapDistribute& pointSlavesMap = globalCoPointSlavesMap();
|
||||
|
||||
|
||||
// Points are either
|
||||
// - master with slaves
|
||||
// - slave with a master
|
||||
// - other (since e.g. non-collocated cyclics not connected)
|
||||
|
||||
labelList masterGlobalPoint(cpp.nPoints(), -1);
|
||||
forAll(masterGlobalPoint, pointI)
|
||||
{
|
||||
const labelList& slavePoints = pointSlaves[pointI];
|
||||
if (slavePoints.size() > 0)
|
||||
{
|
||||
masterGlobalPoint[pointI] = globalCoupledPoints.toGlobal(pointI);
|
||||
}
|
||||
}
|
||||
|
||||
// Sync by taking max
|
||||
syncData
|
||||
(
|
||||
masterGlobalPoint,
|
||||
pointSlaves,
|
||||
labelListList(cpp.nPoints()), // no transforms
|
||||
pointSlavesMap,
|
||||
maxEqOp<label>()
|
||||
);
|
||||
|
||||
|
||||
// 1. Count number of masters on my processor.
|
||||
label nCoupledMaster = 0;
|
||||
label nMaster = 0;
|
||||
PackedBoolList isMaster(mesh_.nPoints(), 1);
|
||||
forAll(pointSlaves, pointI)
|
||||
{
|
||||
const labelList& slavePoints = pointSlaves[pointI];
|
||||
|
||||
if (slavePoints.size() > 0)
|
||||
if (masterGlobalPoint[pointI] == -1)
|
||||
{
|
||||
nCoupledMaster++;
|
||||
// unconnected point (e.g. from separated cyclic)
|
||||
nMaster++;
|
||||
}
|
||||
else if
|
||||
(
|
||||
masterGlobalPoint[pointI]
|
||||
== globalCoupledPoints.toGlobal(pointI)
|
||||
)
|
||||
{
|
||||
// connected master
|
||||
nMaster++;
|
||||
}
|
||||
else
|
||||
{
|
||||
// connected slave point
|
||||
isMaster[cpp.meshPoints()[pointI]] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
label myUniquePoints = mesh_.nPoints() - cpp.nPoints() + nCoupledMaster;
|
||||
label myUniquePoints = mesh_.nPoints() - cpp.nPoints() + nMaster;
|
||||
|
||||
//Pout<< "Points :" << nl
|
||||
// << " mesh : " << mesh_.nPoints() << nl
|
||||
// << " of which coupled : " << cpp.nPoints() << nl
|
||||
// << " of which master : " << nCoupledMaster << nl
|
||||
// << " of which master : " << nMaster << nl
|
||||
// << endl;
|
||||
|
||||
|
||||
@ -2206,7 +2305,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
pointToGlobal.setSize(mesh_.nPoints());
|
||||
pointToGlobal = -1;
|
||||
uniquePoints.setSize(myUniquePoints);
|
||||
label nMaster = 0;
|
||||
nMaster = 0;
|
||||
|
||||
forAll(isMaster, meshPointI)
|
||||
{
|
||||
@ -2245,11 +2344,10 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
// On slave copy master index into overal map.
|
||||
forAll(pointSlaves, pointI)
|
||||
{
|
||||
const labelList& slaves = pointSlaves[pointI];
|
||||
label meshPointI = cpp.meshPoints()[pointI];
|
||||
|
||||
if (slaves.size() == 0)
|
||||
if (!isMaster[meshPointI])
|
||||
{
|
||||
label meshPointI = cpp.meshPoints()[pointI];
|
||||
pointToGlobal[meshPointI] = masterToGlobal[pointI];
|
||||
}
|
||||
}
|
||||
@ -2268,8 +2366,8 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
) const
|
||||
{
|
||||
const indirectPrimitivePatch& cpp = coupledPatch();
|
||||
const labelListList& pointSlaves = globalPointSlaves();
|
||||
const mapDistribute& pointSlavesMap = globalPointSlavesMap();
|
||||
const labelListList& pointSlaves = globalCoPointSlaves();
|
||||
const mapDistribute& pointSlavesMap = globalCoPointSlavesMap();
|
||||
|
||||
|
||||
// The patch points come in two variants:
|
||||
@ -2280,19 +2378,18 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
// coupled points to be the master but this master point is not
|
||||
// necessarily on the patch itself! (it might just be connected to the
|
||||
// patch point via coupled patches).
|
||||
// So this means that all master point loops should be over the
|
||||
// master-slave structure, not over the patch points and that the unique
|
||||
// point returned is a mesh point.
|
||||
// (unless we want to do the whole master-slave analysis again for the
|
||||
// current patch only).
|
||||
|
||||
|
||||
// Determine mapping from coupled point to patch point and vice versa
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Determine mapping:
|
||||
// - from patch point to coupled point (or -1)
|
||||
// - from coupled point to global patch point
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
globalIndex globalPPoints(meshPoints.size());
|
||||
|
||||
labelList patchToCoupled(meshPoints.size(), -1);
|
||||
label nCoupled = 0;
|
||||
labelList coupledToPatch(pointSlavesMap.constructSize(), -1);
|
||||
labelList coupledToGlobalPatch(pointSlavesMap.constructSize(), -1);
|
||||
|
||||
// Note: loop over patch since usually smaller
|
||||
forAll(meshPoints, patchPointI)
|
||||
@ -2304,7 +2401,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
if (iter != cpp.meshPointMap().end())
|
||||
{
|
||||
patchToCoupled[patchPointI] = iter();
|
||||
coupledToPatch[iter()] = patchPointI;
|
||||
coupledToGlobalPatch[iter()] = globalPPoints.toGlobal(patchPointI);
|
||||
nCoupled++;
|
||||
}
|
||||
}
|
||||
@ -2314,132 +2411,162 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
|
||||
// << " of which on coupled patch:" << nCoupled << endl;
|
||||
|
||||
|
||||
// Pull coupled-to-patch information to master
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
pointSlavesMap.distribute(coupledToPatch);
|
||||
|
||||
|
||||
// Check on master whether point is anywhere on patch
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// List of master points that are on the patch
|
||||
DynamicList<label> masterPoints(pointSlaves.size());
|
||||
// Determine master of connected points
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Problem is that the coupled master might not be on the patch. So
|
||||
// work out the best patch-point master from all connected points.
|
||||
// - if the coupled master is on the patch it becomes the patch-point master
|
||||
// - else the slave with the lowest numbered patch point label
|
||||
|
||||
// Get all data on master
|
||||
pointSlavesMap.distribute(coupledToGlobalPatch);
|
||||
forAll(pointSlaves, coupledPointI)
|
||||
{
|
||||
const labelList& slaves = pointSlaves[coupledPointI];
|
||||
|
||||
if (slaves.size() > 0)
|
||||
{
|
||||
// I am master. Is this point on the patch on myself or on any
|
||||
// any slave?
|
||||
if (coupledToPatch[coupledPointI] != -1)
|
||||
// I am master. What is the best candidate for patch-point master
|
||||
label masterI = labelMax;
|
||||
if (coupledToGlobalPatch[coupledPointI] != -1)
|
||||
{
|
||||
masterPoints.append(coupledPointI);
|
||||
// I am master and on the coupled patch. Use me.
|
||||
masterI = coupledToGlobalPatch[coupledPointI];
|
||||
}
|
||||
else
|
||||
{
|
||||
// Get min of slaves as master.
|
||||
forAll(slaves, i)
|
||||
{
|
||||
if (coupledToPatch[slaves[i]] != -1)
|
||||
label slavePp = coupledToGlobalPatch[slaves[i]];
|
||||
if (slavePp != -1 && slavePp < masterI)
|
||||
{
|
||||
masterPoints.append(coupledPointI);
|
||||
break;
|
||||
masterI = slavePp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (masterI != labelMax)
|
||||
{
|
||||
// Push back
|
||||
coupledToGlobalPatch[coupledPointI] = masterI;
|
||||
forAll(slaves, i)
|
||||
{
|
||||
coupledToGlobalPatch[slaves[i]] = masterI;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
pointSlavesMap.reverseDistribute(cpp.nPoints(), coupledToGlobalPatch);
|
||||
|
||||
|
||||
// Create global indexing
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
// 1. patch points that are not on coupled patch:
|
||||
// meshPoints.size()-nCoupled
|
||||
// 2. master points that are on patch:
|
||||
// masterPoints.size()
|
||||
label myUniquePoints = meshPoints.size()-nCoupled+masterPoints.size();
|
||||
autoPtr<globalIndex> globalPointsPtr(new globalIndex(myUniquePoints));
|
||||
// Generate compact numbering for master points
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
// Now coupledToGlobalPatch is the globalIndex of the master point.
|
||||
// Now every processor can check whether they hold it and generate a
|
||||
// compact numbering.
|
||||
|
||||
//Pout<< "CoupledPatch:" << nl
|
||||
// << " points:" << cpp.nPoints() << nl
|
||||
// << " of which on patch:" << masterPoints.size() << endl;
|
||||
|
||||
|
||||
// Allocate unique points
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
pointToGlobal.setSize(meshPoints.size());
|
||||
pointToGlobal = -1;
|
||||
uniqueMeshPoints.setSize(myUniquePoints);
|
||||
|
||||
// Allocate globals for uncoupled patch points
|
||||
label nMaster = 0;
|
||||
forAll(patchToCoupled, patchPointI)
|
||||
label nMasters = 0;
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
if (patchToCoupled[patchPointI] == -1)
|
||||
{
|
||||
// Allocate global point
|
||||
label globalI = globalPointsPtr().toGlobal(nMaster);
|
||||
pointToGlobal[patchPointI] = globalI;
|
||||
uniqueMeshPoints[nMaster] = meshPoints[patchPointI];
|
||||
nMaster++;
|
||||
nMasters++;
|
||||
}
|
||||
}
|
||||
|
||||
// Allocate globals for master
|
||||
labelList masterToGlobal(pointSlavesMap.constructSize(), -456);
|
||||
|
||||
forAll(masterPoints, i)
|
||||
{
|
||||
label coupledPointI = masterPoints[i];
|
||||
|
||||
// Allocate global point
|
||||
label globalI = globalPointsPtr().toGlobal(nMaster);
|
||||
if (coupledToPatch[coupledPointI] != -1)
|
||||
else
|
||||
{
|
||||
pointToGlobal[coupledToPatch[coupledPointI]] = globalI;
|
||||
}
|
||||
uniqueMeshPoints[nMaster] = cpp.meshPoints()[coupledPointI];
|
||||
nMaster++;
|
||||
|
||||
// Put global into slave slots
|
||||
const labelList& slaves = pointSlaves[coupledPointI];
|
||||
masterToGlobal[coupledPointI] = globalI; // not really necessary
|
||||
forAll(slaves, i)
|
||||
{
|
||||
masterToGlobal[slaves[i]] = globalI;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (nMaster != myUniquePoints)
|
||||
{
|
||||
FatalErrorIn("globalMeshData::mergePoints(..)")
|
||||
<< "problem." << abort(FatalError);
|
||||
}
|
||||
|
||||
|
||||
// Send back (from slave slots) to originating processor
|
||||
pointSlavesMap.reverseDistribute(cpp.nPoints(), masterToGlobal);
|
||||
|
||||
// On slaves take over global number
|
||||
forAll(patchToCoupled, patchPointI)
|
||||
{
|
||||
label coupledPointI = patchToCoupled[patchPointI];
|
||||
|
||||
if (coupledPointI != -1)
|
||||
{
|
||||
const labelList& slaves = pointSlaves[coupledPointI];
|
||||
|
||||
if (slaves.size() == 0)
|
||||
label coupledPointI = patchToCoupled[patchPointI];
|
||||
if
|
||||
(
|
||||
globalPPoints.toGlobal(patchPointI)
|
||||
== coupledToGlobalPatch[coupledPointI]
|
||||
)
|
||||
{
|
||||
pointToGlobal[patchPointI] = masterToGlobal[coupledPointI];
|
||||
// I am the master
|
||||
nMasters++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
autoPtr<globalIndex> globalPointsPtr(new globalIndex(nMasters));
|
||||
|
||||
//Pout<< "Patch:" << nl
|
||||
// << " points:" << meshPoints.size() << nl
|
||||
// << " of which on coupled patch:" << nCoupled << nl
|
||||
// << " of which master:" << nMasters << endl;
|
||||
|
||||
|
||||
|
||||
// Push back compact numbering for master point onto slaves
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
pointToGlobal.setSize(meshPoints.size());
|
||||
pointToGlobal = -1;
|
||||
uniqueMeshPoints.setSize(nMasters);
|
||||
|
||||
// Sync master in global point numbering so all know the master point.
|
||||
// Initialise globalMaster to be -1 except at a globalMaster.
|
||||
labelList globalMaster(cpp.nPoints(), -1);
|
||||
|
||||
nMasters = 0;
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
if (patchToCoupled[patchPointI] == -1)
|
||||
{
|
||||
uniqueMeshPoints[nMasters++] = meshPoints[patchPointI];
|
||||
}
|
||||
else
|
||||
{
|
||||
label coupledPointI = patchToCoupled[patchPointI];
|
||||
if
|
||||
(
|
||||
globalPPoints.toGlobal(patchPointI)
|
||||
== coupledToGlobalPatch[coupledPointI]
|
||||
)
|
||||
{
|
||||
globalMaster[coupledPointI] =
|
||||
globalPointsPtr().toGlobal(nMasters);
|
||||
uniqueMeshPoints[nMasters++] = meshPoints[patchPointI];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Sync by taking max
|
||||
syncData
|
||||
(
|
||||
globalMaster,
|
||||
pointSlaves,
|
||||
labelListList(cpp.nPoints()), // no transforms
|
||||
pointSlavesMap,
|
||||
maxEqOp<label>()
|
||||
);
|
||||
|
||||
|
||||
// Now everyone has the master point in globalPointsPtr numbering. Fill
|
||||
// in the pointToGlobal map.
|
||||
nMasters = 0;
|
||||
forAll(meshPoints, patchPointI)
|
||||
{
|
||||
if (patchToCoupled[patchPointI] == -1)
|
||||
{
|
||||
pointToGlobal[patchPointI] = globalPointsPtr().toGlobal(nMasters++);
|
||||
}
|
||||
else
|
||||
{
|
||||
label coupledPointI = patchToCoupled[patchPointI];
|
||||
pointToGlobal[patchPointI] = globalMaster[coupledPointI];
|
||||
|
||||
if
|
||||
(
|
||||
globalPPoints.toGlobal(patchPointI)
|
||||
== coupledToGlobalPatch[coupledPointI]
|
||||
)
|
||||
{
|
||||
nMasters++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return globalPointsPtr;
|
||||
}
|
||||
|
||||
@ -202,7 +202,7 @@ class globalMeshData
|
||||
globalPointTransformedBoundaryFacesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryFacesMapPtr_;
|
||||
|
||||
// Coupled point to collocated boundary cells
|
||||
// Coupled point to boundary cells
|
||||
|
||||
mutable autoPtr<labelList> boundaryCellsPtr_;
|
||||
mutable autoPtr<globalIndex> globalBoundaryCellNumberingPtr_;
|
||||
@ -212,6 +212,12 @@ class globalMeshData
|
||||
mutable autoPtr<mapDistribute> globalPointBoundaryCellsMapPtr_;
|
||||
|
||||
|
||||
// Other: coupled point to coupled COLLOCATED points
|
||||
mutable autoPtr<labelListList> globalCoPointSlavesPtr_;
|
||||
mutable autoPtr<mapDistribute> globalCoPointSlavesMapPtr_;
|
||||
|
||||
|
||||
|
||||
// Globally shared point addressing
|
||||
|
||||
//- Total number of global points
|
||||
@ -303,6 +309,18 @@ class globalMeshData
|
||||
//- Calculate global point to global boundary cell addressing.
|
||||
void calcGlobalPointBoundaryCells() const;
|
||||
|
||||
// Other
|
||||
|
||||
// Point to collocated points. Note that not all points on
|
||||
// coupled patches now have a master! (since points on either
|
||||
// side of a cyclic are not connected). So check whether the map
|
||||
// reaches all points and decide who is master, slave and who is
|
||||
// its own master. Maybe store as well?
|
||||
|
||||
void calcGlobalCoPointSlaves() const;
|
||||
const labelListList& globalCoPointSlaves() const;
|
||||
const mapDistribute& globalCoPointSlavesMap() const;
|
||||
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
globalMeshData(const globalMeshData&);
|
||||
@ -547,7 +565,7 @@ public:
|
||||
|
||||
// Other
|
||||
|
||||
//- Helper for merging mesh point data.
|
||||
//- Helper for merging (collocated!) mesh point data.
|
||||
// Determines:
|
||||
// - my unique indices
|
||||
// - global numbering over all unique indices
|
||||
@ -559,11 +577,11 @@ public:
|
||||
labelList& uniquePoints
|
||||
) const;
|
||||
|
||||
//- Helper for merging patch point data.
|
||||
//- Helper for merging (collocated!) patch point data.
|
||||
// Takes maps from:
|
||||
// local points to/from mesh. Determines
|
||||
// - my unique points. These are mesh points, not patch points
|
||||
// since the master might not be on the patch.
|
||||
// - my unique points. These are mesh point indices, not patch
|
||||
// point indices.
|
||||
// - global numbering over all unique indices.
|
||||
// - the global number for all local points.
|
||||
autoPtr<globalIndex> mergePoints
|
||||
|
||||
@ -533,7 +533,7 @@ void Foam::globalPoints::sendPatchPoints
|
||||
// Send to neighbour
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " Sending to "
|
||||
Pout<< " Sending from " << pp.name() << " to "
|
||||
<< procPatch.neighbProcNo() << " point information:"
|
||||
<< patchFaces.size() << endl;
|
||||
}
|
||||
@ -589,7 +589,8 @@ void Foam::globalPoints::receivePatchPoints
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " Received from "
|
||||
Pout<< " On " << pp.name()
|
||||
<< " Received from "
|
||||
<< procPatch.neighbProcNo() << " point information:"
|
||||
<< patchFaces.size() << endl;
|
||||
}
|
||||
|
||||
9
src/combustionModels/Make/files
Normal file
9
src/combustionModels/Make/files
Normal file
@ -0,0 +1,9 @@
|
||||
combustionModel/combustionModel.C
|
||||
combustionModel/combustionModelNew.C
|
||||
|
||||
infinitelyFastChemistry/infinitelyFastChemistry.C
|
||||
|
||||
noCombustion/noCombustion.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libcombustionModels
|
||||
|
||||
9
src/combustionModels/Make/options
Normal file
9
src/combustionModels/Make/options
Normal file
@ -0,0 +1,9 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude
|
||||
|
||||
LIB_LIBS = \
|
||||
-lfiniteVolume
|
||||
153
src/combustionModels/combustionModel/combustionModel.C
Normal file
153
src/combustionModels/combustionModel/combustionModel.C
Normal file
@ -0,0 +1,153 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "combustionModel.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "fvScalarMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(combustionModel, 0);
|
||||
defineRunTimeSelectionTable(combustionModel, dictionary);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModel::combustionModel
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
coeffs_(dictionary::null),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
mesh_(phi.mesh()),
|
||||
phi_(phi),
|
||||
rho_(rho)
|
||||
{}
|
||||
|
||||
|
||||
Foam::combustionModel::combustionModel
|
||||
(
|
||||
const word& modelType,
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
coeffs_(combustionProps.subDict(modelType + "Coeffs")),
|
||||
thermo_(thermo),
|
||||
turbulence_(turbulence),
|
||||
mesh_(phi.mesh()),
|
||||
phi_(phi),
|
||||
rho_(rho)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModel::~combustionModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::combustionModel::correct()
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::fvScalarMatrix> Foam::combustionModel::R
|
||||
(
|
||||
volScalarField& Y
|
||||
) const
|
||||
{
|
||||
return tmp<fvScalarMatrix>
|
||||
(
|
||||
new fvScalarMatrix(Y, dimMass/dimTime*Y.dimensions())
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::combustionModel::dQ() const
|
||||
{
|
||||
return tmp<Foam::volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"dQ",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::combustionModel::wFuelNorm() const
|
||||
{
|
||||
return tmp<Foam::volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wFuelNorm",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimMass/dimTime/pow3(dimLength), 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
bool Foam::combustionModel::read(const dictionary& combustionProps)
|
||||
{
|
||||
coeffs_ = combustionProps.subDict(type() + "Coeffs");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
201
src/combustionModels/combustionModel/combustionModel.H
Normal file
201
src/combustionModels/combustionModel/combustionModel.H
Normal file
@ -0,0 +1,201 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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::combustionModel
|
||||
|
||||
Description
|
||||
Base class for all non-premixed combustion models based on single step
|
||||
chemistry
|
||||
|
||||
SourceFiles
|
||||
combustionModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef combustionModel_H
|
||||
#define combustionModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "hsCombustionThermo.H"
|
||||
#include "turbulenceModel.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class combustionModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class combustionModel
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Dictionary of coefficients for the particular model
|
||||
dictionary coeffs_;
|
||||
|
||||
//- Reference to the thermodynamics
|
||||
hsCombustionThermo& thermo_;
|
||||
|
||||
//- Reference to the turbulence model
|
||||
const compressible::turbulenceModel& turbulence_;
|
||||
|
||||
//- Reference to the mesh database
|
||||
const fvMesh& mesh_;
|
||||
|
||||
//- Reference to mass-flux field
|
||||
const surfaceScalarField& phi_;
|
||||
|
||||
//- Reference to the density field
|
||||
const volScalarField& rho_;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
combustionModel(const combustionModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const combustionModel&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("combustionModel");
|
||||
|
||||
|
||||
// Declare run-time constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
combustionModel,
|
||||
dictionary,
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
),
|
||||
(
|
||||
combustionProperties,
|
||||
thermo,
|
||||
turbulence,
|
||||
phi,
|
||||
rho
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected combustion model
|
||||
static autoPtr<combustionModel> New
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from components
|
||||
combustionModel
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
combustionModel
|
||||
(
|
||||
const word& modelType,
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~combustionModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access functions
|
||||
|
||||
//- Access combustion dictionary
|
||||
const dictionary coeffs() const
|
||||
{
|
||||
return coeffs_;
|
||||
}
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Correct combustion rate
|
||||
virtual void correct();
|
||||
|
||||
//- Fuel consumption rate matrix, i.e. source term for fuel equation
|
||||
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
|
||||
|
||||
//- Heat release rate calculated from fuel consumption rate matrix
|
||||
virtual tmp<volScalarField> dQ() const;
|
||||
|
||||
//- Return normalised consumption rate of (fu - fres)
|
||||
virtual tmp<Foam::volScalarField> wFuelNorm() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& combustionProps);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
65
src/combustionModels/combustionModel/combustionModelNew.C
Normal file
65
src/combustionModels/combustionModel/combustionModelNew.C
Normal file
@ -0,0 +1,65 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "combustionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::autoPtr<Foam::combustionModel> Foam::combustionModel::New
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
{
|
||||
word combustionModelTypeName = combustionProperties.lookup
|
||||
(
|
||||
"combustionModel"
|
||||
);
|
||||
|
||||
Info<< "Selecting combustion model " << combustionModelTypeName << endl;
|
||||
|
||||
dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(combustionModelTypeName);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"combustionModel::New"
|
||||
) << "Unknown combustionModel type "
|
||||
<< combustionModelTypeName << endl << endl
|
||||
<< "Valid combustionModels are : " << endl
|
||||
<< dictionaryConstructorTablePtr_->toc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<combustionModel>
|
||||
(cstrIter()(combustionProperties, thermo, turbulence, phi, rho));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,153 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "infinitelyFastChemistry.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvmSup.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
defineTypeNameAndDebug(infinitelyFastChemistry, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
combustionModel,
|
||||
infinitelyFastChemistry,
|
||||
dictionary
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::infinitelyFastChemistry::infinitelyFastChemistry
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
combustionModel(typeName, combustionProps, thermo, turbulence, phi, rho),
|
||||
C_(readScalar(coeffs_.lookup("C"))),
|
||||
singleMixture_
|
||||
(
|
||||
dynamic_cast<singleStepReactingMixture<gasThermoPhysics>&>(thermo)
|
||||
),
|
||||
wFuelNorm_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"wFuelNorm",
|
||||
mesh_.time().timeName(),
|
||||
mesh_,
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
mesh_,
|
||||
dimensionedScalar("zero", dimMass/pow3(dimLength)/dimTime, 0.0)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::infinitelyFastChemistry::~infinitelyFastChemistry()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::combustionModels::infinitelyFastChemistry::correct()
|
||||
{
|
||||
singleMixture_.fresCorrect();
|
||||
|
||||
const label fuelI = singleMixture_.fuelIndex();
|
||||
|
||||
const volScalarField& YFuel = thermo_.composition().Y()[fuelI];
|
||||
|
||||
const dimensionedScalar s = singleMixture_.s();
|
||||
|
||||
if (thermo_.composition().contains("O2"))
|
||||
{
|
||||
const volScalarField& YO2 = thermo_.composition().Y("O2");
|
||||
wFuelNorm_ == rho_/(mesh_.time().deltaT()*C_)*min(YFuel, YO2/s.value());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::fvScalarMatrix>
|
||||
Foam::combustionModels::infinitelyFastChemistry::R(volScalarField& Y) const
|
||||
{
|
||||
const label specieI = thermo_.composition().species()[Y.name()];
|
||||
|
||||
const label fNorm = singleMixture_.specieProd()[specieI];
|
||||
|
||||
const volScalarField fres(singleMixture_.fres(specieI));
|
||||
|
||||
const volScalarField wSpecie
|
||||
(
|
||||
wFuelNorm_*singleMixture_.specieStoichCoeffs()[specieI]
|
||||
/ max(fNorm*(Y - fres), scalar(0.001))
|
||||
);
|
||||
|
||||
return -fNorm*wSpecie*fres + fNorm*fvm::Sp(wSpecie, Y);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::combustionModels::infinitelyFastChemistry::dQ() const
|
||||
{
|
||||
const label fuelI = singleMixture_.fuelIndex();
|
||||
volScalarField& YFuel = thermo_.composition().Y(fuelI);
|
||||
|
||||
return -singleMixture_.qFuel()*(R(YFuel) & YFuel);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::combustionModels::infinitelyFastChemistry::wFuelNorm() const
|
||||
{
|
||||
return wFuelNorm_;
|
||||
}
|
||||
|
||||
|
||||
bool Foam::combustionModels::infinitelyFastChemistry::read
|
||||
(
|
||||
const dictionary& combustionProps
|
||||
)
|
||||
{
|
||||
combustionModel::read(combustionProps);
|
||||
coeffs_.lookup("C") >> C_ ;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,135 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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::combustionModels::infinitelyFastChemistry
|
||||
|
||||
Description
|
||||
Simple infinitely fast chemistry combustion model based on the principle
|
||||
mixed is burnt. Additional parameter C is used to distribute the heat
|
||||
release rate.in time
|
||||
|
||||
SourceFiles
|
||||
infinitelyFastChemistry.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef infinitelyFastChemistry_H
|
||||
#define infinitelyFastChemistry_H
|
||||
|
||||
#include "combustionModel.H"
|
||||
#include "singleStepReactingMixture.H"
|
||||
#include "thermoPhysicsTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class infinitelyFastChemistry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class infinitelyFastChemistry
|
||||
:
|
||||
public combustionModel
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Model constant
|
||||
scalar C_;
|
||||
|
||||
//- Reference to singleStepReactingMixture mixture
|
||||
singleStepReactingMixture<gasThermoPhysics>& singleMixture_;
|
||||
|
||||
//- Normalised consumption rate of (fu - fres)
|
||||
volScalarField wFuelNorm_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
infinitelyFastChemistry(const infinitelyFastChemistry&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const infinitelyFastChemistry&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("infinitelyFastChemistry");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
infinitelyFastChemistry
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~infinitelyFastChemistry();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Correct combustion rate
|
||||
virtual void correct();
|
||||
|
||||
//- Fuel consumption rate matrix, i.e. source term for fuel equation
|
||||
virtual tmp<fvScalarMatrix> R(volScalarField& Y) const;
|
||||
|
||||
//- Heat release rate calculated from fuel consumption rate matrix
|
||||
virtual tmp<volScalarField> dQ() const;
|
||||
|
||||
//- Return normalised consumption rate of (fu - fres)
|
||||
virtual tmp<volScalarField> wFuelNorm() const;
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Update properties from given dictionary
|
||||
virtual bool read(const dictionary& combustionProperties);
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace combustionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
66
src/combustionModels/noCombustion/noCombustion.C
Normal file
66
src/combustionModels/noCombustion/noCombustion.C
Normal file
@ -0,0 +1,66 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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 "noCombustion.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
defineTypeNameAndDebug(noCombustion, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
combustionModel,
|
||||
noCombustion,
|
||||
dictionary
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::noCombustion::noCombustion
|
||||
(
|
||||
const dictionary& combustionProps,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
)
|
||||
:
|
||||
combustionModel(combustionProps, thermo, turbulence, phi, rho)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructors * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::combustionModels::noCombustion::~noCombustion()
|
||||
{}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
96
src/combustionModels/noCombustion/noCombustion.H
Normal file
96
src/combustionModels/noCombustion/noCombustion.H
Normal file
@ -0,0 +1,96 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
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::combustionModel::noCombustion
|
||||
|
||||
Description
|
||||
Dummy combustion model for 'none' option
|
||||
|
||||
SourceFiles
|
||||
noCombustion.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noCombustion_H
|
||||
#define noCombustion_H
|
||||
|
||||
#include "combustionModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace combustionModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noCombustion Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noCombustion
|
||||
:
|
||||
public combustionModel
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow copy construct
|
||||
noCombustion(const noCombustion&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const noCombustion&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("none");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
noCombustion
|
||||
(
|
||||
const dictionary& combustionProperties,
|
||||
hsCombustionThermo& thermo,
|
||||
const compressible::turbulenceModel& turbulence,
|
||||
const surfaceScalarField& phi,
|
||||
const volScalarField& rho
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~noCombustion();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace combustionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -120,6 +120,7 @@ $(derivedFvPatchFields)/directMappedFixedInternalValue/directMappedFixedInternal
|
||||
$(derivedFvPatchFields)/directMappedFixedPushedInternalValue/directMappedFixedPushedInternalValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
|
||||
$(derivedFvPatchFields)/directMappedFlowRate/directMappedFlowRateFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
|
||||
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
|
||||
|
||||
@ -0,0 +1,208 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "directMappedFlowRateFvPatchVectorField.H"
|
||||
#include "volFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvPatchFieldMapper.H"
|
||||
#include "directMappedPatchBase.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directMappedFlowRateFvPatchVectorField::
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(p, iF),
|
||||
nbrPhiName_("none"),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho")
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedFlowRateFvPatchVectorField::
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const directMappedFlowRateFvPatchVectorField& 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::directMappedFlowRateFvPatchVectorField::
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
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::directMappedFlowRateFvPatchVectorField::
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const directMappedFlowRateFvPatchVectorField& ptf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf),
|
||||
nbrPhiName_(ptf.nbrPhiName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedFlowRateFvPatchVectorField::
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const directMappedFlowRateFvPatchVectorField& ptf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchField<vector>(ptf, iF),
|
||||
nbrPhiName_(ptf.nbrPhiName_),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::directMappedFlowRateFvPatchVectorField::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()];
|
||||
|
||||
scalarList phi =
|
||||
nbrPatch.lookupPatchField<surfaceScalarField, scalar>(nbrPhiName_);
|
||||
|
||||
mpp.map().distribute(phi);
|
||||
|
||||
|
||||
const surfaceScalarField& phiName =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
scalarField U(-phi/patch().magSf());
|
||||
|
||||
vectorField n(patch().nf());
|
||||
|
||||
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
|
||||
(
|
||||
"directMappedFlowRateFvPatchVectorField::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::directMappedFlowRateFvPatchVectorField::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,
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,176 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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::directMappedFlowRateFvPatchVectorField
|
||||
|
||||
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 directMappedFlowRate;
|
||||
phi phi;
|
||||
rho rho;
|
||||
neigPhi neigPhiName_; // Volumetric/mass flow rate
|
||||
// [m3/s or kg/s]
|
||||
value uniform (0 0 0); // placeholder
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
SourceFiles
|
||||
directMappedFlowRateFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directMappedFlowRateFvPatchVectorField_H
|
||||
#define directMappedFlowRateFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class flowRateInletVelocityFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class directMappedFlowRateFvPatchVectorField
|
||||
:
|
||||
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("directMappedFlowRate");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// directMappedFlowRateFvPatchVectorField
|
||||
// onto a new patch
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const directMappedFlowRateFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const directMappedFlowRateFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new directMappedFlowRateFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
directMappedFlowRateFvPatchVectorField
|
||||
(
|
||||
const directMappedFlowRateFvPatchVectorField&,
|
||||
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 directMappedFlowRateFvPatchVectorField(*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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
@ -54,6 +54,7 @@ Foam::fvm::Su
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> >
|
||||
Foam::fvm::Su
|
||||
@ -67,6 +68,7 @@ Foam::fvm::Su
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> >
|
||||
Foam::fvm::Su
|
||||
@ -80,6 +82,7 @@ Foam::fvm::Su
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::zeroField
|
||||
Foam::fvm::Su
|
||||
@ -117,6 +120,7 @@ Foam::fvm::Sp
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> >
|
||||
Foam::fvm::Sp
|
||||
@ -130,6 +134,7 @@ Foam::fvm::Sp
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> >
|
||||
Foam::fvm::Sp
|
||||
@ -169,6 +174,7 @@ Foam::fvm::Sp
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::zeroField
|
||||
Foam::fvm::Sp
|
||||
@ -209,6 +215,7 @@ Foam::fvm::SuSp
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> >
|
||||
Foam::fvm::SuSp
|
||||
@ -222,6 +229,7 @@ Foam::fvm::SuSp
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::fvMatrix<Type> >
|
||||
Foam::fvm::SuSp
|
||||
@ -235,6 +243,7 @@ Foam::fvm::SuSp
|
||||
return tfvm;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Foam::zeroField
|
||||
Foam::fvm::SuSp
|
||||
|
||||
@ -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
|
||||
@ -219,7 +219,7 @@ Foam::lduMatrix::solverPerformance Foam::fvMatrix<Type>::solve()
|
||||
template<class Type>
|
||||
Foam::tmp<Foam::Field<Type> > Foam::fvMatrix<Type>::residual() const
|
||||
{
|
||||
tmp<Field<Type> > tres(source_);
|
||||
tmp<Field<Type> > tres(new Field<Type>(source_));
|
||||
Field<Type>& res = tres();
|
||||
|
||||
addBoundarySource(res);
|
||||
|
||||
@ -44,13 +44,10 @@ void Foam::cyclicFvPatch::makeWeights(scalarField& w) const
|
||||
{
|
||||
const cyclicFvPatch& nbrPatch = neighbFvPatch();
|
||||
|
||||
const scalarField& magFa = magSf();
|
||||
const scalarField& nbrMagFa = nbrPatch.magSf();
|
||||
|
||||
const scalarField deltas(nf() & fvPatch::delta());
|
||||
const scalarField nbrDeltas(nbrPatch.nf() & nbrPatch.fvPatch::delta());
|
||||
|
||||
forAll(magFa, facei)
|
||||
forAll(deltas, facei)
|
||||
{
|
||||
scalar di = deltas[facei];
|
||||
scalar dni = nbrDeltas[facei];
|
||||
|
||||
@ -130,7 +130,6 @@ Foam::ThermoCloud<CloudType>::ThermoCloud
|
||||
dimensionedScalar("zero", dimEnergy/dimTemperature, 0.0)
|
||||
)
|
||||
)
|
||||
|
||||
{
|
||||
if (this->solution().active())
|
||||
{
|
||||
|
||||
@ -167,7 +167,7 @@ public:
|
||||
// Private data
|
||||
|
||||
//- Local copy of carrier specific heat field
|
||||
// Cp not stored on acrrier thermo, but returned as tmp<...>
|
||||
// Cp not stored on carrier thermo, but returned as tmp<...>
|
||||
const volScalarField Cp_;
|
||||
|
||||
|
||||
|
||||
@ -52,7 +52,49 @@ void Foam::FacePostProcessing<CloudType>::applyToFace
|
||||
faceI = j;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::FacePostProcessing<CloudType>::makeLogFile
|
||||
(
|
||||
const word& zoneName,
|
||||
const label zoneI,
|
||||
const label nFaces,
|
||||
const scalar totArea
|
||||
)
|
||||
{
|
||||
// Create the output file if not already created
|
||||
if (log_)
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "Creating output file." << endl;
|
||||
}
|
||||
|
||||
if (Pstream::master())
|
||||
{
|
||||
const fileName logDir = outputDir_/this->owner().time().timeName();
|
||||
|
||||
// Create directory if does not exist
|
||||
mkDir(logDir);
|
||||
|
||||
// Open new file at start up
|
||||
outputFilePtr_.set
|
||||
(
|
||||
zoneI,
|
||||
new OFstream(logDir/(type() + '_' + zoneName + ".dat"))
|
||||
);
|
||||
|
||||
outputFilePtr_[zoneI]
|
||||
<< "# Source : " << type() << nl
|
||||
<< "# Face zone : " << zoneName << nl
|
||||
<< "# Faces : " << nFaces << nl
|
||||
<< "# Area : " << totArea << nl
|
||||
<< "# Time" << tab << "mass" << tab << "massFlux" << endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,8 +103,9 @@ template<class CloudType>
|
||||
void Foam::FacePostProcessing<CloudType>::write()
|
||||
{
|
||||
const fvMesh& mesh = this->owner().mesh();
|
||||
const faceZoneMesh& fzm = this->owner().mesh().faceZones();
|
||||
const scalar dt = this->owner().time().deltaTValue();
|
||||
const Time& time = mesh.time();
|
||||
const faceZoneMesh& fzm = mesh.faceZones();
|
||||
const scalar dt = time.deltaTValue();
|
||||
|
||||
totalTime_ += dt;
|
||||
|
||||
@ -80,8 +123,11 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
Info<< "particleFaceFlux output:" << nl;
|
||||
|
||||
List<scalarField> zoneMassTotal(mass_.size());
|
||||
forAll(zoneMassTotal, zoneI)
|
||||
List<scalarField> zoneMassFlux(massFlux_.size());
|
||||
forAll(faceZoneIDs_, zoneI)
|
||||
{
|
||||
const word& zoneName = fzm[faceZoneIDs_[zoneI]].name();
|
||||
|
||||
scalarListList allProcMass(Pstream::nProcs());
|
||||
allProcMass[procI] = massTotal_[zoneI];
|
||||
Pstream::gatherList(allProcMass);
|
||||
@ -90,15 +136,8 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
(
|
||||
allProcMass, accessOp<scalarList>()
|
||||
);
|
||||
const scalar sumMassTotal = sum(zoneMassTotal[zoneI]);
|
||||
|
||||
const word& zoneName = fzm[faceZoneIDs_[zoneI]].name();
|
||||
Info<< " " << zoneName << " total mass = "
|
||||
<< sum(zoneMassTotal[zoneI]) << nl;
|
||||
}
|
||||
|
||||
List<scalarField> zoneMassFlux(massFlux_.size());
|
||||
forAll(zoneMassFlux, zoneI)
|
||||
{
|
||||
scalarListList allProcMassFlux(Pstream::nProcs());
|
||||
allProcMassFlux[procI] = massFlux_[zoneI];
|
||||
Pstream::gatherList(allProcMassFlux);
|
||||
@ -107,10 +146,19 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
(
|
||||
allProcMassFlux, accessOp<scalarList>()
|
||||
);
|
||||
const scalar sumMassFlux = sum(zoneMassFlux[zoneI]);
|
||||
|
||||
const word& zoneName = fzm[faceZoneIDs_[zoneI]].name();
|
||||
Info<< " " << zoneName << " average mass flux = "
|
||||
<< sum(zoneMassFlux[zoneI]) << nl;
|
||||
Info<< " " << zoneName
|
||||
<< ": total mass = " << sumMassTotal
|
||||
<< "; average mass flux = " << sumMassFlux
|
||||
<< nl;
|
||||
|
||||
if (outputFilePtr_.set(zoneI))
|
||||
{
|
||||
OFstream& os = outputFilePtr_[zoneI];
|
||||
os << time.timeName() << token::TAB << sumMassTotal << token::TAB
|
||||
<< sumMassFlux<< endl;
|
||||
}
|
||||
}
|
||||
|
||||
Info<< endl;
|
||||
@ -118,23 +166,6 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
|
||||
if (surfaceFormat_ != "none")
|
||||
{
|
||||
fileName outputDir = mesh.time().path();
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir =
|
||||
outputDir/".."/"postProcessing"/cloud::prefix/
|
||||
this->owner().name()/mesh.time().timeName();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir =
|
||||
outputDir/"postProcessing"/cloud::prefix/
|
||||
this->owner().name()/mesh.time().timeName();
|
||||
}
|
||||
|
||||
forAll(faceZoneIDs_, zoneI)
|
||||
{
|
||||
const faceZone& fZone = fzm[faceZoneIDs_[zoneI]];
|
||||
@ -189,7 +220,7 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
|
||||
writer->write
|
||||
(
|
||||
outputDir,
|
||||
outputDir_/time.timeName(),
|
||||
fZone.name(),
|
||||
allPoints,
|
||||
allFaces,
|
||||
@ -200,7 +231,7 @@ void Foam::FacePostProcessing<CloudType>::write()
|
||||
|
||||
writer->write
|
||||
(
|
||||
outputDir,
|
||||
outputDir_/time.timeName(),
|
||||
fZone.name(),
|
||||
allPoints,
|
||||
allFaces,
|
||||
@ -247,15 +278,34 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
||||
totalTime_(0.0),
|
||||
mass_(),
|
||||
massTotal_(),
|
||||
massFlux_()
|
||||
massFlux_(),
|
||||
log_(this->coeffDict().lookup("log")),
|
||||
outputFilePtr_(),
|
||||
outputDir_(owner.mesh().time().path())
|
||||
{
|
||||
wordList faceZoneNames(this->coeffDict().lookup("faceZones"));
|
||||
mass_.setSize(faceZoneNames.size());
|
||||
massTotal_.setSize(faceZoneNames.size());
|
||||
massFlux_.setSize(faceZoneNames.size());
|
||||
|
||||
outputFilePtr_.setSize(faceZoneNames.size());
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
// Put in undecomposed case (Note: gives problems for
|
||||
// distributed data running)
|
||||
outputDir_ =
|
||||
outputDir_/".."/"postProcessing"/cloud::prefix/owner.name();
|
||||
}
|
||||
else
|
||||
{
|
||||
outputDir_ =
|
||||
outputDir_/"postProcessing"/cloud::prefix/owner.name();
|
||||
}
|
||||
|
||||
DynamicList<label> zoneIDs;
|
||||
const faceZoneMesh& fzm = owner.mesh().faceZones();
|
||||
const surfaceScalarField& magSf = owner.mesh().magSf();
|
||||
forAll(faceZoneNames, i)
|
||||
{
|
||||
const word& zoneName = faceZoneNames[i];
|
||||
@ -268,7 +318,16 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
||||
mass_[i].setSize(nFaces, 0.0);
|
||||
massTotal_[i].setSize(nFaces, 0.0);
|
||||
massFlux_[i].setSize(nFaces, 0.0);
|
||||
Info<< " " << zoneName << " faces: " << nFaces;
|
||||
Info<< " " << zoneName << " faces: " << nFaces << nl;
|
||||
|
||||
scalar totArea = 0.0;
|
||||
forAll(fz, j)
|
||||
{
|
||||
totArea += magSf[fz[j]];
|
||||
}
|
||||
totArea = returnReduce(totArea, sumOp<scalar>());
|
||||
|
||||
makeLogFile(zoneName, i, nFaces, totArea);
|
||||
}
|
||||
}
|
||||
|
||||
@ -291,7 +350,10 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
||||
totalTime_(pff.totalTime_),
|
||||
mass_(pff.mass_),
|
||||
massTotal_(pff.massTotal_),
|
||||
massFlux_(pff.massFlux_)
|
||||
massFlux_(pff.massFlux_),
|
||||
log_(pff.log_),
|
||||
outputFilePtr_(),
|
||||
outputDir_(pff.outputDir_)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -85,9 +85,27 @@ class FacePostProcessing
|
||||
//- Mass flux storage
|
||||
List<scalarField> massFlux_;
|
||||
|
||||
//- Flag to indicate whether data should be written to file
|
||||
Switch log_;
|
||||
|
||||
//- Output file pointer per zone
|
||||
PtrList<OFstream> outputFilePtr_;
|
||||
|
||||
//- Output directory
|
||||
fileName outputDir_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Helper function to create log files
|
||||
void makeLogFile
|
||||
(
|
||||
const word& zoneName,
|
||||
const label zoneI,
|
||||
const label nFaces,
|
||||
const scalar totArea
|
||||
);
|
||||
|
||||
//- Return index into storage lists if valid zone and face
|
||||
void applyToFace
|
||||
(
|
||||
|
||||
@ -30,6 +30,82 @@ License
|
||||
|
||||
using namespace Foam::constant;
|
||||
|
||||
// * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ConeNozzleInjection<CloudType>::setInjectionMethod()
|
||||
{
|
||||
word injectionMethodType = this->coeffDict().lookup("injectionMethod");
|
||||
if (injectionMethodType == "disc")
|
||||
{
|
||||
injectionMethod_ = imDisc;
|
||||
}
|
||||
else if (injectionMethodType == "point")
|
||||
{
|
||||
injectionMethod_ = imPoint;
|
||||
|
||||
// Set/cache the injector cell
|
||||
this->findCellAtPosition
|
||||
(
|
||||
injectorCell_,
|
||||
tetFaceI_,
|
||||
tetPtI_,
|
||||
position_,
|
||||
false
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::InjectionModel<CloudType>::setInjectionMethod()")
|
||||
<< "injectionMethod must be either 'point' or 'disc'"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::ConeNozzleInjection<CloudType>::setFlowType()
|
||||
{
|
||||
word flowType = this->coeffDict().lookup("flowType");
|
||||
if (flowType == "constantVelocity")
|
||||
{
|
||||
this->coeffDict().lookup("UMag") >> UMag_;
|
||||
flowType_ = ftConstantVelocity;
|
||||
}
|
||||
else if (flowType == "pressureDrivenVelocity")
|
||||
{
|
||||
Pinj_.reset
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"Pinj",
|
||||
this->coeffDict()
|
||||
).ptr()
|
||||
);
|
||||
flowType_ = ftPressureDrivenVelocity;
|
||||
}
|
||||
else if (flowType == "flowRateAndDischarge")
|
||||
{
|
||||
Cd_.reset
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"Cd",
|
||||
this->coeffDict()
|
||||
).ptr()
|
||||
);
|
||||
flowType_ = ftFlowRateAndDischarge;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::InjectionModel<CloudType>::setFlowType()")
|
||||
<< "flowType must be either 'constantVelocity', "
|
||||
<<"'pressureDrivenVelocity' or 'flowRateAndDischarge'"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -41,14 +117,9 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner, typeName),
|
||||
injectionMethod_(imPoint),
|
||||
outerNozzleDiameter_
|
||||
(
|
||||
readScalar(this->coeffDict().lookup("outerNozzleDiameter"))
|
||||
),
|
||||
innerNozzleDiameter_
|
||||
(
|
||||
readScalar(this->coeffDict().lookup("innerNozzleDiameter"))
|
||||
),
|
||||
flowType_(ftConstantVelocity),
|
||||
outerDiameter_(readScalar(this->coeffDict().lookup("outerDiameter"))),
|
||||
innerDiameter_(readScalar(this->coeffDict().lookup("innerDiameter"))),
|
||||
duration_(readScalar(this->coeffDict().lookup("duration"))),
|
||||
position_(this->coeffDict().lookup("position")),
|
||||
injectorCell_(-1),
|
||||
@ -67,14 +138,6 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
Cd_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"Cd",
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
thetaInner_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
@ -101,9 +164,13 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
||||
),
|
||||
tanVec1_(vector::zero),
|
||||
tanVec2_(vector::zero),
|
||||
normal_(vector::zero)
|
||||
normal_(vector::zero),
|
||||
|
||||
UMag_(0.0),
|
||||
Cd_(NULL),
|
||||
Pinj_(NULL)
|
||||
{
|
||||
if (innerNozzleDiameter_ >= outerNozzleDiameter_)
|
||||
if (innerDiameter_ >= outerDiameter_)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -116,38 +183,9 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
word injectionMethodType = this->coeffDict().lookup("injectionMethod");
|
||||
setInjectionMethod();
|
||||
|
||||
if (injectionMethodType == "disc")
|
||||
{
|
||||
injectionMethod_ = imDisc;
|
||||
}
|
||||
else if (injectionMethodType == "point")
|
||||
{
|
||||
injectionMethod_ = imPoint;
|
||||
|
||||
// Set/cache the injector cell
|
||||
this->findCellAtPosition
|
||||
(
|
||||
injectorCell_,
|
||||
tetFaceI_,
|
||||
tetPtI_,
|
||||
position_,
|
||||
false
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::InjectionModel<CloudType>::InjectionModel"
|
||||
"("
|
||||
"const dictionary&, "
|
||||
"CloudType&"
|
||||
")"
|
||||
)<< "injectionMethod must be either 'point' or 'disc'" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
setFlowType();
|
||||
|
||||
cachedRandom& rndGen = this->owner().rndGen();
|
||||
|
||||
@ -182,21 +220,23 @@ Foam::ConeNozzleInjection<CloudType>::ConeNozzleInjection
|
||||
:
|
||||
InjectionModel<CloudType>(im),
|
||||
injectionMethod_(im.injectionMethod_),
|
||||
outerNozzleDiameter_(im.outerNozzleDiameter_),
|
||||
innerNozzleDiameter_(im.innerNozzleDiameter_),
|
||||
outerDiameter_(im.outerDiameter_),
|
||||
innerDiameter_(im.innerDiameter_),
|
||||
duration_(im.duration_),
|
||||
position_(im.position_),
|
||||
injectorCell_(im.injectorCell_),
|
||||
direction_(im.direction_),
|
||||
parcelsPerSecond_(im.parcelsPerSecond_),
|
||||
volumeFlowRate_(im.volumeFlowRate_().clone().ptr()),
|
||||
Cd_(im.Cd_().clone().ptr()),
|
||||
thetaInner_(im.thetaInner_().clone().ptr()),
|
||||
thetaOuter_(im.thetaOuter_().clone().ptr()),
|
||||
sizeDistribution_(im.sizeDistribution_().clone().ptr()),
|
||||
tanVec1_(im.tanVec1_),
|
||||
tanVec2_(im.tanVec1_),
|
||||
normal_(im.normal_)
|
||||
normal_(im.normal_),
|
||||
UMag_(im.UMag_),
|
||||
Cd_(im.Cd_().clone().ptr()),
|
||||
Pinj_(im.Pinj_().clone().ptr())
|
||||
{}
|
||||
|
||||
|
||||
@ -283,8 +323,8 @@ void Foam::ConeNozzleInjection<CloudType>::setPositionAndCell
|
||||
case imDisc:
|
||||
{
|
||||
scalar frac = rndGen.sample01<scalar>();
|
||||
scalar dr = outerNozzleDiameter_ - innerNozzleDiameter_;
|
||||
scalar r = 0.5*(innerNozzleDiameter_ + frac*dr);
|
||||
scalar dr = outerDiameter_ - innerDiameter_;
|
||||
scalar r = 0.5*(innerDiameter_ + frac*dr);
|
||||
position = position_ + r*normal_;
|
||||
|
||||
this->findCellAtPosition
|
||||
@ -344,13 +384,38 @@ void Foam::ConeNozzleInjection<CloudType>::setProperties
|
||||
dirVec += normal;
|
||||
dirVec /= mag(dirVec);
|
||||
|
||||
scalar Ao = 0.25*mathematical::pi*outerNozzleDiameter_*outerNozzleDiameter_;
|
||||
scalar Ai = 0.25*mathematical::pi*innerNozzleDiameter_*innerNozzleDiameter_;
|
||||
scalar massFlowRate =
|
||||
this->massTotal()*volumeFlowRate_().value(t)/this->volumeTotal();
|
||||
switch (flowType_)
|
||||
{
|
||||
case ftConstantVelocity:
|
||||
{
|
||||
parcel.U() = UMag_*dirVec;
|
||||
break;
|
||||
}
|
||||
case ftPressureDrivenVelocity:
|
||||
{
|
||||
scalar pAmbient = this->owner().pAmbient();
|
||||
scalar rho = parcel.rho();
|
||||
scalar UMag = ::sqrt(2.0*(Pinj_().value(t) - pAmbient)/rho);
|
||||
parcel.U() = UMag*dirVec;
|
||||
break;
|
||||
}
|
||||
case ftFlowRateAndDischarge:
|
||||
{
|
||||
scalar Ao = 0.25*mathematical::pi*outerDiameter_*outerDiameter_;
|
||||
scalar Ai = 0.25*mathematical::pi*innerDiameter_*innerDiameter_;
|
||||
scalar massFlowRate =
|
||||
this->massTotal()
|
||||
*volumeFlowRate_().value(t)
|
||||
/this->volumeTotal();
|
||||
|
||||
scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai));
|
||||
parcel.U() = Umag*dirVec;
|
||||
scalar Umag = massFlowRate/(parcel.rho()*Cd_().value(t)*(Ao - Ai));
|
||||
parcel.U() = Umag*dirVec;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// set particle diameter
|
||||
parcel.d() = sizeDistribution_->sample();
|
||||
|
||||
@ -32,16 +32,18 @@ Description
|
||||
- injector position
|
||||
- direction (along injection axis)
|
||||
- parcel flow rate
|
||||
- discharge coefficient, Cd
|
||||
- inner and outer cone angles
|
||||
|
||||
- Parcel diameters obtained by size distribution model
|
||||
|
||||
- Parcel velocity is calculated as:
|
||||
|
||||
U = V_dot/(A * Cd), where V_dot is the volume flow rate
|
||||
|
||||
Based on the old 'unitInjection' model
|
||||
- Constant velocity
|
||||
U = <specified by user>
|
||||
- Pressure driven velocity
|
||||
U = sqrt(2*(Pinj - Pamb)/rho)
|
||||
- Flow rate and discharge
|
||||
U = V_dot/(A*Cd)
|
||||
|
||||
SourceFiles
|
||||
ConeNozzleInjection.C
|
||||
@ -83,19 +85,30 @@ public:
|
||||
imDisc
|
||||
};
|
||||
|
||||
//- Flow type enumeration
|
||||
enum flowType
|
||||
{
|
||||
ftConstantVelocity,
|
||||
ftPressureDrivenVelocity,
|
||||
ftFlowRateAndDischarge
|
||||
};
|
||||
|
||||
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- point/disc injection method
|
||||
//- Point/disc injection method
|
||||
injectionMethod injectionMethod_;
|
||||
|
||||
//- Flow type
|
||||
flowType flowType_;
|
||||
|
||||
//- Outer nozzle diameter [m]
|
||||
const scalar outerNozzleDiameter_;
|
||||
const scalar outerDiameter_;
|
||||
|
||||
//- Inner nozzle diameter [m]
|
||||
const scalar innerNozzleDiameter_;
|
||||
const scalar innerDiameter_;
|
||||
|
||||
//- Injection duration [s]
|
||||
const scalar duration_;
|
||||
@ -121,9 +134,6 @@ private:
|
||||
//- Volume flow rate of parcels to introduce relative to SOI [m^3/s]
|
||||
const autoPtr<DataEntry<scalar> > volumeFlowRate_;
|
||||
|
||||
//- Discharge coefficient, relative to SOI [m/s]
|
||||
const autoPtr<DataEntry<scalar> > Cd_;
|
||||
|
||||
//- Inner cone angle relative to SOI [deg]
|
||||
const autoPtr<DataEntry<scalar> > thetaInner_;
|
||||
|
||||
@ -146,6 +156,27 @@ private:
|
||||
vector normal_;
|
||||
|
||||
|
||||
// Velocity model coefficients
|
||||
|
||||
//- Constant velocity [m/s]
|
||||
scalar UMag_;
|
||||
|
||||
//- Discharge coefficient, relative to SOI [m/s]
|
||||
autoPtr<DataEntry<scalar> > Cd_;
|
||||
|
||||
//- Injection pressure [Pa]
|
||||
autoPtr<DataEntry<scalar> > Pinj_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Set the injection type
|
||||
void setInjectionMethod();
|
||||
|
||||
//- Set the injection flow type
|
||||
void setFlowType();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
|
||||
@ -205,6 +205,9 @@ void Foam::SurfaceFilmModel<CloudType>::inject(TrackData& td)
|
||||
tetPtI
|
||||
);
|
||||
|
||||
// Check/set new parcel thermo properties
|
||||
td.cloud().setParcelThermoProperties(*pPtr, 0.0);
|
||||
|
||||
setParcelProperties(*pPtr, j);
|
||||
|
||||
// Check new parcel properties
|
||||
|
||||
@ -345,7 +345,7 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
|
||||
parcelType& p = iter();
|
||||
if (p.mass() < VSMALL)
|
||||
{
|
||||
deleteParticle(p);
|
||||
this->deleteParticle(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
|
||||
\\ / A nd | Copyright (C) 2011-2011 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
|
||||
@ -648,7 +648,7 @@ Foam::scalarField Foam::autoSnapDriver::calcSnapDistance
|
||||
-GREAT // null value
|
||||
);
|
||||
|
||||
return snapParams.snapTol()*maxEdgeLen;
|
||||
return scalarField(snapParams.snapTol()*maxEdgeLen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -773,7 +773,7 @@ void Foam::autoSnapDriver::determineAllFeatures
|
||||
labelList nearPointFeat;
|
||||
labelList nearPointIndex;
|
||||
{
|
||||
scalarField snapDistSqr = sqr(snapDist);
|
||||
scalarField snapDistSqr(sqr(snapDist));
|
||||
features.findNearestEdge
|
||||
(
|
||||
pp.localPoints(),
|
||||
|
||||
@ -45,6 +45,7 @@ License
|
||||
#include "slipPointPatchFields.H"
|
||||
#include "fixedValuePointPatchFields.H"
|
||||
#include "calculatedPointPatchFields.H"
|
||||
#include "cyclicSlipPointPatchFields.H"
|
||||
#include "processorPointPatch.H"
|
||||
#include "globalIndex.H"
|
||||
#include "meshTools.H"
|
||||
@ -1458,6 +1459,10 @@ Foam::tmp<Foam::pointVectorField> Foam::meshRefinement::makeDisplacementField
|
||||
{
|
||||
patchFieldTypes[patchI] = calculatedPointPatchVectorField::typeName;
|
||||
}
|
||||
else if (isA<cyclicPointPatch>(pointPatches[patchI]))
|
||||
{
|
||||
patchFieldTypes[patchI] = cyclicSlipPointPatchVectorField::typeName;
|
||||
}
|
||||
}
|
||||
|
||||
// Note: time().timeName() instead of meshRefinement::timeName() since
|
||||
|
||||
@ -159,7 +159,10 @@ twoDPointCorrector/twoDPointCorrector.C
|
||||
directMapped/directMappedPolyPatch/directMappedPatchBase.C
|
||||
directMapped/directMappedPolyPatch/directMappedPolyPatch.C
|
||||
directMapped/directMappedPolyPatch/directMappedWallPolyPatch.C
|
||||
directMapped/directMappedPolyPatch/directMappedVariableThicknessWallPolyPatch.C
|
||||
directMapped/directMappedPointPatch/directMappedPointPatch.C
|
||||
directMapped/directMappedPointPatch/directMappedWallPointPatch.C
|
||||
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libmeshTools
|
||||
|
||||
@ -0,0 +1,178 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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 "directMappedVariableThicknessWallPolyPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(directMappedVariableThicknessWallPolyPatch, 0);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
polyPatch,
|
||||
directMappedVariableThicknessWallPolyPatch,
|
||||
word
|
||||
);
|
||||
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
polyPatch,
|
||||
directMappedVariableThicknessWallPolyPatch,
|
||||
dictionary
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(name, size, start, index, bm),
|
||||
thickness_(size)
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const directMappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vectorField& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(name, size, start, index, bm),
|
||||
thickness_(size)
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const directMappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vector& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(name, size, start, index, bm),
|
||||
thickness_(size)
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(name, dict, index, bm),
|
||||
thickness_(scalarField("thickness", dict, this->size()))
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const directMappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(pp, bm),
|
||||
thickness_(pp.thickness_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const directMappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(pp, bm, index, newSize, newStart),
|
||||
thickness_(newSize)
|
||||
{}
|
||||
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const directMappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
)
|
||||
:
|
||||
directMappedWallPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||
thickness_(pp.size())
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
~directMappedVariableThicknessWallPolyPatch()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::directMappedVariableThicknessWallPolyPatch::
|
||||
write(Foam::Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("thickness") << thickness_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,236 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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::directMappedVariableThicknessWallPolyPatch
|
||||
|
||||
Description
|
||||
Foam::directMappedVariableThicknessWallPolyPatch
|
||||
|
||||
SourceFiles
|
||||
directMappedVariableThicknessWallPolyPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directMappedVariableThicknessWallPolyPatch_H
|
||||
#define directMappedVariableThicknessWallPolyPatch_H
|
||||
|
||||
#include "wallPolyPatch.H"
|
||||
#include "directMappedWallPolyPatch.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
class polyMesh;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directMappedVariableThicknessWallPolyPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class directMappedVariableThicknessWallPolyPatch
|
||||
:
|
||||
public directMappedWallPolyPatch
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Thickness
|
||||
scalarList thickness_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("directMappedWallVariableThickness");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct from components
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const directMappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vectorField& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct from components. Uniform offset.
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const label size,
|
||||
const label start,
|
||||
const label index,
|
||||
const word& sampleRegion,
|
||||
const directMappedPatchBase::sampleMode mode,
|
||||
const word& samplePatch,
|
||||
const vector& offset,
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct from dictionary
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const word& name,
|
||||
const dictionary& dict,
|
||||
const label index,
|
||||
const polyBoundaryMesh& bm
|
||||
);
|
||||
|
||||
//- Construct as copy, resetting the boundary mesh
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const directMappedVariableThicknessWallPolyPatch&,
|
||||
const polyBoundaryMesh&
|
||||
);
|
||||
|
||||
//- Construct given the original patch and resetting the
|
||||
// face list and boundary mesh information
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const directMappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
);
|
||||
|
||||
//- Construct given the original patch and a map
|
||||
directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
const directMappedVariableThicknessWallPolyPatch& pp,
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
);
|
||||
|
||||
//- Construct and return a clone, resetting the boundary mesh
|
||||
virtual autoPtr<polyPatch> clone(const polyBoundaryMesh& bm) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new directMappedVariableThicknessWallPolyPatch(*this, bm)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const label newSize,
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
newSize,
|
||||
newStart
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct and return a clone, resetting the face list
|
||||
// and boundary mesh
|
||||
virtual autoPtr<polyPatch> clone
|
||||
(
|
||||
const polyBoundaryMesh& bm,
|
||||
const label index,
|
||||
const labelUList& mapAddressing,
|
||||
const label newStart
|
||||
) const
|
||||
{
|
||||
return autoPtr<polyPatch>
|
||||
(
|
||||
new directMappedVariableThicknessWallPolyPatch
|
||||
(
|
||||
*this,
|
||||
bm,
|
||||
index,
|
||||
mapAddressing,
|
||||
newStart
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~directMappedVariableThicknessWallPolyPatch();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
//- Return non const thickness
|
||||
scalarList& thickness()
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
|
||||
|
||||
//- Return const thickness
|
||||
const scalarList& thickness() const
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
|
||||
|
||||
//- Write the polyPatch data as a dictionary
|
||||
void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -179,9 +179,14 @@ defineTypeNameAndDebug(Foam::treeDataTriSurface, 0);
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
// Construct from components
|
||||
Foam::treeDataTriSurface::treeDataTriSurface(const triSurface& surface)
|
||||
Foam::treeDataTriSurface::treeDataTriSurface
|
||||
(
|
||||
const triSurface& surface,
|
||||
const scalar planarTol
|
||||
)
|
||||
:
|
||||
surface_(surface)
|
||||
surface_(surface),
|
||||
planarTol_(planarTol)
|
||||
{}
|
||||
|
||||
|
||||
@ -437,7 +442,7 @@ bool Foam::treeDataTriSurface::intersects
|
||||
dir,
|
||||
points,
|
||||
intersection::HALF_RAY,
|
||||
indexedOctree<treeDataTriSurface>::perturbTol()
|
||||
planarTol_
|
||||
);
|
||||
|
||||
if (inter.hit() && inter.distance() <= 1)
|
||||
|
||||
@ -55,8 +55,11 @@ class treeDataTriSurface
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Reference to triSurface
|
||||
const triSurface& surface_;
|
||||
|
||||
//- Tolerance to use for intersection tests
|
||||
const scalar planarTol_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
@ -83,8 +86,9 @@ public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from triSurface. Holds reference.
|
||||
treeDataTriSurface(const triSurface&);
|
||||
//- Construct from triSurface and tolerance for intersection
|
||||
// tests. Holds reference.
|
||||
treeDataTriSurface(const triSurface&, const scalar planarTol);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -507,7 +507,7 @@ void Foam::triSurfaceMesh::movePoints(const pointField& newPoints)
|
||||
|
||||
|
||||
const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||
Foam::triSurfaceMesh::tree() const
|
||||
Foam::triSurfaceMesh::tree() const
|
||||
{
|
||||
if (tree_.empty())
|
||||
{
|
||||
@ -543,7 +543,7 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||
(
|
||||
new indexedOctree<treeDataTriSurface>
|
||||
(
|
||||
treeDataTriSurface(*this),
|
||||
treeDataTriSurface(*this, tolerance_),
|
||||
bb,
|
||||
maxTreeDepth_, // maxLevel
|
||||
10, // leafsize
|
||||
@ -559,7 +559,7 @@ const Foam::indexedOctree<Foam::treeDataTriSurface>&
|
||||
|
||||
|
||||
const Foam::indexedOctree<Foam::treeDataEdge>&
|
||||
Foam::triSurfaceMesh::edgeTree() const
|
||||
Foam::triSurfaceMesh::edgeTree() const
|
||||
{
|
||||
if (edgeTree_.empty())
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -64,7 +64,11 @@ Foam::triSurfaceSearch::triSurfaceSearch(const triSurface& surface)
|
||||
(
|
||||
new indexedOctree<treeDataTriSurface>
|
||||
(
|
||||
treeDataTriSurface(surface_),
|
||||
treeDataTriSurface
|
||||
(
|
||||
surface_,
|
||||
indexedOctree<treeDataTriSurface>::perturbTol()
|
||||
),
|
||||
treeBb,
|
||||
8, // maxLevel
|
||||
10, // leafsize
|
||||
|
||||
@ -448,8 +448,8 @@ void Foam::decompositionMethod::calcCellCells
|
||||
// Count number of faces (internal + coupled)
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Number of faces per cell
|
||||
labelList nFacesPerCell(mesh.nCells(), 0);
|
||||
// Number of faces per coarse cell
|
||||
labelList nFacesPerCell(nCoarse, 0);
|
||||
|
||||
for (label faceI = 0; faceI < mesh.nInternalFaces(); faceI++)
|
||||
{
|
||||
@ -481,7 +481,11 @@ void Foam::decompositionMethod::calcCellCells
|
||||
{
|
||||
label own = agglom[faceOwner[faceI]];
|
||||
label globalNei = globalNeighbour[bFaceI];
|
||||
if (cellPair.insert(labelPair(own, globalNei)))
|
||||
if
|
||||
(
|
||||
globalAgglom.toGlobal(own) != globalNei
|
||||
&& cellPair.insert(labelPair(own, globalNei))
|
||||
)
|
||||
{
|
||||
nFacesPerCell[own]++;
|
||||
}
|
||||
|
||||
@ -111,7 +111,7 @@ public:
|
||||
}
|
||||
|
||||
//- Return for every coordinate the wanted processor number. Use the
|
||||
// mesh connectivity (if needed)
|
||||
// mesh connectivity (if needed). See note on weights in scotchDecomp.H
|
||||
virtual labelList decompose
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -122,7 +122,7 @@ public:
|
||||
//- Return for every coordinate the wanted processor number. Gets
|
||||
// passed agglomeration map (from fine to coarse cells) and coarse cell
|
||||
// location. Can be overridden by decomposers that provide this
|
||||
// functionality natively.
|
||||
// functionality natively. See note on weights in scotchDecomp.H
|
||||
virtual labelList decompose
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
@ -138,6 +138,7 @@ public:
|
||||
// from 0 at processor0 and then incrementing all through the
|
||||
// processors)
|
||||
// - the connections are across coupled patches
|
||||
// See note on weights in scotchDecomp.H
|
||||
virtual labelList decompose
|
||||
(
|
||||
const labelListList& globalCellCells,
|
||||
|
||||
@ -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
|
||||
@ -107,9 +107,9 @@ public:
|
||||
|
||||
//- Return for every coordinate the wanted processor number. Use the
|
||||
// mesh connectivity (if needed)
|
||||
// Weights get truncated to convert into integer
|
||||
// so e.g. 3.5 is seen as 3. The overall sum of weights
|
||||
// might otherwise overflow.
|
||||
// Weights get normalised with minimum weight and truncated to
|
||||
// convert into integer so e.g. 3.5 is seen as 3. The overall sum
|
||||
// of weights might otherwise overflow.
|
||||
virtual labelList decompose
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
|
||||
@ -4,9 +4,10 @@ makeType=${1:-libso}
|
||||
set -x
|
||||
|
||||
wmake $makeType regionModel
|
||||
#wmake $makeType pyrolysisModels
|
||||
wmake $makeType pyrolysisModels
|
||||
wmake $makeType surfaceFilmModels
|
||||
#wmake $makeType regionCoupling
|
||||
wmake $makeType thermoBaffleModels
|
||||
wmake $makeType regionCoupling
|
||||
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
7
src/regionModels/pyrolysisModels/Make/files
Normal file
7
src/regionModels/pyrolysisModels/Make/files
Normal file
@ -0,0 +1,7 @@
|
||||
/* Pyrolysis models */
|
||||
pyrolysisModel/pyrolysisModel.C
|
||||
pyrolysisModel/pyrolysisModelNew.C
|
||||
reactingOneDim/reactingOneDim.C
|
||||
noPyrolysis/noPyrolysis.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libpyrolysisModels
|
||||
25
src/regionModels/pyrolysisModels/Make/options
Normal file
25
src/regionModels/pyrolysisModels/Make/options
Normal file
@ -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
|
||||
147
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
Normal file
147
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.C
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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<volScalarField> noPyrolysis::Cp() const
|
||||
{
|
||||
FatalErrorIn("const tmp<volScalarField>& noPyrolysis::Cp() const")
|
||||
<< "Cp field not available for " << type() << abort(FatalError);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
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
|
||||
|
||||
// ************************************************************************* //
|
||||
127
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
Normal file
127
src/regionModels/pyrolysisModels/noPyrolysis/noPyrolysis.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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<volScalarField> 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
|
||||
|
||||
// ************************************************************************* //
|
||||
182
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C
Normal file
182
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.C
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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<scalar>& fvp = filmDelta.boundaryField()[patchI];
|
||||
if (isA<directMappedFieldFvPatchField<scalar> >(fvp))
|
||||
{
|
||||
foundCoupledPatch = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!foundCoupledPatch)
|
||||
{
|
||||
WarningIn("void pyrolysisModels::constructMeshObjects()")
|
||||
<< "filmCoupled flag set to true, but no "
|
||||
<< directMappedFieldFvPatchField<scalar>::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<scalar>("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
|
||||
|
||||
// ************************************************************************* //
|
||||
199
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H
Normal file
199
src/regionModels/pyrolysisModels/pyrolysisModel/pyrolysisModel.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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<volScalarField> 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<pyrolysisModel> 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<volScalarField> 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "pyrolysisModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace pyrolysisModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<pyrolysisModel> 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<pyrolysisModel>(cstrIter()(modelType, mesh));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace surfaceFilmModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
615
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
Normal file
615
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C
Normal file
@ -0,0 +1,615 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "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, scalar(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<volScalarField> tHsiGas = solidChemistry_->gasHs(T_, gasI);
|
||||
tmp<volScalarField> 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; i<Ys_.size()-1; i++)
|
||||
{
|
||||
volScalarField& Yi = Ys_[i];
|
||||
|
||||
fvScalarMatrix YiEqn
|
||||
(
|
||||
fvm::ddt(rho_, Yi)
|
||||
==
|
||||
solidChemistry_->RRs(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<word>("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<volScalarField> 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
|
||||
|
||||
// ************************************************************************* //
|
||||
284
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
Normal file
284
src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
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<solidChemistryModel> 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<volScalarField>& 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<volScalarField> 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
4
src/regionModels/regionCoupling/Make/files
Normal file
4
src/regionModels/regionCoupling/Make/files
Normal file
@ -0,0 +1,4 @@
|
||||
derivedFvPatchFields/filmPyrolysisVelocityCoupled/filmPyrolysisVelocityCoupledFvPatchVectorField.C
|
||||
derivedFvPatchFields/filmPyrolysisTemperatureCoupled/filmPyrolysisTemperatureCoupledFvPatchScalarField.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libregionCoupling
|
||||
30
src/regionModels/regionCoupling/Make/options
Normal file
30
src/regionModels/regionCoupling/Make/options
Normal file
@ -0,0 +1,30 @@
|
||||
|
||||
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/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solidChemistryModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/radiationModels/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 \
|
||||
-I$(LIB_SRC)/regionModels/pyrolysisModels/lnInclude \
|
||||
-I$(LIB_SRC)/regionModels/surfaceFilmModels/lnInclude \
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lregionModels \
|
||||
-lpyrolysisModels \
|
||||
-lsurfaceFilmModels \
|
||||
-lsolidChemistryModel \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lcompressibleRASModels \
|
||||
-lcompressibleLESModels
|
||||
@ -0,0 +1,213 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "filmPyrolysisTemperatureCoupledFvPatchScalarField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pyrolysisModel.H"
|
||||
#include "surfaceFilmModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
deltaWet_(1e-6)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
deltaWet_(ptf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<scalar, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6))
|
||||
{
|
||||
fvPatchScalarField::operator=(scalarField("value", dict, p.size()));
|
||||
}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField& fptpsf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(fptpsf),
|
||||
phiName_(fptpsf.phiName_),
|
||||
rhoName_(fptpsf.rhoName_),
|
||||
deltaWet_(fptpsf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField& fptpsf,
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchScalarField(fptpsf, iF),
|
||||
phiName_(fptpsf.phiName_),
|
||||
rhoName_(fptpsf.rhoName_),
|
||||
deltaWet_(fptpsf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
||||
|
||||
bool filmOk =
|
||||
db().objectRegistry::foundObject<filmModelType>
|
||||
(
|
||||
"surfaceFilmProperties"
|
||||
);
|
||||
|
||||
|
||||
bool pyrOk =
|
||||
db().objectRegistry::foundObject<pyrModelType>
|
||||
(
|
||||
"pyrolysisProperties"
|
||||
);
|
||||
|
||||
if (!filmOk || !pyrOk)
|
||||
{
|
||||
// do nothing on construction - film model doesn't exist yet
|
||||
return;
|
||||
}
|
||||
|
||||
scalarField& Tp = *this;
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
// Retrieve film model
|
||||
const filmModelType& filmModel =
|
||||
db().lookupObject<filmModelType>("surfaceFilmProperties");
|
||||
|
||||
const label filmPatchI = filmModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& filmMap = filmModel.mappedPatches()[filmPatchI].map();
|
||||
|
||||
scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(deltaFilm);
|
||||
|
||||
scalarField TFilm = filmModel.Ts().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(TFilm);
|
||||
|
||||
|
||||
// Retrieve pyrolysis model
|
||||
const pyrModelType& pyrModel =
|
||||
db().lookupObject<pyrModelType>("pyrolysisProperties");
|
||||
|
||||
const label pyrPatchI = pyrModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& pyrMap = pyrModel.mappedPatches()[pyrPatchI].map();
|
||||
|
||||
scalarField TPyr = pyrModel.T().boundaryField()[pyrPatchI];
|
||||
pyrMap.distribute(TPyr);
|
||||
|
||||
|
||||
forAll(deltaFilm, i)
|
||||
{
|
||||
if (deltaFilm[i] > deltaWet_)
|
||||
{
|
||||
// temperature set by film
|
||||
Tp[i] = TFilm[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// temperature set by pyrolysis model
|
||||
Tp[i] = TPyr[i];
|
||||
}
|
||||
}
|
||||
|
||||
fixedValueFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchScalarField,
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Class
|
||||
Foam::filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
|
||||
Description
|
||||
Temperature boundary condition for patches on the primary region:
|
||||
|
||||
- where the film height > height threshold value:
|
||||
apply film surface temperature values
|
||||
- else
|
||||
apply pyrolysis surface temperature values
|
||||
|
||||
SourceFiles
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef filmPyrolysisTemperatureCoupledFvPatchScalarField_H
|
||||
#define filmPyrolysisTemperatureCoupledFvPatchScalarField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class filmPyrolysisTemperatureCoupledFvPatchScalarField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
:
|
||||
public fixedValueFvPatchScalarField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Film height threshold beyond which it is considered 'wet'
|
||||
scalar deltaWet_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("filmPyrolysisTemperatureCoupled");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// filmPyrolysisTemperatureCoupledFvPatchScalarField onto a new patch
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<scalar, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchScalarField> clone() const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new filmPyrolysisTemperatureCoupledFvPatchScalarField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
filmPyrolysisTemperatureCoupledFvPatchScalarField
|
||||
(
|
||||
const filmPyrolysisTemperatureCoupledFvPatchScalarField&,
|
||||
const DimensionedField<scalar, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct and return a clone setting internal field reference
|
||||
virtual tmp<fvPatchScalarField> clone
|
||||
(
|
||||
const DimensionedField<scalar, volMesh>& iF
|
||||
) const
|
||||
{
|
||||
return tmp<fvPatchScalarField>
|
||||
(
|
||||
new filmPyrolysisTemperatureCoupledFvPatchScalarField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of phi
|
||||
const word& phiName() const
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of phi to allow adjustment
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return the name of rho
|
||||
const word& rhoName() const
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of rho to allow adjustment
|
||||
word& rhoName()
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,248 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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 "filmPyrolysisVelocityCoupledFvPatchVectorField.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "pyrolysisModel.H"
|
||||
#include "surfaceFilmModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
phiName_("phi"),
|
||||
rhoName_("rho"),
|
||||
deltaWet_(1e-6)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField& ptf,
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const fvPatchFieldMapper& mapper
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(ptf, p, iF, mapper),
|
||||
phiName_(ptf.phiName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
deltaWet_(ptf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch& p,
|
||||
const DimensionedField<vector, volMesh>& iF,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
phiName_(dict.lookupOrDefault<word>("phi", "phi")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
deltaWet_(dict.lookupOrDefault<scalar>("deltaWet", 1e-6))
|
||||
{
|
||||
fvPatchVectorField::operator=(vectorField("value", dict, p.size()));
|
||||
}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField& fpvpvf
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(fpvpvf),
|
||||
phiName_(fpvpvf.phiName_),
|
||||
rhoName_(fpvpvf.rhoName_),
|
||||
deltaWet_(fpvpvf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField& fpvpvf,
|
||||
const DimensionedField<vector, volMesh>& iF
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(fpvpvf, iF),
|
||||
phiName_(fpvpvf.phiName_),
|
||||
rhoName_(fpvpvf.rhoName_),
|
||||
deltaWet_(fpvpvf.deltaWet_)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()
|
||||
{
|
||||
if (updated())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
typedef regionModels::surfaceFilmModels::surfaceFilmModel filmModelType;
|
||||
typedef regionModels::pyrolysisModels::pyrolysisModel pyrModelType;
|
||||
|
||||
bool filmOk =
|
||||
db().objectRegistry::foundObject<filmModelType>
|
||||
(
|
||||
"surfaceFilmProperties"
|
||||
);
|
||||
|
||||
|
||||
bool pyrOk =
|
||||
db().objectRegistry::foundObject<pyrModelType>
|
||||
(
|
||||
"pyrolysisProperties"
|
||||
);
|
||||
|
||||
if (!filmOk || !pyrOk)
|
||||
{
|
||||
// do nothing on construction - film model doesn't exist yet
|
||||
return;
|
||||
}
|
||||
|
||||
vectorField& Up = *this;
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
// Retrieve film model
|
||||
const filmModelType& filmModel =
|
||||
db().objectRegistry::lookupObject<filmModelType>
|
||||
(
|
||||
"surfaceFilmProperties"
|
||||
);
|
||||
|
||||
const label filmPatchI = filmModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& filmMap = filmModel.mappedPatches()[filmPatchI].map();
|
||||
|
||||
scalarField deltaFilm = filmModel.delta().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(deltaFilm);
|
||||
|
||||
vectorField UFilm = filmModel.Us().boundaryField()[filmPatchI];
|
||||
filmMap.distribute(UFilm);
|
||||
|
||||
|
||||
// Retrieve pyrolysis model
|
||||
const pyrModelType& pyrModel =
|
||||
db().objectRegistry::lookupObject<pyrModelType>
|
||||
(
|
||||
"pyrolysisProperties"
|
||||
);
|
||||
|
||||
const label pyrPatchI = pyrModel.regionPatchID(patchI);
|
||||
|
||||
const mapDistribute& pyrMap = pyrModel.mappedPatches()[pyrPatchI].map();
|
||||
|
||||
scalarField phiPyr = pyrModel.phiGas().boundaryField()[pyrPatchI];
|
||||
pyrMap.distribute(phiPyr);
|
||||
|
||||
|
||||
const surfaceScalarField& phi =
|
||||
db().lookupObject<surfaceScalarField>(phiName_);
|
||||
|
||||
if (phi.dimensions() == dimVelocity*dimArea)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
else if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
const fvPatchField<scalar>& rhop =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
phiPyr /= rhop;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs()"
|
||||
) << "Unable to process flux field phi with dimensions "
|
||||
<< phi.dimensions() << nl
|
||||
<< " on patch " << patch().name()
|
||||
<< " of field " << dimensionedInternalField().name()
|
||||
<< " in file " << dimensionedInternalField().objectPath()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const scalarField UAvePyr(-phiPyr/patch().magSf());
|
||||
const vectorField& nf = patch().nf();
|
||||
|
||||
forAll(deltaFilm, i)
|
||||
{
|
||||
if (deltaFilm[i] > deltaWet_)
|
||||
{
|
||||
// velocity set by film
|
||||
Up[i] = UFilm[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
// velocity set by pyrolysis model
|
||||
Up[i] = UAvePyr[i]*nf[i];
|
||||
}
|
||||
}
|
||||
|
||||
fixedValueFvPatchVectorField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
void Foam::filmPyrolysisVelocityCoupledFvPatchVectorField::write
|
||||
(
|
||||
Ostream& os
|
||||
) const
|
||||
{
|
||||
fvPatchVectorField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
os.writeKeyword("deltaWet") << deltaWet_ << token::END_STATEMENT << nl;
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makePatchTypeField
|
||||
(
|
||||
fvPatchVectorField,
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,183 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / 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/>.
|
||||
|
||||
Class
|
||||
Foam::filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
|
||||
Description
|
||||
Velocity boundary condition for patches on the primary region:
|
||||
|
||||
- where the film height > height threshold value:
|
||||
apply film surface velocity values
|
||||
- else
|
||||
apply pyrolysis out-gassing velocity values
|
||||
|
||||
SourceFiles
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef filmPyrolysisVelocityCoupledFvPatchVectorField_H
|
||||
#define filmPyrolysisVelocityCoupledFvPatchVectorField_H
|
||||
|
||||
#include "fixedValueFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class filmPyrolysisVelocityCoupledFvPatchVectorField Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
:
|
||||
public fixedValueFvPatchVectorField
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Name of flux field
|
||||
word phiName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Film height threshold beyond which it is considered 'wet'
|
||||
scalar deltaWet_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("filmPyrolysisVelocityCoupled");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from patch and internal field
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&
|
||||
);
|
||||
|
||||
//- Construct from patch, internal field and dictionary
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const dictionary&
|
||||
);
|
||||
|
||||
//- Construct by mapping given
|
||||
// filmPyrolysisVelocityCoupledFvPatchVectorField onto a new patch
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField&,
|
||||
const fvPatch&,
|
||||
const DimensionedField<vector, volMesh>&,
|
||||
const fvPatchFieldMapper&
|
||||
);
|
||||
|
||||
//- Construct as copy
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
virtual tmp<fvPatchVectorField> clone() const
|
||||
{
|
||||
return tmp<fvPatchVectorField>
|
||||
(
|
||||
new filmPyrolysisVelocityCoupledFvPatchVectorField(*this)
|
||||
);
|
||||
}
|
||||
|
||||
//- Construct as copy setting internal field reference
|
||||
filmPyrolysisVelocityCoupledFvPatchVectorField
|
||||
(
|
||||
const filmPyrolysisVelocityCoupledFvPatchVectorField&,
|
||||
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 filmPyrolysisVelocityCoupledFvPatchVectorField(*this, iF)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the name of phi
|
||||
const word& phiName() const
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of phi to allow adjustment
|
||||
word& phiName()
|
||||
{
|
||||
return phiName_;
|
||||
}
|
||||
|
||||
//- Return the name of rho
|
||||
const word& rhoName() const
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
//- Return reference to the name of rho to allow adjustment
|
||||
word& rhoName()
|
||||
{
|
||||
return rhoName_;
|
||||
}
|
||||
|
||||
|
||||
//- Update the coefficients associated with the patch field
|
||||
virtual void updateCoeffs();
|
||||
|
||||
//- Write
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -3,5 +3,7 @@ regionModel/regionModel.C
|
||||
singleLayerRegion/singleLayerRegion.C
|
||||
regionModel1D/regionModel1D.C
|
||||
|
||||
/* Boundary conditions */
|
||||
derivedFvPatches/directMappedVariableThicknessWall/directMappedVariableThicknessWallFvPatch.C
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libregionModels
|
||||
|
||||
@ -0,0 +1,74 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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 "directMappedVariableThicknessWallFvPatch.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "regionModel1D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(directMappedVariableThicknessWallFvPatch, 0);
|
||||
addToRunTimeSelectionTable
|
||||
(
|
||||
fvPatch,
|
||||
directMappedVariableThicknessWallFvPatch,
|
||||
polyPatch
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::directMappedVariableThicknessWallFvPatch::
|
||||
makeDeltaCoeffs(scalarField& dc) const
|
||||
{
|
||||
const directMappedVariableThicknessWallPolyPatch& pp =
|
||||
refCast<const directMappedVariableThicknessWallPolyPatch>
|
||||
(
|
||||
patch()
|
||||
);
|
||||
|
||||
const directMappedPatchBase& mpp = refCast<const directMappedPatchBase>
|
||||
(
|
||||
patch()
|
||||
);
|
||||
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
|
||||
typedef regionModels::regionModel1D modelType;
|
||||
|
||||
const modelType& region1D =
|
||||
nbrMesh.objectRegistry::lookupObject<modelType>
|
||||
(
|
||||
"thermoBaffleProperties"
|
||||
);
|
||||
|
||||
dc = 2.0/(pp.thickness()/region1D.nLayers());
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,94 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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::directMappedVariableThicknessWallFvPatch
|
||||
|
||||
Description
|
||||
Take thickness field and number of layers and returns deltaCoeffs
|
||||
as 2.0/thickness/nLayers.
|
||||
To be used with 1D thermo baffle.
|
||||
|
||||
SourceFiles
|
||||
directMappedVariableThicknessWallFvPatch.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef directMappedWallFvPatch_H
|
||||
#define directMappedWallFvPatch_H
|
||||
|
||||
#include "wallFvPatch.H"
|
||||
#include "directMappedVariableThicknessWallPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class directMappedVariableThicknessWallFvPatch Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class directMappedVariableThicknessWallFvPatch
|
||||
:
|
||||
public wallFvPatch
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read neighbour cell distances from dictionary
|
||||
void makeDeltaCoeffs(scalarField& dc) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName(directMappedVariableThicknessWallPolyPatch::typeName_());
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
directMappedVariableThicknessWallFvPatch
|
||||
(
|
||||
const polyPatch& patch,
|
||||
const fvBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
wallFvPatch(patch, bm)
|
||||
{}
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -27,6 +27,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "fvcGrad.H"
|
||||
#include "unitConversion.H"
|
||||
#include "fvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -109,7 +110,8 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
|
||||
);
|
||||
volVectorField gradAlpha(fvc::grad(alpha));
|
||||
|
||||
scalarField nHits(force.size(), 0.0);
|
||||
|
||||
scalarField nHits(owner_.regionMesh().nCells(), 0.0);
|
||||
|
||||
forAll(nbr, faceI)
|
||||
{
|
||||
@ -129,6 +131,7 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
|
||||
if (cellI != -1)
|
||||
{
|
||||
// const scalar dx = Foam::sqrt(magSf[cellI]);
|
||||
// bit of a cheat, but ok for regular meshes
|
||||
const scalar dx = owner_.regionMesh().deltaCoeffs()[faceI];
|
||||
const vector n =
|
||||
gradAlpha[cellI]/(mag(gradAlpha[cellI]) + ROOTVSMALL);
|
||||
@ -138,8 +141,29 @@ tmp<fvVectorMatrix> contactAngleForce::correct(volVectorField& U)
|
||||
}
|
||||
}
|
||||
|
||||
nHits = max(nHits, 1.0);
|
||||
force /= (nHits*magSf);
|
||||
forAll(delta.boundaryField(), patchI)
|
||||
{
|
||||
const fvPatchField<scalar>& df = delta.boundaryField()[patchI];
|
||||
const scalarField& dx = df.patch().deltaCoeffs();
|
||||
const labelUList& faceCells = df.patch().faceCells();
|
||||
|
||||
forAll(df, faceI)
|
||||
{
|
||||
label cellO = faceCells[faceI];
|
||||
|
||||
if ((delta[cellO] > deltaWet_) && (df[faceI] < deltaWet_))
|
||||
{
|
||||
const vector n =
|
||||
gradAlpha[cellO]/(mag(gradAlpha[cellO]) + ROOTVSMALL);
|
||||
scalar theta = cos(degToRad(distribution_->sample()));
|
||||
force[cellO] += Ccf_*n*sigma[cellO]*(1.0 - theta)/dx[faceI];
|
||||
nHits[cellO]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
force /= (max(nHits, scalar(1.0))*magSf);
|
||||
tForce().correctBoundaryConditions();
|
||||
|
||||
if (owner_.regionMesh().time().outputTime())
|
||||
{
|
||||
|
||||
7
src/regionModels/thermoBaffleModels/Make/files
Normal file
7
src/regionModels/thermoBaffleModels/Make/files
Normal file
@ -0,0 +1,7 @@
|
||||
thermoBaffleModel/thermoBaffleModel.C
|
||||
thermoBaffleModel/thermoBaffleModelNew.C
|
||||
thermoBaffle2D/thermoBaffle2D.C
|
||||
noThermo/noThermo.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libthermoBaffleModels
|
||||
18
src/regionModels/thermoBaffleModels/Make/options
Normal file
18
src/regionModels/thermoBaffleModels/Make/options
Normal file
@ -0,0 +1,18 @@
|
||||
EXE_INC = \
|
||||
-I$(LIB_SRC)/regionModels/regionModel/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/solid/lnInclude \
|
||||
-I$(LIB_SRC)/finiteVolume/lnInclude \
|
||||
-I$(LIB_SRC)/meshTools/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
|
||||
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
|
||||
-I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude
|
||||
|
||||
|
||||
EXE_LIBS = \
|
||||
-lregionModels \
|
||||
-lbasicSolidThermo \
|
||||
-lfiniteVolume \
|
||||
-lmeshTools \
|
||||
-lOpenFOAM \
|
||||
-lsolid
|
||||
136
src/regionModels/thermoBaffleModels/noThermo/noThermo.C
Normal file
136
src/regionModels/thermoBaffleModels/noThermo/noThermo.C
Normal file
@ -0,0 +1,136 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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 "noThermo.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(noThermo, 0);
|
||||
addToRunTimeSelectionTable(thermoBaffleModel, noThermo, mesh);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool noThermo::read()
|
||||
{
|
||||
return regionModel1D::read();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
noThermo::noThermo(const word& modelType, const fvMesh& mesh)
|
||||
:
|
||||
thermoBaffleModel(mesh)
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
noThermo::~noThermo()
|
||||
{}
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void noThermo::preEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
void noThermo::evolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
const tmp<volScalarField> noThermo::Cp() const
|
||||
{
|
||||
FatalErrorIn("const tmp<volScalarField>& noThermo::Cp() const")
|
||||
<< "Cp field not available for " << type() << abort(FatalError);
|
||||
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"noThermo::Cp",
|
||||
time().timeName(),
|
||||
primaryMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
primaryMesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
const volScalarField& noThermo::kappa() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noThermo::kappa() const")
|
||||
<< "kappa field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noThermo::rho() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noThermo::rho() const")
|
||||
<< "rho field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noThermo::K() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noThermo::K() const")
|
||||
<< "K field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& noThermo::T() const
|
||||
{
|
||||
FatalErrorIn("const volScalarField& noThermo::T() const")
|
||||
<< "T field not available for " << type() << abort(FatalError);
|
||||
return volScalarField::null();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
134
src/regionModels/thermoBaffleModels/noThermo/noThermo.H
Normal file
134
src/regionModels/thermoBaffleModels/noThermo/noThermo.H
Normal file
@ -0,0 +1,134 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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::noThermo
|
||||
|
||||
Description
|
||||
Dummy surface pyrolysis model for 'none'
|
||||
|
||||
SourceFiles
|
||||
noThermo.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef noThermo_H
|
||||
#define noThermo_H
|
||||
|
||||
#include "thermoBaffleModel.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noThermo Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class noThermo
|
||||
:
|
||||
public thermoBaffleModel
|
||||
{
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
noThermo(const noThermo&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const noThermo&);
|
||||
|
||||
|
||||
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
|
||||
noThermo(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~noThermo();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return the film specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Return solid absortivity [1/m]
|
||||
virtual const volScalarField& kappa() const;
|
||||
|
||||
//- Return the film mean temperature [K]
|
||||
virtual const volScalarField& T() const;
|
||||
|
||||
//- Return density [Kg/m3]
|
||||
virtual const volScalarField& rho() const;
|
||||
|
||||
//- Return thermal conductivity [W/m/K]
|
||||
virtual const volScalarField& K() const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve film
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
//- Evolve the film equations
|
||||
virtual void evolveRegion();
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,289 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermoBaffle2D.H"
|
||||
|
||||
#include "fvm.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
#include "fvMatrices.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(thermoBaffle2D, 0);
|
||||
|
||||
addToRunTimeSelectionTable(thermoBaffleModel, thermoBaffle2D, mesh);
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
|
||||
bool thermoBaffle2D::read()
|
||||
{
|
||||
this->solution().lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
return regionModel1D::read();
|
||||
}
|
||||
|
||||
|
||||
void thermoBaffle2D::solveEnergy()
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Info<< "thermoBaffle2D::solveEnergy()" << endl;
|
||||
}
|
||||
|
||||
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
|
||||
|
||||
tmp<volScalarField> tQ
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"tQ",
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar("zero", dimEnergy/dimVolume/dimTime, 0.0)
|
||||
)
|
||||
);
|
||||
|
||||
volScalarField& Q = tQ();
|
||||
|
||||
volScalarField rhoCp("rhoCp", thermo_->rho()*thermo_->Cp()());
|
||||
volScalarField K("K", thermo_->K());
|
||||
|
||||
|
||||
//If region is one-dimension variable thickness can be used.
|
||||
if (oneD_)
|
||||
{
|
||||
// Scale K and rhoCp and fill Q in the internal baffle region.
|
||||
const label patchI = intCoupledPatchIDs_[0];
|
||||
const polyPatch& ppCoupled = rbm[patchI];
|
||||
|
||||
forAll(ppCoupled, localFaceI)
|
||||
{
|
||||
const labelList& cells = boundaryFaceCells_[localFaceI];
|
||||
forAll (cells, i)
|
||||
{
|
||||
const label cellId = cells[i];
|
||||
|
||||
Q[cellId] =
|
||||
Qs_.boundaryField()[patchI][localFaceI]
|
||||
/thickness_[localFaceI];
|
||||
|
||||
rhoCp[cellId] *= delta_.value()/thickness_[localFaceI];
|
||||
|
||||
K[cellId] *= delta_.value()/thickness_[localFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Q = Q_;
|
||||
}
|
||||
|
||||
fvScalarMatrix TEqn
|
||||
(
|
||||
fvm::ddt(rhoCp, T_)
|
||||
- fvm::laplacian(K, T_)
|
||||
==
|
||||
Q
|
||||
);
|
||||
|
||||
TEqn.relax();
|
||||
TEqn.solve();
|
||||
|
||||
thermo_->correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
thermoBaffle2D::thermoBaffle2D
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh
|
||||
)
|
||||
:
|
||||
thermoBaffleModel(modelType, mesh),
|
||||
nNonOrthCorr_(readLabel(solution().lookup("nNonOrthCorr"))),
|
||||
thermo_(basicSolidThermo::New(regionMesh())),
|
||||
T_(thermo_->T()),
|
||||
Qs_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qs",
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar
|
||||
(
|
||||
"zero",
|
||||
dimEnergy/dimArea/dimTime,
|
||||
pTraits<scalar>::zero
|
||||
)
|
||||
),
|
||||
Q_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Q",
|
||||
regionMesh().time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::READ_IF_PRESENT,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh(),
|
||||
dimensionedScalar
|
||||
(
|
||||
"zero",
|
||||
dimEnergy/dimVolume/dimTime,
|
||||
pTraits<scalar>::zero
|
||||
)
|
||||
)
|
||||
{
|
||||
if (oneD_)
|
||||
{
|
||||
label patchI = intCoupledPatchIDs_[0];
|
||||
const label Qsb = Qs_.boundaryField()[patchI].size();
|
||||
if (Qsb!= thickness_.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermoBaffle2D::thermoBaffle2D"
|
||||
"("
|
||||
" const word& modelType,"
|
||||
" const fvMesh& mesh"
|
||||
")"
|
||||
) << "the boundary field of Qs is "
|
||||
<< Qsb << " and " << nl
|
||||
<< "the field 'thickness' is " << thickness_.size() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
thermo_->correct();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
thermoBaffle2D::~thermoBaffle2D()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void thermoBaffle2D::preEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
void thermoBaffle2D::evolveRegion()
|
||||
{
|
||||
for (int nonOrth=0; nonOrth<=nNonOrthCorr_; nonOrth++)
|
||||
{
|
||||
solveEnergy();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const tmp<volScalarField> thermoBaffle2D::Cp() const
|
||||
{
|
||||
return thermo_->Cp();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& thermoBaffle2D::kappa() const
|
||||
{
|
||||
return thermo_->kappa();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& thermoBaffle2D::rho() const
|
||||
{
|
||||
return thermo_->rho();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& thermoBaffle2D::K() const
|
||||
{
|
||||
return thermo_->K();
|
||||
}
|
||||
|
||||
|
||||
const volScalarField& thermoBaffle2D::T() const
|
||||
{
|
||||
return T_;
|
||||
}
|
||||
|
||||
|
||||
void thermoBaffle2D::info() const
|
||||
{
|
||||
Info<< indent << "min/max(T) = " << min(T_).value() << ", "
|
||||
<< max(T_).value() << nl;
|
||||
|
||||
const labelList& coupledPatches = intCoupledPatchIDs();
|
||||
forAll (coupledPatches, i)
|
||||
{
|
||||
const label patchI = coupledPatches[i];
|
||||
const fvPatchScalarField& pT = T_.boundaryField()[patchI];
|
||||
const word patchName = regionMesh().boundary()[patchI].name();
|
||||
Info << indent << "Q : " << patchName << indent <<
|
||||
gSum
|
||||
(
|
||||
mag(regionMesh().Sf().boundaryField()[patchI])
|
||||
* pT.snGrad()
|
||||
* thermo_->K().boundaryField()[patchI]
|
||||
) << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // end namespace thermoBaffleModels
|
||||
} // end namespace regionModels
|
||||
} // end namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,208 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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::thermoBaffle2D
|
||||
|
||||
Description
|
||||
2D thermal baffle
|
||||
|
||||
SourceFiles
|
||||
thermoBaffle2D.C
|
||||
thermoBaffle2DI.H
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef thermoBaffle2D_H
|
||||
#define thermoBaffle2D_H
|
||||
|
||||
#include "thermoBaffleModel.H"
|
||||
#include "basicSolidThermo.H"
|
||||
#include "volFieldsFwd.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermoBaffle2D Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class thermoBaffle2D
|
||||
:
|
||||
public thermoBaffleModel
|
||||
{
|
||||
private:
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
thermoBaffle2D(const thermoBaffle2D&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const thermoBaffle2D&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Solution parameters
|
||||
|
||||
//- Number of non orthogonal correctors
|
||||
label nNonOrthCorr_;
|
||||
|
||||
|
||||
// Thermo properties
|
||||
|
||||
//- Solid thermo
|
||||
autoPtr<basicSolidThermo> thermo_;
|
||||
|
||||
//- Temperature / [K]
|
||||
volScalarField& T_;
|
||||
|
||||
|
||||
// Source term fields
|
||||
|
||||
//- Surface energy source / [J/m2/s]
|
||||
volScalarField Qs_;
|
||||
|
||||
//- Volumetric energy source / [J/m3/s]
|
||||
volScalarField Q_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read();
|
||||
|
||||
// Equations
|
||||
|
||||
//- Solve energy equation
|
||||
virtual void solveEnergy();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("thermoBaffle2D");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
thermoBaffle2D(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~thermoBaffle2D();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Thermo properties
|
||||
|
||||
//- Return const reference to the basicSolidThermo
|
||||
inline const basicSolidThermo& thermo() const;
|
||||
|
||||
|
||||
// Fields
|
||||
|
||||
//- Return the film specific heat capacity [J/kg/K]
|
||||
virtual const tmp<volScalarField> Cp() const;
|
||||
|
||||
//- Return solid absortivity [1/m]
|
||||
virtual const volScalarField& kappa() const;
|
||||
|
||||
//- Return the film mean temperature [K]
|
||||
virtual const volScalarField& T() const;
|
||||
|
||||
//- Return density [Kg/m3]
|
||||
virtual const volScalarField& rho() const;
|
||||
|
||||
//- Return thermal conductivity [W/m/K]
|
||||
virtual const volScalarField& K() const;
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
//- Return sensible enthalpy as a function of temperature
|
||||
// for a patch
|
||||
inline tmp<scalarField> hs
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const;
|
||||
|
||||
//- Return sensible enthalpy as a function of temperature
|
||||
inline tmp<volScalarField> hs
|
||||
(
|
||||
const volScalarField& T
|
||||
) const;
|
||||
|
||||
//- Return temperature as a function of sensible enthalpy
|
||||
inline tmp<volScalarField> T
|
||||
(
|
||||
const volScalarField& hs
|
||||
) const;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve film
|
||||
virtual void preEvolveRegion();
|
||||
|
||||
//- Evolve the film equations
|
||||
virtual void evolveRegion();
|
||||
|
||||
|
||||
|
||||
// I-O
|
||||
|
||||
//- Provide some feedback
|
||||
virtual void info() const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "thermoBaffle2DI.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,114 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "thermoBaffle2D.H"
|
||||
#include "zeroGradientFvPatchFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
inline const basicSolidThermo& thermoBaffle2D::thermo() const
|
||||
{
|
||||
return thermo_;
|
||||
}
|
||||
|
||||
|
||||
inline tmp<scalarField> thermoBaffle2D::hs
|
||||
(
|
||||
const scalarField& T,
|
||||
const label patchI
|
||||
) const
|
||||
{
|
||||
const scalarField Cp(thermo_->Cp(patchI));
|
||||
return Cp*(T - 298.15);
|
||||
}
|
||||
|
||||
|
||||
inline tmp<volScalarField> thermoBaffle2D::hs
|
||||
(
|
||||
const volScalarField& T
|
||||
) const
|
||||
{
|
||||
const volScalarField Cp = thermo_->Cp()();
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"hs(" + T.name() + ")",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
Cp*(T - (dimensionedScalar("Tstd", dimTemperature, 298.15))),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
inline tmp<volScalarField> thermoBaffle2D::T
|
||||
(
|
||||
const volScalarField& hs
|
||||
) const
|
||||
{
|
||||
const volScalarField Cp = thermo_->Cp()();
|
||||
return tmp<volScalarField>
|
||||
(
|
||||
new volScalarField
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"T(" + hs.name() + ")",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::NO_READ,
|
||||
IOobject::NO_WRITE
|
||||
),
|
||||
hs/Cp + dimensionedScalar("Tstd", dimTemperature, 298.15),
|
||||
zeroGradientFvPatchScalarField::typeName
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,213 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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 "thermoBaffleModel.H"
|
||||
#include "fvMesh.H"
|
||||
#include "directMappedVariableThicknessWallPolyPatch.H"
|
||||
#include "wedgePolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
defineTypeNameAndDebug(thermoBaffleModel, 0);
|
||||
defineRunTimeSelectionTable(thermoBaffleModel, mesh);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
bool thermoBaffleModel::read()
|
||||
{
|
||||
regionModel1D::read();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
thermoBaffleModel::thermoBaffleModel(const fvMesh& mesh)
|
||||
:
|
||||
regionModel1D(mesh),
|
||||
thickness_(),
|
||||
delta_("delta", dimLength, 0.0),
|
||||
oneD_(false)
|
||||
{}
|
||||
|
||||
|
||||
thermoBaffleModel::thermoBaffleModel(const word& modelType, const fvMesh& mesh)
|
||||
:
|
||||
regionModel1D(mesh, "thermoBaffle", modelType),
|
||||
thickness_(),
|
||||
delta_("delta", dimLength, 0.0),
|
||||
oneD_(false)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
const polyBoundaryMesh& rbm = regionMesh().boundaryMesh();
|
||||
|
||||
// Check if region mesh in 1-D
|
||||
label nTotalEdges = 0;
|
||||
const label patchi = intCoupledPatchIDs_[0];
|
||||
nTotalEdges = 2*nLayers_*rbm[patchi].nInternalEdges();
|
||||
nTotalEdges +=
|
||||
nLayers_*(rbm[patchi].nEdges() - rbm[patchi].nInternalEdges());
|
||||
|
||||
reduce(nTotalEdges, sumOp<label>());
|
||||
|
||||
label nFaces = 0;
|
||||
forAll (rbm, patchi)
|
||||
{
|
||||
if (rbm[patchi].size() && isA<wedgePolyPatch>(rbm[patchi]))
|
||||
{
|
||||
nFaces += rbm[patchi].size();
|
||||
}
|
||||
}
|
||||
reduce(nFaces, sumOp<label>());
|
||||
|
||||
if (nTotalEdges == nFaces)
|
||||
{
|
||||
oneD_ = true;
|
||||
Info << "\nThe thermal baffle is 1D \n" << endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
Info << "\nThe thermal baffle is 3D \n" << endl;
|
||||
}
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
const polyPatch& pp = rbm[patchI];
|
||||
|
||||
if (!isA<directMappedVariableThicknessWallPolyPatch>(pp) && oneD_)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermoBaffleModel::thermoBaffleModel"
|
||||
"("
|
||||
" const word&,"
|
||||
" const fvMesh&"
|
||||
")"
|
||||
) << "\n patch type '" << pp.type()
|
||||
<< "' not type '"
|
||||
<< directMappedVariableThicknessWallPolyPatch::typeName
|
||||
<< "'. This is necessary for 1D solution"
|
||||
<< "\n for patch. " << pp.name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
else if (!isA<directMappedWallPolyPatch>(pp))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermoBaffleModel::thermoBaffleModel"
|
||||
"("
|
||||
" const word&,"
|
||||
" const fvMesh&"
|
||||
")"
|
||||
) << "\n patch type '" << pp.type()
|
||||
<< "' not type '"
|
||||
<< directMappedWallPolyPatch::typeName
|
||||
<< "'. This is necessary for 3D solution"
|
||||
<< "\n for patch. " << pp.name()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
if (oneD_)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[0];
|
||||
const polyPatch& pp = rbm[patchI];
|
||||
const directMappedVariableThicknessWallPolyPatch& ppCoupled =
|
||||
refCast
|
||||
<
|
||||
const directMappedVariableThicknessWallPolyPatch
|
||||
>(pp);
|
||||
|
||||
thickness_ = ppCoupled.thickness();
|
||||
|
||||
// Check that thickness has the right size
|
||||
if (thickness_.size() != pp.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"thermoBaffleModel::thermoBaffleModel"
|
||||
"("
|
||||
" const word&,"
|
||||
" const fvMesh&"
|
||||
")"
|
||||
) << " coupled patches in thermoBaffle are " << nl
|
||||
<< " different sizes from list thickness" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
// Calculate thickness of the baffle on the first face only.
|
||||
if (delta_.value() == 0.0)
|
||||
{
|
||||
forAll (ppCoupled, localFaceI)
|
||||
{
|
||||
label faceI = ppCoupled.start() + localFaceI;
|
||||
|
||||
label faceO =
|
||||
boundaryFaceOppositeFace_[localFaceI];
|
||||
|
||||
delta_.value() = mag
|
||||
(
|
||||
regionMesh().faceCentres()[faceI]
|
||||
- regionMesh().faceCentres()[faceO]
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
thermoBaffleModel::~thermoBaffleModel()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
void thermoBaffleModel::preEvolveRegion()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,189 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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::thermoBaffleModel
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
thermoBaffleModel.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef thermoBaffleModel_H
|
||||
#define thermoBaffleModel_H
|
||||
|
||||
#include "runTimeSelectionTables.H"
|
||||
#include "scalarIOField.H"
|
||||
#include "autoPtr.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "regionModel1D.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class thermoBaffleModel Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class thermoBaffleModel
|
||||
:
|
||||
public regionModel1D
|
||||
{
|
||||
private:
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
thermoBaffleModel(const thermoBaffleModel&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const thermoBaffleModel&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Data
|
||||
|
||||
//- Baffle physical thickness
|
||||
scalarField thickness_;
|
||||
|
||||
//- Baffle geometric thickness
|
||||
dimensionedScalar delta_;
|
||||
|
||||
//- Is it one dimension
|
||||
bool oneD_;
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
virtual bool read();
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("thermoBaffleModel");
|
||||
|
||||
|
||||
// Declare runtime constructor selection table
|
||||
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
thermoBaffleModel,
|
||||
mesh,
|
||||
(
|
||||
const word& modelType,
|
||||
const fvMesh& mesh
|
||||
),
|
||||
(modelType, mesh)
|
||||
);
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null from mesh
|
||||
thermoBaffleModel(const fvMesh& mesh);
|
||||
|
||||
//- Construct from type name and mesh
|
||||
thermoBaffleModel(const word& modelType, const fvMesh& mesh);
|
||||
|
||||
|
||||
// Selectors
|
||||
|
||||
//- Return a reference to the selected model
|
||||
static autoPtr<thermoBaffleModel> New(const fvMesh& mesh);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~thermoBaffleModel();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
|
||||
//- Return thickness
|
||||
const scalarField& thickness() const
|
||||
{
|
||||
return thickness_;
|
||||
}
|
||||
|
||||
//- Return geometrical thickness
|
||||
const dimensionedScalar& delta() const
|
||||
{
|
||||
return delta_;
|
||||
}
|
||||
|
||||
//- Return if region is one dimensional
|
||||
bool oneD() const
|
||||
{
|
||||
return oneD_;
|
||||
}
|
||||
|
||||
|
||||
// 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<volScalarField> 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;
|
||||
|
||||
|
||||
// Evolution
|
||||
|
||||
//- Pre-evolve region
|
||||
virtual void preEvolveRegion();
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,85 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2011-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 "thermoBaffleModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
namespace regionModels
|
||||
{
|
||||
namespace thermoBaffleModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
autoPtr<thermoBaffleModel> thermoBaffleModel::New(const fvMesh& mesh)
|
||||
{
|
||||
|
||||
word modelType;
|
||||
{
|
||||
IOdictionary thermoBafflePropertiesDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"thermoBaffleProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
thermoBafflePropertiesDict.lookup("thermoBaffleModel") >> modelType;
|
||||
}
|
||||
Info<< "Selecting baffle model " << modelType << endl;
|
||||
|
||||
meshConstructorTable::iterator cstrIter =
|
||||
meshConstructorTablePtr_->find(modelType);
|
||||
|
||||
if (cstrIter == meshConstructorTablePtr_->end())
|
||||
{
|
||||
|
||||
FatalErrorIn("thermoBaffleModel::New(const fvMesh&)")
|
||||
<< "Unknown thermoBaffleModel type " << modelType
|
||||
<< nl << nl
|
||||
<< "Valid thermoBaffleModel types are:" << nl
|
||||
<< meshConstructorTablePtr_->sortedToc()
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<thermoBaffleModel>(cstrIter()(modelType, mesh));
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace thermoBaffleModels
|
||||
} // End namespace regionModels
|
||||
} // End namespace Foam
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -76,7 +76,7 @@ void Foam::csvSetWriter<Type>::write
|
||||
columns[i] = valueSets[i];
|
||||
}
|
||||
|
||||
writeTable(points, columns, os);
|
||||
this->writeTable(points, columns, os);
|
||||
}
|
||||
|
||||
|
||||
@ -110,7 +110,7 @@ void Foam::csvSetWriter<Type>::write
|
||||
columns[i] = &valueSets[i][trackI];
|
||||
}
|
||||
|
||||
writeTable(points[trackI], columns, os);
|
||||
this->writeTable(points[trackI], columns, os);
|
||||
os << nl << nl;
|
||||
}
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@ wmake $makeType SLGThermo
|
||||
|
||||
# Should be combined with solids&solidMixture
|
||||
wmake $makeType basicSolidThermo
|
||||
wmake $makeType solidChemistryModel
|
||||
|
||||
wmake $makeType radiationModels
|
||||
|
||||
|
||||
@ -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<class CompType, class ThermoType>
|
||||
Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
||||
(
|
||||
const fvMesh& mesh,
|
||||
const word& compTypeName,
|
||||
const word& ODEModelName,
|
||||
const word& thermoTypeName
|
||||
)
|
||||
:
|
||||
@ -56,16 +56,6 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
|
||||
nSpecie_(Y_.size()),
|
||||
nReaction_(reactions_.size()),
|
||||
|
||||
solver_
|
||||
(
|
||||
chemistrySolver<CompType, ThermoType>::New
|
||||
(
|
||||
*this,
|
||||
compTypeName,
|
||||
thermoTypeName
|
||||
)
|
||||
),
|
||||
|
||||
RR_(nSpecie_)
|
||||
{
|
||||
// create the fields for the chemistry sources
|
||||
@ -135,6 +125,88 @@ Foam::ODEChemistryModel<CompType, ThermoType>::omega
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::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<ThermoType>& R = reactions_[index];
|
||||
scalar w = omega(R, c, T, p, pf, cf, lRef, pr, cr, rRef);
|
||||
return(w);
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
void Foam::ODEChemistryModel<CompType, ThermoType>::updateConcsInReactionI
|
||||
(
|
||||
const label index,
|
||||
const scalar dt,
|
||||
const scalar omeg,
|
||||
scalarField& c
|
||||
) const
|
||||
{
|
||||
// update species
|
||||
const Reaction<ThermoType>& 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<class CompType, class ThermoType>
|
||||
void Foam::ODEChemistryModel<CompType, ThermoType>::updateRRInReactionI
|
||||
(
|
||||
const label index,
|
||||
const scalar pr,
|
||||
const scalar pf,
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const
|
||||
{
|
||||
const Reaction<ThermoType>& 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<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::omega
|
||||
(
|
||||
@ -731,7 +803,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::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,30 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::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);
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -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 CompType, class ThermoType>
|
||||
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<chemistrySolver<CompType, ThermoType> > solver_;
|
||||
|
||||
//- List of reaction rate per specie [kg/m3/s]
|
||||
PtrList<scalarField> 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<CompType, ThermoType>& solver() const;
|
||||
|
||||
//- dc/dt = omega, rate of change in concentration, for each species
|
||||
virtual tmp<scalarField> 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<scalar>& 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;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -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<CompType, ThermoType>::nReaction() const
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
inline const Foam::chemistrySolver<CompType, ThermoType>&
|
||||
Foam::ODEChemistryModel<CompType, ThermoType>::solver() const
|
||||
{
|
||||
return solver_;
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
inline Foam::tmp<Foam::volScalarField>
|
||||
Foam::ODEChemistryModel<CompType, ThermoType>::RR
|
||||
|
||||
@ -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
|
||||
@ -21,9 +21,6 @@ License
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
InClass
|
||||
Foam::psiChemistryModel
|
||||
|
||||
Description
|
||||
Macros for instantiating chemistry models based on compressibility and
|
||||
transport types
|
||||
@ -44,21 +41,27 @@ namespace Foam
|
||||
|
||||
#define makeChemistryModel(SS, Comp, Thermo) \
|
||||
\
|
||||
typedef SS<Comp, Thermo> SS##Comp##Thermo; \
|
||||
typedef SS<Comp, Thermo> SS##Comp##Thermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
0 \
|
||||
); \
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
0 \
|
||||
);
|
||||
|
||||
|
||||
#define makeSolidChemistryModel(SS, Comp, SThermo, GThermo) \
|
||||
\
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##Comp##Thermo, \
|
||||
fvMesh \
|
||||
);
|
||||
typedef SS<Comp, SThermo, GThermo> SS##Comp##SThermo##GThermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##SThermo##GThermo, \
|
||||
#SS"<"#Comp","#SThermo","#GThermo">", \
|
||||
0 \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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
|
||||
@ -32,24 +32,40 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word userModel
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("psiChemistryModel")
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
wordHashSet validModels;
|
||||
forAll(models, i)
|
||||
{
|
||||
label delim = models[i].find('<');
|
||||
validModels.insert(models[i](0, delim));
|
||||
}
|
||||
|
||||
wordHashSet::iterator solverIter = validModels.find(solver);
|
||||
if (solverIter == validModels.end())
|
||||
{
|
||||
FatalErrorIn("psiChemistryModel::New(const fvMesh&)")
|
||||
<< "Valid chemistrySolver types are:" << validModels
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("psiChemistryModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
@ -59,7 +75,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
className + '<' + typeName + ',' + thermoTypeName + '>';
|
||||
solver + '<' + className + '<' + typeName + ',' + thermoTypeName + ">>";
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -77,7 +93,7 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("psiChemistryModel::New(const mesh&)")
|
||||
<< "Unknown psiChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid psiChemistryModel types are:" << nl
|
||||
@ -86,16 +102,22 @@ Foam::autoPtr<Foam::psiChemistryModel> Foam::psiChemistryModel::New
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
wordList allModels(fvMeshConstructorTablePtr_->sortedToc());
|
||||
wordHashSet models;
|
||||
forAll(allModels, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
const label tempOpen = allModels[i].find('<');
|
||||
const label tempClose = allModels[i].rfind('>');
|
||||
word modelName =
|
||||
allModels[i](tempOpen + 1, tempClose - tempOpen - 1);
|
||||
modelName = modelName.replace(typeName + ',', "");
|
||||
models.insert(modelName);
|
||||
}
|
||||
|
||||
FatalErrorIn("psiChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("psiChemistryModel::New(const mesh&)")
|
||||
<< "Unknown psiChemistryModel type " << userModel
|
||||
<< nl << nl << "Valid psiChemistryModel types are:" << nl
|
||||
<< models << nl << exit(FatalError);
|
||||
<< nl << nl << "Valid psiChemistryModel types are:"
|
||||
<< models << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -32,24 +32,40 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
const fvMesh& mesh
|
||||
)
|
||||
{
|
||||
// get model name, but do not register the dictionary
|
||||
// otherwise it is registered in the database twice
|
||||
const word userModel
|
||||
IOdictionary chemistryPropertiesDict
|
||||
(
|
||||
IOdictionary
|
||||
IOobject
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
).lookup("rhoChemistryModel")
|
||||
"chemistryProperties",
|
||||
mesh.time().constant(),
|
||||
mesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE,
|
||||
false
|
||||
)
|
||||
);
|
||||
|
||||
const word solver(chemistryPropertiesDict.lookup("chemistrySolver"));
|
||||
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
wordHashSet validModels;
|
||||
forAll(models, i)
|
||||
{
|
||||
label delim = models[i].find('<');
|
||||
validModels.insert(models[i](0, delim));
|
||||
}
|
||||
|
||||
wordHashSet::iterator solverIter = validModels.find(solver);
|
||||
if (solverIter == validModels.end())
|
||||
{
|
||||
FatalErrorIn("rhoChemistryModel::New(const fvMesh&)")
|
||||
<< "Valid chemistrySolver types are:" << validModels
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
const word userModel(chemistryPropertiesDict.lookup("rhoChemistryModel"));
|
||||
|
||||
// construct chemistry model type name by inserting first template argument
|
||||
const label tempOpen = userModel.find('<');
|
||||
const label tempClose = userModel.find('>');
|
||||
@ -59,7 +75,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
userModel(tempOpen + 1, tempClose - tempOpen - 1);
|
||||
|
||||
const word modelType =
|
||||
className + '<' + typeName + ',' + thermoTypeName + '>';
|
||||
solver + '<' + className + '<' + typeName + ',' + thermoTypeName + ">>";
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -77,7 +93,7 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||
FatalErrorIn("rhoChemistryModel::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type "
|
||||
<< modelType << nl << nl
|
||||
<< "Valid rhoChemistryModel types are:" << nl
|
||||
@ -86,18 +102,22 @@ Foam::autoPtr<Foam::rhoChemistryModel> Foam::rhoChemistryModel::New
|
||||
}
|
||||
else
|
||||
{
|
||||
wordList models = fvMeshConstructorTablePtr_->sortedToc();
|
||||
forAll(models, i)
|
||||
wordList allModels(fvMeshConstructorTablePtr_->sortedToc());
|
||||
wordHashSet models;
|
||||
forAll(allModels, i)
|
||||
{
|
||||
models[i] = models[i].replace(typeName + ',', "");
|
||||
const label tempOpen = allModels[i].find('<');
|
||||
const label tempClose = allModels[i].rfind('>');
|
||||
word modelName =
|
||||
allModels[i](tempOpen + 1, tempClose - tempOpen - 1);
|
||||
modelName = modelName.replace(typeName + ',', "");
|
||||
models.insert(modelName);
|
||||
}
|
||||
|
||||
FatalErrorIn("rhoChemistryModelBase::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type "
|
||||
<< userModel << nl << nl
|
||||
<< "Valid rhoChemistryModel types are:" << nl
|
||||
<< models << nl
|
||||
<< exit(FatalError);
|
||||
FatalErrorIn("rhoChemistryModel::New(const mesh&)")
|
||||
<< "Unknown rhoChemistryModel type " << userModel
|
||||
<< nl << nl << "Valid rhoChemistryModel types are:"
|
||||
<< models << exit(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
@ -29,15 +29,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
||||
template<class ODEChemistryType>
|
||||
Foam::EulerImplicit<ODEChemistryType>::EulerImplicit
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict("EulerImplicitCoeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
@ -45,15 +46,15 @@ Foam::EulerImplicit<CompType, ThermoType>::EulerImplicit
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::EulerImplicit<CompType, ThermoType>::~EulerImplicit()
|
||||
template<class ODEChemistryType>
|
||||
Foam::EulerImplicit<ODEChemistryType>::~EulerImplicit()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::EulerImplicit<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
@ -62,7 +63,10 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::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<scalar> RR(nSpecie, 0, 0);
|
||||
|
||||
for (label i = 0; i < nSpecie; i++)
|
||||
@ -75,17 +79,9 @@ Foam::scalar Foam::EulerImplicit<CompType, ThermoType>::solve
|
||||
RR.source()[i] = c[i]/dt;
|
||||
}
|
||||
|
||||
forAll(this->model_.reactions(), i)
|
||||
forAll(this->reactions(), i)
|
||||
{
|
||||
const Reaction<ThermoType>& 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<CompType, ThermoType>::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<CompType, ThermoType>::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<CompType, ThermoType>::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);
|
||||
|
||||
|
||||
@ -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 CompType, class ThermoType>
|
||||
class EulerImplicit;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class EulerImplicit Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class EulerImplicit
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -81,8 +77,9 @@ public:
|
||||
//- Construct from components
|
||||
EulerImplicit
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& 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,
|
||||
|
||||
@ -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
|
||||
@ -27,22 +27,23 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::chemistrySolver<CompType, ThermoType>::chemistrySolver
|
||||
template<class ODEChemistryType>
|
||||
Foam::chemistrySolver<ODEChemistryType>::chemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& 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<class CompType, class ThermoType>
|
||||
Foam::chemistrySolver<CompType, ThermoType>::~chemistrySolver()
|
||||
template<class ODEChemistryType>
|
||||
Foam::chemistrySolver<ODEChemistryType>::~chemistrySolver()
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -38,32 +38,25 @@ SourceFiles
|
||||
#include "ODEChemistryModel.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "scalarField.H"
|
||||
#include "autoPtr.H"
|
||||
#include "runTimeSelectionTables.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class chemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class chemistrySolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class chemistrySolver
|
||||
:
|
||||
public ODEChemistryType
|
||||
{
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Reference to the chemistry model
|
||||
ODEChemistryModel<CompType, ThermoType>& model_;
|
||||
|
||||
//- Name of the chemistry solver
|
||||
const word name_;
|
||||
|
||||
@ -74,39 +67,17 @@ public:
|
||||
TypeName("chemistrySolver");
|
||||
|
||||
|
||||
// Declare runtime constructor selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
chemistrySolver,
|
||||
dictionary,
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
),
|
||||
(model, modelName)
|
||||
);
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
chemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<chemistrySolver> New
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& compTypeName,
|
||||
const word& thermoTypeName
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
virtual ~chemistrySolver();
|
||||
|
||||
@ -131,46 +102,60 @@ public:
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeChemistrySolver(Comp, Thermo) \
|
||||
\
|
||||
typedef chemistrySolver<Comp, Thermo> \
|
||||
chemistrySolver##Comp##Thermo; \
|
||||
#define makeChemistrySolver(ODEChem) \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
chemistrySolver##Comp##Thermo, \
|
||||
"chemistryModel<"#Comp","#Thermo">", \
|
||||
chemistrySolver<ODEChem>, \
|
||||
"chemistrySolver<"#ODEChem">", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
( \
|
||||
chemistrySolver##Comp##Thermo, \
|
||||
dictionary \
|
||||
);
|
||||
|
||||
|
||||
#define makeChemistrySolverType(SS, Comp, Thermo) \
|
||||
|
||||
#define makeChemistrySolverType(SS, ODEChem, Comp, Thermo) \
|
||||
\
|
||||
typedef SS<Comp, Thermo> SS##Comp##Thermo; \
|
||||
typedef SS<ODEChem<Comp, Thermo> > SS##ODEChem##Comp##Thermo; \
|
||||
\
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##Thermo, \
|
||||
#SS"<"#Comp","#Thermo">", \
|
||||
SS##ODEChem##Comp##Thermo, \
|
||||
#SS"<"#ODEChem"<"#Comp","#Thermo">>", \
|
||||
0 \
|
||||
); \
|
||||
\
|
||||
chemistrySolver<Comp, Thermo>:: \
|
||||
adddictionaryConstructorToTable<SS<Comp, Thermo> > \
|
||||
add##SS##Comp##Thermo##ConstructorToTable_;
|
||||
addToRunTimeSelectionTable \
|
||||
( \
|
||||
Comp, \
|
||||
SS##ODEChem##Comp##Thermo, \
|
||||
fvMesh \
|
||||
);
|
||||
|
||||
|
||||
#define makeSolidChemistrySolverType(SS, ODEChem, Comp, SThermo, GThermo) \
|
||||
\
|
||||
typedef SS<ODEChem<Comp, SThermo, GThermo> > \
|
||||
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
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "chemistrySolver.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::autoPtr<Foam::chemistrySolver<CompType, ThermoType> >
|
||||
Foam::chemistrySolver<CompType, ThermoType>::New
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& 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<chemistrySolver<CompType, ThermoType> >
|
||||
(cstrIter()(model, modelName));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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 <http://www.gnu.org/licenses/>.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#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> 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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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<class CompType, class ThermoType>
|
||||
Foam::noChemistrySolver<CompType, ThermoType>::noChemistrySolver
|
||||
template<class ODEChemistryType>
|
||||
Foam::noChemistrySolver<ODEChemistryType>::noChemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName)
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::noChemistrySolver<CompType, ThermoType>::~noChemistrySolver()
|
||||
template<class ODEChemistryType>
|
||||
Foam::noChemistrySolver<ODEChemistryType>::~noChemistrySolver()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::noChemistrySolver<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::noChemistrySolver<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField&,
|
||||
const scalar,
|
||||
|
||||
@ -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 CompType, class ThermoType>
|
||||
class noChemistrySolver;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class noChemistrySolver Declaration
|
||||
Class noChemistrySolver Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class noChemistrySolver
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
|
||||
public:
|
||||
@ -69,8 +65,9 @@ public:
|
||||
//- Construct from components
|
||||
noChemistrySolver
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -81,7 +78,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Update the concentrations and return the chemical time
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
|
||||
@ -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
|
||||
@ -28,32 +28,33 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::ode<CompType, ThermoType>::ode
|
||||
template<class ODEChemistryType>
|
||||
Foam::ode<ODEChemistryType>::ode
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
solverName_(coeffsDict_.lookup("ODESolver")),
|
||||
odeSolver_(ODESolver::New(solverName_, model)),
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict("odeCoeffs")),
|
||||
solverName_(coeffsDict_.lookup("solver")),
|
||||
odeSolver_(ODESolver::New(solverName_, *this)),
|
||||
eps_(readScalar(coeffsDict_.lookup("eps")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::ode<CompType, ThermoType>::~ode()
|
||||
template<class ODEChemistryType>
|
||||
Foam::ode<ODEChemistryType>::~ode()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::ode<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::ode<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField& c,
|
||||
const scalar T,
|
||||
@ -62,8 +63,8 @@ Foam::scalar Foam::ode<CompType, ThermoType>::solve
|
||||
const scalar dt
|
||||
) const
|
||||
{
|
||||
label nSpecie = this->model_.nSpecie();
|
||||
scalarField c1(this->model_.nEqns(), 0.0);
|
||||
label nSpecie = this->nSpecie();
|
||||
scalarField c1(this->nEqns(), 0.0);
|
||||
|
||||
// copy the concentration, T and P to the total solve-vector
|
||||
for (label i = 0; i < nSpecie; i++)
|
||||
@ -77,7 +78,7 @@ Foam::scalar Foam::ode<CompType, ThermoType>::solve
|
||||
|
||||
odeSolver_->solve
|
||||
(
|
||||
this->model_,
|
||||
*this,
|
||||
t0,
|
||||
t0 + dt,
|
||||
c1,
|
||||
|
||||
@ -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
|
||||
@ -43,18 +43,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class ode;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ode Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class ode
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -78,8 +74,9 @@ public:
|
||||
//- Construct from components
|
||||
ode
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModeNewlName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -89,7 +86,7 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField& c,
|
||||
const scalar T,
|
||||
|
||||
@ -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
|
||||
@ -28,15 +28,16 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::sequential<CompType, ThermoType>::sequential
|
||||
template<class ODEChemistryType>
|
||||
Foam::sequential<ODEChemistryType>::sequential
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
)
|
||||
:
|
||||
chemistrySolver<CompType, ThermoType>(model, modelName),
|
||||
coeffsDict_(model.subDict(modelName + "Coeffs")),
|
||||
chemistrySolver<ODEChemistryType>(mesh, ODEModelName, thermoType),
|
||||
coeffsDict_(this->subDict("sequentialCoeffs")),
|
||||
cTauChem_(readScalar(coeffsDict_.lookup("cTauChem"))),
|
||||
eqRateLimiter_(coeffsDict_.lookup("equilibriumRateLimiter"))
|
||||
{}
|
||||
@ -44,15 +45,15 @@ Foam::sequential<CompType, ThermoType>::sequential
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::sequential<CompType, ThermoType>::~sequential()
|
||||
template<class ODEChemistryType>
|
||||
Foam::sequential<ODEChemistryType>::~sequential()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
template<class ODEChemistryType>
|
||||
Foam::scalar Foam::sequential<ODEChemistryType>::solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
@ -66,14 +67,9 @@ Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
scalar pf, cf, pb, cb;
|
||||
label lRef, rRef;
|
||||
|
||||
forAll(this->model_.reactions(), i)
|
||||
forAll(this->reactions(), i)
|
||||
{
|
||||
const Reaction<ThermoType>& R = this->model_.reactions()[i];
|
||||
|
||||
scalar omega = this->model_.omega
|
||||
(
|
||||
R, c, T, p, pf, cf, lRef, pb, cb, rRef
|
||||
);
|
||||
scalar omega = this->omegaI(i, c, T, p, pf, cf, lRef, pb, cb, rRef);
|
||||
|
||||
if (eqRateLimiter_)
|
||||
{
|
||||
@ -89,23 +85,7 @@ Foam::scalar Foam::sequential<CompType, ThermoType>::solve
|
||||
|
||||
tChemInv = max(tChemInv, mag(omega));
|
||||
|
||||
|
||||
// update species
|
||||
forAll(R.lhs(), specieI)
|
||||
{
|
||||
const label id = R.lhs()[specieI].index;
|
||||
const scalar sc = R.lhs()[specieI].stoichCoeff;
|
||||
c[id] -= dt*sc*omega;
|
||||
c[id] = max(0.0, c[id]);
|
||||
}
|
||||
|
||||
forAll(R.rhs(), specieI)
|
||||
{
|
||||
const label id = R.rhs()[specieI].index;
|
||||
const scalar sc = R.rhs()[specieI].stoichCoeff;
|
||||
c[id] += dt*sc*omega;
|
||||
c[id] = max(0.0, c[id]);
|
||||
}
|
||||
this->updateConcsInReactionI(i, dt, omega, c);
|
||||
}
|
||||
|
||||
return cTauChem_/tChemInv;
|
||||
|
||||
@ -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
|
||||
@ -44,18 +44,14 @@ SourceFiles
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
// Forward declaration of classes
|
||||
template<class CompType, class ThermoType>
|
||||
class sequential;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class sequential Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CompType, class ThermoType>
|
||||
template<class ODEChemistryType>
|
||||
class sequential
|
||||
:
|
||||
public chemistrySolver<CompType, ThermoType>
|
||||
public chemistrySolver<ODEChemistryType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
@ -83,8 +79,9 @@ public:
|
||||
//- Construct from components
|
||||
sequential
|
||||
(
|
||||
ODEChemistryModel<CompType, ThermoType>& model,
|
||||
const word& modelName
|
||||
const fvMesh& mesh,
|
||||
const word& ODEModelName,
|
||||
const word& thermoType
|
||||
);
|
||||
|
||||
|
||||
@ -95,7 +92,7 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Update the concentrations and return the chemical time
|
||||
scalar solve
|
||||
virtual scalar solve
|
||||
(
|
||||
scalarField &c,
|
||||
const scalar T,
|
||||
|
||||
@ -189,6 +189,8 @@ updateCoeffs()
|
||||
|
||||
ray.Qr().boundaryField()[patchI] += Iw*(n & ray.dAve());
|
||||
|
||||
scalarList temissivity = emissivity();
|
||||
|
||||
forAll(Iw, faceI)
|
||||
{
|
||||
scalar Ir = 0.0;
|
||||
@ -217,8 +219,8 @@ updateCoeffs()
|
||||
valueFraction()[faceI] = 1.0;
|
||||
refValue()[faceI] =
|
||||
(
|
||||
Ir*(scalar(1.0) - emissivity()()[faceI])
|
||||
+ emissivity()()[faceI]*physicoChemical::sigma.value()
|
||||
Ir*(scalar(1.0) - temissivity[faceI])
|
||||
+ temissivity[faceI]*physicoChemical::sigma.value()
|
||||
* pow4(Tp[faceI])
|
||||
)/pi;
|
||||
|
||||
@ -238,7 +240,6 @@ updateCoeffs()
|
||||
Iw[faceI]*(n[faceI] & ray.dAve());
|
||||
}
|
||||
}
|
||||
|
||||
mixedFvPatchScalarField::updateCoeffs();
|
||||
}
|
||||
|
||||
|
||||
@ -127,7 +127,7 @@ Foam::radiationCoupledBase::radiationCoupledBase
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
|
||||
Foam::scalarField Foam::radiationCoupledBase::emissivity() const
|
||||
{
|
||||
switch (method_)
|
||||
{
|
||||
@ -142,6 +142,9 @@ Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
|
||||
|
||||
const polyMesh& nbrMesh = mpp.sampleMesh();
|
||||
|
||||
// Force recalculation of mapping and schedule
|
||||
const mapDistribute& distMap = mpp.map();
|
||||
|
||||
const fvPatch& nbrPatch = refCast<const fvMesh>
|
||||
(
|
||||
nbrMesh
|
||||
@ -160,12 +163,11 @@ Foam::tmp<Foam::scalarField> Foam::radiationCoupledBase::emissivity() const
|
||||
)
|
||||
);
|
||||
|
||||
scalarField& emissivity = temissivity();
|
||||
|
||||
scalarField emissivity(temissivity);
|
||||
// Use direct map mapping to exchange data
|
||||
mpp.map().distribute(emissivity);
|
||||
|
||||
return temissivity;
|
||||
distMap.distribute(emissivity);
|
||||
//Pout << emissivity << endl;
|
||||
return emissivity;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -114,7 +114,7 @@ public:
|
||||
|
||||
|
||||
//- Calculate corresponding emissivity field
|
||||
tmp<scalarField> emissivity() const;
|
||||
scalarField emissivity() const;
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user