Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ELP2000 lunar theory #362

Merged
merged 33 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
a32c89d
Minor typo.
bluescarni Nov 5, 2023
5dedc78
Initial import of the ELP2000 data files.
bluescarni Nov 6, 2023
97d4d03
Move the thresh kwarg into kw.hpp.
bluescarni Nov 6, 2023
55499ca
A few simplifications in the vsop header.
bluescarni Nov 6, 2023
44be459
Merge branch 'master' into pr/elp2000
bluescarni Nov 12, 2023
e383c8c
Minor static check addition.
bluescarni Nov 13, 2023
973a451
Some initial WIP code for spherical coords.
bluescarni Nov 13, 2023
0096988
More WIP, initial compiling code in Cartesian coordinates.
bluescarni Nov 13, 2023
c39244b
Merge branch 'master' into pr/elp2000
bluescarni Nov 13, 2023
4e34101
Small tweaks.
bluescarni Nov 13, 2023
839a2d4
ELP4,5,6.
bluescarni Nov 13, 2023
560f843
ELP7,8,9.
bluescarni Nov 14, 2023
d73b61c
ELP10,11,12.
bluescarni Nov 14, 2023
0d8f4d2
Add a few static assertions.
bluescarni Nov 14, 2023
e8b3ad8
Remove unused header.
bluescarni Nov 15, 2023
cda8003
Introduce parallelisation when normalising the arguments to sums and …
bluescarni Nov 15, 2023
2845c8b
First bits of parallelism in the elp2000 implementation.
bluescarni Nov 15, 2023
af42192
More implementation WIP.
bluescarni Nov 15, 2023
28b7068
Add the B coefficients to the ELP1-3 data files.
bluescarni Nov 15, 2023
fa899e9
Implement the corrections to the A coefficients for the main problem.
bluescarni Nov 16, 2023
85ebe77
Minor.
bluescarni Nov 16, 2023
7a30974
Some initial testing.
bluescarni Nov 16, 2023
b5b7b43
Test error handling.
bluescarni Nov 16, 2023
0a81a3c
Add elp2000 benchmark too.
bluescarni Nov 16, 2023
2706c1d
Coverage fix.
bluescarni Nov 16, 2023
3dbbdc3
Add the FK5 version.
bluescarni Nov 17, 2023
a307599
Bump to 3.2.0 for development.
bluescarni Nov 17, 2023
93e918e
Add getter for the mus.
bluescarni Nov 17, 2023
10267e9
Try conjuring up the correct pins to build the docs.
bluescarni Nov 17, 2023
58e1193
Try to upgrade to larger machine on CircleCI.
bluescarni Nov 17, 2023
58074ce
Update changelog.
bluescarni Nov 17, 2023
9a0c507
Coverage fix.
bluescarni Nov 17, 2023
7da9340
Last coverage fix bit.
bluescarni Nov 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ jobs:
conda_asan:
docker:
- image: cimg/base:current
resource_class: large
steps:
- checkout
- run:
Expand All @@ -13,7 +14,7 @@ jobs:
ubuntu_arm64:
machine:
image: ubuntu-2004:202101-01
resource_class: arm.medium
resource_class: arm.large
steps:
- checkout
- run:
Expand Down
11 changes: 9 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ if(NOT CMAKE_BUILD_TYPE)
FORCE)
endif()

project(heyoka VERSION 3.1.0 LANGUAGES CXX C)
project(heyoka VERSION 3.2.0 LANGUAGES CXX C)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/yacma")

Expand Down Expand Up @@ -253,13 +253,20 @@ set(HEYOKA_SRC_FILES
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/vsop2013/vsop2013_9_4.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/vsop2013/vsop2013_9_5.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/vsop2013/vsop2013_9_6.cpp"
# ELP2000 details.
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/elp2000/elp2000_1_3.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/elp2000/elp2000_4_9.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/elp2000/elp2000_10_15.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/elp2000/elp2000_16_21.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/detail/elp2000/elp2000_22_36.cpp"
# Models.
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/pendulum.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/nbody.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/fixed_centres.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/rotating.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/mascon.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/vsop2013.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/elp2000.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/cr3bp.cpp"
"${CMAKE_CURRENT_SOURCE_DIR}/src/model/ffnn.cpp"
# Math functions.
Expand Down Expand Up @@ -306,7 +313,7 @@ if(HEYOKA_WITH_SLEEF)
endif()

# Setup the heyoka ABI version number.
set(HEYOKA_ABI_VERSION 25)
set(HEYOKA_ABI_VERSION 26)

if(HEYOKA_BUILD_STATIC_LIBRARY)
# Setup of the heyoka static library.
Expand Down
1 change: 1 addition & 0 deletions benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ ADD_HEYOKA_BENCHMARK(h_oscillator_lt)
ADD_HEYOKA_BENCHMARK(mb)
ADD_HEYOKA_BENCHMARK(vsop2013_elliptic)
ADD_HEYOKA_BENCHMARK(vsop2013_cartesian)
ADD_HEYOKA_BENCHMARK(elp2000_cartesian)
ADD_HEYOKA_BENCHMARK(pendulum_bench)
ADD_HEYOKA_BENCHMARK(pendulum_odeint)
ADD_HEYOKA_BENCHMARK(pcr3bp)
Expand Down
76 changes: 76 additions & 0 deletions benchmark/elp2000_cartesian.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
//
// This file is part of the heyoka library.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#include <iostream>

#include <boost/program_options.hpp>

#include <fmt/core.h>
#include <fmt/ranges.h>

#include <spdlog/spdlog.h>
#include <spdlog/stopwatch.h>

#include <heyoka/kw.hpp>
#include <heyoka/llvm_state.hpp>
#include <heyoka/logging.hpp>
#include <heyoka/model/elp2000.hpp>

using namespace heyoka;
using namespace heyoka::model;

int main(int argc, char *argv[])
{
namespace po = boost::program_options;

double thresh{};

po::options_description desc("Options");

desc.add_options()("help", "produce help message")("thresh", po::value<double>(&thresh)->default_value(1e-7),
"threshold value");

po::variables_map vm;
po::store(po::parse_command_line(argc, argv, desc), vm);
po::notify(vm);

if (vm.count("help") != 0u) {
std::cout << desc << "\n";
return 0;
}

// Fetch the logger.
create_logger();
set_logger_level_trace();
auto logger = spdlog::get("heyoka");

spdlog::stopwatch sw;
auto sol = model::elp2000_cartesian_e2000(kw::thresh = thresh);
logger->trace("Creating the solution took: {}", sw);

llvm_state s;

sw.reset();
add_cfunc<double>(s, "func", sol, kw::compact_mode = true);
s.compile();
logger->trace("Compiling the solution took: {}", sw);

auto *cf_ptr
= reinterpret_cast<void (*)(double *, const double *, const double *, const double *)>(s.jit_lookup("func"));

double out[3]{};

for (auto date : {2469000.5, 2449000.5, 2429000.5, 2409000.5, 2389000.5}) {
const double tm = (date - 2451545.0) / (36525);

sw.reset();
cf_ptr(out, nullptr, nullptr, &tm);
logger->trace("Computing the solution took: {}", sw);
logger->trace("State for date {}: {}", date, out);
}
}
1 change: 1 addition & 0 deletions benchmark/vsop2013_cartesian.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <boost/program_options.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/model/vsop2013.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions benchmark/vsop2013_elliptic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include <boost/program_options.hpp>

#include <heyoka/expression.hpp>
#include <heyoka/kw.hpp>
#include <heyoka/model/vsop2013.hpp>
#include <heyoka/taylor.hpp>

Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ coverage:
- "test/.*"
- "tutorial/.*"
- "src/detail/vsop2013/.*"
- "src/detail/elp2000/.*"

comment: off
16 changes: 16 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
Changelog
=========

3.2.0 (unreleased)
------------------

New
~~~

- Add model implementing the ELP2000 analytical lunar theory
(`#362 <https://github.com/bluescarni/heyoka/pull/362>`__).

Changes
~~~~~~~

- Improve performance when creating symbolic expressions for
large sums and products
(`#362 <https://github.com/bluescarni/heyoka/pull/362>`__).

3.1.0 (2023-11-13)
------------------

Expand Down
43 changes: 43 additions & 0 deletions include/heyoka/detail/elp2000/elp2000_10_15.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
//
// This file is part of the heyoka library.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef HEYOKA_DETAIL_ELP2000_ELP_10_15_HPP
#define HEYOKA_DETAIL_ELP2000_ELP_10_15_HPP

#include <cstdint>

#include <heyoka/config.hpp>

HEYOKA_BEGIN_NAMESPACE

namespace model::detail
{

extern const std::int8_t elp2000_idx_10[14328][11];
extern const double elp2000_phi_A_10[14328][2];

extern const std::int8_t elp2000_idx_11[5233][11];
extern const double elp2000_phi_A_11[5233][2];

extern const std::int8_t elp2000_idx_12[6631][11];
extern const double elp2000_phi_A_12[6631][2];

extern const std::int8_t elp2000_idx_13[4384][11];
extern const double elp2000_phi_A_13[4384][2];

extern const std::int8_t elp2000_idx_14[833][11];
extern const double elp2000_phi_A_14[833][2];

extern const std::int8_t elp2000_idx_15[1715][11];
extern const double elp2000_phi_A_15[1715][2];

} // namespace model::detail

HEYOKA_END_NAMESPACE

#endif
43 changes: 43 additions & 0 deletions include/heyoka/detail/elp2000/elp2000_16_21.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
//
// This file is part of the heyoka library.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef HEYOKA_DETAIL_ELP2000_ELP_16_21_HPP
#define HEYOKA_DETAIL_ELP2000_ELP_16_21_HPP

#include <cstdint>

#include <heyoka/config.hpp>

HEYOKA_BEGIN_NAMESPACE

namespace model::detail
{

extern const std::int8_t elp2000_idx_16[170][11];
extern const double elp2000_phi_A_16[170][2];

extern const std::int8_t elp2000_idx_17[150][11];
extern const double elp2000_phi_A_17[150][2];

extern const std::int8_t elp2000_idx_18[114][11];
extern const double elp2000_phi_A_18[114][2];

extern const std::int8_t elp2000_idx_19[226][11];
extern const double elp2000_phi_A_19[226][2];

extern const std::int8_t elp2000_idx_20[188][11];
extern const double elp2000_phi_A_20[188][2];

extern const std::int8_t elp2000_idx_21[169][11];
extern const double elp2000_phi_A_21[169][2];

} // namespace model::detail

HEYOKA_END_NAMESPACE

#endif
34 changes: 34 additions & 0 deletions include/heyoka/detail/elp2000/elp2000_1_3.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
//
// This file is part of the heyoka library.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef HEYOKA_DETAIL_ELP2000_ELP_1_3_HPP
#define HEYOKA_DETAIL_ELP2000_ELP_1_3_HPP

#include <cstdint>

#include <heyoka/config.hpp>

HEYOKA_BEGIN_NAMESPACE

namespace model::detail
{

extern const std::int8_t elp2000_idx_1[1023][4];
extern const double elp2000_A_B_1[1023][6];

extern const std::int8_t elp2000_idx_2[918][4];
extern const double elp2000_A_B_2[918][6];

extern const std::int8_t elp2000_idx_3[704][4];
extern const double elp2000_A_B_3[704][6];

} // namespace model::detail

HEYOKA_END_NAMESPACE

#endif
70 changes: 70 additions & 0 deletions include/heyoka/detail/elp2000/elp2000_22_36.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// Copyright 2020, 2021, 2022, 2023 Francesco Biscani ([email protected]), Dario Izzo ([email protected])
//
// This file is part of the heyoka library.
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.

#ifndef HEYOKA_DETAIL_ELP2000_ELP_22_36_HPP
#define HEYOKA_DETAIL_ELP2000_ELP_22_36_HPP

#include <cstdint>

#include <heyoka/config.hpp>

HEYOKA_BEGIN_NAMESPACE

namespace model::detail
{

extern const std::int8_t elp2000_idx_22[3][5];
extern const double elp2000_phi_A_22[3][2];

extern const std::int8_t elp2000_idx_23[2][5];
extern const double elp2000_phi_A_23[2][2];

extern const std::int8_t elp2000_idx_24[2][5];
extern const double elp2000_phi_A_24[2][2];

extern const std::int8_t elp2000_idx_25[6][5];
extern const double elp2000_phi_A_25[6][2];

extern const std::int8_t elp2000_idx_26[4][5];
extern const double elp2000_phi_A_26[4][2];

extern const std::int8_t elp2000_idx_27[5][5];
extern const double elp2000_phi_A_27[5][2];

extern const std::int8_t elp2000_idx_28[20][5];
extern const double elp2000_phi_A_28[20][2];

extern const std::int8_t elp2000_idx_29[12][5];
extern const double elp2000_phi_A_29[12][2];

extern const std::int8_t elp2000_idx_30[14][5];
extern const double elp2000_phi_A_30[14][2];

extern const std::int8_t elp2000_idx_31[11][5];
extern const double elp2000_phi_A_31[11][2];

extern const std::int8_t elp2000_idx_32[4][5];
extern const double elp2000_phi_A_32[4][2];

extern const std::int8_t elp2000_idx_33[10][5];
extern const double elp2000_phi_A_33[10][2];

extern const std::int8_t elp2000_idx_34[28][5];
extern const double elp2000_phi_A_34[28][2];

extern const std::int8_t elp2000_idx_35[13][5];
extern const double elp2000_phi_A_35[13][2];

extern const std::int8_t elp2000_idx_36[19][5];
extern const double elp2000_phi_A_36[19][2];

} // namespace model::detail

HEYOKA_END_NAMESPACE

#endif
Loading
Loading