58bool Foam::simplifiedMeshes::columnFvMeshInfo::setPatchEntries
80 Info<<
"Creating simplified mesh using " << allPatchEntries.path()
83 for (
const entry&
e : allPatchEntries)
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");
168void 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;
268 if (debug)
Pout<<
"points:" << points1D_ <<
endl;
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
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;
371 nInternalFace + 4*nPatchWithFace_,
374 emptyPolyPatch::typeName
391 initialiseZone<pointZoneMesh>
397 initialiseZone<faceZoneMesh>(
"face", localInstance_,
mesh.faceZones());
421 createFromMesh_(false),
455 std::move(points1D_),
458 std::move(neighbour1D_)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
@ NO_REGISTER
Do not request registration (bool: false).
readOption readOpt() const noexcept
Get the read option.
@ NO_READ
Nothing to be read.
@ MUST_READ
Reading required.
@ NO_WRITE
Ignore writing from objectRegistry::writeObject().
Defines the attributes of an object for which implicit objectRegistry management is supported,...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static int disallowGenericZones
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
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.
entry * add(entry *entryPtr, bool mergeEntry=false)
Add a new entry.
entry * set(entry *entryPtr)
Assign a new entry, overwriting any existing entry.
Empty front and back plane patch. Used for 2-D geometries.
A keyword and a list of tokens is an 'entry'.
Mesh data needed to do the Finite Volume discretisation.
Read and store dictionary entries for boundary patches The object is *never* registered to avoid regi...
A polyBoundaryMesh is a polyPatch list with registered IO, a reference to the associated polyMesh,...
Mesh consisting of general polyhedral cells.
void setInstance(const fileName &instance, const IOobjectOption::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
static const word & regionName(const word ®ion)
The mesh region name or word::null if polyMesh::defaultRegion.
fileName meshDir() const
Return the local mesh directory (dbDir()/meshSubDir).
const word & regionName() const
The mesh region name or word::null if polyMesh::defaultRegion.
static wordList constraintTypes()
Return a list of all the constraint patch types.
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.
virtual bool write(const bool writeOnProc=true) const
Write using setting from DB.
virtual bool read()
Read object.
Functions to generate simplified finite volume meshes.
static bool fvPatchFieldExists(const word &patchType)
Helper function to see if the patch type exists in the run-time selection tables.
simplifiedFvMesh(const IOobject &io, pointField &&points, faceList &&faces, labelList &&allOwner, labelList &&allNeighbour)
Constructor.
dictionary patchEntries_
Dictionary of patch information.
pointField points1D_
Points.
labelList neighbour1D_
Neighbour addressing.
label nPatchWithFace_
Number of patches with at least 1 local face.
bool createFromMesh_
Created from existing mesh (false = from field).
labelList owner1D_
Owner addressing.
const word regionName_
Region of existing mesh.
columnFvMeshInfo(const Time &runTime, const word ®ionName)
const word localInstance_
Location of existing mesh (if present).
void addLocalPatches(fvMesh &mesh) const
Add the patches to the mesh.
void initialiseZones(fvMesh &mesh)
Initialise zones if constructed from mesh.
Generates a 1D column representation of a mesh based on an existing mesh and/or fields.
columnFvMesh(const Time &runTime, const word ®ionName=polyMesh::defaultRegion)
Constructor.
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
A class for handling words, derived from Foam::string.
#define defineTypeNameAndDebug(Type, DebugSwitch)
Define the typeName and debug information.
const polyBoundaryMesh & patches
Foam::word regionName(args.getOrDefault< word >("region", Foam::polyMesh::defaultRegion))
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define DebugInfo
Report an information message using Foam::Info.
#define WarningInFunction
Report a warning using Foam::Warning.
#define DebugPout
Report an information message using Foam::Pout.
Different types of constants.
Namespace for handling debugging switches.
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
messageStream Info
Information stream (stdout output on master, null elsewhere).
vectorIOField pointIOField
pointIOField is a vectorIOField.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
vector point
Point is a vector.
static constexpr const zero Zero
Global zero (0).
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
IOField< vector > vectorIOField
IO for a Field of vector.
constexpr char nl
The newline '\n' character (0x0a).
List< treeBoundBox > meshBb(1, treeBoundBox(coarseMesh.points()).extend(rndGen, 1e-3))