magSqr.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) 2016 OpenFOAM Foundation
9  Copyright (C) 2016-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::magSqr
29 
30 Group
31  grpFieldFunctionObjects
32 
33 Description
34  Computes the magnitude of the square 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 functionObject
47  surface output (e.g. sampledSurfaces).
48 
49 Usage
50  Minimal example by using \c system/controlDict.functions:
51  \verbatim
52  magSqr1
53  {
54  // Mandatory entries (unmodifiable)
55  type magSqr;
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: magSqr | 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 "magSqr(<field>)"
81  \endverbatim
82 
83 See also
84  - Foam::functionObject
85  - Foam::functionObjects::fvMeshFunctionObject
86  - Foam::functionObjects::fieldExpression
87  - ExtendedCodeGuide::functionObjects::field::magSqr
88 
89 SourceFiles
90  magSqr.C
91  magSqrTemplates.C
92 
93 \*---------------------------------------------------------------------------*/
94 
95 #ifndef functionObjects_magSqr_H
96 #define functionObjects_magSqr_H
97 
98 #include "fieldExpression.H"
99 
100 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
101 
102 namespace Foam
103 {
104 namespace functionObjects
105 {
106 
107 /*---------------------------------------------------------------------------*\
108  Class magSqr Declaration
109 \*---------------------------------------------------------------------------*/
110 
111 class magSqr
112 :
113  public fieldExpression
114 {
115  // Private Member Functions
116 
117  //- Calculate the magnitude of the sqr of the field
118  //- and register the result
119  template<class Type>
120  bool calcMagSqr();
121 
122  //- Calculate the magnitude of the sqr of the field
123  //- and return true if successful
124  virtual bool calc();
125 
126 
127 public:
128 
129  //- Runtime type information
130  TypeName("magSqr");
131 
132 
133  // Constructors
134 
135  //- Construct from Time and dictionary
136  magSqr
137  (
138  const word& name,
139  const Time& runTime,
140  const dictionary& dict
141  );
142 
143  //- No copy construct
144  magSqr(const magSqr&) = delete;
145 
146  //- No copy assignment
147  void operator=(const magSqr&) = delete;
148 
149 
150  //- Destructor
151  virtual ~magSqr() = default;
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace functionObjects
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #ifdef NoRepository
163  #include "magSqrTemplates.C"
164 #endif
165 
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
167 
168 #endif
169 
170 // ************************************************************************* //
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:65
Foam::functionObjects::magSqr::TypeName
TypeName("magSqr")
Runtime type information.
Foam::functionObjects::magSqr
Computes the magnitude of the square of an input field.
Definition: magSqr.H:150
Foam::magSqr
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Foam::functionObjects::magSqr::operator=
void operator=(const magSqr &)=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:123
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::functionObject::name
const word & name() const noexcept
Return the name of this functionObject.
Definition: functionObject.C:143
Foam::functionObjects::fieldExpression
Intermediate class for handling field expression function objects (e.g. blendingFactor etc....
Definition: fieldExpression.H:120
Foam::functionObjects::magSqr::~magSqr
virtual ~magSqr()=default
Destructor.
fieldExpression.H
Foam::functionObjects::magSqr::magSqr
magSqr(const word &name, const Time &runTime, const dictionary &dict)
Construct from Time and dictionary.
Definition: magSqr.C:63
magSqrTemplates.C