Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
andy
2010-02-08 19:13:37 +00:00
93 changed files with 5041 additions and 2548 deletions

View File

@ -26,8 +26,13 @@ Application
coalChemistryFoam coalChemistryFoam
Description Description
Transient solver for compressible, turbulent flow with coal and Transient solver for:
limestone parcel injections, and combustion. - compressible,
- turbulent flow,
with
- coal and limestone parcel injections,
- energy source, and
- combustion.
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -38,7 +43,7 @@ Description
#include "CoalCloud.H" #include "CoalCloud.H"
#include "psiChemistryModel.H" #include "psiChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "timeActivatedExplicitCellSource.H" #include "timeActivatedExplicitSource.H"
#include "radiationModel.H" #include "radiationModel.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -127,10 +127,11 @@
fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p) fvc::DDt(surfaceScalarField("phiU", phi/fvc::interpolate(rho)), p)
); );
Info<< "\nConstructing explicit enthalpy cell source" << endl; Info<< "\nConstructing explicit enthalpy source" << endl;
timeActivatedExplicitCellSource enthalpySource scalarTimeActivatedExplicitSourceList enthalpySource
( (
"enthalpySource", "energy",
mesh, mesh,
h.dimensions()*phi.dimensions()/mesh.V().dimensions() dimEnergy/dimTime/dimVolume,
"h"
); );

View File

@ -7,6 +7,7 @@
== ==
rho.dimensionedInternalField()*g rho.dimensionedInternalField()*g
+ parcels.SU() + parcels.SU()
+ momentumSource.Su()
); );
pZones.addResistance(UEqn); pZones.addResistance(UEqn);

View File

@ -28,7 +28,7 @@ tmp<fv::convectionScheme<scalar> > mvConvection
== ==
parcels.Srho(i) parcels.Srho(i)
+ kappa*chemistry.RR(i)().dimensionedInternalField() + kappa*chemistry.RR(i)().dimensionedInternalField()
+ pointMassSources.Su(i), + massSource.Su(i),
mesh.solver("Yi") mesh.solver("Yi")
); );

View File

@ -1,5 +1,5 @@
Info<< "\nConstructing reacting cloud" << endl; Info<< "\nConstructing reacting cloud" << endl;
icoPoly8ThermoReactingCloud parcels icoPoly8ThermoReactingMultiphaseCloud parcels
( (
"reactingCloud1", "reactingCloud1",
rho, rho,

View File

@ -0,0 +1,27 @@
Info<< "Creating mass source\n" << endl;
scalarTimeActivatedExplicitSourceList massSource
(
"mass",
mesh,
dimMass/dimTime/dimVolume,
composition.species()
);
Info<< "Creating momentum source\n" << endl;
vectorTimeActivatedExplicitSourceList momentumSource
(
"momentum",
mesh,
dimMass*dimVelocity/dimTime/dimVolume,
"U"
);
Info<< "Creating energy source\n" << endl;
scalarTimeActivatedExplicitSourceList energySource
(
"energy",
mesh,
dimEnergy/dimTime/dimVolume,
"h"
);

View File

@ -1,8 +0,0 @@
Info<< "\nConstructing multi-component mass flow rate point sources" << endl;
timeActivatedExplicitMulticomponentPointSource pointMassSources
(
"pointMassSources",
mesh,
Y,
dimMass/dimVolume/dimTime
);

View File

@ -39,6 +39,7 @@
pWork() pWork()
+ parcels.Sh() + parcels.Sh()
+ radiation->Sh(thermo) + radiation->Sh(thermo)
+ energySource.Su()
); );
thermo.correct(); thermo.correct();

View File

@ -32,7 +32,7 @@
- fvm::laplacian(rho*rAU, p) - fvm::laplacian(rho*rAU, p)
== ==
parcels.Srho() parcels.Srho()
+ pointMassSources.Su() + massSource.SuTot()
); );
if (corr == nCorr-1 && nonOrth == nNonOrthCorr) if (corr == nCorr-1 && nonOrth == nNonOrthCorr)

View File

@ -27,10 +27,11 @@ Application
Description Description
Transient PISO solver for compressible, laminar or turbulent flow with Transient PISO solver for compressible, laminar or turbulent flow with
reacting Lagrangian parcels for porous media, including explicit sources reacting multiphase Lagrangian parcels for porous media, including explicit
sources for mass, momentum and energy
The solver includes: The solver includes:
- reacting parcel cloud - reacting multiphase parcel cloud
- porous media - porous media
- point mass sources - point mass sources
- polynomial based, incompressible thermodynamics (f(T)) - polynomial based, incompressible thermodynamics (f(T))
@ -43,12 +44,12 @@ Description
#include "fvCFD.H" #include "fvCFD.H"
#include "hReactionThermo.H" #include "hReactionThermo.H"
#include "turbulenceModel.H" #include "turbulenceModel.H"
#include "BasicReactingCloud.H" #include "BasicReactingMultiphaseCloud.H"
#include "rhoChemistryModel.H" #include "rhoChemistryModel.H"
#include "chemistrySolver.H" #include "chemistrySolver.H"
#include "radiationModel.H" #include "radiationModel.H"
#include "porousZones.H" #include "porousZones.H"
#include "timeActivatedExplicitMulticomponentPointSource.H" #include "timeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -63,7 +64,7 @@ int main(int argc, char *argv[])
#include "createFields.H" #include "createFields.H"
#include "createRadiationModel.H" #include "createRadiationModel.H"
#include "createClouds.H" #include "createClouds.H"
#include "createMulticomponentPointSources.H" #include "createExplicitSources.H"
#include "createPorousZones.H" #include "createPorousZones.H"
#include "initContinuityErrs.H" #include "initContinuityErrs.H"
#include "readTimeControls.H" #include "readTimeControls.H"

View File

@ -37,7 +37,7 @@ Description
+ fvc::div(phi) + fvc::div(phi)
== ==
parcels.Srho() parcels.Srho()
+ pointMassSources.Su() + massSource.SuTot()
); );
rhoEqn.relax(); rhoEqn.relax();

View File

@ -53,7 +53,7 @@ int main(int argc, char *argv[])
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch(); const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
// Test:print shared points // Test:print (collocated) shared points
{ {
const labelListList& globalPointSlaves = const labelListList& globalPointSlaves =
globalData.globalPointSlaves(); globalData.globalPointSlaves();
@ -90,7 +90,7 @@ int main(int argc, char *argv[])
// Test: point to faces addressing // Test: (collocated) point to faces addressing
{ {
const labelListList& globalPointBoundaryFaces = const labelListList& globalPointBoundaryFaces =
globalData.globalPointBoundaryFaces(); globalData.globalPointBoundaryFaces();
@ -137,7 +137,7 @@ int main(int argc, char *argv[])
// Test:point to cells addressing // Test:(collocated) point to cells addressing
{ {
const labelList& boundaryCells = globalData.boundaryCells(); const labelList& boundaryCells = globalData.boundaryCells();
const labelListList& globalPointBoundaryCells = const labelListList& globalPointBoundaryCells =
@ -172,7 +172,7 @@ int main(int argc, char *argv[])
// Test:print shared edges // Test:print (collocated) shared edges
{ {
const labelListList& globalEdgeSlaves = const labelListList& globalEdgeSlaves =
globalData.globalEdgeSlaves(); globalData.globalEdgeSlaves();

View File

@ -1,7 +1,7 @@
// ignore special fields or fields that we don't handle // ignore special fields or fields that we don't handle
// //
bool variableGood = true; bool variableGood = true;
for (label n1=startTime; n1<endTime && variableGood; ++n1) for (label n1=0; n1<Times.size() && variableGood; ++n1)
{ {
// ignore _0 fields // ignore _0 fields
if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0") if (fieldName.size() > 2 && fieldName(fieldName.size() - 2, 2) == "_0")

View File

@ -19,7 +19,7 @@ if (Pstream::master())
Info<< "Correcting time values. Adding " << Tcorr << endl; Info<< "Correcting time values. Adding " << Tcorr << endl;
} }
for (int n=startTime; n<endTime; n++) forAll(Times, n)
{ {
ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " "; ensightCaseFile << setw(12) << Times[n].value() + Tcorr << " ";

View File

@ -185,7 +185,6 @@ void writeAllFaceData
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const Field<Type>& pf, const Field<Type>& pf,
const labelList& patchProcessors,
OFstream& ensightFile OFstream& ensightFile
) )
{ {
@ -199,11 +198,8 @@ void writeAllFaceData
{ {
writeData(map(pf, prims, cmpt), ensightFile); writeData(map(pf, prims, cmpt), ensightFile);
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave); scalarField pf(fromSlave);
@ -211,7 +207,6 @@ void writeAllFaceData
} }
} }
} }
}
else else
{ {
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
@ -231,7 +226,6 @@ void writeAllFaceDataBinary
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const Field<Type>& pf, const Field<Type>& pf,
const labelList& patchProcessors,
std::ofstream& ensightFile std::ofstream& ensightFile
) )
{ {
@ -245,11 +239,8 @@ void writeAllFaceDataBinary
{ {
writeEnsDataBinary(map(pf, prims, cmpt), ensightFile); writeEnsDataBinary(map(pf, prims, cmpt), ensightFile);
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
scalarField pf(fromSlave); scalarField pf(fromSlave);
@ -257,7 +248,6 @@ void writeAllFaceDataBinary
} }
} }
} }
}
else else
{ {
for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++) for (direction cmpt=0; cmpt<pTraits<Type>::nComponents; cmpt++)
@ -278,7 +268,6 @@ bool writePatchField
const Foam::label ensightPatchI, const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet, const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp, const Foam::ensightMesh::nFacePrimitives& nfp,
const Foam::labelList& patchProcessors,
Foam::OFstream& ensightFile Foam::OFstream& ensightFile
) )
{ {
@ -297,7 +286,6 @@ bool writePatchField
boundaryFaceSet.tris, boundaryFaceSet.tris,
nfp.nTris, nfp.nTris,
pf, pf,
patchProcessors,
ensightFile ensightFile
); );
@ -307,7 +295,6 @@ bool writePatchField
boundaryFaceSet.quads, boundaryFaceSet.quads,
nfp.nQuads, nfp.nQuads,
pf, pf,
patchProcessors,
ensightFile ensightFile
); );
@ -317,7 +304,6 @@ bool writePatchField
boundaryFaceSet.polys, boundaryFaceSet.polys,
nfp.nPolys, nfp.nPolys,
pf, pf,
patchProcessors,
ensightFile ensightFile
); );
@ -338,7 +324,6 @@ bool writePatchFieldBinary
const Foam::label ensightPatchI, const Foam::label ensightPatchI,
const Foam::faceSets& boundaryFaceSet, const Foam::faceSets& boundaryFaceSet,
const Foam::ensightMesh::nFacePrimitives& nfp, const Foam::ensightMesh::nFacePrimitives& nfp,
const Foam::labelList& patchProcessors,
std::ofstream& ensightFile std::ofstream& ensightFile
) )
{ {
@ -356,7 +341,6 @@ bool writePatchFieldBinary
boundaryFaceSet.tris, boundaryFaceSet.tris,
nfp.nTris, nfp.nTris,
pf, pf,
patchProcessors,
ensightFile ensightFile
); );
@ -366,7 +350,6 @@ bool writePatchFieldBinary
boundaryFaceSet.quads, boundaryFaceSet.quads,
nfp.nQuads, nfp.nQuads,
pf, pf,
patchProcessors,
ensightFile ensightFile
); );
@ -376,7 +359,6 @@ bool writePatchFieldBinary
boundaryFaceSet.polys, boundaryFaceSet.polys,
nfp.nPolys, nfp.nPolys,
pf, pf,
patchProcessors,
ensightFile ensightFile
); );
@ -406,7 +388,6 @@ void writePatchField
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets(); const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const wordList& allPatchNames = eMesh.allPatchNames(); const wordList& allPatchNames = eMesh.allPatchNames();
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
@ -425,8 +406,6 @@ void writePatchField
} }
const labelList& patchProcessors = allPatchProcs[patchi];
word pfName = patchName + '.' + fieldName; word pfName = patchName + '.' + fieldName;
word timeFile = prepend + itoa(timeIndex); word timeFile = prepend + itoa(timeIndex);
@ -473,7 +452,6 @@ void writePatchField
ensightPatchI, ensightPatchI,
boundaryFaceSets[patchi], boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile ensightFile
); );
} }
@ -488,7 +466,6 @@ void writePatchField
ensightPatchI, ensightPatchI,
nullFaceSets, nullFaceSets,
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile ensightFile
); );
} }
@ -521,7 +498,6 @@ void ensightFieldAscii
const cellSets& meshCellSets = eMesh.meshCellSets(); const cellSets& meshCellSets = eMesh.meshCellSets();
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets(); const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const wordList& allPatchNames = eMesh.allPatchNames(); const wordList& allPatchNames = eMesh.allPatchNames();
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
const wordHashSet& patchNames = eMesh.patchNames(); const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
@ -619,11 +595,8 @@ void ensightFieldAscii
forAll(allPatchNames, patchi) forAll(allPatchNames, patchi)
{ {
const word& patchName = allPatchNames[patchi]; const word& patchName = allPatchNames[patchi];
const labelList& patchProcessors = allPatchProcs[patchi];
if (patchNames.empty() || patchNames.found(patchName)) if (patchNames.empty() || patchNames.found(patchName))
{
if (mesh.boundary()[patchi].size())
{ {
if if
( (
@ -634,36 +607,12 @@ void ensightFieldAscii
ensightPatchI, ensightPatchI,
boundaryFaceSets[patchi], boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile ensightFile
) )
) )
{ {
ensightPatchI++; ensightPatchI++;
} }
}
else if (Pstream::master())
{
faceSets nullFaceSet;
if
(
writePatchField
(
Field<Type>(),
-1,
ensightPatchI,
nullFaceSet,
nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile
)
)
{
ensightPatchI++;
}
}
} }
} }
@ -695,7 +644,6 @@ void ensightFieldBinary
const cellSets& meshCellSets = eMesh.meshCellSets(); const cellSets& meshCellSets = eMesh.meshCellSets();
const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets(); const List<faceSets>& boundaryFaceSets = eMesh.boundaryFaceSets();
const wordList& allPatchNames = eMesh.allPatchNames(); const wordList& allPatchNames = eMesh.allPatchNames();
const List<labelList>& allPatchProcs = eMesh.allPatchProcs();
const wordHashSet& patchNames = eMesh.patchNames(); const wordHashSet& patchNames = eMesh.patchNames();
const HashTable<ensightMesh::nFacePrimitives>& const HashTable<ensightMesh::nFacePrimitives>&
nPatchPrims = eMesh.nPatchPrims(); nPatchPrims = eMesh.nPatchPrims();
@ -819,11 +767,8 @@ void ensightFieldBinary
forAll(allPatchNames, patchi) forAll(allPatchNames, patchi)
{ {
const word& patchName = allPatchNames[patchi]; const word& patchName = allPatchNames[patchi];
const labelList& patchProcessors = allPatchProcs[patchi];
if (patchNames.empty() || patchNames.found(patchName)) if (patchNames.empty() || patchNames.found(patchName))
{
if (mesh.boundary()[patchi].size())
{ {
if if
( (
@ -834,36 +779,12 @@ void ensightFieldBinary
ensightPatchI, ensightPatchI,
boundaryFaceSets[patchi], boundaryFaceSets[patchi],
nPatchPrims.find(patchName)(), nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile ensightFile
) )
) )
{ {
ensightPatchI++; ensightPatchI++;
} }
}
else if (Pstream::master())
{
faceSets nullFaceSet;
if
(
writePatchFieldBinary
(
Field<Type>(),
-1,
ensightPatchI,
nullFaceSet,
nPatchPrims.find(patchName)(),
patchProcessors,
ensightFile
)
)
{
ensightPatchI++;
}
}
} }
} }

View File

@ -43,42 +43,6 @@ License
// * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * Private Functions * * * * * * * * * * * * * * //
namespace Foam
{
//- Proxy-class to hold the patch processor list combination operator
class concatPatchProcs
{
public:
void operator()
(
List<labelList>& x,
const List<labelList>& y
) const
{
forAll(y, i)
{
const labelList& yPatches = y[i];
if (yPatches.size())
{
labelList& xPatches = x[i];
label offset = xPatches.size();
xPatches.setSize(offset + yPatches.size());
forAll(yPatches, i)
{
xPatches[i + offset] = yPatches[i];
}
}
}
}
};
} // End namespace Foam
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::ensightMesh::ensightMesh Foam::ensightMesh::ensightMesh
@ -94,7 +58,6 @@ Foam::ensightMesh::ensightMesh
meshCellSets_(mesh_.nCells()), meshCellSets_(mesh_.nCells()),
boundaryFaceSets_(mesh_.boundary().size()), boundaryFaceSets_(mesh_.boundary().size()),
allPatchNames_(0), allPatchNames_(0),
allPatchProcs_(0),
patchNames_(0), patchNames_(0),
nPatchPrims_(0) nPatchPrims_(0)
{ {
@ -108,6 +71,9 @@ Foam::ensightMesh::ensightMesh
if (!args.optionFound("noPatches")) if (!args.optionFound("noPatches"))
{ {
// Patches are output. Check that they're synced.
mesh_.boundaryMesh().checkParallelSync(true);
allPatchNames_ = wordList::subList allPatchNames_ = wordList::subList
( (
mesh_.boundaryMesh().names(), mesh_.boundaryMesh().names(),
@ -115,19 +81,6 @@ Foam::ensightMesh::ensightMesh
- mesh_.globalData().processorPatches().size() - mesh_.globalData().processorPatches().size()
); );
allPatchProcs_.setSize(allPatchNames_.size());
forAll(allPatchProcs_, patchi)
{
if (mesh_.boundary()[patchi].size())
{
allPatchProcs_[patchi].setSize(1);
allPatchProcs_[patchi][0] = Pstream::myProcNo();
}
}
combineReduce(allPatchProcs_, concatPatchProcs());
if (args.optionFound("patches")) if (args.optionFound("patches"))
{ {
wordList patchNameList(args.optionLookup("patches")()); wordList patchNameList(args.optionLookup("patches")());
@ -275,14 +228,12 @@ Foam::ensightMesh::ensightMesh
{ {
if (mesh.boundary()[patchi].size()) if (mesh.boundary()[patchi].size())
{ {
nfp.nPoints = mesh.boundaryMesh()[patchi].localPoints().size();
nfp.nTris = boundaryFaceSets_[patchi].tris.size(); nfp.nTris = boundaryFaceSets_[patchi].tris.size();
nfp.nQuads = boundaryFaceSets_[patchi].quads.size(); nfp.nQuads = boundaryFaceSets_[patchi].quads.size();
nfp.nPolys = boundaryFaceSets_[patchi].polys.size(); nfp.nPolys = boundaryFaceSets_[patchi].polys.size();
} }
} }
reduce(nfp.nPoints, sumOp<label>());
reduce(nfp.nTris, sumOp<label>()); reduce(nfp.nTris, sumOp<label>());
reduce(nfp.nQuads, sumOp<label>()); reduce(nfp.nQuads, sumOp<label>());
reduce(nfp.nPolys, sumOp<label>()); reduce(nfp.nPolys, sumOp<label>());
@ -300,114 +251,6 @@ Foam::ensightMesh::~ensightMesh()
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::globalIndex Foam::ensightMesh::mergeMeshPoints
(
labelList& pointToGlobal,
pointField& uniquePoints
) const
{
const globalMeshData& globalData = mesh_.globalData();
const indirectPrimitivePatch& coupledPatch = globalData.coupledPatch();
const labelListList& globalPointSlaves =
globalData.globalPointSlaves();
const mapDistribute& globalPointSlavesMap =
globalData.globalPointSlavesMap();
// 1. Count number of masters on my processor.
label nCoupledMaster = 0;
PackedBoolList isMaster(mesh_.nPoints(), 1);
forAll(globalPointSlaves, pointI)
{
const labelList& slavePoints = globalPointSlaves[pointI];
if (slavePoints.size() > 0)
{
nCoupledMaster++;
}
else
{
isMaster[coupledPatch.meshPoints()[pointI]] = 0;
}
}
label myUniquePoints =
mesh_.nPoints()
- coupledPatch.nPoints()
+ nCoupledMaster;
//Pout<< "Points :" << nl
// << " mesh : " << mesh_.nPoints() << nl
// << " of which coupled : " << coupledPatch.nPoints() << nl
// << " of which master : " << nCoupledMaster << nl
// << endl;
// 2. Create global indexing for unique points.
globalIndex globalPoints(myUniquePoints);
// 3. Assign global point numbers. Keep slaves unset.
pointToGlobal.setSize(mesh_.nPoints());
pointToGlobal = -1;
uniquePoints.setSize(myUniquePoints);
label nMaster = 0;
forAll(isMaster, meshPointI)
{
if (isMaster[meshPointI])
{
pointToGlobal[meshPointI] = globalPoints.toGlobal(nMaster);
uniquePoints[nMaster] = mesh_.points()[meshPointI];
nMaster++;
}
}
// 4. Push global index for coupled points to slaves.
{
labelList masterToGlobal(globalPointSlavesMap.constructSize(), -1);
forAll(globalPointSlaves, pointI)
{
const labelList& slaves = globalPointSlaves[pointI];
if (slaves.size() > 0)
{
// Duplicate master globalpoint into slave slots
label meshPointI = coupledPatch.meshPoints()[pointI];
masterToGlobal[pointI] = pointToGlobal[meshPointI];
forAll(slaves, i)
{
masterToGlobal[slaves[i]] = masterToGlobal[pointI];
}
}
}
// Send back
globalPointSlavesMap.reverseDistribute
(
coupledPatch.nPoints(),
masterToGlobal
);
// On slave copy master index into overall map.
forAll(globalPointSlaves, pointI)
{
const labelList& slaves = globalPointSlaves[pointI];
if (slaves.size() == 0)
{
label meshPointI = coupledPatch.meshPoints()[pointI];
pointToGlobal[meshPointI] = masterToGlobal[pointI];
}
}
}
return globalPoints;
}
void Foam::ensightMesh::writePoints void Foam::ensightMesh::writePoints
( (
const scalarField& pointsComponent, const scalarField& pointsComponent,
@ -990,21 +833,18 @@ void Foam::ensightMesh::writeAllPrimsBinary
void Foam::ensightMesh::writeFacePrims void Foam::ensightMesh::writeFacePrims
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const ) const
{ {
if (patchFaces.size()) if (patchFaces.size())
{ {
label po = pointOffset + 1;
forAll(patchFaces, i) forAll(patchFaces, i)
{ {
const face& patchFace = patchFaces[i]; const face& patchFace = patchFaces[i];
forAll(patchFace, pointI) forAll(patchFace, pointI)
{ {
ensightGeometryFile << setw(10) << patchFace[pointI] + po; ensightGeometryFile << setw(10) << patchFace[pointI] + 1;
} }
ensightGeometryFile << nl; ensightGeometryFile << nl;
} }
@ -1015,21 +855,18 @@ void Foam::ensightMesh::writeFacePrims
void Foam::ensightMesh::writeFacePrimsBinary void Foam::ensightMesh::writeFacePrimsBinary
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const ) const
{ {
if (patchFaces.size()) if (patchFaces.size())
{ {
label po = pointOffset + 1;
forAll(patchFaces, i) forAll(patchFaces, i)
{ {
const face& patchFace = patchFaces[i]; const face& patchFace = patchFaces[i];
forAll(patchFace, pointI) forAll(patchFace, pointI)
{ {
writeEnsDataBinary(patchFace[pointI] + po, ensightGeometryFile); writeEnsDataBinary(patchFace[pointI] + 1, ensightGeometryFile);
} }
} }
} }
@ -1042,8 +879,6 @@ void Foam::ensightMesh::writeAllFacePrims
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const ) const
{ {
@ -1053,34 +888,21 @@ void Foam::ensightMesh::writeAllFacePrims
{ {
ensightGeometryFile << key << nl << setw(10) << nPrims << nl; ensightGeometryFile << key << nl << setw(10) << nPrims << nl;
if (&prims != NULL)
{
writeFacePrims writeFacePrims
( (
UIndirectList<face>(patchFaces, prims)(), UIndirectList<face>(patchFaces, prims)(),
0,
ensightGeometryFile ensightGeometryFile
); );
}
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave); faceList patchFaces(fromSlave);
writeFacePrims writeFacePrims(patchFaces, ensightGeometryFile);
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
} }
} }
} else
else if (&prims != NULL)
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< UIndirectList<face>(patchFaces, prims); toMaster<< UIndirectList<face>(patchFaces, prims);
@ -1105,11 +927,10 @@ void Foam::ensightMesh::writeNSidedNPointsPerFace
void Foam::ensightMesh::writeNSidedPoints void Foam::ensightMesh::writeNSidedPoints
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const ) const
{ {
writeFacePrims(patchFaces, pointOffset, ensightGeometryFile); writeFacePrims(patchFaces, ensightGeometryFile);
} }
@ -1118,8 +939,6 @@ void Foam::ensightMesh::writeAllNSided
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const ) const
{ {
@ -1133,21 +952,15 @@ void Foam::ensightMesh::writeAllNSided
// Number of points for each face // Number of points for each face
if (Pstream::master()) if (Pstream::master())
{
if (&prims != NULL)
{ {
writeNSidedNPointsPerFace writeNSidedNPointsPerFace
( (
UIndirectList<face>(patchFaces, prims)(), UIndirectList<face>(patchFaces, prims)(),
ensightGeometryFile ensightGeometryFile
); );
}
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave); faceList patchFaces(fromSlave);
@ -1158,8 +971,7 @@ void Foam::ensightMesh::writeAllNSided
); );
} }
} }
} else
else if (&prims != NULL)
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< UIndirectList<face>(patchFaces, prims); toMaster<< UIndirectList<face>(patchFaces, prims);
@ -1167,35 +979,22 @@ void Foam::ensightMesh::writeAllNSided
// List of points id for each face // List of points id for each face
if (Pstream::master()) if (Pstream::master())
{
if (&prims != NULL)
{ {
writeNSidedPoints writeNSidedPoints
( (
UIndirectList<face>(patchFaces, prims)(), UIndirectList<face>(patchFaces, prims)(),
0,
ensightGeometryFile ensightGeometryFile
); );
}
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave); faceList patchFaces(fromSlave);
writeNSidedPoints writeNSidedPoints(patchFaces, ensightGeometryFile);
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
} }
} }
} else
else if (&prims != NULL)
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< UIndirectList<face>(patchFaces, prims); toMaster<< UIndirectList<face>(patchFaces, prims);
@ -1207,16 +1006,10 @@ void Foam::ensightMesh::writeAllNSided
void Foam::ensightMesh::writeNSidedPointsBinary void Foam::ensightMesh::writeNSidedPointsBinary
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const ) const
{ {
writeFacePrimsBinary writeFacePrimsBinary(patchFaces, ensightGeometryFile);
(
patchFaces,
pointOffset,
ensightGeometryFile
);
} }
@ -1228,11 +1021,7 @@ void Foam::ensightMesh::writeNSidedNPointsPerFaceBinary
{ {
forAll(patchFaces, i) forAll(patchFaces, i)
{ {
writeEnsDataBinary writeEnsDataBinary(patchFaces[i].size(), ensightGeometryFile);
(
patchFaces[i].size(),
ensightGeometryFile
);
} }
} }
@ -1242,8 +1031,6 @@ void Foam::ensightMesh::writeAllNSidedBinary
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const ) const
{ {
@ -1257,21 +1044,15 @@ void Foam::ensightMesh::writeAllNSidedBinary
// Number of points for each face // Number of points for each face
if (Pstream::master()) if (Pstream::master())
{
if (&prims != NULL)
{ {
writeNSidedNPointsPerFaceBinary writeNSidedNPointsPerFaceBinary
( (
UIndirectList<face>(patchFaces, prims)(), UIndirectList<face>(patchFaces, prims)(),
ensightGeometryFile ensightGeometryFile
); );
}
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave); faceList patchFaces(fromSlave);
@ -1282,8 +1063,7 @@ void Foam::ensightMesh::writeAllNSidedBinary
); );
} }
} }
} else
else if (&prims != NULL)
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< UIndirectList<face>(patchFaces, prims); toMaster<< UIndirectList<face>(patchFaces, prims);
@ -1291,35 +1071,22 @@ void Foam::ensightMesh::writeAllNSidedBinary
// List of points id for each face // List of points id for each face
if (Pstream::master()) if (Pstream::master())
{
if (&prims != NULL)
{ {
writeNSidedPointsBinary writeNSidedPointsBinary
( (
UIndirectList<face>(patchFaces, prims)(), UIndirectList<face>(patchFaces, prims)(),
0,
ensightGeometryFile ensightGeometryFile
); );
}
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave); faceList patchFaces(fromSlave);
writeNSidedPointsBinary writeNSidedPointsBinary(patchFaces, ensightGeometryFile);
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
} }
} }
} else
else if (&prims != NULL)
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< UIndirectList<face>(patchFaces, prims); toMaster<< UIndirectList<face>(patchFaces, prims);
@ -1334,8 +1101,6 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const ) const
{ {
@ -1351,29 +1116,19 @@ void Foam::ensightMesh::writeAllFacePrimsBinary
writeFacePrimsBinary writeFacePrimsBinary
( (
UIndirectList<face>(patchFaces, prims)(), UIndirectList<face>(patchFaces, prims)(),
0,
ensightGeometryFile ensightGeometryFile
); );
} }
forAll(patchProcessors, i) for (int slave=1; slave<Pstream::nProcs(); slave++)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
faceList patchFaces(fromSlave); faceList patchFaces(fromSlave);
writeFacePrimsBinary writeFacePrimsBinary(patchFaces, ensightGeometryFile);
(
patchFaces,
pointOffsets[i],
ensightGeometryFile
);
} }
} }
} else
else if (&prims != NULL)
{ {
OPstream toMaster(Pstream::scheduled, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster<< UIndirectList<face>(patchFaces, prims); toMaster<< UIndirectList<face>(patchFaces, prims);
@ -1390,13 +1145,42 @@ void Foam::ensightMesh::write
Ostream& ensightCaseFile Ostream& ensightCaseFile
) const ) const
{ {
// Find global point numbering
labelList pointToGlobal;
labelList uniquePointMap;
autoPtr<globalIndex> globalPoints = mesh_.globalData().mergePoints
(
pointToGlobal,
uniquePointMap
);
const pointField uniquePoints(mesh_.points(), uniquePointMap);
if (binary_) if (binary_)
{ {
writeBinary(postProcPath, prepend, timeIndex, ensightCaseFile); writeBinary
(
postProcPath,
prepend,
timeIndex,
ensightCaseFile,
pointToGlobal,
uniquePoints,
globalPoints()
);
} }
else else
{ {
writeAscii(postProcPath, prepend, timeIndex, ensightCaseFile); writeAscii
(
postProcPath,
prepend,
timeIndex,
ensightCaseFile,
pointToGlobal,
uniquePoints,
globalPoints()
);
} }
} }
@ -1406,24 +1190,16 @@ void Foam::ensightMesh::writeAscii
const fileName& postProcPath, const fileName& postProcPath,
const word& prepend, const word& prepend,
const label timeIndex, const label timeIndex,
Ostream& ensightCaseFile Ostream& ensightCaseFile,
const labelList& pointToGlobal,
const pointField& uniquePoints,
const globalIndex& globalPoints
) const ) const
{ {
const Time& runTime = mesh_.time(); const Time& runTime = mesh_.time();
//const pointField& points = mesh_.points(); //const pointField& points = mesh_.points();
const cellShapeList& cellShapes = mesh_.cellShapes(); const cellShapeList& cellShapes = mesh_.cellShapes();
// Find global point numbering
labelList pointToGlobal;
pointField uniquePoints;
globalIndex globalPoints
(
mergeMeshPoints
(
pointToGlobal,
uniquePoints
)
);
word timeFile = prepend; word timeFile = prepend;
@ -1558,40 +1334,38 @@ void Foam::ensightMesh::writeAscii
forAll(allPatchNames_, patchi) forAll(allPatchNames_, patchi)
{ {
const word& patchName = allPatchNames_[patchi]; const word& patchName = allPatchNames_[patchi];
const labelList& patchProcessors = allPatchProcs_[patchi];
if (patchNames_.empty() || patchNames_.found(patchName)) if (patchNames_.empty() || patchNames_.found(patchName))
{ {
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); const nFacePrimitives& nfp = nPatchPrims_[patchName];
const labelList *trisPtr = NULL;
const labelList *quadsPtr = NULL;
const labelList *polysPtr = NULL;
const pointField *patchPointsPtr = NULL;
const faceList *patchFacesPtr = NULL;
if (mesh_.boundary()[patchi].size())
{
const polyPatch& p = mesh_.boundaryMesh()[patchi];
trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchi].polys;
patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces());
}
if (nfp.nTris || nfp.nQuads || nfp.nPolys) if (nfp.nTris || nfp.nQuads || nfp.nPolys)
{ {
const labelList& tris = *trisPtr; const polyPatch& p = mesh_.boundaryMesh()[patchi];
const labelList& quads = *quadsPtr; const labelList& tris = boundaryFaceSets_[patchi].tris;
const labelList& polys = *polysPtr; const labelList& quads = boundaryFaceSets_[patchi].quads;
const pointField& patchPoints = *patchPointsPtr; const labelList& polys = boundaryFaceSets_[patchi].polys;
const faceList& patchFaces = *patchFacesPtr;
// Renumber the patch points/faces into unique points
labelList pointToGlobal;
labelList uniquePointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh_.globalData().mergePoints
(
p.meshPoints(),
p.meshPointMap(),
pointToGlobal,
uniquePointLabels
);
pointField uniquePoints(p.localPoints(), uniquePointLabels);
// Renumber the patch faces
faceList patchFaces(p.localFaces());
forAll(patchFaces, i)
{
inplaceRenumber(pointToGlobal, patchFaces[i]);
}
labelList patchPointOffsets(Pstream::nProcs(), 0);
if (Pstream::master()) if (Pstream::master())
{ {
@ -1600,27 +1374,19 @@ void Foam::ensightMesh::writeAscii
<< setw(10) << ensightPatchI++ << nl << setw(10) << ensightPatchI++ << nl
<< patchName << nl << patchName << nl
<< "coordinates" << nl << "coordinates" << nl
<< setw(10) << nfp.nPoints << setw(10) << globalPointsPtr().size()
<< endl; << endl;
for (direction d=0; d<vector::nComponents; d++) for (direction d=0; d<vector::nComponents; d++)
{
if (patchPointsPtr)
{ {
writePoints writePoints
( (
patchPoints.component(d), uniquePoints.component(d),
ensightGeometryFile ensightGeometryFile
); );
}
patchPointOffsets = 0; for (int slave=1; slave<Pstream::nProcs(); slave++)
forAll(patchProcessors, i)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
scalarField patchPointsComponent(fromSlave); scalarField patchPointsComponent(fromSlave);
@ -1629,27 +1395,10 @@ void Foam::ensightMesh::writeAscii
patchPointsComponent, patchPointsComponent,
ensightGeometryFile ensightGeometryFile
); );
}
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPointsComponent.size();
} }
} }
else else
{
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPoints.size();
}
}
}
}
}
else if (patchPointsPtr)
{ {
for (direction d=0; d<vector::nComponents; d++) for (direction d=0; d<vector::nComponents; d++)
{ {
@ -1658,7 +1407,7 @@ void Foam::ensightMesh::writeAscii
Pstream::scheduled, Pstream::scheduled,
Pstream::masterNo() Pstream::masterNo()
); );
toMaster<< patchPoints.component(d); toMaster<< uniquePoints.component(d);
} }
} }
@ -1668,8 +1417,6 @@ void Foam::ensightMesh::writeAscii
tris, tris,
nfp.nTris, nfp.nTris,
patchFaces, patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile ensightGeometryFile
); );
@ -1679,8 +1426,6 @@ void Foam::ensightMesh::writeAscii
quads, quads,
nfp.nQuads, nfp.nQuads,
patchFaces, patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile ensightGeometryFile
); );
@ -1689,8 +1434,6 @@ void Foam::ensightMesh::writeAscii
polys, polys,
nfp.nPolys, nfp.nPolys,
patchFaces, patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile ensightGeometryFile
); );
} }
@ -1709,24 +1452,14 @@ void Foam::ensightMesh::writeBinary
const fileName& postProcPath, const fileName& postProcPath,
const word& prepend, const word& prepend,
const label timeIndex, const label timeIndex,
Ostream& ensightCaseFile Ostream& ensightCaseFile,
const labelList& pointToGlobal,
const pointField& uniquePoints,
const globalIndex& globalPoints
) const ) const
{ {
const cellShapeList& cellShapes = mesh_.cellShapes(); const cellShapeList& cellShapes = mesh_.cellShapes();
// Find global point numbering
labelList pointToGlobal;
pointField uniquePoints;
globalIndex globalPoints
(
mergeMeshPoints
(
pointToGlobal,
uniquePoints
)
);
word timeFile = prepend; word timeFile = prepend;
if (timeIndex == 0) if (timeIndex == 0)
@ -1854,40 +1587,37 @@ void Foam::ensightMesh::writeBinary
{ {
iCount ++; iCount ++;
const word& patchName = allPatchNames_[patchi]; const word& patchName = allPatchNames_[patchi];
const labelList& patchProcessors = allPatchProcs_[patchi];
if (patchNames_.empty() || patchNames_.found(patchName)) if (patchNames_.empty() || patchNames_.found(patchName))
{ {
const nFacePrimitives& nfp = nPatchPrims_.find(patchName)(); const nFacePrimitives& nfp = nPatchPrims_.find(patchName)();
const labelList *trisPtr = NULL;
const labelList *quadsPtr = NULL;
const labelList *polysPtr = NULL;
const pointField *patchPointsPtr = NULL;
const faceList *patchFacesPtr = NULL;
if (mesh_.boundary()[patchi].size())
{
const polyPatch& p = mesh_.boundaryMesh()[patchi];
trisPtr = &boundaryFaceSets_[patchi].tris;
quadsPtr = &boundaryFaceSets_[patchi].quads;
polysPtr = &boundaryFaceSets_[patchi].polys;
patchPointsPtr = &(p.localPoints());
patchFacesPtr = &(p.localFaces());
}
if (nfp.nTris || nfp.nQuads || nfp.nPolys) if (nfp.nTris || nfp.nQuads || nfp.nPolys)
{ {
const labelList& tris = *trisPtr; const polyPatch& p = mesh_.boundaryMesh()[patchi];
const labelList& quads = *quadsPtr; const labelList& tris = boundaryFaceSets_[patchi].tris;
const labelList& polys = *polysPtr; const labelList& quads = boundaryFaceSets_[patchi].quads;
const pointField& patchPoints = *patchPointsPtr; const labelList& polys = boundaryFaceSets_[patchi].polys;
const faceList& patchFaces = *patchFacesPtr;
// Renumber the patch points/faces into unique points
labelList pointToGlobal;
labelList uniquePointLabels;
autoPtr<globalIndex> globalPointsPtr =
mesh_.globalData().mergePoints
(
p.meshPoints(),
p.meshPointMap(),
pointToGlobal,
uniquePointLabels
);
pointField uniquePoints(p.localPoints(), uniquePointLabels);
// Renumber the patch faces
faceList patchFaces(p.localFaces());
forAll(patchFaces, i)
{
inplaceRenumber(pointToGlobal, patchFaces[i]);
}
labelList patchPointOffsets(Pstream::nProcs(), 0);
if (Pstream::master()) if (Pstream::master())
{ {
@ -1896,28 +1626,23 @@ void Foam::ensightMesh::writeBinary
//writeEnsDataBinary(patchName.c_str(),ensightGeometryFile); //writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
writeEnsDataBinary(patchName.c_str(),ensightGeometryFile); writeEnsDataBinary(patchName.c_str(),ensightGeometryFile);
writeEnsDataBinary("coordinates",ensightGeometryFile); writeEnsDataBinary("coordinates",ensightGeometryFile);
writeEnsDataBinary(nfp.nPoints,ensightGeometryFile); writeEnsDataBinary
(
globalPointsPtr().size(),
ensightGeometryFile
);
for (direction d=0; d<vector::nComponents; d++) for (direction d=0; d<vector::nComponents; d++)
{
if (patchPointsPtr)
{ {
//writePointsBinary //writePointsBinary
writeEnsDataBinary writeEnsDataBinary
( (
patchPoints.component(d), uniquePoints.component(d),
ensightGeometryFile ensightGeometryFile
); );
}
patchPointOffsets = 0; for (int slave=1; slave<Pstream::nProcs(); slave++)
forAll(patchProcessors, i)
{ {
if (patchProcessors[i] != 0)
{
label slave = patchProcessors[i];
IPstream fromSlave(Pstream::scheduled, slave); IPstream fromSlave(Pstream::scheduled, slave);
scalarField patchPointsComponent(fromSlave); scalarField patchPointsComponent(fromSlave);
@ -1927,27 +1652,10 @@ void Foam::ensightMesh::writeBinary
patchPointsComponent, patchPointsComponent,
ensightGeometryFile ensightGeometryFile
); );
}
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPointsComponent.size();
} }
} }
else else
{
if (i < Pstream::nProcs()-1)
{
patchPointOffsets[i+1] =
patchPointOffsets[i]
+ patchPoints.size();
}
}
}
}
}
else if (patchPointsPtr)
{ {
for (direction d=0; d<vector::nComponents; d++) for (direction d=0; d<vector::nComponents; d++)
{ {
@ -1956,7 +1664,7 @@ void Foam::ensightMesh::writeBinary
Pstream::scheduled, Pstream::scheduled,
Pstream::masterNo() Pstream::masterNo()
); );
toMaster<< patchPoints.component(d); toMaster<< uniquePoints.component(d);
} }
} }
@ -1966,8 +1674,6 @@ void Foam::ensightMesh::writeBinary
tris, tris,
nfp.nTris, nfp.nTris,
patchFaces, patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile ensightGeometryFile
); );
@ -1977,8 +1683,6 @@ void Foam::ensightMesh::writeBinary
quads, quads,
nfp.nQuads, nfp.nQuads,
patchFaces, patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile ensightGeometryFile
); );
@ -1987,8 +1691,6 @@ void Foam::ensightMesh::writeBinary
polys, polys,
nfp.nPolys, nfp.nPolys,
patchFaces, patchFaces,
patchPointOffsets,
patchProcessors,
ensightGeometryFile ensightGeometryFile
); );
} }

View File

@ -63,14 +63,12 @@ public:
{ {
public: public:
label nPoints;
label nTris; label nTris;
label nQuads; label nQuads;
label nPolys; label nPolys;
nFacePrimitives() nFacePrimitives()
: :
nPoints(0),
nTris(0), nTris(0),
nQuads(0), nQuads(0),
nPolys(0) nPolys(0)
@ -96,8 +94,6 @@ private:
wordList allPatchNames_; wordList allPatchNames_;
List<labelList> allPatchProcs_;
wordHashSet patchNames_; wordHashSet patchNames_;
HashTable<nFacePrimitives> nPatchPrims_; HashTable<nFacePrimitives> nPatchPrims_;
@ -111,16 +107,6 @@ private:
//- Disallow default bitwise assignment //- Disallow default bitwise assignment
void operator=(const ensightMesh&); void operator=(const ensightMesh&);
//- Construct map from mesh points to merged points.
// pointToGlobal : from mesh point to global point
// uniquePoints : my set of unique points
globalIndex mergeMeshPoints
(
labelList& pointToGlobal,
pointField& uniquePoints
) const;
void writePoints void writePoints
( (
const scalarField& pointsComponent, const scalarField& pointsComponent,
@ -188,7 +174,6 @@ private:
void writeFacePrims void writeFacePrims
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
@ -198,8 +183,6 @@ private:
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
@ -212,7 +195,6 @@ private:
void writeNSidedPoints void writeNSidedPoints
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
@ -221,8 +203,6 @@ private:
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
OFstream& ensightGeometryFile OFstream& ensightGeometryFile
) const; ) const;
@ -231,7 +211,10 @@ private:
const fileName& postProcPath, const fileName& postProcPath,
const word& prepend, const word& prepend,
const label timeIndex, const label timeIndex,
Ostream& ensightCaseFile Ostream& ensightCaseFile,
const labelList& pointToGlobal,
const pointField& uniquePoints,
const globalIndex& globalPoints
) const; ) const;
void writeBinary void writeBinary
@ -239,7 +222,10 @@ private:
const fileName& postProcPath, const fileName& postProcPath,
const word& prepend, const word& prepend,
const label timeIndex, const label timeIndex,
Ostream& ensightCaseFile Ostream& ensightCaseFile,
const labelList& pointToGlobal,
const pointField& uniquePoints,
const globalIndex& globalPoints
) const; ) const;
void writePrimsBinary void writePrimsBinary
@ -291,22 +277,18 @@ private:
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
void writeFacePrimsBinary void writeFacePrimsBinary
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
void writeNSidedPointsBinary void writeNSidedPointsBinary
( (
const faceList& patchFaces, const faceList& patchFaces,
const label pointOffset,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
@ -321,8 +303,6 @@ private:
const labelList& prims, const labelList& prims,
const label nPrims, const label nPrims,
const faceList& patchFaces, const faceList& patchFaces,
const labelList& pointOffsets,
const labelList& patchProcessors,
std::ofstream& ensightGeometryFile std::ofstream& ensightGeometryFile
) const; ) const;
@ -362,11 +342,6 @@ public:
return allPatchNames_; return allPatchNames_;
} }
const List<labelList>& allPatchProcs() const
{
return allPatchProcs_;
}
const wordHashSet& patchNames() const const wordHashSet& patchNames() const
{ {
return patchNames_; return patchNames_;

View File

@ -93,6 +93,9 @@ bool inFileNameList
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
timeSelector::addOptions();
# include "addRegionOption.H"
argList::addBoolOption argList::addBoolOption
( (
"ascii", "ascii",
@ -111,7 +114,6 @@ int main(int argc, char *argv[])
"An empty list suppresses writing the internalMesh." "An empty list suppresses writing the internalMesh."
); );
# include "addTimeOptions.H"
# include "setRootCase.H" # include "setRootCase.H"
// Check options // Check options
@ -119,12 +121,7 @@ int main(int argc, char *argv[])
# include "createTime.H" # include "createTime.H"
// get the available time-steps instantList Times = timeSelector::select0(runTime, args);
instantList Times = runTime.times();
# include "checkTimeOptions.H"
runTime.setTime(Times[startTime], startTime);
# include "createNamedMesh.H" # include "createNamedMesh.H"
@ -214,9 +211,9 @@ int main(int argc, char *argv[])
// Identify if lagrangian data exists at each time, and add clouds // Identify if lagrangian data exists at each time, and add clouds
// to the 'allCloudNames' hash set // to the 'allCloudNames' hash set
for (label n=startTime; n<endTime; n++) forAll(Times, timeI)
{ {
runTime.setTime(Times[n], n); runTime.setTime(Times[timeI], timeI);
fileNameList cloudDirs = readDir fileNameList cloudDirs = readDir
( (
@ -267,9 +264,9 @@ int main(int argc, char *argv[])
// Loop over all times to build list of fields and field types // Loop over all times to build list of fields and field types
// for each cloud // for each cloud
for (label n=startTime; n<endTime; n++) forAll(Times, timeI)
{ {
runTime.setTime(Times[n], n); runTime.setTime(Times[timeI], timeI);
IOobjectList cloudObjs IOobjectList cloudObjs
( (
@ -296,20 +293,19 @@ int main(int argc, char *argv[])
} }
label nTimeSteps = 0; label nTimeSteps = 0;
for (label n=startTime; n<endTime; n++) forAll(Times, timeIndex)
{ {
nTimeSteps++; nTimeSteps++;
runTime.setTime(Times[n], n); runTime.setTime(Times[timeIndex], timeIndex);
label timeIndex = n - startTime;
word timeName = itoa(timeIndex); word timeName = itoa(timeIndex);
word timeFile = prepend + timeName; word timeFile = prepend + timeName;
Info<< "Translating time = " << runTime.timeName() << nl; Info<< "Translating time = " << runTime.timeName() << nl;
# include "moveMesh.H" polyMesh::readUpdateState meshState = mesh.readUpdate();
if (timeIndex == 0 || mesh.moving()) if (timeIndex == 0 || (meshState != polyMesh::UNCHANGED))
{ {
eMesh.write eMesh.write
( (

View File

@ -1,28 +0,0 @@
{
IOobject ioPoints
(
"points",
runTime.timeName(),
polyMesh::meshSubDir,
mesh
);
if (ioPoints.headerOk())
{
// Reading new points
pointIOField newPoints
(
IOobject
(
"points",
mesh.time().timeName(),
polyMesh::meshSubDir,
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
);
mesh.movePoints(newPoints);
}
}

View File

@ -95,7 +95,8 @@ public:
// If object pointer already set issue a FatalError. // If object pointer already set issue a FatalError.
inline void set(T*); inline void set(T*);
//- If object pointer already set, delete object and set to given pointer //- If object pointer already set, delete object and set to given
// pointer
inline void reset(T* = 0); inline void reset(T* = 0);
//- Delete object and set pointer to NULL, if the pointer is valid. //- Delete object and set pointer to NULL, if the pointer is valid.

View File

@ -1742,7 +1742,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
} }
} }
label myUniquePoints = meshPoints.size() + nCoupledMaster - nCoupledSlave; label myUniquePoints = meshPoints.size() - nCoupledSlave;
Pout<< "Points :" << nl Pout<< "Points :" << nl
<< " patch : " << meshPoints.size() << nl << " patch : " << meshPoints.size() << nl
@ -1796,10 +1796,10 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
if (slaves.size() > 0) if (slaves.size() > 0)
{ {
// Duplicate master globalpoint into slave slots // Duplicate master globalpoint into slave slots
masterToGlobal[coupledPointI] = pointToGlobal[meshPointI]; masterToGlobal[coupledPointI] = pointToGlobal[localPointI];
forAll(slaves, i) forAll(slaves, i)
{ {
masterToGlobal[slaves[i]] = pointToGlobal[meshPointI]; masterToGlobal[slaves[i]] = pointToGlobal[localPointI];
} }
} }
} }
@ -1826,7 +1826,7 @@ Foam::autoPtr<Foam::globalIndex> Foam::globalMeshData::mergePoints
if (slaves.size() == 0) if (slaves.size() == 0)
{ {
pointToGlobal[meshPointI] = masterToGlobal[coupledPointI]; pointToGlobal[localPointI] = masterToGlobal[coupledPointI];
} }
} }
} }

View File

@ -341,10 +341,5 @@ $(SRF)/derivedFvPatchFields/SRFVelocityFvPatchVectorField/SRFVelocityFvPatchVect
fieldSources = $(general)/fieldSources fieldSources = $(general)/fieldSources
$(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C $(fieldSources)/pressureGradientExplicitSource/pressureGradientExplicitSource.C
$(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C $(fieldSources)/timeActivatedExplicitSource/timeActivatedExplicitSource.C
$(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
LIB = $(FOAM_LIBBIN)/libfiniteVolume LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -1,175 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "timeActivatedExplicitCellSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void Foam::timeActivatedExplicitCellSource::updateCellSet()
{
cellSelector_->applyToSet(topoSetSource::NEW, selectedCellSet_);
Info<< " " << name_ << ": selected "
<< returnReduce(selectedCellSet_.size(), sumOp<label>())
<< " cells" << nl << endl;
V_ = scalarField(selectedCellSet_.size(), 1.0);
if (volumeType_ == vtAbsolute)
{
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitCellSource::timeActivatedExplicitCellSource
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dims
)
:
timeActivatedExplicitSource(name, mesh, dims),
onValue_(readScalar(lookup("onValue"))),
offValue_(readScalar(lookup("offValue"))),
V_(0),
cellSource_(lookup("cellSource")),
cellSelector_
(
topoSetSource::New
(
cellSource_,
mesh,
subDict(cellSource_ + "Coeffs")
)
),
selectedCellSet_
(
mesh,
name + "SourceCellSet",
mesh.nCells()/10 + 1 // Reasonable size estimate.
)
{
// Create the cell set
updateCellSet();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::scalar Foam::timeActivatedExplicitCellSource::onValue() const
{
return onValue_;
}
Foam::scalar Foam::timeActivatedExplicitCellSource::offValue() const
{
return offValue_;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitCellSource::Su()
{
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
scalar value = offValue_;
if
(
active_
&& (runTime_.time().value() >= timeStart_)
&& (runTime_.time().value() <= timeStart_ + duration_)
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
updateCellSet();
}
value = onValue_;
}
DimensionedField<scalar, volMesh>& sourceField = tSource();
label i = 0;
forAllConstIter(cellSet, selectedCellSet_, iter)
{
sourceField[iter.key()] = value/V_[i++];
}
return tSource;
}
bool Foam::timeActivatedExplicitCellSource::read()
{
if (timeActivatedExplicitSource::read())
{
lookup("onValue") >> onValue_;
lookup("offValue") >> offValue_;
lookup("cellSource") >> cellSource_;
cellSelector_ =
topoSetSource::New
(
cellSource_,
mesh_,
subDict(cellSource_ + "Coeffs")
);
updateCellSet();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,143 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::timeActivatedExplicitSourceNew
Description
Creates a cell set source that is activated at a given time, and remains
active for a specified duration. The source value is either in specific
(XX/m3) or absolute (XX) units.
SourceFiles
timeActivatedExplicitCellSource.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitCellSource_H
#define timeActivatedExplicitCellSource_H
#include "timeActivatedExplicitSource.H"
#include "topoSetSource.H"
#include "cellSet.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitCellSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitCellSource
:
public timeActivatedExplicitSource
{
private:
// Private member functions
//- Update the cell set that the source is acting on
void updateCellSet();
// Private Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitCellSource(const timeActivatedExplicitCellSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitCellSource&);
protected:
// Protected data
// Source properties
//- Value when "on"
scalar onValue_;
//- Value when "off"
scalar offValue_;
// Cell set
//- Cell volumes
scalarList V_;
//- Name of cell source (XXXToCell)
word cellSource_;
//- Method by which the cells will be selected
autoPtr<topoSetSource> cellSelector_;
//- Set of selected cells
cellSet selectedCellSet_;
public:
// Constructors
//- Construct from explicit source name and mesh
timeActivatedExplicitCellSource
(
const word&,
const fvMesh&,
const dimensionSet&
);
// Member Functions
// Access
//- Return the "on" value
virtual scalar onValue() const;
//- Return the "off" value
virtual scalar offValue() const;
//- Return a tmp field of the source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,87 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties()
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{}
Foam::pointSourceProperties::pointSourceProperties(const dictionary& dict)
:
name_(dict.name().name()),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
location_(dict.lookup("location")),
fieldData_(dict.lookup("fieldData"))
{}
Foam::pointSourceProperties::pointSourceProperties
(
const pointSourceProperties& psp
)
:
name_(psp.name_),
timeStart_(psp.timeStart_),
duration_(psp.duration_),
location_(psp.location_),
fieldData_(psp.fieldData_)
{}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
void Foam::pointSourceProperties::operator=(const pointSourceProperties& rhs)
{
// Check for assignment to self
if (this == &rhs)
{
FatalErrorIn
(
"pointSourceProperties::operator=(const pointSourceProperties&)"
) << "Attempted assignment to self" << nl
<< abort(FatalError);
}
// Set updated values
name_ = rhs.name_;
timeStart_ = rhs.timeStart_;
duration_ = rhs.duration_;
location_ = rhs.location_;
fieldData_ = rhs.fieldData_;}
// ************************************************************************* //

View File

@ -1,158 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::pointSourceProperties
Description
Helper class to describe point source properties
SourceFiles
pointSourceProperties.C
\*---------------------------------------------------------------------------*/
#ifndef pointSourceProperties_H
#define pointSourceProperties_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "Tuple2.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class pointSourceProperties Declaration
\*---------------------------------------------------------------------------*/
class pointSourceProperties
{
protected:
// Protected data
typedef Tuple2<word, scalar> fieldNameValuePair;
//- Source name
word name_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Point location
point location_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
public:
// Constructors
//- Construct null
pointSourceProperties();
//- Construct from dictionary
pointSourceProperties(const dictionary& dict);
//- Construct from Istream
pointSourceProperties(Istream& is);
//- Copy constructor
pointSourceProperties(const pointSourceProperties&);
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the point location
inline const point& location() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the point location
inline point& location();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();
// Member Operators
void operator=(const pointSourceProperties&);
// IOstream operators
friend Istream& operator>>(Istream&, pointSourceProperties&);
friend Ostream& operator<<(Ostream&, const pointSourceProperties&);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "pointSourcePropertiesI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,88 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "pointSourceProperties.H"
#include "dictionaryEntry.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::pointSourceProperties::pointSourceProperties(Istream& is)
:
name_("unknownPointSourceName"),
timeStart_(0.0),
duration_(0.0),
location_(point::zero),
fieldData_()
{
is.check("pointSourceProperties(Istream&)");
const dictionaryEntry entry(dictionary::null, is);
name_ = entry.keyword();
entry.lookup("timeStart") >> timeStart_;
entry.lookup("duration") >> duration_;
entry.lookup("location") >> location_;
entry.lookup("fieldData") >> fieldData_;
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>(Istream& is, pointSourceProperties& psp)
{
is.check("Istream& operator>>(Istream&, pointSourceProperties&)");
const dictionaryEntry entry(dictionary::null, is);
psp.name_ = entry.keyword();
entry.lookup("timeStart") >> psp.timeStart_;
entry.lookup("duration") >> psp.duration_;
entry.lookup("location") >> psp.location_;
entry.lookup("fieldData") >> psp.fieldData_;
return is;
}
Foam::Ostream& Foam::operator<<(Ostream& os, const pointSourceProperties& psp)
{
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
os << psp.name_ << nl << token::BEGIN_BLOCK << nl;
os.writeKeyword("timeStart") << psp.timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << psp.duration_ << token::END_STATEMENT << nl;
os.writeKeyword("location") << psp.location_ << token::END_STATEMENT << nl;
os.writeKeyword("fieldData") << psp.fieldData_ << token::END_STATEMENT << nl;
os << token::END_BLOCK << nl;
os.check("Ostream& operator<<(Ostream&, const pointSourceProperties&)");
return os;
}
// ************************************************************************* //

View File

@ -1,292 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "timeActivatedExplicitMulticomponentPointSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
Foam::label
Foam::timeActivatedExplicitMulticomponentPointSource::carrierFieldId
(
const word& fieldName
)
{
forAll(carrierFields_, fieldI)
{
if (carrierFields_[fieldI].name() == fieldName)
{
return fieldI;
}
}
return -1;
}
void Foam::timeActivatedExplicitMulticomponentPointSource::updateAddressing()
{
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
bool foundCell = false;
label cid = mesh_.findCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
label cid = mesh_.findNearestCell(psp.location());
if (cid >= 0)
{
foundCell = mesh_.pointInCell(psp.location(), cid);
}
}
reduce(foundCell, orOp<bool>());
if (!foundCell)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find location " << psp.location() << " in mesh "
<< "for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
cellOwners_[sourceI] = cid;
}
fieldIds_[sourceI].setSize(psp.fieldData().size());
forAll(psp.fieldData(), fieldI)
{
const word& fieldName = psp.fieldData()[fieldI].first();
label cfid = carrierFieldId(fieldName);
if (cfid < 0)
{
FatalErrorIn
(
"timeActivatedExplicitMulticomponentPointSource::"
"updateAddressing()"
) << "Unable to find field " << fieldName << " in carrier "
<< "fields for source " << psp.name() << nl
<< exit(FatalError);
}
else
{
fieldIds_[sourceI][fieldI] = cfid;
}
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitMulticomponentPointSource::
timeActivatedExplicitMulticomponentPointSource
(
const word& name,
const fvMesh& mesh,
const PtrList<volScalarField>& carrierFields,
const dimensionSet& dims
)
:
IOdictionary
(
IOobject
(
name + "Properties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
name_(name),
mesh_(mesh),
runTime_(mesh.time()),
dimensions_(dims),
carrierFields_(carrierFields),
active_(lookup("active")),
pointSources_(lookup("pointSources")),
cellOwners_(pointSources_.size()),
fieldIds_(pointSources_.size())
{
// Initialise the field addressing
updateAddressing();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su
(
const label fieldI
)
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + carrierFields_[fieldI].name() + "Su",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
fieldIds_[sourceI][i] == fieldI
&& (runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::timeActivatedExplicitMulticomponentPointSource::Su()
{
if (mesh_.changing())
{
updateAddressing();
}
tmp<DimensionedField<scalar, volMesh> > tSource
(
new DimensionedField<scalar, volMesh>
(
IOobject
(
name_ + "TotalSu",
runTime_.timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensionedScalar("zero", dimensions_, 0.0)
)
);
if (active_)
{
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{
const pointSourceProperties& psp = pointSources_[sourceI];
forAll(fieldIds_[sourceI], i)
{
if
(
(runTime_.time().value() >= psp.timeStart())
&& (runTime_.time().value() <= psp.timeEnd())
)
{
const label cid = cellOwners_[sourceI];
if (cid >= 0)
{
sourceField[cid] +=
dt*psp.fieldData()[i].second()/V[cid];
}
}
}
}
}
return tSource;
}
bool Foam::timeActivatedExplicitMulticomponentPointSource::read()
{
if (regIOobject::read())
{
lookup("active") >> active_;
lookup("pointSources") >> pointSources_;
cellOwners_.setSize(pointSources_.size());
updateAddressing();
return true;
}
else
{
return false;
}
}
// ************************************************************************* //

View File

@ -1,185 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::timeActivatedExplicitMulticomponentPointSourceNew
Description
Provides a mechanism to introduce point sources to a set of carrier fields.
Carrier fields are supplied on consruction, and interrogated to provide the
field indices of the sources.
Source values are assumed to be in <quantity>/s, and divided through by the
cell volumes before being returned, e.g. for a kg/s source
Properties are described in a <name>Properties dictionary
active true; // are sources active (true/false)
pointSources
(
source1 // source name
{
timeStart 0.0;
duration 1.0;
location (0 0 0);
fieldData
(
(H2O 0.1) // kg/s
(O2 0.05) // kg/s
);
}
source2 // source name
{
timeStart 0.5;
duration 2.0;
location (1 1 1);
fieldData
(
(NO 0.1) // kg/s
(CO2 0.05) // kg/s
(H2 0.001) // kg/s
);
}
);
SourceFiles
timeActivatedExplicitMulticomponentPointSourceNew.C
\*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitMulticomponentPointSource_H
#define timeActivatedExplicitMulticomponentPointSource_H
#include "IOdictionary.H"
#include "fvMesh.H"
#include "Time.H"
#include "pointSourceProperties.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class timeActivatedExplicitMulitcomponentPointSource Declaration
\*---------------------------------------------------------------------------*/
class timeActivatedExplicitMulticomponentPointSource
:
public IOdictionary
{
protected:
// Protected data
//- Name of the source
word name_;
//- Reference to the mesh
const fvMesh& mesh_;
//- Reference to time database
const Time& runTime_;
//- Source dimensions
const dimensionSet& dimensions_;
//- Reference to the multicomponent carrier fields
const PtrList<volScalarField>& carrierFields_;
//- Active flag
Switch active_;
//- List of point source properties
List<pointSourceProperties> pointSources_;
//- List of cell owners for point source locations
List<label> cellOwners_;
//- List of field ids for each source
List<labelList> fieldIds_;
// Protected Member Functions
//- Return the id of field given its name
label carrierFieldId(const word& fieldName);
//- Update the addressing between source and carrier fields
void updateAddressing();
//- Disallow default bitwise copy construct
timeActivatedExplicitMulticomponentPointSource
(
const timeActivatedExplicitMulticomponentPointSource&
);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitMulticomponentPointSource&);
public:
// Constructors
//- Construct from components
timeActivatedExplicitMulticomponentPointSource
(
const word&,
const fvMesh&,
const PtrList<volScalarField>&,
const dimensionSet&
);
// Member Functions
// Access
//- Return a tmp field of the source for field fieldI
virtual tmp<DimensionedField<scalar, volMesh> > Su
(
const label fieldI
);
//- Return a tmp field of the total source
virtual tmp<DimensionedField<scalar, volMesh> > Su();
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,360 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "TimeActivatedExplicitSource.H"
#include "fvMesh.H"
#include "volFields.H"
// * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * * //
template<class Type>
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
selectionModeTypeNames_
(
IStringStream("(points cellSet)")()
);
template<class Type>
const Foam::wordList Foam::TimeActivatedExplicitSource<Type>::
volumeModeTypeNames_
(
IStringStream("(absolute specific)")()
);
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class Type>
typename Foam::TimeActivatedExplicitSource<Type>::selectionModeType
Foam::TimeActivatedExplicitSource<Type>::wordToSelectionModeType
(
const word& smtName
) const
{
forAll(selectionModeTypeNames_, i)
{
if (smtName == selectionModeTypeNames_[i])
{
return selectionModeType(i);
}
}
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::selectionModeType"
"TimeActivatedExplicitSource<Type>::wordToSelectionModeType"
"("
"const word&"
")"
) << "Unknown selectionMode type " << smtName
<< ". Valid selectionMode types are:" << nl << selectionModeTypeNames_
<< exit(FatalError);
return selectionModeType(0);
}
template<class Type>
typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType
Foam::TimeActivatedExplicitSource<Type>::wordToVolumeModeType
(
const word& vmtName
) const
{
forAll(volumeModeTypeNames_, i)
{
if (vmtName == volumeModeTypeNames_[i])
{
return volumeModeType(i);
}
}
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::volumeModeType"
"TimeActivatedExplicitSource<Type>::wordToVolumeModeType(const word&)"
) << "Unknown volumeMode type " << vmtName
<< ". Valid volumeMode types are:" << nl << volumeModeTypeNames_
<< exit(FatalError);
return volumeModeType(0);
}
template<class Type>
Foam::word Foam::TimeActivatedExplicitSource<Type>::selectionModeTypeToWord
(
const selectionModeType& smtType
) const
{
if (smtType > selectionModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return selectionModeTypeNames_[smtType];
}
}
template<class Type>
Foam::word Foam::TimeActivatedExplicitSource<Type>::volumeModeTypeToWord
(
const volumeModeType& vmtType
) const
{
if (vmtType > volumeModeTypeNames_.size())
{
return "UNKNOWN";
}
else
{
return volumeModeTypeNames_[vmtType];
}
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::setSelection
(
const dictionary& dict
)
{
switch (selectionMode_)
{
case smPoints:
{
dict.lookup("points") >> points_;
break;
}
case smCellSet:
{
dict.lookup("cellSet") >> cellSetName_;
break;
}
default:
{
FatalErrorIn
(
"TimeActivatedExplicitSource::setSelection(const dictionary&)"
) << "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::setFieldData
(
const dictionary& dict,
const wordList& fieldNames
)
{
dict.lookup("fieldData") >> fieldData_;
labelList localFieldIds(fieldData_.size(), -1);
forAll(fieldNames, i)
{
forAll(fieldData_, j)
{
const word& fdName = fieldData_[j].first();
if (fdName == fieldNames[i])
{
fieldIds_[i] = j;
localFieldIds[j] = i;
break;
}
}
}
forAll(localFieldIds, i)
{
if (localFieldIds[i] < 0)
{
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::setFieldData"
"("
"const dictionary&, "
"const wordList&"
")"
) << "Field " << fieldData_[i].first() << " not found in "
<< "field list. Available fields are: " << nl << fieldNames
<< exit(FatalError);
}
}
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::setCellSet()
{
Info<< incrIndent << indent << "Source: " << name_ << endl;
switch (selectionMode_)
{
case smPoints:
{
Info<< indent << "- selecting cells using points" << endl;
labelHashSet cellOwners;
forAll(points_, i)
{
label cellI = mesh_.findCell(points_[i]);
if (cellI >= 0)
{
cellOwners.insert(cellI);
}
label globalCellI = returnReduce(cellI, maxOp<label>());
if (globalCellI < 0)
{
WarningIn("TimeActivatedExplicitSource<Type>::setCellIds()")
<< "Unable to find owner cell for point " << points_[i]
<< endl;
}
}
cellsPtr_.reset(new cellSet(mesh_, "points", cellOwners));
break;
}
case smCellSet:
{
Info<< indent << "- selecting cells using cellSet "
<< cellSetName_ << endl;
cellsPtr_.reset(new cellSet(mesh_, cellSetName_));
break;
}
default:
{
FatalErrorIn("TimeActivatedExplicitSource<Type>::setCellIds()")
<< "Unknown selectionMode "
<< selectionModeTypeNames_[selectionMode_]
<< ". Valid selectionMode types are" << selectionModeTypeNames_
<< exit(FatalError);
}
}
const cellSet& cSet = cellsPtr_();
// Set volume normalisation
V_ = scalarField(cSet.size(), 1.0);
if (volumeMode_ == vmAbsolute)
{
label i = 0;
forAllConstIter(cellSet, cSet, iter)
{
V_[i++] = mesh_.V()[iter.key()];
}
}
Info<< indent << "- selected " << returnReduce(cSet.size(), sumOp<label>())
<< " cell(s)" << nl << decrIndent << endl;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::TimeActivatedExplicitSource<Type>::TimeActivatedExplicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh,
const wordList& fieldNames
)
:
name_(name),
mesh_(mesh),
active_(dict.lookup("active")),
timeStart_(readScalar(dict.lookup("timeStart"))),
duration_(readScalar(dict.lookup("duration"))),
volumeMode_(wordToVolumeModeType(dict.lookup("volumeMode"))),
selectionMode_(wordToSelectionModeType(dict.lookup("selectionMode"))),
points_(),
cellSetName_("none"),
V_(),
cellsPtr_(),
fieldData_(),
fieldIds_(fieldNames.size(), -1)
{
setSelection(dict);
if (fieldNames.size() == 1)
{
fieldData_.setSize(1);
fieldData_[0].first() = fieldNames[0];
dict.lookup("fieldData") >> fieldData_[0].second();
fieldIds_[0] = 0;
}
else
{
setFieldData(dict, fieldNames);
}
setCellSet();
}
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::addToField
(
DimensionedField<Type, volMesh>& Su,
const label fieldI
)
{
const label fid = fieldIds_[fieldI];
if
(
active_
&& (fid >= 0)
&& (mesh_.time().value() >= timeStart_)
&& (mesh_.time().value() <= timeEnd())
)
{
// Update the cell set if the mesh is changing
if (mesh_.changing())
{
setCellSet();
}
const cellSet& cSet = cellsPtr_();
label i = 0;
forAllConstIter(cellSet, cSet, iter)
{
Su[iter.key()] = fieldData_[fid].second()/V_[i++];
}
}
}
// ************************************************************************* //

View File

@ -0,0 +1,392 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::TimeActivatedExplicitSource
Description
Time activated explicit source.
Sources described by:
{
active true; // on/off switch
timeStart 0.2; // start time
duration 2.0; // duration
selectionMode points; // cellSet
volumeMode absolute; // specific
fieldData // field data - usage for multiple fields
(
(H2O 0.005)
);
fieldData 0.005; // field data - usage for single field
points // list of points when selectionMode = points
(
(2.75 0.5 0)
);
cellSet c0; // cellSet name when selectionMode = cekllSet
}
SourceFiles
TimeActivatedExplicitSource.C
\*---------------------------------------------------------------------------*/
#ifndef TimeActivatedExplicitSource_H
#define TimeActivatedExplicitSource_H
#include "Tuple2.H"
#include "cellSet.H"
#include "volFieldsFwd.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
template<class Type>
class TimeActivatedExplicitSource;
// Forward declaration of friend functions
template<class Type>
Ostream& operator<<
(
Ostream&,
const TimeActivatedExplicitSource<Type>&
);
/*---------------------------------------------------------------------------*\
Class TimeActivatedExplicitSource Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class TimeActivatedExplicitSource
{
public:
// Public data
//- Enumeration for selection mode types
enum selectionModeType
{
smPoints,
smCellSet
};
//- Word list of selection mode type names
static const wordList selectionModeTypeNames_;
//- Enumeration for volume types
enum volumeModeType
{
vmAbsolute,
vmSpecific
};
//- Word list of volume mode type names
static const wordList volumeModeTypeNames_;
protected:
// Protected data
typedef Tuple2<word, Type> fieldNameValuePair;
//- Source name
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Source active flag
bool active_;
//- Time start
scalar timeStart_;
//- Duration
scalar duration_;
//- Volume mode
volumeModeType volumeMode_;
//- Cell selection mode
selectionModeType selectionMode_;
//- List of points for "points" selectionMode
List<point> points_;
//- Name of cell set for "cellSet" selectionMode
word cellSetName_;
//- Field of cell volumes according to cell set cells
scalarList V_;
//- Cell set
autoPtr<cellSet> cellsPtr_;
//- List of source field name vs value pairs
List<fieldNameValuePair> fieldData_;
//- Map of fields ids from supplied fields to local field source ids
labelList fieldIds_;
// Protected functions
//- Helper function to convert from a word to a selectionModeType
selectionModeType wordToSelectionModeType(const word& smtName) const;
//- Helper function to convert from a word to a volumeModeType
volumeModeType wordToVolumeModeType(const word& vtName) const;
//- Helper function to convert from a selectionModeType to a word
word selectionModeTypeToWord(const selectionModeType& smtType) const;
//- Helper function to convert from a volumeModeType to a word
word volumeModeTypeToWord(const volumeModeType& vtType) const;
//- Set the cellSet or points selection
void setSelection(const dictionary& dict);
//- Set the local field data
void setFieldData(const dictionary& dict, const wordList& fieldNames);
//- Set the cell set based on the user input selection mode
void setCellSet();
public:
// Constructors
//- Construct from components
TimeActivatedExplicitSource
(
const word& name,
const dictionary& dict,
const fvMesh& mesh,
const wordList& fieldNames
);
//- Return clone
autoPtr<TimeActivatedExplicitSource> clone() const
{
notImplemented
(
"autoPtr<TimeActivatedExplicitSource> clone() const"
);
return autoPtr<TimeActivatedExplicitSource>(NULL);
}
//- Return pointer to new TimeActivatedExplicitSource object created
// on the freestore from an Istream
class iNew
{
//- Reference to the mesh database
const fvMesh& mesh_;
//- List of field names
const wordList& fieldNames_;
public:
iNew
(
const fvMesh& mesh,
const wordList& fieldNames
)
:
mesh_(mesh),
fieldNames_(fieldNames)
{}
autoPtr<TimeActivatedExplicitSource> operator()(Istream& is) const
{
const word name(is);
const dictionary dict(is);
return autoPtr<TimeActivatedExplicitSource>
(
new TimeActivatedExplicitSource
(
name,
dict,
mesh_,
fieldNames_
)
);
}
};
// Member Functions
// Access
//- Return const access to the source name
inline const word& name() const;
//- Return const access to the mesh database
inline const fvMesh& mesh() const;
//- Return const access to the source active flag
inline bool active() const;
//- Return const access to the time start
inline scalar timeStart() const;
//- Return const access to the duration
inline scalar duration() const;
//- Return const access to the time end
inline scalar timeEnd() const;
//- Return const access to the volume mode
inline const volumeModeType& volumeMode() const;
//- Return const access to the cell selection mode
inline const selectionModeType& selectionMode() const;
//- Return const access to the list of points for "points"
// selectionMode
inline const List<point>& points() const;
//- Return const access to the name of cell set for "cellSet"
// selectionMode
inline const word& cellSetName() const;
//- Return const access to the field of cell volumes according to
// cell set cells
inline const scalarList& V() const;
//- Return const access to the cell set
inline const cellSet& cells() const;
//- Return const access to the source field name vs value pairs
inline const List<fieldNameValuePair>& fieldData() const;
//- Return const access to the the map of fields ids from supplied
// fields to local field source ids
inline const labelList& fieldIds() const;
// Edit
//- Return access to the source name
inline word& name();
//- Return access to the source active flag
inline bool& active();
//- Return access to the time start
inline scalar& timeStart();
//- Return access to the duration
inline scalar& duration();
//- Return access to the volume mode
inline volumeModeType& volumeMode();
//- Return access to the cell selection mode
inline selectionModeType& selectionMode();
//- Return access to the list of points for "points" selectionMode
inline List<point>& points();
//- Return access to the name of cell set for "cellSet"
// selectionMode
inline word& cellSetName();
//- Return access to the field of cell volumes according to
// cell set cells
inline scalarList& V();
//- Return access to the cell set
inline cellSet& cells();
//- Return access to the source field name vs value pairs
inline List<fieldNameValuePair>& fieldData();
//- Return access to the the map of fields ids from supplied
// fields to local field source ids
inline labelList& fieldIds();
// Evaluation
//- Add the source contribution to field Su
void addToField
(
DimensionedField<Type, volMesh>& Su,
const label fieldI
);
// I-O
//- Write the source properties
void writeData(Ostream&) const;
//- Ostream operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const TimeActivatedExplicitSource& source
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "TimeActivatedExplicitSource.C"
# include "TimeActivatedExplicitSourceIO.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "TimeActivatedExplicitSourceI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,227 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "TimeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
inline const Foam::word& Foam::TimeActivatedExplicitSource<Type>::name() const
{
return name_;
}
template<class Type>
inline const Foam::fvMesh& Foam::TimeActivatedExplicitSource<Type>::mesh() const
{
return mesh_;
}
template<class Type>
inline bool Foam::TimeActivatedExplicitSource<Type>::active() const
{
return active_;
}
template<class Type>
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::timeStart() const
{
return timeStart_;
}
template<class Type>
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::duration() const
{
return duration_;
}
template<class Type>
inline Foam::scalar Foam::TimeActivatedExplicitSource<Type>::timeEnd() const
{
return timeStart_ + duration_;
}
template<class Type>
inline const typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType&
Foam::TimeActivatedExplicitSource<Type>::volumeMode() const
{
return volumeMode_;
}
template<class Type>
inline const typename Foam::TimeActivatedExplicitSource<Type>::
selectionModeType&
Foam::TimeActivatedExplicitSource<Type>::selectionMode() const
{
return selectionMode_;
}
template<class Type>
inline const Foam::List<Foam::point>&
Foam::TimeActivatedExplicitSource<Type>::points() const
{
return points_;
}
template<class Type>
inline const Foam::word&
Foam::TimeActivatedExplicitSource<Type>::cellSetName() const
{
return cellSetName_;
}
template<class Type>
inline const Foam::scalarList&
Foam::TimeActivatedExplicitSource<Type>::V() const
{
return V_;
}
template<class Type>
inline const Foam::cellSet&
Foam::TimeActivatedExplicitSource<Type>::cells() const
{
return cellsPtr_();
}
template<class Type>
inline const Foam::List<typename Foam::TimeActivatedExplicitSource<Type>::
fieldNameValuePair>&
Foam::TimeActivatedExplicitSource<Type>::fieldData() const
{
return fieldData_;
}
template<class Type>
inline const Foam::labelList&
Foam::TimeActivatedExplicitSource<Type>::fieldIds() const
{
return fieldIds_;
}
template<class Type>
inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::name()
{
return name_;
}
template<class Type>
inline bool& Foam::TimeActivatedExplicitSource<Type>::active()
{
return active_;
}
template<class Type>
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::timeStart()
{
return timeStart_;
}
template<class Type>
inline Foam::scalar& Foam::TimeActivatedExplicitSource<Type>::duration()
{
return duration_;
}
template<class Type>
inline typename Foam::TimeActivatedExplicitSource<Type>::volumeModeType&
Foam::TimeActivatedExplicitSource<Type>::volumeMode()
{
return volumeMode_;
}
template<class Type>
inline typename Foam::TimeActivatedExplicitSource<Type>::selectionModeType&
Foam::TimeActivatedExplicitSource<Type>::selectionMode()
{
return selectionMode_;
}
template<class Type>
inline Foam::List<Foam::point>&
Foam::TimeActivatedExplicitSource<Type>::points()
{
return points_;
}
template<class Type>
inline Foam::word& Foam::TimeActivatedExplicitSource<Type>::cellSetName()
{
return cellSetName_;
}
template<class Type>
inline Foam::scalarList& Foam::TimeActivatedExplicitSource<Type>::V()
{
return V_;
}
template<class Type>
inline Foam::cellSet& Foam::TimeActivatedExplicitSource<Type>::cells()
{
return cellsPtr_();
}
template<class Type>
inline Foam::List<typename Foam::TimeActivatedExplicitSource<Type>::fieldNameValuePair>&
Foam::TimeActivatedExplicitSource<Type>::fieldData()
{
return fieldData_;
}
template<class Type>
inline Foam::labelList& Foam::TimeActivatedExplicitSource<Type>::fieldIds()
{
return fieldIds_;
}
// ************************************************************************* //

View File

@ -0,0 +1,102 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "TimeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
void Foam::TimeActivatedExplicitSource<Type>::writeData(Ostream& os) const
{
os << indent << name_ << nl
<< indent << token::BEGIN_BLOCK << incrIndent << nl;
os.writeKeyword("active") << active_ << token::END_STATEMENT << nl;
os.writeKeyword("timeStart") << timeStart_ << token::END_STATEMENT << nl;
os.writeKeyword("duration") << duration_ << token::END_STATEMENT << nl;
os.writeKeyword("selectionMode") << selectionModeTypeToWord(selectionMode_)
<< token::END_STATEMENT << nl;
os.writeKeyword("volumeMode") << volumeModeTypeToWord(volumeMode_)
<< token::END_STATEMENT << nl;
if (fieldIds_.size() == 1)
{
os.writeKeyword("fieldData") << fieldData_[0].second()
<< token::END_STATEMENT << nl;
}
else
{
os.writeKeyword("fieldData") << fieldData_ << nl;
}
switch (selectionMode_)
{
case smPoints:
{
os.writeKeyword("points") << nl << indent << points_
<< token::END_STATEMENT << nl;
break;
}
case smCellSet:
{
os.writeKeyword("cellSet") << cellSetName_
<< token::END_STATEMENT << nl;
break;
}
default:
{
FatalErrorIn
(
"TimeActivatedExplicitSource<Type>::writeData"
"("
"Ostream&, "
"bool"
") const"
) << "Unknown selectionMode "
<< selectionModeTypeToWord(selectionMode_)
<< abort(FatalError);
}
}
os << decrIndent << indent << token::END_BLOCK << endl;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const TimeActivatedExplicitSource<Type>& source
)
{
source.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,223 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "TimeActivatedExplicitSourceList.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
Foam::TimeActivatedExplicitSourceList<Type>::TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const wordList& fieldNames
)
:
IOPtrList<TimeActivatedExplicitSource<Type> >
(
IOobject
(
name + "SourceProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
typename TimeActivatedExplicitSource<Type>::iNew(mesh, fieldNames)
),
name_(name),
mesh_(mesh),
dimensions_(dimensions),
fieldNames_(fieldNames)
{}
template<class Type>
Foam::TimeActivatedExplicitSourceList<Type>::TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const word& fieldName
)
:
IOPtrList<TimeActivatedExplicitSource<Type> >
(
IOobject
(
name + "SourceProperties",
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
),
typename TimeActivatedExplicitSource<Type>::iNew
(
mesh,
IStringStream('(' + fieldName + ')')()
)
),
name_(name),
mesh_(mesh),
dimensions_(dimensions),
fieldNames_(1, fieldName)
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
Foam::TimeActivatedExplicitSourceList<Type>::Su(const label fieldI)
{
tmp<DimensionedField<Type, volMesh> > tSu
(
new DimensionedField<Type, volMesh>
(
IOobject
(
name_ + "Source_" + fieldNames_[fieldI],
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensioned<Type>("zero", dimensions_, pTraits<Type>::zero)
)
);
DimensionedField<Type, volMesh>& Su = tSu();
forAll(*this, i)
{
this->operator[](i).addToField(Su, fieldI);
}
return tSu;
}
template<class Type>
Foam::tmp<Foam::DimensionedField<Type, Foam::volMesh> >
Foam::TimeActivatedExplicitSourceList<Type>::SuTot()
{
tmp<DimensionedField<Type, volMesh> > tSuTot
(
new DimensionedField<Type, volMesh>
(
IOobject
(
name_ + "TotalSource",
mesh_.time().timeName(),
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh_,
dimensioned<Type>("zero", dimensions_, pTraits<Type>::zero)
)
);
DimensionedField<Type, volMesh>& SuTot = tSuTot();
forAll(fieldNames_, fieldI)
{
forAll(*this, sourceI)
{
this->operator[](sourceI).addToField(SuTot, fieldI);
}
}
return tSuTot;
}
template<class Type>
bool Foam::TimeActivatedExplicitSourceList<Type>::readData(Istream& is)
{
this->clear();
IOPtrList<TimeActivatedExplicitSource<Type> > newSources
(
IOobject
(
name_ + "TimeActivatedExplicitSource",
mesh_.time().constant(),
mesh_,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
),
typename TimeActivatedExplicitSource<Type>::iNew(mesh_, fieldNames_)
);
transfer(newSources);
return is.good();
}
template<class Type>
bool Foam::TimeActivatedExplicitSourceList<Type>::writeData(Ostream& os) const
{
// Write size of list
os << nl << this->size();
// Write beginning of contents
os << nl << token::BEGIN_LIST;
// Write list contents
forAll(*this, i)
{
os << nl;
this->operator[](i).writeData(os);
}
// Write end of contents
os << token::END_LIST << token::END_STATEMENT << nl;
// Check state of IOstream
return os.good();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
template<class Type>
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const TimeActivatedExplicitSourceList<Type>& sources
)
{
sources.writeData(os);
return os;
}
// ************************************************************************* //

View File

@ -0,0 +1,172 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::TimeActivatedExplicitSourceList
Description
List of time activeted explict sources
SourceFiles
TimeActivatedExplicitSourceList.C
\*---------------------------------------------------------------------------*/
#ifndef TimeActivatedExplicitSourceList_H
#define TimeActivatedExplicitSourceList_H
#include "IOPtrList.H"
#include "TimeActivatedExplicitSource.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class fvMesh;
template<class Type>
class TimeActivatedExplicitSource;
template<class Type>
class TimeActivatedExplicitSourceList;
// Forward declaration of friend functions
template<class Type>
Ostream& operator<<
(
Ostream&,
const TimeActivatedExplicitSourceList<Type>&
);
/*---------------------------------------------------------------------------*\
Class TimeActivatedExplicitSourceList Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class TimeActivatedExplicitSourceList
:
public IOPtrList<TimeActivatedExplicitSource<Type> >
{
private:
// Private data
//- Name of source properties list
word name_;
//- Reference to the mesh database
const fvMesh& mesh_;
//- Dimensions of source properties
dimensionSet dimensions_;
//- List of field names the source is working on
wordList fieldNames_;
// Private member functions
//- Disallow default bitwise copy construct
TimeActivatedExplicitSourceList
(
const TimeActivatedExplicitSourceList<Type>&
);
//- Disallow default bitwise assignment
void operator=(const TimeActivatedExplicitSourceList<Type>&);
public:
// Constructors
//- Construct from components with list of field names
TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const wordList& fieldNames
);
//- Construct from components with single field name
TimeActivatedExplicitSourceList
(
const word& name,
const fvMesh& mesh,
const dimensionSet& dimensions,
const word& fieldName
);
// Member Functions
// Evaluation
//- Return the source for field, fieldI
tmp<DimensionedField<Type, volMesh> > Su
(
const label fieldI = 0
);
//- Return the total source for all fields
tmp<DimensionedField<Type, volMesh> > SuTot();
// I-O
//- Read data from Istream
bool readData(Istream& is);
//- Write data to Istream
bool writeData(Ostream& os) const;
//- Ostream operator
friend Ostream& operator<< <Type>
(
Ostream& os,
const TimeActivatedExplicitSourceList& sources
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "TimeActivatedExplicitSourceList.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -25,131 +25,21 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "timeActivatedExplicitSource.H" #include "timeActivatedExplicitSource.H"
#include "volFields.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<> namespace Foam
const char* Foam::NamedEnum
<
Foam::timeActivatedExplicitSource::volumeType,
2
>::names[] =
{ {
"specific", defineTemplateTypeNameAndDebug
"absolute"
};
const Foam::NamedEnum<Foam::timeActivatedExplicitSource::volumeType, 2>
Foam::timeActivatedExplicitSource::volumeTypeNames_;
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::timeActivatedExplicitSource::timeActivatedExplicitSource
( (
const word& name, IOPtrList<scalarTimeActivatedExplicitSource>,
const fvMesh& mesh, 0
const dimensionSet& dims );
) defineTemplateTypeNameAndDebug
:
IOdictionary
( (
IOobject IOPtrList<vectorTimeActivatedExplicitSource>,
( 0
name + "Properties", );
mesh.time().constant(),
mesh,
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
mesh_(mesh),
runTime_(mesh.time()),
name_(name),
active_(lookup("active")),
dimensions_(dims),
volumeType_(volumeTypeNames_.read(lookup("volumeType"))),
timeStart_(readScalar(lookup("timeStart"))),
duration_(readScalar(lookup("duration")))
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
const Foam::fvMesh& Foam::timeActivatedExplicitSource::mesh() const
{
return mesh_;
} }
const Foam::Time& Foam::timeActivatedExplicitSource::runTime() const
{
return runTime_;
}
const Foam::word& Foam::timeActivatedExplicitSource::name() const
{
return name_;
}
const Foam::Switch& Foam::timeActivatedExplicitSource::active() const
{
return active_;
}
const Foam::dimensionSet& Foam::timeActivatedExplicitSource::dimensions() const
{
return dimensions_;
}
const Foam::timeActivatedExplicitSource::volumeType&
Foam::timeActivatedExplicitSource::volume() const
{
return volumeType_;
}
Foam::scalar Foam::timeActivatedExplicitSource::timeStart() const
{
return timeStart_;
}
Foam::scalar Foam::timeActivatedExplicitSource::duration() const
{
return duration_;
}
bool Foam::timeActivatedExplicitSource::read()
{
if (regIOobject::read())
{
lookup("active") >> active_;
if (active_)
{
volumeType_ = volumeTypeNames_.read(lookup("volumeType"));
lookup("timeStart") >> duration_;
lookup("duration") >> duration_;
return true;
}
else
{
return false;
}
}
else
{
return false;
}
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -22,150 +22,43 @@ License
along with OpenFOAM; if not, write to the Free Software Foundation, along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Typedef
Foam::timeActivatedExplicitSource Foam::timeActivatedExplicitSource
Description
Base class for field sources. Provides:
- name
- references to mesh and time databases
- dimensions
- volume type
- startTime
- duration
- read (from <sourceName>Properties dictionary)
SourceFiles
timeActivatedExplicitSource.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef timeActivatedExplicitSource_H #ifndef timeActivatedExplicitSource_H
#define timeActivatedExplicitSource_H #define timeActivatedExplicitSource_H
#include "IOdictionary.H" #include "TimeActivatedExplicitSource.H"
#include "autoPtr.H" #include "TimeActivatedExplicitSourceList.H"
#include "fvMesh.H"
#include "Time.H"
#include "NamedEnum.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
typedef TimeActivatedExplicitSource<scalar>
scalarTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<vector>
vectorTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<sphericalTensor>
sphericalTensorTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<symmTensor>
symmTensorTimeActivatedExplicitSource;
typedef TimeActivatedExplicitSource<tensor>
tensorTimeActivatedExplicitSource;
/*---------------------------------------------------------------------------*\ typedef TimeActivatedExplicitSourceList<scalar>
Class timeActivatedExplicitSource Declaration scalarTimeActivatedExplicitSourceList;
\*---------------------------------------------------------------------------*/ typedef TimeActivatedExplicitSourceList<vector>
vectorTimeActivatedExplicitSourceList;
class timeActivatedExplicitSource typedef TimeActivatedExplicitSourceList<sphericalTensor>
: sphericalTensorTimeActivatedExplicitSourceList;
public IOdictionary typedef TimeActivatedExplicitSourceList<symmTensor>
{ symmTensorTimeActivatedExplicitSourceList;
public: typedef TimeActivatedExplicitSourceList<tensor>
tensorTimeActivatedExplicitSourceList;
enum volumeType }
{
vtSpecific,
vtAbsolute
};
static const NamedEnum<volumeType, 2> volumeTypeNames_;
private:
// Private Member Functions
//- Disallow default bitwise copy construct
timeActivatedExplicitSource(const timeActivatedExplicitSource&);
//- Disallow default bitwise assignment
void operator=(const timeActivatedExplicitSource&);
protected:
// Protected data
//- Reference to the mesh
const fvMesh& mesh_;
//- Reference to time database
const Time& runTime_;
// Source properties
//- Name of the source
word name_;
//- Active flag
Switch active_;
//- Dimensions
const dimensionSet dimensions_;
//- Volume type
volumeType volumeType_;
//- Time start [s]
scalar timeStart_;
//- Duration [s]
scalar duration_;
public:
// Constructors
//- Construct from explicit source name and mesh
timeActivatedExplicitSource
(
const word&,
const fvMesh&,
const dimensionSet&
);
// Member Functions
// Access
//- Return the reference to the mesh
virtual const fvMesh& mesh() const;
//- Return the reference to the time database
virtual const Time& runTime() const;
//- Return the source name
virtual const word& name() const;
//- Return the active flag
virtual const Switch& active() const;
//- Return the dimensions
virtual const dimensionSet& dimensions() const;
//- Return the volume type
virtual const volumeType& volume() const;
//- Return the start time
virtual scalar timeStart() const;
//- Return the duration
virtual scalar duration() const;
//- Read properties dictionary
virtual bool read();
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -45,10 +45,32 @@ $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
/* bolt-on models */ /* bolt-on models */
submodels/addOns/radiation/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C RADIATION=submodels/addOns/radiation
submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C $(RADIATION)/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C
$(RADIATION)/scatter/cloudScatter/cloudScatter.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
KINEMATICINJECTION=submodels/Kinematic/InjectionModel
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionData.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIO.C
$(KINEMATICINJECTION)/KinematicLookupTableInjection/kinematicParcelInjectionDataIOList.C
THERMOINJECTION=submodels/Thermodynamic/InjectionModel
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionData.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIO.C
$(THERMOINJECTION)/ThermoLookupTableInjection/thermoParcelInjectionDataIOList.C
REACTINGINJECTION=submodels/Reacting/InjectionModel
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionData.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIO.C
$(REACTINGINJECTION)/ReactingLookupTableInjection/reactingParcelInjectionDataIOList.C
REACTINGMPINJECTION=submodels/ReactingMultiphase/InjectionModel
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionData.C
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIO.C
$(REACTINGMPINJECTION)/ReactingMultiphaseLookupTableInjection/reactingMultiphaseParcelInjectionDataIOList.C
/* data entries */ /* data entries */
submodels/IO/DataEntry/makeDataEntries.C submodels/IO/DataEntry/makeDataEntries.C

View File

@ -38,6 +38,7 @@ License
#include "ManualInjection.H" #include "ManualInjection.H"
#include "NoInjection.H" #include "NoInjection.H"
#include "PatchInjection.H" #include "PatchInjection.H"
#include "ReactingMultiphaseLookupTableInjection.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -108,6 +109,13 @@ License
ParcelType, \ ParcelType, \
ThermoType \ ThermoType \
); \ ); \
makeInjectionModelThermoType \
( \
ReactingMultiphaseLookupTableInjection, \
KinematicCloud, \
ParcelType, \
ThermoType \
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -94,25 +94,34 @@ Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
Type sum = pTraits<Type>::zero; Type sum = pTraits<Type>::zero;
// Return zero if out of bounds // Return zero if out of bounds
if ((x1 > table_[table_.size()-1].first()) || (x2 < table_[0].first())) if ((x1 > table_.last().first()) || (x2 < table_[0].first()))
{ {
return sum; return sum;
} }
// Find start index // Find next index greater than x1
label id1 = 0; label id1 = 0;
while ((table_[id1].first() < x1) && (id1 < table_.size())) while ((table_[id1].first() < x1) && (id1 < table_.size()))
{ {
id1++; id1++;
} }
// Find end index // Find next index less than x2
label id2 = table_.size() - 1; label id2 = table_.size() - 1;
while ((table_[id2].first() > x2) && (id2 >= 1)) while ((table_[id2].first() > x2) && (id2 >= 1))
{ {
id2--; id2--;
} }
if ((id1 - id2) == 1)
{
// x1 and x2 lie within 1 interval
sum = 0.5*(value(x1) + value(x2))*(x2 - x1);
}
else
{
// x1 and x2 cross multiple intervals
// Integrate table body // Integrate table body
for (label i=id1; i<id2; i++) for (label i=id1; i<id2; i++)
{ {
@ -135,6 +144,7 @@ Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
* (table_[id2].second() + value(x2)) * (table_[id2].second() + value(x2))
* (x2 - table_[id2].first()); * (x2 - table_[id2].first());
} }
}
return sum; return sum;
} }

View File

@ -27,11 +27,6 @@ License
#include "KinematicLookupTableInjection.H" #include "KinematicLookupTableInjection.H"
#include "scalarIOList.H" #include "scalarIOList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::KinematicLookupTableInjection<CloudType>::INPUT_FILE_COLS = 9;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
@ -62,9 +57,9 @@ Foam::scalar Foam::KinematicLookupTableInjection<CloudType>::volumeToInject
scalar volume = 0.0; scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
forAll(mDot_, injectorI) forAll(injectors_, i)
{ {
volume += mDot_[injectorI]/rho_[injectorI]*(time1 - time0); volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
} }
} }
@ -88,14 +83,7 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
( (
readScalar(this->coeffDict().lookup("parcelsPerSecond")) readScalar(this->coeffDict().lookup("parcelsPerSecond"))
), ),
x_(0), injectors_
U_(0),
d_(0),
rho_(0),
mDot_(0),
injectorCells_(0)
{
scalarListIOList injectorData
( (
IOobject IOobject
( (
@ -105,55 +93,21 @@ Foam::KinematicLookupTableInjection<CloudType>::KinematicLookupTableInjection
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
); ),
injectorCells_(0)
x_.setSize(injectorData.size());
U_.setSize(injectorData.size());
d_.setSize(injectorData.size());
rho_.setSize(injectorData.size());
mDot_.setSize(injectorData.size());
// Populate lists
forAll(injectorData, injectorI)
{ {
if (injectorData[injectorI].size() != INPUT_FILE_COLS)
{
FatalErrorIn
(
"KinematicLookupTableInjection"
"("
"const dictionary&,"
"CloudType& owner"
")"
) << "Incorrect number of entries in injector specification "
<< "- found " << injectorData[injectorI].size()
<< ", expected " << INPUT_FILE_COLS << ":" << nl
<< " x0 x1 x2 u0 u1 u2 d rho mDot " << nl
<< exit(FatalError);
}
x_[injectorI].component(0) = injectorData[injectorI][0];
x_[injectorI].component(1) = injectorData[injectorI][1];
x_[injectorI].component(2) = injectorData[injectorI][2];
U_[injectorI].component(0) = injectorData[injectorI][3];
U_[injectorI].component(1) = injectorData[injectorI][4];
U_[injectorI].component(2) = injectorData[injectorI][5];
d_[injectorI] = injectorData[injectorI][6];
rho_[injectorI] = injectorData[injectorI][7];
mDot_[injectorI] = injectorData[injectorI][8];
}
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectorData.size()); injectorCells_.setSize(injectors_.size());
forAll(x_, injectorI) forAll(injectors_, i)
{ {
this->findCellAtPosition(injectorCells_[injectorI], x_[injectorI]); this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
} }
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
forAll(mDot_, injectorI) forAll(injectors_, i)
{ {
this->volumeTotal_ += mDot_[injectorI]/rho_[injectorI]; this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
} }
this->volumeTotal_ *= duration_; this->volumeTotal_ *= duration_;
} }
@ -194,7 +148,7 @@ void Foam::KinematicLookupTableInjection<CloudType>::setPositionAndCell
{ {
label injectorI = parcelI*injectorCells_.size()/nParcels; label injectorI = parcelI*injectorCells_.size()/nParcels;
position = x_[injectorI]; position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI]; cellOwner = injectorCells_[injectorI];
} }
@ -211,13 +165,13 @@ void Foam::KinematicLookupTableInjection<CloudType>::setProperties
label injectorI = parcelI*injectorCells_.size()/nParcels; label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity // set particle velocity
parcel.U() = U_[injectorI]; parcel.U() = injectors_[injectorI].U();
// set particle diameter // set particle diameter
parcel.d() = d_[injectorI]; parcel.d() = injectors_[injectorI].d();
// set particle density // set particle density
parcel.rho() = rho_[injectorI]; parcel.rho() = injectors_[injectorI].rho();
} }

View File

@ -30,7 +30,10 @@ Description
an injection site. an injection site.
( (
(x y z u v w d rho mDot) (x y z) (u v w) d rho mDot // injector 1
(x y z) (u v w) d rho mDot // injector 2
...
(x y z) (u v w) d rho mDot // injector N
); );
where: where:
@ -49,7 +52,7 @@ SourceFiles
#define KinematicLookupTableInjection_H #define KinematicLookupTableInjection_H
#include "InjectionModel.H" #include "InjectionModel.H"
#include "pdf.H" #include "kinematicParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -76,27 +79,12 @@ class KinematicLookupTableInjection
//- Number of parcels per injector - common to all injection sources //- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_; const label nParcelsPerSecond_;
//- List of parcel position per injector / [m] //- List of injectors
List<point> x_; kinematicParcelInjectionDataIOList injectors_;
//- List of parcel velocity per injector / [m]
List<vector> U_;
//- List of parcel diameter per injector / [m]
List<scalar> d_;
//- List of parcel fluid density pre injector / [kg/m3]
List<scalar> rho_;
//- List of parcel injection mass flow per injector / [kg/s]
List<scalar> mDot_;
//- List of injector cells per injector //- List of injector cells per injector
List<label> injectorCells_; List<label> injectorCells_;
//- Number of columns expected in input file
static label INPUT_FILE_COLS;
protected: protected:

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(kinematicParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::kinematicParcelInjectionData::kinematicParcelInjectionData()
:
x_(point::zero),
U_(vector::zero),
d_(0.0),
rho_(0.0),
mDot_(0.0)
{}
Foam::kinematicParcelInjectionData::kinematicParcelInjectionData
(
const dictionary& dict
)
:
x_(dict.lookup("x")),
U_(dict.lookup("U")),
d_(readScalar(dict.lookup("d"))),
rho_(readScalar(dict.lookup("rho"))),
mDot_(readScalar(dict.lookup("mDot")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::kinematicParcelInjectionData::~kinematicParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,216 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::kinematicParcelInjectionData
Description
Container class to provide injection data for kinematic parcels
SourceFiles
kinematicParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef kinematicParcelInjectionData_H
#define kinematicParcelInjectionData_H
#include "dictionary.H"
#include "vector.H"
#include "point.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class kinematicParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const kinematicParcelInjectionData&
);
Istream& operator>>
(
Istream&,
kinematicParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class kinematicParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class kinematicParcelInjectionData
{
protected:
// Parcel properties
//- Position [m]
point x_;
//- Velocity [m/s]
vector U_;
//- Diameter [m]
scalar d_;
//- Density [kg/m3]
scalar rho_;
//- Mass flow rate [kg/s]
scalar mDot_;
public:
//- Runtime type information
TypeName("kinematicParcelInjectionData");
// Constructors
//- Null constructor
kinematicParcelInjectionData();
//- Construct from dictionary
kinematicParcelInjectionData(const dictionary& dict);
//- Construct from Istream
kinematicParcelInjectionData(Istream& is);
//-Destructor
virtual ~kinematicParcelInjectionData();
// Access
//- Return const access to the position
inline const point& x() const;
//- Return const access to the velocity
inline const vector& U() const;
//- Return const access to the diameter
inline scalar d() const;
//- Return const access to the density
inline scalar rho() const;
//- Return const access to the mass flow rate
inline scalar mDot() const;
// Edit
//- Return access to the position
inline point& x();
//- Return access to the velocity
inline vector& U();
//- Return access to the diameter
inline scalar& d();
//- Return access to the density
inline scalar& rho();
//- Return access to the mass flow rate
inline scalar& mDot();
// I-O
// Friend Operators
friend bool operator==
(
const kinematicParcelInjectionData& a,
const kinematicParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const kinematicParcelInjectionData&, "
"const kinematicParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const kinematicParcelInjectionData& a,
const kinematicParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const kinematicParcelInjectionData&, "
"const kinematicParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const kinematicParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
kinematicParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "kinematicParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -24,75 +24,67 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "pointSourceProperties.H" #include "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::word& Foam::pointSourceProperties::name() const inline const Foam::point& Foam::kinematicParcelInjectionData::x() const
{ {
return name_; return x_;
} }
inline Foam::scalar Foam::pointSourceProperties::timeStart() const inline const Foam::vector& Foam::kinematicParcelInjectionData::U() const
{ {
return timeStart_; return U_;
} }
inline Foam::scalar Foam::pointSourceProperties::timeEnd() const inline Foam::scalar Foam::kinematicParcelInjectionData::d() const
{ {
return timeStart_ + duration_; return d_;
} }
inline Foam::scalar Foam::pointSourceProperties::duration() const inline Foam::scalar Foam::kinematicParcelInjectionData::rho() const
{ {
return duration_; return rho_;
} }
inline const Foam::point& Foam::pointSourceProperties::location() const inline Foam::scalar Foam::kinematicParcelInjectionData::mDot() const
{ {
return location_; return mDot_;
} }
inline const Foam::List<Foam::pointSourceProperties::fieldNameValuePair>& inline Foam::point& Foam::kinematicParcelInjectionData::x()
Foam::pointSourceProperties::fieldData() const
{ {
return fieldData_; return x_;
} }
inline Foam::word& Foam::pointSourceProperties::name() inline Foam::vector& Foam::kinematicParcelInjectionData::U()
{ {
return name_; return U_;
} }
inline Foam::scalar& Foam::pointSourceProperties::timeStart() inline Foam::scalar& Foam::kinematicParcelInjectionData::d()
{ {
return timeStart_; return d_;
} }
inline Foam::scalar& Foam::pointSourceProperties::duration() inline Foam::scalar& Foam::kinematicParcelInjectionData::rho()
{ {
return duration_; return rho_;
} }
inline Foam::point& Foam::pointSourceProperties::location() inline Foam::scalar& Foam::kinematicParcelInjectionData::mDot()
{ {
return location_; return mDot_;
}
inline Foam::List<Foam::pointSourceProperties::fieldNameValuePair>&
Foam::pointSourceProperties::fieldData()
{
return fieldData_;
} }

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::kinematicParcelInjectionData::kinematicParcelInjectionData(Istream& is)
{
is.check("reading (Px Py Pz)");
is >> x_;
is.check("reading (Ux Uy Uz)");
is >> U_;
is.check("reading d");
is >> d_;
is.check("reading rho");
is >> rho_;
is.check("reading mDot");
is >> mDot_;
is.check("kinematicParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const kinematicParcelInjectionData& data
)
{
os << data.x_ << data.U_ << data.d_ << data.rho_ << data.mDot_;
return os;
}
Foam::Istream& Foam::operator>>(Istream& is, kinematicParcelInjectionData& data)
{
is.check("reading (Px Py Pz)");
is >> data.x_;
is.check("reading (Ux Uy Uz)");
is >> data.U_;
is.check("reading d");
is >> data.d_;
is.check("reading rho");
is >> data.rho_;
is.check("reading mDot");
is >> data.mDot_;
is.check("operator(Istream&, kinematicParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "kinematicParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<kinematicParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Description
SourceFiles
kinematicParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef kinematicParcelInjectionDataIOList_H
#define kinematicParcelInjectionDataIOList_H
#include "IOList.H"
#include "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<kinematicParcelInjectionData>
kinematicParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -25,12 +25,6 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "ReactingLookupTableInjection.H" #include "ReactingLookupTableInjection.H"
#include "scalarIOList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::ReactingLookupTableInjection<CloudType>::INPUT_FILE_COLS = 12;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
@ -62,9 +56,9 @@ Foam::scalar Foam::ReactingLookupTableInjection<CloudType>::volumeToInject
scalar volume = 0.0; scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
forAll(mDot_, injectorI) forAll(injectors_, i)
{ {
volume += mDot_[injectorI]/rho_[injectorI]*(time1 - time0); volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
} }
} }
@ -88,17 +82,7 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
( (
readScalar(this->coeffDict().lookup("parcelsPerSecond")) readScalar(this->coeffDict().lookup("parcelsPerSecond"))
), ),
x_(0), injectors_
U_(0),
d_(0),
rho_(0),
mDot_(0),
T_(0),
cp_(0),
Y_(0),
injectorCells_(0)
{
scalarListIOList injectorData
( (
IOobject IOobject
( (
@ -108,75 +92,21 @@ Foam::ReactingLookupTableInjection<CloudType>::ReactingLookupTableInjection
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
); ),
injectorCells_(0)
x_.setSize(injectorData.size());
U_.setSize(injectorData.size());
d_.setSize(injectorData.size());
rho_.setSize(injectorData.size());
mDot_.setSize(injectorData.size());
T_.setSize(injectorData.size());
cp_.setSize(injectorData.size());
Y_.setSize(injectorData.size());
// Populate lists
forAll(injectorData, injectorI)
{ {
if (injectorData[injectorI].size() != INPUT_FILE_COLS)
{
FatalErrorIn
(
"ReactingLookupTableInjection"
"("
"const dictionary&,"
"CloudType& owner"
")"
) << "Incorrect number of entries in injector specification "
<< "- found " << injectorData[injectorI].size()
<< ", expected a minimum of " << INPUT_FILE_COLS << ":" << nl
<< " x0 x1 x2 u0 u1 u2 d rho mDot T cp Y0..YN"
<< nl << exit(FatalError);
}
x_[injectorI].component(0) = injectorData[injectorI][0];
x_[injectorI].component(1) = injectorData[injectorI][1];
x_[injectorI].component(2) = injectorData[injectorI][2];
U_[injectorI].component(0) = injectorData[injectorI][3];
U_[injectorI].component(1) = injectorData[injectorI][4];
U_[injectorI].component(2) = injectorData[injectorI][5];
d_[injectorI] = injectorData[injectorI][6];
rho_[injectorI] = injectorData[injectorI][7];
mDot_[injectorI] = injectorData[injectorI][8];
T_[injectorI] = injectorData[injectorI][9];
cp_[injectorI] = injectorData[injectorI][10];
Y_[injectorI].setSize
(
injectorData[injectorI].size() - INPUT_FILE_COLS + 1
);
label Yi = 0;
for
(
label i = INPUT_FILE_COLS-1;
i < injectorData[injectorI].size();
i++
)
{
Y_[injectorI][Yi++] = injectorData[injectorI][i];
}
}
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectorData.size()); injectorCells_.setSize(injectors_.size());
forAll(x_, injectorI) forAll(injectors_, i)
{ {
this->findCellAtPosition(injectorCells_[injectorI], x_[injectorI]); this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
} }
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
forAll(mDot_, injectorI) forAll(injectors_, i)
{ {
this->volumeTotal_ += mDot_[injectorI]/rho_[injectorI]; this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
} }
this->volumeTotal_ *= duration_; this->volumeTotal_ *= duration_;
} }
@ -217,7 +147,7 @@ void Foam::ReactingLookupTableInjection<CloudType>::setPositionAndCell
{ {
label injectorI = parcelI*injectorCells_.size()/nParcels; label injectorI = parcelI*injectorCells_.size()/nParcels;
position = x_[injectorI]; position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI]; cellOwner = injectorCells_[injectorI];
} }
@ -234,22 +164,22 @@ void Foam::ReactingLookupTableInjection<CloudType>::setProperties
label injectorI = parcelI*injectorCells_.size()/nParcels; label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity // set particle velocity
parcel.U() = U_[injectorI]; parcel.U() = injectors_[injectorI].U();
// set particle diameter // set particle diameter
parcel.d() = d_[injectorI]; parcel.d() = injectors_[injectorI].d();
// set particle density // set particle density
parcel.rho() = rho_[injectorI]; parcel.rho() = injectors_[injectorI].rho();
// set particle temperature // set particle temperature
parcel.T() = T_[injectorI]; parcel.T() = injectors_[injectorI].T();
// set particle specific heat capacity // set particle specific heat capacity
parcel.cp() = cp_[injectorI]; parcel.cp() = injectors_[injectorI].cp();
// set particle component mass fractions // set particle component mass fractions
parcel.Y() = Y_[injectorI]; parcel.Y() = injectors_[injectorI].Y();
} }

View File

@ -30,7 +30,10 @@ Description
an injection site. an injection site.
( (
(x y z u v w d rho mDot T cp Y0..YN) (x y z) (u v w) d rho mDot T cp (Y0..YN) // injector 1
(x y z) (u v w) d rho mDot T cp (Y0..YN) // injector 2
...
(x y z) (u v w) d rho mDot T cp (Y0..YN) // injector N
); );
where: where:
@ -41,6 +44,7 @@ Description
mDot = mass flow rate [kg/m3] mDot = mass flow rate [kg/m3]
T = temperature [K] T = temperature [K]
cp = specific heat capacity [J/kg/K] cp = specific heat capacity [J/kg/K]
Y = list of mass fractions
SourceFiles SourceFiles
ReactingLookupTableInjection.C ReactingLookupTableInjection.C
@ -51,7 +55,7 @@ SourceFiles
#define ReactingLookupTableInjection_H #define ReactingLookupTableInjection_H
#include "InjectionModel.H" #include "InjectionModel.H"
#include "pdf.H" #include "reactingParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,36 +82,12 @@ class ReactingLookupTableInjection
//- Number of parcels per injector - common to all injection sources //- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_; const label nParcelsPerSecond_;
//- List of parcel position per injector / [m] //- List of injectors
List<point> x_; reactingParcelInjectionDataIOList injectors_;
//- List of parcel velocity per injector / [m]
List<vector> U_;
//- List of parcel diameter per injector / [m]
List<scalar> d_;
//- List of parcel fluid density pre injector / [kg/m3]
List<scalar> rho_;
//- List of parcel injection mass flow per injector / [kg/s]
List<scalar> mDot_;
//- List of parcel temperature flow per injector / [K]
List<scalar> T_;
//- List of parcel specific heat capacity per injector / [J/kg/K]
List<scalar> cp_;
//- List of parcel specie mass fractions per injector / []
List<scalarList> Y_;
//- List of injector cells per injector //- List of injector cells per injector
List<label> injectorCells_; List<label> injectorCells_;
//- Number of columns expected in input file
static label INPUT_FILE_COLS;
protected: protected:

View File

@ -0,0 +1,60 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(reactingParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::reactingParcelInjectionData::reactingParcelInjectionData()
:
thermoParcelInjectionData(),
Y_()
{}
Foam::reactingParcelInjectionData::reactingParcelInjectionData
(
const dictionary& dict
)
:
thermoParcelInjectionData(dict),
Y_(dict.lookup("Y"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::reactingParcelInjectionData::~reactingParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,181 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::reactingParcelInjectionData
Description
Container class to provide injection data for reacting parcels
SourceFiles
reactingParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef reactingParcelInjectionData_H
#define reactingParcelInjectionData_H
#include "thermoParcelInjectionData.H"
#include "scalarList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class reactingParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const reactingParcelInjectionData&
);
Istream& operator>>
(
Istream&,
reactingParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class reactingParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class reactingParcelInjectionData
:
public thermoParcelInjectionData
{
protected:
// Parcel properties
//- List of mass fractions
scalarList Y_;
public:
//- Runtime type information
TypeName("reactingParcelInjectionData");
// Constructors
//- Null constructor
reactingParcelInjectionData();
//- Construct from dictionary
reactingParcelInjectionData(const dictionary& dict);
//- Construct from Istream
reactingParcelInjectionData(Istream& is);
//-Destructor
virtual ~reactingParcelInjectionData();
// Access
//- Return const access to the list of mass fractions
inline const scalarList& Y() const;
// Edit
//- Return access to the mass fractions
inline scalarList& Y();
// I-O
// Friend Operators
friend bool operator==
(
const reactingParcelInjectionData& a,
const reactingParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingParcelInjectionData&, "
"const reactingParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const reactingParcelInjectionData& a,
const reactingParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingParcelInjectionData&, "
"const reactingParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const reactingParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
reactingParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::scalarList& Foam::reactingParcelInjectionData::Y() const
{
return Y_;
}
inline Foam::scalarList& Foam::reactingParcelInjectionData::Y()
{
return Y_;
}
// ************************************************************************* //

View File

@ -0,0 +1,71 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::reactingParcelInjectionData::reactingParcelInjectionData(Istream& is)
:
thermoParcelInjectionData(is)
{
is.check("reading Y's");
is >> Y_;
is.check("reactingParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const reactingParcelInjectionData& data
)
{
os << static_cast<const thermoParcelInjectionData&>(data);
os << data.Y_;
return os;
}
Foam::Istream& Foam::operator>>(Istream& is, reactingParcelInjectionData& data)
{
is >> static_cast<thermoParcelInjectionData&>(data);
is.check("reading Y's");
is >> data.Y_;
is.check("operator(Istream&, reactingParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<reactingParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Description
SourceFiles
reactingParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef reactingParcelInjectionDataIOList_H
#define reactingParcelInjectionDataIOList_H
#include "IOList.H"
#include "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<reactingParcelInjectionData>
reactingParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,218 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "ReactingMultiphaseLookupTableInjection.H"
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType>
Foam::label
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::parcelsToInject
(
const scalar time0,
const scalar time1
) const
{
if ((time0 >= 0.0) && (time0 < duration_))
{
return round(injectorCells_.size()*(time1 - time0)*nParcelsPerSecond_);
}
else
{
return 0;
}
}
template<class CloudType>
Foam::scalar
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::volumeToInject
(
const scalar time0,
const scalar time1
) const
{
scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_))
{
forAll(injectors_, i)
{
volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
}
}
return volume;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
ReactingMultiphaseLookupTableInjection
(
const dictionary& dict,
CloudType& owner
)
:
InjectionModel<CloudType>(dict, owner, typeName),
inputFileName_(this->coeffDict().lookup("inputFile")),
duration_(readScalar(this->coeffDict().lookup("duration"))),
nParcelsPerSecond_
(
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
),
injectors_
(
IOobject
(
inputFileName_,
owner.db().time().constant(),
owner.db(),
IOobject::MUST_READ,
IOobject::NO_WRITE
)
),
injectorCells_(0)
{
// Set/cache the injector cells
injectorCells_.setSize(injectors_.size());
forAll(injectors_, i)
{
this->findCellAtPosition(injectorCells_[i], injectors_[i].x());
}
// Determine volume of particles to inject
this->volumeTotal_ = 0.0;
forAll(injectors_, i)
{
this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
}
this->volumeTotal_ *= duration_;
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::
~ReactingMultiphaseLookupTableInjection()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::active() const
{
return true;
}
template<class CloudType>
Foam::scalar
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::timeEnd() const
{
return this->SOI_ + duration_;
}
template<class CloudType>
void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI];
}
template<class CloudType>
void Foam::ReactingMultiphaseLookupTableInjection<CloudType>::setProperties
(
const label parcelI,
const label nParcels,
const scalar,
typename CloudType::parcelType& parcel
)
{
label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity
parcel.U() = injectors_[injectorI].U();
// set particle diameter
parcel.d() = injectors_[injectorI].d();
// set particle density
parcel.rho() = injectors_[injectorI].rho();
// set particle temperature
parcel.T() = injectors_[injectorI].T();
// set particle specific heat capacity
parcel.cp() = injectors_[injectorI].cp();
// set particle component mass fractions
parcel.Y() = injectors_[injectorI].Y();
// set particle gaseous component mass fractions
parcel.YGas() = injectors_[injectorI].YGas();
// set particle liquid component mass fractions
parcel.YLiquid() = injectors_[injectorI].YLiquid();
// set particle solid component mass fractions
parcel.YSolid() = injectors_[injectorI].YSolid();
}
template<class CloudType>
bool
Foam::ReactingMultiphaseLookupTableInjection<CloudType>::fullyDescribed() const
{
return true;
}
template<class CloudType>
bool Foam::ReactingMultiphaseLookupTableInjection<CloudType>::validInjection
(
const label
)
{
return true;
}
// ************************************************************************* //

View File

@ -0,0 +1,187 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2008-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::ReactingMultiphaseLookupTableInjection
Description
Particle injection sources read from look-up table. Each row corresponds to
an injection site.
(
(x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
(x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
...
(x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
);
where:
x, y, z = global cartesian co-ordinates [m]
u, v, w = global cartesian velocity components [m/s]
d = diameter [m]
rho = density [kg/m3]
mDot = mass flow rate [kg/m3]
T = temperature [K]
cp = specific heat capacity [J/kg/K]
Y(3) = total mass fraction of gas (Y0), liquid (Y1), solid (Y3)
Yg(Ngas) = mass fractions of gaseous components
Yl(Nliq) = mass fractions of liquid components
Ys(Nsld) = mass fractions of solid components
SourceFiles
ReactingMultiphaseLookupTableInjection.C
\*---------------------------------------------------------------------------*/
#ifndef ReactingMultiphaseLookupTableInjection_H
#define ReactingMultiphaseLookupTableInjection_H
#include "InjectionModel.H"
#include "reactingMultiphaseParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class ReactingMultiphaseLookupTableInjection Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class ReactingMultiphaseLookupTableInjection
:
public InjectionModel<CloudType>
{
// Private data
//- Name of file containing injector/parcel data
const word inputFileName_;
//- Injection duration - common to all injection sources
const scalar duration_;
//- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_;
//- List of injectors
reactingMultiphaseParcelInjectionDataIOList injectors_;
//- List of injector cells per injector
List<label> injectorCells_;
protected:
// Protected member functions
//- Number of parcels to introduce over the time step relative to SOI
label parcelsToInject
(
const scalar time0,
const scalar time1
) const;
//- Volume of parcels to introduce over the time step relative to SOI
scalar volumeToInject
(
const scalar time0,
const scalar time1
) const;
public:
//- Runtime type information
TypeName("ReactingMultiphaseLookupTableInjection");
// Constructors
//- Construct from dictionary
ReactingMultiphaseLookupTableInjection
(
const dictionary& dict,
CloudType& owner
);
//- Destructor
virtual ~ReactingMultiphaseLookupTableInjection();
// Member Functions
//- Flag to indicate whether model activates injection model
bool active() const;
//- Return the end-of-injection time
scalar timeEnd() const;
// Injection geometry
//- Set the injection position and owner cell
virtual void setPositionAndCell
(
const label parcelI,
const label nParcels,
const scalar time,
vector& position,
label& cellOwner
);
//- Set the parcel properties
virtual void setProperties
(
const label parcelI,
const label nParcels,
const scalar time,
typename CloudType::parcelType& parcel
);
//- Flag to identify whether model fully describes the parcel
virtual bool fullyDescribed() const;
//- Return flag to identify whether or not injection of parcelI is
// permitted
virtual bool validInjection(const label parcelI);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "ReactingMultiphaseLookupTableInjection.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,67 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(reactingMultiphaseParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::reactingMultiphaseParcelInjectionData::
reactingMultiphaseParcelInjectionData()
:
reactingParcelInjectionData(),
YGas_(),
YLiquid_(),
YSolid_()
{}
Foam::reactingMultiphaseParcelInjectionData::
reactingMultiphaseParcelInjectionData
(
const dictionary& dict
)
:
reactingParcelInjectionData(dict),
YGas_(dict.lookup("YGas")),
YLiquid_(dict.lookup("YLiquid")),
YSolid_(dict.lookup("YSolid"))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::reactingMultiphaseParcelInjectionData::
~reactingMultiphaseParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,198 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::reactingMultiphaseParcelInjectionData
Description
Container class to provide injection data for reacting multiphase parcels
SourceFiles
reactingMultiphaseParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef reactingMultiphaseParcelInjectionData_H
#define reactingMultiphaseParcelInjectionData_H
#include "reactingParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class reactingMultiphaseParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const reactingMultiphaseParcelInjectionData&
);
Istream& operator>>
(
Istream&,
reactingMultiphaseParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class reactingMultiphaseParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class reactingMultiphaseParcelInjectionData
:
public reactingParcelInjectionData
{
protected:
// Parcel properties
//- List of gaseous mass fractions
scalarList YGas_;
//- List of liquid mass fractions
scalarList YLiquid_;
//- List of solid mass fractions
scalarList YSolid_;
public:
//- Runtime type information
TypeName("reactingMultiphaseParcelInjectionData");
// Constructors
//- Null constructor
reactingMultiphaseParcelInjectionData();
//- Construct from dictionary
reactingMultiphaseParcelInjectionData(const dictionary& dict);
//- Construct from Istream
reactingMultiphaseParcelInjectionData(Istream& is);
//-Destructor
virtual ~reactingMultiphaseParcelInjectionData();
// Access
//- Return const access to the list of gaseous mass fractions
inline const scalarList& YGas() const;
//- Return const access to the list of liquid mass fractions
inline const scalarList& YLiquid() const;
//- Return const access to the list of solid mass fractions
inline const scalarList& YSolid() const;
// Edit
//- Return access to the gaseous mass fractions
inline scalarList& YGas();
//- Return access to the liquid mass fractions
inline scalarList& YLiquid();
//- Return access to the solid mass fractions
inline scalarList& YSolid();
// I-O
// Friend Operators
friend bool operator==
(
const reactingMultiphaseParcelInjectionData& a,
const reactingMultiphaseParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingMultiphaseParcelInjectionData&, "
"const reactingMultiphaseParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const reactingMultiphaseParcelInjectionData& a,
const reactingMultiphaseParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const reactingMultiphaseParcelInjectionData&, "
"const reactingMultiphaseParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const reactingMultiphaseParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
reactingMultiphaseParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "reactingMultiphaseParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,70 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline const Foam::scalarList&
Foam::reactingMultiphaseParcelInjectionData::YGas() const
{
return YGas_;
}
inline const Foam::scalarList&
Foam::reactingMultiphaseParcelInjectionData::YLiquid() const
{
return YLiquid_;
}
inline const Foam::scalarList&
Foam::reactingMultiphaseParcelInjectionData::YSolid() const
{
return YSolid_;
}
inline Foam::scalarList& Foam::reactingMultiphaseParcelInjectionData::YGas()
{
return YGas_;
}
inline Foam::scalarList& Foam::reactingMultiphaseParcelInjectionData::YLiquid()
{
return YLiquid_;
}
inline Foam::scalarList& Foam::reactingMultiphaseParcelInjectionData::YSolid()
{
return YSolid_;
}
// ************************************************************************* //

View File

@ -0,0 +1,88 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::reactingMultiphaseParcelInjectionData::
reactingMultiphaseParcelInjectionData(Istream& is)
:
reactingParcelInjectionData(is)
{
is.check("reading YGas's");
is >> YGas_;
is.check("reading YLiquid's");
is >> YLiquid_;
is.check("reading YSolid's");
is >> YSolid_;
is.check("reactingMultiphaseParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const reactingMultiphaseParcelInjectionData& data
)
{
os << static_cast<const reactingParcelInjectionData&>(data);
os << data.YGas_ << data.YLiquid_ << data.YSolid_;
return os;
}
Foam::Istream& Foam::operator>>
(
Istream& is,
reactingMultiphaseParcelInjectionData& data
)
{
is >> static_cast<reactingParcelInjectionData&>(data);
is.check("reading YGas's");
is >> data.YGas_;
is.check("reading YLiquid's");
is >> data.YLiquid_;
is.check("reading YSolid's");
is >> data.YSolid_;
is.check("operator(Istream&, reactingMultiphaseParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "reactingMultiphaseParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<reactingMultiphaseParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Description
SourceFiles
reactingMultiphaseParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef reactingMultiphaseParcelInjectionDataIOList_H
#define reactingMultiphaseParcelInjectionDataIOList_H
#include "IOList.H"
#include "reactingMultiphaseParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<reactingMultiphaseParcelInjectionData>
reactingMultiphaseParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -27,11 +27,6 @@ License
#include "ThermoLookupTableInjection.H" #include "ThermoLookupTableInjection.H"
#include "scalarIOList.H" #include "scalarIOList.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::label Foam::ThermoLookupTableInjection<CloudType>::INPUT_FILE_COLS = 11;
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
@ -62,9 +57,9 @@ Foam::scalar Foam::ThermoLookupTableInjection<CloudType>::volumeToInject
scalar volume = 0.0; scalar volume = 0.0;
if ((time0 >= 0.0) && (time0 < duration_)) if ((time0 >= 0.0) && (time0 < duration_))
{ {
forAll(mDot_, injectorI) forAll(injectors_, i)
{ {
volume += mDot_[injectorI]/rho_[injectorI]*(time1 - time0); volume += injectors_[i].mDot()/injectors_[i].rho()*(time1 - time0);
} }
} }
@ -88,16 +83,7 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
( (
readScalar(this->coeffDict().lookup("parcelsPerSecond")) readScalar(this->coeffDict().lookup("parcelsPerSecond"))
), ),
x_(0), injectors_
U_(0),
d_(0),
rho_(0),
mDot_(0),
T_(0),
cp_(0),
injectorCells_(0)
{
scalarListIOList injectorData
( (
IOobject IOobject
( (
@ -107,59 +93,21 @@ Foam::ThermoLookupTableInjection<CloudType>::ThermoLookupTableInjection
IOobject::MUST_READ, IOobject::MUST_READ,
IOobject::NO_WRITE IOobject::NO_WRITE
) )
); ),
injectorCells_(0)
x_.setSize(injectorData.size());
U_.setSize(injectorData.size());
d_.setSize(injectorData.size());
rho_.setSize(injectorData.size());
mDot_.setSize(injectorData.size());
T_.setSize(injectorData.size());
cp_.setSize(injectorData.size());
// Populate lists
forAll(injectorData, injectorI)
{ {
if (injectorData[injectorI].size() != INPUT_FILE_COLS)
{
FatalErrorIn
(
"ThermoLookupTableInjection"
"("
"const dictionary&,"
"CloudType& owner"
")"
) << "Incorrect number of entries in injector specification "
<< "- found " << injectorData[injectorI].size()
<< ", expected " << INPUT_FILE_COLS << ":" << nl
<< " x0 x1 x2 u0 u1 u2 d rho mDot T cp"
<< nl << exit(FatalError);
}
x_[injectorI].component(0) = injectorData[injectorI][0];
x_[injectorI].component(1) = injectorData[injectorI][1];
x_[injectorI].component(2) = injectorData[injectorI][2];
U_[injectorI].component(0) = injectorData[injectorI][3];
U_[injectorI].component(1) = injectorData[injectorI][4];
U_[injectorI].component(2) = injectorData[injectorI][5];
d_[injectorI] = injectorData[injectorI][6];
rho_[injectorI] = injectorData[injectorI][7];
mDot_[injectorI] = injectorData[injectorI][8];
T_[injectorI] = injectorData[injectorI][9];
cp_[injectorI] = injectorData[injectorI][10];
}
// Set/cache the injector cells // Set/cache the injector cells
injectorCells_.setSize(injectorData.size()); injectorCells_.setSize(injectors_.size());
forAll(x_, injectorI) forAll(injectors_, i)
{ {
this->findCellAtPosition(injectorCells_[injectorI], x_[injectorI]); this->findCellAtPosition(injectorCells_[injectorI], injectors_[i].x());
} }
// Determine volume of particles to inject // Determine volume of particles to inject
this->volumeTotal_ = 0.0; this->volumeTotal_ = 0.0;
forAll(mDot_, injectorI) forAll(injectors_, i)
{ {
this->volumeTotal_ += mDot_[injectorI]/rho_[injectorI]; this->volumeTotal_ += injectors_[i].mDot()/injectors_[i].rho();
} }
this->volumeTotal_ *= duration_; this->volumeTotal_ *= duration_;
} }
@ -200,7 +148,7 @@ void Foam::ThermoLookupTableInjection<CloudType>::setPositionAndCell
{ {
label injectorI = parcelI*injectorCells_.size()/nParcels; label injectorI = parcelI*injectorCells_.size()/nParcels;
position = x_[injectorI]; position = injectors_[injectorI].x();
cellOwner = injectorCells_[injectorI]; cellOwner = injectorCells_[injectorI];
} }
@ -217,19 +165,19 @@ void Foam::ThermoLookupTableInjection<CloudType>::setProperties
label injectorI = parcelI*injectorCells_.size()/nParcels; label injectorI = parcelI*injectorCells_.size()/nParcels;
// set particle velocity // set particle velocity
parcel.U() = U_[injectorI]; parcel.U() = injectors_[injectorI].U();
// set particle diameter // set particle diameter
parcel.d() = d_[injectorI]; parcel.d() = injectors_[injectorI].d();
// set particle density // set particle density
parcel.rho() = rho_[injectorI]; parcel.rho() = injectors_[injectorI].rho();
// set particle temperature // set particle temperature
parcel.T() = T_[injectorI]; parcel.T() = injectors_[injectorI].T();
// set particle specific heat capacity // set particle specific heat capacity
parcel.cp() = cp_[injectorI]; parcel.cp() = injectors_[injectorI].cp();
} }

View File

@ -30,7 +30,10 @@ Description
an injection site. an injection site.
( (
(x y z u v w d rho mDot T cp) (x y z) (u v w) d rho mDot T cp // injector 1
(x y z) (u v w) d rho mDot T cp // injector 2
...
(x y z) (u v w) d rho mDot T cp // injector N
); );
where: where:
@ -51,7 +54,7 @@ SourceFiles
#define ThermoLookupTableInjection_H #define ThermoLookupTableInjection_H
#include "InjectionModel.H" #include "InjectionModel.H"
#include "pdf.H" #include "kinematicParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -78,33 +81,12 @@ class ThermoLookupTableInjection
//- Number of parcels per injector - common to all injection sources //- Number of parcels per injector - common to all injection sources
const label nParcelsPerSecond_; const label nParcelsPerSecond_;
//- List of parcel position per injector / [m] //- List of injectors
List<point> x_; kinematicParcelInjectionDataIOList injectors_;
//- List of parcel velocity per injector / [m]
List<vector> U_;
//- List of parcel diameter per injector / [m]
List<scalar> d_;
//- List of parcel fluid density pre injector / [kg/m3]
List<scalar> rho_;
//- List of parcel injection mass flow per injector / [kg/s]
List<scalar> mDot_;
//- List of parcel temperature flow per injector / [K]
List<scalar> T_;
//- List of parcel specific heat capacity per injector / [J/kg/K]
List<scalar> cp_;
//- List of injector cells per injector //- List of injector cells per injector
List<label> injectorCells_; List<label> injectorCells_;
//- Number of columns expected in input file
static label INPUT_FILE_COLS;
protected: protected:

View File

@ -0,0 +1,62 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
defineTypeNameAndDebug(thermoParcelInjectionData, 0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::thermoParcelInjectionData::thermoParcelInjectionData()
:
kinematicParcelInjectionData(),
T_(0.0),
cp_(0.0)
{}
Foam::thermoParcelInjectionData::thermoParcelInjectionData
(
const dictionary& dict
)
:
kinematicParcelInjectionData(dict),
T_(readScalar(dict.lookup("T"))),
cp_(readScalar(dict.lookup("cp")))
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::thermoParcelInjectionData::~thermoParcelInjectionData()
{}
// ************************************************************************* //

View File

@ -0,0 +1,189 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::thermoParcelInjectionData
Description
Container class to provide injection data for thermodynamic parcels
SourceFiles
thermoParcelInjectionData.C
\*---------------------------------------------------------------------------*/
#ifndef thermoParcelInjectionData_H
#define thermoParcelInjectionData_H
#include "kinematicParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// Forward declaration of classes
class thermoParcelInjectionData;
// Forward declaration of friend functions
Ostream& operator<<
(
Ostream&,
const thermoParcelInjectionData&
);
Istream& operator>>
(
Istream&,
thermoParcelInjectionData&
);
/*---------------------------------------------------------------------------*\
Class thermoParcelInjectionData Declaration
\*---------------------------------------------------------------------------*/
class thermoParcelInjectionData
:
public kinematicParcelInjectionData
{
protected:
// Parcel properties
//- Temperature [K]
scalar T_;
//- Specific heat capacity [J/kg/K]
scalar cp_;
public:
//- Runtime type information
TypeName("thermoParcelInjectionData");
// Constructors
//- Null constructor
thermoParcelInjectionData();
//- Construct from dictionary
thermoParcelInjectionData(const dictionary& dict);
//- Construct from Istream
thermoParcelInjectionData(Istream& is);
//-Destructor
virtual ~thermoParcelInjectionData();
// Access
//- Return const access to the temperature
inline scalar T() const;
//- Return const access to the specific heat capacity
inline scalar cp() const;
// Edit
//- Return access to the temperature
inline scalar& T();
//- Return access to the specific heat capacity
inline scalar& cp();
// I-O
// Friend Operators
friend bool operator==
(
const thermoParcelInjectionData& a,
const thermoParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const thermoParcelInjectionData&, "
"const thermoParcelInjectionData&"
")"
);
return false;
}
friend bool operator!=
(
const thermoParcelInjectionData& a,
const thermoParcelInjectionData& b
)
{
notImplemented
(
"operator=="
"("
"const thermoParcelInjectionData&, "
"const thermoParcelInjectionData&"
")"
);
return false;
}
//- Ostream operator
friend Ostream& operator<<
(
Ostream& os,
const thermoParcelInjectionData& data
);
//- Istream operator
friend Istream& operator>>
(
Istream& is,
thermoParcelInjectionData& data
);
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "thermoParcelInjectionDataI.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,55 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
inline Foam::scalar Foam::thermoParcelInjectionData::T() const
{
return T_;
}
inline Foam::scalar Foam::thermoParcelInjectionData::cp() const
{
return cp_;
}
inline Foam::scalar& Foam::thermoParcelInjectionData::T()
{
return T_;
}
inline Foam::scalar& Foam::thermoParcelInjectionData::cp()
{
return cp_;
}
// ************************************************************************* //

View File

@ -0,0 +1,77 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::thermoParcelInjectionData::thermoParcelInjectionData(Istream& is)
:
kinematicParcelInjectionData(is)
{
is.check("reading T");
is >> T_;
is.check("reading cp");
is >> cp_;
is.check("thermoParcelInjectionData(Istream& is)");
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Ostream& Foam::operator<<
(
Ostream& os,
const thermoParcelInjectionData& data
)
{
os << static_cast<const kinematicParcelInjectionData&>(data);
os << data.T_ << data.cp_;
return os;
}
Foam::Istream& Foam::operator>>(Istream& is, thermoParcelInjectionData& data)
{
is >> static_cast<kinematicParcelInjectionData&>(data);
is.check("reading T");
is >> data.T_;
is.check("reading cp");
is >> data.cp_;
is.check("operator(Istream&, thermoParcelInjectionData&)");
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,37 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "thermoParcelInjectionDataIOList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOList<thermoParcelInjectionData>, 0);
}
// ************************************************************************* //

View File

@ -0,0 +1,52 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Description
SourceFiles
thermoParcelInjectionDataIOList.C
\*---------------------------------------------------------------------------*/
#ifndef thermoParcelInjectionDataIOList_H
#define thermoParcelInjectionDataIOList_H
#include "IOList.H"
#include "thermoParcelInjectionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
typedef IOList<thermoParcelInjectionData>
thermoParcelInjectionDataIOList;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -51,13 +51,12 @@ class cellSet
: :
public topoSet public topoSet
{ {
// Private Member Functions // Private Member Functions
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
cellSet(const cellSet&); cellSet(const cellSet&);
public: public:
//- Runtime type information //- Runtime type information
@ -66,7 +65,6 @@ public:
// Constructors // Constructors
//- Construct from IOobject. No checking. //- Construct from IOobject. No checking.
cellSet(const IOobject& obj); cellSet(const IOobject& obj);
@ -161,7 +159,6 @@ public:
const primitiveMesh&, const primitiveMesh&,
const label maxLen const label maxLen
) const; ) const;
}; };

View File

@ -309,8 +309,8 @@ List<specieElement> currentSpecieComposition(5);
scalar currentLowT = 0; scalar currentLowT = 0;
scalar currentHighT = 0; scalar currentHighT = 0;
scalar currentCommonT = 0; scalar currentCommonT = 0;
gasThermoPhysics::coeffArray highCpCoeffs; gasThermoPhysics::coeffArray highCpCoeffs = {0, 0, 0, 0, 0, 0, 0};
gasThermoPhysics::coeffArray lowCpCoeffs; gasThermoPhysics::coeffArray lowCpCoeffs = {0, 0, 0, 0, 0, 0, 0};
gasReaction::specieCoeffs currentSpecieCoeff; gasReaction::specieCoeffs currentSpecieCoeff;

View File

@ -26,7 +26,8 @@ Class
Foam::basicMultiComponentMixture Foam::basicMultiComponentMixture
Description Description
combustion mixture Multi-component mixture. Provides a list of mass fraction fields and helper
functions to query mixture composition.
SourceFiles SourceFiles
basicMultiComponentMixture.C basicMultiComponentMixture.C

View File

@ -23,6 +23,7 @@ $(mutWallFunctions)/mutkWallFunction/mutkWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C $(mutWallFunctions)/mutURoughWallFunction/mutURoughWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C $(mutWallFunctions)/mutUSpaldingWallFunction/mutUSpaldingWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C $(mutWallFunctions)/mutUWallFunction/mutUWallFunctionFvPatchScalarField.C
$(mutWallFunctions)/mutLowReWallFunction/mutLowReWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C

View File

@ -0,0 +1,118 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "mutLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> mutLowReWallFunctionFvPatchScalarField::calcMut() const
{
return tmp<scalarField>(new scalarField(patch().size(), 0.0));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(p, iF)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
mutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
mutkWallFunctionFvPatchScalarField(p, iF, dict)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField& mlrwfpsf
)
:
mutkWallFunctionFvPatchScalarField(mlrwfpsf)
{}
mutLowReWallFunctionFvPatchScalarField::mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField& mlrwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
mutkWallFunctionFvPatchScalarField(mlrwfpsf, iF)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField
(
fvPatchScalarField,
mutLowReWallFunctionFvPatchScalarField
);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::compressible::RASModels::mutLowReWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when for use with
low Reynolds number models.
Sets mut to zero, and provides an access to calculate y+.
SourceFiles
mutLowReWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef compressibleMutLowReWallFunctionFvPatchScalarField_H
#define compressibleMutLowReWallFunctionFvPatchScalarField_H
#include "mutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace compressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class mutLowReWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class mutLowReWallFunctionFvPatchScalarField
:
public mutkWallFunctionFvPatchScalarField
{
protected:
// Private member functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcMut() const;
public:
//- Runtime type information
TypeName("mutLowReWallFunction");
// Constructors
//- Construct from patch and internal field
mutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
mutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// mutLowReWallFunctionFvPatchScalarField
// onto a new patch
mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new mutLowReWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
mutLowReWallFunctionFvPatchScalarField
(
const mutLowReWallFunctionFvPatchScalarField&,
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 mutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace compressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -35,8 +35,8 @@ SourceFiles
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef compressibleMutWallFunctionFvPatchScalarField_H #ifndef compressibleMutkWallFunctionFvPatchScalarField_H
#define compressibleMutWallFunctionFvPatchScalarField_H #define compressibleMutkWallFunctionFvPatchScalarField_H
#include "fixedValueFvPatchFields.H" #include "fixedValueFvPatchFields.H"

View File

@ -27,6 +27,7 @@ $(nutWallFunctions)/nutURoughWallFunction/nutURoughWallFunctionFvPatchScalarFiel
$(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUSpaldingWallFunction/nutUSpaldingWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUWallFunction/nutUWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C $(nutWallFunctions)/nutUTabulatedWallFunction/nutUTabulatedWallFunctionFvPatchScalarField.C
$(nutWallFunctions)/nutLowReWallFunction/nutLowReWallFunctionFvPatchScalarField.C
epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions epsilonWallFunctions = $(wallFunctions)/epsilonWallFunctions
$(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C $(epsilonWallFunctions)/epsilonWallFunction/epsilonWallFunctionFvPatchScalarField.C

View File

@ -0,0 +1,114 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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 "nutLowReWallFunctionFvPatchScalarField.H"
#include "RASModel.H"
#include "fvPatchFieldMapper.H"
#include "volFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
tmp<scalarField> nutLowReWallFunctionFvPatchScalarField::calcNut() const
{
return tmp<scalarField>(new scalarField(patch().size(), 0.0));
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF
)
:
nutkWallFunctionFvPatchScalarField(p, iF)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& ptf,
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
nutkWallFunctionFvPatchScalarField(ptf, p, iF, mapper)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const fvPatch& p,
const DimensionedField<scalar, volMesh>& iF,
const dictionary& dict
)
:
nutkWallFunctionFvPatchScalarField(p, iF, dict)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf
)
:
nutkWallFunctionFvPatchScalarField(nlrwfpsf)
{}
nutLowReWallFunctionFvPatchScalarField::nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField& nlrwfpsf,
const DimensionedField<scalar, volMesh>& iF
)
:
nutkWallFunctionFvPatchScalarField(nlrwfpsf, iF)
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeField(fvPatchScalarField, nutLowReWallFunctionFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,149 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 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
Class
Foam::incompressible::RASModels::nutLowReWallFunctionFvPatchScalarField
Description
Boundary condition for turbulent (kinematic) viscosity when for use with
low Reynolds number models.
Sets nut to zero, and provides an access function to calculate y+.
SourceFiles
nutLowReWallFunctionFvPatchScalarField.C
\*---------------------------------------------------------------------------*/
#ifndef nutLowReWallFunctionFvPatchScalarField_H
#define nutLowReWallFunctionFvPatchScalarField_H
#include "nutkWallFunctionFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
namespace incompressible
{
namespace RASModels
{
/*---------------------------------------------------------------------------*\
Class nutLowReWallFunctionFvPatchScalarField Declaration
\*---------------------------------------------------------------------------*/
class nutLowReWallFunctionFvPatchScalarField
:
public nutkWallFunctionFvPatchScalarField
{
protected:
// Protected member functions
//- Calculate the turbulence viscosity
virtual tmp<scalarField> calcNut() const;
public:
//- Runtime type information
TypeName("nutLowReWallFunction");
// Constructors
//- Construct from patch and internal field
nutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&
);
//- Construct from patch, internal field and dictionary
nutLowReWallFunctionFvPatchScalarField
(
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const dictionary&
);
//- Construct by mapping given
// nutLowReWallFunctionFvPatchScalarField
// onto a new patch
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&,
const fvPatch&,
const DimensionedField<scalar, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&
);
//- Construct and return a clone
virtual tmp<fvPatchScalarField> clone() const
{
return tmp<fvPatchScalarField>
(
new nutLowReWallFunctionFvPatchScalarField(*this)
);
}
//- Construct as copy setting internal field reference
nutLowReWallFunctionFvPatchScalarField
(
const nutLowReWallFunctionFvPatchScalarField&,
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 nutLowReWallFunctionFvPatchScalarField(*this, iF)
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace RASModels
} // End namespace incompressible
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,14 @@
#!/bin/sh
# Source tutorial run functions
. $WM_PROJECT_DIR/bin/tools/RunFunctions
application=`getApplication`
# create mesh
runApplication blockMesh
# create ignition cells cellSet
runApplication cellSet
runApplication $application

View File

@ -11,29 +11,21 @@ FoamFile
format ascii; format ascii;
class dictionary; class dictionary;
location "constant"; location "constant";
object enthalpySourceProperties; object energySourcesProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
active yes; (
source1
cellSource sphereToCell;
volumeType absolute;
timeStart 0.15;
duration 0.1;
onValue 10000;
offValue 0;
sphereToCellCoeffs
{ {
centre ( 0.125 0.375 0.05 ); active true;
radius 0.005; timeStart 0.15;
duration 0.1;
selectionMode cellSet;
volumeMode absolute;
fieldData 10000;
cellSet ignitionCells;
} }
);
// ************************************************************************* // // ************************************************************************* //

View File

@ -0,0 +1,32 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object cellSetDict;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
name ignitionCells;
action new;
topoSetSources
(
sphereToCell
{
centre ( 0.125 0.375 0.05 );
radius 0.005;
}
);
// ************************************************************************* //

View File

@ -11,22 +11,22 @@ FoamFile
format ascii; format ascii;
class dictionary; class dictionary;
location "constant"; location "constant";
object pointMassSourcesProperties; object energySourcesProperties;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
active true;
pointSources
( (
source1 source1
{ {
active true;
timeStart 0.2; timeStart 0.2;
duration 2.0; duration 2.0;
location (2.75 0.5 0); selectionMode points;
fieldData volumeMode absolute;
fieldData 10;
points
( (
(H2O 0.01) (2.75 0.5 0)
); );
} }
); );

View File

@ -0,0 +1,38 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object massSourcesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
source1
{
active true;
timeStart 0.2;
duration 2.0;
selectionMode points;
volumeMode absolute;
fieldData
(
(H2O 1e-4) // kg/s
);
points
(
(2.75 0.5 0)
);
}
);
// ************************************************************************* //

View File

@ -0,0 +1,35 @@
/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.6 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object momentumSourcesProperties;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
(
source1
{
active true;
timeStart 0.2;
duration 2.0;
selectionMode points;
volumeMode absolute;
fieldData (0 0.005 0);
points
(
(2.75 0.5 0)
);
}
);
// ************************************************************************* //

View File

@ -14,12 +14,12 @@ FoamFile
object scalarListList; object scalarListList;
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// x y z u v w d rho mDot T cp Y0..YN // (x y z) (u v w) d rho mDot T cp (Y0..Y2) (Yg0..YgN) (Yl0..YlN) (Ys0..YsN)
( (
(0.1 0.32 0.0 0.5 0.25 0.0 0.001 1000 0.2 300 4200 1.0) (0.1 0.32 0.0) (0.5 0.25 0.0) 0.001 1000 0.2 300 4200 (0 1 0) () (1) ()
(0.1 0.44 0.0 0.5 0.10 0.0 0.001 1000 0.2 300 4200 1.0) (0.1 0.44 0.0) (0.5 0.10 0.0) 0.001 1000 0.2 300 4200 (0 1 0) () (1) ()
(0.1 0.56 0.0 0.5 -0.10 0.0 0.001 1000 0.2 300 4200 1.0) (0.1 0.56 0.0) (0.5 -0.10 0.0) 0.001 1000 0.2 300 4200 (0 1 0) () (1) ()
(0.1 0.68 0.0 0.5 -0.25 0.0 0.001 1000 0.2 300 4200 1.0) (0.1 0.68 0.0) (0.5 -0.25 0.0) 0.001 1000 0.2 300 4200 (0 1 0) () (1) ()
); );

View File

@ -15,30 +15,9 @@ FoamFile
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
( (
(0.002 0.002 0.00005) (0.1 0.32 0.0)
(0.004 0.002 0.00005) (0.1 0.44 0.0)
(0.006 0.002 0.00005) (0.1 0.56 0.0)
(0.008 0.002 0.00005) (0.1 0.68 0.0)
(0.010 0.002 0.00005)
(0.002 0.004 0.00005)
(0.004 0.004 0.00005)
(0.006 0.004 0.00005)
(0.008 0.004 0.00005)
(0.010 0.004 0.00005)
(0.002 0.006 0.00005)
(0.004 0.006 0.00005)
(0.006 0.006 0.00005)
(0.008 0.006 0.00005)
(0.010 0.006 0.00005)
(0.002 0.008 0.00005)
(0.004 0.008 0.00005)
(0.006 0.008 0.00005)
(0.008 0.008 0.00005)
(0.010 0.008 0.00005)
(0.002 0.010 0.00005)
(0.004 0.010 0.00005)
(0.006 0.010 0.00005)
(0.008 0.010 0.00005)
(0.010 0.010 0.00005)
) )
// ************************************************************************* // // ************************************************************************* //

View File

@ -17,7 +17,8 @@ FoamFile
active true; active true;
InjectionModel ReactingLookupTableInjection; InjectionModel ReactingMultiphaseLookupTableInjection;
//InjectionModel ManualInjection;
DragModel SphereDrag; DragModel SphereDrag;
@ -27,12 +28,16 @@ PatchInteractionModel LocalInteraction;
HeatTransferModel RanzMarshall; HeatTransferModel RanzMarshall;
CompositionModel SinglePhaseMixture; CompositionModel SingleMixtureFraction;
PhaseChangeModel LiquidEvaporation; PhaseChangeModel LiquidEvaporation;
PostProcessingModel PatchPostProcessing; PostProcessingModel PatchPostProcessing;
DevolatilisationModel none;
SurfaceReactionModel none;
radiation off; radiation off;
coupled true; coupled true;
@ -55,6 +60,8 @@ constantProperties
Pr Pr [ 0 0 0 0 0 ] 0.7; Pr Pr [ 0 0 0 0 0 ] 0.7;
Tvap Tvap [ 0 0 0 1 0 ] 273; Tvap Tvap [ 0 0 0 1 0 ] 273;
Tbp Tvap [ 0 0 0 1 0 ] 373; Tbp Tvap [ 0 0 0 1 0 ] 373;
LDevol LDevol [ 0 0 0 0 0 ] 0;
hRetentionCoeff hRetentionCoeff [ 0 0 0 0 0 ] 1;
constantVolume false; constantVolume false;
} }
@ -83,9 +90,9 @@ particleForces
ManualInjectionCoeffs ManualInjectionCoeffs
{ {
massTotal massTotal [ 1 0 0 0 0 ] 1e-2; massTotal massTotal [ 1 0 0 0 0 ] 1e-3;
parcelBasisType mass; parcelBasisType mass;
SOI 0; SOI 0.5;
positionsFile "reactingCloud1Positions"; positionsFile "reactingCloud1Positions";
U0 ( 0 0 0 ); U0 ( 0 0 0 );
parcelPDF parcelPDF
@ -99,7 +106,7 @@ ManualInjectionCoeffs
} }
} }
ReactingLookupTableInjectionCoeffs ReactingMultiphaseLookupTableInjectionCoeffs
{ {
massTotal massTotal [ 1 0 0 0 0 ] 1e-2; massTotal massTotal [ 1 0 0 0 0 ] 1e-2;
parcelBasisType mass; parcelBasisType mass;
@ -109,7 +116,6 @@ ReactingLookupTableInjectionCoeffs
parcelsPerSecond 250; parcelsPerSecond 250;
} }
StandardWallInteractionCoeffs StandardWallInteractionCoeffs
{ {
type rebound; type rebound;
@ -135,15 +141,24 @@ RanzMarshallCoeffs
BirdCorrection true; BirdCorrection true;
} }
SinglePhaseMixtureCoeffs SingleMixtureFractionCoeffs
{ {
phases phases
( (
gas
{
}
liquid liquid
{ {
H2O 1; H2O 1;
} }
solid
{
}
); );
YGasTot0 0;
YLiquidTot0 1;
YSolidTot0 0;
} }
LiquidEvaporationCoeffs LiquidEvaporationCoeffs

View File

@ -27,10 +27,14 @@ PatchInteractionModel StandardWallInteraction;
HeatTransferModel RanzMarshall; HeatTransferModel RanzMarshall;
CompositionModel SinglePhaseMixture; CompositionModel SingleMixtureFraction;
PhaseChangeModel LiquidEvaporation; PhaseChangeModel LiquidEvaporation;
DevolatilisationModel none;
SurfaceReactionModel none;
PostProcessingModel none; PostProcessingModel none;
radiation off; radiation off;
@ -55,6 +59,8 @@ constantProperties
Tvap Tvap [ 0 0 0 1 0 ] 284; Tvap Tvap [ 0 0 0 1 0 ] 284;
Tbp Tbp [ 0 0 0 1 0 ] 373; Tbp Tbp [ 0 0 0 1 0 ] 373;
Pr Pr [ 0 0 0 0 0 ] 0.7; Pr Pr [ 0 0 0 0 0 ] 0.7;
LDevol LDevol [ 0 0 0 0 0 ] 0;
hRetentionCoeff hRetentionCoeff [ 0 0 0 0 0 ] 1;
constantVolume false; constantVolume false;
} }
@ -110,15 +116,24 @@ RanzMarshallCoeffs
BirdCorrection off; BirdCorrection off;
} }
SinglePhaseMixtureCoeffs SingleMixtureFractionCoeffs
{ {
phases phases
( (
gas
{
}
liquid liquid
{ {
H2O 1; H2O 1;
} }
solid
{
}
); );
YGasTot0 0;
YLiquidTot0 1;
YSolidTot0 0;
} }
LiquidEvaporationCoeffs LiquidEvaporationCoeffs

View File

@ -27,10 +27,14 @@ PatchInteractionModel StandardWallInteraction;
HeatTransferModel RanzMarshall; HeatTransferModel RanzMarshall;
CompositionModel SinglePhaseMixture; CompositionModel SingleMixtureFraction;
PhaseChangeModel LiquidEvaporation; PhaseChangeModel LiquidEvaporation;
DevolatilisationModel none;
SurfaceReactionModel none;
PostProcessingModel PatchPostProcessing; PostProcessingModel PatchPostProcessing;
radiation off; radiation off;
@ -55,6 +59,8 @@ constantProperties
Tvap Tvap [ 0 0 0 1 0 ] 273; Tvap Tvap [ 0 0 0 1 0 ] 273;
Tbp Tbp [ 0 0 0 1 0 ] 373; Tbp Tbp [ 0 0 0 1 0 ] 373;
Pr Pr [ 0 0 0 0 0 ] 0.7; Pr Pr [ 0 0 0 0 0 ] 0.7;
LDevol LDevol [ 0 0 0 0 0 ] 0;
hRetentionCoeff hRetentionCoeff [ 0 0 0 0 0 ] 1;
constantVolume false; constantVolume false;
} }
@ -132,15 +138,24 @@ RanzMarshallCoeffs
BirdCorrection off; BirdCorrection off;
} }
SinglePhaseMixtureCoeffs SingleMixtureFractionCoeffs
{ {
phases phases
( (
gas
{
}
liquid liquid
{ {
H2O 1; H2O 1;
} }
solid
{
}
); );
YGasTot0 0;
YLiquidTot0 1;
YSolidTot0 0;
} }
LiquidEvaporationCoeffs LiquidEvaporationCoeffs