forked from ecmwf/atlas
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make VortexRollup function publicly available, and remove it from var…
…ious places (#87)
- Loading branch information
1 parent
4412d2f
commit 6b508f0
Showing
10 changed files
with
120 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* | ||
* (C) Copyright 2013 ECMWF. | ||
* | ||
* This software is licensed under the terms of the Apache Licence Version 2.0 | ||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
* In applying this licence, ECMWF does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an intergovernmental organisation | ||
* nor does it submit to any jurisdiction. | ||
*/ | ||
|
||
#include "atlas/util/Constants.h" | ||
#include "atlas/util/Earth.h" | ||
|
||
#include "atlas/util/function/VortexRollup.h" | ||
|
||
namespace atlas { | ||
|
||
namespace util { | ||
|
||
namespace function { | ||
|
||
double vortex_rollup(double lon, double lat, double t) { | ||
lon *= Constants::degreesToRadians(); | ||
lat *= Constants::degreesToRadians(); | ||
|
||
auto sqr = [](const double x) { return x * x; }; | ||
auto sech = [](const double x) { return 1. / std::cosh(x); }; | ||
constexpr double two_pi = 2. * M_PI; | ||
const double lambda_prime = std::atan2(-std::cos(lon - two_pi * t), std::tan(lat)); | ||
const double rho = 3. * std::sqrt(1. - sqr(std::cos(lat)) * sqr(std::sin(lon - two_pi * t))); | ||
double omega = 0.; | ||
double a = Earth::radius(); | ||
if (rho != 0.) { | ||
omega = 0.5 * 3 * std::sqrt(3) * a * two_pi * sqr(sech(rho)) * std::tanh(rho) / rho; | ||
} | ||
return -std::tanh(0.2 * rho * std::sin(lambda_prime - omega / a * t)); | ||
} | ||
|
||
} // namespace function | ||
|
||
} // namespace util | ||
|
||
} // namespace atlas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* (C) Copyright 2013 ECMWF. | ||
* | ||
* This software is licensed under the terms of the Apache Licence Version 2.0 | ||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0. | ||
* In applying this licence, ECMWF does not waive the privileges and immunities | ||
* granted to it by virtue of its status as an intergovernmental organisation nor | ||
* does it submit to any jurisdiction. | ||
*/ | ||
|
||
|
||
#pragma once | ||
|
||
namespace atlas { | ||
|
||
namespace util { | ||
|
||
namespace function { | ||
|
||
/// \brief An analytic function that provides a vortex rollup on a 2D sphere | ||
/// | ||
/// \detailed The formula is found in | ||
/// "A Lagrangian Particle Method with Remeshing for Tracer Transport on the Sphere" | ||
/// by Peter Bosler, James Kent, Robert Krasny, Christiane Jablonowski, JCP 2015 | ||
/// as the tracer density in Test Case 1. | ||
/// The longitude (lon) and latitude (lat) are assumed to be in degrees, | ||
/// The time parameter associated with the vortex rollup is set by (t). | ||
/// | ||
/// The time it takes for the counter-rotating vortices along | ||
/// the equator to return to its original position takes | ||
/// time t = 1.0; | ||
/// | ||
double vortex_rollup(double lon, double lat, double t); | ||
|
||
} // namespace function | ||
|
||
} // namespace util | ||
|
||
} // namespace atlas |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.