Skip to content

Commit

Permalink
Rename package (#47)
Browse files Browse the repository at this point in the history
* Update README.md

* Correct module name

* Update README.md

* Update Project.toml

* Update make.jl

* Update Project.toml

* Update index.md

* Update runtests.jl

* Update Keplerian_motion.jl

* Update TPM_Didymos.jl

* Update TPM_Ryugu.jl

* Update README.md

* Update README.md

* Update Project.toml
  • Loading branch information
MasanoriKanamaru committed Mar 18, 2023
1 parent 86a0438 commit d5c26c7
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 47 deletions.
4 changes: 2 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ThermoPhysicalModeling"
name = "AsteroidThermoPhysicalModels"
uuid = "ab46f4a3-3c83-4d86-98d6-41a8b1a2e76e"
authors = ["Masanori Kanamaru"]
version = "0.0.3"
version = "0.0.4"

[deps]
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
![](logo/Astroshaper_logo.png)

# ThermoPhysicalModeling.jl
# AsteroidThermoPhysicalModels.jl

[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://Astroshaper.github.io/ThermoPhysicalModeling.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://Astroshaper.github.io/ThermoPhysicalModeling.jl/dev)
[![Build Status](https://github.com/Astroshaper/ThermoPhysicalModeling.jl/workflows/CI/badge.svg)](https://github.com/Astroshaper/ThermoPhysicalModeling.jl/actions?query=workflow%3ACI+branch%3Amain)
[![codecov](https://codecov.io/gh/Astroshaper/ThermoPhysicalModeling.jl/branch/main/graph/badge.svg?token=dJBiR91dCD)](https://codecov.io/gh/Astroshaper/ThermoPhysicalModeling.jl)
[![Stable](https://img.shields.io/badge/docs-stable-blue.svg)](https://Astroshaper.github.io/AsteroidThermoPhysicalModels.jl/stable)
[![Dev](https://img.shields.io/badge/docs-dev-blue.svg)](https://Astroshaper.github.io/AsteroidThermoPhysicalModels.jl/dev)
[![Build Status](https://github.com/Astroshaper/AsteroidThermoPhysicalModels.jl/workflows/CI/badge.svg)](https://github.com/Astroshaper/AsteroidThermoPhysicalModels.jl/actions?query=workflow%3ACI+branch%3Amain)
[![codecov](https://codecov.io/gh/Astroshaper/AsteroidThermoPhysicalModels.jl/branch/main/graph/badge.svg?token=dJBiR91dCD)](https://codecov.io/gh/Astroshaper/AsteroidThermoPhysicalModels.jl)
[![Aqua QA](https://raw.githubusercontent.com/JuliaTesting/Aqua.jl/master/badge.svg)](https://github.com/JuliaTesting/Aqua.jl)

Julia-based toolkit for dynamical simulations of planets and small solar system bodies.

## Installation

using Pkg
Pkg.add(url="https://github.com/Astroshaper/ThermoPhysicalModeling.jl")
using ThermoPhysicalModeling
Pkg.add(url="https://github.com/Astroshaper/AsteroidThermoPhysicalModels.jl")
using AsteroidThermoPhysicalModels

You can update the module and run tests as follows.

Pkg.update("ThermoPhysicalModeling")
Pkg.test("ThermoPhysicalModeling")
Pkg.update("AsteroidThermoPhysicalModels")
Pkg.test("AsteroidThermoPhysicalModels")

## Orbital dynamics
You can simulate orbital evolution of planets and small bodies under gravity interaction and various perturbations.
Expand Down Expand Up @@ -60,12 +60,12 @@ Distribution of dynamical elevation on asteroid Itokawa. The color map ranges fr

## Start to play
Let's visualize a shape model of asteroid Ryugu.
Please downlad a Ryugu model from ThermoPhysicalModeling/test/ryugu_test.obj.
Please downlad a Ryugu model from AsteroidThermoPhysicalModels/test/ryugu_test.obj.

using ThermoPhysicalModeling
using AsteroidThermoPhysicalModels

shapepath = "ryugu_test.obj" # Path to the shape model
shape = Shape(shapepath; scale=1000, find_visible_facets=true)
shape = ShapeModel(shapepath; scale=1000, find_visible_facets=true)

draw(shape)
# draw(shape, data=:radius) # Radius of each surface facet
Expand Down
2 changes: 1 addition & 1 deletion docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[deps]
ThermoPhysicalModeling = "ab46f4a3-3c83-4d86-98d6-41a8b1a2e76e"
AsteroidThermoPhysicalModels = "ab46f4a3-3c83-4d86-98d6-41a8b1a2e76e"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
14 changes: 7 additions & 7 deletions docs/make.jl
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using ThermoPhysicalModeling
using AsteroidThermoPhysicalModels
using Documenter

DocMeta.setdocmeta!(ThermoPhysicalModeling, :DocTestSetup, :(using ThermoPhysicalModeling); recursive=true)
DocMeta.setdocmeta!(AsteroidThermoPhysicalModels, :DocTestSetup, :(using AsteroidThermoPhysicalModels); recursive=true)

makedocs(;
modules=[ThermoPhysicalModeling],
repo="https://github.com/Astroshaper/ThermoPhysicalModeling.jl/blob/{commit}{path}#{line}",
sitename="ThermoPhysicalModeling.jl",
modules=[AsteroidThermoPhysicalModels],
repo="https://github.com/Astroshaper/AsteroidThermoPhysicalModels.jl/blob/{commit}{path}#{line}",
sitename="AsteroidThermoPhysicalModels.jl",
format=Documenter.HTML(;
prettyurls=get(ENV, "CI", "false") == "true",
canonical="https://Astroshaper.github.io/ThermoPhysicalModeling.jl",
canonical="https://Astroshaper.github.io/AsteroidThermoPhysicalModels.jl",
assets=["assets/favicon.ico"],
),
pages=[
Expand All @@ -18,5 +18,5 @@ makedocs(;
)

deploydocs(;
repo="github.com/Astroshaper/ThermoPhysicalModeling.jl",
repo="github.com/Astroshaper/AsteroidThermoPhysicalModels.jl",
)
4 changes: 2 additions & 2 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# ThermoPhysicalModeling.jl
# AsteroidThermoPhysicalModels.jl

A package for dynamical simulation of an asteroid.

```@autodocs
Modules = [ThermoPhysicalModeling]
Modules = [AsteroidThermoPhysicalModels]
```
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module ThermoPhysicalModeling
module AsteroidThermoPhysicalModels

using LinearAlgebra
using StaticArrays
Expand Down Expand Up @@ -83,4 +83,4 @@ export run_Euler
include("leapfrog.jl")
export run_leapfrog

end # module ThermoPhysicalModeling
end # module AsteroidThermoPhysicalModels
12 changes: 6 additions & 6 deletions test/Keplerian_motion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
# These functions are used in https://github.com/Astroshaper/Astroshaper-examples/blob/main/TPM_Kanamaru2021/TPM_Kanamaru2021.ipynb

@testset "Keplerian_motion" begin
orbit = ThermoPhysicalModeling.OrbitalElements(ThermoPhysicalModeling.RYUGU)
spin = ThermoPhysicalModeling.SpinParams(ThermoPhysicalModeling.RYUGU, orbit)
orbit = AsteroidThermoPhysicalModels.OrbitalElements(AsteroidThermoPhysicalModels.RYUGU)
spin = AsteroidThermoPhysicalModels.SpinParams(AsteroidThermoPhysicalModels.RYUGU, orbit)

Δt = spin.P / 72
times = collect(0:Δt:orbit.P)

for time in times
spin_phase = spin.ω * time

u = ThermoPhysicalModeling.solveKeplerEquation2(orbit, time)
r = ThermoPhysicalModeling.get_r(orbit, u)
F☉ = ThermoPhysicalModeling.SOLAR_CONST / (norm(r) / ThermoPhysicalModeling.AU)^2
u = AsteroidThermoPhysicalModels.solveKeplerEquation2(orbit, time)
r = AsteroidThermoPhysicalModels.get_r(orbit, u)
F☉ = AsteroidThermoPhysicalModels.SOLAR_CONST / (norm(r) / AsteroidThermoPhysicalModels.AU)^2

r̂☉ = normalize(r) * -1 # Shift the origin from the sun to the body
r̂☉ = ThermoPhysicalModeling.orbit_to_body(r̂☉, spin.γ, spin.ε, spin_phase) # Sun's position in the asteroid-fixed frame
r̂☉ = AsteroidThermoPhysicalModels.orbit_to_body(r̂☉, spin.γ, spin.ε, spin_phase) # Sun's position in the asteroid-fixed frame
end
end
18 changes: 9 additions & 9 deletions test/TPM_Didymos.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@
path_shape2_jld = joinpath("Didymos", "kernels", "dsk", "g_06650mm_rad_obj_didb_0000n00000_v001.jld2")

if isfile(path_shape1_jld)
shape1 = ThermoPhysicalModeling.ShapeModel(path_shape1_jld; scale=1000, find_visible_facets=true, save_shape=true)
shape1 = AsteroidThermoPhysicalModels.ShapeModel(path_shape1_jld; scale=1000, find_visible_facets=true, save_shape=true)
else
shape1 = ThermoPhysicalModeling.ShapeModel(path_shape1_obj; scale=1000, find_visible_facets=true, save_shape=true)
shape1 = AsteroidThermoPhysicalModels.ShapeModel(path_shape1_obj; scale=1000, find_visible_facets=true, save_shape=true)
end
if isfile(path_shape2_jld)
shape2 = ThermoPhysicalModeling.ShapeModel(path_shape2_jld; scale=1000, find_visible_facets=true, save_shape=true)
shape2 = AsteroidThermoPhysicalModels.ShapeModel(path_shape2_jld; scale=1000, find_visible_facets=true, save_shape=true)
else
shape2 = ThermoPhysicalModeling.ShapeModel(path_shape2_obj; scale=1000, find_visible_facets=true, save_shape=true)
shape2 = AsteroidThermoPhysicalModels.ShapeModel(path_shape2_obj; scale=1000, find_visible_facets=true, save_shape=true)
end

##= TPM =##
thermo_params = ThermoPhysicalModeling.ThermoParams( # [Michel+2016; Naidu+2020]
thermo_params = AsteroidThermoPhysicalModels.ThermoParams( # [Michel+2016; Naidu+2020]
A_B = 0.059, # Bolometric Bond albedo
A_TH = 0.0,
k = 0.125,
Expand All @@ -81,15 +81,15 @@
Nt = length(et_range),
z_max = 0.6,
Nz = 41,
P = SPICE.convrt(ThermoPhysicalModeling.DIDYMOS[:P], "hours", "seconds"),
P = SPICE.convrt(AsteroidThermoPhysicalModels.DIDYMOS[:P], "hours", "seconds"),
);

ThermoPhysicalModeling.init_temps_zero!(shape1, thermo_params)
ThermoPhysicalModeling.init_temps_zero!(shape2, thermo_params)
AsteroidThermoPhysicalModels.init_temps_zero!(shape1, thermo_params)
AsteroidThermoPhysicalModels.init_temps_zero!(shape2, thermo_params)

# Run TPM and save the result
savepath = joinpath("Didymos", "TPM_Didymos.jld2")
shapes = (shape1, shape2)
suns = (sun_d1, sun_d2)
ThermoPhysicalModeling.run_TPM!(shapes, et_range, suns, D2_TO_D1, d2_d1, thermo_params, savepath, [:surf_temps, :forces, :torques])
AsteroidThermoPhysicalModels.run_TPM!(shapes, et_range, suns, D2_TO_D1, d2_d1, thermo_params, savepath, [:surf_temps, :forces, :torques])
end
10 changes: 6 additions & 4 deletions test/TPM_Ryugu.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
##= Load obj file =##
path_jld = splitext(path_obj)[1]*".jld2"
if isfile(path_jld)
shape = ThermoPhysicalModeling.ShapeModel(path_jld; scale=1000, find_visible_facets=true, save_shape=true)
shape = AsteroidThermoPhysicalModels.ShapeModel(path_jld; scale=1000, find_visible_facets=true, save_shape=true)
else
shape = ThermoPhysicalModeling.ShapeModel(path_obj; scale=1000, find_visible_facets=true, save_shape=true)
shape = AsteroidThermoPhysicalModels.ShapeModel(path_obj; scale=1000, find_visible_facets=true, save_shape=true)
end

##= TPM =##
thermo_params = ThermoPhysicalModeling.ThermoParams(
thermo_params = AsteroidThermoPhysicalModels.ThermoParams(
A_B = 0.04, # Bolometric Bond albedo
A_TH = 0.0,
k = 0.1,
Expand All @@ -69,9 +69,11 @@
Nz = 41,
P = 7.63262 * 3600,
)

# Run TPM and save the result
savepath = joinpath("Ryugu", "TPM_Ryugu.jld2")
ThermoPhysicalModeling.run_TPM!(shape, et_range, sun_ryugu, thermo_params, savepath, save_range)
AsteroidThermoPhysicalModels.run_TPM!(shape, et_range, sun_ryugu, thermo_params, savepath, save_range)

JLD2.jldopen(savepath, "r+") do file
file["RYUGU_TO_J2000"] = RYUGU_TO_J2000[save_range]
end
Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using ThermoPhysicalModeling
using AsteroidThermoPhysicalModels
using Test
using Aqua
using JLD2
Expand All @@ -8,7 +8,7 @@ using Downloads
using Statistics
using LinearAlgebra

Aqua.test_all(ThermoPhysicalModeling, ambiguities=false)
Aqua.test_all(AsteroidThermoPhysicalModels, ambiguities=false)

include("TPM_Ryugu.jl")
include("TPM_Didymos.jl")
Expand Down

0 comments on commit d5c26c7

Please sign in to comment.