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
9838e226
Commit
9838e226
authored
6 years ago
by
Matthieu Schaller
Browse files
Options
Downloads
Patches
Plain Diff
Added function to calculate temperature from the Wiersma table interpolation.
parent
8e2729b1
No related branches found
No related tags found
1 merge request
!697
Add functions to calculate temperature of particles.
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/cooling/EAGLE/cooling.c
+36
-3
36 additions, 3 deletions
src/cooling/EAGLE/cooling.c
with
36 additions
and
3 deletions
src/cooling/EAGLE/cooling.c
+
36
−
3
View file @
9838e226
...
@@ -492,8 +492,8 @@ void cooling_cool_part(const struct phys_const *restrict phys_const,
...
@@ -492,8 +492,8 @@ void cooling_cool_part(const struct phys_const *restrict phys_const,
re-ionization as this needs to be added on no matter what */
re-ionization as this needs to be added on no matter what */
/* Get helium and hydrogen reheating term */
/* Get helium and hydrogen reheating term */
const
double
Helium_reion_heat_cgs
=
const
double
Helium_reion_heat_cgs
=
eagle_helium_reionization_extraheat
(
eagle_helium_reionization_extraheat
(
cooling
->
z_index
,
delta_redshift
,
cooling
);
cooling
->
z_index
,
delta_redshift
,
cooling
);
/* Convert this into a rate */
/* Convert this into a rate */
const
double
Lambda_He_reion_cgs
=
const
double
Lambda_He_reion_cgs
=
...
@@ -638,7 +638,40 @@ float cooling_get_temperature(
...
@@ -638,7 +638,40 @@ float cooling_get_temperature(
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
return
1
.
f
;
/* Get physical internal energy */
const
float
u
=
hydro_get_physical_internal_energy
(
p
,
xp
,
cosmo
);
const
double
u_cgs
=
u
*
cooling
->
internal_energy_to_cgs
;
/* Get the Hydrogen mass fraction */
const
float
XH
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_H
];
/* 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 */
const
float
HeFrac
=
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_He
]
/
(
XH
+
p
->
chemistry_data
.
metal_mass_fraction
[
chemistry_element_He
]);
/* Convert Hydrogen mass fraction into Hydrogen number density */
const
float
rho
=
hydro_get_physical_density
(
p
,
cosmo
);
const
double
n_H
=
rho
*
XH
/
phys_const
->
const_proton_mass
;
const
double
n_H_cgs
=
n_H
*
cooling
->
number_density_to_cgs
;
/* compute hydrogen number density and helium fraction table indices and
* offsets */
int
He_index
,
n_H_index
;
float
d_He
,
d_n_H
;
get_index_1d
(
cooling
->
HeFrac
,
eagle_cooling_N_He_frac
,
HeFrac
,
&
He_index
,
&
d_He
);
get_index_1d
(
cooling
->
nH
,
eagle_cooling_N_density
,
log10
(
n_H_cgs
),
&
n_H_index
,
&
d_n_H
);
/* Compute the log10 of the temperature by interpolating the table */
const
double
log_10_T
=
eagle_convert_u_to_temp
(
log10
(
u_cgs
),
cosmo
->
z
,
/*compute_dT_du=*/
0
,
/*dT_du=*/
NULL
,
n_H_index
,
He_index
,
d_n_H
,
d_He
,
cooling
);
/* Undo the log! */
return
exp10
(
log_10_T
);
}
}
/**
/**
...
...
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