-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from darioizzo/propagate_taylor
Stark problem and heyoka taylor integrators
- Loading branch information
Showing
20 changed files
with
906 additions
and
81 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
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,78 @@ | ||
// Copyright 2023, 2024 Dario Izzo ([email protected]), Francesco Biscani | ||
// ([email protected]) | ||
// | ||
// This file is part of the kep3 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 kep3_STARK_PROBLEM_H | ||
#define kep3_STARK_PROBLEM_H | ||
|
||
#include <array> | ||
#include <utility> | ||
#include <vector> | ||
|
||
#include <fmt/ostream.h> | ||
|
||
#include <heyoka/taylor.hpp> | ||
|
||
#include <kep3/detail/s11n.hpp> | ||
#include <kep3/detail/visibility.hpp> | ||
|
||
namespace kep3 | ||
{ | ||
|
||
/// Stark Problem | ||
/** | ||
* This class represent the Stark's problem. When instantiated it gets a | ||
* Taylor adaptive integrator from the kep3 ta cache and copies it as to be able to use it | ||
* later for numerical propagation. The information on the solution sensitivities can be retreived too | ||
* in which case a variational integrator is employed. | ||
*/ | ||
class kep3_DLL_PUBLIC stark_problem | ||
{ | ||
public: | ||
explicit stark_problem(double mu=1., double veff=1., double tol=1e-16); | ||
std::array<double, 7> propagate(const std::array<double, 7> &rvm_state, std::array<double, 3> thrust, double tof); | ||
std::tuple<std::array<double, 7>, std::array<double, 49>, std::array<double, 21>> | ||
propagate_var(const std::array<double, 7> &rvm_state, std::array<double, 3> thrust, double tof); | ||
// Getters | ||
[[nodiscard]] double get_mu() const; | ||
[[nodiscard]] double get_veff() const; | ||
[[nodiscard]] double get_tol() const; | ||
[[nodiscard]] heyoka::taylor_adaptive<double> get_ta() const; | ||
[[nodiscard]] heyoka::taylor_adaptive<double> get_ta_var() const; | ||
// Setters | ||
void set_mu(double); | ||
void set_veff(double); | ||
|
||
private: | ||
// Serialization code | ||
friend class boost::serialization::access; | ||
template <class Archive> | ||
void serialize(Archive &ar, const unsigned int) | ||
{ | ||
ar &m_mu; | ||
ar &m_veff; | ||
ar &m_tol; | ||
ar &m_ta; | ||
ar &m_ta_var; | ||
ar &m_var_ic; | ||
} | ||
double m_mu; | ||
double m_veff; | ||
double m_tol; | ||
heyoka::taylor_adaptive<double> m_ta; | ||
heyoka::taylor_adaptive<double> m_ta_var; | ||
std::vector<double> m_var_ic; | ||
}; | ||
kep3_DLL_PUBLIC std::ostream &operator<<(std::ostream &, const stark_problem &); | ||
} // namespace kep3 | ||
|
||
template <> | ||
struct fmt::formatter<kep3::stark_problem> : fmt::ostream_formatter { | ||
}; | ||
|
||
#endif // kep3_STARK_PROBLEM_H |
Empty file.
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,36 @@ | ||
// Copyright 2023, 2024 Dario Izzo ([email protected]), Francesco Biscani | ||
// ([email protected]) | ||
// | ||
// This file is part of the kep3 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 kep3_TA_LT_KEPLER_H | ||
#define kep3_TA_LT_KEPLER_H | ||
|
||
#include <tuple> | ||
#include <vector> | ||
|
||
#include <kep3/detail/visibility.hpp> | ||
|
||
#include <heyoka/expression.hpp> | ||
#include <heyoka/taylor.hpp> | ||
|
||
namespace kep3::ta | ||
{ | ||
// Returns the low-thrust dynamics (heyoka API) in a Keplerian context and Cartesian throttles. 7 states, 5 parameters: mu, veff, ux, uy, uz. | ||
std::vector<std::pair<heyoka::expression, heyoka::expression>> lt_kepler_dyn(); | ||
|
||
// These return const references to function level static variables of type heyoka::taylor_adaptive<double>. | ||
// NOTE: The object retruned are expected to be copied to then be modified. | ||
kep3_DLL_PUBLIC const heyoka::taylor_adaptive<double> &get_ta_lt_kepler(double tol); | ||
kep3_DLL_PUBLIC const heyoka::taylor_adaptive<double> &get_ta_lt_kepler_var(double tol); // variational (x,y,z,vx,vy,vz,ux,uy,uz) first order | ||
|
||
// Methods to access the cache dimensions. | ||
kep3_DLL_PUBLIC size_t get_ta_lt_kepler_cache_dim(); | ||
kep3_DLL_PUBLIC size_t get_ta_lt_kepler_var_cache_dim(); | ||
} // namespace kep3::ta | ||
|
||
#endif |
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.