mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-12-28 03:37:59 +00:00
Merge branch 'master' of /home/noisy2/OpenFOAM/OpenFOAM-dev/
This commit is contained in:
@ -183,6 +183,12 @@ label findLower
|
||||
);
|
||||
|
||||
|
||||
//- To construct a List from a C array. Has extra Container type
|
||||
// to initialise e.g. wordList from arrays of char*.
|
||||
template<class Container, class T, int nRows>
|
||||
List<Container> initList(const T[nRows]);
|
||||
|
||||
|
||||
//- To construct a (square) ListList from a C array. Has extra Container type
|
||||
// to initialise e.g. faceList from arrays of labels.
|
||||
template<class Container, class T, int nRows, int nColumns>
|
||||
|
||||
@ -486,6 +486,19 @@ Foam::label Foam::findLower
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class T, int nRows>
|
||||
Foam::List<Container> Foam::initList(const T elems[nRows])
|
||||
{
|
||||
List<Container> faces(nRows);
|
||||
|
||||
forAll(faces, faceI)
|
||||
{
|
||||
faces[faceI] = Container(elems[faceI]);
|
||||
}
|
||||
return faces;
|
||||
}
|
||||
|
||||
|
||||
template<class Container, class T, int nRows, int nColumns>
|
||||
Foam::List<Container> Foam::initListList(const T elems[nRows][nColumns])
|
||||
{
|
||||
|
||||
@ -10,7 +10,6 @@ $(autoHexMesh)/meshRefinement/meshRefinement.C
|
||||
$(autoHexMesh)/meshRefinement/meshRefinementMerge.C
|
||||
$(autoHexMesh)/meshRefinement/meshRefinementRefine.C
|
||||
$(autoHexMesh)/refinementSurfaces/refinementSurfaces.C
|
||||
$(autoHexMesh)/offsetTriSurfaceMesh/offsetTriSurfaceMesh.C
|
||||
$(autoHexMesh)/trackedParticle/trackedParticle.C
|
||||
$(autoHexMesh)/trackedParticle/trackedParticleCloud.C
|
||||
|
||||
|
||||
@ -1,199 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "offsetTriSurfaceMesh.H"
|
||||
#include "Random.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "triSurfaceTools.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
defineTypeNameAndDebug(offsetTriSurfaceMesh, 0);
|
||||
addToRunTimeSelectionTable(searchableSurface, offsetTriSurfaceMesh, dict);
|
||||
|
||||
}
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const triSurface& s,
|
||||
const scalar offset)
|
||||
:
|
||||
triSurfaceMesh(io, s),
|
||||
offset_(offset)
|
||||
{}
|
||||
|
||||
|
||||
Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh
|
||||
(
|
||||
const IOobject& io,
|
||||
const scalar offset
|
||||
)
|
||||
:
|
||||
triSurfaceMesh(io),
|
||||
offset_(offset)
|
||||
{}
|
||||
|
||||
|
||||
Foam::offsetTriSurfaceMesh::offsetTriSurfaceMesh
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obj,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
triSurfaceMesh(name, obj, dict),
|
||||
offset_(readScalar(dict.lookup("offset")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::offsetTriSurfaceMesh::~offsetTriSurfaceMesh()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
Foam::pointIndexHit Foam::offsetTriSurfaceMesh::findNearest
|
||||
(
|
||||
const point& sample,
|
||||
const scalar nearestDistSqr
|
||||
) const
|
||||
{
|
||||
// Find nearest (add offset to search span)
|
||||
pointIndexHit surfNearest = triSurfaceMesh::findNearest
|
||||
(
|
||||
sample,
|
||||
nearestDistSqr + Foam::sqr(offset_)
|
||||
);
|
||||
|
||||
// Shift back onto surface
|
||||
if (surfNearest.hit())
|
||||
{
|
||||
vector n(sample-surfNearest.hitPoint());
|
||||
n /= mag(n)+VSMALL;
|
||||
surfNearest.setPoint(surfNearest.hitPoint() + offset_*n);
|
||||
}
|
||||
return surfNearest;
|
||||
}
|
||||
|
||||
|
||||
Foam::pointIndexHit Foam::offsetTriSurfaceMesh::findNearestOnEdge
|
||||
(
|
||||
const point& sample,
|
||||
const scalar nearestDistSqr
|
||||
) const
|
||||
{
|
||||
// Find nearest (add offset to search span)
|
||||
pointIndexHit surfNearest = triSurfaceMesh::findNearestOnEdge
|
||||
(
|
||||
sample,
|
||||
nearestDistSqr + Foam::sqr(offset_)
|
||||
);
|
||||
|
||||
// Shift back onto surface
|
||||
if (surfNearest.hit())
|
||||
{
|
||||
vector n = sample-surfNearest.hitPoint();
|
||||
n /= mag(n)+VSMALL;
|
||||
surfNearest.setPoint(surfNearest.hitPoint() + offset_*n);
|
||||
}
|
||||
return surfNearest;
|
||||
}
|
||||
|
||||
|
||||
Foam::searchableSurface::volumeType Foam::offsetTriSurfaceMesh::getVolumeType
|
||||
(
|
||||
const point& sample
|
||||
) const
|
||||
{
|
||||
// Find the nearest point on background surface
|
||||
pointIndexHit surfNearest = triSurfaceMesh::findNearest
|
||||
(
|
||||
sample,
|
||||
Foam::sqr(GREAT)
|
||||
);
|
||||
|
||||
if (!surfNearest.hit())
|
||||
{
|
||||
FatalErrorIn("offsetTriSurfaceMesh::getVolumeType(const point&)")
|
||||
<< "treeBb:" << tree().bb()
|
||||
<< " sample:" << sample
|
||||
<< " surfNearest:" << surfNearest
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
// Offset sample to the point.
|
||||
vector n(surfNearest.hitPoint()-sample);
|
||||
n /= mag(n)+VSMALL;
|
||||
|
||||
triSurfaceTools::sideType t = triSurfaceTools::surfaceSide
|
||||
(
|
||||
*this,
|
||||
sample+offset_*n,
|
||||
surfNearest.index(),
|
||||
surfNearest.hitPoint()
|
||||
);
|
||||
|
||||
if (t == triSurfaceTools::UNKNOWN)
|
||||
{
|
||||
return searchableSurface::UNKNOWN;
|
||||
}
|
||||
else if (t == triSurfaceTools::INSIDE)
|
||||
{
|
||||
return searchableSurface::INSIDE;
|
||||
}
|
||||
else if (t == triSurfaceTools::OUTSIDE)
|
||||
{
|
||||
return searchableSurface::OUTSIDE;
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("offsetTriSurfaceMesh::getVolumeType(const point&)")
|
||||
<< "problem" << abort(FatalError);
|
||||
return searchableSurface::UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Functions * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Friend Operators * * * * * * * * * * * * * //
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -1,167 +0,0 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
offsetTriSurfaceMesh
|
||||
|
||||
Description
|
||||
triSurfaceMesh with offset. Used to define refinement boxes as a region
|
||||
within certain distance to the refinement surface.
|
||||
Note: reloads surface.
|
||||
|
||||
SourceFiles
|
||||
offsetTriSurfaceMesh.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef offsetTriSurfaceMesh_H
|
||||
#define offsetTriSurfaceMesh_H
|
||||
|
||||
#include "triSurfaceMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class offsetTriSurfaceMesh Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
class offsetTriSurfaceMesh
|
||||
:
|
||||
public triSurfaceMesh
|
||||
{
|
||||
// Private data
|
||||
|
||||
const scalar offset_;
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("offsetTriSurfaceMesh");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from triSurface and offset
|
||||
offsetTriSurfaceMesh(const IOobject&, const triSurface&, const scalar);
|
||||
|
||||
//- Construct read and offset
|
||||
offsetTriSurfaceMesh(const IOobject& io, const scalar);
|
||||
|
||||
//- Construct as searchableSurface
|
||||
offsetTriSurfaceMesh
|
||||
(
|
||||
const word& name,
|
||||
const objectRegistry& obj,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
virtual ~offsetTriSurfaceMesh();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// searchableSurface implementation
|
||||
|
||||
//- Calculate nearest point on surface. Returns
|
||||
// - bool : any point found nearer than nearestDistSqr
|
||||
// - label: relevant index in surface
|
||||
// - point: actual nearest point found
|
||||
virtual pointIndexHit findNearest
|
||||
(
|
||||
const point& sample,
|
||||
const scalar nearestDistSqr
|
||||
) const;
|
||||
|
||||
//- Calculate nearest point on edge. Returns
|
||||
// - bool : any point found nearer than nearestDistSqr
|
||||
// - label: relevant index in surface
|
||||
// - point: actual nearest point found
|
||||
virtual pointIndexHit findNearestOnEdge
|
||||
(
|
||||
const point& sample,
|
||||
const scalar nearestDistSqr
|
||||
) const;
|
||||
|
||||
//- Find nearest to line. Returns
|
||||
// - bool : any point found?
|
||||
// - label: relevant index in shapes
|
||||
// - point: actual nearest point found
|
||||
// sets:
|
||||
// - tightest : bounding box
|
||||
// - linePoint : corresponding nearest point on line
|
||||
virtual pointIndexHit findNearest
|
||||
(
|
||||
const linePointRef& ln,
|
||||
treeBoundBox& tightest,
|
||||
point& linePoint
|
||||
) const
|
||||
{
|
||||
notImplemented("offsetTriSurfaceMesh::findNearest(..)");
|
||||
return pointIndexHit();
|
||||
}
|
||||
|
||||
//- Find nearest intersection of line between start and end.
|
||||
virtual pointIndexHit findLine
|
||||
(
|
||||
const point& start,
|
||||
const point& end
|
||||
) const
|
||||
{
|
||||
notImplemented("offsetTriSurfaceMesh::findLine(..)");
|
||||
return pointIndexHit();
|
||||
}
|
||||
|
||||
//- Find any intersection of line between start and end.
|
||||
virtual pointIndexHit findLineAny
|
||||
(
|
||||
const point& start,
|
||||
const point& end
|
||||
) const
|
||||
{
|
||||
notImplemented("offsetTriSurfaceMesh::findLine(..)");
|
||||
return pointIndexHit();
|
||||
}
|
||||
|
||||
//- Determine type (inside/outside/mixed) for point. unknown if
|
||||
// cannot be determined (e.g. non-manifold surface)
|
||||
virtual volumeType getVolumeType(const point&) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -742,16 +742,21 @@ labelList dynamicRefineFvMesh::selectRefineCells
|
||||
}
|
||||
}
|
||||
|
||||
Info<< "Selected " << returnReduce(candidates.size(), sumOp<label>())
|
||||
// Guarantee 2:1 refinement after refinement
|
||||
labelList consistentSet
|
||||
(
|
||||
meshCutter_.consistentRefinement
|
||||
(
|
||||
candidates.shrink(),
|
||||
true // Add to set to guarantee 2:1
|
||||
)
|
||||
);
|
||||
|
||||
Info<< "Selected " << returnReduce(consistentSet.size(), sumOp<label>())
|
||||
<< " cells for refinement out of " << globalData().nTotalCells()
|
||||
<< "." << endl;
|
||||
|
||||
// Guarantee 2:1 refinement across processor patches.
|
||||
return meshCutter_.consistentRefinement
|
||||
(
|
||||
candidates.shrink(),
|
||||
true // Add to set to guarantee 2:1
|
||||
);
|
||||
return consistentSet;
|
||||
}
|
||||
|
||||
|
||||
@ -795,18 +800,23 @@ labelList dynamicRefineFvMesh::selectUnrefinePoints
|
||||
}
|
||||
|
||||
|
||||
Info<< "Selected " << returnReduce(newSplitPoints.size(), sumOp<label>())
|
||||
newSplitPoints.shrink();
|
||||
|
||||
// Guarantee 2:1 refinement after unrefinement
|
||||
labelList consistentSet
|
||||
(
|
||||
meshCutter_.consistentUnrefinement
|
||||
(
|
||||
newSplitPoints,
|
||||
false
|
||||
)
|
||||
);
|
||||
Info<< "Selected " << returnReduce(consistentSet.size(), sumOp<label>())
|
||||
<< " split points out of a possible "
|
||||
<< returnReduce(splitPoints.size(), sumOp<label>())
|
||||
<< "." << endl;
|
||||
|
||||
newSplitPoints.shrink();
|
||||
|
||||
return meshCutter_.consistentUnrefinement
|
||||
(
|
||||
newSplitPoints,
|
||||
false
|
||||
);
|
||||
return consistentSet;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -1096,6 +1096,9 @@ void Foam::motionSmoother::updateMesh()
|
||||
isInternalPoint_.set(meshPoints[i], 0);
|
||||
}
|
||||
|
||||
// Calculate master edge addressing
|
||||
isMasterEdge_ = syncTools::getMasterEdges(mesh_);
|
||||
|
||||
makePatchPatchAddressing();
|
||||
}
|
||||
|
||||
|
||||
@ -160,6 +160,10 @@ class motionSmoother
|
||||
//- Is mesh point on boundary or not
|
||||
PackedList<1> isInternalPoint_;
|
||||
|
||||
//- Is edge master (always except if on coupled boundary and on
|
||||
// lower processor)
|
||||
PackedList<1> isMasterEdge_;
|
||||
|
||||
//- 2-D motion corrector
|
||||
twoDPointCorrector twoDCorrector_;
|
||||
|
||||
@ -171,31 +175,6 @@ class motionSmoother
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
////- (unweighted) average of all values on points connected via edges
|
||||
//// to pointI
|
||||
//template <class Type>
|
||||
//static Type avg
|
||||
//(
|
||||
// const GeometricField<Type, pointPatchField, pointMesh>&,
|
||||
// const edgeList& edges,
|
||||
// const pointField& points,
|
||||
// const labelList& edgeLabels,
|
||||
// const label pointI
|
||||
//);
|
||||
//
|
||||
////- Distance weighted average. Is average with inverse distance
|
||||
//// weighting and varying edge-diffusivity.
|
||||
//template <class Type>
|
||||
//static Type avg
|
||||
//(
|
||||
// const GeometricField<Type, pointPatchField, pointMesh>&,
|
||||
// const scalarField& edgeGamma,
|
||||
// const edgeList& edges,
|
||||
// const pointField& points,
|
||||
// const labelList& edgeLabels,
|
||||
// const label pointI
|
||||
//);
|
||||
|
||||
//- Average of connected points.
|
||||
template <class Type>
|
||||
tmp<GeometricField<Type, pointPatchField, pointMesh> > avg
|
||||
@ -481,13 +460,6 @@ public:
|
||||
|
||||
// Helper functions to manipulate displacement vector.
|
||||
|
||||
////- Point-jacobi smoothing of internal points
|
||||
//template <class Type>
|
||||
//void smooth
|
||||
//(
|
||||
// GeometricField<Type, pointPatchField, pointMesh>&
|
||||
//) const;
|
||||
|
||||
//- Fully explicit smoothing of internal points with varying
|
||||
// diffusivity.
|
||||
template <class Type>
|
||||
|
||||
@ -227,8 +227,8 @@ bool Foam::motionSmoother::checkMesh
|
||||
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
|
||||
|
||||
Info<< " faces with interpolation weights (0..1) < "
|
||||
<< setw(4) << minWeight
|
||||
<< " : "
|
||||
<< setw(5) << minWeight
|
||||
<< " : "
|
||||
<< nNewWrongFaces-nWrongFaces << endl;
|
||||
|
||||
nWrongFaces = nNewWrongFaces;
|
||||
@ -250,8 +250,8 @@ bool Foam::motionSmoother::checkMesh
|
||||
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
|
||||
|
||||
Info<< " faces with volume ratio of neighbour cells < "
|
||||
<< setw(4) << minVolRatio
|
||||
<< " : "
|
||||
<< setw(5) << minVolRatio
|
||||
<< " : "
|
||||
<< nNewWrongFaces-nWrongFaces << endl;
|
||||
|
||||
nWrongFaces = nNewWrongFaces;
|
||||
@ -519,8 +519,8 @@ bool Foam::motionSmoother::checkMesh
|
||||
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
|
||||
|
||||
Info<< " faces with interpolation weights (0..1) < "
|
||||
<< setw(4) << minWeight
|
||||
<< " : "
|
||||
<< setw(5) << minWeight
|
||||
<< " : "
|
||||
<< nNewWrongFaces-nWrongFaces << endl;
|
||||
|
||||
nWrongFaces = nNewWrongFaces;
|
||||
@ -540,8 +540,8 @@ bool Foam::motionSmoother::checkMesh
|
||||
label nNewWrongFaces = returnReduce(wrongFaces.size(), sumOp<label>());
|
||||
|
||||
Info<< " faces with volume ratio of neighbour cells < "
|
||||
<< setw(4) << minVolRatio
|
||||
<< " : "
|
||||
<< setw(5) << minVolRatio
|
||||
<< " : "
|
||||
<< nNewWrongFaces-nWrongFaces << endl;
|
||||
|
||||
nWrongFaces = nNewWrongFaces;
|
||||
|
||||
@ -182,107 +182,37 @@ Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
||||
);
|
||||
GeometricField<Type, pointPatchField, pointMesh>& res = tres();
|
||||
|
||||
|
||||
const polyMesh& mesh = fld.mesh()();
|
||||
|
||||
scalarField sumWeight(mesh.nPoints(), 0.0);
|
||||
|
||||
// Sum local weighted values and weights
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Note: on coupled edges use only one edge (through isMasterEdge)
|
||||
// This is done so coupled edges do not get counted double.
|
||||
|
||||
scalarField sumWeight(mesh.nPoints(), 0.0);
|
||||
|
||||
const edgeList& edges = mesh.edges();
|
||||
|
||||
forAll(edges, edgeI)
|
||||
{
|
||||
const edge& e = edges[edgeI];
|
||||
const scalar& w = edgeWeight[edgeI];
|
||||
|
||||
res[e[0]] += w*fld[e[1]];
|
||||
sumWeight[e[0]] += w;
|
||||
|
||||
res[e[1]] += w*fld[e[0]];
|
||||
sumWeight[e[1]] += w;
|
||||
}
|
||||
|
||||
|
||||
// Correct for coupled edges counted twice after summing below.
|
||||
|
||||
const polyBoundaryMesh& patches = mesh.boundaryMesh();
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI]))
|
||||
if (isMasterEdge_.get(edgeI) == 1)
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
const edge& e = edges[edgeI];
|
||||
const scalar w = edgeWeight[edgeI];
|
||||
|
||||
if (pp.myProcNo() < pp.neighbProcNo())
|
||||
{
|
||||
// Remove contribution of my edges to sum.
|
||||
res[e[0]] += w*fld[e[1]];
|
||||
sumWeight[e[0]] += w;
|
||||
|
||||
const labelList& meshEdges = pp.meshEdges();
|
||||
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
label edgeI = meshEdges[i];
|
||||
const edge& e = edges[edgeI];
|
||||
const scalar& w = edgeWeight[edgeI];
|
||||
|
||||
res[e[0]] -= w*fld[e[1]];
|
||||
sumWeight[e[0]] -= w;
|
||||
|
||||
res[e[1]] -= w*fld[e[0]];
|
||||
sumWeight[e[1]] -= w;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
{
|
||||
// Remove first half contribution.
|
||||
|
||||
const cyclicPolyPatch& pp =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
SubList<face> half0Faces
|
||||
(
|
||||
mesh.faces(),
|
||||
pp.size()/2,
|
||||
pp.start()
|
||||
);
|
||||
|
||||
labelList::subList half0Cells
|
||||
(
|
||||
mesh.faceOwner(),
|
||||
pp.size()/2,
|
||||
pp.start()
|
||||
);
|
||||
|
||||
labelList meshEdges
|
||||
(
|
||||
primitivePatch(half0Faces, mesh.points()).meshEdges
|
||||
(
|
||||
edges,
|
||||
mesh.cellEdges(),
|
||||
half0Cells
|
||||
)
|
||||
);
|
||||
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
label edgeI = meshEdges[i];
|
||||
const edge& e = edges[edgeI];
|
||||
const scalar& w = edgeWeight[edgeI];
|
||||
|
||||
res[e[0]] -= w*fld[e[1]];
|
||||
sumWeight[e[0]] -= w;
|
||||
|
||||
res[e[1]] -= w*fld[e[0]];
|
||||
sumWeight[e[1]] -= w;
|
||||
}
|
||||
res[e[1]] += w*fld[e[0]];
|
||||
sumWeight[e[1]] += w;
|
||||
}
|
||||
}
|
||||
|
||||
// Still to be done: multiply shared edges.
|
||||
// (mesh.globalData().sharedEdgeLabels()) However needs for us to keep
|
||||
// count how many have already been corrected above.
|
||||
|
||||
// Add coupled contributions
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
syncTools::syncPointList
|
||||
(
|
||||
@ -303,6 +233,9 @@ Foam::tmp<Foam::GeometricField<Type, Foam::pointPatchField, Foam::pointMesh> >
|
||||
);
|
||||
|
||||
|
||||
// Average
|
||||
// ~~~~~~~
|
||||
|
||||
forAll(res, pointI)
|
||||
{
|
||||
if (mag(sumWeight[pointI]) < VSMALL)
|
||||
@ -330,7 +263,6 @@ void Foam::motionSmoother::smooth
|
||||
const GeometricField<Type, pointPatchField, pointMesh>& fld,
|
||||
const scalarField& edgeWeight,
|
||||
const bool separation,
|
||||
|
||||
GeometricField<Type, pointPatchField, pointMesh>& newFld
|
||||
) const
|
||||
{
|
||||
@ -349,6 +281,7 @@ void Foam::motionSmoother::smooth
|
||||
newFld[pointI] = 0.5*fld[pointI] + 0.5*avgFld[pointI];
|
||||
}
|
||||
}
|
||||
|
||||
newFld.correctBoundaryConditions();
|
||||
applyCornerConstraints(newFld);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
/*---------------------------------------------------------------------------* \
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
@ -333,7 +333,7 @@ Foam::labelList Foam::faceCoupleInfo::findMappedEdges
|
||||
label v0 = pointMap[e[0]];
|
||||
label v1 = pointMap[e[1]];
|
||||
|
||||
toPatchEdges[edgeI] =
|
||||
toPatchEdges[edgeI] =
|
||||
meshTools::findEdge
|
||||
(
|
||||
patch.edges(),
|
||||
@ -517,7 +517,7 @@ void Foam::faceCoupleInfo::setCutEdgeToPoints(const labelList& cutToMasterEdges)
|
||||
labelListList masterToCutEdges
|
||||
(
|
||||
invertOneToMany
|
||||
(
|
||||
(
|
||||
masterPatch().nEdges(),
|
||||
cutToMasterEdges
|
||||
)
|
||||
@ -577,7 +577,7 @@ void Foam::faceCoupleInfo::setCutEdgeToPoints(const labelList& cutToMasterEdges)
|
||||
|
||||
while (startVertI != unsplitEdge[1])
|
||||
{
|
||||
// Loop over all string of edges. Update
|
||||
// Loop over all string of edges. Update
|
||||
// - startVertI : previous vertex
|
||||
// - startEdgeI : previous edge
|
||||
// and insert any points into splitPoints
|
||||
@ -995,7 +995,7 @@ void Foam::faceCoupleInfo::findPerfectMatchingFaces
|
||||
nMatched++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
mesh0Faces.setSize(nMatched);
|
||||
mesh1Faces.setSize(nMatched);
|
||||
}
|
||||
@ -1050,7 +1050,7 @@ void Foam::faceCoupleInfo::findSlavesCoveringMaster
|
||||
point fc(f1.centre(mesh1.points()));
|
||||
|
||||
// Search in bounding box of face only.
|
||||
treeBoundBox tightest(f1.points(mesh1.points()));
|
||||
treeBoundBox tightest(static_cast<const pointField&>(f1.points(mesh1.points())));
|
||||
|
||||
scalar tightestDist = GREAT;
|
||||
|
||||
@ -1509,7 +1509,7 @@ void Foam::faceCoupleInfo::perfectPointMatch
|
||||
|
||||
// Cut faces to slave patch.
|
||||
bool matchedAllFaces = false;
|
||||
|
||||
|
||||
if (slaveFacesOrdered)
|
||||
{
|
||||
cutToSlaveFaces_ = identity(cutFaces().size());
|
||||
@ -1576,7 +1576,7 @@ void Foam::faceCoupleInfo::perfectPointMatch
|
||||
compactToCut // compaction map: from compacted to cut
|
||||
);
|
||||
|
||||
|
||||
|
||||
// Use compaction lists to renumber cutPoints.
|
||||
cutPoints_ = IndirectList<point>(cutPoints_, compactToCut)();
|
||||
{
|
||||
@ -1882,7 +1882,7 @@ void Foam::faceCoupleInfo::subDivisionMatch
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// All cut faces matched?
|
||||
forAll(cutToMasterFaces_, cutFaceI)
|
||||
|
||||
@ -48,4 +48,8 @@ submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C
|
||||
IntegrationScheme/makeIntegrationSchemes.C
|
||||
|
||||
|
||||
/* Data entries */
|
||||
submodels/IO/DataEntry/makeDataEntries.C
|
||||
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/liblagrangianIntermediate
|
||||
|
||||
@ -112,15 +112,13 @@ Foam::scalar Foam::KinematicCloud<ParcelType>::setNumberOfParticles
|
||||
{
|
||||
nP = pVolumeFraction*massTotal_/nParcels
|
||||
/(pRho*mathematicalConstant::pi/6.0*pow(pDiameter, 3));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case pbNumber:
|
||||
{
|
||||
nP = pVolumeFraction*massTotal_/(pRho*pVolume);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
{
|
||||
nP = 0.0;
|
||||
@ -364,13 +362,10 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
|
||||
scalar pRho = td.constProps().rho0();
|
||||
|
||||
this->injection().prepareForNextTimeStep(time0_, time);
|
||||
|
||||
// Number of parcels to introduce during this timestep
|
||||
const label nParcels = this->injection().nParcelsToInject
|
||||
(
|
||||
nInjections_,
|
||||
time0_,
|
||||
time
|
||||
);
|
||||
const label nParcels = this->injection().nParcels();
|
||||
|
||||
// Return if no parcels are required
|
||||
if (!nParcels)
|
||||
@ -380,15 +375,10 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
}
|
||||
|
||||
// Volume of particles to introduce during this timestep
|
||||
scalar pVolume = this->injection().volume
|
||||
(
|
||||
time0_,
|
||||
time,
|
||||
this->meshInfo()
|
||||
);
|
||||
scalar pVolume = this->injection().volume();
|
||||
|
||||
// Volume fraction to introduce during this timestep
|
||||
scalar pVolumeFraction = this->injection().volumeFraction(time0_, time);
|
||||
scalar pVolumeFraction = this->injection().volumeFraction();
|
||||
|
||||
// Duration of injection period during this timestep
|
||||
scalar deltaT = min
|
||||
@ -419,8 +409,7 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo(),
|
||||
rndGen_
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Diameter of parcels
|
||||
@ -437,7 +426,12 @@ void Foam::KinematicCloud<ParcelType>::inject
|
||||
);
|
||||
|
||||
// Velocity of parcels
|
||||
vector pU = this->injection().velocity(iParcel, timeInj);
|
||||
vector pU = this->injection().velocity
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Determine the injection cell
|
||||
label pCell = -1;
|
||||
@ -496,8 +490,9 @@ void Foam::KinematicCloud<ParcelType>::postInjectCheck()
|
||||
{
|
||||
if (nParcelsAdded_)
|
||||
{
|
||||
Pout<< "\n--> Cloud: " << this->name() << nl <<
|
||||
" Added " << nParcelsAdded_ << " new parcels" << nl << endl;
|
||||
Pout<< "\n--> Cloud: " << this->name() << nl
|
||||
<< " Added " << nParcelsAdded_
|
||||
<< " new parcels" << nl << endl;
|
||||
}
|
||||
|
||||
// Reset parcel counters
|
||||
|
||||
@ -363,6 +363,9 @@ public:
|
||||
inline const InjectionModel<KinematicCloud<ParcelType> >&
|
||||
injection() const;
|
||||
|
||||
inline InjectionModel<KinematicCloud<ParcelType> >&
|
||||
injection();
|
||||
|
||||
//- Return reference to wall interaction model
|
||||
inline const WallInteractionModel<KinematicCloud<ParcelType> >&
|
||||
wallInteraction() const;
|
||||
|
||||
@ -139,6 +139,14 @@ Foam::KinematicCloud<ParcelType>::injection() const
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline Foam::InjectionModel<Foam::KinematicCloud<ParcelType> >&
|
||||
Foam::KinematicCloud<ParcelType>::injection()
|
||||
{
|
||||
return injectionModel_();
|
||||
}
|
||||
|
||||
|
||||
template<class ParcelType>
|
||||
inline const Foam::WallInteractionModel<Foam::KinematicCloud<ParcelType> >&
|
||||
Foam::KinematicCloud<ParcelType>::wallInteraction() const
|
||||
|
||||
@ -200,13 +200,10 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
|
||||
scalar pRho = td.constProps().rho0();
|
||||
|
||||
this->injection().prepareForNextTimeStep(this->time0(), time);
|
||||
|
||||
// Number of parcels to introduce during this timestep
|
||||
const label nParcels = this->injection().nParcelsToInject
|
||||
(
|
||||
this->nInjections(),
|
||||
this->time0(),
|
||||
time
|
||||
);
|
||||
const label nParcels = this->injection().nParcels();
|
||||
|
||||
// Return if no parcels are required
|
||||
if (!nParcels)
|
||||
@ -216,19 +213,10 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
}
|
||||
|
||||
// Volume of particles to introduce during this timestep
|
||||
scalar pVolume = this->injection().volume
|
||||
(
|
||||
this->time0(),
|
||||
time,
|
||||
this->meshInfo()
|
||||
);
|
||||
scalar pVolume = this->injection().volume();
|
||||
|
||||
// Volume fraction to introduce during this timestep
|
||||
scalar pVolumeFraction = this->injection().volumeFraction
|
||||
(
|
||||
this->time0(),
|
||||
time
|
||||
);
|
||||
scalar pVolumeFraction = this->injection().volumeFraction();
|
||||
|
||||
// Duration of injection period during this timestep
|
||||
scalar deltaT = min
|
||||
@ -259,8 +247,7 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo(),
|
||||
this->rndGen()
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Diameter of parcels
|
||||
@ -277,7 +264,12 @@ void Foam::ReactingCloud<ParcelType>::inject
|
||||
);
|
||||
|
||||
// Velocity of parcels
|
||||
vector pU = this->injection().velocity(iParcel, timeInj);
|
||||
vector pU = this->injection().velocity
|
||||
(
|
||||
iParcel,
|
||||
timeInj,
|
||||
this->meshInfo()
|
||||
);
|
||||
|
||||
// Determine the injection cell
|
||||
label pCell = -1;
|
||||
|
||||
@ -277,38 +277,58 @@ public:
|
||||
//- Return type id
|
||||
inline const label typeId() const;
|
||||
|
||||
//- Return diameter
|
||||
//- Return const access to diameter
|
||||
inline const scalar d() const;
|
||||
inline scalar& d();
|
||||
|
||||
//- Return velocity
|
||||
//- Return const access to velocity
|
||||
inline const vector& U() const;
|
||||
inline vector& U();
|
||||
|
||||
//- Return relative velocity
|
||||
//- Return const access to relative velocity
|
||||
inline const vector& Ur() const;
|
||||
inline vector& Ur();
|
||||
|
||||
//- Return number of particles
|
||||
//- Return const access to number of particles
|
||||
inline const scalar nParticle() const;
|
||||
inline scalar& nParticle();
|
||||
|
||||
//- Return density
|
||||
//- Return const access to density
|
||||
inline const scalar rho() const;
|
||||
inline scalar& rho();
|
||||
|
||||
//- Return time spent in turbulent eddy
|
||||
//- Return const access to time spent in turbulent eddy
|
||||
inline const scalar tTurb() const;
|
||||
inline scalar& tTurb();
|
||||
|
||||
//- Return turbulent velocity fluctuation
|
||||
//- Return const access to turbulent velocity fluctuation
|
||||
inline const vector& UTurb() const;
|
||||
inline vector& UTurb();
|
||||
|
||||
//- The nearest distance to a wall that
|
||||
// the particle can be in the n direction
|
||||
inline scalar wallImpactDistance(const vector& n) const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to diameter
|
||||
inline scalar& d();
|
||||
|
||||
//- Return access to velocity
|
||||
inline vector& U();
|
||||
|
||||
//- Return access to relative velocity
|
||||
inline vector& Ur();
|
||||
|
||||
//- Return access to number of particles
|
||||
inline scalar& nParticle();
|
||||
|
||||
//- Return access to density
|
||||
inline scalar& rho();
|
||||
|
||||
//- Return access to time spent in turbulent eddy
|
||||
inline scalar& tTurb();
|
||||
|
||||
//- Return access to turbulent velocity fluctuation
|
||||
inline vector& UTurb();
|
||||
|
||||
|
||||
// Helper functions
|
||||
|
||||
//- Return the index of the face to be used in the interpolation
|
||||
// routine
|
||||
inline label faceInterpolation() const;
|
||||
|
||||
@ -259,24 +259,37 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return mass fractions of gases
|
||||
//- Return const access to mass fractions of gases
|
||||
inline const scalarField& YGas() const;
|
||||
|
||||
//- Return const access to mass fractions of liquids
|
||||
inline const scalarField& YLiquid() const;
|
||||
|
||||
//- Return const access to mass fractions of solids
|
||||
inline const scalarField& YSolid() const;
|
||||
|
||||
//- Return const access to mass fractions of mixture
|
||||
inline const scalarField& YMixture() const;
|
||||
|
||||
//- Return const access to initial mass
|
||||
inline const scalar mass0() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to mass fractions of gases
|
||||
inline scalarField& YGas();
|
||||
|
||||
//- Return mass fractions of liquids
|
||||
inline const scalarField& YLiquid() const;
|
||||
//- Return access to mass fractions of liquids
|
||||
inline scalarField& YLiquid();
|
||||
|
||||
//- Return mass fractions of solids
|
||||
inline const scalarField& YSolid() const;
|
||||
//- Return access to mass fractions of solids
|
||||
inline scalarField& YSolid();
|
||||
|
||||
//- Return mass fractions of mixture
|
||||
inline const scalarField& YMixture() const;
|
||||
//- Return access to mass fractions of mixture
|
||||
inline scalarField& YMixture();
|
||||
|
||||
//- Return initial mass
|
||||
inline const scalar mass0() const;
|
||||
//- Return access to initial mass
|
||||
inline scalar& mass0();
|
||||
|
||||
|
||||
@ -315,6 +328,15 @@ public:
|
||||
static void readFields(ReactingCloud<ParcelType>& c);
|
||||
|
||||
static void writeFields(const ReactingCloud<ParcelType>& c);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <ParcelType>
|
||||
(
|
||||
Ostream&,
|
||||
const ReactingParcel<ParcelType>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -249,12 +249,19 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return temperature
|
||||
//- Return const access to temperature
|
||||
inline const scalar T() const;
|
||||
|
||||
//- Return const access to specific heat capacity
|
||||
inline const scalar cp() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Return access to temperature
|
||||
inline scalar& T();
|
||||
|
||||
//- Return specific heat capacity
|
||||
inline const scalar cp() const;
|
||||
//- Return access to specific heat capacity
|
||||
inline scalar& cp();
|
||||
|
||||
|
||||
@ -293,6 +300,15 @@ public:
|
||||
static void readFields(ThermoCloud<ParcelType>& c);
|
||||
|
||||
static void writeFields(const ThermoCloud<ParcelType>& c);
|
||||
|
||||
|
||||
// Ostream Operator
|
||||
|
||||
friend Ostream& operator<< <ParcelType>
|
||||
(
|
||||
Ostream&,
|
||||
const ThermoParcel<ParcelType>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -26,8 +26,9 @@ License
|
||||
|
||||
#include "basicKinematicParcel.H"
|
||||
#include "KinematicCloud.H"
|
||||
#include "ManualInjection.H"
|
||||
#include "NoInjection.H"
|
||||
#include "ManualInjection.H"
|
||||
#include "ConeInjection.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -35,6 +36,12 @@ namespace Foam
|
||||
|
||||
// Add instances of injection model to the table
|
||||
makeInjectionModelType
|
||||
(
|
||||
NoInjection,
|
||||
KinematicCloud,
|
||||
basicKinematicParcel
|
||||
);
|
||||
makeInjectionModelType
|
||||
(
|
||||
ManualInjection,
|
||||
KinematicCloud,
|
||||
@ -42,7 +49,7 @@ namespace Foam
|
||||
);
|
||||
makeInjectionModelType
|
||||
(
|
||||
NoInjection,
|
||||
ConeInjection,
|
||||
KinematicCloud,
|
||||
basicKinematicParcel
|
||||
);
|
||||
|
||||
@ -26,8 +26,9 @@ License
|
||||
|
||||
#include "basicReactingParcel.H"
|
||||
#include "ReactingCloud.H"
|
||||
#include "ManualInjection.H"
|
||||
#include "NoInjection.H"
|
||||
#include "ManualInjection.H"
|
||||
#include "ConeInjection.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -35,6 +36,12 @@ namespace Foam
|
||||
|
||||
// Add instances of injection model to the table
|
||||
makeInjectionModelType
|
||||
(
|
||||
NoInjection,
|
||||
KinematicCloud,
|
||||
basicReactingParcel
|
||||
);
|
||||
makeInjectionModelType
|
||||
(
|
||||
ManualInjection,
|
||||
KinematicCloud,
|
||||
@ -42,7 +49,7 @@ namespace Foam
|
||||
);
|
||||
makeInjectionModelType
|
||||
(
|
||||
NoInjection,
|
||||
ConeInjection,
|
||||
KinematicCloud,
|
||||
basicReactingParcel
|
||||
);
|
||||
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "ThermoCloud.H"
|
||||
#include "NoInjection.H"
|
||||
#include "ManualInjection.H"
|
||||
#include "ConeInjection.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
@ -37,6 +38,8 @@ namespace Foam
|
||||
makeInjectionModelType(NoInjection, KinematicCloud, basicThermoParcel);
|
||||
|
||||
makeInjectionModelType(ManualInjection, KinematicCloud, basicThermoParcel);
|
||||
|
||||
makeInjectionModelType(ConeInjection, KinematicCloud, basicThermoParcel);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Constant.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Constant<Type>::Constant
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
DataEntry<Type>(typeName, entryName, dict),
|
||||
value_(this->dict_.lookup("value"))
|
||||
{}
|
||||
|
||||
|
||||
template<>
|
||||
Foam::Constant<Foam::label>::Constant
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
DataEntry<label>(typeName, entryName, dict),
|
||||
value_(readLabel(this->dict_.lookup("value")))
|
||||
{}
|
||||
|
||||
|
||||
template<>
|
||||
Foam::Constant<Foam::scalar>::Constant
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
DataEntry<scalar>(typeName, entryName, dict),
|
||||
value_(readScalar(this->dict_.lookup("value")))
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Constant<Type>::~Constant()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Constant<Type>::value(const scalar x) const
|
||||
{
|
||||
return value_;
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Constant<Type>::integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
return (x2 - x1)*value_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,129 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::Constant
|
||||
|
||||
Description
|
||||
Templated basic entry that holds a constant value.
|
||||
|
||||
@verbatim
|
||||
entry Constant
|
||||
entryCoeffs
|
||||
{
|
||||
value 100.0; // Constant value
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
SourceFiles
|
||||
Constant.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Constant_H
|
||||
#define Constant_H
|
||||
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Constant Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class Constant
|
||||
:
|
||||
public DataEntry<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
Type value_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
Constant(const Constant<Type>&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const Constant<Type>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Runtime type information
|
||||
TypeName("Constant");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
Constant
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
~Constant();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return constant value
|
||||
Type value(const scalar) const;
|
||||
|
||||
//- Integrate between two values
|
||||
Type integrate(const scalar x1, const scalar x2) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
Constant<label>::Constant(const word& entryName, const dictionary& dict);
|
||||
|
||||
template<>
|
||||
Constant<scalar>::Constant(const word& entryName, const dictionary& dict);
|
||||
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "Constant.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,60 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::DataEntry<Type>::DataEntry
|
||||
(
|
||||
const word& typeName,
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
dict_(dict.subDict(entryName + "Coeffs")),
|
||||
entry_(entryName)
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::DataEntry<Type>::~DataEntry()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
const Foam::dictionary& Foam::DataEntry<Type>::dict() const
|
||||
{
|
||||
return dict_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,170 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::DataEntry
|
||||
|
||||
Description
|
||||
|
||||
SourceFiles
|
||||
DataEntry.C
|
||||
NewDataEntry.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef DataEntry_H
|
||||
#define DataEntry_H
|
||||
|
||||
#include "dictionary.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class DataEntry Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class DataEntry
|
||||
{
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
DataEntry(const DataEntry<Type>&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const DataEntry<Type>&);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
//- Coefficients dictionary
|
||||
const dictionary dict_;
|
||||
|
||||
//- Name of entry
|
||||
const word entry_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("DataEntry")
|
||||
|
||||
//- Declare runtime constructor selection table
|
||||
declareRunTimeSelectionTable
|
||||
(
|
||||
autoPtr,
|
||||
DataEntry,
|
||||
dictionary,
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
),
|
||||
(entryName, dict)
|
||||
);
|
||||
|
||||
|
||||
// Constructor
|
||||
|
||||
//- Construct from type name and dictionary
|
||||
DataEntry
|
||||
(
|
||||
const word& TypeName,
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Selector
|
||||
static autoPtr<DataEntry<Type> > New
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
virtual ~DataEntry();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
|
||||
// Evaluation
|
||||
|
||||
//- Return value as a function of (scalar) independent variable
|
||||
virtual Type value(const scalar x) const = 0;
|
||||
|
||||
//- Integrate between two (scalar) values
|
||||
virtual Type integrate(const scalar x1, const scalar x2) const = 0;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#define makeDataEntry(Type) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(DataEntry<Type>, 0); \
|
||||
\
|
||||
defineTemplateRunTimeSelectionTable \
|
||||
( \
|
||||
DataEntry<Type>, \
|
||||
dictionary \
|
||||
);
|
||||
|
||||
|
||||
#define makeDataEntryType(SS, Type) \
|
||||
\
|
||||
defineNamedTemplateTypeNameAndDebug(SS<Type>, 0); \
|
||||
\
|
||||
DataEntry<Type>::adddictionaryConstructorToTable<SS<Type> > \
|
||||
add##SS##Type##ConstructorToTable_;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "DataEntry.C"
|
||||
# include "NewDataEntry.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,62 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::autoPtr<Foam::DataEntry<Type> > Foam::DataEntry<Type>::New
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
)
|
||||
{
|
||||
word DataEntryType(dict.lookup(entryName));
|
||||
|
||||
// Info<< "Selecting DataEntry " << DataEntryType << endl;
|
||||
|
||||
typename dictionaryConstructorTable::iterator cstrIter =
|
||||
dictionaryConstructorTablePtr_->find(DataEntryType);
|
||||
|
||||
if (cstrIter == dictionaryConstructorTablePtr_->end())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"DataEntry<Type>::New(const dictionary&"
|
||||
) << "Unknown DataEntry type "
|
||||
<< DataEntryType << " for " << entryName
|
||||
<< ", constructor not in hash table" << nl << nl
|
||||
<< " Valid DataEntry types are :" << nl
|
||||
<< dictionaryConstructorTablePtr_->toc() << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
|
||||
return autoPtr<DataEntry<Type> >(cstrIter()(entryName, dict));
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
151
src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C
Normal file
151
src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.C
Normal file
@ -0,0 +1,151 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Table.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Table<Type>::Table
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
)
|
||||
:
|
||||
DataEntry<Type>(typeName, entryName, dict),
|
||||
table_(this->dict_.lookup("table"))
|
||||
{
|
||||
if (!table_.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::Table<Type>::Table"
|
||||
"("
|
||||
"const word& entryName,"
|
||||
"const dictionary& dict"
|
||||
")"
|
||||
) << "Table is invalid (empty)" << nl
|
||||
<< exit(FatalError);
|
||||
}
|
||||
Info<< table_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Foam::Table<Type>::~Table()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Table<Type>::value(const scalar x) const
|
||||
{
|
||||
// Return zero if out of bounds
|
||||
if ((x > table_[table_.size()-1].first()) || (x < table_[0].first()))
|
||||
{
|
||||
return pTraits<Type>::zero;
|
||||
}
|
||||
|
||||
label i = 0;
|
||||
while ((table_[i].first() < x) && (i < table_.size()))
|
||||
{
|
||||
i++;
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
return table_[0].second();
|
||||
}
|
||||
else if (i == table_.size() - 1)
|
||||
{
|
||||
return table_[i-1].second();
|
||||
}
|
||||
else
|
||||
{
|
||||
return
|
||||
(x - table_[i-1].first())/(table_[i].first() - table_[i-1].first())
|
||||
* (table_[i].second() - table_[i-1].second())
|
||||
+ table_[i-1].second();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class Type>
|
||||
Type Foam::Table<Type>::integrate(const scalar x1, const scalar x2) const
|
||||
{
|
||||
// Initialise return value
|
||||
Type sum = pTraits<Type>::zero;
|
||||
|
||||
// Return zero if out of bounds
|
||||
if ((x1 > table_[table_.size()-1].first()) || (x2 < table_[0].first()))
|
||||
{
|
||||
return sum;
|
||||
}
|
||||
|
||||
// Find start index
|
||||
label id1 = 0;
|
||||
while ((table_[id1].first() < x1) && (id1 < table_.size()))
|
||||
{
|
||||
id1++;
|
||||
}
|
||||
|
||||
// Find end index
|
||||
label id2 = table_.size() - 1;
|
||||
while ((table_[id2].first() > x2) && (id2 >= 1))
|
||||
{
|
||||
id2--;
|
||||
}
|
||||
|
||||
// Integrate table body
|
||||
for (label i=id1; i<id2; i++)
|
||||
{
|
||||
sum +=
|
||||
(table_[i].second() + table_[i+1].second())
|
||||
* (table_[i+1].first() - table_[i].first());
|
||||
}
|
||||
sum *= 0.5;
|
||||
|
||||
// Add table ends
|
||||
if (id1 > 0)
|
||||
{
|
||||
sum += 0.5
|
||||
* (value(x1) + table_[id1].second())
|
||||
* (table_[id1].first() - x1);
|
||||
}
|
||||
if (id2 < table_.size() - 1)
|
||||
{
|
||||
sum += 0.5
|
||||
* (table_[id2].second() + value(x2))
|
||||
* (x2 - table_[id2].first());
|
||||
}
|
||||
|
||||
return sum;
|
||||
}
|
||||
|
||||
// ************************************************************************* //
|
||||
130
src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H
Normal file
130
src/lagrangian/intermediate/submodels/IO/DataEntry/Table/Table.H
Normal file
@ -0,0 +1,130 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::Table
|
||||
|
||||
Description
|
||||
Templated table container data entry. Items are stored in a list of
|
||||
Tuple2's. First column is always stored as scalar entries. Data is read
|
||||
in the form, e.g. for (scalar, vector):
|
||||
|
||||
@verbatim
|
||||
entry Table
|
||||
entryCoeffs
|
||||
{
|
||||
table
|
||||
(
|
||||
0.0 (1 2 3)
|
||||
1.0 (4 5 6)
|
||||
)
|
||||
}
|
||||
@endverbatim
|
||||
|
||||
SourceFiles
|
||||
Table.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef Table_H
|
||||
#define Table_H
|
||||
|
||||
#include "DataEntry.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class Table Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class Type>
|
||||
class Table
|
||||
:
|
||||
public DataEntry<Type>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Table data
|
||||
List<Tuple2<scalar, Type> > table_;
|
||||
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
//- Disallow default bitwise copy construct
|
||||
Table(const Table<Type>&);
|
||||
|
||||
//- Disallow default bitwise assignment
|
||||
void operator=(const Table<Type>&);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Runtime type information
|
||||
TypeName("Table");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
Table
|
||||
(
|
||||
const word& entryName,
|
||||
const dictionary& dict
|
||||
);
|
||||
|
||||
|
||||
//- Destructor
|
||||
|
||||
~Table();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return Table value
|
||||
Type value(const scalar x) const;
|
||||
|
||||
//- Integrate between two (scalar) values
|
||||
Type integrate(const scalar x1, const scalar x2) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "Table.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,51 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "DataEntry.H"
|
||||
#include "Constant.H"
|
||||
#include "Table.H"
|
||||
|
||||
#include "label.H"
|
||||
#include "scalar.H"
|
||||
#include "vector.H"
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
makeDataEntry(label);
|
||||
makeDataEntryType(Constant, label);
|
||||
makeDataEntryType(Table, label);
|
||||
|
||||
makeDataEntry(scalar);
|
||||
makeDataEntryType(Constant, scalar);
|
||||
makeDataEntryType(Table, scalar);
|
||||
|
||||
makeDataEntry(vector);
|
||||
makeDataEntryType(Constant, vector);
|
||||
makeDataEntryType(Table, vector);
|
||||
};
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -80,22 +80,11 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Return const access to the turbulence model
|
||||
const compressible::turbulenceModel& turbulence() const
|
||||
{
|
||||
return turbulence_;
|
||||
}
|
||||
|
||||
virtual bool active() const = 0;
|
||||
|
||||
virtual vector update
|
||||
(
|
||||
const scalar dt,
|
||||
const label celli,
|
||||
const vector& U,
|
||||
const vector& Uc,
|
||||
vector& UTurb,
|
||||
scalar& tTurb
|
||||
) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -75,8 +75,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
//- Update (disperse particles)
|
||||
vector update
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -73,8 +73,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
//- Update (disperse particles)
|
||||
vector update
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -28,7 +28,7 @@ Class
|
||||
Description
|
||||
The velocity is perturbed in random direction, with a
|
||||
Gaussian random number distribution with variance sigma.
|
||||
where sigma is defined below
|
||||
where sigma is defined below
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
@ -75,8 +75,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
//- Update (disperse particles)
|
||||
vector update
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -72,8 +72,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates drag model
|
||||
bool active() const;
|
||||
|
||||
//- Return drag coefficient
|
||||
scalar Cd(const scalar) const;
|
||||
};
|
||||
|
||||
|
||||
@ -72,8 +72,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates drag model
|
||||
bool active() const;
|
||||
|
||||
//- Return drag coefficient
|
||||
scalar Cd(const scalar Re) const;
|
||||
};
|
||||
|
||||
|
||||
@ -0,0 +1,256 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "ConeInjection.H"
|
||||
#include "DataEntry.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ConeInjection<CloudType>::nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((time0 >= 0.0) && (time0 < duration_))
|
||||
{
|
||||
return round((time1 - time0)*parcelsPerSecond_);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((time0 >= 0.0) && (time0 < duration_))
|
||||
{
|
||||
return volumeFlowRate_().integrate(time0, time1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::ConeInjection<CloudType>::ConeInjection
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner, typeName),
|
||||
duration_(readScalar(this->coeffDict().lookup("duration"))),
|
||||
position_(this->coeffDict().lookup("position")),
|
||||
direction_(this->coeffDict().lookup("direction")),
|
||||
parcelsPerSecond_
|
||||
(
|
||||
readScalar(this->coeffDict().lookup("parcelsPerSecond"))
|
||||
),
|
||||
volumeFlowRate_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"volumeFlowRate",
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
Umag_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"Umag",
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
thetaInner_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"thetaInner",
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
thetaOuter_
|
||||
(
|
||||
DataEntry<scalar>::New
|
||||
(
|
||||
"thetaOuter",
|
||||
this->coeffDict()
|
||||
)
|
||||
),
|
||||
parcelPDF_
|
||||
(
|
||||
pdf::New
|
||||
(
|
||||
this->coeffDict().subDict("parcelPDF"),
|
||||
owner.rndGen()
|
||||
)
|
||||
),
|
||||
tanVec1_(vector::zero),
|
||||
tanVec2_(vector::zero)
|
||||
{
|
||||
// Normalise direction vector
|
||||
direction_ /= mag(direction_);
|
||||
|
||||
// Determine direction vectors tangential to direction
|
||||
vector tangent = vector::zero;
|
||||
scalar magTangent = 0.0;
|
||||
|
||||
while (magTangent < SMALL)
|
||||
{
|
||||
vector v = this->owner().rndGen().vector01();
|
||||
|
||||
tangent = v - (v & direction_)*direction_;
|
||||
magTangent = mag(tangent);
|
||||
}
|
||||
|
||||
tanVec1_ = tangent/magTangent;
|
||||
tanVec2_ = direction_^tanVec1_;
|
||||
|
||||
// Set total volume to inject
|
||||
this->volumeTotal_ = volumeFlowRate_().integrate(0.0, duration_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::ConeInjection<CloudType>::~ConeInjection()
|
||||
{}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
bool Foam::ConeInjection<CloudType>::active() const
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
return this->SOI_ + duration_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::ConeInjection<CloudType>::position
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
vector pos = position_;
|
||||
if (meshInfo.caseIs2d())
|
||||
{
|
||||
if (meshInfo.caseIs2dWedge())
|
||||
{
|
||||
pos.component(meshInfo.emptyComponent()) = 0.0;
|
||||
}
|
||||
else if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
pos.component(meshInfo.emptyComponent()) =
|
||||
meshInfo.centrePoint().component(meshInfo.emptyComponent());
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::vector Foam::ConeInjection<CloudType>::position"
|
||||
) << "Could not determine 2-D case geometry" << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::ConeInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
const scalar deg2Rad = mathematicalConstant::pi/180.0;
|
||||
|
||||
scalar t = time - this->SOI_;
|
||||
scalar ti = thetaInner_().value(t);
|
||||
scalar to = thetaOuter_().value(t);
|
||||
scalar coneAngle = this->owner().rndGen().scalar01()*(to - ti) + ti;
|
||||
|
||||
coneAngle *= deg2Rad;
|
||||
scalar alpha = sin(coneAngle);
|
||||
scalar dcorr = cos(coneAngle);
|
||||
scalar beta =
|
||||
2.0*mathematicalConstant::pi*this->owner().rndGen().scalar01();
|
||||
|
||||
vector normal = alpha*(tanVec1_*cos(beta) + tanVec2_*sin(beta));
|
||||
vector dirVec = dcorr*direction_;
|
||||
dirVec += normal;
|
||||
|
||||
// Remove empty component of velocity for slab cases
|
||||
if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
dirVec.component(meshInfo.emptyComponent()) = 0.0;
|
||||
}
|
||||
|
||||
dirVec /= mag(dirVec);
|
||||
|
||||
return Umag_().value(t)*dirVec;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ConeInjection<CloudType>::d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return parcelPDF_().sample();
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -0,0 +1,200 @@
|
||||
/*---------------------------------------------------------------------------*\
|
||||
========= |
|
||||
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
\\ / O peration |
|
||||
\\ / A nd | Copyright (C) 1991-2007 OpenCFD Ltd.
|
||||
\\/ M anipulation |
|
||||
-------------------------------------------------------------------------------
|
||||
License
|
||||
This file is part of OpenFOAM.
|
||||
|
||||
OpenFOAM is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with OpenFOAM; if not, write to the Free Software Foundation,
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Class
|
||||
Foam::ConeInjection
|
||||
|
||||
Description
|
||||
Cone injection
|
||||
- User specifies
|
||||
- time of start of injection
|
||||
- injector position
|
||||
- direction (along injection axis)
|
||||
- parcel flow rate
|
||||
- parcel velocity
|
||||
- inner and outer cone angles
|
||||
- Parcel diameters obtained by PDF model
|
||||
|
||||
SourceFiles
|
||||
ConeInjection.C
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef ConeInjection_H
|
||||
#define ConeInjection_H
|
||||
|
||||
#include "InjectionModel.H"
|
||||
#include "pdf.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
namespace Foam
|
||||
{
|
||||
|
||||
template<class Type>
|
||||
class DataEntry;
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class ConeInjection Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
template<class CloudType>
|
||||
class ConeInjection
|
||||
:
|
||||
public InjectionModel<CloudType>
|
||||
{
|
||||
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
//- Injection duration [s]
|
||||
const scalar duration_;
|
||||
|
||||
//- Injector position [m]
|
||||
const vector position_;
|
||||
|
||||
//- Injector direction []
|
||||
vector direction_;
|
||||
|
||||
//- Number of parcels to introduce per second []
|
||||
const label parcelsPerSecond_;
|
||||
|
||||
//- Volume flow rate of parcels to introduce relative to SOI [m^3]
|
||||
const autoPtr<DataEntry<scalar> > volumeFlowRate_;
|
||||
|
||||
//- Parcel velocity magnitude relative to SOI [m/s]
|
||||
const autoPtr<DataEntry<scalar> > Umag_;
|
||||
|
||||
//- Inner cone angle relative to SOI [deg]
|
||||
const autoPtr<DataEntry<scalar> > thetaInner_;
|
||||
|
||||
//- Outer cone angle relative to SOI [deg]
|
||||
const autoPtr<DataEntry<scalar> > thetaOuter_;
|
||||
|
||||
//- Parcel size PDF model
|
||||
const autoPtr<pdf> parcelPDF_;
|
||||
|
||||
|
||||
// Tangential vectors to the direction vector
|
||||
|
||||
//- First tangential vector
|
||||
vector tanVec1_;
|
||||
|
||||
//- Second tangential vector
|
||||
vector tanVec2_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
label nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
TypeName("ConeInjection");
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from dictionary
|
||||
ConeInjection
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~ConeInjection();
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
|
||||
// Injection geometry
|
||||
|
||||
//- Return the injection position
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
} // End namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#ifdef NoRepository
|
||||
# include "ConeInjection.C"
|
||||
#endif
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#endif
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -32,11 +32,17 @@ template<class CloudType>
|
||||
Foam::InjectionModel<CloudType>::InjectionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner),
|
||||
rndGen_(label(0))
|
||||
coeffDict_(dict.subDict(type + "Coeffs")),
|
||||
SOI_(readScalar(coeffDict_.lookup("SOI"))),
|
||||
volumeTotal_(0.0),
|
||||
timeStep0_(0.0),
|
||||
nParcels_(0),
|
||||
volume_(0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -56,6 +62,13 @@ const CloudType& Foam::InjectionModel<CloudType>::owner() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
CloudType& Foam::InjectionModel<CloudType>::owner()
|
||||
{
|
||||
return owner_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::InjectionModel<CloudType>::dict() const
|
||||
{
|
||||
@ -64,9 +77,85 @@ const Foam::dictionary& Foam::InjectionModel<CloudType>::dict() const
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::Random& Foam::InjectionModel<CloudType>::rndGen()
|
||||
const Foam::dictionary& Foam::InjectionModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return rndGen_;
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::timeStart() const
|
||||
{
|
||||
return SOI_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::volumeTotal() const
|
||||
{
|
||||
return volumeTotal_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::label Foam::InjectionModel<CloudType>::nParcels() const
|
||||
{
|
||||
return nParcels_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::volume() const
|
||||
{
|
||||
return volume_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::scalar Foam::InjectionModel<CloudType>::volumeFraction() const
|
||||
{
|
||||
return volume_/volumeTotal_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
void Foam::InjectionModel<CloudType>::prepareForNextTimeStep
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
)
|
||||
{
|
||||
// Initialise values
|
||||
nParcels_ = 0;
|
||||
volume_ = 0.0;
|
||||
|
||||
// Return if not started injection event
|
||||
if (time1 < SOI_)
|
||||
{
|
||||
timeStep0_ = time1;
|
||||
return;
|
||||
}
|
||||
|
||||
// Make times relative to SOI
|
||||
scalar t0 = timeStep0_ - SOI_;
|
||||
scalar t1 = time1 - SOI_;
|
||||
|
||||
// Number of parcels to inject
|
||||
nParcels_ = nParcelsToInject(t0, t1);
|
||||
|
||||
// Volume of parcels to inject
|
||||
volume_ = volumeToInject(t0, t1);
|
||||
|
||||
// Hold previous time if no parcels, but non-zero volume fraction
|
||||
if ((nParcels_ == 0) && (volume_ > 0.0))
|
||||
{
|
||||
// hold value of timeStep0_
|
||||
}
|
||||
else
|
||||
{
|
||||
// advance value of timeStep0_
|
||||
timeStep0_ = time1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -63,8 +63,51 @@ class InjectionModel
|
||||
// Reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- Random number generator
|
||||
Random rndGen_;
|
||||
//- The coefficients dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected data
|
||||
|
||||
// Global injection properties
|
||||
|
||||
//- Start of injection [s]
|
||||
scalar SOI_;
|
||||
|
||||
//- Total volume of parcels to introduce [m^3]
|
||||
// Initialised in the individual injection models
|
||||
scalar volumeTotal_;
|
||||
|
||||
|
||||
// Injection properties per Lagrangian time step
|
||||
|
||||
//- Time at start of injection time step [s]
|
||||
scalar timeStep0_;
|
||||
|
||||
//- Number of parcels to introduce []
|
||||
label nParcels_;
|
||||
|
||||
//- Volume of parcels to introduce [m^3]
|
||||
scalar volume_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
virtual label nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
|
||||
//- Volume of parcels to introduce over the time step
|
||||
virtual scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
|
||||
|
||||
public:
|
||||
@ -92,7 +135,8 @@ public:
|
||||
InjectionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -112,14 +156,17 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the owner cloud object
|
||||
//- Return const access the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return non-const access the owner cloud object for manipulation
|
||||
CloudType& owner();
|
||||
|
||||
//- Return the dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return reference to random number
|
||||
inline Random& rndGen();
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -127,57 +174,62 @@ public:
|
||||
//- Flag to indicate whether model activates injection model
|
||||
virtual bool active() const = 0;
|
||||
|
||||
//- Return the start-of-injection time
|
||||
virtual scalar timeStart() const = 0;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
virtual scalar timeEnd() const = 0;
|
||||
// Global information
|
||||
|
||||
//- Return the injection position
|
||||
virtual vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random& rndGen
|
||||
) const = 0;
|
||||
//- Return the start-of-injection time
|
||||
const scalar timeStart() const;
|
||||
|
||||
//- Return the number of parcels to intruduce between two times
|
||||
virtual label nParcelsToInject
|
||||
(
|
||||
const label nInjections_,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
//- Return the total volume to be injected across the event
|
||||
const scalar volumeTotal() const;
|
||||
|
||||
//- Return the volume of parcels to introduce between two times
|
||||
virtual scalar volume
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1,
|
||||
const polyMeshInfo& meshInfo
|
||||
) const = 0;
|
||||
//- Return the end-of-injection time
|
||||
virtual scalar timeEnd() const = 0;
|
||||
|
||||
//- Return the volume fraction to introduce between two times
|
||||
virtual scalar volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const = 0;
|
||||
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
virtual scalar d0
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time
|
||||
) const = 0;
|
||||
// Per Lagrangian time step properties
|
||||
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
virtual vector velocity
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time
|
||||
) const = 0;
|
||||
//- Determine properties for next time step/injection interval
|
||||
void prepareForNextTimeStep
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
);
|
||||
|
||||
//- Return the number of parcels to introduce
|
||||
const label nParcels() const;
|
||||
|
||||
//- Return the volume of parcels to introduce
|
||||
const scalar volume() const;
|
||||
|
||||
//- Return the volume fraction to introduce
|
||||
const scalar volumeFraction() const;
|
||||
|
||||
|
||||
// Injection geometry
|
||||
|
||||
//- Return the injection position
|
||||
virtual vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
) = 0;
|
||||
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
virtual vector velocity
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
) = 0;
|
||||
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
virtual scalar d0
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time
|
||||
) const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -24,10 +24,47 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "ManualInjection.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ManualInjection<CloudType>::nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((0.0 >= time0) && (0.0 < time1))
|
||||
{
|
||||
return positions_.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
// All parcels introduced at SOI
|
||||
if ((0.0 >= time0) && (0.0 < time1))
|
||||
{
|
||||
return this->volumeTotal_;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -37,10 +74,8 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
injectionTime_(readScalar(coeffDict_.lookup("injectionTime"))),
|
||||
positionsFile_(coeffDict_.lookup("positionsFile")),
|
||||
InjectionModel<CloudType>(dict, owner, typeName),
|
||||
positionsFile_(this->coeffDict().lookup("positionsFile")),
|
||||
positions_
|
||||
(
|
||||
IOobject
|
||||
@ -53,12 +88,12 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
||||
)
|
||||
),
|
||||
diameters_(positions_.size()),
|
||||
U0_(coeffDict_.lookup("U0")),
|
||||
U0_(this->coeffDict().lookup("U0")),
|
||||
parcelPDF_
|
||||
(
|
||||
pdf::New
|
||||
(
|
||||
coeffDict_.subDict("parcelPDF"),
|
||||
this->coeffDict().subDict("parcelPDF"),
|
||||
owner.rndGen()
|
||||
)
|
||||
)
|
||||
@ -70,7 +105,7 @@ Foam::ManualInjection<CloudType>::ManualInjection
|
||||
}
|
||||
|
||||
// Determine volume of particles to inject
|
||||
volumeTotal_ = sum(pow(diameters_, 3))
|
||||
this->volumeTotal_ = sum(pow(diameters_, 3))
|
||||
*mathematicalConstant::pi/6.0;
|
||||
}
|
||||
|
||||
@ -91,13 +126,6 @@ bool Foam::ManualInjection<CloudType>::active() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::timeStart() const
|
||||
{
|
||||
return injectionTime_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
@ -111,9 +139,8 @@ Foam::vector Foam::ManualInjection<CloudType>::position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
vector pos = positions_[iParcel];
|
||||
if (meshInfo.caseIs2d())
|
||||
@ -129,8 +156,10 @@ Foam::vector Foam::ManualInjection<CloudType>::position
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("Foam::vector Foam::ManualInjection<CloudType>::position")
|
||||
<< "Could not determine 2-D case geometry" << nl
|
||||
FatalErrorIn
|
||||
(
|
||||
"Foam::vector Foam::ManualInjection<CloudType>::position"
|
||||
) << "Could not determine 2-D case geometry" << nl
|
||||
<< abort(FatalError);
|
||||
}
|
||||
}
|
||||
@ -140,53 +169,21 @@ Foam::vector Foam::ManualInjection<CloudType>::position
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::ManualInjection<CloudType>::nParcelsToInject
|
||||
Foam::vector Foam::ManualInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((injectionTime_>=time0) && (injectionTime_<time1))
|
||||
{
|
||||
return positions_.size();
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const
|
||||
const polyMeshInfo& meshInfo
|
||||
)
|
||||
{
|
||||
// Since all parcels are introduced at once, volume introduced in this time
|
||||
// interval = total mass
|
||||
return volumeTotal_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::ManualInjection<CloudType>::volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const
|
||||
{
|
||||
if ((injectionTime_>=time0) && (injectionTime_<time1))
|
||||
vector vel = U0_;
|
||||
if (meshInfo.caseIs2dSlab())
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
vel.component(meshInfo.emptyComponent()) =
|
||||
meshInfo.centrePoint().component(meshInfo.emptyComponent());
|
||||
}
|
||||
|
||||
return vel;
|
||||
}
|
||||
|
||||
|
||||
@ -201,15 +198,4 @@ Foam::scalar Foam::ManualInjection<CloudType>::d0
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::ManualInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return U0_;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -68,9 +68,6 @@ class ManualInjection
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
//- Time to introduce parcels
|
||||
const scalar injectionTime_;
|
||||
|
||||
//- Name of file containing positions data
|
||||
const word positionsFile_;
|
||||
|
||||
@ -83,9 +80,6 @@ class ManualInjection
|
||||
//- Initial parcel velocity
|
||||
const vector U0_;
|
||||
|
||||
//- Total volume of parcels to introduce [m^3]
|
||||
scalar volumeTotal_;
|
||||
|
||||
//- Parcel size PDF model
|
||||
const autoPtr<pdf> parcelPDF_;
|
||||
|
||||
@ -93,6 +87,25 @@ class ManualInjection
|
||||
scalar nParticlesPerParcel_;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
label nParcelsToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
//- Volume of parcels to introduce over the time step
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -116,51 +129,37 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
scalar timeStart() const;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo,
|
||||
Random&
|
||||
) const;
|
||||
|
||||
label nParcelsToInject
|
||||
(
|
||||
const label,
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
// Injection geometry
|
||||
|
||||
scalar volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const;
|
||||
//- Return the injection position
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar volumeFraction
|
||||
(
|
||||
const scalar time0,
|
||||
const scalar time1
|
||||
) const;
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar d0
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -24,11 +24,33 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "NoInjection.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::NoInjection<CloudType>::nParcelsToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::volumeToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
template<class CloudType>
|
||||
@ -38,7 +60,7 @@ Foam::NoInjection<CloudType>::NoInjection
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
InjectionModel<CloudType>(dict, owner)
|
||||
InjectionModel<CloudType>(dict, owner, typeName)
|
||||
{}
|
||||
|
||||
|
||||
@ -58,13 +80,6 @@ bool Foam::NoInjection<CloudType>::active() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::timeStart() const
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::timeEnd() const
|
||||
{
|
||||
@ -77,46 +92,22 @@ Foam::vector Foam::NoInjection<CloudType>::position
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo&,
|
||||
Random&
|
||||
) const
|
||||
const polyMeshInfo&
|
||||
)
|
||||
{
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::label Foam::NoInjection<CloudType>::nParcelsToInject
|
||||
Foam::vector Foam::NoInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const
|
||||
)
|
||||
{
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::NoInjection<CloudType>::volumeFraction
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return 0.0;
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
|
||||
@ -131,15 +122,4 @@ Foam::scalar Foam::NoInjection<CloudType>::d0
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::vector Foam::NoInjection<CloudType>::velocity
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const
|
||||
{
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -53,6 +53,25 @@ class NoInjection
|
||||
public InjectionModel<CloudType>
|
||||
{
|
||||
|
||||
protected:
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Number of parcels to introduce over the time step
|
||||
label nParcelsToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
//- Volume of parcels to introduce over the time step
|
||||
scalar volumeToInject
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
//- Runtime type information
|
||||
@ -76,51 +95,37 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates injection model
|
||||
bool active() const;
|
||||
|
||||
scalar timeStart() const;
|
||||
|
||||
//- Return the end-of-injection time
|
||||
scalar timeEnd() const;
|
||||
|
||||
vector position
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const polyMeshInfo&,
|
||||
Random&
|
||||
) const;
|
||||
|
||||
label nParcelsToInject
|
||||
(
|
||||
const label,
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
// Injection geometry
|
||||
|
||||
scalar volume
|
||||
(
|
||||
const scalar,
|
||||
const scalar,
|
||||
const polyMeshInfo&
|
||||
) const;
|
||||
//- Return the injection position
|
||||
vector position
|
||||
(
|
||||
const label iParcel,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar volumeFraction
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
//- Return the velocity of the parcel to introduce at a time
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar time,
|
||||
const polyMeshInfo& meshInfo
|
||||
);
|
||||
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
vector velocity
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
//- Return the diameter of the parcel to introduce at a time
|
||||
scalar d0
|
||||
(
|
||||
const label,
|
||||
const scalar
|
||||
) const;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -24,8 +24,6 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "error.H"
|
||||
|
||||
#include "Rebound.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
@ -37,7 +35,8 @@ Foam::Rebound<CloudType>::Rebound
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
WallInteractionModel<CloudType>(dict, cloud)
|
||||
WallInteractionModel<CloudType>(dict, cloud, typeName),
|
||||
UFactor_(readScalar(this->coeffDict().lookup("UFactor")))
|
||||
{}
|
||||
|
||||
|
||||
@ -71,9 +70,9 @@ void Foam::Rebound<CloudType>::correct
|
||||
scalar Un = U & nw;
|
||||
vector Ut = U - Un*nw;
|
||||
|
||||
if (Un > 0)
|
||||
if (Un > 0.0)
|
||||
{
|
||||
U -= 2.0*Un*nw;
|
||||
U -= UFactor_*2.0*Un*nw;
|
||||
}
|
||||
|
||||
U -= Ut;
|
||||
|
||||
@ -48,6 +48,12 @@ class Rebound
|
||||
:
|
||||
public WallInteractionModel<CloudType>
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Factor applied to velocity on rebound
|
||||
// Normal rebound = 1
|
||||
scalar UFactor_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -72,8 +78,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Apply wall correction
|
||||
virtual void correct
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
|
||||
@ -37,10 +37,9 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
WallInteractionModel<CloudType>(dict, cloud),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
e_(dimensionedScalar(coeffDict_.lookup("e")).value()),
|
||||
mu_(dimensionedScalar(coeffDict_.lookup("mu")).value())
|
||||
WallInteractionModel<CloudType>(dict, cloud, typeName),
|
||||
e_(dimensionedScalar(this->coeffDict().lookup("e")).value()),
|
||||
mu_(dimensionedScalar(this->coeffDict().lookup("mu")).value())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -51,9 +51,6 @@ class StandardWallInteraction
|
||||
|
||||
// Private data
|
||||
|
||||
//- Coefficient dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
//- Elasticity
|
||||
const scalar e_;
|
||||
|
||||
@ -84,8 +81,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Apply wall correction
|
||||
virtual void correct
|
||||
(
|
||||
const wallPolyPatch& wpp,
|
||||
|
||||
@ -32,10 +32,12 @@ template<class CloudType>
|
||||
Foam::WallInteractionModel<CloudType>::WallInteractionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner)
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
@ -63,6 +65,14 @@ const Foam::dictionary& Foam::WallInteractionModel<CloudType>::dict() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary&
|
||||
Foam::WallInteractionModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "NewWallInteractionModel.C"
|
||||
|
||||
@ -63,6 +63,9 @@ class WallInteractionModel
|
||||
// reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficients dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -89,7 +92,8 @@ public:
|
||||
WallInteractionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -109,11 +113,14 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return the dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
@ -32,10 +32,12 @@ template<class CloudType>
|
||||
Foam::CompositionModel<CloudType>::CompositionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs")),
|
||||
carrierThermo_(owner.carrierThermo()),
|
||||
gases_(owner.gases()),
|
||||
liquids_
|
||||
@ -84,6 +86,13 @@ const Foam::dictionary& Foam::CompositionModel<CloudType>::dict() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::CompositionModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::hCombustionThermo&
|
||||
Foam::CompositionModel<CloudType>::carrierThermo() const
|
||||
|
||||
@ -70,6 +70,9 @@ class CompositionModel
|
||||
//- Reference to the owner injection class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficients dictionary
|
||||
const dictionary& coeffDict_;
|
||||
|
||||
//- Reference to the carrier phase thermo package
|
||||
hCombustionThermo& carrierThermo_;
|
||||
|
||||
@ -108,7 +111,8 @@ public:
|
||||
CompositionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -133,9 +137,12 @@ public:
|
||||
//- Return the cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return the dictionary
|
||||
//- Return the cloud dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
//- Return the carrier phase thermo package
|
||||
const hCombustionThermo& carrierThermo() const;
|
||||
|
||||
@ -216,6 +223,7 @@ public:
|
||||
const scalar T
|
||||
) const = 0;
|
||||
|
||||
//- Return specific heat caparcity for the liquid mixture
|
||||
virtual const scalar cpLiquid
|
||||
(
|
||||
const scalarField& YLiquid,
|
||||
@ -223,6 +231,7 @@ public:
|
||||
const scalar T
|
||||
) const = 0;
|
||||
|
||||
//- Return specific heat caparcity for the solid mixture
|
||||
virtual const scalar cpSolid
|
||||
(
|
||||
const scalarField& YSolid
|
||||
|
||||
@ -35,23 +35,22 @@ Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
CompositionModel<CloudType>(dict, owner),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
CompositionModel<CloudType>(dict, owner, typeName),
|
||||
|
||||
gasNames_(coeffDict_.lookup("gasNames")),
|
||||
gasNames_(this->coeffDict().lookup("gasNames")),
|
||||
gasGlobalIds_(gasNames_.size(), -1),
|
||||
YGas0_(coeffDict_.lookup("YGas0")),
|
||||
YGasTot0_(readScalar(coeffDict_.lookup("YGasTot0"))),
|
||||
YGas0_(this->coeffDict().lookup("YGas0")),
|
||||
YGasTot0_(readScalar(this->coeffDict().lookup("YGasTot0"))),
|
||||
|
||||
liquidNames_(coeffDict_.lookup("liquidNames")),
|
||||
liquidNames_(this->coeffDict().lookup("liquidNames")),
|
||||
liquidGlobalIds_(liquidNames_.size(), -1),
|
||||
YLiquid0_(coeffDict_.lookup("YLiquid0")),
|
||||
YLiquidTot0_(readScalar(coeffDict_.lookup("YLiquidTot0"))),
|
||||
YLiquid0_(this->coeffDict().lookup("YLiquid0")),
|
||||
YLiquidTot0_(readScalar(this->coeffDict().lookup("YLiquidTot0"))),
|
||||
|
||||
solidNames_(coeffDict_.lookup("solidNames")),
|
||||
solidNames_(this->coeffDict().lookup("solidNames")),
|
||||
solidGlobalIds_(solidNames_.size(), -1),
|
||||
YSolid0_(coeffDict_.lookup("YSolid0")),
|
||||
YSolidTot0_(readScalar(coeffDict_.lookup("YSolidTot0"))),
|
||||
YSolid0_(this->coeffDict().lookup("YSolid0")),
|
||||
YSolidTot0_(readScalar(this->coeffDict().lookup("YSolidTot0"))),
|
||||
|
||||
YMixture0_(3)
|
||||
{
|
||||
@ -73,7 +72,8 @@ Foam::SingleMixtureFraction<CloudType>::SingleMixtureFraction
|
||||
Info<< "\nThermo package species composition comprises:" << endl;
|
||||
forAll (this->carrierThermo().composition().Y(), k)
|
||||
{
|
||||
Info<< this->carrierThermo().composition().Y()[k].name() << endl;
|
||||
Info<< this->carrierThermo().composition().Y()[k].name()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
FatalErrorIn
|
||||
@ -255,12 +255,14 @@ Foam::SingleMixtureFraction<CloudType>::gasLocalId(const word& gasName) const
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"Foam::label SingleMixtureFraction<CloudType>::"
|
||||
"gasLocalId(const word& gasName) const"
|
||||
)<< "Gas name " << gasName << " not found in gasNames_"
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -276,12 +278,14 @@ Foam::SingleMixtureFraction<CloudType>::gasGlobalId(const word& gasName) const
|
||||
return gasGlobalIds_[i];
|
||||
}
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"Foam::label SingleMixtureFraction<CloudType>::"
|
||||
"gasGlobalId(const word& gasName) const"
|
||||
)<< "Gas name " << gasName << " not found in gasNames_"
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -329,12 +333,14 @@ Foam::SingleMixtureFraction<CloudType>::liquidLocalId(const word& liquidName) co
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"Foam::label SingleMixtureFraction<CloudType>::"
|
||||
"liquidLocalId(const word& liquidName) const"
|
||||
)<< "Liquid name " << liquidName << " not found in liquidNames_"
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -350,12 +356,14 @@ Foam::SingleMixtureFraction<CloudType>::liquidGlobalId(const word& liquidName) c
|
||||
return liquidGlobalIds_[i];
|
||||
}
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"Foam::label SingleMixtureFraction<CloudType>::"
|
||||
"liquidGlobalId(const word& liquidName) const"
|
||||
)<< "Liquid name " << liquidName << " not found in liquidNames_"
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -403,12 +411,14 @@ Foam::SingleMixtureFraction<CloudType>::solidLocalId(const word& solidName) cons
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"Foam::label SingleMixtureFraction<CloudType>::"
|
||||
"SolididLocalId(const word& solidName) const"
|
||||
)<< "Solid name " << solidName << " not found in solidNames_"
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -424,12 +434,14 @@ Foam::SingleMixtureFraction<CloudType>::solidGlobalId(const word& solidName) con
|
||||
return solidGlobalIds_[i];
|
||||
}
|
||||
}
|
||||
|
||||
WarningIn
|
||||
(
|
||||
"Foam::label SingleMixtureFraction<CloudType>::"
|
||||
"solidGlobalId(const word& solidName) const"
|
||||
)<< "Solid name " << solidName << " not found in solidNames_"
|
||||
<< endl;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@ -57,9 +57,6 @@ class SingleMixtureFraction
|
||||
|
||||
// Private data
|
||||
|
||||
//- The coefficient dictionary
|
||||
const dictionary& coeffDict_;
|
||||
|
||||
//- Parcel properties
|
||||
|
||||
//- List of gas names
|
||||
@ -146,40 +143,58 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the list of composition names
|
||||
const wordList compositionNames() const;
|
||||
|
||||
//- Return the list of gas names
|
||||
const wordList& gasNames() const;
|
||||
|
||||
//- Return the list indices of gases in global thermo list
|
||||
const labelList& gasGlobalIds() const;
|
||||
|
||||
//- Return the list of gas mass fractions
|
||||
const scalarField& YGas0() const;
|
||||
|
||||
//- Return the total gas mass fraction
|
||||
const scalar YGasTot0() const;
|
||||
|
||||
//- Return the list of liquid names
|
||||
const wordList& liquidNames() const;
|
||||
|
||||
//- Return the list indices of liquid in global thermo list
|
||||
const labelList& liquidGlobalIds() const;
|
||||
|
||||
//- Return the list of liquid mass fractions
|
||||
const scalarField& YLiquid0() const;
|
||||
|
||||
//- Return the total liquid mass fraction
|
||||
const scalar YLiquidTot0() const;
|
||||
|
||||
//- Return the list of solid names
|
||||
const wordList& solidNames() const;
|
||||
|
||||
//- Return the list indices of solids in global thermo list
|
||||
const labelList& solidGlobalIds() const;
|
||||
|
||||
//- Return the list of solid mass fractions
|
||||
const scalarField& YSolid0() const;
|
||||
|
||||
//- Return the total solid mass fraction
|
||||
const scalar YSolidTot0() const;
|
||||
|
||||
//- Return the list of mixture mass fractions
|
||||
const scalarField& YMixture0() const;
|
||||
|
||||
//- Return the gas constant for the gas mixture
|
||||
const scalar RGas(const scalarField& YGas) const;
|
||||
|
||||
//- Return enthalpy for the gas mixture
|
||||
const scalar HGas(const scalarField& YGas, const scalar T) const;
|
||||
|
||||
//- Return specific heat caparcity for the gas mixture
|
||||
const scalar cpGas(const scalarField& YGas, const scalar T) const;
|
||||
|
||||
//- Return specific heat caparcity for the liquid mixture
|
||||
const scalar cpLiquid
|
||||
(
|
||||
const scalarField& YLiquid,
|
||||
@ -187,6 +202,7 @@ public:
|
||||
const scalar T
|
||||
) const;
|
||||
|
||||
//- Return specific heat caparcity for the solid mixture
|
||||
const scalar cpSolid(const scalarField& YSolid) const;
|
||||
};
|
||||
|
||||
|
||||
@ -35,12 +35,11 @@ Foam::ConstantRateDevolatilisation<CloudType>::ConstantRateDevolatilisation
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
MassTransferModel<CloudType>(dict, owner),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
A0_(dimensionedScalar(coeffDict_.lookup("A0")).value()),
|
||||
MassTransferModel<CloudType>(dict, owner, typeName),
|
||||
A0_(dimensionedScalar(this->coeffDict().lookup("A0")).value()),
|
||||
volatileResidualCoeff_
|
||||
(
|
||||
readScalar(coeffDict_.lookup("volatileResidualCoeff"))
|
||||
readScalar(this->coeffDict().lookup("volatileResidualCoeff"))
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -52,10 +52,6 @@ class ConstantRateDevolatilisation
|
||||
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
|
||||
// Model constants
|
||||
|
||||
//- Rate constant (suggested default = 12) [1/s]
|
||||
@ -90,10 +86,13 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates mass transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Flag to indicate whether model changes particle volume
|
||||
bool changesVolume() const;
|
||||
|
||||
//- Update model
|
||||
scalar calculate
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -32,10 +32,12 @@ template<class CloudType>
|
||||
Foam::MassTransferModel<CloudType>::MassTransferModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner)
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
@ -61,6 +63,13 @@ const Foam::dictionary& Foam::MassTransferModel<CloudType>::dict() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::MassTransferModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "NewMassTransferModel.C"
|
||||
|
||||
@ -65,6 +65,9 @@ protected:
|
||||
//- Reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficient dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -91,7 +94,8 @@ public:
|
||||
MassTransferModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -114,9 +118,12 @@ public:
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return the dictionary
|
||||
//- Return the cloud dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the coefficient dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::NoMassTransfer<CloudType>::NoMassTransfer
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
MassTransferModel<CloudType>(dict, cloud)
|
||||
MassTransferModel<CloudType>(dict, cloud, typeName)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -72,10 +72,13 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates mass transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Flag to indicate whether model changes particle volume
|
||||
bool changesVolume() const;
|
||||
|
||||
//- Update model
|
||||
scalar calculate
|
||||
(
|
||||
const scalar,
|
||||
|
||||
@ -35,13 +35,12 @@ Foam::SingleKineticRateDevolatilisation<CloudType>::SingleKineticRateDevolatilis
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
MassTransferModel<CloudType>(dict, owner),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
A1_(dimensionedScalar(coeffDict_.lookup("A1")).value()),
|
||||
E_(dimensionedScalar(coeffDict_.lookup("E")).value()),
|
||||
MassTransferModel<CloudType>(dict, owner, typeName),
|
||||
A1_(dimensionedScalar(this->coeffDict().lookup("A1")).value()),
|
||||
E_(dimensionedScalar(this->coeffDict().lookup("E")).value()),
|
||||
volatileResidualCoeff_
|
||||
(
|
||||
readScalar(coeffDict_.lookup("volatileResidualCoeff"))
|
||||
readScalar(this->coeffDict().lookup("volatileResidualCoeff"))
|
||||
)
|
||||
{}
|
||||
|
||||
|
||||
@ -51,10 +51,6 @@ class SingleKineticRateDevolatilisation
|
||||
|
||||
// Private data
|
||||
|
||||
//- Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
|
||||
// Model constants
|
||||
|
||||
//- Activation energy
|
||||
@ -92,10 +88,13 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates mass transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Flag to indicate whether model changes particle volume
|
||||
bool changesVolume() const;
|
||||
|
||||
//- Update model
|
||||
scalar calculate
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::NoSurfaceReaction<CloudType>::NoSurfaceReaction
|
||||
CloudType& owner
|
||||
)
|
||||
:
|
||||
SurfaceReactionModel<CloudType>(dict, owner)
|
||||
SurfaceReactionModel<CloudType>(dict, owner, typeName)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -72,8 +72,10 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates devolatisation model
|
||||
bool active() const;
|
||||
|
||||
//- Update surface reactions
|
||||
void calculate
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -32,10 +32,12 @@ template<class CloudType>
|
||||
Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner)
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
@ -61,6 +63,13 @@ const Foam::dictionary& Foam::SurfaceReactionModel<CloudType>::dict() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::SurfaceReactionModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
#include "NewSurfaceReactionModel.C"
|
||||
|
||||
@ -66,6 +66,9 @@ class SurfaceReactionModel
|
||||
// reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficients dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -93,7 +96,8 @@ public:
|
||||
SurfaceReactionModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& cloud
|
||||
CloudType& cloud,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -116,15 +120,19 @@ public:
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
//- Return the dictionary
|
||||
//- Return the cloud dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates devolatisation model
|
||||
virtual bool active() const = 0;
|
||||
|
||||
//- Update surface reactions
|
||||
virtual void calculate
|
||||
(
|
||||
const scalar dt,
|
||||
|
||||
@ -32,10 +32,12 @@ template<class CloudType>
|
||||
Foam::HeatTransferModel<CloudType>::HeatTransferModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
)
|
||||
: dict_(dict),
|
||||
owner_(owner)
|
||||
owner_(owner),
|
||||
coeffDict_(dict.subDict(type + "Coeffs"))
|
||||
{}
|
||||
|
||||
|
||||
@ -62,6 +64,13 @@ const Foam::dictionary& Foam::HeatTransferModel<CloudType>::dict() const
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
const Foam::dictionary& Foam::HeatTransferModel<CloudType>::coeffDict() const
|
||||
{
|
||||
return coeffDict_;
|
||||
}
|
||||
|
||||
|
||||
template<class CloudType>
|
||||
Foam::scalar Foam::HeatTransferModel<CloudType>::h
|
||||
(
|
||||
|
||||
@ -63,6 +63,9 @@ class HeatTransferModel
|
||||
//- Reference to the owner cloud class
|
||||
CloudType& owner_;
|
||||
|
||||
//- The coefficents dictionary
|
||||
const dictionary coeffDict_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
@ -89,7 +92,8 @@ public:
|
||||
HeatTransferModel
|
||||
(
|
||||
const dictionary& dict,
|
||||
CloudType& owner
|
||||
CloudType& owner,
|
||||
const word& type
|
||||
);
|
||||
|
||||
|
||||
@ -109,9 +113,12 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Return the dictionary
|
||||
//- Return the cloud dictionary
|
||||
const dictionary& dict() const;
|
||||
|
||||
//- Return the coefficients dictionary
|
||||
const dictionary& coeffDict() const;
|
||||
|
||||
//- Return the owner cloud object
|
||||
const CloudType& owner() const;
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ Foam::NoHeatTransfer<CloudType>::NoHeatTransfer
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
HeatTransferModel<CloudType>(dict, cloud)
|
||||
HeatTransferModel<CloudType>(dict, cloud, typeName)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -72,14 +72,17 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Nusselt number
|
||||
scalar Nu
|
||||
(
|
||||
const scalar,
|
||||
const scalar
|
||||
) const;
|
||||
|
||||
//- Prandtl number
|
||||
scalar Pr() const;
|
||||
};
|
||||
|
||||
|
||||
@ -37,9 +37,8 @@ Foam::RanzMarshall<CloudType>::RanzMarshall
|
||||
CloudType& cloud
|
||||
)
|
||||
:
|
||||
HeatTransferModel<CloudType>(dict, cloud),
|
||||
coeffDict_(dict.subDict(typeName + "Coeffs")),
|
||||
Pr_(dimensionedScalar(coeffDict_.lookup("Pr")).value())
|
||||
HeatTransferModel<CloudType>(dict, cloud, typeName),
|
||||
Pr_(dimensionedScalar(this->coeffDict().lookup("Pr")).value())
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -51,9 +51,6 @@ class RanzMarshall
|
||||
|
||||
// Private data
|
||||
|
||||
// Coefficients dictionary
|
||||
dictionary coeffDict_;
|
||||
|
||||
// Prandtl number
|
||||
const scalar Pr_;
|
||||
|
||||
@ -81,14 +78,17 @@ public:
|
||||
|
||||
// Member Functions
|
||||
|
||||
//- Flag to indicate whether model activates heat transfer model
|
||||
bool active() const;
|
||||
|
||||
//- Nusselt number
|
||||
scalar Nu
|
||||
(
|
||||
const scalar Re,
|
||||
const scalar Pr
|
||||
) const;
|
||||
|
||||
//- Prandtl number
|
||||
scalar Pr() const;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user