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
7cd0f2fa
Commit
7cd0f2fa
authored
6 years ago
by
Folkert Nobels
Browse files
Options
Downloads
Patches
Plain Diff
Update the EAGLE star formation
parent
a0f68fd8
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!764
Add EOS temperature from entropy floor
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/entropy_floor/EAGLE/entropy_floor.h
+42
-0
42 additions, 0 deletions
src/entropy_floor/EAGLE/entropy_floor.h
src/runner.c
+2
-1
2 additions, 1 deletion
src/runner.c
src/star_formation/EAGLE/star_formation.h
+4
-2
4 additions, 2 deletions
src/star_formation/EAGLE/star_formation.h
with
48 additions
and
3 deletions
src/entropy_floor/EAGLE/entropy_floor.h
+
42
−
0
View file @
7cd0f2fa
...
@@ -136,6 +136,48 @@ static INLINE float entropy_floor(
...
@@ -136,6 +136,48 @@ static INLINE float entropy_floor(
return
gas_entropy_from_pressure
(
rho
,
pressure
);
return
gas_entropy_from_pressure
(
rho
,
pressure
);
}
}
static
INLINE
float
entropy_floor_temperature
(
const
struct
part
*
p
,
const
struct
cosmology
*
cosmo
,
const
struct
entropy_floor_properties
*
props
){
/* Physical density in internal units */
const
float
rho
=
hydro_get_physical_density
(
p
,
cosmo
);
/* Critical density at this redshift.
* Recall that this is 0 in a non-cosmological run */
const
float
rho_crit
=
cosmo
->
critical_density
;
const
float
rho_crit_baryon
=
cosmo
->
Omega_b
*
rho_crit
;
/* Physical temperature */
float
temperature
=
0
.
f
;
/* Are we in the regime of the Jeans equation of state? */
if
((
rho
>=
rho_crit_baryon
*
props
->
Jeans_over_density_threshold
)
&&
(
rho
>=
props
->
Jeans_density_threshold
))
{
const
float
jeans_slope
=
props
->
Jeans_gamma_effective
-
1
.
f
;
const
float
temperature_Jeans
=
props
->
Jeans_temperature_norm
*
pow
(
rho
*
props
->
Jeans_density_threshold_inv
,
jeans_slope
);
temperature
=
max
(
temperature
,
temperature_Jeans
);
}
/* Are we in the regime of the Cool equation of state? */
if
((
rho
>=
rho_crit_baryon
*
props
->
Cool_over_density_threshold
)
&&
(
rho
>=
props
->
Cool_density_threshold
))
{
const
float
cool_slope
=
props
->
Cool_gamma_effective
-
1
.
f
;
const
float
temperature_Cool
=
props
->
Cool_temperature_norm
*
pow
(
rho
*
props
->
Cool_density_threshold_inv
,
cool_slope
);
temperature
=
max
(
temperature
,
temperature_Cool
);
}
return
temperature
;
}
/**
/**
* @brief Initialise the entropy floor by reading the parameters and converting
* @brief Initialise the entropy floor by reading the parameters and converting
* to internal units.
* to internal units.
...
...
This diff is collapsed.
Click to expand it.
src/runner.c
+
2
−
1
View file @
7cd0f2fa
...
@@ -577,6 +577,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
...
@@ -577,6 +577,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
const
struct
hydro_props
*
restrict
hydro_props
=
e
->
hydro_properties
;
const
struct
hydro_props
*
restrict
hydro_props
=
e
->
hydro_properties
;
const
struct
unit_system
*
restrict
us
=
e
->
internal_units
;
const
struct
unit_system
*
restrict
us
=
e
->
internal_units
;
struct
cooling_function_data
*
restrict
cooling
=
e
->
cooling_func
;
struct
cooling_function_data
*
restrict
cooling
=
e
->
cooling_func
;
const
struct
entropy_floor_properties
*
entropy
=
e
->
entropy_floor
;
const
double
time_base
=
e
->
time_base
;
const
double
time_base
=
e
->
time_base
;
const
integertime_t
ti_current
=
e
->
ti_current
;
const
integertime_t
ti_current
=
e
->
ti_current
;
const
int
current_stars_count
=
c
->
stars
.
count
;
const
int
current_stars_count
=
c
->
stars
.
count
;
...
@@ -604,7 +605,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
...
@@ -604,7 +605,7 @@ void runner_do_star_formation(struct runner *r, struct cell *c, int timer) {
/* Is this particle star forming? */
/* Is this particle star forming? */
if
(
star_formation_is_star_forming
(
p
,
xp
,
sf_props
,
phys_const
,
cosmo
,
if
(
star_formation_is_star_forming
(
p
,
xp
,
sf_props
,
phys_const
,
cosmo
,
hydro_props
,
us
,
cooling
))
{
hydro_props
,
us
,
cooling
,
entropy
))
{
/* Time-step size for this particle */
/* Time-step size for this particle */
double
dt_star
;
double
dt_star
;
...
...
This diff is collapsed.
Click to expand it.
src/star_formation/EAGLE/star_formation.h
+
4
−
2
View file @
7cd0f2fa
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include
"random.h"
#include
"random.h"
#include
"stars.h"
#include
"stars.h"
#include
"units.h"
#include
"units.h"
#include
"entropy_floor.h"
/**
/**
* @file src/star_formation/EAGLE/star_formation.h
* @file src/star_formation/EAGLE/star_formation.h
...
@@ -224,7 +225,8 @@ INLINE static int star_formation_is_star_forming(
...
@@ -224,7 +225,8 @@ INLINE static int star_formation_is_star_forming(
const
struct
cosmology
*
cosmo
,
const
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
restrict
hydro_props
,
const
struct
hydro_props
*
restrict
hydro_props
,
const
struct
unit_system
*
restrict
us
,
const
struct
unit_system
*
restrict
us
,
const
struct
cooling_function_data
*
restrict
cooling
)
{
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
entropy_floor_properties
*
restrict
entropy
)
{
/* Minimal density (converted from critical density) for star formation */
/* Minimal density (converted from critical density) for star formation */
const
double
rho_crit_times_min_over_den
=
const
double
rho_crit_times_min_over_den
=
...
@@ -261,7 +263,7 @@ INLINE static int star_formation_is_star_forming(
...
@@ -261,7 +263,7 @@ INLINE static int star_formation_is_star_forming(
us
,
cosmo
,
cooling
,
p
,
xp
);
us
,
cosmo
,
cooling
,
p
,
xp
);
/* Temperature on the equation of state */
/* Temperature on the equation of state */
const
double
temperature_eos
=
EOS_temperature
(
n_H
,
starform
);
const
double
temperature_eos
=
entropy_floor_temperature
(
p
,
cosmo
,
entropy
);
/* Check the Scahye & Dalla Vecchia 2012 EOS-based temperature critrion */
/* Check the Scahye & Dalla Vecchia 2012 EOS-based temperature critrion */
return
(
temperature
<
return
(
temperature
<
...
...
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