mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
Merge branch 'master' of /home/dm4/OpenFOAM/OpenFOAM-dev
This commit is contained in:
@ -112,7 +112,13 @@ public:
|
||||
|
||||
tmp<volScalarField> nu() const
|
||||
{
|
||||
return thermo_->mu()/thermo_->rho();
|
||||
return thermo_->nu();
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return thermo_->nu(patchi);
|
||||
}
|
||||
|
||||
tmp<volScalarField> kappa() const
|
||||
|
||||
@ -50,6 +50,18 @@ Foam::threePhaseMixture::threePhaseMixture
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
|
||||
transportModel(U, phi),
|
||||
|
||||
phase1Name_("phase1"),
|
||||
|
||||
@ -35,6 +35,7 @@ SourceFiles
|
||||
#define threePhaseMixture_H
|
||||
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "incompressible/viscosityModels/viscosityModel/viscosityModel.H"
|
||||
#include "dimensionedScalar.H"
|
||||
#include "volFields.H"
|
||||
@ -50,6 +51,7 @@ namespace Foam
|
||||
|
||||
class threePhaseMixture
|
||||
:
|
||||
public IOdictionary,
|
||||
public transportModel
|
||||
{
|
||||
// Private data
|
||||
@ -158,6 +160,12 @@ public:
|
||||
return U_;
|
||||
}
|
||||
|
||||
//- Return the flux
|
||||
const surfaceScalarField& phi() const
|
||||
{
|
||||
return phi_;
|
||||
}
|
||||
|
||||
//- Return the dynamic laminar viscosity
|
||||
tmp<volScalarField> mu() const;
|
||||
|
||||
@ -170,6 +178,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Return the face-interpolated dynamic laminar viscosity
|
||||
tmp<surfaceScalarField> nuf() const;
|
||||
|
||||
|
||||
@ -371,6 +371,18 @@ Foam::multiphaseSystem::multiphaseSystem
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
|
||||
transportModel(U, phi),
|
||||
|
||||
phases_(lookup("phases"), phaseModel::iNew(U.mesh())),
|
||||
@ -482,18 +494,54 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::rho() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::multiphaseSystem::rho(const label patchi) const
|
||||
{
|
||||
PtrDictionary<phaseModel>::const_iterator iter = phases_.begin();
|
||||
|
||||
tmp<scalarField> trho = iter().boundaryField()[patchi]*iter().rho().value();
|
||||
|
||||
for (++iter; iter != phases_.end(); ++iter)
|
||||
{
|
||||
trho() += iter().boundaryField()[patchi]*iter().rho().value();
|
||||
}
|
||||
|
||||
return trho;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::multiphaseSystem::nu() const
|
||||
{
|
||||
PtrDictionary<phaseModel>::const_iterator iter = phases_.begin();
|
||||
|
||||
tmp<volScalarField> tnu = iter()*iter().nu();
|
||||
tmp<volScalarField> tmu = iter()*(iter().rho()*iter().nu());
|
||||
|
||||
for (++iter; iter != phases_.end(); ++iter)
|
||||
{
|
||||
tnu() += iter()*iter().nu();
|
||||
tmu() += iter()*(iter().rho()*iter().nu());
|
||||
}
|
||||
|
||||
return tnu;
|
||||
return tmu/rho();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::multiphaseSystem::nu(const label patchi) const
|
||||
{
|
||||
PtrDictionary<phaseModel>::const_iterator iter = phases_.begin();
|
||||
|
||||
tmp<scalarField> tmu =
|
||||
iter().boundaryField()[patchi]
|
||||
*(iter().rho().value()*iter().nu().value());
|
||||
|
||||
for (++iter; iter != phases_.end(); ++iter)
|
||||
{
|
||||
tmu() +=
|
||||
iter().boundaryField()[patchi]
|
||||
*(iter().rho().value()*iter().nu().value());
|
||||
}
|
||||
|
||||
return tmu/rho(patchi);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#define multiphaseSystem_H
|
||||
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "phaseModel.H"
|
||||
#include "PtrDictionary.H"
|
||||
#include "volFields.H"
|
||||
@ -61,6 +62,7 @@ namespace Foam
|
||||
|
||||
class multiphaseSystem
|
||||
:
|
||||
public IOdictionary,
|
||||
public transportModel
|
||||
{
|
||||
|
||||
@ -255,9 +257,15 @@ public:
|
||||
//- Return the mixture density
|
||||
tmp<volScalarField> rho() const;
|
||||
|
||||
//- Return the mixture density for patch
|
||||
tmp<scalarField> rho(const label patchi) const;
|
||||
|
||||
//- Return the mixture laminar viscosity
|
||||
tmp<volScalarField> nu() const;
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const;
|
||||
|
||||
//- Return the virtual-mass coefficient for the given phase
|
||||
tmp<volScalarField> Cvm(const phaseModel& phase) const;
|
||||
|
||||
|
||||
@ -65,6 +65,18 @@ Foam::multiphaseMixture::multiphaseMixture
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
|
||||
transportModel(U, phi),
|
||||
phases_(lookup("phases"), phase::iNew(U, phi)),
|
||||
|
||||
@ -116,7 +128,8 @@ Foam::multiphaseMixture::multiphaseMixture
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::rho() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::multiphaseMixture::rho() const
|
||||
{
|
||||
PtrDictionary<phase>::const_iterator iter = phases_.begin();
|
||||
|
||||
@ -131,7 +144,24 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::rho() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::mu() const
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::multiphaseMixture::rho(const label patchi) const
|
||||
{
|
||||
PtrDictionary<phase>::const_iterator iter = phases_.begin();
|
||||
|
||||
tmp<scalarField> trho = iter().boundaryField()[patchi]*iter().rho().value();
|
||||
|
||||
for (++iter; iter != phases_.end(); ++iter)
|
||||
{
|
||||
trho() += iter().boundaryField()[patchi]*iter().rho().value();
|
||||
}
|
||||
|
||||
return trho;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::multiphaseMixture::mu() const
|
||||
{
|
||||
PtrDictionary<phase>::const_iterator iter = phases_.begin();
|
||||
|
||||
@ -146,7 +176,30 @@ Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::mu() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::muf() const
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::multiphaseMixture::mu(const label patchi) const
|
||||
{
|
||||
PtrDictionary<phase>::const_iterator iter = phases_.begin();
|
||||
|
||||
tmp<scalarField> tmu =
|
||||
iter().boundaryField()[patchi]
|
||||
*iter().rho().value()
|
||||
*iter().nu(patchi);
|
||||
|
||||
for (++iter; iter != phases_.end(); ++iter)
|
||||
{
|
||||
tmu() +=
|
||||
iter().boundaryField()[patchi]
|
||||
*iter().rho().value()
|
||||
*iter().nu(patchi);
|
||||
}
|
||||
|
||||
return tmu;
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::multiphaseMixture::muf() const
|
||||
{
|
||||
PtrDictionary<phase>::const_iterator iter = phases_.begin();
|
||||
|
||||
@ -163,13 +216,22 @@ Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::muf() const
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::multiphaseMixture::nu() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::multiphaseMixture::nu() const
|
||||
{
|
||||
return mu()/rho();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField> Foam::multiphaseMixture::nuf() const
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::multiphaseMixture::nu(const label patchi) const
|
||||
{
|
||||
return mu(patchi)/rho(patchi);
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::surfaceScalarField>
|
||||
Foam::multiphaseMixture::nuf() const
|
||||
{
|
||||
return muf()/fvc::interpolate(rho());
|
||||
}
|
||||
|
||||
@ -43,12 +43,12 @@ SourceFiles
|
||||
#define multiphaseMixture_H
|
||||
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "phase.H"
|
||||
#include "PtrDictionary.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -60,6 +60,7 @@ namespace Foam
|
||||
|
||||
class multiphaseMixture
|
||||
:
|
||||
public IOdictionary,
|
||||
public transportModel
|
||||
{
|
||||
public:
|
||||
@ -229,15 +230,24 @@ public:
|
||||
//- Return the mixture density
|
||||
tmp<volScalarField> rho() const;
|
||||
|
||||
//- Return the mixture density for patch
|
||||
tmp<scalarField> rho(const label patchi) const;
|
||||
|
||||
//- Return the dynamic laminar viscosity
|
||||
tmp<volScalarField> mu() const;
|
||||
|
||||
//- Return the dynamic laminar viscosity for patch
|
||||
tmp<scalarField> mu(const label patchi) const;
|
||||
|
||||
//- Return the face-interpolated dynamic laminar viscosity
|
||||
tmp<surfaceScalarField> muf() const;
|
||||
|
||||
//- Return the kinematic laminar viscosity
|
||||
tmp<volScalarField> nu() const;
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const;
|
||||
|
||||
//- Return the face-interpolated dynamic laminar viscosity
|
||||
tmp<surfaceScalarField> nuf() const;
|
||||
|
||||
|
||||
@ -129,6 +129,12 @@ public:
|
||||
return nuModel_->nu();
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nuModel_->nu(patchi);
|
||||
}
|
||||
|
||||
//- Return const-access to phase1 density
|
||||
const dimensionedScalar& rho() const
|
||||
{
|
||||
|
||||
@ -1,18 +0,0 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake blockMesh
|
||||
wmake all extrude
|
||||
|
||||
extrude2DMesh/Allwmake
|
||||
|
||||
wmake snappyHexMesh
|
||||
|
||||
if [ -d "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
foamyHexMesh/Allwmake
|
||||
foamyQuadMesh/Allwmake
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
@ -2,10 +2,13 @@
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake libso conformalVoronoiMesh
|
||||
wmake
|
||||
#wmake cvMeshBackgroundMesh
|
||||
#(cd cvMeshSurfaceSimplify && ./Allwmake)
|
||||
#wmake cellSizeAndAlignmentGrid
|
||||
if [ -d "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
wmake libso conformalVoronoiMesh
|
||||
wmake
|
||||
#wmake cvMeshBackgroundMesh
|
||||
#(cd cvMeshSurfaceSimplify && ./Allwmake)
|
||||
#wmake cellSizeAndAlignmentGrid
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -2,7 +2,10 @@
|
||||
cd ${0%/*} || exit 1 # run from this directory
|
||||
set -x
|
||||
|
||||
wmake libso conformalVoronoi2DMesh
|
||||
wmake
|
||||
if [ -d "$CGAL_ARCH_PATH" ]
|
||||
then
|
||||
wmake libso conformalVoronoi2DMesh
|
||||
wmake
|
||||
fi
|
||||
|
||||
# ----------------------------------------------------------------- end-of-file
|
||||
|
||||
@ -56,17 +56,30 @@ Description
|
||||
#include "UnsortedMeshedSurface.H"
|
||||
#include "MeshedSurface.H"
|
||||
#include "globalIndex.H"
|
||||
#include "IOmanip.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Convert size (as fraction of defaultCellSize) to refinement level
|
||||
label sizeCoeffToRefinement
|
||||
(
|
||||
const scalar level0Coeff, // ratio of hex cell size v.s. defaultCellSize
|
||||
const scalar sizeCoeff
|
||||
)
|
||||
{
|
||||
return round(::log(level0Coeff/sizeCoeff)/::log(2));
|
||||
}
|
||||
|
||||
|
||||
autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
(
|
||||
const searchableSurfaces& allGeometry,
|
||||
const dictionary& surfacesDict,
|
||||
const dictionary& shapeControlDict,
|
||||
const label gapLevelIncrement
|
||||
const label gapLevelIncrement,
|
||||
const scalar level0Coeff
|
||||
)
|
||||
{
|
||||
autoPtr<refinementSurfaces> surfacePtr;
|
||||
@ -103,7 +116,6 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
labelList globalMinLevel(surfI, 0);
|
||||
labelList globalMaxLevel(surfI, 0);
|
||||
labelList globalLevelIncr(surfI, 0);
|
||||
scalarField globalAngle(surfI, -GREAT);
|
||||
PtrList<dictionary> globalPatchInfo(surfI);
|
||||
List<Map<label> > regionMinLevel(surfI);
|
||||
List<Map<label> > regionMaxLevel(surfI);
|
||||
@ -116,70 +128,39 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
{
|
||||
const word& geomName = allGeometry.names()[geomI];
|
||||
|
||||
|
||||
// Definition of surfaces to conform to
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (surfacesDict.found(geomName))
|
||||
{
|
||||
const dictionary& dict = surfacesDict.subDict(geomName);
|
||||
|
||||
names[surfI] = geomName;
|
||||
surfaces[surfI] = geomI;
|
||||
|
||||
const dictionary& shapeDict = shapeControlDict.subDict(geomName);
|
||||
|
||||
// Find the index in shapeControlDict
|
||||
// Invert surfaceCellSize to get the refinementLevel
|
||||
if (shapeControlDict.found(geomName))
|
||||
{
|
||||
const dictionary& shapeDict =
|
||||
shapeControlDict.subDict(geomName);
|
||||
|
||||
const word scsFuncName =
|
||||
shapeDict.lookup("surfaceCellSizeFunction");
|
||||
const dictionary& scsDict =
|
||||
shapeDict.subDict(scsFuncName + "Coeffs");
|
||||
const word scsFuncName =
|
||||
shapeDict.lookup("surfaceCellSizeFunction");
|
||||
const dictionary& scsDict =
|
||||
shapeDict.subDict(scsFuncName + "Coeffs");
|
||||
|
||||
const scalar surfaceCellSize =
|
||||
readScalar(scsDict.lookup("surfaceCellSizeCoeff"));
|
||||
const scalar surfaceCellSize =
|
||||
readScalar(scsDict.lookup("surfaceCellSizeCoeff"));
|
||||
|
||||
const label calculatedCellLevel =
|
||||
round(::log(1.0/surfaceCellSize)/::log(2));
|
||||
|
||||
globalMinLevel[surfI] = calculatedCellLevel;
|
||||
globalMaxLevel[surfI] = calculatedCellLevel;
|
||||
globalLevelIncr[surfI] = shapeDict.lookupOrDefault
|
||||
(
|
||||
"gapLevelIncrement",
|
||||
gapLevelIncrement
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"createRefinementSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary>&)"
|
||||
) << "Illegal level specification for surface "
|
||||
<< names[surfI]
|
||||
<< " not found in shapeControlDict"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if
|
||||
const label refLevel = sizeCoeffToRefinement
|
||||
(
|
||||
globalMinLevel[surfI] < 0
|
||||
|| globalMaxLevel[surfI] < globalMinLevel[surfI]
|
||||
|| globalLevelIncr[surfI] < 0
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"createRefinementSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary>&)"
|
||||
) << "Illegal level specification for surface "
|
||||
<< names[surfI]
|
||||
<< " : minLevel:" << globalMinLevel[surfI]
|
||||
<< " maxLevel:" << globalMaxLevel[surfI]
|
||||
<< " levelIncrement:" << globalLevelIncr[surfI]
|
||||
<< exit(FatalError);
|
||||
}
|
||||
level0Coeff,
|
||||
surfaceCellSize
|
||||
);
|
||||
|
||||
globalMinLevel[surfI] = refLevel;
|
||||
globalMaxLevel[surfI] = refLevel;
|
||||
globalLevelIncr[surfI] = gapLevelIncrement;
|
||||
|
||||
const dictionary& dict = surfacesDict.subDict(geomName);
|
||||
|
||||
// Global zone names per surface
|
||||
if (dict.readIfPresent("faceZone", faceZoneNames[surfI]))
|
||||
@ -264,7 +245,6 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Global perpendicular angle
|
||||
if (dict.found("patchInfo"))
|
||||
{
|
||||
@ -274,7 +254,9 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
dict.subDict("patchInfo").clone()
|
||||
);
|
||||
}
|
||||
dict.readIfPresent("perpendicularAngle", globalAngle[surfI]);
|
||||
|
||||
|
||||
// Per region override of patchInfo
|
||||
|
||||
if (dict.found("regions"))
|
||||
{
|
||||
@ -292,107 +274,6 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
regionNames[regionI]
|
||||
);
|
||||
|
||||
const dictionary& shapeDict =
|
||||
shapeControlDict.subDict(geomName);
|
||||
|
||||
const dictionary& shapeControlRegionsDict =
|
||||
shapeDict.subDict("regions");
|
||||
|
||||
if (shapeControlRegionsDict.found(regionNames[regionI]))
|
||||
{
|
||||
const dictionary& shapeControlRegionDict =
|
||||
shapeControlRegionsDict.subDict
|
||||
(
|
||||
regionNames[regionI]
|
||||
);
|
||||
|
||||
const word scsFuncName =
|
||||
shapeControlRegionDict.lookup
|
||||
(
|
||||
"surfaceCellSizeFunction"
|
||||
);
|
||||
const dictionary& scsDict =
|
||||
shapeControlRegionDict.subDict
|
||||
(
|
||||
scsFuncName + "Coeffs"
|
||||
);
|
||||
|
||||
const scalar surfaceCellSize =
|
||||
readScalar
|
||||
(
|
||||
scsDict.lookup("surfaceCellSizeCoeff")
|
||||
);
|
||||
|
||||
const label calculatedCellLevel =
|
||||
round
|
||||
(
|
||||
::log(1.0/surfaceCellSize)/::log(2)
|
||||
);
|
||||
|
||||
globalMinLevel[surfI] = calculatedCellLevel;
|
||||
globalMaxLevel[surfI] = calculatedCellLevel;
|
||||
globalLevelIncr[surfI] =
|
||||
shapeControlRegionDict.lookupOrDefault
|
||||
(
|
||||
"gapLevelIncrement",
|
||||
0
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"createRefinementSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary&)"
|
||||
) << "Illegal level specification for surface "
|
||||
<< regionNames[regionI]
|
||||
<< " not found in shapeControlDict"
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
const labelPair refLevel(regionDict.lookup("level"));
|
||||
|
||||
regionMinLevel[surfI].insert(regionI, refLevel[0]);
|
||||
regionMaxLevel[surfI].insert(regionI, refLevel[1]);
|
||||
label levelIncr = regionDict.lookupOrDefault
|
||||
(
|
||||
"gapLevelIncrement",
|
||||
gapLevelIncrement
|
||||
);
|
||||
regionLevelIncr[surfI].insert(regionI, levelIncr);
|
||||
|
||||
if
|
||||
(
|
||||
refLevel[0] < 0
|
||||
|| refLevel[1] < refLevel[0]
|
||||
|| levelIncr < 0
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"createRefinementSurfaces"
|
||||
"(const searchableSurfaces&, const dictionary&)"
|
||||
) << "Illegal level specification for surface "
|
||||
<< names[surfI] << " region "
|
||||
<< regionNames[regionI]
|
||||
<< " : minLevel:" << refLevel[0]
|
||||
<< " maxLevel:" << refLevel[1]
|
||||
<< " levelIncrement:" << levelIncr
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
if (regionDict.found("perpendicularAngle"))
|
||||
{
|
||||
regionAngle[surfI].insert
|
||||
(
|
||||
regionI,
|
||||
readScalar
|
||||
(
|
||||
regionDict.lookup("perpendicularAngle")
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
if (regionDict.found("patchInfo"))
|
||||
{
|
||||
regionPatchInfo[surfI].insert
|
||||
@ -404,6 +285,54 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Per region override of cellSize
|
||||
if (shapeDict.found("regions"))
|
||||
{
|
||||
const dictionary& shapeControlRegionsDict =
|
||||
shapeDict.subDict("regions");
|
||||
const wordList& regionNames =
|
||||
allGeometry[surfaces[surfI]].regions();
|
||||
|
||||
forAll(regionNames, regionI)
|
||||
{
|
||||
if (shapeControlRegionsDict.found(regionNames[regionI]))
|
||||
{
|
||||
const dictionary& shapeControlRegionDict =
|
||||
shapeControlRegionsDict.subDict
|
||||
(
|
||||
regionNames[regionI]
|
||||
);
|
||||
|
||||
const word scsFuncName =
|
||||
shapeControlRegionDict.lookup
|
||||
(
|
||||
"surfaceCellSizeFunction"
|
||||
);
|
||||
const dictionary& scsDict =
|
||||
shapeControlRegionDict.subDict
|
||||
(
|
||||
scsFuncName + "Coeffs"
|
||||
);
|
||||
|
||||
const scalar surfaceCellSize =
|
||||
readScalar
|
||||
(
|
||||
scsDict.lookup("surfaceCellSizeCoeff")
|
||||
);
|
||||
|
||||
const label refLevel = sizeCoeffToRefinement
|
||||
(
|
||||
level0Coeff,
|
||||
surfaceCellSize
|
||||
);
|
||||
|
||||
regionMinLevel[surfI].insert(regionI, refLevel);
|
||||
regionMaxLevel[surfI].insert(regionI, refLevel);
|
||||
regionLevelIncr[surfI].insert(regionI, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
surfI++;
|
||||
}
|
||||
}
|
||||
@ -421,7 +350,6 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
labelList minLevel(nRegions, 0);
|
||||
labelList maxLevel(nRegions, 0);
|
||||
labelList gapLevel(nRegions, -1);
|
||||
scalarField perpendicularAngle(nRegions, -GREAT);
|
||||
PtrList<dictionary> patchInfo(nRegions);
|
||||
|
||||
forAll(globalMinLevel, surfI)
|
||||
@ -438,7 +366,6 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
maxLevel[globalRegionI]
|
||||
+ globalLevelIncr[surfI];
|
||||
|
||||
perpendicularAngle[globalRegionI] = globalAngle[surfI];
|
||||
if (globalPatchInfo.set(surfI))
|
||||
{
|
||||
patchInfo.set
|
||||
@ -460,18 +387,11 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
maxLevel[globalRegionI]
|
||||
+ regionLevelIncr[surfI][iter.key()];
|
||||
}
|
||||
forAllConstIter(Map<scalar>, regionAngle[surfI], iter)
|
||||
{
|
||||
label globalRegionI = regionOffset[surfI] + iter.key();
|
||||
|
||||
perpendicularAngle[globalRegionI] = regionAngle[surfI][iter.key()];
|
||||
}
|
||||
|
||||
const Map<autoPtr<dictionary> >& localInfo = regionPatchInfo[surfI];
|
||||
forAllConstIter(Map<autoPtr<dictionary> >, localInfo, iter)
|
||||
{
|
||||
label globalRegionI = regionOffset[surfI] + iter.key();
|
||||
|
||||
patchInfo.set(globalRegionI, iter()().clone());
|
||||
}
|
||||
}
|
||||
@ -492,11 +412,43 @@ autoPtr<refinementSurfaces> createRefinementSurfaces
|
||||
minLevel,
|
||||
maxLevel,
|
||||
gapLevel,
|
||||
perpendicularAngle,
|
||||
scalarField(nRegions, -GREAT), //perpendicularAngle,
|
||||
patchInfo
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
const refinementSurfaces& rf = surfacePtr();
|
||||
|
||||
Info<< setw(20) << "Region"
|
||||
<< setw(10) << "Min Level"
|
||||
<< setw(10) << "Max Level"
|
||||
<< setw(10) << "Gap Level" << nl
|
||||
<< setw(20) << "------"
|
||||
<< setw(10) << "---------"
|
||||
<< setw(10) << "---------"
|
||||
<< setw(10) << "---------" << endl;
|
||||
|
||||
forAll(rf.surfaces(), surfI)
|
||||
{
|
||||
label geomI = rf.surfaces()[surfI];
|
||||
|
||||
Info<< rf.names()[surfI] << ':' << nl;
|
||||
|
||||
const wordList& regionNames = allGeometry.regionNames()[geomI];
|
||||
|
||||
forAll(regionNames, regionI)
|
||||
{
|
||||
label globalI = rf.globalRegion(surfI, regionI);
|
||||
|
||||
Info<< setw(20) << regionNames[regionI]
|
||||
<< setw(10) << rf.minLevel()[globalI]
|
||||
<< setw(10) << rf.maxLevel()[globalI]
|
||||
<< setw(10) << rf.gapLevel()[globalI] << endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return surfacePtr;
|
||||
}
|
||||
|
||||
@ -703,6 +655,7 @@ void writeMesh
|
||||
(
|
||||
const string& msg,
|
||||
const meshRefinement& meshRefiner,
|
||||
const bool writeLevel,
|
||||
const label debug
|
||||
)
|
||||
{
|
||||
@ -711,21 +664,21 @@ void writeMesh
|
||||
meshRefiner.printMeshInfo(debug, msg);
|
||||
Info<< "Writing mesh to time " << meshRefiner.timeName() << endl;
|
||||
|
||||
meshRefiner.write(meshRefinement::MESH|meshRefinement::SCALARLEVELS, "");
|
||||
label flag = meshRefinement::MESH;
|
||||
if (writeLevel)
|
||||
{
|
||||
flag |= meshRefinement::SCALARLEVELS;
|
||||
}
|
||||
if (debug & meshRefinement::OBJINTERSECTIONS)
|
||||
{
|
||||
meshRefiner.write
|
||||
(
|
||||
meshRefinement::OBJINTERSECTIONS,
|
||||
mesh.time().path()/meshRefiner.timeName()
|
||||
);
|
||||
flag |= meshRefinement::OBJINTERSECTIONS;
|
||||
}
|
||||
meshRefiner.write(flag, mesh.time().path()/meshRefiner.timeName());
|
||||
Info<< "Wrote mesh in = "
|
||||
<< mesh.time().cpuTimeIncrement() << " s." << endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
# include "addOverwriteOption.H"
|
||||
@ -740,20 +693,24 @@ int main(int argc, char *argv[])
|
||||
"boundBox",
|
||||
"simplify the surface using snappyHexMesh starting from a boundBox"
|
||||
);
|
||||
|
||||
Foam::argList::addBoolOption
|
||||
(
|
||||
"writeLevel",
|
||||
"write pointLevel and cellLevel postprocessing files"
|
||||
);
|
||||
Foam::argList::addOption
|
||||
(
|
||||
"patches",
|
||||
"(patch0 .. patchN)",
|
||||
"only triangulate selected patches (wildcards supported)"
|
||||
);
|
||||
|
||||
Foam::argList::addOption
|
||||
(
|
||||
"outFile",
|
||||
"fileName",
|
||||
"name of the file to save the simplified surface to"
|
||||
);
|
||||
# include "addDictOption.H"
|
||||
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
@ -762,6 +719,7 @@ int main(int argc, char *argv[])
|
||||
const bool overwrite = args.optionFound("overwrite");
|
||||
const bool checkGeometry = args.optionFound("checkGeometry");
|
||||
const bool surfaceSimplify = args.optionFound("surfaceSimplify");
|
||||
const bool writeLevel = args.optionFound("writeLevel");
|
||||
|
||||
autoPtr<fvMesh> meshPtr;
|
||||
|
||||
@ -901,17 +859,10 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
// Read meshing dictionary
|
||||
IOdictionary meshDict
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"snappyHexMeshDict",
|
||||
runTime.system(),
|
||||
mesh,
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
const word dictName("snappyHexMeshDict");
|
||||
#include "setSystemMeshDictionaryIO.H"
|
||||
const IOdictionary meshDict(dictIO);
|
||||
|
||||
|
||||
// all surface geometry
|
||||
const dictionary& geometryDict = meshDict.subDict("geometry");
|
||||
@ -1021,11 +972,22 @@ int main(int argc, char *argv[])
|
||||
"geometryToConformTo"
|
||||
);
|
||||
|
||||
const dictionary& motionDict =
|
||||
foamyHexMeshDict.subDict("motionControl");
|
||||
|
||||
const dictionary& shapeControlDict =
|
||||
foamyHexMeshDict.subDict("motionControl").subDict
|
||||
(
|
||||
"shapeControlFunctions"
|
||||
);
|
||||
motionDict.subDict("shapeControlFunctions");
|
||||
|
||||
// Calculate current ratio of hex cells v.s. wanted cell size
|
||||
const scalar defaultCellSize =
|
||||
readScalar(motionDict.lookup("defaultCellSize"));
|
||||
|
||||
const scalar initialCellSize = ::pow(meshPtr().V()[0], 1.0/3.0);
|
||||
|
||||
//Info<< "Wanted cell size = " << defaultCellSize << endl;
|
||||
//Info<< "Current cell size = " << initialCellSize << endl;
|
||||
//Info<< "Fraction = " << initialCellSize/defaultCellSize
|
||||
// << endl;
|
||||
|
||||
surfacesPtr =
|
||||
createRefinementSurfaces
|
||||
@ -1033,7 +995,8 @@ int main(int argc, char *argv[])
|
||||
allGeometry,
|
||||
conformationDict,
|
||||
shapeControlDict,
|
||||
refineDict.lookupOrDefault("gapLevelIncrement", 0)
|
||||
refineDict.lookupOrDefault("gapLevelIncrement", 0),
|
||||
initialCellSize/defaultCellSize
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -1187,9 +1150,12 @@ int main(int argc, char *argv[])
|
||||
globalToMasterPatch.setSize(surfaces.nRegions(), -1);
|
||||
globalToSlavePatch.setSize(surfaces.nRegions(), -1);
|
||||
|
||||
Info<< "Patch\tType\tRegion" << nl
|
||||
<< "-----\t----\t------"
|
||||
<< endl;
|
||||
Info<< setw(8) << "Patch"
|
||||
<< setw(30) << "Type"
|
||||
<< setw(30) << "Region" << nl
|
||||
<< setw(8) << "-----"
|
||||
<< setw(30) << "----"
|
||||
<< setw(30) << "------" << endl;
|
||||
|
||||
const labelList& surfaceGeometry = surfaces.surfaces();
|
||||
const PtrList<dictionary>& surfacePatchInfo = surfaces.patchInfo();
|
||||
@ -1231,8 +1197,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
Info<< patchI << '\t' << mesh.boundaryMesh()[patchI].type()
|
||||
<< '\t' << regNames[i] << nl;
|
||||
Info<< setw(8) << patchI
|
||||
<< setw(30) << mesh.boundaryMesh()[patchI].type()
|
||||
<< setw(30) << regNames[i] << nl;
|
||||
|
||||
globalToMasterPatch[globalRegionI] = patchI;
|
||||
globalToSlavePatch[globalRegionI] = patchI;
|
||||
@ -1269,9 +1236,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
Info<< patchI << '\t'
|
||||
<< mesh.boundaryMesh()[patchI].type()
|
||||
<< '\t' << regNames[i] << nl;
|
||||
Info<< setw(8) << patchI
|
||||
<< setw(30) << mesh.boundaryMesh()[patchI].type()
|
||||
<< setw(30) << regNames[i] << nl;
|
||||
|
||||
globalToMasterPatch[globalRegionI] = patchI;
|
||||
}
|
||||
@ -1300,9 +1267,9 @@ int main(int argc, char *argv[])
|
||||
);
|
||||
}
|
||||
|
||||
Info<< patchI << '\t'
|
||||
<< mesh.boundaryMesh()[patchI].type()
|
||||
<< '\t' << slaveName << nl;
|
||||
Info<< setw(8) << patchI
|
||||
<< setw(30) << mesh.boundaryMesh()[patchI].type()
|
||||
<< setw(30) << slaveName << nl;
|
||||
|
||||
globalToSlavePatch[globalRegionI] = patchI;
|
||||
}
|
||||
@ -1392,6 +1359,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"Refined mesh",
|
||||
meshRefiner,
|
||||
writeLevel,
|
||||
debug
|
||||
);
|
||||
|
||||
@ -1424,6 +1392,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"Snapped mesh",
|
||||
meshRefiner,
|
||||
writeLevel,
|
||||
debug
|
||||
);
|
||||
|
||||
@ -1472,6 +1441,7 @@ int main(int argc, char *argv[])
|
||||
(
|
||||
"Layer mesh",
|
||||
meshRefiner,
|
||||
writeLevel,
|
||||
debug
|
||||
);
|
||||
|
||||
|
||||
@ -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
|
||||
@ -55,14 +55,14 @@ class labelBits
|
||||
|
||||
label data_;
|
||||
|
||||
inline static label pack(const label val, const direction bits)
|
||||
inline static label pack(const uLabel val, const direction bits)
|
||||
{
|
||||
# ifdef FULLDEBUG
|
||||
if (bits > 7 || (((val<<3)>>3) != val))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"labelBits::pack(const label, const direction)"
|
||||
"labelBits::pack(const uLabel, const direction)"
|
||||
) << "Direction " << bits << " outside range 0..7"
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -55,8 +55,19 @@ buoyantPressureFvPatchScalarField
|
||||
fixedGradientFvPatchScalarField(p, iF),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
if (dict.found("value") && dict.found("gradient"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
}
|
||||
else
|
||||
{
|
||||
fvPatchField<scalar>::operator=(patchInternalField());
|
||||
gradient() = 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -77,11 +77,13 @@ Foam::fixedFluxPressureFvPatchScalarField::fixedFluxPressureFvPatchScalarField
|
||||
DpName_(dict.lookupOrDefault<word>("Dp", "Dp")),
|
||||
adjoint_(dict.lookupOrDefault<Switch>("adjoint", false))
|
||||
{
|
||||
if (dict.found("gradient"))
|
||||
if (dict.found("value") && dict.found("gradient"))
|
||||
{
|
||||
fvPatchField<scalar>::operator=
|
||||
(
|
||||
scalarField("value", dict, p.size())
|
||||
);
|
||||
gradient() = scalarField("gradient", dict, p.size());
|
||||
fixedGradientFvPatchScalarField::updateCoeffs();
|
||||
fixedGradientFvPatchScalarField::evaluate();
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -190,7 +192,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::updateCoeffs()
|
||||
|
||||
void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fvPatchScalarField::write(os);
|
||||
fixedGradientFvPatchScalarField::write(os);
|
||||
writeEntryIfDifferent<word>(os, "phiHbyA", "phiHbyA", phiHbyAName_);
|
||||
writeEntryIfDifferent<word>(os, "phi", "phi", phiName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
@ -199,7 +201,7 @@ void Foam::fixedFluxPressureFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
os.writeKeyword("adjoint") << adjoint_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
gradient().writeEntry("gradient", os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -102,6 +102,30 @@ ddt
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||
ddt
|
||||
(
|
||||
const one&,
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf
|
||||
)
|
||||
{
|
||||
return ddt(vf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> >
|
||||
ddt
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>& vf,
|
||||
const one&
|
||||
)
|
||||
{
|
||||
return ddt(vf);
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<typename flux<Type>::type, fvsPatchField, surfaceMesh> >
|
||||
ddtPhiCorr
|
||||
|
||||
@ -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
|
||||
@ -39,6 +39,8 @@ SourceFiles
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
#include "dimensionedTypes.H"
|
||||
#include "one.H"
|
||||
#include "geometricZeroField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -78,6 +80,29 @@ namespace fvc
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> > ddt
|
||||
(
|
||||
const one&,
|
||||
const GeometricField<Type, fvPatchField, volMesh>&
|
||||
);
|
||||
|
||||
template<class Type>
|
||||
tmp<GeometricField<Type, fvPatchField, volMesh> > ddt
|
||||
(
|
||||
const GeometricField<Type, fvPatchField, volMesh>&,
|
||||
const one&
|
||||
);
|
||||
|
||||
inline geometricZeroField ddt
|
||||
(
|
||||
const one&,
|
||||
const one&
|
||||
)
|
||||
{
|
||||
return geometricZeroField();
|
||||
}
|
||||
|
||||
template<class Type>
|
||||
tmp
|
||||
<
|
||||
|
||||
@ -481,7 +481,8 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
|
||||
const scalarField& srcMagSf,
|
||||
const scalarField& tgtMagSf,
|
||||
const faceAreaIntersect::triangulationMode& triMode,
|
||||
const bool reverseTarget
|
||||
const bool reverseTarget,
|
||||
const bool restartUncoveredSourceFace
|
||||
)
|
||||
:
|
||||
AMIMethod<SourcePatch, TargetPatch>
|
||||
@ -492,7 +493,8 @@ Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::faceAreaWeightAMI
|
||||
tgtMagSf,
|
||||
triMode,
|
||||
reverseTarget
|
||||
)
|
||||
),
|
||||
restartUncoveredSourceFace_(restartUncoveredSourceFace)
|
||||
{}
|
||||
|
||||
|
||||
@ -557,7 +559,7 @@ void Foam::faceAreaWeightAMI<SourcePatch, TargetPatch>::calculate
|
||||
|
||||
|
||||
// Check for badly covered faces
|
||||
if (debug)
|
||||
if (restartUncoveredSourceFace_)
|
||||
{
|
||||
restartUncoveredSourceFace
|
||||
(
|
||||
|
||||
@ -51,6 +51,13 @@ class faceAreaWeightAMI
|
||||
:
|
||||
public AMIMethod<SourcePatch, TargetPatch>
|
||||
{
|
||||
private:
|
||||
|
||||
// Private data
|
||||
|
||||
//- Flag to restart uncovered source faces
|
||||
const bool restartUncoveredSourceFace_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@ -136,7 +143,8 @@ public:
|
||||
const scalarField& srcMagSf,
|
||||
const scalarField& tgtMagSf,
|
||||
const faceAreaIntersect::triangulationMode& triMode,
|
||||
const bool reverseTarget = false
|
||||
const bool reverseTarget = false,
|
||||
const bool restartUncoveredSourceFace = true
|
||||
);
|
||||
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ License
|
||||
#include "fluidThermo.H"
|
||||
#include "incompressible/turbulenceModel/turbulenceModel.H"
|
||||
#include "compressible/turbulenceModel/turbulenceModel.H"
|
||||
#include "incompressible/singlePhaseTransportModel/singlePhaseTransportModel.H"
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
@ -94,12 +94,11 @@ Foam::tmp<Foam::volSymmTensorField> Foam::forces::devRhoReff() const
|
||||
}
|
||||
else if
|
||||
(
|
||||
obr_.foundObject<singlePhaseTransportModel>("transportProperties")
|
||||
obr_.foundObject<transportModel>("transportProperties")
|
||||
)
|
||||
{
|
||||
const singlePhaseTransportModel& laminarT =
|
||||
obr_.lookupObject<singlePhaseTransportModel>
|
||||
("transportProperties");
|
||||
const transportModel& laminarT =
|
||||
obr_.lookupObject<transportModel>("transportProperties");
|
||||
|
||||
const volVectorField& U = obr_.lookupObject<volVectorField>(UName_);
|
||||
|
||||
@ -138,12 +137,11 @@ Foam::tmp<Foam::volScalarField> Foam::forces::mu() const
|
||||
}
|
||||
else if
|
||||
(
|
||||
obr_.foundObject<singlePhaseTransportModel>("transportProperties")
|
||||
obr_.foundObject<transportModel>("transportProperties")
|
||||
)
|
||||
{
|
||||
const singlePhaseTransportModel& laminarT =
|
||||
obr_.lookupObject<singlePhaseTransportModel>
|
||||
("transportProperties");
|
||||
const transportModel& laminarT =
|
||||
obr_.lookupObject<transportModel>("transportProperties");
|
||||
|
||||
return rho()*laminarT.nu();
|
||||
}
|
||||
|
||||
@ -57,8 +57,10 @@ void reactingOneDim::readReactingOneDimControls()
|
||||
solution.lookup("nNonOrthCorr") >> nNonOrthCorr_;
|
||||
time().controlDict().lookup("maxDi") >> maxDiff_;
|
||||
|
||||
coeffs().lookup("radFluxName") >> primaryRadFluxName_;
|
||||
coeffs().lookup("minimumDelta") >> minimumDelta_;
|
||||
|
||||
coeffs().lookup("gasHSource") >> gasHSource_;
|
||||
coeffs().lookup("QrHSource") >> QrHSource_;
|
||||
}
|
||||
|
||||
|
||||
@ -90,6 +92,58 @@ bool reactingOneDim::read(const dictionary& dict)
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::updateQr()
|
||||
{
|
||||
// Update local Qr from coupled Qr field
|
||||
Qr_ == dimensionedScalar("zero", Qr_.dimensions(), 0.0);
|
||||
|
||||
// Retrieve field from coupled region using mapped boundary conditions
|
||||
Qr_.correctBoundaryConditions();
|
||||
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
|
||||
scalarField& Qrp = Qr_.boundaryField()[patchI];
|
||||
|
||||
// Qr is positive going in the solid
|
||||
// If the surface is emitting the radiative flux is set to zero
|
||||
Qrp = max(Qrp, scalar(0.0));
|
||||
}
|
||||
|
||||
const vectorField& cellC = regionMesh().cellCentres();
|
||||
|
||||
tmp<volScalarField> kappa = kappaRad();
|
||||
|
||||
// Propagate Qr through 1-D regions
|
||||
label localPyrolysisFaceI = 0;
|
||||
forAll(intCoupledPatchIDs_, i)
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
|
||||
const scalarField& Qrp = Qr_.boundaryField()[patchI];
|
||||
const vectorField& Cf = regionMesh().Cf().boundaryField()[patchI];
|
||||
|
||||
forAll(Qrp, faceI)
|
||||
{
|
||||
const scalar Qr0 = Qrp[faceI];
|
||||
point Cf0 = Cf[faceI];
|
||||
const labelList& cells = boundaryFaceCells_[localPyrolysisFaceI++];
|
||||
scalar kappaInt = 0.0;
|
||||
forAll(cells, k)
|
||||
{
|
||||
const label cellI = cells[k];
|
||||
const point& Cf1 = cellC[cellI];
|
||||
const scalar delta = mag(Cf1 - Cf0);
|
||||
kappaInt += kappa()[cellI]*delta;
|
||||
Qr_[cellI] = Qr0*exp(-kappaInt);
|
||||
Cf0 = Cf1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reactingOneDim::updatePhiGas()
|
||||
{
|
||||
phiHsGas_ == dimensionedScalar("zero", phiHsGas_.dimensions(), 0.0);
|
||||
@ -112,20 +166,21 @@ void reactingOneDim::updatePhiGas()
|
||||
{
|
||||
const label patchI = intCoupledPatchIDs_[i];
|
||||
|
||||
const scalarField& phiGasp = phiHsGas_.boundaryField()[patchI];
|
||||
scalarField& phiGasp = phiGas_.boundaryField()[patchI];
|
||||
const scalarField& cellVol = regionMesh().V();
|
||||
|
||||
forAll(phiGasp, faceI)
|
||||
{
|
||||
const labelList& cells = boundaryFaceCells_[totalFaceId];
|
||||
const labelList& cells = boundaryFaceCells_[totalFaceId++];
|
||||
scalar massInt = 0.0;
|
||||
forAllReverse(cells, k)
|
||||
{
|
||||
const label cellI = cells[k];
|
||||
massInt += RRiGas[cellI]*regionMesh().V()[cellI];
|
||||
massInt += RRiGas[cellI]*cellVol[cellI];
|
||||
phiHsGas_[cellI] += massInt*HsiGas[cellI];
|
||||
}
|
||||
|
||||
phiGas_.boundaryField()[patchI][faceI] += massInt;
|
||||
phiGasp[faceI] += massInt;
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -136,7 +191,6 @@ void reactingOneDim::updatePhiGas()
|
||||
<< " is : " << massInt
|
||||
<< " [kg/s] " << endl;
|
||||
}
|
||||
totalFaceId ++;
|
||||
}
|
||||
}
|
||||
tHsiGas().clear();
|
||||
@ -146,6 +200,11 @@ void reactingOneDim::updatePhiGas()
|
||||
|
||||
void reactingOneDim::updateFields()
|
||||
{
|
||||
if (QrHSource_)
|
||||
{
|
||||
updateQr();
|
||||
}
|
||||
|
||||
updatePhiGas();
|
||||
}
|
||||
|
||||
@ -183,22 +242,28 @@ void reactingOneDim::solveContinuity()
|
||||
Info<< "reactingOneDim::solveContinuity()" << endl;
|
||||
}
|
||||
|
||||
if (moveMesh_)
|
||||
{
|
||||
const scalarField mass0 = rho_*regionMesh().V();
|
||||
const scalarField mass0 = rho_*regionMesh().V();
|
||||
|
||||
fvScalarMatrix rhoEqn
|
||||
fvScalarMatrix rhoEqn
|
||||
(
|
||||
fvm::ddt(rho_)
|
||||
==
|
||||
- solidChemistry_->RRg()
|
||||
);
|
||||
|
||||
if (regionMesh().moving())
|
||||
{
|
||||
surfaceScalarField phiRhoMesh
|
||||
(
|
||||
fvm::ddt(rho_)
|
||||
==
|
||||
- solidChemistry_->RRg()
|
||||
fvc::interpolate(rho_)*regionMesh().phi()
|
||||
);
|
||||
|
||||
rhoEqn.solve();
|
||||
|
||||
updateMesh(mass0);
|
||||
|
||||
rhoEqn += fvc::div(phiRhoMesh);
|
||||
}
|
||||
|
||||
rhoEqn.solve();
|
||||
|
||||
updateMesh(mass0);
|
||||
}
|
||||
|
||||
|
||||
@ -239,6 +304,7 @@ void reactingOneDim::solveSpeciesMass()
|
||||
}
|
||||
|
||||
Ys_[Ys_.size() - 1] = 1.0 - Yt;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -259,6 +325,18 @@ void reactingOneDim::solveEnergy()
|
||||
chemistrySh_
|
||||
);
|
||||
|
||||
if (gasHSource_)
|
||||
{
|
||||
const surfaceScalarField phiGas(fvc::interpolate(phiHsGas_));
|
||||
hEqn += fvc::div(phiGas);
|
||||
}
|
||||
|
||||
if (QrHSource_)
|
||||
{
|
||||
const surfaceScalarField phiQr(fvc::interpolate(Qr_)*nMagSf());
|
||||
hEqn += fvc::div(phiQr);
|
||||
}
|
||||
|
||||
if (regionMesh().moving())
|
||||
{
|
||||
surfaceScalarField phihMesh
|
||||
@ -271,9 +349,6 @@ void reactingOneDim::solveEnergy()
|
||||
|
||||
hEqn.relax();
|
||||
hEqn.solve();
|
||||
|
||||
Info<< "pyrolysis min/max(T) = " << min(solidThermo_.T()) << ", "
|
||||
<< max(solidThermo_.T()) << endl;
|
||||
}
|
||||
|
||||
|
||||
@ -366,10 +441,27 @@ reactingOneDim::reactingOneDim(const word& modelType, const fvMesh& mesh)
|
||||
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0)
|
||||
),
|
||||
|
||||
Qr_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qr",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh()
|
||||
//dimensionedScalar("zero", dimEnergy/dimArea/dimTime, 0.0),
|
||||
//zeroGradientFvPatchVectorField::typeName
|
||||
),
|
||||
|
||||
lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)),
|
||||
addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)),
|
||||
totalGasMassFlux_(0.0),
|
||||
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0))
|
||||
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)),
|
||||
gasHSource_(false),
|
||||
QrHSource_(false)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
@ -449,10 +541,25 @@ reactingOneDim::reactingOneDim
|
||||
dimensionedScalar("zero", dimEnergy/dimTime/dimVolume, 0.0)
|
||||
),
|
||||
|
||||
Qr_
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"Qr",
|
||||
time().timeName(),
|
||||
regionMesh(),
|
||||
IOobject::MUST_READ,
|
||||
IOobject::AUTO_WRITE
|
||||
),
|
||||
regionMesh()
|
||||
),
|
||||
|
||||
lostSolidMass_(dimensionedScalar("zero", dimMass, 0.0)),
|
||||
addedGasMass_(dimensionedScalar("zero", dimMass, 0.0)),
|
||||
totalGasMassFlux_(0.0),
|
||||
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0))
|
||||
totalHeatRR_(dimensionedScalar("zero", dimEnergy/dimTime, 0.0)),
|
||||
gasHSource_(false),
|
||||
QrHSource_(false)
|
||||
{
|
||||
if (active_)
|
||||
{
|
||||
@ -579,8 +686,6 @@ void reactingOneDim::evolveRegion()
|
||||
time().deltaTValue()
|
||||
);
|
||||
|
||||
calculateMassTransfer();
|
||||
|
||||
solveContinuity();
|
||||
|
||||
chemistrySh_ = solidChemistry_->Sh()();
|
||||
@ -594,9 +699,15 @@ void reactingOneDim::evolveRegion()
|
||||
solveEnergy();
|
||||
}
|
||||
|
||||
calculateMassTransfer();
|
||||
|
||||
solidThermo_.correct();
|
||||
|
||||
rho_ = solidThermo_.rho();
|
||||
Info<< "pyrolysis min/max(T) = "
|
||||
<< min(solidThermo_.T().internalField())
|
||||
<< ", "
|
||||
<< max(solidThermo_.T().internalField())
|
||||
<< endl;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -97,10 +97,6 @@ protected:
|
||||
volScalarField& h_;
|
||||
|
||||
|
||||
//- Name of the radiative flux in the primary region
|
||||
word primaryRadFluxName_;
|
||||
|
||||
|
||||
// Solution parameters
|
||||
|
||||
//- Number of non-orthogonal correctors
|
||||
@ -125,6 +121,16 @@ protected:
|
||||
volScalarField chemistrySh_;
|
||||
|
||||
|
||||
// Source term fields
|
||||
|
||||
//- Coupled region radiative heat flux [W/m2]
|
||||
// Requires user to input mapping info for coupled patches
|
||||
//volScalarField QrCoupled_;
|
||||
|
||||
//- In depth radiative heat flux [W/m2]
|
||||
volScalarField Qr_;
|
||||
|
||||
|
||||
// Checks
|
||||
|
||||
//- Cumulative lost mass of the condensed phase [kg]
|
||||
@ -140,6 +146,15 @@ protected:
|
||||
dimensionedScalar totalHeatRR_;
|
||||
|
||||
|
||||
// Options
|
||||
|
||||
//- Add gas enthalpy source term
|
||||
bool gasHSource_;
|
||||
|
||||
//- Add in depth radiation source term
|
||||
bool QrHSource_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Read control parameters from dictionary
|
||||
@ -154,6 +169,9 @@ protected:
|
||||
//- Update/move mesh based on change in mass
|
||||
void updateMesh(const scalarField& mass0);
|
||||
|
||||
//- Update radiative flux in pyrolysis region
|
||||
void updateQr();
|
||||
|
||||
//- Update enthalpy flux for pyrolysis gases
|
||||
void updatePhiGas();
|
||||
|
||||
|
||||
@ -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
|
||||
@ -159,6 +159,8 @@ void Foam::chemistryModel<CompType, ThermoType>::updateConcsInReactionI
|
||||
const label index,
|
||||
const scalar dt,
|
||||
const scalar omeg,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
scalarField& c
|
||||
) const
|
||||
{
|
||||
@ -191,6 +193,8 @@ void Foam::chemistryModel<CompType, ThermoType>::updateRRInReactionI
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const
|
||||
{
|
||||
|
||||
@ -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
|
||||
@ -182,6 +182,8 @@ public:
|
||||
const label i,
|
||||
const scalar dt,
|
||||
const scalar omega,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
scalarField& c
|
||||
) const;
|
||||
|
||||
@ -194,6 +196,8 @@ public:
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -94,7 +94,7 @@ Foam::scalar Foam::EulerImplicit<ChemistryModel>::solve
|
||||
}
|
||||
}
|
||||
|
||||
this->updateRRInReactionI(i, pr, pf, corr, lRef, rRef, RR);
|
||||
this->updateRRInReactionI(i, pr, pf, corr, lRef, rRef, p, T, RR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -83,7 +83,7 @@ Foam::scalar Foam::sequential<ChemistryModel>::solve
|
||||
|
||||
tChemInv = max(tChemInv, mag(omega));
|
||||
|
||||
this->updateConcsInReactionI(i, dt, omega, c);
|
||||
this->updateConcsInReactionI(i, dt, omega, p, T, c);
|
||||
}
|
||||
|
||||
return cTauChem_/tChemInv;
|
||||
|
||||
@ -97,15 +97,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
|
||||
}
|
||||
else
|
||||
{
|
||||
// No value given. Restart as fixedValue b.c.
|
||||
|
||||
const scalarField& Tp =
|
||||
patch().lookupPatchField<volScalarField, scalar>(TName_);
|
||||
|
||||
//NOTE: Assumes emissivity = 1 as the solidThermo might
|
||||
// not be constructed yet
|
||||
refValue() =
|
||||
4.0*physicoChemical::sigma.value()*pow4(Tp)/pi;
|
||||
refValue() = 0.0;
|
||||
refGrad() = 0.0;
|
||||
valueFraction() = 1.0;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -121,6 +121,21 @@ greyMeanSolidAbsorptionEmission
|
||||
continue;
|
||||
}
|
||||
const word& key = iter().keyword();
|
||||
if (!mixture_.contains(key))
|
||||
{
|
||||
WarningIn
|
||||
(
|
||||
"greyMeanSolidAbsorptionEmission::"
|
||||
"greyMeanSolidAbsorptionEmission "
|
||||
"("
|
||||
" const dictionary& dict,"
|
||||
" const fvMesh& mesh"
|
||||
")"
|
||||
) << " specie: " << key << " is not found in the solid mixture"
|
||||
<< nl
|
||||
<< " specie is the mixture are:" << mixture_.species() << nl
|
||||
<< nl << endl;
|
||||
}
|
||||
speciesNames_.insert(key, nFunc);
|
||||
const dictionary& dict = iter().dict();
|
||||
dict.lookup("absorptivity") >> solidData_[nFunc][absorptivity];
|
||||
|
||||
@ -80,9 +80,11 @@ makeChemistryReaderType(foamChemistryReader, icoPoly8EThermoPhysics);
|
||||
|
||||
makeChemistryReader(hConstSolidThermoPhysics);
|
||||
makeChemistryReader(hExponentialSolidThermoPhysics);
|
||||
makeChemistryReader(hExpKappaConstSolidThermoPhysics);
|
||||
|
||||
makeChemistryReaderType(foamChemistryReader, hConstSolidThermoPhysics);
|
||||
makeChemistryReaderType(foamChemistryReader, hExponentialSolidThermoPhysics);
|
||||
makeChemistryReaderType(foamChemistryReader, hExpKappaConstSolidThermoPhysics);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
@ -59,6 +59,15 @@ namespace Foam
|
||||
hExponentialSolidThermoPhysics,
|
||||
gasHThermoPhysics
|
||||
);
|
||||
|
||||
makeSolidChemistryModel
|
||||
(
|
||||
solidChemistryModel,
|
||||
pyrolysisChemistryModel,
|
||||
basicSolidChemistryModel,
|
||||
hExpKappaConstSolidThermoPhysics,
|
||||
gasHThermoPhysics
|
||||
);
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -56,7 +56,8 @@ namespace Foam
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Comp##SThermo##GThermo, \
|
||||
(#SS"<"#Comp"," + SThermo::typeName() + "," + GThermo::typeName() + \
|
||||
(word(SS::typeName_()) + "<"#Comp"," + SThermo::typeName() + "," + \
|
||||
GThermo::typeName() + \
|
||||
">").c_str(), \
|
||||
0 \
|
||||
);
|
||||
|
||||
@ -274,6 +274,29 @@ Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::omega
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::scalar Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
omegaI
|
||||
(
|
||||
const label index,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const
|
||||
{
|
||||
|
||||
const Reaction<SolidThermo>& R = this->reactions_[index];
|
||||
scalar w = omega(R, c, T, p, pf, cf, lRef, pr, cr, rRef);
|
||||
return(w);
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
void Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
derivatives
|
||||
@ -489,6 +512,76 @@ calculate()
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
void Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
updateConcsInReactionI
|
||||
(
|
||||
const label index,
|
||||
const scalar dt,
|
||||
const scalar omeg,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
scalarField& c
|
||||
) const
|
||||
{
|
||||
// update species
|
||||
const Reaction<SolidThermo>& 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);
|
||||
c[si] -= dt*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
}
|
||||
|
||||
forAll(R.rhs(), s)
|
||||
{
|
||||
label si = R.rhs()[s].index;
|
||||
const scalar rhoR = this->solidThermo_[si].rho(p, T);
|
||||
const scalar sr = rhoR/rhoL;
|
||||
c[si] += dt*sr*omeg;
|
||||
c[si] = max(0.0, c[si]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
void Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::
|
||||
updateRRInReactionI
|
||||
(
|
||||
const label index,
|
||||
const scalar pr,
|
||||
const scalar pf,
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const
|
||||
{
|
||||
const Reaction<SolidThermo>& 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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CompType, class SolidThermo, class GasThermo>
|
||||
Foam::scalar
|
||||
Foam::pyrolysisChemistryModel<CompType, SolidThermo, GasThermo>::solve
|
||||
|
||||
@ -153,9 +153,52 @@ public:
|
||||
label& rRef
|
||||
) const;
|
||||
|
||||
//- Return the reaction rate for iReaction and the reference
|
||||
// species and charateristic times
|
||||
virtual scalar omegaI
|
||||
(
|
||||
label iReaction,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const;
|
||||
|
||||
//- Calculates the reaction rates
|
||||
virtual void calculate();
|
||||
|
||||
//- Update concentrations in reaction i given dt and reaction rate
|
||||
// omega used by sequential solver
|
||||
virtual void updateConcsInReactionI
|
||||
(
|
||||
const label i,
|
||||
const scalar dt,
|
||||
const scalar omega,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
scalarField& c
|
||||
) const;
|
||||
|
||||
|
||||
//- Update matrix RR for reaction i. Used by EulerImplicit
|
||||
virtual void updateRRInReactionI
|
||||
(
|
||||
const label i,
|
||||
const scalar pr,
|
||||
const scalar pf,
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const;
|
||||
|
||||
|
||||
// Chemistry model functions
|
||||
|
||||
|
||||
@ -43,6 +43,7 @@ SourceFiles
|
||||
#include "ODE.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "DimensionedField.H"
|
||||
#include "simpleMatrix.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -150,6 +151,49 @@ public:
|
||||
label& rRef
|
||||
) const = 0;
|
||||
|
||||
//- Return the reaction rate for iReaction and the reference
|
||||
// species and charateristic times
|
||||
virtual scalar omegaI
|
||||
(
|
||||
label iReaction,
|
||||
const scalarField& c,
|
||||
const scalar T,
|
||||
const scalar p,
|
||||
scalar& pf,
|
||||
scalar& cf,
|
||||
label& lRef,
|
||||
scalar& pr,
|
||||
scalar& cr,
|
||||
label& rRef
|
||||
) const = 0;
|
||||
|
||||
//- Update concentrations in reaction i given dt and reaction rate
|
||||
// omega used by sequential solver
|
||||
virtual void updateConcsInReactionI
|
||||
(
|
||||
const label i,
|
||||
const scalar dt,
|
||||
const scalar omega,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
scalarField& c
|
||||
) const = 0;
|
||||
|
||||
|
||||
//- Update matrix RR for reaction i. Used by EulerImplicit
|
||||
virtual void updateRRInReactionI
|
||||
(
|
||||
const label i,
|
||||
const scalar pr,
|
||||
const scalar pf,
|
||||
const scalar corr,
|
||||
const label lRef,
|
||||
const label rRef,
|
||||
const scalar p,
|
||||
const scalar T,
|
||||
simpleMatrix<scalar>& RR
|
||||
) const = 0;
|
||||
|
||||
//- Calculates the reaction rates
|
||||
virtual void calculate() = 0;
|
||||
|
||||
|
||||
@ -32,6 +32,11 @@ Description
|
||||
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
#include "noChemistrySolver.H"
|
||||
#include "EulerImplicit.H"
|
||||
#include "ode.H"
|
||||
#include "sequential.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
@ -47,7 +52,8 @@ namespace Foam
|
||||
defineTemplateTypeNameAndDebugWithName \
|
||||
( \
|
||||
SS##Schem##Comp##SThermo##GThermo, \
|
||||
(#SS"<" + word(Schem::typeName_()) + "<"#Comp"," + SThermo::typeName()\
|
||||
(#SS"<" + word(Schem::typeName_()) \
|
||||
+ "<"#Comp"," + SThermo::typeName() \
|
||||
+ "," + GThermo::typeName() + ">>").c_str(), \
|
||||
0 \
|
||||
); \
|
||||
@ -60,6 +66,45 @@ namespace Foam
|
||||
);
|
||||
|
||||
|
||||
#define makeSolidChemistrySolverTypes(SolidChem, Comp, SThermo, GThermo) \
|
||||
\
|
||||
makeSolidChemistrySolverType \
|
||||
( \
|
||||
noChemistrySolver, \
|
||||
SolidChem, \
|
||||
Comp, \
|
||||
SThermo, \
|
||||
GThermo \
|
||||
); \
|
||||
\
|
||||
makeSolidChemistrySolverType \
|
||||
( \
|
||||
EulerImplicit, \
|
||||
SolidChem, \
|
||||
Comp, \
|
||||
SThermo, \
|
||||
GThermo \
|
||||
); \
|
||||
\
|
||||
makeSolidChemistrySolverType \
|
||||
( \
|
||||
ode, \
|
||||
SolidChem, \
|
||||
Comp, \
|
||||
SThermo, \
|
||||
GThermo \
|
||||
); \
|
||||
\
|
||||
makeSolidChemistrySolverType \
|
||||
( \
|
||||
sequential, \
|
||||
SolidChem, \
|
||||
Comp, \
|
||||
SThermo, \
|
||||
GThermo \
|
||||
);
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -30,30 +30,34 @@ License
|
||||
#include "pyrolysisChemistryModel.H"
|
||||
#include "basicSolidChemistryModel.H"
|
||||
|
||||
#include "ode.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeSolidChemistrySolverType
|
||||
makeSolidChemistrySolverTypes
|
||||
(
|
||||
ode,
|
||||
pyrolysisChemistryModel,
|
||||
basicSolidChemistryModel,
|
||||
hConstSolidThermoPhysics,
|
||||
gasHThermoPhysics
|
||||
)
|
||||
|
||||
makeSolidChemistrySolverType
|
||||
makeSolidChemistrySolverTypes
|
||||
(
|
||||
ode,
|
||||
pyrolysisChemistryModel,
|
||||
basicSolidChemistryModel,
|
||||
hExponentialSolidThermoPhysics,
|
||||
gasHThermoPhysics
|
||||
)
|
||||
|
||||
makeSolidChemistrySolverTypes
|
||||
(
|
||||
pyrolysisChemistryModel,
|
||||
basicSolidChemistryModel,
|
||||
hExpKappaConstSolidThermoPhysics,
|
||||
gasHThermoPhysics
|
||||
)
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -76,7 +76,6 @@ namespace Foam
|
||||
>
|
||||
> hExponentialSolidThermoPhysics;
|
||||
|
||||
|
||||
typedef
|
||||
polynomialSolidTransport
|
||||
<
|
||||
@ -91,6 +90,19 @@ namespace Foam
|
||||
>,
|
||||
8
|
||||
> hTransportThermoPoly8SolidThermoPhysics;
|
||||
|
||||
typedef
|
||||
constIsoSolidTransport
|
||||
<
|
||||
species::thermo
|
||||
<
|
||||
hExponentialThermo
|
||||
<
|
||||
rhoConst<specie>
|
||||
>,
|
||||
sensibleEnthalpy
|
||||
>
|
||||
> hExpKappaConstSolidThermoPhysics;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -42,6 +42,12 @@ makeSolidIRReactions
|
||||
solidArrheniusReactionRate
|
||||
)
|
||||
|
||||
makeSolidIRReactions
|
||||
(
|
||||
hExpKappaConstSolidThermoPhysics,
|
||||
solidArrheniusReactionRate
|
||||
)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
@ -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
|
||||
@ -62,6 +62,19 @@ makeReactingSolidThermo
|
||||
);
|
||||
|
||||
|
||||
makeReactingSolidThermo
|
||||
(
|
||||
solidReactionThermo,
|
||||
heSolidThermo,
|
||||
reactingMixture,
|
||||
constIsoSolidTransport,
|
||||
sensibleEnthalpy,
|
||||
hExponentialThermo,
|
||||
rhoConst,
|
||||
specie
|
||||
);
|
||||
|
||||
|
||||
makeReactingSolidThermo
|
||||
(
|
||||
solidThermo,
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -28,6 +28,21 @@ License
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
Foam::hExponentialThermo<equationOfState>::hExponentialThermo(Istream& is)
|
||||
:
|
||||
equationOfState(is),
|
||||
n0_(readScalar(is)),
|
||||
Tref_(readScalar(is)),
|
||||
Hf_(readScalar(is))
|
||||
{
|
||||
is.check("hExponentialThermo::hExponentialThermo(Istream& is)");
|
||||
|
||||
c0_ *= this->W();
|
||||
Hf_ *= this->W();
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
Foam::hExponentialThermo<equationOfState>::hExponentialThermo
|
||||
(
|
||||
@ -39,7 +54,10 @@ Foam::hExponentialThermo<equationOfState>::hExponentialThermo
|
||||
n0_(readScalar(dict.subDict("thermodynamics").lookup("n0"))),
|
||||
Tref_(readScalar(dict.subDict("thermodynamics").lookup("Tref"))),
|
||||
Hf_(readScalar(dict.subDict("thermodynamics").lookup("Hf")))
|
||||
{}
|
||||
{
|
||||
c0_ *= this->W();
|
||||
Hf_ *= this->W();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -48,6 +48,20 @@ namespace Foam
|
||||
|
||||
template<class EquationOfState> class hExponentialThermo;
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hExponentialThermo<EquationOfState> operator+
|
||||
(
|
||||
const hExponentialThermo<EquationOfState>&,
|
||||
const hExponentialThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hExponentialThermo<EquationOfState> operator-
|
||||
(
|
||||
const hExponentialThermo<EquationOfState>&,
|
||||
const hExponentialThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hExponentialThermo<EquationOfState> operator*
|
||||
(
|
||||
@ -56,6 +70,14 @@ inline hExponentialThermo<EquationOfState> operator*
|
||||
);
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
inline hExponentialThermo<EquationOfState> operator==
|
||||
(
|
||||
const hExponentialThermo<EquationOfState>&,
|
||||
const hExponentialThermo<EquationOfState>&
|
||||
);
|
||||
|
||||
|
||||
template<class EquationOfState>
|
||||
Ostream& operator<<
|
||||
(
|
||||
@ -90,11 +112,6 @@ class hExponentialThermo
|
||||
//- Integrate Cp expression
|
||||
inline scalar integrateCp(const scalar T) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
inline hExponentialThermo
|
||||
(
|
||||
@ -105,6 +122,13 @@ public:
|
||||
const scalar Hf
|
||||
);
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from Istream
|
||||
hExponentialThermo(Istream&);
|
||||
|
||||
//- Construct from dictionary
|
||||
hExponentialThermo(const dictionary&);
|
||||
|
||||
@ -115,6 +139,15 @@ public:
|
||||
const hExponentialThermo&
|
||||
);
|
||||
|
||||
//- Construct and return a clone
|
||||
inline autoPtr<hExponentialThermo> clone() const;
|
||||
|
||||
//- Selector from Istream
|
||||
inline static autoPtr<hExponentialThermo> New(Istream& is);
|
||||
|
||||
//- Selector from dictionary
|
||||
inline static autoPtr<hExponentialThermo> New(const dictionary& dict);
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -148,16 +181,23 @@ public:
|
||||
|
||||
// Member operators
|
||||
|
||||
inline hExponentialThermo& operator=
|
||||
(
|
||||
const hExponentialThermo&
|
||||
);
|
||||
inline void operator+=(const hExponentialThermo&);
|
||||
inline void operator-=(const hExponentialThermo&);
|
||||
|
||||
|
||||
// Friend operators
|
||||
|
||||
friend hExponentialThermo operator+ <EquationOfState>
|
||||
(
|
||||
const hExponentialThermo&,
|
||||
const hExponentialThermo&
|
||||
);
|
||||
|
||||
friend hExponentialThermo operator- <EquationOfState>
|
||||
(
|
||||
const hExponentialThermo&,
|
||||
const hExponentialThermo&
|
||||
);
|
||||
|
||||
friend hExponentialThermo operator* <EquationOfState>
|
||||
(
|
||||
@ -166,6 +206,13 @@ public:
|
||||
);
|
||||
|
||||
|
||||
friend hExponentialThermo operator== <EquationOfState>
|
||||
(
|
||||
const hExponentialThermo&,
|
||||
const hExponentialThermo&
|
||||
);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <EquationOfState>
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 2012 OpenFOAM Foundation
|
||||
\\ / A nd | Copyright (C) 2012-2013 OpenFOAM Foundation
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
@ -55,14 +55,11 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::integrateCp
|
||||
{
|
||||
return
|
||||
(
|
||||
c0_*pow(T, n0_ + 1.0)
|
||||
/(pow(Tref_, n0_)*(n0_ + 1.0))
|
||||
c0_*pow(T, n0_ + 1.0)/(pow(Tref_, n0_)*(n0_ + 1.0))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState>::hExponentialThermo
|
||||
(
|
||||
@ -78,6 +75,8 @@ inline Foam::hExponentialThermo<equationOfState>::hExponentialThermo
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState>::hExponentialThermo
|
||||
(
|
||||
@ -96,6 +95,39 @@ inline Foam::hExponentialThermo<equationOfState>::hExponentialThermo
|
||||
{}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::autoPtr<Foam::hExponentialThermo<equationOfState> >
|
||||
Foam::hExponentialThermo<equationOfState>::clone() const
|
||||
{
|
||||
return autoPtr<hExponentialThermo<equationOfState> >
|
||||
(
|
||||
new hExponentialThermo<equationOfState>(*this)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::autoPtr<Foam::hExponentialThermo<equationOfState> >
|
||||
Foam::hExponentialThermo<equationOfState>::New(Istream& is)
|
||||
{
|
||||
return autoPtr<hExponentialThermo<equationOfState> >
|
||||
(
|
||||
new hExponentialThermo<equationOfState>(is)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::autoPtr<Foam::hExponentialThermo<equationOfState> >
|
||||
Foam::hExponentialThermo<equationOfState>::New(const dictionary& dict)
|
||||
{
|
||||
return autoPtr<hExponentialThermo<equationOfState> >
|
||||
(
|
||||
new hExponentialThermo<equationOfState>(dict)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
@ -114,7 +146,7 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::cp
|
||||
const scalar p, const scalar T
|
||||
) const
|
||||
{
|
||||
return c0_*pow(T/Tref_, n0_)*this->W();
|
||||
return c0_*pow(T/Tref_, n0_);
|
||||
}
|
||||
|
||||
|
||||
@ -128,7 +160,7 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::ha
|
||||
|
||||
return
|
||||
(
|
||||
(integrateCp(T) + Hf_ - hOffset)*this->W()
|
||||
(integrateCp(T) + Hf_ - hOffset)
|
||||
);
|
||||
}
|
||||
|
||||
@ -140,14 +172,14 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::hs
|
||||
) const
|
||||
{
|
||||
scalar hOffset = integrateCp(specie::Tstd);
|
||||
return (integrateCp(T) - hOffset)*this->W();
|
||||
return (integrateCp(T) - hOffset);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::scalar Foam::hExponentialThermo<equationOfState>::hc() const
|
||||
{
|
||||
return Hf_*this->W();
|
||||
return Hf_;
|
||||
}
|
||||
|
||||
|
||||
@ -167,25 +199,6 @@ inline Foam::scalar Foam::hExponentialThermo<equationOfState>::s
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState>&
|
||||
Foam::hExponentialThermo<equationOfState>::operator=
|
||||
(
|
||||
const hExponentialThermo<equationOfState>& ct
|
||||
)
|
||||
{
|
||||
equationOfState::operator=(ct);
|
||||
|
||||
Hf_ = ct.Hf_;
|
||||
c0_ = ct.c0_;
|
||||
n0_ = ct.n0_;
|
||||
Tref_ = ct.Tref_;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline void Foam::hExponentialThermo<equationOfState>::operator+=
|
||||
(
|
||||
@ -195,14 +208,13 @@ inline void Foam::hExponentialThermo<equationOfState>::operator+=
|
||||
scalar molr1 = this->nMoles();
|
||||
|
||||
equationOfState::operator+=(ct);
|
||||
|
||||
molr1 /= this->nMoles();
|
||||
scalar molr2 = ct.nMoles()/this->nMoles();
|
||||
|
||||
Hf_ = molr1*Hf_ + molr2*ct.Hf_;
|
||||
c0_ = molr1*c0_ + molr2*ct.c0_;
|
||||
n0_ = (molr1*n0_ + molr2*ct.n0_);
|
||||
Tref_ = (molr1*Tref_ + molr2*ct.Tref_);
|
||||
n0_ = molr1*n0_ + molr2*ct.n0_;
|
||||
Tref_ = molr1*Tref_ + molr2*ct.Tref_;
|
||||
}
|
||||
|
||||
|
||||
@ -228,6 +240,62 @@ inline void Foam::hExponentialThermo<equationOfState>::operator-=
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState> Foam::operator+
|
||||
(
|
||||
const hExponentialThermo<equationOfState>& ct1,
|
||||
const hExponentialThermo<equationOfState>& ct2
|
||||
)
|
||||
{
|
||||
equationOfState eofs
|
||||
(
|
||||
static_cast<const equationOfState&>(ct1)
|
||||
+ static_cast<const equationOfState&>(ct2)
|
||||
);
|
||||
|
||||
return hExponentialThermo<equationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.c0_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.c0_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.n0_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.n0_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Tref_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.Tref_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
|
||||
+ ct2.nMoles()/eofs.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState> Foam::operator-
|
||||
(
|
||||
const hExponentialThermo<equationOfState>& ct1,
|
||||
const hExponentialThermo<equationOfState>& ct2
|
||||
)
|
||||
{
|
||||
equationOfState eofs
|
||||
(
|
||||
static_cast<const equationOfState&>(ct1)
|
||||
+ static_cast<const equationOfState&>(ct2)
|
||||
);
|
||||
|
||||
return hExponentialThermo<equationOfState>
|
||||
(
|
||||
eofs,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.c0_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.c0_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.n0_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.n0_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Tref_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.Tref_,
|
||||
ct1.nMoles()/eofs.nMoles()*ct1.Hf_
|
||||
- ct2.nMoles()/eofs.nMoles()*ct2.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState> Foam::operator*
|
||||
(
|
||||
@ -238,12 +306,23 @@ inline Foam::hExponentialThermo<equationOfState> Foam::operator*
|
||||
return hExponentialThermo<equationOfState>
|
||||
(
|
||||
s*static_cast<const equationOfState&>(ct),
|
||||
ct.Hf_,
|
||||
ct.c0_,
|
||||
ct.n0_,
|
||||
ct.Tref_
|
||||
ct.Tref_,
|
||||
ct.Hf_
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<class equationOfState>
|
||||
inline Foam::hExponentialThermo<equationOfState> Foam::operator==
|
||||
(
|
||||
const hExponentialThermo<equationOfState>& ct1,
|
||||
const hExponentialThermo<equationOfState>& ct2
|
||||
)
|
||||
{
|
||||
return ct2 - ct1;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -58,6 +58,17 @@ Foam::incompressibleTwoPhaseMixture::incompressibleTwoPhaseMixture
|
||||
const word& alpha2Name
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
transportModel(U, phi),
|
||||
twoPhaseMixture(U.mesh(), *this, alpha1Name, alpha2Name),
|
||||
|
||||
|
||||
@ -38,6 +38,7 @@ SourceFiles
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "incompressible/viscosityModels/viscosityModel/viscosityModel.H"
|
||||
#include "twoPhaseMixture.H"
|
||||
#include "IOdictionary.H"
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -51,6 +52,7 @@ namespace Foam
|
||||
|
||||
class incompressibleTwoPhaseMixture
|
||||
:
|
||||
public IOdictionary,
|
||||
public transportModel,
|
||||
public twoPhaseMixture
|
||||
{
|
||||
@ -133,6 +135,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
virtual tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Return the face-interpolated kinematic laminar viscosity
|
||||
tmp<surfaceScalarField> nuf() const;
|
||||
|
||||
|
||||
@ -36,6 +36,17 @@ Foam::singlePhaseTransportModel::singlePhaseTransportModel
|
||||
const surfaceScalarField& phi
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
),
|
||||
transportModel(U, phi),
|
||||
viscosityModelPtr_(viscosityModel::New("nu", *this, U, phi))
|
||||
{}
|
||||
@ -49,12 +60,20 @@ Foam::singlePhaseTransportModel::~singlePhaseTransportModel()
|
||||
|
||||
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::tmp<Foam::volScalarField> Foam::singlePhaseTransportModel::nu() const
|
||||
Foam::tmp<Foam::volScalarField>
|
||||
Foam::singlePhaseTransportModel::nu() const
|
||||
{
|
||||
return viscosityModelPtr_->nu();
|
||||
}
|
||||
|
||||
|
||||
Foam::tmp<Foam::scalarField>
|
||||
Foam::singlePhaseTransportModel::nu(const label patchi) const
|
||||
{
|
||||
return viscosityModelPtr_->nu(patchi);
|
||||
}
|
||||
|
||||
|
||||
void Foam::singlePhaseTransportModel::correct()
|
||||
{
|
||||
viscosityModelPtr_->correct();
|
||||
|
||||
@ -39,6 +39,7 @@ SourceFiles
|
||||
#define singlePhaseTransportModel_H
|
||||
|
||||
#include "incompressible/transportModel/transportModel.H"
|
||||
#include "IOdictionary.H"
|
||||
#include "autoPtr.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -54,6 +55,7 @@ class viscosityModel;
|
||||
|
||||
class singlePhaseTransportModel
|
||||
:
|
||||
public IOdictionary,
|
||||
public transportModel
|
||||
{
|
||||
// Private Data
|
||||
@ -89,10 +91,13 @@ public:
|
||||
// Member Functions
|
||||
|
||||
//- Return the laminar viscosity
|
||||
tmp<volScalarField> nu() const;
|
||||
virtual tmp<volScalarField> nu() const;
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
virtual tmp<scalarField> nu(const label patchi) const;
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
void correct();
|
||||
virtual void correct();
|
||||
|
||||
//- Read transportProperties dictionary
|
||||
virtual bool read();
|
||||
|
||||
@ -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
|
||||
@ -24,29 +24,22 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "transportModel.H"
|
||||
#include "viscosityModel.H"
|
||||
#include "volFields.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
defineTypeNameAndDebug(transportModel, 0);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::transportModel::transportModel
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
const volVectorField&,
|
||||
const surfaceScalarField&
|
||||
)
|
||||
:
|
||||
IOdictionary
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"transportProperties",
|
||||
U.time().constant(),
|
||||
U.db(),
|
||||
IOobject::MUST_READ_IF_MODIFIED,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -60,7 +53,7 @@ Foam::transportModel::~transportModel()
|
||||
|
||||
bool Foam::transportModel::read()
|
||||
{
|
||||
return regIOobject::read();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -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
|
||||
@ -36,7 +36,7 @@ SourceFiles
|
||||
#ifndef transportModel_H
|
||||
#define transportModel_H
|
||||
|
||||
#include "IOdictionary.H"
|
||||
#include "primitiveFieldsFwd.H"
|
||||
#include "volFieldsFwd.H"
|
||||
#include "surfaceFieldsFwd.H"
|
||||
|
||||
@ -50,8 +50,6 @@ namespace Foam
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class transportModel
|
||||
:
|
||||
public IOdictionary
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
@ -64,6 +62,10 @@ class transportModel
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("transportModel");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
@ -71,7 +73,7 @@ public:
|
||||
(
|
||||
const volVectorField& U,
|
||||
const surfaceScalarField& phi
|
||||
);
|
||||
);\
|
||||
|
||||
|
||||
//- Destructor
|
||||
@ -83,6 +85,9 @@ public:
|
||||
//- Return the laminar viscosity
|
||||
virtual tmp<volScalarField> nu() const = 0;
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
virtual tmp<scalarField> nu(const label patchi) const = 0;
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
virtual void correct() = 0;
|
||||
|
||||
|
||||
@ -107,6 +107,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
void correct()
|
||||
{
|
||||
|
||||
@ -102,6 +102,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
void correct()
|
||||
{
|
||||
|
||||
@ -103,6 +103,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
void correct()
|
||||
{
|
||||
|
||||
@ -92,6 +92,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Correct the laminar viscosity (not appropriate, viscosity constant)
|
||||
void correct()
|
||||
{}
|
||||
|
||||
@ -103,6 +103,12 @@ public:
|
||||
return nu_;
|
||||
}
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
tmp<scalarField> nu(const label patchi) const
|
||||
{
|
||||
return nu_.boundaryField()[patchi];
|
||||
}
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
void correct()
|
||||
{
|
||||
|
||||
@ -154,6 +154,9 @@ public:
|
||||
//- Return the laminar viscosity
|
||||
virtual tmp<volScalarField> nu() const = 0;
|
||||
|
||||
//- Return the laminar viscosity for patch
|
||||
virtual tmp<scalarField> nu(const label patchi) const = 0;
|
||||
|
||||
//- Correct the laminar viscosity
|
||||
virtual void correct() = 0;
|
||||
|
||||
|
||||
@ -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
|
||||
@ -51,9 +51,11 @@ bool Foam::triSurface::readOBJ(const fileName& OBJfileName)
|
||||
{
|
||||
string line = getLineNoComment(OBJfile);
|
||||
|
||||
if (line[line.size()-1] == '\\')
|
||||
label sz = line.size();
|
||||
|
||||
if (sz && line[sz-1] == '\\')
|
||||
{
|
||||
line.substr(0, line.size()-1);
|
||||
line.substr(0, sz-1);
|
||||
line += getLineNoComment(OBJfile);
|
||||
}
|
||||
|
||||
|
||||
@ -212,9 +212,14 @@ void alphatJayatillekeWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
const tmp<volScalarField> tk = turbModel.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const IOdictionary& transportProperties =
|
||||
db().lookupObject<IOdictionary>("transportProperties");
|
||||
|
||||
// Molecular Prandtl number
|
||||
const scalar
|
||||
Pr(dimensionedScalar(turbModel.transport().lookup("Pr")).value());
|
||||
const scalar Pr
|
||||
(
|
||||
dimensionedScalar(transportProperties.lookup("Pr")).value()
|
||||
);
|
||||
|
||||
// Populate boundary values
|
||||
scalarField& alphatw = *this;
|
||||
|
||||
@ -192,9 +192,9 @@ void turbulentHeatFluxTemperatureFvPatchScalarField::updateCoeffs()
|
||||
patch().lookupPatchField<volScalarField, scalar>(alphaEffName_);
|
||||
|
||||
// retrieve (constant) specific heat capacity from transport dictionary
|
||||
const turbulenceModel& turbulence =
|
||||
db().lookupObject<turbulenceModel>("turbulenceModel");
|
||||
const scalar Cp0(readScalar(turbulence.transport().lookup("Cp0")));
|
||||
const IOdictionary& transportProperties =
|
||||
db().lookupObject<IOdictionary>("transportProperties");
|
||||
const scalar Cp0(readScalar(transportProperties.lookup("Cp0")));
|
||||
|
||||
switch (heatSource_)
|
||||
{
|
||||
|
||||
@ -36,12 +36,12 @@ boundaryField
|
||||
type wedge;
|
||||
}
|
||||
|
||||
region0_to_panelRegion_left_face
|
||||
region0_to_panelRegion_fLeft_zone
|
||||
{
|
||||
type mappedField;
|
||||
sampleRegion region0;
|
||||
sampleMode nearestPatchFace;
|
||||
samplePatch region0_to_panelRegion_left_face;
|
||||
samplePatch region0_to_panelRegion_fLeft_zone;
|
||||
offset (0 0 0);
|
||||
fieldName Qr;
|
||||
setAverage no;
|
||||
@ -49,12 +49,12 @@ boundaryField
|
||||
value uniform 0;
|
||||
}
|
||||
|
||||
region0_to_panelRegion_right_face
|
||||
region0_to_panelRegion_fRight_zone
|
||||
{
|
||||
type mappedField;
|
||||
sampleRegion region0;
|
||||
sampleMode nearestPatchFace;
|
||||
samplePatch region0_to_panelRegion_right_face;
|
||||
samplePatch region0_to_panelRegion_fRight_zone;
|
||||
offset (0 0 0);
|
||||
fieldName Qr;
|
||||
setAverage no;
|
||||
|
||||
@ -23,15 +23,15 @@ absorptionEmissionModel greyMeanSolidAbsorptionEmission;
|
||||
|
||||
greyMeanSolidAbsorptionEmissionCoeffs
|
||||
{
|
||||
v
|
||||
wood
|
||||
{
|
||||
absorptivity 0.0; //opaque
|
||||
absorptivity 0.17;
|
||||
emissivity 0.17;
|
||||
}
|
||||
|
||||
char
|
||||
{
|
||||
absorptivity 0.0;
|
||||
absorptivity 0.85;
|
||||
emissivity 0.85;
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,8 +27,8 @@ FoamFile
|
||||
|
||||
reactingOneDimCoeffs
|
||||
{
|
||||
radFluxName Qr;
|
||||
|
||||
gasHSource false; //Energy source term due to pyrolysis gas
|
||||
QrHSource false; //Energy source term due in depht radiation
|
||||
minimumDelta 1e-12;
|
||||
|
||||
reactionDeltaMin 1e-12;
|
||||
|
||||
@ -16,7 +16,7 @@ FoamFile
|
||||
|
||||
application fireFoam;
|
||||
|
||||
startFrom latestTime;
|
||||
startFrom startTime;
|
||||
|
||||
startTime 0;
|
||||
|
||||
@ -28,7 +28,7 @@ deltaT 0.03;
|
||||
|
||||
writeControl adjustableRunTime;
|
||||
|
||||
writeInterval 0.5;
|
||||
writeInterval 0.1;
|
||||
|
||||
purgeWrite 0;
|
||||
|
||||
|
||||
@ -17,5 +17,8 @@ FoamFile
|
||||
// Include defaults parameters from master dictionary
|
||||
#include "$WM_PROJECT_DIR/etc/caseDicts/meshQualityDict"
|
||||
|
||||
//- minFaceWeight (0 -> 0.5)
|
||||
minFaceWeight 0.02;
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
Reference in New Issue
Block a user