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
16d1bb08
Commit
16d1bb08
authored
5 years ago
by
Sergio Ruiz-Bonilla
Committed by
Matthieu Schaller
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Fix FPE from rare duplicate values in the SESAME planetary EoS tables
parent
35eaa463
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/equation_of_state/planetary/sesame.h
+58
-18
58 additions, 18 deletions
src/equation_of_state/planetary/sesame.h
with
58 additions
and
18 deletions
src/equation_of_state/planetary/sesame.h
+
58
−
18
View file @
16d1bb08
...
@@ -338,15 +338,35 @@ INLINE static float SESAME_pressure_from_internal_energy(
...
@@ -338,15 +338,35 @@ INLINE static float SESAME_pressure_from_internal_energy(
idx_u_2
=
mat
->
num_T
-
2
;
idx_u_2
=
mat
->
num_T
-
2
;
}
}
intp_rho
=
(
log_rho
-
mat
->
table_log_rho
[
idx_rho
])
/
// Check for duplicates in SESAME tables before interpolation
(
mat
->
table_log_rho
[
idx_rho
+
1
]
-
mat
->
table_log_rho
[
idx_rho
]);
if
(
mat
->
table_log_rho
[
idx_rho
+
1
]
!=
mat
->
table_log_rho
[
idx_rho
])
{
intp_u_1
=
(
log_u
-
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
])
/
intp_rho
=
(
log_rho
-
mat
->
table_log_rho
[
idx_rho
])
/
(
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
(
idx_u_1
+
1
)]
-
(
mat
->
table_log_rho
[
idx_rho
+
1
]
-
mat
->
table_log_rho
[
idx_rho
]);
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
]);
}
else
{
intp_u_2
=
intp_rho
=
1
.;
(
log_u
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
])
/
}
(
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
(
idx_u_2
+
1
)]
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
]);
// Check for duplicates in SESAME tables before interpolation
if
(
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
(
idx_u_1
+
1
)]
!=
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
])
{
intp_u_1
=
(
log_u
-
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
])
/
(
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
(
idx_u_1
+
1
)]
-
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
]);
}
else
{
intp_u_1
=
1
.;
}
// Check for duplicates in SESAME tables before interpolation
if
(
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
(
idx_u_2
+
1
)]
!=
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
])
{
intp_u_2
=
(
log_u
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
])
/
(
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
(
idx_u_2
+
1
)]
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
]);
}
else
{
intp_u_2
=
1
.;
}
// Table values
// Table values
P_1
=
mat
->
table_P_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
];
P_1
=
mat
->
table_P_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
];
...
@@ -442,15 +462,35 @@ INLINE static float SESAME_soundspeed_from_internal_energy(
...
@@ -442,15 +462,35 @@ INLINE static float SESAME_soundspeed_from_internal_energy(
idx_u_2
=
mat
->
num_T
-
2
;
idx_u_2
=
mat
->
num_T
-
2
;
}
}
intp_rho
=
(
log_rho
-
mat
->
table_log_rho
[
idx_rho
])
/
// Check for duplicates in SESAME tables before interpolation
(
mat
->
table_log_rho
[
idx_rho
+
1
]
-
mat
->
table_log_rho
[
idx_rho
]);
if
(
mat
->
table_log_rho
[
idx_rho
+
1
]
!=
mat
->
table_log_rho
[
idx_rho
])
{
intp_u_1
=
(
log_u
-
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
])
/
intp_rho
=
(
log_rho
-
mat
->
table_log_rho
[
idx_rho
])
/
(
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
(
idx_u_1
+
1
)]
-
(
mat
->
table_log_rho
[
idx_rho
+
1
]
-
mat
->
table_log_rho
[
idx_rho
]);
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
]);
}
else
{
intp_u_2
=
intp_rho
=
1
.;
(
log_u
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
])
/
}
(
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
(
idx_u_2
+
1
)]
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
]);
// Check for duplicates in SESAME tables before interpolation
if
(
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
(
idx_u_1
+
1
)]
!=
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
])
{
intp_u_1
=
(
log_u
-
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
])
/
(
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
(
idx_u_1
+
1
)]
-
mat
->
table_log_u_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
]);
}
else
{
intp_u_1
=
1
.;
}
// Check for duplicates in SESAME tables before interpolation
if
(
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
(
idx_u_2
+
1
)]
!=
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
])
{
intp_u_2
=
(
log_u
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
])
/
(
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
(
idx_u_2
+
1
)]
-
mat
->
table_log_u_rho_T
[(
idx_rho
+
1
)
*
mat
->
num_T
+
idx_u_2
]);
}
else
{
intp_u_2
=
1
.;
}
// Table values
// Table values
c_1
=
mat
->
table_c_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
];
c_1
=
mat
->
table_c_rho_T
[
idx_rho
*
mat
->
num_T
+
idx_u_1
];
...
...
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