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);
105 <<
"convertToMeters 1;" <<
nl
112 Pair<word> defaultPatch;
114 word opt =
"defaultPatch";
115 if (patchOpts_.found(opt))
117 defaultPatch = readPatchOption(opt);
121 defaultPatch = {
"background",
"internal"};
124 beginDict(os_,
"defaultPatch");
126 os_ <<
indent <<
"name " << defaultPatch.first() <<
";" <<
nl
127 <<
indent <<
"type " << defaultPatch.second() <<
";" <<
endl;
131 Info<<
"\nAdding defaultPatch '" << defaultPatch.first()
132 <<
"' of type '" << defaultPatch.second() <<
"'" <<
endl;
144 <<
" { type " <<
type
145 <<
"; faces ( " <<
face.c_str()
149 <<
"' of type '" <<
type <<
"'" <<
endl;
156 bool enableBoundary = clearBoundary_;
164 enableBoundary = patchOpts_.found(
patches[i] +
"Patch");
169 os_ <<
"// delete \"-disabled\" to enable boundary settings" <<
endl;
171 Info<<
"\nNote: The boundary list in blockMeshDict is disabled" <<
nl
172 <<
"To enable, open the file and edit line number "
173 << os_.lineNumber() <<
nl <<
endl;
179 enableBoundary ?
"boundary" :
"boundary-disabled"
182 const List<word> faces
194 const bool optFound(patchOpts_.found(
patches[i] +
"Patch"));
198 if (clearBoundary_ && !optFound)
203 Pair<word> patch(
patches[i],
"patch");
207 patch = readPatchOption(patch.first() +
"Patch");
210 writePatch(patch.first(), patch.second(), faces[i]);
219 beginList(os_,
"vertices");
221 writeVertex(
"xMin",
"yMin",
"zMin");
222 writeVertex(
"xMax",
"yMin",
"zMin");
223 writeVertex(
"xMax",
"yMax",
"zMin");
224 writeVertex(
"xMin",
"yMax",
"zMin");
225 writeVertex(
"xMin",
"yMin",
"zMax");
226 writeVertex(
"xMax",
"yMin",
"zMax");
227 writeVertex(
"xMax",
"yMax",
"zMax");
228 writeVertex(
"xMin",
"yMax",
"zMax");
236 beginList(os_,
"blocks");
238 os_ <<
indent <<
"hex (0 1 2 3 4 5 6 7)" <<
nl
240 <<
indent <<
"$!backgroundMesh/xCells" <<
nl
241 <<
indent <<
"$!backgroundMesh/yCells" <<
nl
252 beginList(os_,
"edges");
259 beginList(os_,
"mergePatchPairs");
268 const fileName&
name,
271 const meshingSurfaceList& surfaces,
272 const bool& boundsOpt,
273 const Vector<label>& nCells,
274 const label minDimCells,
275 const label refineFactor,
276 const HashTable<Pair<word>>& patchOpts,
277 const bool clearBoundary
280 blockMeshConfigurationBase(
name, dir, time, surfaces, patchOpts),
282 minDimCells_(minDimCells),
283 refineFactor_(refineFactor),
284 clearBoundary_(clearBoundary)
286 calcBlockMeshDict(boundsOpt);
300 dict_.writeHeader(os_, word(
"dictionary"));
302 writeBackgroundMesh();
308 writeMergePatchPairs();
310 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.
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)
void cmptMin(FieldField< Field, typename FieldField< Field, Type >::cmptType > &cf, const FieldField< Field, Type > &f)
Ostream & incrIndent(Ostream &os)
Increment the indent level.
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.