40 namespace porosityModels
53 const word& modelType,
58 zoneName_(
name +
":porousZone")
60 const dictionary& coeffs(
dict.optionalSubDict(modelType +
"Coeffs"));
66 scalar searchSpan(coeffs.get<scalar>(
"searchSpan"));
69 const word topSurfaceFileName(coeffs.get<
word>(
"topSurface"));
88 mesh.time().constant(),
100 surfBounds.min() - searchSpan*zDir, surfBounds.max()
107 label porousCelli = 0;
111 if (searchBounds.contains(
C[celli]))
113 porousCells[porousCelli++] = celli;
117 porousCells.setSize(porousCelli);
122 forAll(porousCells, porousCelli)
124 start[porousCelli] =
C[porousCells[porousCelli]];
125 end[porousCelli] = start[porousCelli] + searchSpan*zDir;
134 List<pointIndexHit> hitInfo;
139 forAll(porousCells, celli)
145 porousCells[porousCelli] = porousCells[celli];
148 (hit.point() -
C[porousCells[porousCelli]]) & zDir;
155 porousCells.setSize(porousCelli);
156 zTop.setSize(porousCelli);
159 triSurface groundSurface
164 mesh.boundaryMesh().patchSet(groundPatches),
182 forAll(groundSurfaceProcTris, i)
184 nTris += groundSurfaceProcTris[i].size();
187 List<labelledTri> groundSurfaceTris(nTris);
190 forAll(groundSurfaceProcTris, i)
192 forAll(groundSurfaceProcTris[i], j)
194 groundSurfaceTris[trii] = groundSurfaceProcTris[i][j];
195 groundSurfaceTris[trii][0] += offset;
196 groundSurfaceTris[trii][1] += offset;
197 groundSurfaceTris[trii][2] += offset;
200 offset += groundSurfaceProcPoints[i].size();
204 forAll(groundSurfaceProcPoints, i)
206 nPoints += groundSurfaceProcPoints[i].size();
212 forAll(groundSurfaceProcPoints, i)
214 forAll(groundSurfaceProcPoints[i], j)
216 groundSurfacePoints[pointi++] = groundSurfaceProcPoints[i][j];
220 groundSurface = triSurface(groundSurfaceTris, groundSurfacePoints);
224 triSurfaceSearch groundSearch(groundSurface);
228 start.setSize(porousCelli);
229 end.setSize(porousCelli);
231 forAll(porousCells, porousCelli)
233 start[porousCelli] =
C[porousCells[porousCelli]];
234 end[porousCelli] = start[porousCelli] - searchSpan*zDir;
237 groundSearch.findLine(start,
end, hitInfo);
241 forAll(porousCells, porousCelli)
247 zBottom[porousCelli] =
248 (
C[porousCells[porousCelli]] - hit.point()) & zDir;
256 Sigma_ = SigmaFunc->value(zNorm);
266 zoneID = cellZones.size();
267 cellZones.setSize(zoneID + 1);
284 <<
"Unable to create porous cellZone " <<
zoneName_ 285 <<
": zone already exists" 291 Foam::porosityModels::powerLawLopesdaCosta::powerLawLopesdaCosta
294 const word& modelType,
297 const word& dummyCellZoneName
307 powerLawLopesdaCostaZone::zoneName_
309 Cd_(coeffs_.
get<scalar>(
"Cd")),
310 C1_(coeffs_.
get<scalar>(
"C1")),
311 rhoName_(coeffs_.getOrDefault<
word>(
"rho",
"rho"))
413 dict_.writeEntry(name_,
os);
List< ReturnType > get(const UPtrList< T > &list, const AccessOp &aop)
List of values generated by applying the access operation to each list item.
virtual void findLine(const pointField &start, const pointField &end, List< pointIndexHit > &) const
Find first intersection on segment from start to end.
Top level data entry class for use in dictionaries. Provides a mechanism to specify a variable as a c...
Graphite solid properties.
defineTypeNameAndDebug(powerLawLopesdaCosta, 0)
Variant of the power law porosity model with spatially varying drag coefficient.
virtual void correct(fvVectorMatrix &UEqn) const
Add resistance.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
const scalarField & Sigma() const
Return the porosity surface area per unit volume zone field.
addToRunTimeSelectionTable(porosityModel, powerLawLopesdaCosta, mesh)
virtual tmp< pointField > points() const
Get the points that define the surface.
static void apply(bitSet &selection, const Detail::parcelSelection::actionType action, const Predicate &accept, const UList< Type > &list, const AccessOp &aop)
PointIndexHit< point > pointIndexHit
A PointIndexHit with a 3D point.
static bool & parRun() noexcept
Test if this a parallel run.
A bounding box defined in terms of min/max extrema points.
static int myProcNo(const label communicator=worldComm)
Number of this process (starting from masterNo() = 0)
Macros for easy insertion into run-time selection tables.
#define forAll(list, i)
Loop across all elements in list.
powerLawLopesdaCostaZone(const word &name, const word &modelType, const fvMesh &mesh, const dictionary &dict)
Constructor.
IOoject and searching on triSurface.
static void allGatherList(List< T > &values, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm)
Gather data, but keep individual values separate. Uses linear/tree communication. ...
static label nProcs(const label communicator=worldComm)
Number of ranks in parallel run (for given communicator) is 1 for serial run.
vectorField pointField
pointField is a vectorField.
virtual void calcForce(const volVectorField &U, const volScalarField &rho, const volScalarField &mu, vectorField &force) const
Calculate the porosity force.
A class representing the concept of a GeometricField of 1 used to avoid unnecessary manipulations for...
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
label findZoneID(const word &zoneName) const
Find zone index by name, return -1 if not found.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
virtual void calcTransformModelData()
Transform the model data wrt mesh changes.
A List of wordRe with additional matching capabilities.
A special matrix type and solver, designed for finite volume solutions of scalar equations. Face addressing is used to make all matrix assembly and solution loops vectorise.
bool writeData(Ostream &os) const
Write.
errorManip< error > abort(error &err)
An Ostream is an abstract base class for all output systems (streams, files, token lists...
const dimensionSet dimForce
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
OBJstream os(runTime.globalPath()/outputName)
scalarField Sigma_
Porosity surface area per unit volume zone field.
const dimensionedScalar mu
Atomic mass unit.
Mesh data needed to do the Finite Volume discretisation.
A special matrix type and solver, designed for finite volume solutions of scalar equations.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
const word zoneName_
Automatically generated zone name for this porous zone.
Defines the attributes of an object for which implicit objectRegistry management is supported...
virtual ~powerLawLopesdaCosta()
Destructor.
ZoneMesh< cellZone, polyMesh > cellZoneMesh
A ZoneMesh with the type cellZone.
Top level model for porosity models.
static constexpr const zero Zero
Global zero (0)