Go to the documentation of this file.
41 namespace simplifiedMeshes
58 bool Foam::simplifiedMeshes::columnFvMeshInfo::setPatchEntries
76 if (boundaryIO.typeHeaderOk<polyBoundaryMesh>(
true))
78 polyBoundaryMeshEntries allPatchEntries(boundaryIO);
80 Info<<
"Creating simplified mesh using " << allPatchEntries.path()
83 for (
const entry&
e : allPatchEntries)
85 const word
type(
e.dict().get<word>(
"type"));
87 if (!constraintPatches.found(
type))
89 if (
e.dict().get<label>(
"nFaces"))
115 const IOobject& io = *objects.begin()();
117 if (io.instance() ==
runTime.constant())
120 <<
"No time directories found for field reading"
124 const fieldDictionary fieldDict(io, io.headerClassName());
126 Info<<
"Creating simplified mesh from field "
127 << fieldDict.objectPath()
131 <<
"All boundaries will be approximated using wall-type patches. "
132 <<
"This may cause your" <<
nl
133 <<
" final case to run differently. "
134 <<
"Create your mesh first for improved performance"
137 const dictionary& boundaryFieldDict =
138 fieldDict.subDict(
"boundaryField");
140 for (
const entry&
e : boundaryFieldDict)
142 const word
type(
e.dict().get<word>(
"type"));
146 if (!constraintPatches.found(
type))
149 dictionary simplifiedEntries;
150 simplifiedEntries.add(
"startFace", 0);
151 simplifiedEntries.add(
"nFaces", 1);
152 simplifiedEntries.add(
"type",
"wall");
168 void Foam::simplifiedMeshes::columnFvMeshInfo::initialise(
const Time&
runTime)
173 createFromMesh_ = setPatchEntries(
runTime);
175 const label nPatch = patchEntries_.size();
199 points1D_.setSize(nPatchWithFace_*4 + 4);
200 faces1D_.setSize(nPatchWithFace_*5 + 1);
202 owner1D_.setSize(faces1D_.size(), label(-1));
203 neighbour1D_.setSize(owner1D_.size(), label(-1));
228 boundBox
meshBb(meshPoints,
true);
234 dxi = span.x()/scalar(nPatchWithFace_);
241 origin =
point(-Lref, -Lref, -Lref);
242 dxi = 2.0*Lref/scalar(nPatchWithFace_);
248 const vector dy(0, dyi, 0);
249 const vector dz(0, 0, dzi);
252 points1D_[0] = origin;
253 points1D_[1] = origin + dy;
254 points1D_[2] = origin + dy + dz;
255 points1D_[3] = origin + dz;
259 for (label i = 1; i <= nPatchWithFace_; ++i)
262 points1D_[i*
n] = points1D_[0] + idx;
263 points1D_[i*
n + 1] = points1D_[1] + idx;
264 points1D_[i*
n + 2] = points1D_[2] + idx;
265 points1D_[i*
n + 3] = points1D_[3] + idx;
273 for (label i = 0; i < nPatchWithFace_ - 1; ++i)
276 faces1D_[facei] = face({4 + o, 5 + o, 6 + o, 7 + o});
278 neighbour1D_[facei] = i + 1;
283 for (label i = 0; i < nPatchWithFace_; ++i)
286 faces1D_[facei] = face({0 + o, 4 + o, 7 + o, 3 + o});
290 faces1D_[facei] = face({0 + o, 1 + o, 5 + o, 4 + o});
294 faces1D_[facei] = face({1 + o, 2 + o, 6 + o, 5 + o});
298 faces1D_[facei] = face({3 + o, 7 + o, 6 + o, 2 + o});
304 faces1D_[facei] = face({0, 3, 2, 1});
308 label o = 4*nPatchWithFace_;
309 faces1D_[facei] = face({0 + o, 1 + o, 2 + o, 3 + o});
310 owner1D_[facei] = nPatchWithFace_ - 1;
315 <<
"faces:" << faces1D_ <<
nl
316 <<
"owner:" << owner1D_ <<
nl
317 <<
"neighbour:" << neighbour1D_
329 const label nPatch = patchEntries_.size();
333 label nInternalFace = nPatchWithFace_ - 1;
334 label startFace = nInternalFace;
336 for (
const entry&
e : patchEntries_)
340 const word& patchName =
e.keyword();
344 label nFaces0 = patchDict.
get<label>(
"nFaces");
350 patchDict.
set(
"nFaces", nFaces0);
353 patchDict.
set(
"startFace", startFace);
364 startFace += nFaces0;
369 typeName +
":default",
371 nInternalFace + 4*nPatchWithFace_,
374 emptyPolyPatch::typeName
391 initialiseZone<pointZoneMesh>
397 initialiseZone<faceZoneMesh>(
"face", localInstance_,
mesh.faceZones());
398 initialiseZone<cellZoneMesh>(
"cell", localInstance_,
mesh.cellZones());
427 createFromMesh_(
false),
461 std::move(points1D_),
464 std::move(neighbour1D_)
477 addLocalPatches(*
this);
480 initialiseZones(*
this);
484 setInstance(
runTime.timeName());
int debug
Static debugging option.
A keyword and a list of tokens is an 'entry'.
IOField< vector > vectorIOField
vectorField with IO.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
A class for handling words, derived from Foam::string.
void addLocalPatches(fvMesh &mesh) const
Add the patches to the mesh.
static word defaultRegion
Return the default region name.
static constexpr const zero Zero
Global zero (0)
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
addToRunTimeSelectionTable(simplifiedDynamicFvMeshBase, simplifiedstaticFvMesh, time)
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
Ostream & endl(Ostream &os)
Add newline and flush stream.
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
prefixOSstream Pout
An Ostream wrapper for parallel output to std::cout.
void initialiseZones(fvMesh &mesh)
Initialise zones if constructed from mesh.
bool read()
Read the fvSchemes.
dictionary patchEntries_
Dictionary of patch information.
const word regionName_
Region of existing mesh.
vectorIOField pointIOField
pointIOField is a vectorIOField.
virtual bool write(const bool valid=true) const
Write using setting from DB.
messageStream Info
Information stream (uses stdout - output is on the master only)
static bool fvPatchFieldExists(const word &patchType)
bool read()
Read the solution dictionary.
columnFvMeshInfo(const Time &runTime, const word ®ionName)
static wordList constraintTypes()
Return a list of all the constraint patch types.
columnFvMesh(const Time &runTime, const word ®ionName=fvMesh::defaultRegion)
Constructor.
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
const word localInstance_
Location of existing mesh (if present)
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return a pointer to a new patch created on freestore from.
Macros for easy insertion into run-time selection tables.
Mesh data needed to do the Finite Volume discretisation.
defineTypeNameAndDebug(simplifiedDynamicFvMeshBase, 0)
Vector< scalar > vector
A scalar version of the templated Vector.
#define DebugPout
Report an information message using Foam::Pout.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Empty front and back plane patch. Used for 2-D geometries.
Functions to generate simplified finite volume meshes.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
readOption readOpt() const
The read option.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const dimensionedScalar e
Elementary charge.
const polyBoundaryMesh & patches
const fileName regionPrefix_
Additional prefix for region. Empty if default region.
HashSet< word > wordHashSet
A HashSet with word keys.
static int disallowGenericZones
Debug switch to disallow the use of generic zones.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
vector point
Point is a vector.
#define WarningInFunction
Report a warning using Foam::Warning.
label nPatchWithFace_
Number of patches with at least 1 local face.