atmCoriolisUSource.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) 2020 CENER
9  Copyright (C) 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::fv::atmCoriolisUSource
29 
30 Group
31  grpAtmFvOptions
32 
33 Description
34  Applies corrections to incorporate the horizontal and vertical components
35  of the Coriolis force for which the rotating frame is Earth.
36 
37  The Coriolis force is an inertial or fictitious force that acts on
38  objects that are in motion within a frame of reference that rotates with
39  respect to an inertial frame.
40 
41  In the atmospheric boundary layer context, for the "Coriolis effect",
42  the rotating reference frame implied is almost always Earth.
43  Because Earth spins, Earth-bound observers need to account for the
44  Coriolis force to correctly analyze the motion of objects. Earth
45  completes one rotation per day, so for motions of everyday objects the
46  Coriolis force is usually quite small compared with other forces; its
47  effects generally become noticeable only for motions occurring over large
48  distances and long periods of time, such as large-scale movement of air in
49  the atmosphere or water in the ocean. Such motions are constrained by the
50  surface of Earth, so only the horizontal component of the Coriolis
51  force is generally important.
52 
53  Corrections applied on:
54  \verbatim
55  U | Velocity [m/s]
56  \endverbatim
57 
58  Required fields:
59  \verbatim
60  U | Velocity [m/s]
61  \endverbatim
62 
63  References:
64  \verbatim
65  Coriolis force. (n.d.).
66  In Wikipedia. Retrieved Feb 26, 2020, from https://w.wiki/JE5
67  \endverbatim
68 
69 Usage
70  Example by using \c constant/fvOptions:
71  \verbatim
72  atmCoriolisUSource1
73  {
74  // Mandatory entries (unmodifiable)
75  type atmCoriolisUSource;
76 
77  atmCoriolisUSourceCoeffs
78  {
79  // Mandatory (inherited) entries (unmodifiable)
80  selectionMode all;
81 
82  // Conditional mandatory entries (unmodifiable)
83  // Select either of the below
84 
85  // Option-1: to directly input rotation vector
86  Omega (0 0 5.65156e-5);
87 
88  // Option-2: to indirectly input rotation vector
89  // by a latitude-period pair
90  latitude 51.971;
91  planetaryRotationPeriod 23.9344694;
92  }
93 
94  // Optional (inherited) entries
95  ...
96  }
97  \endverbatim
98 
99  where the entries mean:
100  \table
101  Property | Description | Type | Req'd | Dflt
102  type | Type name: atmCoriolisUSource | word | yes | -
103  latitude | Geographic coordinate specifying the north–south <!--
104  --> position of a point on the surface of a planetary <!--
105  --> body [degree] | scalar | conditional | 0.0
106  planetaryRotationPeriod | Rotation period of the planetary body <!--
107  --> [h] | scalar | conditional | 23.9344694
108  Omega | Rotation vector of the rotating reference frame <!--
109  --> relative to the inertial frame [rad/s] <!--
110  --> | vector | conditional | (0 0 0)
111  \endtable
112 
113  The inherited entries are elaborated in:
114  - \link fvOption.H \endlink
115  - \link cellSetOption.H \endlink
116 
117 Note
118  - Dimensional consistencies are hard-coded; therefore, no internal
119  check is performed for potential dimension inconsistencies.
120  - The magnitude of the \c latitude is limited to [0, 90], yet its value
121  is allowed to be negative for the southern hemisphere.
122  - The Coriolis force for cell whose volume is less than \c VSMALL is
123  equated to zero.
124 
125 SourceFiles
126  atmCoriolisUSource.C
127 
128 \*---------------------------------------------------------------------------*/
129 
130 #ifndef atmCoriolisUSource_H
131 #define atmCoriolisUSource_H
132 
133 #include "cellSetOption.H"
134 #include "dimensionedVector.H"
135 
136 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
137 
138 namespace Foam
139 {
140 namespace fv
141 {
142 
143 /*---------------------------------------------------------------------------*\
144  Class atmCoriolisUSource Declaration
145 \*---------------------------------------------------------------------------*/
146 
147 class atmCoriolisUSource
148 :
149  public fv::cellSetOption
150 {
151  // Private Data
152 
153  //- Latitude on the planetary body
154  const scalar latitude_;
155 
156  //- Rotation period of the planetary body
157  const scalar planetaryRotationPeriod_;
158 
159  //- Planetary rotation vector
160  const dimensionedVector Omega_;
161 
162 
163  // Private Member Functions
164 
165  //- Rotation vector of the planetary body
166  vector planetaryRotationVector() const;
167 
168 
169 public:
170 
171  //- Runtime type information
172  TypeName("atmCoriolisUSource");
173 
174 
175  // Constructors
176 
177  //- Construct from explicit source name and mesh
179  (
180  const word& sourceName,
181  const word& modelType,
182  const dictionary& dict,
183  const fvMesh& mesh
184  );
185 
186  //- No copy construct
187  atmCoriolisUSource(const atmCoriolisUSource&) = delete;
188 
189  //- No copy assignment
190  void operator=(const atmCoriolisUSource&) = delete;
191 
192 
193  //- Destructor
194  virtual ~atmCoriolisUSource() = default;
195 
196 
197  // Member Functions
198 
199  //- Add explicit contribution to incompressible momentum equation
200  virtual void addSup
201  (
202  fvMatrix<vector>& eqn,
203  const label fieldi
204  );
205 
206  //- Add explicit contribution to compressible momentum equation
207  virtual void addSup
208  (
209  const volScalarField& rho,
210  fvMatrix<vector>& eqn,
211  const label fieldi
212  );
213 
214  //- Add explicit contribution to phase momentum equation
215  virtual void addSup
216  (
217  const volScalarField& alpha,
218  const volScalarField& rho,
219  fvMatrix<vector>& eqn,
220  const label fieldi
221  );
222 
223  //- Read source dictionary
224  virtual bool read(const dictionary& dict)
225  {
226  return true;
227  }
228 };
229 
230 
231 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
232 
233 } // End namespace fv
234 } // End namespace Foam
235 
236 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
237 
238 #endif
239 
240 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::fv::cellSetOption
Intermediate abstract class for handling cell-set options for the derived fvOptions.
Definition: cellSetOption.H:163
Foam::fv::atmCoriolisUSource::operator=
void operator=(const atmCoriolisUSource &)=delete
No copy assignment.
Foam::constant::atomic::alpha
const dimensionedScalar alpha
Fine-structure constant: default SI units: [].
Definition: readThermalProperties.H:212
rho
rho
Definition: readInitialConditions.H:88
cellSetOption.H
Foam::dimensionedVector
dimensioned< vector > dimensionedVector
Dimensioned vector obtained from generic dimensioned type.
Definition: dimensionedVector.H:50
Foam::fv::atmCoriolisUSource::read
virtual bool read(const dictionary &dict)
Read source dictionary.
Definition: atmCoriolisUSource.H:263
Foam::fv::atmCoriolisUSource::addSup
virtual void addSup(fvMatrix< vector > &eqn, const label fieldi)
Add explicit contribution to incompressible momentum equation.
Definition: atmCoriolisUSource.C:123
dict
dictionary dict
Definition: searchingEngine.H:14
dimensionedVector.H
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::dimensioned< vector >
Foam::fvMesh
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:85
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::vector
Vector< scalar > vector
A scalar version of the templated Vector.
Definition: vector.H:51
Foam::fv::atmCoriolisUSource::atmCoriolisUSource
atmCoriolisUSource(const word &sourceName, const word &modelType, const dictionary &dict, const fvMesh &mesh)
Construct from explicit source name and mesh.
Definition: atmCoriolisUSource.C:64
fv
labelList fv(nPoints)
Foam::fv::atmCoriolisUSource::TypeName
TypeName("atmCoriolisUSource")
Runtime type information.
Foam::fv::option::mesh
const fvMesh & mesh() const noexcept
Return const access to the mesh database.
Definition: fvOptionI.H:37
Foam::Vector< scalar >
Foam::fvMatrix
A special matrix type and solver, designed for finite volume solutions of scalar equations....
Definition: fvPatchField.H:68
Foam::fv::atmCoriolisUSource
Applies corrections to incorporate the horizontal and vertical components of the Coriolis force for w...
Definition: atmCoriolisUSource.H:186
Foam::GeometricField< scalar, fvPatchField, volMesh >
Foam::fv::atmCoriolisUSource::~atmCoriolisUSource
virtual ~atmCoriolisUSource()=default
Destructor.