Merge commit 'OpenCFD/master' into olesenm

This commit is contained in:
Mark Olesen
2009-12-15 10:48:51 +01:00
161 changed files with 4698 additions and 51200 deletions

View File

@ -122,7 +122,7 @@ Foam::dictionary::dictionary
const dictionary& dict
)
:
dictionaryName(parentDict.name() + "::" + dict.name()),
dictionaryName(dict.name()),
IDLList<entry>(dict, *this),
parent_(parentDict)
{
@ -489,7 +489,7 @@ Foam::dictionary Foam::dictionary::subOrEmptyDict
if (entryPtr == NULL)
{
return dictionary(*this, dictionary(keyword));
return dictionary(*this, dictionary(name() + "::" + keyword));
}
else
{

View File

@ -1461,7 +1461,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
getNeighbourData(distribution, sourceFace, sourceProc, sourceNewProc);
// Remove meshPhi. Since this would otherwise dissappear anyway
// Remove meshPhi. Since this would otherwise disappear anyway
// during topo changes and we have to guarantee that all the fields
// can be sent.
mesh_.clearOut();

View File

@ -54,7 +54,6 @@ SourceFiles
#define fvMeshDistribute_H
#include "Field.H"
#include "uLabel.H"
#include "fvMeshSubset.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -264,6 +264,10 @@ public:
" const face& f,\n"
" const label owner,"
" const label neighbour,\n"
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID"
")"
@ -292,6 +296,7 @@ public:
" const label masterPointID,\n"
" const label masterEdgeID,\n"
" const label masterFaceID,\n"
" const bool flipFaceFlux,\n"
" const label patchID,\n"
" const label zoneID,\n"
" const bool zoneFlip\n"

View File

@ -2207,6 +2207,7 @@ void Foam::polyTopoChange::addMesh
// Extend
points_.setCapacity(points_.size() + points.size());
pointMap_.setCapacity(pointMap_.size() + points.size());
reversePointMap_.setCapacity(reversePointMap_.size() + points.size());
pointZone_.resize(pointZone_.size() + points.size()/100);
// Precalc offset zones
@ -2246,6 +2247,7 @@ void Foam::polyTopoChange::addMesh
label nAllCells = mesh.nCells();
cellMap_.setCapacity(cellMap_.size() + nAllCells);
reverseCellMap_.setCapacity(reverseCellMap_.size() + nAllCells);
cellFromPoint_.resize(cellFromPoint_.size() + nAllCells/100);
cellFromEdge_.resize(cellFromEdge_.size() + nAllCells/100);
cellFromFace_.resize(cellFromFace_.size() + nAllCells/100);
@ -2310,6 +2312,7 @@ void Foam::polyTopoChange::addMesh
faceOwner_.setCapacity(faceOwner_.size() + nAllFaces);
faceNeighbour_.setCapacity(faceNeighbour_.size() + nAllFaces);
faceMap_.setCapacity(faceMap_.size() + nAllFaces);
reverseFaceMap_.setCapacity(reverseFaceMap_.size() + nAllFaces);
faceFromPoint_.resize(faceFromPoint_.size() + nAllFaces/100);
faceFromEdge_.resize(faceFromEdge_.size() + nAllFaces/100);
flipFaceFlux_.setCapacity(faces_.size() + nAllFaces);
@ -2394,6 +2397,39 @@ void Foam::polyTopoChange::addMesh
}
void Foam::polyTopoChange::setCapacity
(
const label nPoints,
const label nFaces,
const label nCells
)
{
points_.setCapacity(nPoints);
pointMap_.setCapacity(nPoints);
reversePointMap_.setCapacity(nPoints);
pointZone_.resize(pointZone_.size() + nPoints/100);
faces_.setCapacity(nFaces);
region_.setCapacity(nFaces);
faceOwner_.setCapacity(nFaces);
faceNeighbour_.setCapacity(nFaces);
faceMap_.setCapacity(nFaces);
reverseFaceMap_.setCapacity(nFaces);
faceFromPoint_.resize(faceFromPoint_.size() + nFaces/100);
faceFromEdge_.resize(faceFromEdge_.size() + nFaces/100);
flipFaceFlux_.setCapacity(nFaces);
faceZone_.resize(faceZone_.size() + nFaces/100);
faceZoneFlip_.setCapacity(nFaces);
cellMap_.setCapacity(nCells);
reverseCellMap_.setCapacity(nCells);
cellFromPoint_.resize(cellFromPoint_.size() + nCells/100);
cellFromEdge_.resize(cellFromEdge_.size() + nCells/100);
cellFromFace_.resize(cellFromFace_.size() + nCells/100);
cellZone_.setCapacity(nCells);
}
Foam::label Foam::polyTopoChange::setAction(const topoAction& action)
{
if (isType<polyAddPoint>(action))

View File

@ -472,6 +472,15 @@ public:
const labelList& cellZoneMap
);
//- Explicitly pre-size the dynamic storage for expected mesh
// size for if construct-without-mesh
void setCapacity
(
const label nPoints,
const label nFaces,
const label nCells
);
//- Move all points. Incompatible with other topology changes.
void movePoints(const pointField& newPoints);

View File

@ -339,7 +339,7 @@ void Foam::removeCells::setRefinement
faceI, // label of face being modified
nei, // owner
-1, // neighbour
false, // face flip
true, // face flip
newPatchID[faceI], // patch for face
false, // remove from zone
zoneID, // zone for face

View File

@ -137,8 +137,7 @@ class removeFaces
) const;
//- Return face with all pointsToRemove removed.
face filterFace(const labelHashSet& pointsToRemove, const label)
const;
face filterFace(const labelHashSet&, const label) const;
//- Wrapper for meshMod.modifyFace. Reverses face if own>nei.
void modFace

View File

@ -31,10 +31,5 @@ pointPatchFields/derived/oscillatingDisplacement/oscillatingDisplacementPointPat
pointPatchFields/derived/angularOscillatingDisplacement/angularOscillatingDisplacementPointPatchVectorField.C
pointPatchFields/derived/surfaceSlipDisplacement/surfaceSlipDisplacementPointPatchVectorField.C
pointPatchFields/derived/surfaceDisplacement/surfaceDisplacementPointPatchVectorField.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
LIB = $(FOAM_LIBBIN)/libfvMotionSolvers

View File

@ -10,4 +10,4 @@ LIB_LIBS = \
-lmeshTools \
-ldynamicMesh \
-lfiniteVolume \
-lforces
/*-lforces include in controlDict if needed */

View File

@ -176,7 +176,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
// Knock out any wedge component
scalarField offset(start.size(), 0.0);
if (wedgePlane_ >= 0 && wedgePlane_ <= vector::nComponents)
if (wedgePlane_ >= 0 && wedgePlane_ < vector::nComponents)
{
forAll(offset, i)
{
@ -262,7 +262,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
if (interPt.hit())
{
if (wedgePlane_ >= 0 && wedgePlane_ <= vector::nComponents)
if (wedgePlane_ >= 0 && wedgePlane_ < vector::nComponents)
{
interPt.rawPoint()[wedgePlane_] += offset[i];
}

View File

@ -344,7 +344,7 @@ void Foam::ReactingParcel<ParcelType>::calc
td.cloud().hcTrans()[cellI] +=
np0
*dMassPC[i]
*td.cloud().mcCarrierThermo().speciesData()[gid].H(T0);
*td.cloud().mcCarrierThermo().speciesData()[gid].Hc();
}
// Update momentum transfer
@ -423,6 +423,11 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
scalarField& Cs
)
{
typedef PhaseChangeModel
<
typename ReactingParcel<ParcelType>::trackData::cloudType
> phaseChangeModelType;
if
(
!td.cloud().phaseChange().active()
@ -464,17 +469,26 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const label idl = td.cloud().composition().globalIds(idPhase)[i];
const scalar hv = td.cloud().mcCarrierThermo().speciesData()[idc].H(Ts);
const scalar hl =
td.cloud().composition().liquids().properties()[idl].h(pc_, Ts);
if
(
td.cloud().phaseChange().enthalpyTransfer()
== phaseChangeModelType::etLatentHeat
)
{
scalar hlp =
td.cloud().composition().liquids().properties()[idl].hl(pc_, T);
// Enthalphy transfer to carrier phase - method 1 using enthalpy diff
Sh += dMassPC[i]*(hl - hv)/dt;
Sh -= dMassPC[i]*hlp/dt;
}
else
{
// Note: enthalpies of both phases must use the same reference
scalar hc = td.cloud().mcCarrierThermo().speciesData()[idc].H(T);
scalar hp =
td.cloud().composition().liquids().properties()[idl].h(pc_, T);
// Enthalphy transfer to carrier phase - method 2 using latent heat
// const scalar hl =
// td.cloud().composition().liquids().properties()[idl].hl(pc_, Ts);
// Sh -= dMassPC[i]*hl/dt;
Sh -= dMassPC[i]*(hc - hp)/dt;
}
// Update particle surface thermo properties
const scalar Dab =

View File

@ -136,6 +136,9 @@ public:
public:
typedef ReactingCloud<ParcelType> cloudType;
// Constructors
//- Construct from components

View File

@ -26,6 +26,48 @@ License
#include "PhaseChangeModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
const Foam::wordList Foam::PhaseChangeModel<CloudType>::
enthalpyTransferTypeNames
(
IStringStream
(
"("
"latentHeat "
"enthalpyDifference"
")"
)()
);
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class CloudType>
typename Foam::PhaseChangeModel<CloudType>::enthalpyTransferType
Foam::PhaseChangeModel<CloudType>::wordToEnthalpyTransfer(const word& etName)
const
{
forAll(enthalpyTransferTypeNames, i)
{
if (etName == enthalpyTransferTypeNames[i])
{
return enthalpyTransferType(i);
}
}
FatalErrorIn
(
"PhaseChangeModel<CloudType>::enthalpyTransferType"
"PhaseChangeModel<CloudType>::wordToEnthalpyTransfer(const word&) const"
) << "Unknown enthalpyType " << etName << ". Valid selections are:" << nl
<< enthalpyTransferTypeNames << exit(FatalError);
return enthalpyTransferType(0);
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
@ -36,7 +78,8 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
:
dict_(dictionary::null),
owner_(owner),
coeffDict_(dictionary::null)
coeffDict_(dictionary::null),
enthalpyTransfer_(etLatentHeat)
{}
@ -50,7 +93,11 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
:
dict_(dict),
owner_(owner),
coeffDict_(dict.subDict(type + "Coeffs"))
coeffDict_(dict.subDict(type + "Coeffs")),
enthalpyTransfer_
(
wordToEnthalpyTransfer(coeffDict_.lookup("enthalpyTransfer"))
)
{}
@ -83,6 +130,14 @@ const Foam::dictionary& Foam::PhaseChangeModel<CloudType>::coeffDict() const
}
template<class CloudType>
const typename Foam::PhaseChangeModel<CloudType>::enthalpyTransferType&
Foam::PhaseChangeModel<CloudType>::enthalpyTransfer() const
{
return enthalpyTransfer_;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "NewPhaseChangeModel.C"

View File

@ -53,6 +53,21 @@ namespace Foam
template<class CloudType>
class PhaseChangeModel
{
public:
// Public enumerations
//- Enthalpy transfer type
enum enthalpyTransferType
{
etLatentHeat,
etEnthalpyDifference
};
//- Name representations of enthalpy transfer types
static const Foam::wordList enthalpyTransferTypeNames;
protected:
// Protected data
@ -66,9 +81,15 @@ protected:
//- The coefficient dictionary
const dictionary coeffDict_;
//- Enthalpy transfer type enumeration
enthalpyTransferType enthalpyTransfer_;
// Protected member functions
//- Convert word to enthalpy transfer type
enthalpyTransferType wordToEnthalpyTransfer(const word& etName) const;
//- Sherwood number
scalar Sh() const;
@ -129,6 +150,9 @@ public:
//- Return the coefficient dictionary
const dictionary& coeffDict() const;
//- Return the enthalpy transfer type enumeration
const enthalpyTransferType& enthalpyTransfer() const;
// Member Functions

View File

@ -560,7 +560,11 @@ void Foam::autoRefineDriver::zonify
const_cast<Time&>(mesh.time())++;
}
meshRefiner_.zonify(refineParams.keepPoints()[0]);
meshRefiner_.zonify
(
refineParams.keepPoints()[0],
refineParams.allowFreeStandingZoneFaces()
);
if (debug)
{

View File

@ -44,6 +44,7 @@ Foam::refinementParameters::refinementParameters
curvature_(readScalar(dict.lookup("curvature"))),
nBufferLayers_(readLabel(dict.lookup("nBufferLayers"))),
keepPoints_(dict.lookup("keepPoints")),
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),
maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance",0))
{}
@ -55,6 +56,7 @@ Foam::refinementParameters::refinementParameters(const dictionary& dict)
minRefineCells_(readLabel(dict.lookup("minRefinementCells"))),
nBufferLayers_(readLabel(dict.lookup("nCellsBetweenLevels"))),
keepPoints_(pointField(1, dict.lookup("locationInMesh"))),
allowFreeStandingZoneFaces_(dict.lookup("allowFreeStandingZoneFaces")),
maxLoadUnbalance_(dict.lookupOrDefault<scalar>("maxLoadUnbalance",0))
{
scalar featAngle(readScalar(dict.lookup("resolveFeatureAngle")));

View File

@ -38,6 +38,7 @@ SourceFiles
#include "dictionary.H"
#include "pointField.H"
#include "Switch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -73,6 +74,10 @@ class refinementParameters
//- Areas to keep
const pointField keepPoints_;
//- FaceZone faces allowed which have owner and neighbour in same
// cellZone?
Switch allowFreeStandingZoneFaces_;
//- Allowed load unbalance
scalar maxLoadUnbalance_;
@ -137,6 +142,13 @@ public:
return keepPoints_;
}
//- Are zone faces allowed only inbetween different cell zones
// or also just free standing?
bool allowFreeStandingZoneFaces() const
{
return allowFreeStandingZoneFaces_;
}
//- Allowed load unbalance
scalar maxLoadUnbalance() const
{

View File

@ -704,7 +704,11 @@ public:
//- Put faces/cells into zones according to surface specification.
// Returns null if no zone surfaces present. Region containing
// the keepPoint will not be put into a cellZone.
autoPtr<mapPolyMesh> zonify(const point& keepPoint);
autoPtr<mapPolyMesh> zonify
(
const point& keepPoint,
const bool allowFreeStandingZoneFaces
);
// Other topo changes

View File

@ -2032,7 +2032,8 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::dupNonManifoldPoints()
// Zoning
Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
(
const point& keepPoint
const point& keepPoint,
const bool allowFreeStandingZoneFaces
)
{
const wordList& cellZoneNames = surfaces_.cellZoneNames();
@ -2344,9 +2345,11 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
}
//// Make sure namedSurfaceIndex is unset inbetween same cell cell zones.
//makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
// Make sure namedSurfaceIndex is unset inbetween same cell cell zones.
if (!allowFreeStandingZoneFaces)
{
makeConsistentFaceIndex(cellToZone, namedSurfaceIndex);
}
// Topochange container
polyTopoChange meshMod(mesh_);
@ -2440,7 +2443,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
}
else if (ownZone == neiZone)
{
// Can only happen for coupled boundaries. Keep master
// Free-standing zone face or coupled boundary. Keep master
// face unflipped.
flip = !isMasterFace[faceI];
}

View File

@ -291,7 +291,7 @@ public:
(
const labelList& surfacesToTest,
const pointField& samples,
const scalarField& nearestDistSqr,
const scalarField& nearestDistSqr,
labelList& hitSurface,
labelList& hitRegion
) const;

View File

@ -218,6 +218,69 @@ bool Foam::triSurfaceMesh::isSurfaceClosed() const
}
// Gets all intersections after initial one. Adds smallVec and starts tracking
// from there.
void Foam::triSurfaceMesh::getNextIntersections
(
const indexedOctree<treeDataTriSurface>& octree,
const point& start,
const point& end,
const vector& smallVec,
DynamicList<pointIndexHit, 1, 1>& hits
)
{
const vector dirVec(end-start);
const scalar magSqrDirVec(magSqr(dirVec));
// Initial perturbation amount
vector perturbVec(smallVec);
while (true)
{
// Start tracking from last hit.
point pt = hits[hits.size()-1].hitPoint() + perturbVec;
if (((pt-start)&dirVec) > magSqrDirVec)
{
return;
}
// See if any intersection between pt and end
pointIndexHit inter = octree.findLine(pt, end);
if (!inter.hit())
{
return;
}
// Check if already found this intersection
bool duplicateHit = false;
forAllReverse(hits, i)
{
if (hits[i].index() == inter.index())
{
duplicateHit = true;
break;
}
}
if (duplicateHit)
{
// Hit same triangle again. Increase perturbVec and try again.
perturbVec *= 2;
}
else
{
// Proper hit
hits.append(inter);
// Restore perturbVec
perturbVec = smallVec;
}
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const triSurface& s)
@ -620,27 +683,14 @@ void Foam::triSurfaceMesh::findLineAll
hits.clear();
hits.append(inter);
point pt = inter.hitPoint() + smallVec[pointI];
while (((pt-start[pointI])&dirVec[pointI]) <= magSqrDirVec[pointI])
{
// See if any intersection between pt and end
pointIndexHit inter = octree.findLine(pt, end[pointI]);
// Check for not hit or hit same triangle as before (can happen
// if vector along surface of triangle)
if
(
!inter.hit()
|| (inter.index() == hits.last().index())
)
{
break;
}
hits.append(inter);
pt = inter.hitPoint() + smallVec[pointI];
}
getNextIntersections
(
octree,
start[pointI],
end[pointI],
smallVec[pointI],
hits
);
info[pointI].transfer(hits);
}

View File

@ -111,6 +111,17 @@ private:
// addressing.
bool isSurfaceClosed() const;
//- Steps to next intersection. Adds smallVec and starts tracking
// from there.
static void getNextIntersections
(
const indexedOctree<treeDataTriSurface>& octree,
const point& start,
const point& end,
const vector& smallVec,
DynamicList<pointIndexHit, 1, 1>& hits
);
//- Disallow default bitwise copy construct
triSurfaceMesh(const triSurfaceMesh&);

View File

@ -4,4 +4,10 @@ forces/forcesFunctionObject.C
forceCoeffs/forceCoeffs.C
forceCoeffs/forceCoeffsFunctionObject.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyDisplacementPointPatchVectorField.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotion.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionIO.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionState.C
pointPatchFields/derived/sixDoFRigidBodyDisplacement/sixDoFRigidBodyMotion/sixDoFRigidBodyMotionStateIO.C
LIB = $(FOAM_LIBBIN)/libforces

View File

@ -449,7 +449,7 @@ template<class CompType, class ThermoType>
Foam::tmp<Foam::volScalarField>
Foam::ODEChemistryModel<CompType, ThermoType>::tc() const
{
scalar pf,cf,pr,cr;
scalar pf, cf, pr, cr;
label lRef, rRef;
const volScalarField rho

View File

@ -81,7 +81,7 @@ greyDiffusiveRadiationMixedFvPatchScalarField
TName_(dict.lookup("T")),
emissivity_(readScalar(dict.lookup("emissivity")))
{
if (dict.found("value"))
if (dict.found("refValue"))
{
fvPatchScalarField::operator=
(

View File

@ -39,7 +39,9 @@ icoPolynomial<PolySize>::icoPolynomial(Istream& is)
:
specie(is),
rhoPolynomial_("rhoPolynomial", is)
{}
{
rhoPolynomial_ *= this->W();
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
@ -47,7 +49,8 @@ icoPolynomial<PolySize>::icoPolynomial(Istream& is)
template<int PolySize>
Ostream& operator<<(Ostream& os, const icoPolynomial<PolySize>& ip)
{
os << static_cast<const specie&>(ip);
os << static_cast<const specie&>(ip) << tab
<< "rhoPolynomial" << tab << ip.rhoPolynomial_/ip.W();
os.check
(

View File

@ -99,7 +99,8 @@ class icoPolynomial
{
// Private data
//- Density [kg/m^3]
//- Density
// Note: input in [kg/m3], but internally uses [kg/m3/kmol]
Polynomial<PolySize> rhoPolynomial_;
@ -117,6 +118,9 @@ public:
//- Construct from Istream
icoPolynomial(Istream&);
//- Construct as copy
inline icoPolynomial(const icoPolynomial&);
//- Construct as named copy
inline icoPolynomial(const word& name, const icoPolynomial&);
@ -141,6 +145,7 @@ public:
// Member operators
inline icoPolynomial& operator=(const icoPolynomial&);
inline void operator+=(const icoPolynomial&);
inline void operator-=(const icoPolynomial&);

View File

@ -42,6 +42,17 @@ inline Foam::icoPolynomial<PolySize>::icoPolynomial
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<int PolySize>
inline Foam::icoPolynomial<PolySize>::icoPolynomial
(
const icoPolynomial<PolySize>& ip
)
:
specie(ip),
rhoPolynomial_(ip.rhoPolynomial_)
{}
template<int PolySize>
inline Foam::icoPolynomial<PolySize>::icoPolynomial
(
@ -78,7 +89,7 @@ Foam::icoPolynomial<PolySize>::New(Istream& is)
template<int PolySize>
inline Foam::scalar Foam::icoPolynomial<PolySize>::rho(scalar, scalar T) const
{
return rhoPolynomial_.evaluate(T);
return rhoPolynomial_.evaluate(T)/this->W();
}
@ -98,6 +109,20 @@ inline Foam::scalar Foam::icoPolynomial<PolySize>::Z(scalar, scalar) const
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<int PolySize>
inline Foam::icoPolynomial<PolySize>& Foam::icoPolynomial<PolySize>::operator=
(
const icoPolynomial<PolySize>& ip
)
{
specie::operator=(ip);
rhoPolynomial_ = ip.rhoPolynomial_;
return *this;
}
template<int PolySize>
inline void Foam::icoPolynomial<PolySize>::operator+=
(
@ -122,6 +147,7 @@ inline void Foam::icoPolynomial<PolySize>::operator-=
)
{
scalar molr1 = this->nMoles();
specie::operator-=(ip);
molr1 /= this->nMoles();
@ -147,15 +173,15 @@ Foam::icoPolynomial<PolySize> Foam::operator+
const icoPolynomial<PolySize>& ip2
)
{
scalar mol1 = ip1.nMoles();
scalar mol2 = ip2.nMoles();
scalar nMoles = mol1 + mol2;
scalar nMoles = ip1.nMoles() + ip2.nMoles();
scalar molr1 = ip1.nMoles()/nMoles;
scalar molr2 = ip2.nMoles()/nMoles;
return icoPolynomial<PolySize>
(
static_cast<const specie&>(ip1)
+ static_cast<const specie&>(ip2),
(mol1/nMoles)*ip1.rhoPolynomial_ + (mol2/nMoles)*ip2.rhoPolynomial_
molr1*ip1.rhoPolynomial_ + molr2*ip2.rhoPolynomial_
);
}
@ -167,15 +193,15 @@ Foam::icoPolynomial<PolySize> Foam::operator-
const icoPolynomial<PolySize>& ip2
)
{
scalar mol1 = ip1.nMoles();
scalar mol2 = ip2.nMoles();
scalar nMoles = mol1 + mol2;
scalar nMoles = ip1.nMoles() + ip2.nMoles();
scalar molr1 = ip1.nMoles()/nMoles;
scalar molr2 = ip2.nMoles()/nMoles;
return icoPolynomial<PolySize>
(
static_cast<const specie&>(ip1)
- static_cast<const specie&>(ip2),
(mol1/nMoles)*ip1.rhoPolynomial_ - (mol2/nMoles)*ip2.rhoPolynomial_
molr1*ip1.rhoPolynomial_ - molr2*ip2.rhoPolynomial_
);
}

View File

@ -54,7 +54,6 @@ inline specie::specie
const scalar molWeight
)
:
//name_(),
nMoles_(nMoles),
molWeight_(molWeight)
{}
@ -113,29 +112,29 @@ inline void specie::operator=(const specie& st)
inline void specie::operator+=(const specie& st)
{
scalar sumNmoles_ = max(nMoles_ + st.nMoles_, SMALL);
scalar sumNmoles = max(nMoles_ + st.nMoles_, SMALL);
molWeight_ =
nMoles_/sumNmoles_*molWeight_
+ st.nMoles_/sumNmoles_*st.molWeight_;
nMoles_/sumNmoles*molWeight_
+ st.nMoles_/sumNmoles*st.molWeight_;
nMoles_ = sumNmoles_;
nMoles_ = sumNmoles;
}
inline void specie::operator-=(const specie& st)
{
scalar diffnMoles_ = nMoles_ - st.nMoles_;
if (mag(diffnMoles_) < SMALL)
scalar diffnMoles = nMoles_ - st.nMoles_;
if (mag(diffnMoles) < SMALL)
{
diffnMoles_ = SMALL;
diffnMoles = SMALL;
}
molWeight_ =
nMoles_/diffnMoles_*molWeight_
- st.nMoles_/diffnMoles_*st.molWeight_;
nMoles_/diffnMoles*molWeight_
- st.nMoles_/diffnMoles*st.molWeight_;
nMoles_ = diffnMoles_;
nMoles_ = diffnMoles;
}
@ -149,30 +148,30 @@ inline void specie::operator*=(const scalar s)
inline specie operator+(const specie& st1, const specie& st2)
{
scalar sumNmoles_ = max(st1.nMoles_ + st2.nMoles_, SMALL);
scalar sumNmoles = max(st1.nMoles_ + st2.nMoles_, SMALL);
return specie
(
sumNmoles_,
st1.nMoles_/sumNmoles_*st1.molWeight_
+ st2.nMoles_/sumNmoles_*st2.molWeight_
sumNmoles,
st1.nMoles_/sumNmoles*st1.molWeight_
+ st2.nMoles_/sumNmoles*st2.molWeight_
);
}
inline specie operator-(const specie& st1, const specie& st2)
{
scalar diffNmoles_ = st1.nMoles_ - st2.nMoles_;
if (mag(diffNmoles_) < SMALL)
scalar diffNmoles = st1.nMoles_ - st2.nMoles_;
if (mag(diffNmoles) < SMALL)
{
diffNmoles_ = SMALL;
diffNmoles = SMALL;
}
return specie
(
diffNmoles_,
st1.nMoles_/diffNmoles_*st1.molWeight_
- st2.nMoles_/diffNmoles_*st2.molWeight_
diffNmoles,
st1.nMoles_/diffNmoles*st1.molWeight_
- st2.nMoles_/diffNmoles*st2.molWeight_
);
}

View File

@ -39,11 +39,21 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Hf_(readScalar(is)),
Sf_(readScalar(is)),
cpPolynomial_("cpPolynomial", is),
dhPolynomial_(cpPolynomial_.integrate()),
dsPolynomial_(cpPolynomial_.integrateMinus1())
hPolynomial_(),
sPolynomial_()
{
// Offset dh poly so that it is relative to the enthalpy at Tstd
dhPolynomial_[0] -= dhPolynomial_.evaluate(specie::Tstd);
Hf_ *= this->W();
Sf_ *= this->W();
cpPolynomial_ *= this->W();
hPolynomial_ = cpPolynomial_.integrate();
sPolynomial_ = cpPolynomial_.integrateMinus1();
// Offset h poly so that it is relative to the enthalpy at Tstd
hPolynomial_[0] += Hf_ - hPolynomial_.evaluate(specie::Tstd);
// Offset s poly so that it is relative to the entropy at Tstd
sPolynomial_[0] += Sf_ - sPolynomial_.evaluate(specie::Tstd);
}
@ -57,15 +67,17 @@ Foam::Ostream& Foam::operator<<
)
{
os << static_cast<const EquationOfState&>(pt) << tab
<< pt.Hf_ << tab
<< pt.Hf_/pt.W() << tab
<< pt.Sf_ << tab
<< pt.cpPolynomial_ << tab
<< pt.dhPolynomial_ << tab
<< pt.dsPolynomial;
<< "cpPolynomial" << tab << pt.cpPolynomial_/pt.W();
os.check
(
"operator<<(Ostream& os, const hPolynomialThermo<EquationOfState>& pt)"
"operator<<"
"("
"Ostream&, "
"const hPolynomialThermo<EquationOfState, PolySize>&"
")"
);
return os;

View File

@ -100,20 +100,22 @@ class hPolynomialThermo
{
// Private data
//- Heat of formation [J/kg]
//- Heat of formation
// Note: input in [J/kg], but internally uses [J/kmol]
scalar Hf_;
//- Standard entropy [J/(kg.K)]
//- Standard entropy
// Note: input in [J/kg/K], but internally uses [J/kmol/K]
scalar Sf_;
//- Specific heat at constant pressure [J/(kg.K)]
Polynomial<PolySize> cpPolynomial_;
//- Enthalpy - derived from cp [J/kg] - relative to Tstd
typename Polynomial<PolySize>::intPolyType dhPolynomial_;
typename Polynomial<PolySize>::intPolyType hPolynomial_;
//- Entropy - derived from cp [J/(kg.K)]
Polynomial<PolySize> dsPolynomial_;
//- Entropy - derived from cp [J/(kg.K)] - relative to Tstd
Polynomial<PolySize> sPolynomial_;
// Private member functions
@ -125,8 +127,8 @@ class hPolynomialThermo
const scalar Hf,
const scalar Sf,
const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& dhPoly,
const Polynomial<PolySize>& dsPoly
const typename Polynomial<PolySize>::intPolyType& hPoly,
const Polynomial<PolySize>& sPoly
);
@ -137,6 +139,9 @@ public:
//- Construct from dictionary
hPolynomialThermo(Istream& is);
//- Construct as copy
inline hPolynomialThermo(const hPolynomialThermo&);
//- Construct as a named copy
inline hPolynomialThermo(const word&, const hPolynomialThermo&);
@ -161,8 +166,10 @@ public:
// Member operators
inline hPolynomialThermo& operator=(const hPolynomialThermo&);
inline void operator+=(const hPolynomialThermo&);
inline void operator-=(const hPolynomialThermo&);
inline void operator*=(const scalar);
// Friend operators

View File

@ -35,21 +35,36 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
const scalar Hf,
const scalar Sf,
const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& dhPoly,
const Polynomial<PolySize>& dsPoly
const typename Polynomial<PolySize>::intPolyType& hPoly,
const Polynomial<PolySize>& sPoly
)
:
EquationOfState(pt),
Hf_(Hf),
Sf_(Sf),
cpPolynomial_(cpPoly),
dhPolynomial_(dhPoly),
dsPolynomial_(dsPoly)
hPolynomial_(hPoly),
sPolynomial_(sPoly)
{}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class EquationOfState, int PolySize>
inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
(
const hPolynomialThermo& pt
)
:
EquationOfState(pt),
Hf_(pt.Hf_),
Sf_(pt.Sf_),
cpPolynomial_(pt.cpPolynomial_),
hPolynomial_(pt.hPolynomial_),
sPolynomial_(pt.sPolynomial_)
{}
template<class EquationOfState, int PolySize>
inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
(
@ -61,8 +76,8 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Hf_(pt.Hf_),
Sf_(pt.Sf_),
cpPolynomial_(pt.cpPolynomial_),
dhPolynomial_(pt.dhPolynomial_),
dsPolynomial_(pt.dsPolynomial_)
hPolynomial_(pt.hPolynomial_),
sPolynomial_(pt.sPolynomial_)
{}
@ -74,7 +89,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::cp
const scalar T
) const
{
return cpPolynomial_.evaluate(T)*this->W();
return cpPolynomial_.evaluate(T);
}
@ -84,7 +99,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::h
const scalar T
) const
{
return (dhPolynomial_.evaluate(T) + Hf_)*this->W();
return hPolynomial_.evaluate(T);
}
@ -94,7 +109,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::hs
const scalar T
) const
{
return dhPolynomial_.evaluate(T)*this->W();
return h(T) - hc();
}
@ -102,7 +117,7 @@ template<class EquationOfState, int PolySize>
inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::hc()
const
{
return Hf_*this->W();
return Hf_;
}
@ -112,12 +127,31 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s
const scalar T
) const
{
return (dsPolynomial_.evaluate(T) + Sf_)*this->W();
return sPolynomial_.evaluate(T);
}
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
template<class EquationOfState, int PolySize>
inline Foam::hPolynomialThermo<EquationOfState, PolySize>&
Foam::hPolynomialThermo<EquationOfState, PolySize>::operator=
(
const hPolynomialThermo<EquationOfState, PolySize>& pt
)
{
EquationOfState::operator=(pt);
Hf_ = pt.Hf_;
Sf_ = pt.Sf_;
cpPolynomial_ = pt.cpPolynomial_;
hPolynomial_ = pt.hPolynomial_;
sPolynomial_ = pt.sPolynomial_;
return *this;
}
template<class EquationOfState, int PolySize>
inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator+=
(
@ -134,8 +168,8 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator+=
Hf_ = molr1*Hf_ + molr2*pt.Hf_;
Sf_ = molr1*Sf_ + molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_;
dhPolynomial_ = molr1*dhPolynomial_ + molr2*pt.dhPolynomial_;
dsPolynomial_ = molr1*dsPolynomial_ + molr2*pt.dsPolynomial_;
hPolynomial_ = molr1*hPolynomial_ + molr2*pt.hPolynomial_;
sPolynomial_ = molr1*sPolynomial_ + molr2*pt.sPolynomial_;
}
@ -155,8 +189,18 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator-=
Hf_ = molr1*Hf_ - molr2*pt.Hf_;
Sf_ = molr1*Sf_ - molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_;
dhPolynomial_ = molr1*dhPolynomial_ - molr2*pt.dhPolynomial_;
dsPolynomial_ = molr1*dsPolynomial_ - molr2*pt.dsPolynomial_;
hPolynomial_ = molr1*hPolynomial_ - molr2*pt.hPolynomial_;
sPolynomial_ = molr1*sPolynomial_ - molr2*pt.sPolynomial_;
}
template<class EquationOfState, int PolySize>
inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator*=
(
const scalar s
)
{
EquationOfState::operator*=(s);
}
@ -169,22 +213,20 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator+
const hPolynomialThermo<EquationOfState, PolySize>& pt2
)
{
EquationOfState eofs
(
static_cast<const EquationOfState&>(pt1)
+ static_cast<const EquationOfState&>(pt2)
);
EquationOfState eofs = pt1;
eofs += pt2;
scalar molr1 = pt1.nMoles()/eofs.nMoles();
scalar molr2 = pt2.nMoles()/eofs.nMoles();
return hPolynomialThermo<EquationOfState, PolySize>
(
eofs,
molr1*pt1.Hf_ + molr2*pt2.Hf_,
molr1*pt1.Sf_ + molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_,
molr1*pt1.dhPolynomial_ + molr2*pt2.dhPolynomial_,
molr1*pt1.dsPolynomial_ + molr2*pt2.dsPolynomial_
molr1*pt1.hPolynomial_ + molr2*pt2.hPolynomial_,
molr1*pt1.sPolynomial_ + molr2*pt2.sPolynomial_
);
}
@ -196,22 +238,20 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator-
const hPolynomialThermo<EquationOfState, PolySize>& pt2
)
{
EquationOfState eofs
(
static_cast<const EquationOfState&>(pt1)
- static_cast<const EquationOfState&>(pt2)
);
EquationOfState eofs = pt1;
eofs -= pt2;
scalar molr1 = pt1.nMoles()/eofs.nMoles();
scalar molr2 = pt2.nMoles()/eofs.nMoles();
return hPolynomialThermo<EquationOfState, PolySize>
(
eofs,
molr1*pt1.Hf_ - molr2*pt2.Hf_,
molr1*pt1.Sf_ - molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_,
molr1*pt1.dhPolynomial_ - molr2*pt2.dhPolynomial_,
molr1*pt1.dsPolynomial_ - molr2*pt2.dsPolynomial_
molr1*pt1.hPolynomial_ - molr2*pt2.hPolynomial_,
molr1*pt1.sPolynomial_ - molr2*pt2.sPolynomial_
);
}
@ -229,8 +269,8 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator*
pt.Hf_,
pt.Sf_,
pt.cpPolynomial_,
pt.dhPolynomial_,
pt.dsPolynomial_
pt.hPolynomial_,
pt.sPolynomial_
);
}

View File

@ -303,6 +303,7 @@ inline void Foam::specieThermo<thermo>::operator+=
thermo::operator+=(st);
}
template<class thermo>
inline void Foam::specieThermo<thermo>::operator-=
(
@ -312,6 +313,7 @@ inline void Foam::specieThermo<thermo>::operator-=
thermo::operator-=(st);
}
template<class thermo>
inline void Foam::specieThermo<thermo>::operator*=(const scalar s)
{

View File

@ -35,7 +35,10 @@ Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport(Istream& is)
Thermo(is),
muPolynomial_("muPolynomial", is),
kappaPolynomial_("kappaPolynomial", is)
{}
{
muPolynomial_ *= this->W();
kappaPolynomial_ *= this->W();
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
@ -47,7 +50,9 @@ Foam::Ostream& Foam::operator<<
const polynomialTransport<Thermo, PolySize>& pt
)
{
os << static_cast<const Thermo&>(pt);
os << static_cast<const Thermo&>(pt) << tab
<< "muPolynomial" << tab << pt.muPolynomial_/pt.W() << tab
<< "kappaPolynomial" << tab << pt.kappaPolynomial_/pt.W();
os.check
(

View File

@ -96,9 +96,11 @@ class polynomialTransport
// Private data
//- Dynamic viscosity
// Note: input in [Pa.s], but internally uses [Pa.s/kmol]
Polynomial<PolySize> muPolynomial_;
//- Thermal conductivity
// Note: input in [W/m/K], but internally uses [W/m/K/kmol]
Polynomial<PolySize> kappaPolynomial_;
@ -117,6 +119,9 @@ public:
// Constructors
//- Construct copy
inline polynomialTransport(const polynomialTransport&);
//- Construct as named copy
inline polynomialTransport(const word&, const polynomialTransport&);
@ -148,6 +153,9 @@ public:
// Member operators
inline polynomialTransport& operator=(const polynomialTransport&);
inline void operator+=(const polynomialTransport&);
inline void operator-=(const polynomialTransport&);
inline void operator*=(const scalar);
// Friend operators

View File

@ -28,6 +28,18 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
(
const polynomialTransport& pt
)
:
Thermo(pt),
muPolynomial_(pt.muPolynomial_),
kappaPolynomial_(pt.kappaPolynomial_)
{}
template<class Thermo, int PolySize>
inline Foam::polynomialTransport<Thermo, PolySize>::polynomialTransport
(
@ -85,7 +97,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::mu
const scalar T
) const
{
return muPolynomial_.evaluate(T);
return muPolynomial_.evaluate(T)/this->W();
}
@ -95,7 +107,7 @@ inline Foam::scalar Foam::polynomialTransport<Thermo, PolySize>::kappa
const scalar T
) const
{
return kappaPolynomial_.evaluate(T);
return kappaPolynomial_.evaluate(T)/this->W();
}
@ -132,6 +144,52 @@ Foam::polynomialTransport<Thermo, PolySize>::operator=
}
template<class Thermo, int PolySize>
inline void Foam::polynomialTransport<Thermo, PolySize>::operator+=
(
const polynomialTransport<Thermo, PolySize>& pt
)
{
scalar molr1 = this->nMoles();
Thermo::operator+=(pt);
molr1 /= this->nMoles();
scalar molr2 = pt.nMoles()/this->nMoles();
muPolynomial_ = molr1*muPolynomial_ + molr2*pt.muPolynomial_;
kappaPolynomial_ = molr1*kappaPolynomial_ + molr2*pt.kappaPolynomial_;
}
template<class Thermo, int PolySize>
inline void Foam::polynomialTransport<Thermo, PolySize>::operator-=
(
const polynomialTransport<Thermo, PolySize>& pt
)
{
scalar molr1 = this->nMoles();
Thermo::operator-=(pt);
molr1 /= this->nMoles();
scalar molr2 = pt.nMoles()/this->nMoles();
muPolynomial_ = molr1*muPolynomial_ - molr2*pt.muPolynomial_;
kappaPolynomial_ = molr1*kappaPolynomial_ - molr2*pt.kappaPolynomial_;
}
template<class Thermo, int PolySize>
inline void Foam::polynomialTransport<Thermo, PolySize>::operator*=
(
const scalar s
)
{
Thermo::operator*=(s);
}
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
template<class Thermo, int PolySize>
@ -146,7 +204,6 @@ inline Foam::polynomialTransport<Thermo, PolySize> Foam::operator+
static_cast<const Thermo&>(pt1) + static_cast<const Thermo&>(pt2)
);
scalar molr1 = pt1.nMoles()/t.nMoles();
scalar molr2 = pt2.nMoles()/t.nMoles();

View File

@ -161,7 +161,18 @@ LaunderSharmaKE::LaunderSharmaKE
mesh_
),
mut_(rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_)),
mut_
(
IOobject
(
"mut",
runTime_.timeName(),
mesh_,
IOobject::MUST_READ,
IOobject::AUTO_WRITE
),
rho_*Cmu_*fMu()*sqr(k_)/(epsilon_ + epsilonSmall_)
),
alphat_
(

View File

@ -79,6 +79,7 @@ void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl;
}
@ -95,6 +96,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
beta1_(0.075),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
@ -115,6 +117,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
beta1_(ptf.beta1_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
@ -133,6 +136,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
@ -149,6 +153,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
beta1_(owfpsf.beta1_),
yPlusLam_(owfpsf.yPlusLam_)
{
checkType();
@ -166,6 +171,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
beta1_(owfpsf.beta1_),
yPlusLam_(owfpsf.yPlusLam_)
{
@ -222,7 +228,11 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
Cmu25*y[faceI]*sqrt(k[faceCellI])
/(muw[faceI]/rhow[faceI]);
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
scalar omegaVis = 6.0*muw[faceI]/(rhow[faceI]*beta1_*sqr(y[faceI]));
scalar omegaLog = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
omega[faceCellI] = sqrt(sqr(omegaVis) + sqr(omegaLog));
if (yPlus > yPlusLam_)
{

View File

@ -26,7 +26,23 @@ Class
Foam::compressible::RASModels::omegaWallFunctionFvPatchScalarField
Description
Replaces functionality in wallFunctionsI.H
Provides a wall function boundary condition/constraint on omega
Computed value is:
omega = sqrt(omega_vis^2 + omega_log^2)
where
omega_vis = omega in viscous region
omega_log = omega in logarithmic region
Model described by Eq.(15) of:
@verbatim
Menter, F., Esch, T.
"Elements of Industrial Heat Transfer Prediction"
16th Brazilian Congress of Mechanical Engineering (COBEM),
Nov. 2001
@endverbatim
SourceFiles
omegaWallFunctionFvPatchScalarField.C
@ -71,6 +87,9 @@ protected:
//- E coefficient
scalar E_;
//- beta1 coefficient
scalar beta1_;
//- Y+ at the edge of the laminar sublayer
scalar yPlusLam_;

View File

@ -79,6 +79,7 @@ void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
os.writeKeyword("beta1") << beta1_ << token::END_STATEMENT << nl;
}
@ -95,6 +96,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(0.09),
kappa_(0.41),
E_(9.8),
beta1_(0.075),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
@ -114,6 +116,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(ptf.Cmu_),
kappa_(ptf.kappa_),
E_(ptf.E_),
beta1_(ptf.beta1_),
yPlusLam_(ptf.yPlusLam_)
{
checkType();
@ -132,6 +135,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
beta1_(dict.lookupOrDefault<scalar>("beta1", 0.075)),
yPlusLam_(calcYPlusLam(kappa_, E_))
{
checkType();
@ -148,6 +152,7 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
beta1_(owfpsf.beta1_),
yPlusLam_(owfpsf.yPlusLam_)
{
checkType();
@ -165,8 +170,8 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
Cmu_(owfpsf.Cmu_),
kappa_(owfpsf.kappa_),
E_(owfpsf.E_),
beta1_(owfpsf.beta1_),
yPlusLam_(owfpsf.yPlusLam_)
{
checkType();
}
@ -217,7 +222,11 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
scalar yPlus = Cmu25*y[faceI]*sqrt(k[faceCellI])/nuw[faceI];
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
scalar omegaVis = 6.0*nuw[faceI]/(beta1_*sqr(y[faceI]));
scalar omegaLog = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
omega[faceCellI] = sqrt(sqr(omegaVis) + sqr(omegaLog));
if (yPlus > yPlusLam_)
{

View File

@ -26,7 +26,23 @@ Class
Foam::incompressible::RASModels::omegaWallFunctionFvPatchScalarField
Description
Replaces functionality in wallFunctionsI.H
Provides a wall function boundary condition/constraint on omega
Computed value is:
omega = sqrt(omega_vis^2 + omega_log^2)
where
omega_vis = omega in viscous region
omega_log = omega in logarithmic region
Model described by Eq.(15) of:
@verbatim
Menter, F., Esch, T.
"Elements of Industrial Heat Transfer Prediction"
16th Brazilian Congress of Mechanical Engineering (COBEM),
Nov. 2001
@endverbatim
SourceFiles
omegaWallFunctionFvPatchScalarField.C
@ -71,6 +87,9 @@ protected:
//- E coefficient
scalar E_;
//- beta1 coefficient
scalar beta1_;
//- Y+ at the edge of the laminar sublayer
scalar yPlusLam_;