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
d0a5a9b7
Commit
d0a5a9b7
authored
2 years ago
by
Jacob Kegerreis
Browse files
Options
Downloads
Patches
Plain Diff
Update HM80 tables
parent
be2a599c
No related branches found
No related tags found
1 merge request
!1615
Draft: Update HM80 tables
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/equation_of_state/planetary/hm80.h
+26
-24
26 additions, 24 deletions
src/equation_of_state/planetary/hm80.h
with
26 additions
and
24 deletions
src/equation_of_state/planetary/hm80.h
+
26
−
24
View file @
d0a5a9b7
...
...
@@ -23,8 +23,8 @@
/**
* @file equation_of_state/planetary/hm80.h
*
* Contains the Hubbard & MacFarlane (1980) Uranus/Neptune EOS functions
for
* equation_of_state/planetary/equation_of_state.h
* Contains the Hubbard & MacFarlane (1980) Uranus/Neptune
-like
EOS functions
*
for
equation_of_state/planetary/equation_of_state.h
*
*/
...
...
@@ -42,7 +42,7 @@
// Hubbard & MacFarlane (1980) parameters
struct
HM80_params
{
float
*
table_log_P_rho_u
;
int
date
,
num_rho
,
num_u
;
int
version_
date
,
num_rho
,
num_u
;
float
log_rho_min
,
log_rho_max
,
log_rho_step
,
inv_log_rho_step
,
log_u_min
,
log_u_max
,
log_u_step
,
inv_log_u_step
,
bulk_mod
,
P_min_for_c_min
;
enum
eos_planetary_material_id
mat_id
;
...
...
@@ -54,38 +54,40 @@ INLINE static void set_HM80_HHe(struct HM80_params *mat,
mat
->
mat_id
=
mat_id
;
mat
->
bulk_mod
=
0
.
f
;
mat
->
P_min_for_c_min
=
1e3
f
;
mat
->
date
=
202
01003
;
mat
->
version_
date
=
202
20822
;
}
INLINE
static
void
set_HM80_ice
(
struct
HM80_params
*
mat
,
enum
eos_planetary_material_id
mat_id
)
{
mat
->
mat_id
=
mat_id
;
mat
->
bulk_mod
=
2.0e9
f
;
mat
->
P_min_for_c_min
=
0
.
f
;
mat
->
date
=
202
01003
;
mat
->
version_
date
=
202
20822
;
}
INLINE
static
void
set_HM80_rock
(
struct
HM80_params
*
mat
,
enum
eos_planetary_material_id
mat_id
)
{
mat
->
mat_id
=
mat_id
;
mat
->
bulk_mod
=
3.49e10
f
;
mat
->
P_min_for_c_min
=
0
.
f
;
mat
->
date
=
202
01003
;
mat
->
version_
date
=
202
20822
;
}
// Read the table from file
INLINE
static
void
load_table_HM80
(
struct
HM80_params
*
mat
,
char
*
table_file
)
{
/* File contents:
header (five lines)
date
log_rho_min log_rho_max num_rho log_u_min log_u_max num_u (SI)
P_0_0 P_0_1 ... P_0_num_u # Array of pressures (Pa)
P_1_0 ... ... P_1_num_u
... ... ... ...
P_num_rho_0 ... P_num_rho_num_u
T_0_0 T_0_1 ... T_0_num_u # Array of temperatures (K)
T_1_0 ... ... T_1_num_u
... ... ... ...
T_num_rho_0 ... T_num_rho_num_u
/*
File contents
-------------
# header (11 lines)
version_date (YYYYMMDD)
log_rho_min log_rho_max num_rho log_u_min log_u_max num_u
P[0,0] P[0,1] ... P[0,num_u] (Pressures, Pa)
P[1,0] ... ... P[1,num_u]
... ... ... ...
P[num_rho,0] ... ... P[num_rho,num_u]
T[0,0] T[0,1] ... T[0,num_u] (Temperatures, K)
T[1,0] ... ... T[1,num_u]
... ... ... ...
T[num_rho,0] ... ... T[num_rho,num_u]
*/
// Load table contents from file
...
...
@@ -94,21 +96,21 @@ INLINE static void load_table_HM80(struct HM80_params *mat, char *table_file) {
// Ignore header lines
char
buffer
[
100
];
for
(
int
i
=
0
;
i
<
5
;
i
++
)
{
for
(
int
i
=
0
;
i
<
11
;
i
++
)
{
if
(
fgets
(
buffer
,
100
,
f
)
==
NULL
)
error
(
"Failed to read the HM80 EoS file header %s"
,
table_file
);
}
// Table properties
int
date
;
int
c
=
fscanf
(
f
,
"%d"
,
&
date
);
int
version_
date
;
int
c
=
fscanf
(
f
,
"%d"
,
&
version_
date
);
if
(
c
!=
1
)
error
(
"Failed to read the HM80 EoS table %s"
,
table_file
);
if
(
date
!=
mat
->
date
)
if
(
version_
date
!=
mat
->
version_
date
)
error
(
"EoS file %s date %d does not match expected %d"
"EoS file %s
version
date %d does not match expected %d"
"
\n
Please download the file using "
"examples/Planetary/EoSTables/get_eos_tables.sh"
,
table_file
,
date
,
mat
->
date
);
table_file
,
version_
date
,
mat
->
version_
date
);
c
=
fscanf
(
f
,
"%f %f %d %f %f %d"
,
&
mat
->
log_rho_min
,
&
mat
->
log_rho_max
,
&
mat
->
num_rho
,
&
mat
->
log_u_min
,
&
mat
->
log_u_max
,
&
mat
->
num_u
);
if
(
c
!=
6
)
error
(
"Failed to read the HM80 EoS table %s"
,
table_file
);
...
...
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