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
b275d63c
Commit
b275d63c
authored
6 years ago
by
Folkert Nobels
Browse files
Options
Downloads
Patches
Plain Diff
Rename a few variable to make the variables more clear
parent
46743f8c
No related branches found
No related tags found
1 merge request
!705
Star formation following Schaye08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/starformation/schaye08/starformation.h
+23
-17
23 additions, 17 deletions
src/starformation/schaye08/starformation.h
with
23 additions
and
17 deletions
src/starformation/schaye08/starformation.h
+
23
−
17
View file @
b275d63c
...
...
@@ -43,6 +43,9 @@ struct star_formation {
/*! Normalization of the KS star formation law */
double
KS_normalization
;
/*! Normalization of the KS star formation law in user units */
float
KS_normalization_MSUNpYRpKPC2
;
/*! Slope of the KS law */
double
KS_power_law
;
...
...
@@ -59,7 +62,7 @@ struct star_formation {
double
min_over_den
;
/*! Critical temperature */
double
T
_crit
;
double
T
emperature_threshold
;
/*! gas fraction */
double
fgas
;
...
...
@@ -80,10 +83,10 @@ struct star_formation {
double
inv_RAND_MAX
;
/*! Critical density to form stars */
double
den
_crit
;
double
den
sity_threshold
;
/*! Maximum critical density to form stars */
double
den
_crit
_max
;
double
den
sity_threshold
_max
;
/*! Scaling metallicity */
double
Z0
;
...
...
@@ -95,7 +98,7 @@ struct star_formation {
double
n_Z0
;
/*! Normalization of critical SF density of Schaye (2004) */
double
den
_crit
_star
;
double
den
sity_threshold
_star
;
/*! Polytropic index */
double
polytropic_index
;
...
...
@@ -108,6 +111,7 @@ struct star_formation {
/*! EOS density norm */
double
EOS_density_norm
;
};
/*
...
...
@@ -151,12 +155,12 @@ INLINE static int star_formation_potential_to_become_star(
* the appropriate limit */
/* Check if it exceeded the maximum density */
if
(
p
->
rho
>
starform
->
den
_crit
_max
)
{
if
(
p
->
rho
>
starform
->
den
sity_threshold
_max
)
{
/* double tempp = cooling_get_temperature() */
tempp
=
cooling_get_temperature
(
phys_const
,
hydro_props
,
us
,
cosmo
,
cooling
,
p
,
xp
);
/* Check the last criteria, if the temperature is satisfied */
if
(
tempp
<
starform
->
T
_crit
)
{
if
(
tempp
<
starform
->
T
emperature_threshold
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -167,14 +171,14 @@ INLINE static int star_formation_potential_to_become_star(
/* Get the metallicity from the chemistry struct
* Do we use SMOOTHED OR NON SMOOTHED IN EAGLE???*/
double
Z
=
p
->
chemistry_data
.
smoothed_metal_mass_fraction_total
;
double
den
_crit
_current
=
starform
->
den
_crit
*
pow
(
Z
*
starform
->
Z0_inv
,
starform
->
n_Z0
);
if
(
p
->
rho
>
den
_crit
_current
)
{
double
den
sity_threshold
_current
=
starform
->
den
sity_threshold
*
pow
(
Z
*
starform
->
Z0_inv
,
starform
->
n_Z0
);
if
(
p
->
rho
>
den
sity_threshold
_current
)
{
/* double tempp = cooling_get_temperature() */
tempp
=
cooling_get_temperature
(
phys_const
,
hydro_props
,
us
,
cosmo
,
cooling
,
p
,
xp
);
/* Check the last criteria, if the temperature is satisfied */
if
(
tempp
<
starform
->
T
_crit
)
{
if
(
tempp
<
starform
->
T
emperature_threshold
)
{
return
1
;
}
else
{
return
0
;
...
...
@@ -326,7 +330,7 @@ INLINE static void starformation_init_backend(
parser_get_param_double
(
parameter_file
,
"SchayeSF:thresh_MinOverDens"
);
/* Read the critical temperature from the parameter file */
starform
->
T
_crit
=
starform
->
T
emperature_threshold
=
parser_get_param_double
(
parameter_file
,
"SchayeSF:thresh_temp"
);
/* Read the gas fraction from the file */
...
...
@@ -336,6 +340,8 @@ INLINE static void starformation_init_backend(
const
double
normalization_MSUNpYRpKPC2
=
parser_get_param_double
(
parameter_file
,
"SchayeSF:SchmidtLawCoeff_MSUNpYRpKPC2"
);
starform
->
KS_normalization_MSUNpYRpKPC2
=
normalization_MSUNpYRpKPC2
;
/* Read the Kennicutt-Schmidt power law exponent */
starform
->
KS_power_law
=
parser_get_param_double
(
parameter_file
,
"SchayeSF:SchmidtLawExponent"
);
...
...
@@ -405,7 +411,7 @@ INLINE static void starformation_init_backend(
* to form stars. */
/* Read the normalization of the metallicity dependent critical
* density*/
starform
->
den
_crit
=
starform
->
den
sity_threshold
=
parser_get_param_double
(
parameter_file
,
"SchayeSF:thresh_norm_HpCM3"
)
*
conversion_numb_density
;
...
...
@@ -417,7 +423,7 @@ INLINE static void starformation_init_backend(
parser_get_param_double
(
parameter_file
,
"SchayeSF:MetDep_SFthresh_Slope"
);
/* Read the maximum allowed density for star formation */
starform
->
den
_crit
_max
=
starform
->
den
sity_threshold
_max
=
parser_get_param_double
(
parameter_file
,
"SchayeSF:thresh_max_norm_HpCM3"
);
/* Claculate 1 over the metallicity */
...
...
@@ -425,7 +431,7 @@ INLINE static void starformation_init_backend(
/* Calculate the prefactor that is always common */
/* !!!DONT FORGET TO DO THE CORRECT UNIT CONVERSION!!!*/
starform
->
den
_crit
_star
=
starform
->
den
_crit
/
starform
->
den
sity_threshold
_star
=
starform
->
den
sity_threshold
/
pow
(
starform
->
Z0
,
starform
->
n_Z0
)
*
conversion_numb_density
;
}
...
...
@@ -442,14 +448,14 @@ INLINE static void starformation_print_backend(
" with properties, normalization = %e, slope of the Kennicutt"
"-Schmidt law = %e, gas fraction = %e, critical "
"density = %e and critical temperature = %e"
,
starform
->
KS_normalization
,
starform
->
KS_power_law
,
starform
->
fgas
,
starform
->
den
_crit
,
starform
->
T_crit
);
starform
->
KS_normalization
_MSUNpYRpKPC2
,
starform
->
KS_power_law
,
starform
->
fgas
,
starform
->
den
sity_threshold
,
starform
->
Temperature_threshold
);
message
(
"Density threshold to form stars is given by Schaye "
"(2004), the normalization of the star formation law is given by"
" %e, with metallicity slope of %e, and metallicity normalization"
"of %e"
,
starform
->
den
_crit
_star
,
starform
->
n_Z0
,
starform
->
Z0
);
starform
->
den
sity_threshold
_star
,
starform
->
n_Z0
,
starform
->
Z0
);
}
#endif
/* SWIFT_SCHAYE_STARFORMATION_H */
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