diff --git a/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/options b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/options index 11053f31a9..502938c53c 100644 --- a/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/options +++ b/applications/solvers/compressible/rhoPimpleFoam/rhoLTSPimpleFoam/Make/options @@ -1,5 +1,4 @@ EXE_INC = \ - -I../rhoPorousMRFPimpleFoam \ -I.. \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel \ diff --git a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C index 44a02e234a..2a958b3a3c 100644 --- a/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C +++ b/applications/utilities/mesh/advanced/autoRefineMesh/autoRefineMesh.C @@ -269,9 +269,10 @@ void selectCurvatureCells querySurf.surface(), querySurf, pointField(1, mesh.cellCentres()[0]), - false, - false, - false, + false, // includeCut + false, // includeInside + false, // includeOutside + false, // geometricOnly nearDist, curvature ); diff --git a/applications/utilities/mesh/manipulation/topoSet/topoSetDict b/applications/utilities/mesh/manipulation/topoSet/topoSetDict index 11dccf942b..9dee4d1df9 100644 --- a/applications/utilities/mesh/manipulation/topoSet/topoSetDict +++ b/applications/utilities/mesh/manipulation/topoSet/topoSetDict @@ -143,6 +143,9 @@ FoamFile // sourceInfo // { // file "www.avl.com-geometry.stl"; +// useSurfaceOrientation false; // use closed surface inside/outside +// // test (ignores includeCut, +// // outsidePoints) // outsidePoints ((-99 -99 -59)); // definition of outside // includeCut false; // cells cut by surface // includeInside false; // cells not on outside of surf diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index 86ba1b4849..60e1d7d0ee 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -165,6 +165,10 @@ surfaces //- Optional: restrict to a particular zone // zone zone1; + + //- Optional: do not triangulate (only for surfaceFormats that support + // polygons) + //triangulate false; } interpolatedPlane diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C index 66065c4528..1c774c352b 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.C @@ -39,6 +39,14 @@ namespace functionEntries { defineTypeNameAndDebug(codeStream, 0); + addToMemberFunctionSelectionTable + ( + functionEntry, + codeStream, + execute, + dictionaryIstream + ); + addToMemberFunctionSelectionTable ( functionEntry, @@ -364,6 +372,38 @@ bool Foam::functionEntries::codeStream::execute IStringStream resultStream(os.str()); entry.read(parentDict, resultStream); + return true; +} + + +bool Foam::functionEntries::codeStream::execute +( + dictionary& parentDict, + Istream& is +) +{ + Info<< "Using #codeStream at line " << is.lineNumber() + << " in file " << parentDict.name() << endl; + + dynamicCode::checkSecurity + ( + "functionEntries::codeStream::execute(..)", + parentDict + ); + + // get code dictionary + // must reference parent for stringOps::expand to work nicely + dictionary codeDict("#codeStream", parentDict, is); + + streamingFunctionType function = getFunction(parentDict, codeDict); + + // use function to write stream + OStringStream os(is.format()); + (*function)(os, parentDict); + + // get the entry from this stream + IStringStream resultStream(os.str()); + parentDict.read(resultStream); return true; } diff --git a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H index b8baa0183c..1dc2b57c87 100644 --- a/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H +++ b/src/OpenFOAM/db/dictionary/functionEntries/codeStream/codeStream.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -160,6 +160,10 @@ public: // Member Functions + //- Execute the functionEntry in a sub-dict context + static bool execute(dictionary& parentDict, Istream&); + + //- Execute the functionEntry in a primitiveEntry context static bool execute ( const dictionary& parentDict, diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C index ff37610fad..f4a0009028 100644 --- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C +++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.C @@ -157,7 +157,30 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const { cpuTime timer; - if (includeCut_ || includeInside_ || includeOutside_) + + if (useSurfaceOrientation_ && (includeInside_ || includeOutside_)) + { + const meshSearch queryMesh(mesh_); + + //- Calculate for each searchPoint inside/outside status. + boolList isInside(querySurf().calcInside(mesh_.cellCentres())); + + Info<< " Marked inside/outside using surface orientation in = " + << timer.cpuTimeIncrement() << " s" << endl << endl; + + forAll(isInside, cellI) + { + if (isInside[cellI] && includeInside_) + { + addOrDelete(set, cellI, add); + } + else if (!isInside[cellI] && includeOutside_) + { + addOrDelete(set, cellI, add); + } + } + } + else if (includeCut_ || includeInside_ || includeOutside_) { // // Cut cells with surface and classify cells @@ -166,7 +189,7 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const // Construct search engine on mesh - meshSearch queryMesh(mesh_); + const meshSearch queryMesh(mesh_); // Check all 'outside' points @@ -196,10 +219,10 @@ void Foam::surfaceToCell::combine(topoSet& set, const bool add) const ); - Info<< " Marked inside/outside in = " + Info<< " Marked inside/outside using surface intersection in = " << timer.cpuTimeIncrement() << " s" << endl << endl; - + //- Add/remove cells using set forAll(cellType, cellI) { label cType = cellType[cellI]; @@ -326,6 +349,18 @@ void Foam::surfaceToCell::checkSettings() const << " or set curvature to a value -1 .. 1." << exit(FatalError); } + + if (useSurfaceOrientation_ && includeCut_) + { + FatalErrorIn + ( + "surfaceToCell:checkSettings()" + ) << "Illegal include cell specification." + << " You cannot specify both 'useSurfaceOrientation'" + << " and 'includeCut'" + << " since 'includeCut' specifies a topological split" + << exit(FatalError); + } } @@ -340,6 +375,7 @@ Foam::surfaceToCell::surfaceToCell const bool includeCut, const bool includeInside, const bool includeOutside, + const bool useSurfaceOrientation, const scalar nearDist, const scalar curvature ) @@ -350,6 +386,7 @@ Foam::surfaceToCell::surfaceToCell includeCut_(includeCut), includeInside_(includeInside), includeOutside_(includeOutside), + useSurfaceOrientation_(useSurfaceOrientation), nearDist_(nearDist), curvature_(curvature), surfPtr_(new triSurface(surfName_)), @@ -371,6 +408,7 @@ Foam::surfaceToCell::surfaceToCell const bool includeCut, const bool includeInside, const bool includeOutside, + const bool useSurfaceOrientation, const scalar nearDist, const scalar curvature ) @@ -381,6 +419,7 @@ Foam::surfaceToCell::surfaceToCell includeCut_(includeCut), includeInside_(includeInside), includeOutside_(includeOutside), + useSurfaceOrientation_(useSurfaceOrientation), nearDist_(nearDist), curvature_(curvature), surfPtr_(&surf), @@ -404,6 +443,10 @@ Foam::surfaceToCell::surfaceToCell includeCut_(readBool(dict.lookup("includeCut"))), includeInside_(readBool(dict.lookup("includeInside"))), includeOutside_(readBool(dict.lookup("includeOutside"))), + useSurfaceOrientation_ + ( + dict.lookupOrDefault("useSurfaceOrientation", false) + ), nearDist_(readScalar(dict.lookup("nearDistance"))), curvature_(readScalar(dict.lookup("curvature"))), surfPtr_(new triSurface(surfName_)), @@ -427,6 +470,7 @@ Foam::surfaceToCell::surfaceToCell includeCut_(readBool(checkIs(is))), includeInside_(readBool(checkIs(is))), includeOutside_(readBool(checkIs(is))), + useSurfaceOrientation_(false), nearDist_(readScalar(checkIs(is))), curvature_(readScalar(checkIs(is))), surfPtr_(new triSurface(surfName_)), diff --git a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H index cfaf80dd30..931f412a2a 100644 --- a/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H +++ b/src/meshTools/sets/cellSources/surfaceToCell/surfaceToCell.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,6 +29,8 @@ Description Selects: - all cells inside/outside/cut by surface + - all cells inside/outside surface ('useSurfaceOrientation', requires closed + surface) - cells with centre nearer than XXX to surface - cells with centre nearer than XXX to surface \b and with normal at nearest point to centre and cell-corners differing by @@ -67,27 +69,31 @@ class surfaceToCell static addToUsageTable usage_; //- Name of surface file - fileName surfName_; + const fileName surfName_; //- Points which are outside - pointField outsidePoints_; + const pointField outsidePoints_; //- Include cut cells - bool includeCut_; + const bool includeCut_; //- Include inside cells - bool includeInside_; + const bool includeInside_; //- Include outside cells - bool includeOutside_; + const bool includeOutside_; + + //- Determine inside/outside purely using geometric test + // (does not allow includeCut) + const bool useSurfaceOrientation_; //- if > 0 : include cells with distance from cellCentre to surface // less than nearDist. - scalar nearDist_; + const scalar nearDist_; //- if > -1 : include cells with normals at nearest surface points // varying more than curvature_. - scalar curvature_; + const scalar curvature_; //- triSurface to search on. On pointer since can be external. const triSurface* surfPtr_; @@ -97,7 +103,7 @@ class surfaceToCell //- whether I allocated above surface ptrs or whether they are // external. - bool IOwnPtrs_; + const bool IOwnPtrs_; // Private Member Functions @@ -155,6 +161,7 @@ public: const bool includeCut, const bool includeInside, const bool includeOutside, + const bool useSurfaceOrientation, const scalar nearDist, const scalar curvature ); @@ -170,6 +177,7 @@ public: const bool includeCut, const bool includeInside, const bool includeOutside, + const bool useSurfaceOrientation, const scalar nearDist, const scalar curvature ); diff --git a/src/meshTools/sets/topoSets/topoSet.C b/src/meshTools/sets/topoSets/topoSet.C index 37fe9a0595..691339102a 100644 --- a/src/meshTools/sets/topoSets/topoSet.C +++ b/src/meshTools/sets/topoSets/topoSet.C @@ -472,7 +472,6 @@ void Foam::topoSet::invert(const label maxLen) insert(cellI); } } - } @@ -550,20 +549,6 @@ void Foam::topoSet::writeDebug(Ostream& os, const label maxLen) const } -//void Foam::topoSet::writeDebug -//( -// Ostream&, -// const primitiveMesh&, -// const label -//) const -//{ -// notImplemented -// ( -// "topoSet::writeDebug(Ostream&, const primitiveMesh&, const label)" -// ); -//} - - bool Foam::topoSet::writeData(Ostream& os) const { return (os << *this).good(); @@ -576,14 +561,6 @@ void Foam::topoSet::updateMesh(const mapPolyMesh&) } -////- Return max index+1. -//label topoSet::maxSize(const polyMesh&) const -//{ -// notImplemented("topoSet::maxSize(const polyMesh&)"); -// -// return -1; -//} - // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * // void Foam::topoSet::operator=(const topoSet& rhs) diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C index 10c8a4b4ac..1e6a30627e 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.C @@ -32,6 +32,7 @@ License #include "fvcVolumeIntegrate.H" #include "fvMatrices.H" #include "absorptionEmissionModel.H" +#include "fvcLaplacian.H" // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // @@ -61,6 +62,9 @@ void reactingOneDim::readReactingOneDimControls() coeffs().lookup("gasHSource") >> gasHSource_; coeffs().lookup("QrHSource") >> QrHSource_; + useChemistrySolvers_ = + coeffs().lookupOrDefault("useChemistrySolvers", true); + } @@ -321,6 +325,8 @@ void reactingOneDim::solveEnergy() ( fvm::ddt(rho_, h_) - fvm::laplacian(alpha, h_) + + fvc::laplacian(alpha, h_) + - fvc::laplacian(kappa(), T()) == chemistrySh_ - fvm::Sp(solidChemistry_->RRg(), h_) @@ -462,7 +468,8 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh) totalGasMassFlux_(0.0), totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)), gasHSource_(false), - QrHSource_(false) + QrHSource_(false), + useChemistrySolvers_(true) { if (active_) { @@ -560,7 +567,8 @@ reactingOneDim::reactingOneDim totalGasMassFlux_(0.0), totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)), gasHSource_(false), - QrHSource_(false) + QrHSource_(false), + useChemistrySolvers_(true) { if (active_) { @@ -681,11 +689,18 @@ void reactingOneDim::evolveRegion() { Info<< "\nEvolving pyrolysis in region: " << regionMesh().name() << endl; - solidChemistry_->solve - ( - time().value() - time().deltaTValue(), - time().deltaTValue() - ); + if (useChemistrySolvers_) + { + solidChemistry_->solve + ( + time().value() - time().deltaTValue(), + time().deltaTValue() + ); + } + else + { + solidChemistry_->calculate(); + } solveContinuity(); diff --git a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H index 4a92fd6967..a5950a9804 100644 --- a/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H +++ b/src/regionModels/pyrolysisModels/reactingOneDim/reactingOneDim.H @@ -154,6 +154,9 @@ protected: //- Add in depth radiation source term bool QrHSource_; + //- Use chemistry solvers (ode or sequential) + bool useChemistrySolvers_; + // Protected member functions diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C index 3873962cca..87167b572c 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.C +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.C @@ -45,12 +45,14 @@ Foam::sampledPlane::sampledPlane const word& name, const polyMesh& mesh, const plane& planeDesc, - const keyType& zoneKey + const keyType& zoneKey, + const bool triangulate ) : sampledSurface(name, mesh), cuttingPlane(planeDesc), zoneKey_(zoneKey), + triangulate_(triangulate), needsUpdate_(true) { if (debug && zoneKey_.size() && mesh.cellZones().findIndex(zoneKey_) < 0) @@ -71,6 +73,7 @@ Foam::sampledPlane::sampledPlane sampledSurface(name, mesh, dict), cuttingPlane(plane(dict.lookup("basePoint"), dict.lookup("normalVector"))), zoneKey_(keyType::null), + triangulate_(dict.lookupOrDefault("triangulate", true)), needsUpdate_(true) { // make plane relative to the coordinateSystem (Cartesian) @@ -138,11 +141,11 @@ bool Foam::sampledPlane::update() if (selectedCells.empty()) { - reCut(mesh(), true); // always triangulate. Note:Make option? + reCut(mesh(), triangulate_); } else { - reCut(mesh(), true, selectedCells); + reCut(mesh(), triangulate_, selectedCells); } if (debug) @@ -250,6 +253,7 @@ void Foam::sampledPlane::print(Ostream& os) const os << "sampledPlane: " << name() << " :" << " base:" << refPoint() << " normal:" << normal() + << " triangulate:" << triangulate_ << " faces:" << faces().size() << " points:" << points().size(); } diff --git a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H index 1c6a1b8058..3b24a09e52 100644 --- a/src/sampling/sampledSurface/sampledPlane/sampledPlane.H +++ b/src/sampling/sampledSurface/sampledPlane/sampledPlane.H @@ -25,7 +25,7 @@ Class Foam::sampledPlane Description - A sampledSurface defined by a cuttingPlane. Always triangulated. + A sampledSurface defined by a cuttingPlane. Triangulated by default. Note Does not actually cut until update() called. @@ -60,6 +60,9 @@ class sampledPlane //- If restricted to zones, name of this zone or a regular expression keyType zoneKey_; + //- Triangulated faces or keep faces as is + const bool triangulate_; + //- Track if the surface needs an update mutable bool needsUpdate_; @@ -92,7 +95,8 @@ public: const word& name, const polyMesh& mesh, const plane& planeDesc, - const keyType& zoneKey = word::null + const keyType& zoneKey = word::null, + const bool triangulate = true ); //- Construct from dictionary diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H index 67704bb9df..75ea14eb67 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/basicChemistryModel/basicChemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -140,6 +140,12 @@ public: const label i ) const = 0; + //- Return access to chemical source terms [kg/m3/s] + virtual DimensionedField& RR + ( + const label i + ) = 0; + // Chemistry solution diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H index 7b3d1c663a..475fc7c8fd 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModel.H @@ -211,6 +211,12 @@ public: const label i ) const; + //- Return non const access to chemical source terms [kg/m3/s] + virtual DimensionedField& RR + ( + const label i + ); + //- Solve the reaction system for the given start time and time // step and return the characteristic time virtual scalar solve(const scalar t0, const scalar deltaT); diff --git a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModelI.H b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModelI.H index d128443fe9..c009a11e46 100644 --- a/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModelI.H +++ b/src/thermophysicalModels/chemistryModel/chemistryModel/chemistryModel/chemistryModelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -78,5 +78,15 @@ Foam::chemistryModel::RR return RR_[i]; } +template +Foam::DimensionedField& +Foam::chemistryModel::RR +( + const label i +) +{ + return RR_[i]; +} + // ************************************************************************* // diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C index cfff71b9ed..f94db5946b 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.C @@ -53,4 +53,35 @@ Foam::basicSolidChemistryModel::~basicSolidChemistryModel() {} +const Foam::DimensionedField& +Foam::basicSolidChemistryModel::RR(const label i) const +{ + notImplemented + ( + "const Foam::DimensionedField&" + "basicSolidChemistryModel::RR(const label)" + ); + return (DimensionedField::null()); +} + + +Foam::DimensionedField& +Foam::basicSolidChemistryModel::RR(const label i) +{ + notImplemented + ( + "Foam::DimensionedField&" + "basicSolidChemistryModel::RR(const label)" + ); + + return dynamic_cast&> + ( + const_cast& > + ( + DimensionedField::null() + ) + ); +} + + // ************************************************************************* // diff --git a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H index 2134bffca1..50d6a2e96b 100644 --- a/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/basicSolidChemistryModel/basicSolidChemistryModel.H @@ -149,6 +149,15 @@ public: //- Calculates the reaction rates virtual void calculate() = 0; + + //- Return const access to the total source terms + virtual const DimensionedField& RR + ( + const label i + ) const; + + //- Return non-const access to the total source terms + virtual DimensionedField& RR(const label i); }; diff --git a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C index e301a1b85e..4962bf716b 100644 --- a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C +++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.C @@ -535,14 +535,21 @@ updateConcsInReactionI c[si] = max(0.0, c[si]); } + scalar sr = 0.0; forAll(R.rhs(), s) { label si = R.rhs()[s].index; const scalar rhoR = this->solidThermo_[si].rho(p, T); - const scalar sr = rhoR/rhoL; + sr = rhoR/rhoL; c[si] += dt*sr*omeg; c[si] = max(0.0, c[si]); } + + forAll(R.grhs(), g) + { + label gi = R.grhs()[g].index; + c[gi + this->nSolids_] += (1.0 - sr)*omeg*dt; + } } @@ -561,24 +568,11 @@ updateRRInReactionI simpleMatrix& RR ) const { - const Reaction& R = this->reactions_[index]; - scalar rhoL = 0.0; - forAll(R.lhs(), s) - { - label si = R.lhs()[s].index; - rhoL = this->solidThermo_[si].rho(p, T); - RR[si][rRef] -= pr*corr; - RR[si][lRef] += pf*corr; - } - - forAll(R.rhs(), s) - { - label si = R.rhs()[s].index; - const scalar rhoR = this->solidThermo_[si].rho(p, T); - const scalar sr = rhoR/rhoL; - RR[si][lRef] -= sr*pf*corr; - RR[si][rRef] += sr*pr*corr; - } + notImplemented + ( + "void Foam::pyrolysisChemistryModel::" + "updateRRInReactionI" + ); } @@ -666,7 +660,6 @@ Foam::pyrolysisChemistryModel::solve scalar newCp = 0.0; scalar newhi = 0.0; - scalar invRho = 0.0; scalarList dcdt = (c - c0)/dt; for (label i=0; inSolids_; i++) @@ -675,7 +668,6 @@ Foam::pyrolysisChemistryModel::solve scalar Yi = c[i]/cTot; newCp += Yi*this->solidThermo_[i].Cp(pi, Ti); newhi -= dYi*this->solidThermo_[i].Hc(); - invRho += Yi/this->solidThermo_[i].rho(pi, Ti); } scalar dTi = (newhi/newCp)*dt; diff --git a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H index 2d4a11cc90..7ae76c5233 100644 --- a/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/pyrolysisChemistryModel/pyrolysisChemistryModel.H @@ -137,8 +137,9 @@ public: const bool updateC0 = false ) const; - //- Return the reaction rate for reaction r and the reference - // species and charateristic times + //- Return the reaction rate for reaction r + // NOTE: Currently does not calculate reference specie and + // characteristic times (pf, cf,l Ref, etc.) virtual scalar omega ( const Reaction& r, @@ -153,8 +154,10 @@ public: label& rRef ) const; - //- Return the reaction rate for iReaction and the reference - // species and charateristic times + + //- Return the reaction rate for iReaction + // NOTE: Currently does not calculate reference specie and + // characteristic times (pf, cf,l Ref, etc.) virtual scalar omegaI ( label iReaction, @@ -169,6 +172,7 @@ public: label& rRef ) const; + //- Calculates the reaction rates virtual void calculate(); @@ -186,6 +190,7 @@ public: //- Update matrix RR for reaction i. Used by EulerImplicit + // (Not implemented) virtual void updateRRInReactionI ( const label i, diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H index 03076d79ce..bf67f1ca4d 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModel.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -65,6 +65,9 @@ class solidChemistryModel { // Private Member Functions + //- Disallow copy constructor + solidChemistryModel(const solidChemistryModel&); + //- Disallow default bitwise assignment void operator=(const solidChemistryModel&); @@ -151,6 +154,7 @@ public: label& rRef ) const = 0; + //- Return the reaction rate for iReaction and the reference // species and charateristic times virtual scalar omegaI @@ -167,6 +171,10 @@ public: label& rRef ) const = 0; + //- Calculates the reaction rates + virtual void calculate() = 0; + + //- Update concentrations in reaction i given dt and reaction rate // omega used by sequential solver virtual void updateConcsInReactionI @@ -194,11 +202,8 @@ public: simpleMatrix& RR ) const = 0; - //- Calculates the reaction rates - virtual void calculate() = 0; - - // Chemistry model functions + // Solid Chemistry model functions //- Return const access to the chemical source terms for solids inline const DimensionedField& RRs @@ -209,13 +214,6 @@ public: //- Return total solid source term inline tmp > RRs() const; - //- Return const access to the total source terms - inline const DimensionedField& RR - ( - const label i - ) const; - - //- Solve the reaction system for the given start time and time // step and return the characteristic time virtual scalar solve(const scalar t0, const scalar deltaT) = 0; diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H index 92b461e11e..f2d0dad79a 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistryModel/solidChemistryModelI.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2013-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -95,16 +95,4 @@ Foam::solidChemistryModel::RRs() const } -template -inline const Foam::DimensionedField& -Foam::solidChemistryModel::RR -( - const label i -) const -{ - notImplemented("solidChemistryModel::RR(const label)"); - return (DimensionedField::null()); -} - - // ************************************************************************* // diff --git a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H index 12f842a054..447020e2f7 100644 --- a/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H +++ b/src/thermophysicalModels/solidChemistryModel/solidChemistrySolver/makeSolidChemistrySolverType.H @@ -52,9 +52,8 @@ namespace Foam defineTemplateTypeNameAndDebugWithName \ ( \ SS##Schem##Comp##SThermo##GThermo, \ - (#SS"<" + word(Schem::typeName_()) \ - + "<"#Comp"," + SThermo::typeName() \ - + "," + GThermo::typeName() + ">>").c_str(), \ + (#SS"<"#Schem"<"#Comp"," + SThermo::typeName() + "," \ + + GThermo::typeName() + ">>").c_str(), \ 0 \ ); \ \ @@ -77,14 +76,6 @@ namespace Foam GThermo \ ); \ \ - makeSolidChemistrySolverType \ - ( \ - EulerImplicit, \ - SolidChem, \ - Comp, \ - SThermo, \ - GThermo \ - ); \ \ makeSolidChemistrySolverType \ ( \ @@ -104,7 +95,6 @@ namespace Foam GThermo \ ); - // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End namespace Foam diff --git a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H index 5193a4b9de..07b6ffb050 100644 --- a/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H +++ b/src/thermophysicalModels/solidThermo/solidThermo/makeSolidThermo.H @@ -30,7 +30,7 @@ Description \*---------------------------------------------------------------------------*/ #ifndef makeSolidThermo_H -#define makesolidThermo_H +#define makeSolidThermo_H #include "addToRunTimeSelectionTable.H" diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphamercury b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.air similarity index 97% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphamercury rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.air index 0f3dcd4639..210222182a 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphamercury +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.air @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha1; + object alpha.air; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphas b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.mercury similarity index 97% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphas rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.mercury index 0f3dcd4639..cbb4647b47 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphas +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.mercury @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha1; + object alpha.mercury; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphaoil b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.oil similarity index 97% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphaoil rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.oil index 0f3dcd4639..e8b4d42497 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphaoil +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.oil @@ -10,7 +10,7 @@ FoamFile version 2.0; format ascii; class volScalarField; - object alpha1; + object alpha.oil; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphaair b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.water similarity index 100% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphaair rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alpha.water diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphawater b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphawater deleted file mode 100644 index 0f3dcd4639..0000000000 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0.org/alphawater +++ /dev/null @@ -1,44 +0,0 @@ -/*--------------------------------*- C++ -*----------------------------------*\ -| ========= | | -| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | -| \\ / O peration | Version: dev | -| \\ / A nd | Web: www.OpenFOAM.org | -| \\/ M anipulation | | -\*---------------------------------------------------------------------------*/ -FoamFile -{ - version 2.0; - format ascii; - class volScalarField; - object alpha1; -} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -dimensions [0 0 0 0 0 0 0]; - -internalField uniform 0; - -boundaryField -{ - rotor - { - type zeroGradient; - } - - stator - { - type zeroGradient; - } - - front - { - type empty; - } - - back - { - type empty; - } -} - -// ************************************************************************* // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphaair b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.air similarity index 99% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphaair rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.air index b25f228620..a53034d33d 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphaair +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.air @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object alphaair; + object alpha.air; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphamercury b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.mercury similarity index 99% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphamercury rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.mercury index 0e6d124fd0..76002901ed 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphamercury +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.mercury @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object alphamercury; + object alpha.mercury; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphaoil b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.oil similarity index 99% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphaoil rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.oil index 2311855110..56d642d0d9 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphaoil +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.oil @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object alphaoil; + object alpha.oil; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphawater b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.water similarity index 99% rename from tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphawater rename to tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.water index d61eb80ddf..766d8c1462 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alphawater +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/0/alpha.water @@ -11,7 +11,7 @@ FoamFile format ascii; class volScalarField; location "0"; - object alphawater; + object alpha.water; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/polyMesh/boundary b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/polyMesh/boundary index 292f25b806..188a0f0c58 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/polyMesh/boundary +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/polyMesh/boundary @@ -32,12 +32,14 @@ FoamFile front { type empty; + inGroups 1(empty); nFaces 3072; startFace 6336; } back { type empty; + inGroups 1(empty); nFaces 3072; startFace 9408; } diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/transportProperties b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/transportProperties index e338328156..3cfdbabfaf 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/transportProperties +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/constant/transportProperties @@ -46,8 +46,6 @@ phases } ); -refPhase air; - sigmas ( (air water) 0.07 diff --git a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/system/setFieldsDict b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/system/setFieldsDict index d5dd8aca43..82d9ffc783 100644 --- a/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/system/setFieldsDict +++ b/tutorials/multiphase/MRFMultiphaseInterFoam/mixerVessel2D/system/setFieldsDict @@ -17,10 +17,10 @@ FoamFile defaultFieldValues ( - volScalarFieldValue alphaair 1 - volScalarFieldValue alphawater 0 - volScalarFieldValue alphaoil 0 - volScalarFieldValue alphamercury 0 + volScalarFieldValue alpha.air 1 + volScalarFieldValue alpha.water 0 + volScalarFieldValue alpha.oil 0 + volScalarFieldValue alpha.mercury 0 ); regions @@ -30,10 +30,10 @@ regions box (0 0 -1) (1 1 1); fieldValues ( - volScalarFieldValue alphawater 1 - volScalarFieldValue alphaoil 0 - volScalarFieldValue alphamercury 0 - volScalarFieldValue alphaair 0 + volScalarFieldValue alpha.water 1 + volScalarFieldValue alpha.oil 0 + volScalarFieldValue alpha.mercury 0 + volScalarFieldValue alpha.air 0 ); } boxToCell @@ -41,10 +41,10 @@ regions box (0 -1 -1) (1 0 1); fieldValues ( - volScalarFieldValue alphawater 0 - volScalarFieldValue alphaoil 1 - volScalarFieldValue alphamercury 0 - volScalarFieldValue alphaair 0 + volScalarFieldValue alpha.water 0 + volScalarFieldValue alpha.oil 1 + volScalarFieldValue alpha.mercury 0 + volScalarFieldValue alpha.air 0 ); } boxToCell @@ -52,10 +52,10 @@ regions box (-1 -1 -1) (0 0 1); fieldValues ( - volScalarFieldValue alphawater 0 - volScalarFieldValue alphaoil 0 - volScalarFieldValue alphamercury 1 - volScalarFieldValue alphaair 0 + volScalarFieldValue alpha.water 0 + volScalarFieldValue alpha.oil 0 + volScalarFieldValue alpha.mercury 1 + volScalarFieldValue alpha.air 0 ); } );