GIT: resolved merge conflict

This commit is contained in:
andy
2012-08-21 18:17:27 +01:00
72 changed files with 1175 additions and 779 deletions

View File

@ -178,7 +178,7 @@
rho2 = rho20 + psi2*p; rho2 = rho20 + psi2*p;
K1 = 0.5*magSqr(U1); K1 = 0.5*magSqr(U1);
K2 = 0.5*magSqr(U1); K2 = 0.5*magSqr(U2);
dpdt = fvc::ddt(p); dpdt = fvc::ddt(p);
} }

View File

@ -20,4 +20,5 @@ EXE_LIBS = \
-lincompressibleTransportModels \ -lincompressibleTransportModels \
-lcompressibleMultiphaseEulerianInterfacialModels \ -lcompressibleMultiphaseEulerianInterfacialModels \
-lincompressibleLESModels \ -lincompressibleLESModels \
-lincompressibleRASModels \
-lfiniteVolume -lfiniteVolume

View File

@ -273,73 +273,165 @@ bool Foam::checkCoupledPoints
const faceList& fcs = mesh.faces(); const faceList& fcs = mesh.faces();
const polyBoundaryMesh& patches = mesh.boundaryMesh(); const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Zero'th point on coupled faces // Check size of faces
pointField nbrZeroPoint(fcs.size()-mesh.nInternalFaces(), vector::max); label maxSize = 0;
// Exchange zero point
forAll(patches, patchI)
{ {
if (patches[patchI].coupled()) labelList nbrSize(fcs.size()-mesh.nInternalFaces(), 0);
// Exchange size
forAll(patches, patchI)
{ {
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch> if (patches[patchI].coupled())
(
patches[patchI]
);
forAll(cpp, i)
{ {
label bFaceI = cpp.start()+i-mesh.nInternalFaces(); const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
const point& p0 = p[cpp[i][0]];
nbrZeroPoint[bFaceI] = p0;
}
}
}
syncTools::swapBoundaryFacePositions(mesh, nbrZeroPoint);
// Compare to local ones. Use same tolerance as for matching
label nErrorFaces = 0;
scalar avgMismatch = 0;
label nCoupledFaces = 0;
forAll(patches, patchI)
{
if (patches[patchI].coupled())
{
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
(
patches[patchI]
);
if (cpp.owner())
{
scalarField smallDist
( (
cpp.calcFaceTol patches[patchI]
(
//cpp.matchTolerance(),
cpp,
cpp.points(),
cpp.faceCentres()
)
); );
forAll(cpp, i) forAll(cpp, i)
{ {
label bFaceI = cpp.start()+i-mesh.nInternalFaces(); label bFaceI = cpp.start()+i-mesh.nInternalFaces();
const point& p0 = p[cpp[i][0]]; nbrSize[bFaceI] = cpp[i].size();
maxSize = max(maxSize, cpp[i].size());
}
}
}
syncTools::swapBoundaryFaceList(mesh, nbrSize);
scalar d = mag(p0 - nbrZeroPoint[bFaceI]);
if (d > smallDist[i]) // Check on owner
label nErrorFaces = 0;
forAll(patches, patchI)
{
if (patches[patchI].coupled())
{
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
(
patches[patchI]
);
if (cpp.owner())
{
forAll(cpp, i)
{ {
if (setPtr) label bFaceI = cpp.start()+i-mesh.nInternalFaces();
if (cpp[i].size() != nbrSize[bFaceI])
{ {
setPtr->insert(cpp.start()+i); if (setPtr)
{
setPtr->insert(cpp.start()+i);
}
nErrorFaces++;
}
}
}
}
}
reduce(nErrorFaces, sumOp<label>());
if (nErrorFaces > 0)
{
if (report)
{
Info<< " **Error in coupled faces: "
<< nErrorFaces
<< " faces have different size "
<< " compared to their coupled equivalent." << endl;
}
return true;
}
reduce(maxSize, maxOp<label>());
}
label nErrorFaces = 0;
scalar avgMismatch = 0;
label nCoupledPoints = 0;
for (label index = 0; index < maxSize; index++)
{
// point at index on coupled faces
pointField nbrPoint(fcs.size()-mesh.nInternalFaces(), vector::max);
// Exchange point
forAll(patches, patchI)
{
if (patches[patchI].coupled())
{
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
(
patches[patchI]
);
forAll(cpp, i)
{
const face& f = cpp[i];
if (f.size() > index)
{
label bFaceI = cpp.start()+i-mesh.nInternalFaces();
nbrPoint[bFaceI] = p[f[index]];
}
}
}
}
syncTools::swapBoundaryFacePositions(mesh, nbrPoint);
// Compare to local ones. Use same tolerance as for matching
forAll(patches, patchI)
{
if (patches[patchI].coupled())
{
const coupledPolyPatch& cpp = refCast<const coupledPolyPatch>
(
patches[patchI]
);
if (cpp.owner())
{
scalarField smallDist
(
cpp.calcFaceTol
(
//cpp.matchTolerance(),
cpp,
cpp.points(),
cpp.faceCentres()
)
);
forAll(cpp, i)
{
const face& f = cpp[i];
if (f.size() > index)
{
label bFaceI = cpp.start()+i-mesh.nInternalFaces();
label reverseIndex = (f.size()-index)%f.size();
scalar d = mag(p[f[reverseIndex]]-nbrPoint[bFaceI]);
if (d > smallDist[i])
{
if (setPtr)
{
// Avoid duplicate counting of faces
if (setPtr->insert(cpp.start()+i))
{
nErrorFaces++;
}
}
else
{
// No checking on duplicates
nErrorFaces++;
}
}
avgMismatch += d;
nCoupledPoints++;
} }
nErrorFaces++;
} }
avgMismatch += d;
nCoupledFaces++;
} }
} }
} }
@ -347,11 +439,11 @@ bool Foam::checkCoupledPoints
reduce(nErrorFaces, sumOp<label>()); reduce(nErrorFaces, sumOp<label>());
reduce(avgMismatch, maxOp<scalar>()); reduce(avgMismatch, maxOp<scalar>());
reduce(nCoupledFaces, sumOp<label>()); reduce(nCoupledPoints, sumOp<label>());
if (nCoupledFaces > 0) if (nCoupledPoints > 0)
{ {
avgMismatch /= nCoupledFaces; avgMismatch /= nCoupledPoints;
} }
if (nErrorFaces > 0) if (nErrorFaces > 0)
@ -360,7 +452,7 @@ bool Foam::checkCoupledPoints
{ {
Info<< " **Error in coupled point location: " Info<< " **Error in coupled point location: "
<< nErrorFaces << nErrorFaces
<< " faces have their 0th vertex not opposite" << " faces have their 0th or consecutive vertex not opposite"
<< " their coupled equivalent. Average mismatch " << " their coupled equivalent. Average mismatch "
<< avgMismatch << "." << avgMismatch << "."
<< endl; << endl;
@ -581,7 +673,8 @@ Foam::label Foam::checkGeometry(const polyMesh& mesh, const bool allGeometry)
if (nFaces > 0) if (nFaces > 0)
{ {
Info<< " <<Writing " << nFaces Info<< " <<Writing " << nFaces
<< " faces with incorrectly matched 0th vertex to set " << " faces with incorrectly matched 0th (or consecutive)"
<< " vertex to set "
<< faces.name() << endl; << faces.name() << endl;
faces.instance() = mesh.pointsInstance(); faces.instance() = mesh.pointsInstance();
faces.write(); faces.write();

View File

@ -1,9 +1,11 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/dynamicFvMesh/lnInclude \ -I$(LIB_SRC)/dynamicFvMesh/lnInclude \
-I$(LIB_SRC)/meshTools/lnInclude \ -I$(LIB_SRC)/meshTools/lnInclude \
-I$(LIB_SRC)/sampling/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-ldynamicFvMesh \ -ldynamicFvMesh \
-lmeshTools \ -lmeshTools \
-lsampling \
-ldynamicMesh -ldynamicMesh

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -32,19 +32,98 @@ Description
#include "argList.H" #include "argList.H"
#include "Time.H" #include "Time.H"
#include "dynamicFvMesh.H" #include "dynamicFvMesh.H"
#include "vtkSurfaceWriter.H"
#include "cyclicAMIPolyPatch.H"
using namespace Foam; using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Dump patch + weights to vtk file
void writeWeights
(
const scalarField& wghtSum,
const primitivePatch& patch,
const fileName& folder,
const fileName& prefix,
const word& timeName
)
{
vtkSurfaceWriter writer;
writer.write
(
folder,
prefix + "_proc" + Foam::name(Pstream::myProcNo()) + "_" + timeName,
patch.localPoints(),
patch.localFaces(),
"weightsSum",
wghtSum,
false
);
}
void writeWeights(const polyMesh& mesh)
{
const polyBoundaryMesh& pbm = mesh.boundaryMesh();
const word tmName(mesh.time().timeName());
forAll(pbm, patchI)
{
if (isA<cyclicAMIPolyPatch>(pbm[patchI]))
{
const cyclicAMIPolyPatch& cpp =
refCast<const cyclicAMIPolyPatch>(pbm[patchI]);
if (cpp.owner())
{
const AMIPatchToPatchInterpolation& ami =
cpp.AMI();
writeWeights
(
ami.tgtWeightsSum(),
cpp.neighbPatch(),
"output",
"tgt",
tmName
);
writeWeights
(
ami.srcWeightsSum(),
cpp,
"output",
"src",
tmName
);
}
}
}
}
// Main program: // Main program:
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
argList::addBoolOption
(
"checkAMI",
"check AMI weights"
);
# include "setRootCase.H" # include "setRootCase.H"
# include "createTime.H" # include "createTime.H"
# include "createDynamicFvMesh.H" # include "createDynamicFvMesh.H"
const bool checkAMI = args.optionFound("checkAMI");
if (checkAMI)
{
Info<< "Writing VTK files with weights of AMI patches." << nl << endl;
}
while (runTime.loop()) while (runTime.loop())
{ {
Info<< "Time = " << runTime.timeName() << endl; Info<< "Time = " << runTime.timeName() << endl;
@ -52,6 +131,11 @@ int main(int argc, char *argv[])
mesh.update(); mesh.update();
mesh.checkMesh(true); mesh.checkMesh(true);
if (checkAMI)
{
writeWeights(mesh);
}
runTime.write(); runTime.write();
Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s" Info<< "ExecutionTime = " << runTime.elapsedCpuTime() << " s"

View File

@ -1,15 +1,18 @@
EXE_INC = \ EXE_INC = \
-I$(LIB_SRC)/turbulenceModels \ -I$(LIB_SRC)/turbulenceModels \
-I$(LIB_SRC)/turbulenceModels/compressible/RAS/RASModel \ -I$(LIB_SRC)/turbulenceModels/compressible/turbulenceModel/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/specie/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/reactionThermo/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \ -I$(LIB_SRC)/thermophysicalModels/basic/lnInclude \
-I$(LIB_SRC)/thermophysicalModels/basicSolidThermo/lnInclude \
-I$(LIB_SRC)/finiteVolume/lnInclude -I$(LIB_SRC)/finiteVolume/lnInclude
EXE_LIBS = \ EXE_LIBS = \
-lcompressibleRASModels \ -lcompressibleTurbulenceModel \
-lreactionThermophysicalModels \ -lreactionThermophysicalModels \
-lfiniteVolume \ -lfiniteVolume \
-lgenericPatchFields \ -lgenericPatchFields \
-lspecie \ -lspecie \
-lbasicThermophysicalModels -lsolid \
-lbasicThermophysicalModels \
-lbasicSolidThermo

View File

@ -5,6 +5,7 @@ autoPtr<basicThermo> thermo
const volScalarField& h = thermo->he(); const volScalarField& h = thermo->he();
// Register copy of thermo density
volScalarField rho volScalarField rho
( (
IOobject IOobject
@ -16,28 +17,40 @@ volScalarField rho
thermo->rho() thermo->rho()
); );
volVectorField U // Construct turbulence model (if fluid)
( autoPtr<volVectorField> UPtr;
IOobject autoPtr<surfaceScalarField> phiPtr;
autoPtr<compressible::turbulenceModel> turbulence;
if (!isA<solidThermo>(thermo()))
{
UPtr.reset
( (
"U", new volVectorField
runTime.timeName(), (
mesh, IOobject
IOobject::MUST_READ, (
IOobject::AUTO_WRITE "U",
), runTime.timeName(),
mesh mesh,
); IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
mesh
)
);
const volVectorField& U = UPtr();
#include "compressibleCreatePhi.H" #include "compressibleCreatePhi.H"
// Copy phi to autoPtr. Rename to make sure copy is now registered as 'phi'.
phi.rename("phiFluid");
phiPtr.reset(new surfaceScalarField("phi", phi));
autoPtr<compressible::RASModel> RASModel turbulence = compressible::turbulenceModel::New
(
compressible::RASModel::New
( (
rho, rho,
U, U,
phi, phiPtr(),
thermo() thermo()
) );
); }

View File

@ -32,7 +32,8 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "RASModel.H" #include "turbulenceModel.H"
#include "solidThermo.H"
#include "wallFvPatch.H" #include "wallFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -56,7 +57,14 @@ int main(int argc, char *argv[])
surfaceScalarField heatFlux surfaceScalarField heatFlux
( (
fvc::interpolate(RASModel->alphaEff())*fvc::snGrad(h) fvc::interpolate
(
(
turbulence.valid()
? turbulence->alphaEff()()
: thermo->alpha()
)
)*fvc::snGrad(h)
); );
const surfaceScalarField::GeometricBoundaryField& patchHeatFlux = const surfaceScalarField::GeometricBoundaryField& patchHeatFlux =

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -93,6 +93,7 @@ int main(int argc, char *argv[])
U[celli] *= ::pow(y[celli]/yblv, (1.0/7.0)); U[celli] *= ::pow(y[celli]/yblv, (1.0/7.0));
} }
} }
U.correctBoundaryConditions();
Info<< "Writing U\n" << endl; Info<< "Writing U\n" << endl;
U.write(); U.write();
@ -109,7 +110,7 @@ int main(int argc, char *argv[])
if (args.optionFound("writenut")) if (args.optionFound("writenut"))
{ {
Info<< "Writing nut" << endl; Info<< "Writing " << nut.name() << nl << endl;
nut.write(); nut.write();
} }
@ -126,7 +127,7 @@ int main(int argc, char *argv[])
k = sqr(nut/(ck0*min(y, ybl))); k = sqr(nut/(ck0*min(y, ybl)));
k.correctBoundaryConditions(); k.correctBoundaryConditions();
Info<< "Writing k\n" << endl; Info<< "Writing " << k.name() << nl << endl;
k.write(); k.write();
@ -137,7 +138,7 @@ int main(int argc, char *argv[])
epsilon = ce0*k*sqrt(k)/min(y, ybl); epsilon = ce0*k*sqrt(k)/min(y, ybl);
epsilon.correctBoundaryConditions(); epsilon.correctBoundaryConditions();
Info<< "Writing epsilon\n" << endl; Info<< "Writing " << epsilon.name() << nl << endl;
epsilon.write(); epsilon.write();

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -41,9 +41,9 @@ License
singlePhaseTransportModel laminarTransport(U, phi); singlePhaseTransportModel laminarTransport(U, phi);
autoPtr<incompressible::RASModel> turbulence autoPtr<incompressible::turbulenceModel> turbulence
( (
incompressible::RASModel::New(U, phi, laminarTransport) incompressible::turbulenceModel::New(U, phi, laminarTransport)
); );
Info<< "Calculating wall distance field" << endl; Info<< "Calculating wall distance field" << endl;

View File

@ -88,7 +88,7 @@ cleanCase()
rm -rf \ rm -rf \
allOwner* cell* face* meshModifiers* \ allOwner* cell* face* meshModifiers* \
owner* neighbour* point* edge* \ owner* neighbour* point* edge* \
cellLevel* pointLevel* refinementHistory* level0Edge surfaceIndex* sets \ cellLevel* pointLevel* refinementHistory* level0Edge* surfaceIndex* sets \
> /dev/null 2>&1 \ > /dev/null 2>&1 \
) )
fi fi

View File

@ -172,7 +172,7 @@ Foam::scalarField Foam::coupledPolyPatch::calcFaceTol
maxLenSqr = max(maxLenSqr, magSqr(pt - cc)); maxLenSqr = max(maxLenSqr, magSqr(pt - cc));
maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt))); maxCmpt = max(maxCmpt, cmptMax(cmptMag(pt)));
} }
tols[faceI] = max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr)); tols[faceI] = max(SMALL, max(SMALL*maxCmpt, Foam::sqrt(maxLenSqr)));
} }
return tols; return tols;
} }
@ -200,12 +200,40 @@ Foam::label Foam::coupledPolyPatch::getRotation
} }
} }
if (anchorFp == -1 || mag(minDistSqr) > tol) if (anchorFp == -1 || Foam::sqrt(minDistSqr) > tol)
{ {
return -1; return -1;
} }
else else
{ {
// Check that anchor is unique.
forAll(f, fp)
{
scalar distSqr = magSqr(anchor - points[f[fp]]);
if (distSqr == minDistSqr && fp != anchorFp)
{
WarningIn
(
"label coupledPolyPatch::getRotation\n"
"(\n"
" const pointField&,\n"
" const face&,\n"
" const point&,\n"
" const scalar\n"
")"
) << "Cannot determine unique anchor point on face "
<< UIndirectList<point>(points, f)
<< endl
<< "Both at index " << anchorFp << " and " << fp
<< " the vertices have the same distance "
<< Foam::sqrt(minDistSqr)
<< " to the anchor " << anchor
<< ". Continuing but results might be wrong."
<< endl;
}
}
// Positive rotation // Positive rotation
return (f.size() - anchorFp) % f.size(); return (f.size() - anchorFp) % f.size();
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -118,8 +118,19 @@ void Foam::primitiveMesh::makeFaceCentresAndAreas
sumAc += a*c; sumAc += a*c;
} }
fCtrs[facei] = (1.0/3.0)*sumAc/(sumA + VSMALL);
fAreas[facei] = 0.5*sumN; if (sumA < ROOTVSMALL)
{
// Sum of area too small. No chance of reliably calculating
// centroid so fallback to average.
fCtrs[facei] = fCentre;
fAreas[facei] = 0.5*sumN;
}
else
{
fCtrs[facei] = (1.0/3.0)*sumAc/sumA;
fAreas[facei] = 0.5*sumN;
}
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -49,6 +49,7 @@ volumeIntegrate
return vf.mesh().V()*vf.internalField(); return vf.mesh().V()*vf.internalField();
} }
template<class Type> template<class Type>
tmp<Field<Type> > tmp<Field<Type> >
volumeIntegrate volumeIntegrate
@ -62,6 +63,23 @@ volumeIntegrate
} }
template<class Type>
tmp<Field<Type> > volumeIntegrate(const DimensionedField<Type, volMesh>& df)
{
return df.mesh().V()*df.field();
}
template<class Type>
tmp<Field<Type> >
volumeIntegrate(const tmp<DimensionedField<Type, volMesh> >& tdf)
{
tmp<Field<Type> > tdidf = tdf().mesh().V()*tdf().field();
tdf.clear();
return tdidf;
}
template<class Type> template<class Type>
dimensioned<Type> dimensioned<Type>
domainIntegrate domainIntegrate
@ -77,9 +95,9 @@ domainIntegrate
); );
} }
template<class Type> template<class Type>
dimensioned<Type> dimensioned<Type> domainIntegrate
domainIntegrate
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf const tmp<GeometricField<Type, fvPatchField, volMesh> >& tvf
) )
@ -90,6 +108,33 @@ domainIntegrate
} }
template<class Type>
dimensioned<Type> domainIntegrate
(
const DimensionedField<Type, volMesh>& df
)
{
return dimensioned<Type>
(
"domainIntegrate(" + df.name() + ')',
dimVol*df.dimensions(),
gSum(fvc::volumeIntegrate(df))
);
}
template<class Type>
dimensioned<Type> domainIntegrate
(
const tmp<DimensionedField<Type, volMesh> >& tdf
)
{
dimensioned<Type> integral = domainIntegrate(tdf());
tdf.clear();
return integral;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace fvc } // End namespace fvc

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -67,6 +67,19 @@ namespace fvc
); );
template<class Type>
tmp<Field<Type> > volumeIntegrate
(
const DimensionedField<Type, volMesh>&
);
template<class Type>
tmp<Field<Type> > volumeIntegrate
(
const tmp<DimensionedField<Type, volMesh> >&
);
template<class Type> template<class Type>
dimensioned<Type> domainIntegrate dimensioned<Type> domainIntegrate
( (
@ -78,6 +91,19 @@ namespace fvc
( (
const tmp<GeometricField<Type, fvPatchField, volMesh> >& const tmp<GeometricField<Type, fvPatchField, volMesh> >&
); );
template<class Type>
dimensioned<Type> domainIntegrate
(
const DimensionedField<Type, volMesh>&
);
template<class Type>
dimensioned<Type> domainIntegrate
(
const tmp<DimensionedField<Type, volMesh> >&
);
} }

View File

@ -336,7 +336,6 @@ void Foam::ReactingCloud<CloudType>::evolve()
} }
template<class CloudType> template<class CloudType>
void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper) void Foam::ReactingCloud<CloudType>::autoMap(const mapPolyMesh& mapper)
{ {

View File

@ -169,14 +169,15 @@ const Foam::vector Foam::KinematicParcel<ParcelType>::calcVelocity
const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, mu); const forceSuSp Fcp = forces.calcCoupled(p, dt, mass, Re, mu);
const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, mu); const forceSuSp Fncp = forces.calcNonCoupled(p, dt, mass, Re, mu);
const forceSuSp Feff = Fcp + Fncp; const forceSuSp Feff = Fcp + Fncp;
const scalar massEff = forces.massEff(p, mass);
// New particle velocity // New particle velocity
//~~~~~~~~~~~~~~~~~~~~~~ //~~~~~~~~~~~~~~~~~~~~~~
// Update velocity - treat as 3-D // Update velocity - treat as 3-D
const vector abp = (Feff.Sp()*Uc_ + (Feff.Su() + Su))/mass; const vector abp = (Feff.Sp()*Uc_ + (Feff.Su() + Su))/massEff;
const scalar bp = Feff.Sp()/mass; const scalar bp = Feff.Sp()/massEff;
Spu = dt*Feff.Sp(); Spu = dt*Feff.Sp();

View File

@ -67,19 +67,31 @@ inline Foam::KinematicParcel<ParcelType>::constantProperties::constantProperties
) )
: :
dict_(parentDict.subOrEmptyDict("constantProperties")), dict_(parentDict.subOrEmptyDict("constantProperties")),
parcelTypeId_(-1), parcelTypeId_(1),
rhoMin_(0.0), rhoMin_(1e-15),
rho0_(0.0), rho0_(0.0),
minParticleMass_(0.0), minParticleMass_(1e-15),
youngsModulus_(0.0), youngsModulus_(0.0),
poissonsRatio_(0.0) poissonsRatio_(0.0)
{ {
if (readFields) if (readFields)
{ {
dict_.lookup("parcelTypeId") >> parcelTypeId_; if (dict_.readIfPresent("parcelTypeId", parcelTypeId_))
dict_.lookup("rhoMin") >> rhoMin_; {
Info<< " employing parcel parcelTypeId of " << parcelTypeId_
<< endl;
}
if (dict_.readIfPresent("rhoMin", rhoMin_))
{
Info<< " employing parcel rhoMin of " << rhoMin_ << endl;
}
if (dict_.readIfPresent("minParticleMass", minParticleMass_))
{
Info<< " employing parcel minParticleMass of "
<< minParticleMass_ << endl;
}
dict_.lookup("rho0") >> rho0_; dict_.lookup("rho0") >> rho0_;
dict_.lookup("minParticleMass") >> minParticleMass_;
dict_.lookup("youngsModulus") >> youngsModulus_; dict_.lookup("youngsModulus") >> youngsModulus_;
dict_.lookup("poissonsRatio") >> poissonsRatio_; dict_.lookup("poissonsRatio") >> poissonsRatio_;
} }

View File

@ -115,6 +115,7 @@ public:
const scalar poissonsRatio, const scalar poissonsRatio,
const scalar T0, const scalar T0,
const scalar TMin, const scalar TMin,
const scalar TMax,
const scalar Cp0, const scalar Cp0,
const scalar epsilon0, const scalar epsilon0,
const scalar f0, const scalar f0,

View File

@ -59,14 +59,18 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
) )
: :
ParcelType::constantProperties(parentDict, readFields), ParcelType::constantProperties(parentDict, readFields),
pMin_(0.0), pMin_(1000.0),
constantVolume_(false), constantVolume_(false),
Tvap_(0.0), Tvap_(0.0),
Tbp_(0.0) Tbp_(0.0)
{ {
if (readFields) if (readFields)
{ {
this->dict().lookup("pMin") >> pMin_; if (this->dict().readIfPresent("pMin", pMin_))
{
Info<< " employing parcel pMin of " << pMin_ << endl;
}
this->dict().lookup("constantVolume") >> constantVolume_; this->dict().lookup("constantVolume") >> constantVolume_;
this->dict().lookup("Tvap") >> Tvap_; this->dict().lookup("Tvap") >> Tvap_;
this->dict().lookup("Tbp") >> Tbp_; this->dict().lookup("Tbp") >> Tbp_;
@ -85,6 +89,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
const scalar poissonsRatio, const scalar poissonsRatio,
const scalar T0, const scalar T0,
const scalar TMin, const scalar TMin,
const scalar TMax,
const scalar Cp0, const scalar Cp0,
const scalar epsilon0, const scalar epsilon0,
const scalar f0, const scalar f0,
@ -105,6 +110,7 @@ inline Foam::ReactingParcel<ParcelType>::constantProperties::constantProperties
poissonsRatio, poissonsRatio,
T0, T0,
TMin, TMin,
TMax,
Cp0, Cp0,
epsilon0, epsilon0,
f0, f0,

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -324,7 +324,16 @@ Foam::scalar Foam::ThermoParcel<ParcelType>::calcHeatTransfer
IntegrationScheme<scalar>::integrationResult Tres = IntegrationScheme<scalar>::integrationResult Tres =
td.cloud().TIntegrator().integrate(T_, dt, ap*bp, bp); td.cloud().TIntegrator().integrate(T_, dt, ap*bp, bp);
scalar Tnew = max(Tres.value(), td.cloud().constProps().TMin()); scalar Tnew =
min
(
max
(
Tres.value(),
td.cloud().constProps().TMin()
),
td.cloud().constProps().TMax()
);
Sph = dt*htc*As; Sph = dt*htc*As;

View File

@ -82,6 +82,9 @@ public:
//- Minimum temperature [K] //- Minimum temperature [K]
scalar TMin_; scalar TMin_;
//- Maximum temperature [K]
scalar TMax_;
//- Particle specific heat capacity [J/(kg.K)] //- Particle specific heat capacity [J/(kg.K)]
scalar Cp0_; scalar Cp0_;
@ -123,6 +126,7 @@ public:
const scalar poissonsRatio, const scalar poissonsRatio,
const scalar T0, const scalar T0,
const scalar TMin, const scalar TMin,
const scalar TMax,
const scalar Cp0, const scalar Cp0,
const scalar epsilon0, const scalar epsilon0,
const scalar f0, const scalar f0,
@ -140,6 +144,9 @@ public:
//- Return const access to minimum temperature [K] //- Return const access to minimum temperature [K]
inline scalar TMin() const; inline scalar TMin() const;
//- Return const access to maximum temperature [K]
inline scalar TMax() const;
//- Return const access to the particle specific heat capacity //- Return const access to the particle specific heat capacity
// [J/(kg.K)] // [J/(kg.K)]
inline scalar Cp0() const; inline scalar Cp0() const;

View File

@ -31,6 +31,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties()
ParcelType::constantProperties(), ParcelType::constantProperties(),
T0_(0.0), T0_(0.0),
TMin_(0.0), TMin_(0.0),
TMax_(VGREAT),
Cp0_(0.0), Cp0_(0.0),
epsilon0_(0.0), epsilon0_(0.0),
f0_(0.0), f0_(0.0),
@ -47,6 +48,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
ParcelType::constantProperties(cp), ParcelType::constantProperties(cp),
T0_(cp.T0_), T0_(cp.T0_),
TMin_(cp.TMin_), TMin_(cp.TMin_),
TMax_(cp.TMax_),
Cp0_(cp.Cp0_), Cp0_(cp.Cp0_),
epsilon0_(cp.epsilon0_), epsilon0_(cp.epsilon0_),
f0_(cp.f0_), f0_(cp.f0_),
@ -63,7 +65,8 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
: :
ParcelType::constantProperties(parentDict, readFields), ParcelType::constantProperties(parentDict, readFields),
T0_(0.0), T0_(0.0),
TMin_(0.0), TMin_(200),
TMax_(5000),
Cp0_(0.0), Cp0_(0.0),
epsilon0_(0.0), epsilon0_(0.0),
f0_(0.0), f0_(0.0),
@ -71,8 +74,16 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
{ {
if (readFields) if (readFields)
{ {
if (this->dict().readIfPresent("TMin", TMin_))
{
Info<< " employing parcel TMin of " << TMin_ << endl;
}
if (this->dict().readIfPresent("TMax", TMax_))
{
Info<< " employing parcel TMax of " << TMax_ << endl;
}
this->dict().lookup("T0") >> T0_; this->dict().lookup("T0") >> T0_;
this->dict().lookup("TMin") >> TMin_;
this->dict().lookup("Cp0") >> Cp0_; this->dict().lookup("Cp0") >> Cp0_;
this->dict().lookup("epsilon0") >> epsilon0_; this->dict().lookup("epsilon0") >> epsilon0_;
this->dict().lookup("f0") >> f0_; this->dict().lookup("f0") >> f0_;
@ -92,6 +103,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
const scalar poissonsRatio, const scalar poissonsRatio,
const scalar T0, const scalar T0,
const scalar TMin, const scalar TMin,
const scalar TMax,
const scalar Cp0, const scalar Cp0,
const scalar epsilon0, const scalar epsilon0,
const scalar f0, const scalar f0,
@ -109,6 +121,7 @@ inline Foam::ThermoParcel<ParcelType>::constantProperties::constantProperties
), ),
T0_(T0), T0_(T0),
TMin_(TMin), TMin_(TMin),
TMax_(TMax),
Cp0_(Cp0), Cp0_(Cp0),
epsilon0_(epsilon0), epsilon0_(epsilon0),
f0_(f0), f0_(f0),
@ -195,6 +208,14 @@ Foam::ThermoParcel<ParcelType>::constantProperties::TMin() const
} }
template<class ParcelType>
inline Foam::scalar
Foam::ThermoParcel<ParcelType>::constantProperties::TMax() const
{
return TMax_;
}
template<class ParcelType> template<class ParcelType>
inline Foam::scalar inline Foam::scalar
Foam::ThermoParcel<ParcelType>::constantProperties::Cp0() const Foam::ThermoParcel<ParcelType>::constantProperties::Cp0() const

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -36,6 +36,7 @@ License
#include "ParamagneticForce.H" #include "ParamagneticForce.H"
#include "PressureGradientForce.H" #include "PressureGradientForce.H"
#include "SRFForce.H" #include "SRFForce.H"
#include "VirtualMassForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -48,7 +49,8 @@ License
makeParticleForceModelType(NonInertialFrameForce, CloudType); \ makeParticleForceModelType(NonInertialFrameForce, CloudType); \
makeParticleForceModelType(ParamagneticForce, CloudType); \ makeParticleForceModelType(ParamagneticForce, CloudType); \
makeParticleForceModelType(PressureGradientForce, CloudType); \ makeParticleForceModelType(PressureGradientForce, CloudType); \
makeParticleForceModelType(SRFForce, CloudType); makeParticleForceModelType(SRFForce, CloudType); \
makeParticleForceModelType(VirtualMassForce, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,6 +37,7 @@ License
#include "ParamagneticForce.H" #include "ParamagneticForce.H"
#include "PressureGradientForce.H" #include "PressureGradientForce.H"
#include "SRFForce.H" #include "SRFForce.H"
#include "VirtualMassForce.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -50,7 +51,8 @@ License
makeParticleForceModelType(NonInertialFrameForce, CloudType); \ makeParticleForceModelType(NonInertialFrameForce, CloudType); \
makeParticleForceModelType(ParamagneticForce, CloudType); \ makeParticleForceModelType(ParamagneticForce, CloudType); \
makeParticleForceModelType(PressureGradientForce, CloudType); \ makeParticleForceModelType(PressureGradientForce, CloudType); \
makeParticleForceModelType(SRFForce, CloudType); makeParticleForceModelType(SRFForce, CloudType); \
makeParticleForceModelType(VirtualMassForce, CloudType);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -180,4 +180,21 @@ Foam::forceSuSp Foam::ParticleForceList<CloudType>::calcNonCoupled
} }
template<class CloudType>
Foam::scalar Foam::ParticleForceList<CloudType>::massEff
(
const typename CloudType::parcelType& p,
const scalar mass
) const
{
scalar massEff = mass;
forAll(*this, i)
{
massEff += this->operator[](i).massAdd(p, mass);
}
return massEff;
}
// ************************************************************************* // // ************************************************************************* //

View File

@ -130,6 +130,13 @@ public:
const scalar Re, const scalar Re,
const scalar muc const scalar muc
) const; ) const;
//- Return the effective mass
virtual scalar massEff
(
const typename CloudType::parcelType& p,
const scalar mass
) const;
}; };

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -27,7 +27,6 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType> template<class CloudType>
Foam::ParticleForce<CloudType>::ParticleForce Foam::ParticleForce<CloudType>::ParticleForce
( (
@ -120,6 +119,17 @@ Foam::forceSuSp Foam::ParticleForce<CloudType>::calcNonCoupled
} }
template<class CloudType>
Foam::scalar Foam::ParticleForce<CloudType>::massAdd
(
const typename CloudType::parcelType& p,
const scalar mass
) const
{
return 0.0;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "ParticleForceNew.C" #include "ParticleForceNew.C"

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -47,7 +47,7 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class ParticleForce Declaration Class ParticleForce Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class CloudType> template<class CloudType>
@ -169,6 +169,13 @@ public:
const scalar Re, const scalar Re,
const scalar muc const scalar muc
) const; ) const;
//- Return the added mass
virtual scalar massAdd
(
const typename CloudType::parcelType& p,
const scalar mass
) const;
}; };

View File

@ -0,0 +1,139 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
#include "VirtualMassForce.H"
#include "fvcDdt.H"
#include "fvcGrad.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
Foam::VirtualMassForce<CloudType>::VirtualMassForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict
)
:
ParticleForce<CloudType>(owner, mesh, dict, typeName, true),
UName_(this->coeffs().template lookupOrDefault<word>("U", "U")),
Cvm_(readScalar(this->coeffs().lookup("Cvm"))),
DUcDtPtr_(NULL),
DUcDtInterpPtr_(NULL)
{}
template<class CloudType>
Foam::VirtualMassForce<CloudType>::VirtualMassForce
(
const VirtualMassForce& vmf
)
:
ParticleForce<CloudType>(vmf),
UName_(vmf.UName_),
Cvm_(vmf.Cvm_),
DUcDtPtr_(NULL),
DUcDtInterpPtr_(NULL)
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class CloudType>
Foam::VirtualMassForce<CloudType>::~VirtualMassForce()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
void Foam::VirtualMassForce<CloudType>::cacheFields(const bool store)
{
if (store && !DUcDtPtr_)
{
const volVectorField& Uc = this->mesh().template
lookupObject<volVectorField>(UName_);
DUcDtPtr_ = new volVectorField
(
"DUcDt",
fvc::ddt(Uc) + (Uc & fvc::grad(Uc))
);
DUcDtInterpPtr_.reset
(
interpolation<vector>::New
(
this->owner().solution().interpolationSchemes(),
*DUcDtPtr_
).ptr()
);
}
else
{
DUcDtInterpPtr_.clear();
if (DUcDtPtr_)
{
delete DUcDtPtr_;
DUcDtPtr_ = NULL;
}
}
}
template<class CloudType>
Foam::forceSuSp Foam::VirtualMassForce<CloudType>::calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar mass,
const scalar Re,
const scalar muc
) const
{
forceSuSp value(vector::zero, 0.0);
vector DUcDt =
DUcDtInterp().interpolate(p.position(), p.currentTetIndices());
value.Su() = mass*p.rhoc()/p.rho()*Cvm_*DUcDt;
return value;
}
template<class CloudType>
Foam::scalar Foam::VirtualMassForce<CloudType>::massAdd
(
const typename CloudType::parcelType& p,
const scalar mass
) const
{
return mass*p.rhoc()/p.rho()*Cvm_;
}
// ************************************************************************* //

View File

@ -0,0 +1,156 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
Class
Foam::VirtualMassForce
Description
Calculates particle virtual mass force
SourceFiles
VirtualMassForceI.H
VirtualMassForce.C
\*---------------------------------------------------------------------------*/
#ifndef VirtualMassForce_H
#define VirtualMassForce_H
#include "ParticleForce.H"
#include "volFields.H"
#include "interpolation.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class VirtualMassForce Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
class VirtualMassForce
:
public ParticleForce<CloudType>
{
// Private data
//- Name of velocity field
const word UName_;
//- Virtual mass coefficient - typically 0.5
scalar Cvm_;
//- Rate of change of carrier phase velocity
volVectorField* DUcDtPtr_;
//- Rate of change of carrier phase velocity interpolator
autoPtr<interpolation<vector> > DUcDtInterpPtr_;
public:
//- Runtime type information
TypeName("virtualMass");
// Constructors
//- Construct from mesh
VirtualMassForce
(
CloudType& owner,
const fvMesh& mesh,
const dictionary& dict
);
//- Construct copy
VirtualMassForce(const VirtualMassForce& pgf);
//- Construct and return a clone
virtual autoPtr<ParticleForce<CloudType> > clone() const
{
return autoPtr<ParticleForce<CloudType> >
(
new VirtualMassForce<CloudType>(*this)
);
}
//- Destructor
virtual ~VirtualMassForce();
// Member Functions
// Access
//- Return the rate of change of carrier phase velocity
inline const volVectorField& DUcDt() const;
//- Return the rate of change of carrier phase velocity interpolator
inline const interpolation<vector>& DUcDtInterp() const;
// Evaluation
//- Cache fields
virtual void cacheFields(const bool store);
//- Calculate the non-coupled force
virtual forceSuSp calcCoupled
(
const typename CloudType::parcelType& p,
const scalar dt,
const scalar mass,
const scalar Re,
const scalar muc
) const;
//- Return the added mass
virtual scalar massAdd
(
const typename CloudType::parcelType& p,
const scalar mass
) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "VirtualMassForceI.H"
#ifdef NoRepository
#include "VirtualMassForce.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,66 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
\*---------------------------------------------------------------------------*/
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class CloudType>
const Foam::volVectorField& Foam::VirtualMassForce<CloudType>::DUcDt() const
{
if (DUcDtPtr_)
{
return *DUcDtPtr_;
}
else
{
FatalErrorIn
(
"const volVectorField& VirtualMassForce<CloudType>::DUcDt()"
"const"
) << "DUcDt field not allocated" << abort(FatalError);
return *reinterpret_cast<const volVectorField*>(0);
}
}
template<class CloudType>
inline const Foam::interpolation<Foam::vector>&
Foam::VirtualMassForce<CloudType>::DUcDtInterp() const
{
if (!DUcDtInterpPtr_.valid())
{
FatalErrorIn
(
"inline const Foam::interpolation<Foam::vector>&"
"Foam::VirtualMassForce<CloudType>::DUcDtInterp() const"
) << "Carrier pahase DUcDt interpolation object not set"
<< abort(FatalError);
}
return DUcDtInterpPtr_();
}
// ************************************************************************* //

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -28,209 +28,14 @@ License
#include "unitConversion.H" #include "unitConversion.H"
#include "refinementSurfaces.H" #include "refinementSurfaces.H"
#include "searchableSurfaces.H" #include "searchableSurfaces.H"
#include "regExp.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90; const Foam::scalar Foam::layerParameters::defaultConcaveAngle = 90;
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// Read the number of layers from dictionary. Per patch 0 or the number
// of layers.
Foam::labelList Foam::layerParameters::readNumLayers
(
const PtrList<dictionary>& surfaceDicts,
const refinementSurfaces& refineSurfaces,
const labelList& globalToPatch,
const polyBoundaryMesh& boundaryMesh
)
{
// Per surface the number of layers
labelList globalSurfLayers(surfaceDicts.size());
// Per surface, per region the number of layers
List<Map<label> > regionSurfLayers(surfaceDicts.size());
const labelList& surfaceIndices = refineSurfaces.surfaces();
forAll(surfaceDicts, surfI)
{
const dictionary& dict = surfaceDicts[surfI];
globalSurfLayers[surfI] = readLabel(dict.lookup("surfaceLayers"));
if (dict.found("regions"))
{
// Per-region layer information
PtrList<dictionary> regionDicts(dict.lookup("regions"));
const wordList& regionNames =
refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
forAll(regionDicts, dictI)
{
const dictionary& regionDict = regionDicts[dictI];
const word regionName(regionDict.lookup("name"));
label regionI = findIndex(regionNames, regionName);
label nLayers = readLabel(regionDict.lookup("surfaceLayers"));
Info<< " region " << regionName << ':'<< nl
<< " surface layers:" << nLayers << nl;
regionSurfLayers[surfI].insert(regionI, nLayers);
}
}
}
// Transfer per surface/region information into patchwise region info
labelList nLayers(boundaryMesh.size(), 0);
forAll(surfaceIndices, surfI)
{
const wordList& regionNames =
refineSurfaces.geometry()[surfaceIndices[surfI]].regions();
forAll(regionNames, regionI)
{
const word& regionName = regionNames[regionI];
label global = refineSurfaces.globalRegion(surfI, regionI);
label patchI = globalToPatch[global];
// Initialise to surface-wise layers
nLayers[patchI] = globalSurfLayers[surfI];
// Override with region specific data if available
Map<label>::const_iterator iter =
regionSurfLayers[surfI].find(regionI);
if (iter != regionSurfLayers[surfI].end())
{
nLayers[patchI] = iter();
}
// Check
if (nLayers[patchI] < 0)
{
FatalErrorIn
(
"layerParameters::readNumLayers(..)"
) << "Illegal number of layers " << nLayers[patchI]
<< " for surface "
<< refineSurfaces.names()[surfI]
<< " region " << regionName << endl
<< exit(FatalError);
}
}
}
return nLayers;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
//// Construct from dictionary
//Foam::layerParameters::layerParameters
//(
// const PtrList<dictionary>& surfaceDicts,
// const refinementSurfaces& refineSurfaces,
// const labelList& globalToPatch,
// const dictionary& dict,
// const polyBoundaryMesh& boundaryMesh
//)
//:
// numLayers_
// (
// readNumLayers
// (
// surfaceDicts,
// refineSurfaces,
// globalToPatch,
// boundaryMesh
// )
// ),
// expansionRatio_
// (
// numLayers_.size(),
// readScalar(dict.lookup("expansionRatio"))
// ),
// relativeSizes_(false),
// finalLayerThickness_
// (
// numLayers_.size(),
// readScalar(dict.lookup("finalLayerRatio"))
// ),
// minThickness_
// (
// numLayers_.size(),
// readScalar(dict.lookup("minThickness"))
// ),
// featureAngle_(readScalar(dict.lookup("featureAngle"))),
// concaveAngle_
// (
// dict.lookupOrDefault("concaveAngle", defaultConcaveAngle)
// ),
// nGrow_(readLabel(dict.lookup("nGrow"))),
// nSmoothSurfaceNormals_
// (
// readLabel(dict.lookup("nSmoothSurfaceNormals"))
// ),
// nSmoothNormals_(readLabel(dict.lookup("nSmoothNormals"))),
// nSmoothThickness_(readLabel(dict.lookup("nSmoothThickness"))),
// maxFaceThicknessRatio_
// (
// readScalar(dict.lookup("maxFaceThicknessRatio"))
// ),
// layerTerminationCos_
// (
// Foam::cos(degToRad(0.5*featureAngle_))
// ),
// maxThicknessToMedialRatio_
// (
// readScalar(dict.lookup("maxThicknessToMedialRatio"))
// ),
// minMedianAxisAngleCos_
// (
// Foam::cos(degToRad(readScalar(dict.lookup("minMedianAxisAngle"))))
// ),
// nBufferCellsNoExtrude_
// (
// readLabel(dict.lookup("nBufferCellsNoExtrude"))
// ),
// nSnap_(readLabel(dict.lookup("nSnap"))),
// nLayerIter_(readLabel(dict.lookup("nLayerIter"))),
// nRelaxedIter_(labelMax)
//{
// if (nGrow_ > 0)
// {
// WarningIn("layerParameters::layerParameters(..)")
// << "The nGrow parameter effect has changed with respect to 1.6.x."
// << endl
// << "Please set nGrow=0 for 1.6.x behaviour."
// << endl;
// }
//
// dict.readIfPresent("nRelaxedIter", nRelaxedIter_);
//
// if (nLayerIter_ < 0 || nRelaxedIter_ < 0)
// {
// FatalErrorIn("layerParameters::layerParameters(..)")
// << "Layer iterations should be >= 0." << endl
// << "nLayerIter:" << nLayerIter_
// << " nRelaxedIter:" << nRelaxedIter_
// << exit(FatalError);
// }
//}
// Construct from dictionary // Construct from dictionary
Foam::layerParameters::layerParameters Foam::layerParameters::layerParameters
( (
@ -315,71 +120,51 @@ Foam::layerParameters::layerParameters
const dictionary& layersDict = dict.subDict("layers"); const dictionary& layersDict = dict.subDict("layers");
forAll(boundaryMesh, patchI) forAllConstIter(dictionary, layersDict, iter)
{ {
const word& patchName = boundaryMesh[patchI].name(); if (iter().isDict())
if (layersDict.found(patchName))
{ {
const dictionary& layerDict = layersDict.subDict(patchName); const word& key = iter().keyword();
const labelHashSet patchIDs
numLayers_[patchI] =
readLabel(layerDict.lookup("nSurfaceLayers"));
layerDict.readIfPresent
( (
"expansionRatio", boundaryMesh.patchSet(List<wordRe>(1, key))
expansionRatio_[patchI]
); );
layerDict.readIfPresent
(
"finalLayerThickness",
finalLayerThickness_[patchI]
);
layerDict.readIfPresent
(
"minThickness",
minThickness_[patchI]
);
}
}
if (patchIDs.size() == 0)
// Check whether layer specification matches any patches
const List<keyType> wildCards = layersDict.keys(true);
forAll(wildCards, i)
{
regExp re(wildCards[i]);
bool hasMatch = false;
forAll(boundaryMesh, patchI)
{
if (re.match(boundaryMesh[patchI].name()))
{ {
hasMatch = true; IOWarningIn("layerParameters::layerParameters(..)", layersDict)
break; << "Layer specification for " << key
<< " does not match any patch." << endl
<< "Valid patches are " << boundaryMesh.names() << endl;
} }
} else
if (!hasMatch) {
{ const dictionary& layerDict = iter().dict();
IOWarningIn("layerParameters::layerParameters(..)", layersDict)
<< "Wildcard layer specification for " << wildCards[i]
<< " does not match any patch." << endl
<< "Valid patches are " << boundaryMesh.names() << endl;
}
}
const List<keyType> nonWildCards = layersDict.keys(false); forAllConstIter(labelHashSet, patchIDs, patchIter)
{
label patchI = patchIter.key();
forAll(nonWildCards, i) numLayers_[patchI] =
{ readLabel(layerDict.lookup("nSurfaceLayers"));
if (boundaryMesh.findPatchID(nonWildCards[i]) == -1)
{ layerDict.readIfPresent
IOWarningIn("layerParameters::layerParameters(..)", layersDict) (
<< "Layer specification for " << nonWildCards[i] "expansionRatio",
<< " does not match any patch." << endl expansionRatio_[patchI]
<< "Valid patches are " << boundaryMesh.names() << endl; );
layerDict.readIfPresent
(
"finalLayerThickness",
finalLayerThickness_[patchI]
);
layerDict.readIfPresent
(
"minThickness",
minThickness_[patchI]
);
}
}
} }
} }
} }

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -109,15 +109,6 @@ class layerParameters
// Private Member Functions // Private Member Functions
//- Extract patch-wise number of layers
static labelList readNumLayers
(
const PtrList<dictionary>& surfaceDicts,
const refinementSurfaces& refineSurfaces,
const labelList& globalToPatch,
const polyBoundaryMesh& boundaryMesh
);
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
layerParameters(const layerParameters&); layerParameters(const layerParameters&);
@ -129,17 +120,7 @@ public:
// Constructors // Constructors
////- Construct from dictionary - old syntax //- Construct from dictionary
//layerParameters
//(
// const PtrList<dictionary>& surfaceDicts,
// const refinementSurfaces& refineSurfaces,
// const labelList& globalToPatch,
// const dictionary& dict,
// const polyBoundaryMesh& boundaryMesh
//);
//- Construct from dictionary - new syntax
layerParameters(const dictionary& dict, const polyBoundaryMesh&); layerParameters(const dictionary& dict, const polyBoundaryMesh&);

View File

@ -129,17 +129,9 @@ extern "C"
// Hack: scotch generates floating point errors so need to switch of error // Hack: scotch generates floating point errors so need to switch of error
// trapping! // trapping!
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) #ifdef __GLIBC__
# define LINUX # ifndef _GNU_SOURCE
#endif # define _GNU_SOURCE
#if defined(LINUX) && defined(__GNUC__)
# define LINUX_GNUC
#endif
#ifdef LINUX_GNUC
# ifndef __USE_GNU
# define __USE_GNU
# endif # endif
# include <fenv.h> # include <fenv.h>
#endif #endif
@ -651,7 +643,7 @@ Foam::label Foam::ptscotchDecomp::decompose
// Hack:switch off fpu error trapping // Hack:switch off fpu error trapping
# ifdef LINUX_GNUC # ifdef FE_NOMASK_ENV
int oldExcepts = fedisableexcept int oldExcepts = fedisableexcept
( (
FE_DIVBYZERO FE_DIVBYZERO
@ -681,7 +673,7 @@ Foam::label Foam::ptscotchDecomp::decompose
"SCOTCH_graphMap" "SCOTCH_graphMap"
); );
# ifdef LINUX_GNUC # ifdef FE_NOMASK_ENV
feenableexcept(oldExcepts); feenableexcept(oldExcepts);
# 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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -135,17 +135,9 @@ extern "C"
// Hack: scotch generates floating point errors so need to switch of error // Hack: scotch generates floating point errors so need to switch of error
// trapping! // trapping!
#if defined(linux) || defined(linuxAMD64) || defined(linuxIA64) #ifdef __GLIBC__
# define LINUX # ifndef _GNU_SOURCE
#endif # define _GNU_SOURCE
#if defined(LINUX) && defined(__GNUC__)
# define LINUX_GNUC
#endif
#ifdef LINUX_GNUC
# ifndef __USE_GNU
# define __USE_GNU
# endif # endif
# include <fenv.h> # include <fenv.h>
#endif #endif
@ -503,7 +495,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
// Hack:switch off fpu error trapping // Hack:switch off fpu error trapping
# ifdef LINUX_GNUC # ifdef FE_NOMASK_ENV
int oldExcepts = fedisableexcept int oldExcepts = fedisableexcept
( (
FE_DIVBYZERO FE_DIVBYZERO
@ -526,7 +518,7 @@ Foam::label Foam::scotchDecomp::decomposeOneProc
"SCOTCH_graphMap" "SCOTCH_graphMap"
); );
# ifdef LINUX_GNUC # ifdef FE_NOMASK_ENV
feenableexcept(oldExcepts); feenableexcept(oldExcepts);
# 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) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -161,7 +161,7 @@ public:
// Selectors // Selectors
//- Return a reference to the selected pyrolysis film model //- Return a reference to the selected pyrolysis model
static autoPtr<pyrolysisModel> New(const fvMesh& mesh); static autoPtr<pyrolysisModel> New(const fvMesh& mesh);
//- Return a reference to a named selected pyrolysis model //- Return a reference to a named selected pyrolysis model

View File

@ -153,10 +153,10 @@ void reactingOneDim::updatePhiGas()
tmp<volScalarField> tHsiGas = tmp<volScalarField> tHsiGas =
solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI); solidChemistry_->gasHs(solidThermo_.p(), solidThermo_.T(), gasI);
tmp<volScalarField> tRRiGas = solidChemistry_->RRg(gasI);
const volScalarField& HsiGas = tHsiGas(); const volScalarField& HsiGas = tHsiGas();
const volScalarField& RRiGas = tRRiGas();
const DimensionedField<scalar, volMesh>& RRiGas =
solidChemistry_->RRg(gasI);
label totalFaceId = 0; label totalFaceId = 0;
forAll(intCoupledPatchIDs_, i) forAll(intCoupledPatchIDs_, i)

View File

@ -262,7 +262,7 @@ public:
//- Evolve the region //- Evolve the region
virtual void evolveRegion(); virtual void evolveRegion();
//- Evolve the film //- Evolve the region
virtual void evolve(); virtual void evolve();

View File

@ -33,6 +33,7 @@ Description
#define makesolidThermo_H #define makesolidThermo_H
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "basicThermo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
@ -127,6 +128,12 @@ addToRunTimeSelectionTable \
BaseThermo, \ BaseThermo, \
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \ Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
mesh \ mesh \
); \
addToRunTimeSelectionTable \
( \
basicThermo, \
Cthermo##Mixture##Transport##Radiation##Type##Thermo##Rho##BaseThermo, \
fvMesh \
); \ ); \
\ \
addToRunTimeSelectionTable \ addToRunTimeSelectionTable \

View File

@ -64,7 +64,19 @@ Foam::ODEChemistryModel<CompType, ThermoType>::ODEChemistryModel
RR_.set RR_.set
( (
fieldI, fieldI,
new scalarField(mesh.nCells(), 0.0) new DimensionedField<scalar, volMesh>
(
IOobject
(
"RR::" + Y_[fieldI].name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
); );
} }
@ -687,6 +699,11 @@ Foam::label Foam::ODEChemistryModel<CompType, ThermoType>::nEqns() const
template<class CompType, class ThermoType> template<class CompType, class ThermoType>
void Foam::ODEChemistryModel<CompType, ThermoType>::calculate() void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
{ {
if (!this->chemistry_)
{
return;
}
const volScalarField rho const volScalarField rho
( (
IOobject IOobject
@ -701,36 +718,24 @@ void Foam::ODEChemistryModel<CompType, ThermoType>::calculate()
this->thermo().rho() this->thermo().rho()
); );
if (this->mesh().changing()) forAll(rho, celli)
{ {
const scalar rhoi = rho[celli];
const scalar Ti = this->thermo().T()[celli];
const scalar pi = this->thermo().p()[celli];
scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSpecie_; i++) for (label i=0; i<nSpecie_; i++)
{ {
RR_[i].setSize(rho.size()); const scalar Yi = Y_[i][celli];
RR_[i] = 0.0; c[i] = rhoi*Yi/specieThermo_[i].W();
} }
}
if (this->chemistry_) const scalarField dcdt(omega(c, Ti, pi));
{
forAll(rho, celli) for (label i=0; i<nSpecie_; i++)
{ {
const scalar rhoi = rho[celli]; RR_[i][celli] = dcdt[i]*specieThermo_[i].W();
const scalar Ti = this->thermo().T()[celli];
const scalar pi = this->thermo().p()[celli];
scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSpecie_; i++)
{
const scalar Yi = Y_[i][celli];
c[i] = rhoi*Yi/specieThermo_[i].W();
}
const scalarField dcdt(omega(c, Ti, pi));
for (label i=0; i<nSpecie_; i++)
{
RR_[i][celli] = dcdt[i]*specieThermo_[i].W();
}
} }
} }
} }
@ -747,6 +752,11 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
scalar deltaTMin = GREAT; scalar deltaTMin = GREAT;
if (!this->chemistry_)
{
return deltaTMin;
}
const volScalarField rho const volScalarField rho
( (
IOobject IOobject
@ -761,21 +771,6 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
this->thermo().rho() this->thermo().rho()
); );
if (this->mesh().changing())
{
for (label i = 0; i < nSpecie_; i++)
{
RR_[i].setSize(this->mesh().nCells());
RR_[i] = 0.0;
}
}
if (!this->chemistry_)
{
return deltaTMin;
}
tmp<volScalarField> thc = this->thermo().hc(); tmp<volScalarField> thc = this->thermo().hc();
const scalarField& hc = thc(); const scalarField& hc = thc();
@ -856,7 +851,7 @@ Foam::scalar Foam::ODEChemistryModel<CompType, ThermoType>::solve
"const scalar, " "const scalar, "
"const scalar, " "const scalar, "
"const scalar" "const scalar"
")" ") const"
); );
return (0); return (0);

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -42,6 +42,7 @@ SourceFiles
#include "ODE.H" #include "ODE.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "simpleMatrix.H" #include "simpleMatrix.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -90,14 +91,14 @@ protected:
label nReaction_; label nReaction_;
//- List of reaction rate per specie [kg/m3/s] //- List of reaction rate per specie [kg/m3/s]
PtrList<scalarField> RR_; PtrList<DimensionedField<scalar, volMesh> > RR_;
// Protected Member Functions // Protected Member Functions
//- Write access to chemical source terms //- Write access to chemical source terms
// (e.g. for multi-chemistry model) // (e.g. for multi-chemistry model)
inline PtrList<scalarField>& RR(); inline PtrList<DimensionedField<scalar, volMesh> >& RR();
public: public:
@ -205,8 +206,11 @@ public:
// Chemistry model functions (overriding abstract functions in // Chemistry model functions (overriding abstract functions in
// basicChemistryModel.H) // basicChemistryModel.H)
//- Return const access to the chemical source terms //- Return const access to the chemical source terms for specie, i
inline tmp<volScalarField> RR(const label i) const; inline const DimensionedField<scalar, volMesh>& RR
(
const label i
) const;
//- Solve the reaction system for the given start time and time //- Solve the reaction system for the given start time and time
// step and return the characteristic time // step and return the characteristic time

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class ThermoType> template<class CompType, class ThermoType>
inline Foam::PtrList<Foam::scalarField>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODEChemistryModel<CompType, ThermoType>::RR() Foam::ODEChemistryModel<CompType, ThermoType>::RR()
{ {
return RR_; return RR_;
@ -69,36 +69,13 @@ Foam::ODEChemistryModel<CompType, ThermoType>::nReaction() const
template<class CompType, class ThermoType> template<class CompType, class ThermoType>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODEChemistryModel<CompType, ThermoType>::RR Foam::ODEChemistryModel<CompType, ThermoType>::RR
( (
const label i const label i
) const ) const
{ {
tmp<volScalarField> tRR return RR_[i];
(
new volScalarField
(
IOobject
(
"RR(" + this->Y_[i].name() + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRR().internalField() = RR_[i];
tRR().correctBoundaryConditions();
}
return tRR;
} }

View File

@ -38,11 +38,7 @@ namespace Foam
void Foam::basicChemistryModel::correct() void Foam::basicChemistryModel::correct()
{ {
if (mesh_.changing()) // do nothing
{
deltaTChem_.setSize(mesh_.nCells());
deltaTChem_ = deltaTChemIni_;
}
} }
@ -64,7 +60,19 @@ Foam::basicChemistryModel::basicChemistryModel(const fvMesh& mesh)
mesh_(mesh), mesh_(mesh),
chemistry_(lookup("chemistry")), chemistry_(lookup("chemistry")),
deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))), deltaTChemIni_(readScalar(lookup("initialChemicalTimeStep"))),
deltaTChem_(mesh.nCells(), deltaTChemIni_) deltaTChem_
(
IOobject
(
"deltaTChem",
mesh.time().constant(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("deltaTChem0", dimTime, deltaTChemIni_)
)
{} {}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -40,6 +40,8 @@ SourceFiles
#include "Switch.H" #include "Switch.H"
#include "scalarField.H" #include "scalarField.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "volMesh.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -80,14 +82,14 @@ protected:
const scalar deltaTChemIni_; const scalar deltaTChemIni_;
//- Latest estimation of integration step //- Latest estimation of integration step
scalarField deltaTChem_; DimensionedField<scalar, volMesh> deltaTChem_;
// Protected Member Functions // Protected Member Functions
//- Return non-const access to the latest estimation of integration //- Return non-const access to the latest estimation of integration
// step, e.g. for multi-chemistry model // step, e.g. for multi-chemistry model
scalarField& deltaTChem(); inline DimensionedField<scalar, volMesh>& deltaTChem();
//- Correct function - updates due to mesh changes //- Correct function - updates due to mesh changes
void correct(); void correct();
@ -118,7 +120,7 @@ public:
inline Switch chemistry() const; inline Switch chemistry() const;
//- Return the latest estimation of integration step //- Return the latest estimation of integration step
inline const scalarField& deltaTChem() const; inline const DimensionedField<scalar, volMesh>& deltaTChem() const;
// Functions to be derived in derived classes // Functions to be derived in derived classes
@ -126,7 +128,10 @@ public:
// Fields // Fields
//- Return const access to chemical source terms [kg/m3/s] //- Return const access to chemical source terms [kg/m3/s]
virtual tmp<volScalarField> RR(const label i) const = 0; virtual const DimensionedField<scalar, volMesh>& RR
(
const label i
) const = 0;
// Chemistry solution // Chemistry solution

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -37,13 +37,15 @@ inline Foam::Switch Foam::basicChemistryModel::chemistry() const
} }
inline const Foam::scalarField& Foam::basicChemistryModel::deltaTChem() const inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicChemistryModel::deltaTChem() const
{ {
return deltaTChem_; return deltaTChem_;
} }
inline Foam::scalarField& Foam::basicChemistryModel::deltaTChem() inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::basicChemistryModel::deltaTChem()
{ {
return deltaTChem_; return deltaTChem_;
} }

View File

@ -71,7 +71,19 @@ ODESolidChemistryModel
RRs_.set RRs_.set
( (
fieldI, fieldI,
new scalarField(mesh.nCells(), 0.0) new DimensionedField<scalar, volMesh>
(
IOobject
(
"RRs::" + Ys_[fieldI].name(),
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
); );
@ -134,7 +146,8 @@ ODESolidChemistryModel
Y0Default Y0Default
) )
); );
// Calculate inital values of Ysi0 = rho*delta*Yi
// Calculate inital values of Ysi0 = rho*delta*Yi
Ys0_[fieldI].internalField() = Ys0_[fieldI].internalField() =
this->solid().rho() this->solid().rho()
*max(Ys_[fieldI], scalar(0.001))*mesh.V(); *max(Ys_[fieldI], scalar(0.001))*mesh.V();
@ -143,7 +156,23 @@ ODESolidChemistryModel
forAll(RRg_, fieldI) forAll(RRg_, fieldI)
{ {
RRg_.set(fieldI, new scalarField(mesh.nCells(), 0.0)); RRg_.set
(
fieldI,
new DimensionedField<scalar, volMesh>
(
IOobject
(
"RRg::" + pyrolisisGases_[fieldI],
mesh.time().timeName(),
mesh,
IOobject::NO_READ,
IOobject::NO_WRITE
),
mesh,
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
)
);
} }
forAll(gasThermo_, gasI) forAll(gasThermo_, gasI)
@ -519,9 +548,12 @@ ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::nEqns() const
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>:: void Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::calculate()
calculate()
{ {
if (!this->chemistry_)
{
return;
}
const volScalarField rho const volScalarField rho
( (
@ -537,58 +569,43 @@ calculate()
this->solid().rho() this->solid().rho()
); );
if (this->mesh().changing())
{
forAll(RRs_, i)
{
RRs_[i].setSize(rho.size());
}
forAll(RRg_, i)
{
RRg_[i].setSize(rho.size());
}
}
forAll(RRs_, i) forAll(RRs_, i)
{ {
RRs_[i] = 0.0; RRs_[i].field() = 0.0;
} }
forAll(RRg_, i) forAll(RRg_, i)
{ {
RRg_[i] = 0.0; RRg_[i].field() = 0.0;
} }
if (this->chemistry_) forAll(rho, celli)
{ {
forAll(rho, celli) cellCounter_ = celli;
const scalar delta = this->mesh().V()[celli];
if (reactingCells_[celli])
{ {
cellCounter_ = celli; scalar rhoi = rho[celli];
scalar Ti = this->solid().T()[celli];
scalar pi = this->solid().p()[celli];
const scalar delta = this->mesh().V()[celli]; scalarField c(nSpecie_, 0.0);
for (label i=0; i<nSolids_; i++)
if (reactingCells_[celli])
{ {
scalar rhoi = rho[celli]; c[i] = rhoi*Ys_[i][celli]*delta;
scalar Ti = this->solid().T()[celli]; }
scalar pi = this->solid().p()[celli];
scalarField c(nSpecie_, 0.0); const scalarField dcdt = omega(c, Ti, pi, true);
for (label i=0; i<nSolids_; i++)
{
c[i] = rhoi*Ys_[i][celli]*delta;
}
const scalarField dcdt = omega(c, Ti, pi, true); forAll(RRs_, i)
{
RRs_[i][celli] = dcdt[i]/delta;
}
forAll(RRs_, i) forAll(RRg_, i)
{ {
RRs_[i][celli] = dcdt[i]/delta; RRg_[i][celli] = dcdt[nSolids_ + i]/delta;
}
forAll(RRg_, i)
{
RRg_[i][celli] = dcdt[nSolids_ + i]/delta;
}
} }
} }
} }
@ -603,6 +620,13 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
const scalar deltaT const scalar deltaT
) )
{ {
scalar deltaTMin = GREAT;
if (!this->chemistry_)
{
return deltaTMin;
}
const volScalarField rho const volScalarField rho
( (
IOobject IOobject
@ -617,33 +641,15 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
this->solid().rho() this->solid().rho()
); );
if (this->mesh().changing())
{
forAll(RRs_, i)
{
RRs_[i].setSize(rho.size());
}
forAll(RRg_, i)
{
RRg_[i].setSize(rho.size());
}
}
forAll(RRs_, i) forAll(RRs_, i)
{ {
RRs_[i] = 0.0; RRs_[i].field() = 0.0;
} }
forAll(RRg_, i) forAll(RRg_, i)
{ {
RRg_[i] = 0.0; RRg_[i].field() = 0.0;
} }
if (!this->chemistry_)
{
return GREAT;
}
scalar deltaTMin = GREAT;
forAll(rho, celli) forAll(rho, celli)
{ {
@ -798,7 +804,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::solve
"const scalar, " "const scalar, "
"const scalar, " "const scalar, "
"const scalar" "const scalar"
")" ") const"
); );
return (0); return (0);
} }

View File

@ -41,6 +41,7 @@ SourceFiles
#include "solidReaction.H" #include "solidReaction.H"
#include "ODE.H" #include "ODE.H"
#include "volFieldsFwd.H" #include "volFieldsFwd.H"
#include "DimensionedField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -96,19 +97,19 @@ protected:
label nReaction_; label nReaction_;
//- List of reaction rate per solid [kg/m3/s] //- List of reaction rate per solid [kg/m3/s]
PtrList<scalarField> RRs_; PtrList<DimensionedField<scalar, volMesh> > RRs_;
//- List of reaction rate per gas [kg/m3/s] //- List of reaction rate per gas [kg/m3/s]
PtrList<scalarField> RRg_; PtrList<DimensionedField<scalar, volMesh> > RRg_;
// Protected Member Functions // Protected Member Functions
//- Write access to source terms for solids //- Write access to source terms for solids
inline PtrList<scalarField>& RRs(); inline PtrList<DimensionedField<scalar, volMesh> >& RRs();
//- Write access to source terms for gases //- Write access to source terms for gases
inline PtrList<scalarField>& RRg(); inline PtrList<DimensionedField<scalar, volMesh> >& RRg();
private: private:
@ -203,19 +204,28 @@ public:
// Chemistry model functions // Chemistry model functions
//- Return const access to the chemical source terms for solids //- Return const access to the chemical source terms for solids
inline tmp<volScalarField> RRs(const label i) const; inline const DimensionedField<scalar, volMesh>& RRs
(
const label i
) const;
//- Return const access to the chemical source terms for gases //- Return const access to the chemical source terms for gases
inline tmp<volScalarField> RRg(const label i) const; inline const DimensionedField<scalar, volMesh>& RRg
(
const label i
) const;
//- Return total gas source term //- Return total gas source term
inline tmp<volScalarField> RRg() const; inline tmp<DimensionedField<scalar, volMesh> > RRg() const;
//- Return total solid source term //- Return total solid source term
inline tmp<volScalarField> RRs() const; inline tmp<DimensionedField<scalar, volMesh> > RRs() const;
//- Return const access to the total source terms //- Return const access to the total source terms
inline tmp<volScalarField> RR(const label i) const; inline const DimensionedField<scalar, volMesh>& RR
(
const label i
) const;
//- Return sensible enthalpy for gas i [J/Kg] //- Return sensible enthalpy for gas i [J/Kg]
virtual tmp<volScalarField> gasHs virtual tmp<volScalarField> gasHs

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 2011 OpenFOAM Foundation \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -29,7 +29,7 @@ License
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::PtrList<Foam::scalarField>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs()
{ {
return RRs_; return RRs_;
@ -37,7 +37,7 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs()
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::PtrList<Foam::scalarField>& inline Foam::PtrList<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg()
{ {
return RRg_; return RRg_;
@ -87,80 +87,34 @@ nReaction() const
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs
( (
const label i const label i
) const ) const
{ {
tmp<volScalarField> tRRs return RRs_[i];
(
new volScalarField
(
IOobject
(
"RRs(" + Ys_[i].name() + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRRs().internalField() = RRs_[i];
tRRs().correctBoundaryConditions();
}
return tRRs;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg
( (
const label i const label i
) const ) const
{ {
tmp<volScalarField> tRRg return RRg_[i];
(
new volScalarField
(
IOobject
(
"RRg(" + this->pyrolisisGases_[i] + ')',
this->time().timeName(),
this->mesh(),
IOobject::NO_READ,
IOobject::NO_WRITE
),
this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0),
zeroGradientFvPatchScalarField::typeName
)
);
if (this->chemistry_)
{
tRRg().internalField() = RRg_[i];
tRRg().correctBoundaryConditions();
}
return tRRg;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
{ {
tmp<volScalarField> tRRg tmp<DimensionedField<scalar, volMesh> > tRRg
( (
new volScalarField new DimensionedField<scalar, volMesh>
( (
IOobject IOobject
( (
@ -171,30 +125,29 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRg() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
zeroGradientFvPatchScalarField::typeName
) )
); );
if (this->chemistry_) if (this->chemistry_)
{ {
DimensionedField<scalar, volMesh>& RRg = tRRg();
for (label i=0; i < nGases_; i++) for (label i=0; i < nGases_; i++)
{ {
tRRg().internalField() += RRg_[i]; RRg += RRg_[i];
} }
tRRg().correctBoundaryConditions();
} }
return tRRg; return tRRg;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline Foam::tmp<Foam::DimensionedField<Foam::scalar, Foam::volMesh> >
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const
{ {
tmp<volScalarField> tRRs tmp<DimensionedField<scalar, volMesh> > tRRs
( (
new volScalarField new DimensionedField<scalar, volMesh>
( (
IOobject IOobject
( (
@ -205,32 +158,31 @@ Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RRs() const
IOobject::NO_WRITE IOobject::NO_WRITE
), ),
this->mesh(), this->mesh(),
dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0), dimensionedScalar("zero", dimMass/dimVolume/dimTime, 0.0)
zeroGradientFvPatchScalarField::typeName
) )
); );
if (this->chemistry_) if (this->chemistry_)
{ {
DimensionedField<scalar, volMesh>& RRs = tRRs();
for (label i=0; i < nSolids_; i++) for (label i=0; i < nSolids_; i++)
{ {
tRRs().internalField() += RRs_[i]; RRs += RRs_[i];
} }
tRRs().correctBoundaryConditions();
} }
return tRRs; return tRRs;
} }
template<class CompType, class SolidThermo, class GasThermo> template<class CompType, class SolidThermo, class GasThermo>
inline Foam::tmp<Foam::volScalarField> inline const Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RR Foam::ODESolidChemistryModel<CompType, SolidThermo, GasThermo>::RR
( (
const label i const label i
) const ) const
{ {
notImplemented("ODESolidChemistryModel::RR(const label)"); notImplemented("ODESolidChemistryModel::RR(const label)");
return (Foam::volScalarField::null()); return (DimensionedField<scalar, volMesh>::null());
} }

View File

@ -124,16 +124,22 @@ public:
inline const solidReactionThermo& solid() const; inline const solidReactionThermo& solid() const;
//- Return total gases mass source term [kg/m3/s] //- Return total gases mass source term [kg/m3/s]
virtual tmp<volScalarField> RRg() const = 0; virtual tmp<DimensionedField<scalar, volMesh> > RRg() const = 0;
//- Return total solids mass source term [kg/m3/s] //- Return total solids mass source term [kg/m3/s]
virtual tmp<volScalarField> RRs() const = 0; virtual tmp<DimensionedField<scalar, volMesh> > RRs() const = 0;
//- Return chemical source terms for solids [kg/m3/s] //- Return chemical source terms for solids [kg/m3/s]
virtual tmp<volScalarField> RRs(const label i) const = 0; virtual const DimensionedField<scalar, volMesh>& RRs
(
const label i
) const = 0;
//- Return chemical source terms for gases [kg/m3/s] //- Return chemical source terms for gases [kg/m3/s]
virtual tmp<volScalarField> RRg(const label i) const = 0; virtual const DimensionedField<scalar, volMesh>& RRg
(
const label i
) const = 0;
//- Return sensible enthalpy for gas i [J/Kg] //- Return sensible enthalpy for gas i [J/Kg]
virtual tmp<volScalarField> gasHs virtual tmp<volScalarField> gasHs

View File

@ -11,10 +11,10 @@ gnuplot<<EOF
set xlabel "Time / [s]" font "Helvetica,24" set xlabel "Time / [s]" font "Helvetica,24"
set ylabel "Temperature / [K]" font "Helvetica,24" set ylabel "Temperature / [K]" font "Helvetica,24"
set grid set grid
set key left top set key left top
set xrange [0:0.001] set xrange [0:0.001]
set yrange [750:2750] set yrange [750:2750]
set ytics 250 set ytics 250
plot \ plot \
"../chemFoam.out" u 1:2 t "OpenFOAM" with points lt 1 pt 6 ps 1.5,\ "../chemFoam.out" u 1:2 t "OpenFOAM" with points lt 1 pt 6 ps 1.5,\
"chemkinII" with lines title "Chemkin II" lt -1 "chemkinII" with lines title "Chemkin II" lt -1

View File

@ -53,13 +53,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -23,7 +23,8 @@ active true;
infinitelyFastChemistryCoeffs infinitelyFastChemistryCoeffs
{ {
C 5.0; semiImplicit no;
C 5.0;
} }
FSDCoeffs FSDCoeffs

View File

@ -53,13 +53,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -22,6 +22,7 @@ active on;
infinitelyFastChemistryCoeffs infinitelyFastChemistryCoeffs
{ {
semiImplicit no;
C 5.0; C 5.0;
} }

View File

@ -53,13 +53,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -60,13 +60,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 350; T0 350;
Cp0 4100; Cp0 4100;

View File

@ -54,13 +54,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -53,10 +53,6 @@ constantProperties
{ {
parcelTypeId 2; parcelTypeId 2;
rhoMin 1e-15;
TMin 200;
minParticleMass 1e-15;
rho0 2500; rho0 2500;
T0 300; T0 300;
Cp0 900; Cp0 900;

View File

@ -45,11 +45,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
minParticleMass 1e-15;
rho0 964; rho0 964;
youngsModulus 6e8; youngsModulus 6e8;
poissonsRatio 0.35; poissonsRatio 0.35;

View File

@ -37,11 +37,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
minParticleMass 1e-15;
rho0 964; rho0 964;
youngsModulus 6e8; youngsModulus 6e8;
poissonsRatio 0.35; poissonsRatio 0.35;

View File

@ -54,13 +54,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4100; Cp0 4100;

View File

@ -54,13 +54,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 350; T0 350;
Cp0 4100; Cp0 4100;

View File

@ -54,13 +54,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 350; T0 350;
Cp0 4100; Cp0 4100;

View File

@ -53,13 +53,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -53,13 +53,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -53,13 +53,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -54,13 +54,6 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
rho0 1000; rho0 1000;
T0 300; T0 300;
Cp0 4187; Cp0 4187;

View File

@ -54,16 +54,9 @@ solution
constantProperties constantProperties
{ {
parcelTypeId 1;
rhoMin 1e-15;
TMin 200;
pMin 1000;
minParticleMass 1e-15;
T0 320; T0 320;
// place holders for rho0 and T0 - reset from liquid props using T0 // place holders for rho0 and Cp0 - reset from liquid props using T0
rho0 1000; rho0 1000;
Cp0 4187; Cp0 4187;

View File

@ -151,7 +151,7 @@ motionControl
{ {
priority 1; priority 1;
mode bothSides; mode bothSides;
surfaceCellSizeFunction uniformValue; surfaceCellSizeFunction uniformValue;
uniformValueCoeffs uniformValueCoeffs
{ {

View File

@ -139,7 +139,7 @@ surfaceConformation
// conformation, initial protrusion tests. // conformation, initial protrusion tests.
surfacePtReplaceDistCoeff 0.5; surfacePtReplaceDistCoeff 0.5;
surfacePtExclusionDistanceCoeff 0.5; surfacePtExclusionDistanceCoeff 0.5;
} }

View File

@ -1,12 +1,12 @@
#!/bin/sh #!/bin/sh
cd ${0%/*} || exit 1 # run from this directory cd ${0%/*} || exit 1 # run from this directory
( (
cd flange || exit cd flange || exit
./Allrun ./Allrun
) )
exit 0 exit 0
# These cases are links to solver test cases and are run when the Allrun # These cases are links to solver test cases and are run when the Allrun