Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
755d0e1f
Commit
755d0e1f
authored
7 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Style improvements to the maths in the EoS calculations.
parent
6a7a0c1a
No related branches found
No related tags found
1 merge request
!545
Add support for equations of state related to planetary physics
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/equation_of_state/planetary/hm80.h
+26
-25
26 additions, 25 deletions
src/equation_of_state/planetary/hm80.h
src/equation_of_state/planetary/tillotson.h
+17
-21
17 additions, 21 deletions
src/equation_of_state/planetary/tillotson.h
with
43 additions
and
46 deletions
src/equation_of_state/planetary/hm80.h
+
26
−
25
View file @
755d0e1f
...
...
@@ -60,12 +60,12 @@ INLINE static void set_HM80_HHe(struct HM80_params *mat, int mat_id) {
mat
->
mat_id
=
mat_id
;
mat
->
num_rho
=
100
;
mat
->
num_u
=
100
;
mat
->
log_rho_min
=
-
9
.
2103404
;
mat
->
log_rho_max
=
1
.
6094379
;
mat
->
log_rho_step
=
0
.
1092907
;
mat
->
log_u_min
=
9
.
2103404
;
mat
->
log_u_max
=
22
.
3327037
;
mat
->
log_u_step
=
0
.
1325491
;
mat
->
log_rho_min
=
-
9
.
2103404
f
;
mat
->
log_rho_max
=
1
.
6094379
f
;
mat
->
log_rho_step
=
0
.
1092907
f
;
mat
->
log_u_min
=
9
.
2103404
f
;
mat
->
log_u_max
=
22
.
3327037
f
;
mat
->
log_u_step
=
0
.
1325491
f
;
mat
->
bulk_mod
=
0
;
mat
->
inv_log_rho_step
=
1
.
f
/
mat
->
log_rho_step
;
...
...
@@ -75,13 +75,13 @@ INLINE static void set_HM80_ice(struct HM80_params *mat, int mat_id) {
mat
->
mat_id
=
mat_id
;
mat
->
num_rho
=
200
;
mat
->
num_u
=
200
;
mat
->
log_rho_min
=
-
6
.
9077553
;
mat
->
log_rho_max
=
2
.
7080502
;
mat
->
log_rho_step
=
0
.
04
83206
;
mat
->
log_u_min
=
6
.
9077553
;
mat
->
log_u_max
=
22
.
3327037
;
mat
->
log_u_step
=
0
.
0775123
;
mat
->
bulk_mod
=
2.0e10
;
mat
->
log_rho_min
=
-
6
.
9077553
f
;
mat
->
log_rho_max
=
2
.
7080502
f
;
mat
->
log_rho_step
=
0
.
04
83206
f
;
mat
->
log_u_min
=
6
.
9077553
f
;
mat
->
log_u_max
=
22
.
3327037
f
;
mat
->
log_u_step
=
0
.
0775123
f
;
mat
->
bulk_mod
=
2.0e10
f
;
mat
->
inv_log_rho_step
=
1
.
f
/
mat
->
log_rho_step
;
mat
->
inv_log_u_step
=
1
.
f
/
mat
->
log_u_step
;
...
...
@@ -90,13 +90,13 @@ INLINE static void set_HM80_rock(struct HM80_params *mat, int mat_id) {
mat
->
mat_id
=
mat_id
;
mat
->
num_rho
=
100
;
mat
->
num_u
=
100
;
mat
->
log_rho_min
=
-
6
.
9077553
;
mat
->
log_rho_max
=
2
.
9957323
;
mat
->
log_rho_step
=
0
.
1000352
;
mat
->
log_u_min
=
9
.
2103404
;
mat
->
log_u_max
=
20
.
7232658
;
mat
->
log_u_step
=
0
.
1162922
;
mat
->
bulk_mod
=
3.49e11
;
mat
->
log_rho_min
=
-
6
.
9077553
f
;
mat
->
log_rho_max
=
2
.
9957323
f
;
mat
->
log_rho_step
=
0
.
1000352
f
;
mat
->
log_u_min
=
9
.
2103404
f
;
mat
->
log_u_max
=
20
.
7232658
f
;
mat
->
log_u_step
=
0
.
1162922
f
;
mat
->
bulk_mod
=
3.49e11
f
;
mat
->
inv_log_rho_step
=
1
.
f
/
mat
->
log_rho_step
;
mat
->
inv_log_u_step
=
1
.
f
/
mat
->
log_u_step
;
...
...
@@ -127,8 +127,8 @@ INLINE static void load_HM80_table(struct HM80_params *mat, char *table_file) {
// Convert from cgs to internal units
INLINE
static
void
convert_units_HM80
(
struct
HM80_params
*
mat
,
const
struct
unit_system
*
us
)
{
const
float
Mbar_to_Ba
=
1e12
;
// Convert Megabar to Barye
const
float
J_kg_to_erg_g
=
1e4
;
// Convert J/kg to erg/g
const
float
Mbar_to_Ba
=
1e12
f
;
// Convert Megabar to Barye
const
float
J_kg_to_erg_g
=
1e4
f
;
// Convert J/kg to erg/g
// Table densities in cgs
mat
->
log_rho_min
-=
logf
(
units_cgs_conversion_factor
(
us
,
UNIT_CONV_DENSITY
));
...
...
@@ -205,7 +205,7 @@ INLINE static float HM80_pressure_from_internal_energy(
float
P
;
if
(
u
<=
0
)
{
return
0
;
return
0
.
f
;
}
int
rho_idx
,
u_idx
;
...
...
@@ -246,8 +246,9 @@ INLINE static float HM80_pressure_from_internal_energy(
}
// Normal interpolation within the table
else
{
P
=
(
1
-
intp_rho
)
*
((
1
-
intp_u
)
*
mat
->
table_P_rho_u
[
rho_idx
][
u_idx
]
+
intp_u
*
mat
->
table_P_rho_u
[
rho_idx
][
u_idx
+
1
])
+
P
=
(
1
.
f
-
intp_rho
)
*
((
1
.
f
-
intp_u
)
*
mat
->
table_P_rho_u
[
rho_idx
][
u_idx
]
+
intp_u
*
mat
->
table_P_rho_u
[
rho_idx
][
u_idx
+
1
])
+
intp_rho
*
((
1
-
intp_u
)
*
mat
->
table_P_rho_u
[
rho_idx
+
1
][
u_idx
]
+
intp_u
*
mat
->
table_P_rho_u
[
rho_idx
+
1
][
u_idx
+
1
]);
}
...
...
This diff is collapsed.
Click to expand it.
src/equation_of_state/planetary/tillotson.h
+
17
−
21
View file @
755d0e1f
...
...
@@ -53,11 +53,11 @@ INLINE static void set_Til_iron(struct Til_params *mat, int mat_id) {
mat
->
rho_0
=
7
.
800
f
;
mat
->
a
=
0
.
5
f
;
mat
->
b
=
1
.
5
f
;
mat
->
A
=
1.28e12
;
mat
->
B
=
1.05e12
;
mat
->
E_0
=
9.5e10
;
mat
->
E_iv
=
2.4e10
;
mat
->
E_cv
=
8.67e10
;
mat
->
A
=
1.28e12
f
;
mat
->
B
=
1.05e12
f
;
mat
->
E_0
=
9.5e10
f
;
mat
->
E_iv
=
2.4e10
f
;
mat
->
E_cv
=
8.67e10
f
;
mat
->
alpha
=
5
.
0
f
;
mat
->
beta
=
5
.
0
f
;
mat
->
eta_min
=
0
.
0
f
;
...
...
@@ -68,11 +68,11 @@ INLINE static void set_Til_granite(struct Til_params *mat, int mat_id) {
mat
->
rho_0
=
2
.
680
f
;
mat
->
a
=
0
.
5
f
;
mat
->
b
=
1
.
3
f
;
mat
->
A
=
1.8e11
;
mat
->
B
=
1.8e11
;
mat
->
E_0
=
1.6e11
;
mat
->
E_iv
=
3.5e10
;
mat
->
E_cv
=
1.8e11
;
mat
->
A
=
1.8e11
f
;
mat
->
B
=
1.8e11
f
;
mat
->
E_0
=
1.6e11
f
;
mat
->
E_iv
=
3.5e10
f
;
mat
->
E_cv
=
1.8e11
f
;
mat
->
alpha
=
5
.
0
f
;
mat
->
beta
=
5
.
0
f
;
mat
->
eta_min
=
0
.
0
f
;
...
...
@@ -83,11 +83,11 @@ INLINE static void set_Til_water(struct Til_params *mat, int mat_id) {
mat
->
rho_0
=
0
.
998
f
;
mat
->
a
=
0
.
7
f
;
mat
->
b
=
0
.
15
f
;
mat
->
A
=
2.18e10
;
mat
->
B
=
1.325e11
;
mat
->
E_0
=
7.0e10
;
mat
->
E_iv
=
4.19e9
;
mat
->
E_cv
=
2.69e10
;
mat
->
A
=
2.18e10
f
;
mat
->
B
=
1.325e11
f
;
mat
->
E_0
=
7.0e10
f
;
mat
->
E_iv
=
4.19e9
f
;
mat
->
E_cv
=
2.69e10
f
;
mat
->
alpha
=
10
.
0
f
;
mat
->
beta
=
5
.
0
f
;
mat
->
eta_min
=
0
.
915
f
;
...
...
@@ -265,9 +265,7 @@ INLINE static float Til_soundspeed_from_internal_energy(
//
// c = max(c_c, mat->A / mat->rho0);
// }
float
c
;
c
=
sqrtf
(
mat
->
A
/
mat
->
rho_0
);
float
c
=
sqrtf
(
mat
->
A
/
mat
->
rho_0
);
return
c
;
}
...
...
@@ -276,9 +274,7 @@ INLINE static float Til_soundspeed_from_internal_energy(
INLINE
static
float
Til_soundspeed_from_pressure
(
float
density
,
float
P
,
struct
Til_params
*
mat
)
{
float
c
;
c
=
sqrtf
(
mat
->
A
/
mat
->
rho_0
);
float
c
=
sqrtf
(
mat
->
A
/
mat
->
rho_0
);
return
c
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment