![crate badge] ![doc badge] ![license badge] ![pre-commit badge]
Thermophysical model for binary systems of asteroids
Demo | In Action | Installation | If you clone this repo | License
Computation of the temperature of a single point at the surface of an asteroid (initialized as sub-solar-point):
```rust // src/main.rs
fn main() { // Initialize the library. let mut kalast = kalast::init();
// System center of mass position.
kalast.set_system_position(-kalast::V3::new(1.0, 0.0, 0.0) * kalast::ASTRONAUMICAL_UNIT * 1.1);
// Add a body to the system without a mesh.
kalast.add_body(
"Asteroid", // name
kalast::V3::zeros(), // relative position to center of mass
kalast::Properties::new(
11.92 * kalast::HOUR, // rotation period
11.92 * kalast::HOUR, // revolution period
0., // obliquity
500., // thermal inertia
2146., // density
600., // heat capacity
0.07, // albedo
0.9, // emissivity
),
None, // path to 3D mesh
);
// Create one facet located centered in longitude=latitude=0° of 2 m².
kalast
.get_target_mut()
.new_face(kalast::M3::from_column_slice(&[
100.0, // vertex 1 x
-2.0 / 3.0, // y
2.0 / 3.0, // z
100.0, // vertex 2 x
-2.0 / 3.0, // y
-4.0 / 3.0, // z
100.0, // vertex 3 x
4.0 / 3.0, // y
2.0 / 3.0, // z
]));
// Some configurations about the system.
kalast.enable_self_heating(false);
// Set simulation duration and time step.
kalast.set_time_with_revolution_target(30.0, 10.0 * kalast::MINUTE);
// Start the simulation.
kalast.start();
println!("{}", kalast.get_target().surface_temperatures());
}
```
Get Rust:
sh
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Create a new Rust project:
```sh
cargo new my_project
cd my_project ```
Add the dependency kalast to your Cargo.toml
:
toml
...
[dependencies]
kalast = "0.2.0"
To get a working code:
src/main.rs
either the code above or one from the examplessrc/main.rs
from the root of your project with:sh
cargo run --release
To build and run the program, tests or examples:
```sh Usage: ./compile.py [OPTIONS] COMMAND [ARGS]...
Rust Project Builder Assistant.
By default, compile the binary from the main program in debug mode, and run it. If you want to compile in release mode, for the main command or any subcommand, use the release option.
Options: -v, --version Show version. -r, --release Enable release mode. -h, --help Show this message and exit.
Commands: doc Build documentation. example Compile and run an example. publish Publish your library on crates.io. tests Compile and execute unit and integration tests. update-versions Update versions in all files according to the manifest. ```
Some examples:
```sh
./compile.py
./compile.py -r
./compile.sh -r example spheres_mutual
./compile.sh tests -a ```
This compile script requires few dependencies:
sh
dotmap=*
envtoml=*
pathlib=*
subprocess=*
termcolor=*
typing=*
re=*
But if you want to compile yourself, follow this link.
Do not forget to work on a development branch:
```sh
git checkout -b dev ```
The projet uses pre-commit to prevent mistakes before commits. To install the hook scripts:
sh
pre-commit install
A hook script uses an external tool called embedme to ensure the demo code displayed in the section In action matches automatically the code in src/main.rs without having to copy paste it.
Licensed under the Apache License, Version 2.0.