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()();
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" 138 fieldDict.subDict(
"boundaryField");
140 for (
const entry&
e : boundaryFieldDict)
142 const word
type(
e.dict().get<word>(
"type"));
146 if (!constraintPatches.found(
type))
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());
421 createFromMesh_(false),
455 std::move(points1D_),
458 std::move(neighbour1D_)
readOption readOpt() const noexcept
Get the read option.
defineTypeNameAndDebug(simplifiedDynamicFvMeshBase, 0)
errorManipArg< error, int > exit(error &err, const int errNo=1)
const word localInstance_
Location of existing mesh (if present)
columnFvMesh(const Time &runTime, const word ®ionName=polyMesh::defaultRegion)
Constructor.
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 word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
bool read()
Read the solution dictionary.
vectorIOField pointIOField
pointIOField is a vectorIOField.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
constexpr char nl
The newline '\n' character (0x0a)
Ostream & endl(Ostream &os)
Add newline and flush stream.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
Ignore writing from objectRegistry::writeObject()
T get(const word &keyword, enum keyType::option matchOpt=keyType::REGEX) const
Find and return a T. FatalIOError if not found, or if the number of tokens is incorrect.
Functions to generate simplified finite volume meshes.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Macros for easy insertion into run-time selection tables.
addToRunTimeSelectionTable(simplifiedDynamicFvMeshBase, simplifiedstaticFvMesh, time)
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
static bool fvPatchFieldExists(const word &patchType)
Helper function to see if the patch type exists in the run-time selection tables. ...
const dimensionedScalar e
Elementary charge.
A class for handling words, derived from Foam::string.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
#define DebugInfo
Report an information message using Foam::Info.
void addLocalPatches(fvMesh &mesh) const
Add the patches to the mesh.
int debug
Static debugging option.
Empty front and back plane patch. Used for 2-D geometries.
const word regionName_
Region of existing mesh.
columnFvMeshInfo(const Time &runTime, const word ®ionName)
static wordList constraintTypes()
Return a list of all the constraint patch types.
vector point
Point is a vector.
label nPatchWithFace_
Number of patches with at least 1 local face.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
#define WarningInFunction
Report a warning using Foam::Warning.
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
Mesh data needed to do the Finite Volume discretisation.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir)
const polyBoundaryMesh & patches
#define DebugPout
Report an information message using Foam::Pout.
messageStream Info
Information stream (stdout output on master, null elsewhere)
static autoPtr< polyPatch > New(const word &patchType, const word &name, const label size, const label start, const label index, const polyBoundaryMesh &bm)
Return pointer to a new patch created on freestore from components.
Mesh consisting of general polyhedral cells.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
Defines the attributes of an object for which implicit objectRegistry management is supported...
static int disallowGenericZones
Debug switch to disallow the use of generic zones.
dictionary patchEntries_
Dictionary of patch information.
IOField< vector > vectorIOField
IO for a Field of vector.
void initialiseZones(fvMesh &mesh)
Initialise zones if constructed from mesh.
static int debug
Debug switch.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
Do not request registration (bool: false)
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))
A keyword and a list of tokens is an 'entry'.
bool read()
Read schemes from IOdictionary, respects the "select" keyword.
static constexpr const zero Zero
Global zero (0)