Loading...
Searching...
No Matches
lumpedPointZones.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-2021 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Application
27 lumpedPointZones
28
29Description
30 Produce a VTK PolyData file \c lumpedPointZones.vtp in which the
31 segmentation of the pressure integration zones can be visualized
32 for diagnostic purposes. Does not use external coupling.
33
34\*---------------------------------------------------------------------------*/
35
36#include "argList.H"
37#include "Time.H"
38#include "timeSelector.H"
39
40#include "lumpedPointTools.H"
42#include "fvMesh.H"
43
44using namespace Foam;
45
46// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47
48int main(int argc, char *argv[])
49{
51 (
52 "Create lumpedPointZones.vtp to verify the segmentation of"
53 " pressure integration zones used by lumpedPoint BC."
54 );
55
56 argList::noFunctionObjects(); // Never use function objects
57
59 (
60 "Test initial lumped points state without a mesh"
61 );
63 (
64 "visual-length",
65 "len",
66 "Visualization length for planes (visualized as triangles)"
67 );
68
70 (
71 "no-interpolate",
72 "Suppress calculation/display of point interpolators"
73 );
74
76
77 #include "addRegionOption.H"
78 #include "setRootCase.H"
79 #include "createTime.H"
80
81 const bool noInterpolate = args.found("no-interpolate");
82
83 args.readIfPresent("visual-length", lumpedPointState::visLength);
84
85 if (args.dryRun())
86 {
87 // Create without a mesh
90
91 if (!movement)
92 {
93 Info<< "No valid movement found" << endl;
94 return 1;
95 }
96
97 const word outputName("state.vtp");
98
99 Info<< "dry-run: writing " << outputName << nl;
100
101 movement().writeStateVTP(movement().state0(), outputName);
102
103 Info<< "\nEnd\n" << endl;
104
105 return 0;
106 }
107
108
109 runTime.setTime(instant(0, runTime.constant()), 0);
110
111 #include "createNamedMesh.H"
112
114
115 if (!movement)
116 {
117 Info<< "No valid movement found" << endl;
118 return 1;
119 }
120
121 // Initial positions/rotations
122 movement().writeStateVTP("state.vtp");
123
125
127 if (!nPatches)
128 {
129 Info<< "No point patches with lumped movement found" << endl;
130 return 2;
131 }
132
133 Info<<"Lumped point patch controls set on "
134 << nPatches << " patches" << nl;
135
136 Info<<"Areas per point: " << flatOutput(movement().areas(mesh)) << nl;
137
138 if (noInterpolate)
139 {
140 // Initial geometry, with zones
141 movement().writeZonesVTP("lumpedPointZones.vtp", mesh, points0);
142 }
143 else
144 {
146
147 // Initial geometry, with zones and interpolations
148 movement().writeVTP("lumpedPointZones.vtp", mesh, points0);
149 }
150
151 Info<< nl
152 << "wrote 'state.vtp' (reference state)" << nl
153 << "wrote 'lumpedPointZones.vtp'" << nl
154 << "\nEnd\n" << endl;
155
156 return 0;
157}
158
159// ************************************************************************* //
Required Classes.
static void noFunctionObjects(bool addWithOption=false)
Remove '-noFunctionObjects' option and ignore any occurrences.
Definition argList.C:562
static void addVerboseOption(const string &usage="", bool advanced=false)
Enable a 'verbose' bool option, with usage information.
Definition argList.C:535
static void addDryRunOption(const string &usage, bool advanced=false)
Enable a 'dry-run' bool option, with usage information.
Definition argList.C:519
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
An instant of time. Contains the time value and name. Uses Foam::Time when formatting the name.
Definition instant.H:56
static autoPtr< lumpedPointIOMovement > New(const objectRegistry &obr, label ownerId=-1)
Create a movement object in the registry by reading system dictionary.
static scalar visLength
The length for visualization triangles.
A class for handling words, derived from Foam::string.
Definition word.H:66
dynamicFvMesh & mesh
engineTime & runTime
Required Classes.
word outputName("finiteArea-edges.obj")
label setPatchControls(const pointVectorField &pvf, const pointField &points0)
Return the patch-ids associated with a "lumpedPointDisplacement" type.
label setInterpolators(const pointVectorField &pvf, const pointField &points0)
Return the patch-ids associated with a "lumpedPointDisplacement" type.
pointIOField points0Field(const polyMesh &mesh)
Return the 0 or constant points field.
Namespace for OpenFOAM.
messageStream Info
Information stream (stdout output on master, null elsewhere).
vectorIOField pointIOField
pointIOField is a vectorIOField.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition Ostream.H:519
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
Definition FlatOutput.H:217
constexpr char nl
The newline '\n' character (0x0a).
Definition Ostream.H:50
label nPatches
Foam::argList args(argc, argv)
pointField points0(pointIOField(IOobject("points", mesh.time().constant(), polyMesh::meshSubDir, mesh, IOobject::MUST_READ, IOobject::NO_WRITE, IOobject::NO_REGISTER)))