Loading...
Searching...
No Matches
checkFaMesh.C
Go to the documentation of this file.
1/*---------------------------------------------------------------------------*\
2 ========= |
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4 \\ / O peration |
5 \\ / A nd | www.openfoam.com
6 \\/ M anipulation |
7-------------------------------------------------------------------------------
8 Copyright (C) 2016-2017 Wikki Ltd
9 Copyright (C) 2021-2025 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
12 This file is part of OpenFOAM.
13
14 OpenFOAM is free software: you can redistribute it and/or modify it
15 under the terms of the GNU General Public License as published by
16 the Free Software Foundation, either version 3 of the License, or
17 (at your option) any later version.
18
19 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26
27Application
28 makeFaMesh
29
30Description
31 Check a finite-area mesh
32
33Original Authors
34 Zeljko Tukovic, FAMENA
35 Hrvoje Jasak, Wikki Ltd.
36
37\*---------------------------------------------------------------------------*/
38
39#include "Time.H"
40#include "argList.H"
41#include "faMesh.H"
42#include "faMeshTools.H"
43#include "polyMesh.H"
44#include "areaFaMesh.H"
45#include "edgeFaMesh.H"
46#include "areaFields.H"
47#include "edgeFields.H"
48#include "processorFaPatch.H"
50#include "foamVtkLineWriter.H"
51#include "regionProperties.H"
52
53// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
54
55using namespace Foam;
56
57// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
58
59int main(int argc, char *argv[])
60{
62 (
63 "Check a finite-area mesh"
64 );
65
67 (
68 "write-vtk",
69 "Write mesh as a vtp (vtk) file for display or debugging"
70 );
71
73 (
74 "geometryOrder",
75 "N",
76 "Test different geometry order - experimental!!",
77 true // Advanced option
78 );
79
80 #include "addRegionOption.H"
82 #include "setRootCase.H"
83 #include "createTime.H"
84
85 // Handle area region selections
87
88 // ------------------------------------------------------------------------
89
90 #include "createNamedPolyMesh.H"
91
92 int geometryOrder(1);
93 if (args.readIfPresent("geometryOrder", geometryOrder))
94 {
95 Info<< "Setting faMesh::geometryOrder = " << geometryOrder << nl
96 << "(experimental)" << nl << endl;
97
98 faMesh::geometryOrder(geometryOrder);
99 }
100
101 for (const word& areaName : areaRegionNames)
102 {
103 Info<< "Create faMesh";
104 if (!polyMesh::regionName(areaName).empty())
105 {
106 Info<< " [" << areaName << "]";
107 }
108 Info<< " for time = " << runTime.timeName() << nl;
109
110 autoPtr<faMesh> faMeshPtr(faMesh::TryNew(areaName, mesh));
111
112 if (!faMeshPtr)
113 {
114 Info<< " ...failed to create area-mesh";
115 if (!polyMesh::regionName(areaName).empty())
116 {
117 Info<< " [" << areaName << "]";
118 }
119 Info<< endl;
120 continue;
121 }
122 else
123 {
124 Info<< endl;
125 }
126
127 const auto& aMesh = faMeshPtr();
128
129 // Mesh information (verbose)
131
132 if (args.found("write-vtk"))
133 {
134 #include "faMeshWriteVTK.H"
135 }
136 }
137
138 Info<< "\nEnd\n" << endl;
139
140 return 0;
141}
142
143
144// ************************************************************************* //
Required Classes.
Required Classes.
static void addBoolOption(const word &optName, const string &usage="", bool advanced=false)
Add a bool option to validOptions with usage information.
Definition argList.C:389
static void addOption(const word &optName, const string &param="", const string &usage="", bool advanced=false)
Add an option to validOptions with usage information.
Definition argList.C:400
static void addNote(const string &note)
Add extra notes for the usage information.
Definition argList.C:477
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition autoPtr.H:65
static void printMeshChecks(const faMesh &mesh, const int verbose=1)
Report mesh information.
static int geometryOrder() noexcept
Return the current geometry treatment.
Definition faMesh.H:944
static autoPtr< faMesh > TryNew(const word &areaName, const polyMesh &pMesh)
Read construction from polyMesh if all files are available.
Definition faMeshNew.C:188
static const word & regionName(const word &region)
The mesh region name or word::null if polyMesh::defaultRegion.
Definition polyMesh.C:796
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
engineTime & runTime
Required Classes.
wordList areaRegionNames
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
Foam::argList args(argc, argv)