blockMeshConfigurationBase.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2023-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 \*---------------------------------------------------------------------------*/
25 
27 #include "polyPatch.H"
28 #include "wallPolyPatch.H"
29 #include "blockMeshFunctions.H"
30 #include "etcFiles.H"
31 
32 // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
33 
35 (
36  boundBox& bb,
37  const scalar s
38 )
39 {
40  Info<< "Rounding bounding box to multiples of " << s << endl;
41 
42  bb.min() = roundDown(bb.min(), s);
43  bb.max() = roundUp(bb.max(), s);
44 }
45 
46 
48 (
49  const word& option
50 ) const
51 {
52  const Pair<word> patchOpt(patchOpts_.find(option)());
53 
54  if
55  (
56  !(
57  constraintTypes_.found(patchOpt.second())
58  || patchOpt.second() == wallPolyPatch::typeName
59  || patchOpt.second() == polyPatch::typeName
60  )
61  )
62  {
63  FatalErrorInFunction<< "Argument to '-"
64  << option << " should be of the form "
65  << "'(<name> <type>)'" << nl
66  << "where <type> must be a generic \"patch\", \"wall\" "
67  << "or a constraint condition:" << nl << nl
68  << constraintTypes_.sortedToc()
69  << exit(FatalError);
70  }
71 
72  return patchOpt;
73 }
74 
75 
77 (
78  const word& x,
79  const word& y,
80  const word& z
81 )
82 {
83  const word bgm("$!backgroundMesh/");
84  os_ << indent << "("
85  << bgm << x << " "
86  << bgm << y << " "
87  << bgm << z << ")"
88  << endl;
89 }
90 
91 
92 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
93 
95 (
96  const fileName& name,
97  const fileName& dir,
98  const Time& time,
99  const meshingSurfaceList& surfaces,
100  const HashTable<Pair<word>>& patchOpts
101 )
102 :
103  caseFileConfiguration(name, dir, time),
104  constraintTypes_
105  (
106  dictionary
107  (
108  IFstream(findEtcFile("caseDicts/setConstraintTypes", true))()
109  ).toc()
110  ),
111  bb_(surfaces.bb()),
112  patchOpts_(patchOpts)
113 {}
114 
115 
116 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
117 
119 {}
120 
121 
122 // ************************************************************************* //
scalar y
Functions for calculating the bounds and number of cells of a background mesh configured within a blo...
void writeVertex(const word &x, const word &y, const word &z)
Write a vertex entry in the vertices list.
void roundBoundingBox(boundBox &bb, const scalar s)
Round a bounding box by the rounding scale.
Pair< word > readPatchOption(const word &option) const
Parse the patch commandline options.
blockMeshConfigurationBase(const fileName &name, const fileName &dir, const Time &time, const meshingSurfaceList &surfaces, const HashTable< Pair< word >> &patchOpts)
Construct from components.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Definition: error.H:334
Functions to search 'etc' directories for configuration files etc.
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(lagrangian::Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.name(), lagrangian::cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
const dimensionSet time
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
scalar roundDown(const scalar x, const scalar s)
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
messageStream Info
fileName findEtcFile(const fileName &, bool mandatory=false)
Search for a file using findEtcFiles.
Definition: etcFiles.C:252
scalar roundUp(const scalar x, const scalar s)
word name(const LagrangianState state)
Return a string representation of a Lagrangian state enumeration.
error FatalError
Ostream & indent(Ostream &os)
Indent stream.
Definition: Ostream.H:243
static const char nl
Definition: Ostream.H:297