41namespace simplifiedMeshes
58bool 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"
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");
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
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_,
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_)
Macros for easy insertion into run-time selection tables.
#define addToRunTimeSelectionTable(baseType, thisType, argNames)
Add to construction table with typeName as the key.
Defines the attributes of an object for which implicit objectRegistry management is supported,...
const word & headerClassName() const noexcept
Return name of the class name read from header.
readOption readOpt() const noexcept
The read option.
const fileName & instance() const noexcept
Read access to instance path component.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
virtual bool read()
Re-read model coefficients if they have changed.
const word & constant() const
Return constant name.
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
static autoPtr< Time > New()
Construct (dummy) Time - no functionObjects or libraries.
static word timeName(const scalar t, const int precision=precision_)
std::enable_if< std::is_same< bool, TypeT >::value, bool >::type get(const label i) const
static int disallowGenericZones
Debug switch to disallow the use of generic zones.
static int debug
Debug switch.
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
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'.
virtual bool write()
Write the output fields.
Mesh data needed to do the Finite Volume discretisation.
constant condensation/saturation model.
Mesh consisting of general polyhedral cells.
void setInstance(const fileName &instance, const IOobject::writeOption wOpt=IOobject::AUTO_WRITE)
Set the instance for mesh files.
static word meshSubDir
Return the mesh sub-directory name (usually "polyMesh")
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.
Functions to generate simplified finite volume meshes.
static bool fvPatchFieldExists(const word &patchType)
dictionary patchEntries_
Dictionary of patch information.
label nPatchWithFace_
Number of patches with at least 1 local face.
const word regionName_
Region of existing mesh.
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.
static int disallowGenericSets
Debug switch to disallow the use of generic sets.
void initialise()
Initialise integral-scale box properties.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
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(Foam::polyMesh::defaultRegion)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, false)
#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.
messageStream Info
Information stream (stdout output on master, null elsewhere)
vector point
Point is a vector.
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
IOField< vector > vectorIOField
vectorField with IO.
Ostream & endl(Ostream &os)
Add newline and flush stream.
vectorIOField pointIOField
pointIOField is a vectorIOField.
static constexpr const zero Zero
Global zero (0)
HashSet< word, Hash< word > > wordHashSet
A HashSet of words, uses string hasher.
prefixOSstream Pout
OSstream wrapped stdout (std::cout) with parallel prefix.
errorManipArg< error, int > exit(error &err, const int errNo=1)
constexpr char nl
The newline '\n' character (0x0a)
List< treeBoundBox > meshBb(1, treeBoundBox(boundBox(coarseMesh.points(), false)).extend(rndGen, 1e-3))
static const char *const typeName
The type name used in ensight case files.