mag.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) 2012-2016 OpenFOAM Foundation
9  Copyright (C) 2019-2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
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 
27 Class
28  Foam::functionObjects::mag
29 
30 Group
31  grpFieldFunctionObjects
32 
33 Description
34  Computes the magnitude of an input field.
35 
36  Operands:
37  \table
38  Operand | Type | Location
39  input | {vol,surface}<Type>Field | $FOAM_CASE/<time>/<inpField>
40  output file | - | -
41  output field | {vol,surface}ScalarField | $FOAM_CASE/<time>/<outField>
42  \endtable
43 
44  where \c <Type>=Scalar/Vector/SphericalTensor/SymmTensor/Tensor.
45 
46  With the \c subRegion option, also supports fields on function object
47  surface output (e.g. sampledSurfaces).
48 
49 Usage
50  Minimal example by using \c system/controlDict.functions:
51  \verbatim
52  mag1
53  {
54  // Mandatory entries (unmodifiable)
55  type mag;
56  libs (fieldFunctionObjects);
57 
58  // Mandatory (inherited) entries (runtime modifiable)
59  field <field>;
60 
61  // Optional (inherited) entries
62  ...
63  }
64  \endverbatim
65 
66  where the entries mean:
67  \table
68  Property | Description | Type | Req'd | Dflt
69  type | Type name: mag | word | yes | -
70  libs | Library name: fieldFunctionObjects | word | yes | -
71  field | Name of the operand field | word | yes | -
72  \endtable
73 
74  The inherited entries are elaborated in:
75  - \link functionObject.H \endlink
76  - \link fieldExpression.H \endlink
77 
78  Minimal example by using the \c postProcess utility:
79  \verbatim
80  postProcess -func "mag(<field>)"
81  \endverbatim
82 
83 See also
84  - Foam::functionObject
85  - Foam::functionObjects::fvMeshFunctionObject
86  - Foam::functionObjects::fieldExpression
87  - ExtendedCodeGuide::functionObjects::field::mag
88 
89 SourceFiles
90  mag.C
91  magTemplates.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef functionObjects_mag_H
96 #define functionObjects_mag_H
97 
98 #include "fieldExpression.H"
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 namespace Foam
103 {
104 namespace functionObjects
105 {
106 
107 /*---------------------------------------------------------------------------*\
108  Class mag Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 class mag
112 :
113  public fieldExpression
114 {
115  // Private Member Functions
116 
117  //- Calculate the magnitude of the field and register the result
118  template<class Type>
119  bool calcMag();
120 
121  //- Calculate the magnitude of the field and return true if successful
122  virtual bool calc();
123 
124 
125 public:
126 
127  //- Runtime type information
128  TypeName("mag");
129 
130 
131  // Constructors
132 
133  //- Construct from Time and dictionary
134  mag
135  (
136  const word& name,
137  const Time& runTime,
138  const dictionary& dict
139  );
140 
141  //- No copy construct
142  mag(const mag&) = delete;
143 
144  //- No copy assignment
145  void operator=(const mag&) = delete;
146 
147 
148  //- Destructor
149  virtual ~mag() = default;
150 };
151 
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
154 
155 } // End namespace functionObjects
156 } // End namespace Foam
157 
158 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 
160 #ifdef NoRepository
161  #include "magTemplates.C"
162 #endif
163 
164 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
165 
166 #endif
167 
168 // ************************************************************************* //
runTime
engineTime & runTime
Definition: createEngineTime.H:13
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:62
Foam::functionObjects::mag::operator=
void operator=(const mag &)=delete
No copy assignment.
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
magTemplates.C
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObjects::mag::TypeName
TypeName("mag")
Runtime type information.
Foam::functionObjects::fieldExpression
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
Definition: fieldExpression.H:103
Foam::functionObject::name
const word & name() const
Return the name of this functionObject.
Definition: functionObject.C:131
Foam::functionObjects::mag
Computes the magnitude of an input field.
Definition: mag.H:150
Foam::functionObjects::mag::~mag
virtual ~mag()=default
Destructor.
Foam::mag
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
fieldExpression.H
Foam::functionObjects::mag::mag
mag(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: mag.C:62