AMIWeights.H
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) 2018-2020 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
26Class
27 Foam::functionObjects::AMIWeights
28
29Group
30 grpFieldFunctionObjects
31
32Description
33 Computes the min/max/average weights of arbitrary mesh interface (AMI)
34 patches, and optionally reports to a text file or writes VTK surfaces of
35 the sum of the weights and mask fields for arbitrarily coupled mesh
36 interface (ACMI) patches.
37
38 Operands:
39 \table
40 Operand | Type | Location
41 input | - | -
42 output file | dat | $POST/<file>
43 output field | vtp | $POST/<AMINames>_{src,tgt}.vtp
44 \endtable
45
46 where \c $POST=$FOAM_CASE/postProcessing/<FO>/<time>.
47
48Usage
49 Minimal example by using \c system/controlDict.functions:
50 \verbatim
51 AMIWeights1
52 {
53 // Mandatory entries (unmodifiable)
54 type AMIWeights;
55 libs (fieldFunctionObjects);
56
57 // Mandatory entries (runtime modifiable)
58 writeFields false;
59
60 // Optional (inherited) entries
61 ...
62 }
63 \endverbatim
64
65 where the entries mean:
66 \table
67 Property | Description | Type | Req'd | Dflt
68 type | Type name: AMIWeights | word | yes | -
69 libs | Library name: fieldFunctionObjects | word | yes | -
70 writeFields | Write weights as VTK fields | bool | yes | -
71 \endtable
72
73 The inherited entries are elaborated in:
74 - \link functionObject.H \endlink
75 - \link writeFile.H \endlink
76
77 Minimal example by using the \c postProcess utility:
78 \verbatim
79 postProcess -func AMIWeights
80 \endverbatim
81
82See also
83 - Foam::functionObject
84 - Foam::functionObjects::fvMeshFunctionObject
85 - Foam::functionObjects::writeFile
86 - ExtendedCodeGuide::functionObjects::field::AMIWeights
87
88SourceFiles
89 AMIWeights.C
90 AMIWeightsTemplates.C
91
92\*---------------------------------------------------------------------------*/
93
94#ifndef functionObjects_AMIWeights_H
95#define functionObjects_AMIWeights_H
96
98#include "writeFile.H"
99#include "cyclicAMIPolyPatch.H"
100
101// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102
103namespace Foam
104{
105namespace functionObjects
106{
107
108/*---------------------------------------------------------------------------*\
109 Class AMIWeights Declaration
110\*---------------------------------------------------------------------------*/
111
112class AMIWeights
113:
114 public fvMeshFunctionObject,
115 public writeFile
116{
117protected:
118
119 // Protected Data
120
121 //- Flag to write AMI fields (as VTK files)
122 bool writeFields_;
123
124 //- List of AMI patch IDs
126
127
128 // Protected Member Functions
129
130 //- Output file header information
131 virtual void writeFileHeader(Ostream& os);
132
133 //- Helper function to report patch information
134 virtual void reportPatch(const cyclicAMIPolyPatch& pp);
135
136 //- Write weight field
138 (
139 const cyclicAMIPolyPatch& cpp,
140 const scalarField& weightSum,
141 const word& side
142 ) const;
143
144 //- Write weight fields if writeFields=true
145 void writeWeightFields(const cyclicAMIPolyPatch& cpp) const;
146
147
148public:
149
150 //- Runtime type information
151 TypeName("AMIWeights");
152
153
154 // Constructors
155
156 //- Construct from Time and dictionary
158 (
159 const word& name,
160 const Time& runTime,
162 );
163
164 //- No copy construct
165 AMIWeights(const AMIWeights&) = delete;
166
167 //- No copy assignment
168 void operator=(const AMIWeights&) = delete;
169
170
171 //- Destructor
172 virtual ~AMIWeights() = default;
173
174
175 // Member Functions
176
177 //- Read the field min/max data
178 virtual bool read(const dictionary&);
179
180 //- Execute, currently does nothing
181 virtual bool execute();
182
183 //- Write the AMIWeights
184 virtual bool write();
185};
186
187
188// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189
190} // End namespace functionObjects
191} // End namespace Foam
192
193// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
194
195#endif
196
197// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:80
Cyclic patch for Arbitrary Mesh Interface (AMI)
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
const word & name() const noexcept
Return the name of this functionObject.
Computes the min/max/average weights of arbitrary mesh interface (AMI) patches, and optionally report...
Definition: AMIWeights.H:155
void writeWeightFields(const cyclicAMIPolyPatch &cpp) const
Write weight fields if writeFields=true.
Definition: AMIWeights.C:282
void writeWeightField(const cyclicAMIPolyPatch &cpp, const scalarField &weightSum, const word &side) const
Write weight field.
Definition: AMIWeights.C:211
void operator=(const AMIWeights &)=delete
No copy assignment.
virtual void reportPatch(const cyclicAMIPolyPatch &pp)
Helper function to report patch information.
Definition: AMIWeights.C:82
virtual ~AMIWeights()=default
Destructor.
bool writeFields_
Flag to write AMI fields (as VTK files)
Definition: AMIWeights.H:161
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: AMIWeights.C:48
AMIWeights(const AMIWeights &)=delete
No copy construct.
TypeName("AMIWeights")
Runtime type information.
virtual bool execute()
Execute, currently does nothing.
Definition: AMIWeights.C:344
virtual bool write()
Write the AMIWeights.
Definition: AMIWeights.C:350
labelList patchIDs_
List of AMI patch IDs.
Definition: AMIWeights.H:164
virtual bool read(const dictionary &)
Read the field min/max data.
Definition: AMIWeights.C:314
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Base class for writing single files from the function objects.
Definition: writeFile.H:120
A class for handling words, derived from Foam::string.
Definition: word.H:68
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition: List.H:66
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73