checkMesh.H
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 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 Class
25  Foam::functionObjects::checkMesh
26 
27 Description
28  Executes primitiveMesh::checkMesh(true) every execute time for which the
29  mesh changed, i.e. moved or changed topology.
30 
31  Useful to check the correctness of changing and morphing meshes.
32 
33 Usage
34  \table
35  Property | Description | Required | Default value
36  type | type name: checkMesh | yes |
37  noTopology | Skip checking the mesh topology | no | false
38  allTopology | Check all addressing | no | false
39  allGeometry | Check all geometry | no | false
40  writeSurfaces | Reconstruct and write problem faces | no | false
41  surfaceFormat | Format for problem faceSets | no | vtk
42  writeSets | Reconstruct and write problem points | no | false
43  setFormat | Format used to write the problem pointSets | no | vtk
44  nonOrthThreshold | Threshold for non-orthogonality errors | no | 70 deg
45  skewThreshold | Threshold for reporting skewness errors | no | 4
46  stopAt | Stops the run if any mesh checks fail | no | endTime
47  \endtable
48 
49  The optional \c stopAt option may be set to
50  - endTime : Continue running on error
51  - noWriteNow : Stops the run on error without write
52  - writeNow : Stops the run on error and writes fields
53  - nextWrite : Stops the run at the next write time on error
54 
55  Example of checkMesh specification:
56  \verbatim
57  checkMesh
58  {
59  type checkMesh;
60  libs ("libutilityFunctionObjects.so");
61 
62  executeControl timeStep;
63  executeInterval 10;
64 
65  allGeometry true;
66  allTopology true;
67 
68  writeSurfaces true;
69  surfaceFormat vtk;
70 
71  writeSets true;
72  setFormat vtk;
73 
74  stopAt writeNow;
75  }
76  \endverbatim
77 
78  or using the standard configuration file:
79 
80  \verbatim
81  #includeFunc checkMesh(executeInterval=10, allGeometry=true)
82  \endverbatim
83 
84 SourceFiles
85  checkMesh.C
86 
87 \*---------------------------------------------------------------------------*/
88 
89 #ifndef functionObjects_checkMesh_H
90 #define functionObjects_checkMesh_H
91 
92 #include "fvMeshFunctionObject.H"
93 #include "Time.H"
94 
95 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
96 
97 namespace Foam
98 {
99 namespace functionObjects
100 {
101 
102 /*---------------------------------------------------------------------------*\
103  Class checkMesh Declaration
104 \*---------------------------------------------------------------------------*/
105 
106 class checkMesh
107 :
108  public fvMeshFunctionObject
109 {
110  // Private Data
111 
112  bool noTopology_;
113  bool allGeometry_;
114  bool allTopology_;
115 
116  bool writeSurfaces_;
117  word surfaceFormat_;
118 
119  bool writeSets_;
120  word setFormat_;
121 
122  scalar nonOrthThreshold_;
123  scalar skewThreshold_;
124 
125  Time::stopAtControl stopAt_;
126 
127 
128 public:
129 
130  //- Runtime type information
131  TypeName("checkMesh");
132 
133 
134  // Constructors
135 
136  //- Construct from Time and dictionary
137  checkMesh
138  (
139  const word& name,
140  const Time&,
141  const dictionary&
142  );
143 
144 
145  //- Destructor
146  virtual ~checkMesh();
147 
148 
149  // Member Functions
150 
151  //- Read the checkMesh controls
152  virtual bool read(const dictionary&);
153 
154  //- Return the list of fields required
155  virtual wordList fields() const
156  {
157  return wordList::null();
158  }
159 
160  //- Execute primitiveMesh::checkMesh(true)
161  virtual bool execute();
162 
163  //- Do nothing
164  virtual bool write();
165 };
166 
167 
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 
170 } // End namespace functionObjects
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #endif
176 
177 // ************************************************************************* //
static const List< word > & null()
Return a null List.
Definition: ListI.H:118
stopAtControl
Stop-run control options.
Definition: Time.H:102
const word & name() const
Return the name of this functionObject.
TypeName("checkMesh")
Runtime type information.
virtual wordList fields() const
Return the list of fields required.
Definition: checkMesh.H:214
virtual ~checkMesh()
Destructor.
Definition: checkMesh.C:63
checkMesh(const word &name, const Time &, const dictionary &)
Construct from Time and dictionary.
Definition: checkMesh.C:48
virtual bool execute()
Execute primitiveMesh::checkMesh(true)
Definition: checkMesh.C:112
virtual bool write()
Do nothing.
Definition: checkMesh.C:189
virtual bool read(const dictionary &)
Read the checkMesh controls.
Definition: checkMesh.C:69
bool checkMesh(const bool report, const polyMesh &mesh, const dictionary &dict, const labelList &checkFaces, const List< labelPair > &baffles, labelHashSet &wrongFaces)
Check (subset of mesh including baffles) with mesh settings in dict.
Definition: checkMesh.C:33
Namespace for OpenFOAM.
List< word > wordList
A List of words.
Definition: fileName.H:54