Loading...
Searching...
No Matches
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 | postProcessing/<FO>/<time>/file
43 output field | vtp | postProcessing/<FO>/<time>/AMINames_{src,tgt}.vtp
44 \endtable
45
46Usage
47 Minimal example by using \c system/controlDict.functions:
48 \verbatim
49 AMIWeightsFO
50 {
51 // Mandatory entries
52 type AMIWeights;
53 libs (fieldFunctionObjects);
54 writeFields <bool>;
55
56 // Inherited entries
57 ...
58 }
59 \endverbatim
60
61 where the entries mean:
62 \table
63 Property | Description | Type | Reqd | Deflt
64 type | Type name: AMIWeights | word | yes | -
65 libs | Library name: fieldFunctionObjects | word | yes | -
66 writeFields | Write weights as VTK fields | bool | yes | -
67 \endtable
68
69 The inherited entries are elaborated in:
70 - \link functionObject.H \endlink
71 - \link writeFile.H \endlink
72
73SourceFiles
74 AMIWeights.C
75 AMIWeightsTemplates.C
76
77\*---------------------------------------------------------------------------*/
78
79#ifndef Foam_functionObjects_AMIWeights_H
80#define Foam_functionObjects_AMIWeights_H
81
83#include "writeFile.H"
84#include "cyclicAMIPolyPatch.H"
85
86// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
87
88namespace Foam
89{
90namespace functionObjects
91{
92
93/*---------------------------------------------------------------------------*\
94 Class AMIWeights Declaration
95\*---------------------------------------------------------------------------*/
96
97class AMIWeights
98:
100 public writeFile
101{
102protected:
103
104 // Protected Data
105
106 //- Flag to write AMI fields (as VTK files)
107 bool writeFields_;
108
109 //- List of AMI patch IDs
111
112
113 // Protected Member Functions
114
115 //- Output file header information
116 virtual void writeFileHeader(Ostream& os);
117
118 //- Helper function to report patch information
119 virtual void reportPatch(const cyclicAMIPolyPatch& pp);
120
121 //- Write weight field
123 (
124 const cyclicAMIPolyPatch& cpp,
125 const scalarField& weightSum,
126 const word& side
127 ) const;
128
129 //- Write weight fields if writeFields=true
130 void writeWeightFields(const cyclicAMIPolyPatch& cpp) const;
131
133public:
134
135 //- Runtime type information
136 TypeName("AMIWeights");
137
138
139 // Constructors
140
141 //- Construct from name, Time and dictionary
143 (
144 const word& name,
145 const Time& runTime,
146 const dictionary& dict
147 );
148
149 //- No copy construct
150 AMIWeights(const AMIWeights&) = delete;
151
152 //- No copy assignment
153 void operator=(const AMIWeights&) = delete;
154
155
156 //- Destructor
157 virtual ~AMIWeights() = default;
158
159
160 // Member Functions
161
162 //- Read the function-object dictionary
163 virtual bool read(const dictionary& dict);
164
165 //- Execute the function-object operations (no-op)
166 virtual bool execute();
167
168 //- Write the function-object results
169 virtual bool write();
170};
171
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175} // End namespace functionObjects
176} // End namespace Foam
177
178// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180#endif
181
182// ************************************************************************* //
uindirectPrimitivePatch pp(UIndirectList< face >(mesh.faces(), faceLabels), mesh.points())
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition Time.H:75
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:133
Computes the min/max/average weights of arbitrary mesh interface (AMI) patches, and optionally report...
Definition AMIWeights.H:136
void writeWeightFields(const cyclicAMIPolyPatch &cpp) const
Write weight fields if writeFields=true.
Definition AMIWeights.C:274
void writeWeightField(const cyclicAMIPolyPatch &cpp, const scalarField &weightSum, const word &side) const
Write weight field.
Definition AMIWeights.C:204
void operator=(const AMIWeights &)=delete
No copy assignment.
virtual void reportPatch(const cyclicAMIPolyPatch &pp)
Helper function to report patch information.
Definition AMIWeights.C:75
virtual bool read(const dictionary &dict)
Read the function-object dictionary.
Definition AMIWeights.C:306
AMIWeights(const word &name, const Time &runTime, const dictionary &dict)
Construct from name, Time and dictionary.
Definition AMIWeights.C:289
virtual ~AMIWeights()=default
Destructor.
bool writeFields_
Flag to write AMI fields (as VTK files).
Definition AMIWeights.H:144
virtual void writeFileHeader(Ostream &os)
Output file header information.
Definition AMIWeights.C:41
AMIWeights(const AMIWeights &)=delete
No copy construct.
TypeName("AMIWeights")
Runtime type information.
virtual bool execute()
Execute the function-object operations (no-op).
Definition AMIWeights.C:336
virtual bool write()
Write the function-object results.
Definition AMIWeights.C:342
labelList patchIDs_
List of AMI patch IDs.
Definition AMIWeights.H:149
Specialization of Foam::functionObject for an Foam::fvMesh, providing a reference to the Foam::fvMesh...
fvMeshFunctionObject(const fvMeshFunctionObject &)=delete
No copy construct.
Base class for writing single files from the function objects.
Definition writeFile.H:113
writeFile(const objectRegistry &obr, const fileName &prefix, const word &name="undefined", const bool writeToFile=true, const string &ext=".dat")
Construct from objectRegistry, prefix, fileName.
Definition writeFile.C:200
A class for handling words, derived from Foam::string.
Definition word.H:66
engineTime & runTime
OBJstream os(runTime.globalPath()/outputName)
Function objects are OpenFOAM utilities to ease workflow configurations and enhance workflows.
Namespace for OpenFOAM.
List< label > labelList
A List of labels.
Definition List.H:62
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition exprTraits.C:127
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68