-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtests.py
63 lines (50 loc) · 1.24 KB
/
tests.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 14 10:30:13 2020
@author: sergio
"""
# %%
import numpy as np
import woma
import seagen
import matplotlib.pyplot as plt
R_earth = 6.371e6 # m
M_earth = 5.972e24 # kg m^-3
# %%
planet = woma.Planet(
A1_mat_layer=["Til_iron", "Til_basalt"],
A1_T_rho_type=["power=2", "power=2"],
P_s=1e5,
T_s=1000,
M=M_earth,
R=R_earth,
)
# Generate the profiles
planet.gen_prof_L2_find_R1_given_M_R(verbosity=1)
# %%
spin_planet = woma.SpinPlanet(
planet=planet,
period=6,
verbosity=1,
) # h
# %%
N = 1e5
particles = woma.ParticlePlanet(spin_planet, N, N_ngb=48)
particles_seagen = woma.ParticlePlanet(planet, N, N_ngb=48)
particles
# %%
A1_rho_unique = np.unique(particles.A1_rho)
A1_N = np.zeros_like(A1_rho_unique)
for i, rho in enumerate(A1_rho_unique):
A1_N[i] = np.sum(particles.A1_rho == rho)
fig, ax = plt.subplots(1, 1, figsize=(8, 8))
ax.scatter(particles.A1_rho, particles.A1_m / M_earth, s=4)
ax.set_xlabel("density [kg m ^-3]")
ax.set_ylabel("particle mass [M_earth]")
plt.show()
fig, ax = plt.subplots(1, 1, figsize=(8, 8))
ax.scatter(A1_rho_unique, A1_N, s=4)
ax.set_xlabel("density [kg m ^-3]")
ax.set_ylabel("number of particles")
plt.show()