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
90a5816d
Commit
90a5816d
authored
5 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Applied code formatting tool
parent
45267fb2
No related branches found
No related tags found
1 merge request
!1109
More EoS
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/equation_of_state/planetary/equation_of_state.h
+14
-11
14 additions, 11 deletions
src/equation_of_state/planetary/equation_of_state.h
src/equation_of_state/planetary/sesame.h
+7
-8
7 additions, 8 deletions
src/equation_of_state/planetary/sesame.h
with
21 additions
and
19 deletions
src/equation_of_state/planetary/equation_of_state.h
+
14
−
11
View file @
90a5816d
...
@@ -83,10 +83,10 @@ enum eos_planetary_material_id {
...
@@ -83,10 +83,10 @@ enum eos_planetary_material_id {
/*! Tillotson water */
/*! Tillotson water */
eos_planetary_id_Til_water
=
eos_planetary_id_Til_water
=
eos_planetary_type_Til
*
eos_planetary_type_factor
+
2
,
eos_planetary_type_Til
*
eos_planetary_type_factor
+
2
,
/*! Tillotson basalt */
/*! Tillotson basalt */
eos_planetary_id_Til_basalt
=
eos_planetary_id_Til_basalt
=
eos_planetary_type_Til
*
eos_planetary_type_factor
+
3
,
eos_planetary_type_Til
*
eos_planetary_type_factor
+
3
,
/* Hubbard & MacFarlane (1980) Uranus/Neptune */
/* Hubbard & MacFarlane (1980) Uranus/Neptune */
...
@@ -263,12 +263,12 @@ gas_internal_energy_from_entropy(float density, float entropy,
...
@@ -263,12 +263,12 @@ gas_internal_energy_from_entropy(float density, float entropy,
return
SESAME_internal_energy_from_entropy
(
density
,
entropy
,
return
SESAME_internal_energy_from_entropy
(
density
,
entropy
,
&
eos
.
ANEOS_forsterite
);
&
eos
.
ANEOS_forsterite
);
break
;
break
;
case
eos_planetary_id_ANEOS_iron
:
case
eos_planetary_id_ANEOS_iron
:
return
SESAME_internal_energy_from_entropy
(
density
,
entropy
,
return
SESAME_internal_energy_from_entropy
(
density
,
entropy
,
&
eos
.
ANEOS_iron
);
&
eos
.
ANEOS_iron
);
break
;
break
;
case
eos_planetary_id_ANEOS_Fe85Si15
:
case
eos_planetary_id_ANEOS_Fe85Si15
:
return
SESAME_internal_energy_from_entropy
(
density
,
entropy
,
return
SESAME_internal_energy_from_entropy
(
density
,
entropy
,
&
eos
.
ANEOS_Fe85Si15
);
&
eos
.
ANEOS_Fe85Si15
);
...
@@ -391,12 +391,12 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
...
@@ -391,12 +391,12 @@ __attribute__((always_inline)) INLINE static float gas_pressure_from_entropy(
return
SESAME_pressure_from_entropy
(
density
,
entropy
,
return
SESAME_pressure_from_entropy
(
density
,
entropy
,
&
eos
.
ANEOS_forsterite
);
&
eos
.
ANEOS_forsterite
);
break
;
break
;
case
eos_planetary_id_ANEOS_iron
:
case
eos_planetary_id_ANEOS_iron
:
return
SESAME_pressure_from_entropy
(
density
,
entropy
,
return
SESAME_pressure_from_entropy
(
density
,
entropy
,
&
eos
.
ANEOS_iron
);
&
eos
.
ANEOS_iron
);
break
;
break
;
case
eos_planetary_id_ANEOS_Fe85Si15
:
case
eos_planetary_id_ANEOS_Fe85Si15
:
return
SESAME_pressure_from_entropy
(
density
,
entropy
,
return
SESAME_pressure_from_entropy
(
density
,
entropy
,
&
eos
.
ANEOS_Fe85Si15
);
&
eos
.
ANEOS_Fe85Si15
);
...
@@ -513,7 +513,8 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
...
@@ -513,7 +513,8 @@ __attribute__((always_inline)) INLINE static float gas_entropy_from_pressure(
/* Select the material */
/* Select the material */
switch
(
mat_id
)
{
switch
(
mat_id
)
{
case
eos_planetary_id_ANEOS_forsterite
:
case
eos_planetary_id_ANEOS_forsterite
:
return
SESAME_entropy_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_forsterite
);
return
SESAME_entropy_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_forsterite
);
break
;
break
;
case
eos_planetary_id_ANEOS_iron
:
case
eos_planetary_id_ANEOS_iron
:
...
@@ -1290,16 +1291,17 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
...
@@ -1290,16 +1291,17 @@ __attribute__((always_inline)) INLINE static float gas_soundspeed_from_pressure(
/* Select the material */
/* Select the material */
switch
(
mat_id
)
{
switch
(
mat_id
)
{
case
eos_planetary_id_ANEOS_forsterite
:
case
eos_planetary_id_ANEOS_forsterite
:
return
SESAME_soundspeed_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_forsterite
);
return
SESAME_soundspeed_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_forsterite
);
break
;
break
;
case
eos_planetary_id_ANEOS_iron
:
case
eos_planetary_id_ANEOS_iron
:
return
SESAME_soundspeed_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_iron
);
return
SESAME_soundspeed_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_iron
);
break
;
break
;
case
eos_planetary_id_ANEOS_Fe85Si15
:
case
eos_planetary_id_ANEOS_Fe85Si15
:
return
SESAME_soundspeed_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_Fe85Si15
);
return
SESAME_soundspeed_from_pressure
(
density
,
P
,
&
eos
.
ANEOS_Fe85Si15
);
break
;
break
;
default:
default:
...
@@ -1411,7 +1413,8 @@ __attribute__((always_inline)) INLINE static void eos_init(
...
@@ -1411,7 +1413,8 @@ __attribute__((always_inline)) INLINE static void eos_init(
// ANEOS -- using SESAME-style tables
// ANEOS -- using SESAME-style tables
if
(
parser_get_opt_param_int
(
params
,
"EoS:planetary_use_ANEOS"
,
0
))
{
if
(
parser_get_opt_param_int
(
params
,
"EoS:planetary_use_ANEOS"
,
0
))
{
set_ANEOS_forsterite
(
&
e
->
ANEOS_forsterite
,
eos_planetary_id_ANEOS_forsterite
);
set_ANEOS_forsterite
(
&
e
->
ANEOS_forsterite
,
eos_planetary_id_ANEOS_forsterite
);
set_ANEOS_iron
(
&
e
->
ANEOS_iron
,
eos_planetary_id_ANEOS_iron
);
set_ANEOS_iron
(
&
e
->
ANEOS_iron
,
eos_planetary_id_ANEOS_iron
);
set_ANEOS_Fe85Si15
(
&
e
->
ANEOS_Fe85Si15
,
eos_planetary_id_ANEOS_Fe85Si15
);
set_ANEOS_Fe85Si15
(
&
e
->
ANEOS_Fe85Si15
,
eos_planetary_id_ANEOS_Fe85Si15
);
...
...
This diff is collapsed.
Click to expand it.
src/equation_of_state/planetary/sesame.h
+
7
−
8
View file @
90a5816d
...
@@ -29,8 +29,8 @@
...
@@ -29,8 +29,8 @@
*/
*/
/* Some standard headers. */
/* Some standard headers. */
#include
<math.h>
#include
<float.h>
#include
<float.h>
#include
<math.h>
/* Local headers. */
/* Local headers. */
#include
"adiabatic_index.h"
#include
"adiabatic_index.h"
...
@@ -385,13 +385,12 @@ INLINE static float SESAME_pressure_from_internal_energy(
...
@@ -385,13 +385,12 @@ INLINE static float SESAME_pressure_from_internal_energy(
P_2
=
mat
->
table_P_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
+
1
];
P_2
=
mat
->
table_P_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
+
1
];
P_3
=
mat
->
table_P_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
];
P_3
=
mat
->
table_P_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
];
P_4
=
mat
->
table_P_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
+
1
];
P_4
=
mat
->
table_P_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
+
1
];
// If below the minimum u at this rho then just use the lowest table values
// If below the minimum u at this rho then just use the lowest table values
if
((
idx_rho
>
0
.
f
)
&&
(
if
((
idx_rho
>
0
.
f
)
&&
(
intp_u_1
<
0
.
f
)
||
(
intp_u_2
<
0
.
f
)
||
(
P_1
>
P_2
)
||
(
P_3
>
P_4
)
((
intp_u_1
<
0
.
f
)
||
(
intp_u_2
<
0
.
f
)
||
(
P_1
>
P_2
)
||
(
P_3
>
P_4
)))
{
))
{
intp_u_1
=
0
;
intp_u_1
=
0
;
intp_u_2
=
0
;
intp_u_2
=
0
;
}
}
// If more than two table values are non-positive then return zero
// If more than two table values are non-positive then return zero
...
@@ -403,7 +402,7 @@ INLINE static float SESAME_pressure_from_internal_energy(
...
@@ -403,7 +402,7 @@ INLINE static float SESAME_pressure_from_internal_energy(
if
(
num_non_pos
>
0
)
{
if
(
num_non_pos
>
0
)
{
// If just one or two are non-positive then replace them with a tiny value
// If just one or two are non-positive then replace them with a tiny value
// Unless already trying to extrapolate in which case return zero
// Unless already trying to extrapolate in which case return zero
if
((
num_non_pos
>
2
)
||
(
mat
->
P_tiny
==
0
.
f
)
||
(
intp_rho
<
0
.
f
)
||
if
((
num_non_pos
>
2
)
||
(
mat
->
P_tiny
==
0
.
f
)
||
(
intp_rho
<
0
.
f
)
||
(
intp_u_1
<
0
.
f
)
||
(
intp_u_2
<
0
.
f
))
{
(
intp_u_1
<
0
.
f
)
||
(
intp_u_2
<
0
.
f
))
{
return
0
.
f
;
return
0
.
f
;
}
}
...
...
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