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
5149dd05
Commit
5149dd05
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Make the EAGLE cooling model use the smoothed metal abundances and not the raw ones.
parent
be1c1672
No related branches found
No related tags found
1 merge request
!761
Make the EAGLE cooling model use the smoothed metal abundances and not the raw ones.
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cooling/EAGLE/cooling.c
+10
-5
10 additions, 5 deletions
src/cooling/EAGLE/cooling.c
src/cooling/EAGLE/cooling_rates.h
+32
-22
32 additions, 22 deletions
src/cooling/EAGLE/cooling_rates.h
with
42 additions
and
27 deletions
src/cooling/EAGLE/cooling.c
+
10
−
5
View file @
5149dd05
...
@@ -209,7 +209,8 @@ INLINE static float newton_iter(
...
@@ -209,7 +209,8 @@ INLINE static float newton_iter(
const
float
log_table_bound_low
=
(
cooling
->
Therm
[
0
]
+
0
.
05
)
/
M_LOG10E
;
const
float
log_table_bound_low
=
(
cooling
->
Therm
[
0
]
+
0
.
05
)
/
M_LOG10E
;
/* convert Hydrogen mass fraction in Hydrogen number density */
/* convert Hydrogen mass fraction in Hydrogen number density */
const
float
XH
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_H
];
const
float
XH
=
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_H
];
const
double
n_H
=
const
double
n_H
=
hydro_get_physical_density
(
p
,
cosmo
)
*
XH
/
phys_const
->
const_proton_mass
;
hydro_get_physical_density
(
p
,
cosmo
)
*
XH
/
phys_const
->
const_proton_mass
;
const
double
n_H_cgs
=
n_H
*
cooling
->
number_density_to_cgs
;
const
double
n_H_cgs
=
n_H
*
cooling
->
number_density_to_cgs
;
...
@@ -501,8 +502,10 @@ void cooling_cool_part(const struct phys_const *phys_const,
...
@@ -501,8 +502,10 @@ void cooling_cool_part(const struct phys_const *phys_const,
abundance_ratio_to_solar
(
p
,
cooling
,
abundance_ratio
);
abundance_ratio_to_solar
(
p
,
cooling
,
abundance_ratio
);
/* Get the Hydrogen and Helium mass fractions */
/* Get the Hydrogen and Helium mass fractions */
const
float
XH
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_H
];
const
float
XH
=
const
float
XHe
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_He
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_H
];
const
float
XHe
=
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_He
];
/* Get the Helium mass fraction. Note that this is He / (H + He), i.e. a
/* Get the Helium mass fraction. Note that this is He / (H + He), i.e. a
* metal-free Helium mass fraction as per the Wiersma+08 definition */
* metal-free Helium mass fraction as per the Wiersma+08 definition */
...
@@ -719,8 +722,10 @@ float cooling_get_temperature(
...
@@ -719,8 +722,10 @@ float cooling_get_temperature(
const
double
u_cgs
=
u
*
cooling
->
internal_energy_to_cgs
;
const
double
u_cgs
=
u
*
cooling
->
internal_energy_to_cgs
;
/* Get the Hydrogen and Helium mass fractions */
/* Get the Hydrogen and Helium mass fractions */
const
float
XH
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_H
];
const
float
XH
=
const
float
XHe
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_He
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_H
];
const
float
XHe
=
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_He
];
/* Get the Helium mass fraction. Note that this is He / (H + He), i.e. a
/* Get the Helium mass fraction. Note that this is He / (H + He), i.e. a
* metal-free Helium mass fraction as per the Wiersma+08 definition */
* metal-free Helium mass fraction as per the Wiersma+08 definition */
...
...
This diff is collapsed.
Click to expand it.
src/cooling/EAGLE/cooling_rates.h
+
32
−
22
View file @
5149dd05
...
@@ -54,39 +54,49 @@ __attribute__((always_inline)) INLINE void abundance_ratio_to_solar(
...
@@ -54,39 +54,49 @@ __attribute__((always_inline)) INLINE void abundance_ratio_to_solar(
const
struct
part
*
p
,
const
struct
cooling_function_data
*
cooling
,
const
struct
part
*
p
,
const
struct
cooling_function_data
*
cooling
,
float
ratio_solar
[
chemistry_element_count
+
2
])
{
float
ratio_solar
[
chemistry_element_count
+
2
])
{
ratio_solar
[
0
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_H
]
*
ratio_solar
[
0
]
=
cooling
->
SolarAbundances_inv
[
0
/* H */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_H
]
*
cooling
->
SolarAbundances_inv
[
0
/* H */
];
ratio_solar
[
1
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_He
]
*
ratio_solar
[
1
]
=
cooling
->
SolarAbundances_inv
[
1
/* He */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_He
]
*
cooling
->
SolarAbundances_inv
[
1
/* He */
];
ratio_solar
[
2
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_C
]
*
ratio_solar
[
2
]
=
cooling
->
SolarAbundances_inv
[
2
/* C */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_C
]
*
cooling
->
SolarAbundances_inv
[
2
/* C */
];
ratio_solar
[
3
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_N
]
*
ratio_solar
[
3
]
=
cooling
->
SolarAbundances_inv
[
3
/* N */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_N
]
*
cooling
->
SolarAbundances_inv
[
3
/* N */
];
ratio_solar
[
4
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_O
]
*
ratio_solar
[
4
]
=
cooling
->
SolarAbundances_inv
[
4
/* O */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_O
]
*
cooling
->
SolarAbundances_inv
[
4
/* O */
];
ratio_solar
[
5
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Ne
]
*
ratio_solar
[
5
]
=
cooling
->
SolarAbundances_inv
[
5
/* Ne */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_Ne
]
*
cooling
->
SolarAbundances_inv
[
5
/* Ne */
];
ratio_solar
[
6
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Mg
]
*
ratio_solar
[
6
]
=
cooling
->
SolarAbundances_inv
[
6
/* Mg */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_Mg
]
*
cooling
->
SolarAbundances_inv
[
6
/* Mg */
];
ratio_solar
[
7
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Si
]
*
ratio_solar
[
7
]
=
cooling
->
SolarAbundances_inv
[
7
/* Si */
];
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_Si
]
*
cooling
->
SolarAbundances_inv
[
7
/* Si */
];
/* For S, we use the same ratio as Si */
/* For S, we use the same ratio as Si */
ratio_solar
[
8
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Si
]
*
ratio_solar
[
8
]
=
cooling
->
SolarAbundances_inv
[
7
/* Si */
]
*
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_Si
]
*
cooling
->
S_over_Si_ratio_in_solar
;
cooling
->
SolarAbundances_inv
[
7
/* Si */
]
*
cooling
->
S_over_Si_ratio_in_solar
;
/* For Ca, we use the same ratio as Si */
/* For Ca, we use the same ratio as Si */
ratio_solar
[
9
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Si
]
*
ratio_solar
[
9
]
=
cooling
->
SolarAbundances_inv
[
7
/* Si */
]
*
p
->
chemistry_data
.
smoothed_metal_mass_fraction
[
chemistry_element_Si
]
*
cooling
->
Ca_over_Si_ratio_in_solar
;
cooling
->
SolarAbundances_inv
[
7
/* Si */
]
*
cooling
->
Ca_over_Si_ratio_in_solar
;
ratio_solar
[
10
]
=
ratio_solar
[
10
]
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Fe
]
*
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_Fe
]
*
...
...
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