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 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::functionObjects::AMIWeights
28 
29 Group
30  grpFieldFunctionObjects
31 
32 Description
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 
48 Usage
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 
82 See also
83  - Foam::functionObject
84  - Foam::functionObjects::fvMeshFunctionObject
85  - Foam::functionObjects::writeFile
86  - ExtendedCodeGuide::functionObjects::field::AMIWeights
87 
88 SourceFiles
89  AMIWeights.C
90  AMIWeightsTemplates.C
91 
92 \*---------------------------------------------------------------------------*/
93 
94 #ifndef functionObjects_AMIWeights_H
95 #define functionObjects_AMIWeights_H
96 
97 #include "fvMeshFunctionObject.H"
98 #include "writeFile.H"
99 #include "cyclicAMIPolyPatch.H"
100 
101 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
102 
103 namespace Foam
104 {
105 namespace functionObjects
106 {
107 
108 /*---------------------------------------------------------------------------*\
109  Class AMIWeights Declaration
110 \*---------------------------------------------------------------------------*/
111 
112 class AMIWeights
113 :
114  public fvMeshFunctionObject,
115  public writeFile
116 {
117 protected:
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
137  void writeWeightField
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 
148 public:
149 
150  //- Runtime type information
151  TypeName("AMIWeights");
152 
153 
154  // Constructors
155 
156  //- Construct from Time and dictionary
157  AMIWeights
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 // ************************************************************************* //
Foam::labelList
List< label > labelList
A List of labels.
Definition: List.H:67
runTime
engineTime & runTime
Definition: createEngineTime.H:13
Foam::functionObjects::AMIWeights::read
virtual bool read(const dictionary &)
Read the field min/max data.
Definition: AMIWeights.C:314
Foam::scalarField
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Definition: primitiveFieldsFwd.H:52
writeFile.H
Foam::functionObjects::AMIWeights::operator=
void operator=(const AMIWeights &)=delete
No copy assignment.
Foam::functionObjects::AMIWeights::patchIDs_
labelList patchIDs_
List of AMI patch IDs.
Definition: AMIWeights.H:164
Foam::Time
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:73
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
fvMeshFunctionObject.H
Foam::functionObjects::AMIWeights::reportPatch
virtual void reportPatch(const cyclicAMIPolyPatch &pp)
Helper function to report patch information.
Definition: AMIWeights.C:82
Foam::functionObjects::AMIWeights::writeWeightFields
void writeWeightFields(const cyclicAMIPolyPatch &cpp) const
Write weight fields if writeFields=true.
Definition: AMIWeights.C:282
Foam::functionObjects::AMIWeights::write
virtual bool write()
Write the AMIWeights.
Definition: AMIWeights.C:350
Foam::functionObjects::fvMeshFunctionObject
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
Definition: fvMeshFunctionObject.H:64
Foam::Field< scalar >
Foam::functionObjects::AMIWeights::writeWeightField
void writeWeightField(const cyclicAMIPolyPatch &cpp, const scalarField &weightSum, const word &side) const
Write weight field.
Definition: AMIWeights.C:211
Foam::functionObjects::AMIWeights::TypeName
TypeName("AMIWeights")
Runtime type information.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::functionObjects::AMIWeights::~AMIWeights
virtual ~AMIWeights()=default
Destructor.
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
Foam::functionObjects::AMIWeights::execute
virtual bool execute()
Execute, currently does nothing.
Definition: AMIWeights.C:344
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
cyclicAMIPolyPatch.H
Foam::functionObjects::AMIWeights
Computes the min/max/average weights of arbitrary mesh interface (AMI) patches, and optionally report...
Definition: AMIWeights.H:151
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::functionObjects::AMIWeights::writeFields_
bool writeFields_
Flag to write AMI fields (as VTK files)
Definition: AMIWeights.H:161
Foam::functionObjects::AMIWeights::AMIWeights
AMIWeights(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: AMIWeights.C:297
Foam::List< label >
Foam::functionObjects::AMIWeights::writeFileHeader
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition: AMIWeights.C:48
Foam::functionObjects::writeFile
Base class for writing single files from the function objects.
Definition: writeFile.H:119
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::cyclicAMIPolyPatch
Cyclic patch for Arbitrary Mesh Interface (AMI)
Definition: cyclicAMIPolyPatch.H:68