Debian Codegraph @

src/atlas/util/function/SolidBodyRotation.h

raw
1 /*
2 * (C) Copyright 2023 ECMWF.
3 *
4 * This software is licensed under the terms of the Apache Licence Version 2.0
5 * which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
6 * In applying this licence, ECMWF does not waive the privileges and immunities
7 * granted to it by virtue of its status as an intergovernmental organisation nor
8 * does it submit to any jurisdiction.
9 */
10
11
12 #pragma once
13
14 namespace atlas {
15
16 namespace util {
17
18 namespace function {
19
20 /// \brief An analytic function that provides solid body rotation winds on a sphere.
21 ///
22 /// All angles must be provided in degrees.
23 ///
24 class SolidBodyRotation {
25 public:
26
27 SolidBodyRotation() : SolidBodyRotation(0., 1.) {}
28
29
30 SolidBodyRotation(const double beta) : SolidBodyRotation(beta, 1.) {}
31 SolidBodyRotation(const double beta, const double radius);
32
33 void wind(const double lon, const double lat, double& u, double& v) const;
34 void vordiv(const double lon, const double lat, double& vor, double& div) const;
35 double windMagnitude(const double lon, const double lat) const;
36 double u(const double lon, const double lat) const;
37 double v(const double lon, const double lat) const;
38 double vorticity(const double lon, const double lat) const;
39 double divergence(const double lon, const double lat) const;
40
41 double windMagnitudeSquared(const double lon, const double lat) const;
42 void windMagnitudeSquaredGradient(const double lon, const double lat, double& dfdx, double& dfdy) const;
43
44 private:
45 double sin_beta_;
46 double cos_beta_;
47 double radius_;
48 };
49
50 } // namespace function
51
52 } // namespace util
53
54 } // namespace atlas