35 {
"xMin",
"xMax",
"yMin",
"yMax",
"zMin",
"zMax"};
91 dictionary
dict(
"backgroundMesh");
93 dict.
add(
"xMin", bb_.min().x(),
true);
94 dict.
add(
"xMax", bb_.max().x(),
true);
95 dict.
add(
"yMin", bb_.min().y(),
true);
96 dict.
add(
"yMax", bb_.max().y(),
true);
97 dict.
add(
"zMin", bb_.min().z(),
true);
98 dict.
add(
"zMax", bb_.max().z(),
true);
99 dict.
add(
"xCells", nCells_.x(),
true);
100 dict.
add(
"yCells", nCells_.y(),
true);
101 dict.
add(
"zCells", nCells_.z(),
true);
110 Pair<word> defaultPatch;
112 word opt =
"defaultPatch";
113 if (patchOpts_.found(opt))
115 defaultPatch = readPatchOption(opt);
119 defaultPatch = {
"background",
"internal"};
122 beginDict(os_,
"defaultPatch");
124 os_ <<
indent <<
"name " << defaultPatch.first() <<
";" <<
nl
125 <<
indent <<
"type " << defaultPatch.second() <<
";" <<
endl;
129 Info<<
"\nAdding defaultPatch '" << defaultPatch.first()
130 <<
"' of type '" << defaultPatch.second() <<
"'" <<
endl;
142 <<
" { type " <<
type
143 <<
"; faces ( " <<
face.c_str()
147 <<
"' of type '" <<
type <<
"'" <<
endl;
154 bool enableBoundary = clearBoundary_;
162 enableBoundary = patchOpts_.found(
patches[i] +
"Patch");
167 os_ <<
"// delete \"-disabled\" to enable boundary settings" <<
endl;
169 Info<<
"\nNote: The boundary list in blockMeshDict is disabled" <<
nl
170 <<
"To enable, open the file and edit line number "
171 << os_.lineNumber() <<
nl <<
endl;
177 enableBoundary ?
"boundary" :
"boundary-disabled"
192 const bool optFound(patchOpts_.found(
patches[i] +
"Patch"));
196 if (clearBoundary_ && !optFound)
201 Pair<word> patch(
patches[i],
"patch");
205 patch = readPatchOption(patch.first() +
"Patch");
208 writePatch(patch.first(), patch.second(), faces[i]);
217 beginList(os_,
"vertices");
219 writeVertex(
"xMin",
"yMin",
"zMin");
220 writeVertex(
"xMax",
"yMin",
"zMin");
221 writeVertex(
"xMax",
"yMax",
"zMin");
222 writeVertex(
"xMin",
"yMax",
"zMin");
223 writeVertex(
"xMin",
"yMin",
"zMax");
224 writeVertex(
"xMax",
"yMin",
"zMax");
225 writeVertex(
"xMax",
"yMax",
"zMax");
226 writeVertex(
"xMin",
"yMax",
"zMax");
234 beginList(os_,
"blocks");
236 os_ <<
indent <<
"hex (0 1 2 3 4 5 6 7)" <<
nl
238 <<
indent <<
"$!backgroundMesh/xCells" <<
nl
239 <<
indent <<
"$!backgroundMesh/yCells" <<
nl
250 beginList(os_,
"edges");
257 beginList(os_,
"mergePatchPairs");
266 const fileName&
name,
269 const meshingSurfaceList& surfaces,
270 const bool& boundsOpt,
271 const Vector<label>& nCells,
272 const label minDimCells,
273 const label refineFactor,
274 const HashTable<Pair<word>>& patchOpts,
275 const bool clearBoundary
278 blockMeshConfigurationBase(
name, dir,
time, surfaces, patchOpts),
280 minDimCells_(minDimCells),
281 refineFactor_(refineFactor),
282 clearBoundary_(clearBoundary)
284 calcBlockMeshDict(boundsOpt);
298 dict_.writeHeader(os_, word(
"dictionary"));
300 writeBackgroundMesh();
306 writeMergePatchPairs();
308 dict_.writeEndDivider(os_);
#define forAll(list, i)
Loop across all elements in list.
Functions for calculating the bounds and number of cells of a background mesh configured within a blo...
~blockMeshCartesianConfiguration()
Destructor.
void writeEdges()
Write edges list.
static const List< word > patches
Default patch names for the background mesh.
void writeBackgroundMesh()
Write backgroundMesh sub-dictionary.
const label minDimCells_
Number of cells in background mesh shortest direction.
const label refineFactor_
Refinement factor used to scale nCells.
Vector< label > nCells_
Number of cells in background mesh block.
void writeBoundary()
Write the boundary sub-dictionary.
void calcBlockMeshDict(const bool &boundsOpt)
Calculate the parameters for the blockMeshDict file.
void writeMergePatchPairs()
Write mergePatchPairs.
void writeDefaultPatch()
Write the defaultPatch entry.
void writeBlocks()
Write blocks sub-dictionary.
void write()
Write the blockMeshDict.
void writeVertices()
Write vertices list.
blockMeshCartesianConfiguration(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const bool &boundsOpt, const Vector< label > &nCells, const label minDimCells, const label refineFactor, const HashTable< Pair< word >> &patchOpts, const bool clearBoundary)
Construct from components.
void writePatch(const word &name, const word &type, const string &face)
Write a patch in the boundary sub-dictionary.
void roundBoundingBox(boundBox &bb, const scalar s)
Round a bounding box by the rounding scale.
boundBox bb_
Bounding box for the background mesh block.
scalar minDim() const
Smallest length/height/width dimension.
vector span() const
The bounding box span (from minimum to maximum)
const fileName & name() const
Return the dictionary name.
bool add(entry *, bool mergeEntry=false)
Add a new entry.
Motion of the mesh specified as a list of pointMeshMovers.
const fvPatchList & patches
Ostream & decrIndent(Ostream &os)
Decrement the indent level.
bool isEven(const label l)
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Vector< label > setMinDimCells(const vector &v, const scalar s)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
void cmptMin(Field< typename Field< Type >::cmptType > &res, const UList< Type > &f)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
scalar roundingScale(const scalar s)
Ostream & indent(Ostream &os)
Indent stream.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.