log.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2018-2022 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::functionObjects::log
26 
27 Description
28  Calculates the natural logarithm of the specified scalar field.
29 
30  Performs \f$ln(max(x, a))\f$ where \f$x\f$ is the field and \f$a\f$ an
31  optional clip to handle 0 or negative \f$x\f$. Dimension checking can
32  optionally be suspended for this operation if \f$x\f$ is dimensioned.
33 
34  Example of function object specification:
35  \verbatim
36  log1
37  {
38  type log;
39  libs ("libfieldFunctionObjects.so");
40  field p;
41  clip 1e-3;
42  checkDimensions no;
43  }
44  \endverbatim
45 
46  or using \c foamPostProcess
47  \verbatim
48  foamPostProcess -func 'log(p, clip=1e-3, checkDimensions=no)'
49  \endverbatim
50 
51 Usage
52  \table
53  Property | Description | Required | Default value
54  type | Type name: log | yes |
55  clip | Clip value | no |
56  checkDimensions | Dimension checking switch | no |
57  \endtable
58 
59 See also
60  Foam::functionObjects::fieldExpression
61  Foam::functionObjects::fvMeshFunctionObject
62 
63 SourceFiles
64  log.C
65 
66 \*---------------------------------------------------------------------------*/
67 
68 #ifndef functionObjects_log_H
69 #define functionObjects_log_H
70 
71 #include "fieldExpression.H"
72 
73 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
74 
75 namespace Foam
76 {
77 namespace functionObjects
78 {
79 
80 /*---------------------------------------------------------------------------*\
81  Class log Declaration
82 \*---------------------------------------------------------------------------*/
83 
84 class log
85 :
86  public fieldExpression
87 {
88  // Private Data
89 
90  //- Optional clip, default = false
91  bool clip_;
92 
93  //- Optional clip value
94  scalar clipValue_;
95 
96  //- Optional dimension checking override
97  Switch checkDimensions_;
98 
99 
100  // Private Member Functions
101 
102  //- Calculate the log field and return true if successful
103  virtual bool calc();
104 
105 
106 public:
107 
108  //- Runtime type information
109  TypeName("log");
110 
111 
112  // Constructors
113 
114  //- Construct from Time and dictionary
115  log
116  (
117  const word& name,
118  const Time& runTime,
119  const dictionary& dict
120  );
121 
122 
123  //- Destructor
124  virtual ~log();
125 
126 
127  // Member Functions
128 
129  //- Read the randomise data
130  virtual bool read(const dictionary&);
131 };
132 
133 
134 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
135 
136 } // End namespace functionObjects
137 } // End namespace Foam
138 
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 
141 #endif
142 
143 // ************************************************************************* //
Class to control time during OpenFOAM simulations that is also the top-level objectRegistry.
Definition: Time.H:76
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:162
Switch log
Switch write log to Info.
const word & name() const
Return the name of this functionObject.
virtual ~log()
Destructor.
Definition: log.C:110
TypeName("log")
Runtime type information.
virtual bool read(const dictionary &)
Read the randomise data.
Definition: log.C:116
A class for handling words, derived from string.
Definition: word.H:62
Namespace for OpenFOAM.
dimensionedScalar log(const dimensionedScalar &ds)
dictionary dict