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
1ccdb8c6
Commit
1ccdb8c6
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
formating
parent
18da2ec4
No related branches found
No related tags found
1 merge request
!499
Improved grackle
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cooling/grackle/cooling.h
+105
-89
105 additions, 89 deletions
src/cooling/grackle/cooling.h
src/cooling/grackle/cooling_struct.h
+5
-5
5 additions, 5 deletions
src/cooling/grackle/cooling_struct.h
with
110 additions
and
94 deletions
src/cooling/grackle/cooling.h
+
105
−
89
View file @
1ccdb8c6
...
@@ -92,15 +92,15 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part(
...
@@ -92,15 +92,15 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part(
#if COOLING_GRACKLE_MODE >= 3
#if COOLING_GRACKLE_MODE >= 3
/* primordial chemistry >= 3 */
/* primordial chemistry >= 3 */
xp
->
cooling_data
.
DI_frac
=
grackle_data
->
HydrogenFractionByMass
*
grackle_data
->
DeuteriumToHydrogenRatio
;
xp
->
cooling_data
.
DI_frac
=
grackle_data
->
HydrogenFractionByMass
*
grackle_data
->
DeuteriumToHydrogenRatio
;
xp
->
cooling_data
.
DII_frac
=
zero
;
xp
->
cooling_data
.
DII_frac
=
zero
;
xp
->
cooling_data
.
HDI_frac
=
zero
;
xp
->
cooling_data
.
HDI_frac
=
zero
;
#endif // MODE >= 3
#endif
// MODE >= 3
#endif // MODE >= 2
#endif
// MODE >= 2
#endif // MODE >= 1
#endif // MODE >= 1
}
}
/**
/**
...
@@ -120,7 +120,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_density(
...
@@ -120,7 +120,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_density(
xp
->
cooling_data
.
HeIII_frac
*=
rho
;
xp
->
cooling_data
.
HeIII_frac
*=
rho
;
xp
->
cooling_data
.
e_frac
*=
rho
;
xp
->
cooling_data
.
e_frac
*=
rho
;
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
/* primordial chemistry >= 2 */
/* primordial chemistry >= 2 */
xp
->
cooling_data
.
HM_frac
*=
rho
;
xp
->
cooling_data
.
HM_frac
*=
rho
;
xp
->
cooling_data
.
H2I_frac
*=
rho
;
xp
->
cooling_data
.
H2I_frac
*=
rho
;
...
@@ -131,11 +131,11 @@ __attribute__((always_inline)) INLINE static void cooling_compute_density(
...
@@ -131,11 +131,11 @@ __attribute__((always_inline)) INLINE static void cooling_compute_density(
xp
->
cooling_data
.
DI_frac
*=
rho
;
xp
->
cooling_data
.
DI_frac
*=
rho
;
xp
->
cooling_data
.
DII_frac
*=
rho
;
xp
->
cooling_data
.
DII_frac
*=
rho
;
xp
->
cooling_data
.
HDI_frac
*=
rho
;
xp
->
cooling_data
.
HDI_frac
*=
rho
;
#endif // MODE >= 3
#endif
// MODE >= 3
#endif // MODE >= 2
#endif
// MODE >= 2
#endif // MODE >= 1
#endif
// MODE >= 1
xp
->
cooling_data
.
metal_frac
*=
rho
;
xp
->
cooling_data
.
metal_frac
*=
rho
;
}
}
...
@@ -157,7 +157,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_fraction(
...
@@ -157,7 +157,7 @@ __attribute__((always_inline)) INLINE static void cooling_compute_fraction(
xp
->
cooling_data
.
HeIII_frac
/=
rho
;
xp
->
cooling_data
.
HeIII_frac
/=
rho
;
xp
->
cooling_data
.
e_frac
/=
rho
;
xp
->
cooling_data
.
e_frac
/=
rho
;
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
/* primordial chemistry >= 2 */
/* primordial chemistry >= 2 */
xp
->
cooling_data
.
HM_frac
/=
rho
;
xp
->
cooling_data
.
HM_frac
/=
rho
;
xp
->
cooling_data
.
H2I_frac
/=
rho
;
xp
->
cooling_data
.
H2I_frac
/=
rho
;
...
@@ -168,11 +168,11 @@ __attribute__((always_inline)) INLINE static void cooling_compute_fraction(
...
@@ -168,11 +168,11 @@ __attribute__((always_inline)) INLINE static void cooling_compute_fraction(
xp
->
cooling_data
.
DI_frac
/=
rho
;
xp
->
cooling_data
.
DI_frac
/=
rho
;
xp
->
cooling_data
.
DII_frac
/=
rho
;
xp
->
cooling_data
.
DII_frac
/=
rho
;
xp
->
cooling_data
.
HDI_frac
/=
rho
;
xp
->
cooling_data
.
HDI_frac
/=
rho
;
#endif // MODE >= 3
#endif
// MODE >= 3
#endif // MODE >= 2
#endif
// MODE >= 2
#endif // MODE >= 1
#endif
// MODE >= 1
xp
->
cooling_data
.
metal_frac
/=
rho
;
xp
->
cooling_data
.
metal_frac
/=
rho
;
}
}
...
@@ -207,7 +207,8 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend(
...
@@ -207,7 +207,8 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend(
message
(
"CloudyTable = %s"
,
cooling
->
cloudy_table
);
message
(
"CloudyTable = %s"
,
cooling
->
cloudy_table
);
message
(
"UVbackground = %d"
,
cooling
->
uv_background
);
message
(
"UVbackground = %d"
,
cooling
->
uv_background
);
message
(
"Redshift = %g"
,
cooling
->
redshift
);
message
(
"Redshift = %g"
,
cooling
->
redshift
);
message
(
"Solar Metal Fraction = %g"
,
cooling
->
chemistry
.
SolarMetalFractionByMass
);
message
(
"Solar Metal Fraction = %g"
,
cooling
->
chemistry
.
SolarMetalFractionByMass
);
message
(
"Units:"
);
message
(
"Units:"
);
message
(
"
\t
Comoving = %i"
,
cooling
->
units
.
comoving_coordinates
);
message
(
"
\t
Comoving = %i"
,
cooling
->
units
.
comoving_coordinates
);
message
(
"
\t
Length = %g"
,
cooling
->
units
.
length_units
);
message
(
"
\t
Length = %g"
,
cooling
->
units
.
length_units
);
...
@@ -215,55 +216,72 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend(
...
@@ -215,55 +216,72 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend(
message
(
"
\t
Time = %g"
,
cooling
->
units
.
time_units
);
message
(
"
\t
Time = %g"
,
cooling
->
units
.
time_units
);
message
(
"
\t
Scale Factor = %g"
,
cooling
->
units
.
a_units
);
message
(
"
\t
Scale Factor = %g"
,
cooling
->
units
.
a_units
);
#ifdef SWIFT_DEBUG_CHECKS
#ifdef SWIFT_DEBUG_CHECKS
/*
/*
const chemistry_data *tmp = &cooling->chemistry;
const chemistry_data *tmp = &cooling->chemistry;
message("Debug:");
message("Debug:");
message("UVBackground = %i", tmp->UVbackground);
message("UVBackground = %i", tmp->UVbackground);
message("Grackle data file = %s", tmp->grackle_data_file);
message("Grackle data file = %s", tmp->grackle_data_file);
message("CMB temperature floor = %i", tmp->cmb_temperature_floor);
message("CMB temperature floor = %i", tmp->cmb_temperature_floor);
message("Gamma = %g", tmp->Gamma);
message("Gamma = %g", tmp->Gamma);
message("H2 on dust = %i", tmp->h2_on_dust);
message("H2 on dust = %i", tmp->h2_on_dust);
message("Photoelectric heating = %i", tmp->photoelectric_heating);
message("Photoelectric heating = %i", tmp->photoelectric_heating);
message("Photoelectric heating rate = %g", tmp->photoelectric_heating_rate);
message("Photoelectric heating rate = %g",
message("Use volumetric heating rate = %i", tmp->use_volumetric_heating_rate);
tmp->photoelectric_heating_rate);
message("Use specific heating rate = %i", tmp->use_specific_heating_rate);
message("Use volumetric heating rate = %i",
message("Three body = %i", tmp->three_body_rate);
tmp->use_volumetric_heating_rate);
message("Cie cooling = %i", tmp->cie_cooling);
message("Use specific heating rate = %i",
message("h2 optical depth approx = %i", tmp->h2_optical_depth_approximation);
tmp->use_specific_heating_rate);
message("ih2co = %i", tmp->ih2co);
message("Three body = %i", tmp->three_body_rate);
message("ipiht = %i", tmp->ipiht);
message("Cie cooling = %i", tmp->cie_cooling);
message("h2 optical depth approx = %i",
message("Hydrogen Fraction = %g", tmp->HydrogenFractionByMass);
tmp->h2_optical_depth_approximation);
message("Deuterium/Hydrogen ratio = %g", tmp->DeuteriumToHydrogenRatio);
message("ih2co = %i", tmp->ih2co);
message("Solar metal fraction = %g", tmp->SolarMetalFractionByMass);
message("ipiht = %i", tmp->ipiht);
message("Number T bins = %i", tmp->NumberOfTemperatureBins);
message("Hydrogen Fraction = %g", tmp->HydrogenFractionByMass);
message("Case B recombination = %i", tmp->CaseBRecombination);
message("Deuterium/Hydrogen ratio = %g",
tmp->DeuteriumToHydrogenRatio);
message("T start = %g", tmp->TemperatureStart);
message("Solar metal fraction = %g",
message("T end = %g", tmp->TemperatureEnd);
tmp->SolarMetalFractionByMass);
message("Number dust T bins = %i", tmp->NumberOfDustTemperatureBins);
message("Number T bins = %i",
message("Dust T start = %g", tmp->DustTemperatureStart);
tmp->NumberOfTemperatureBins);
message("Dust T end = %g", tmp->DustTemperatureEnd);
message("Case B recombination = %i", tmp->CaseBRecombination);
message("Compton xray heating = %i", tmp->Compton_xray_heating);
message("T start = %g", tmp->TemperatureStart);
message("LW background sawtooth suppression = %i", tmp->LWbackground_sawtooth_suppression);
message("T end = %g", tmp->TemperatureEnd);
message("LW background intensity = %g", tmp->LWbackground_intensity);
message("UV redshift on = %g", tmp->UVbackground_redshift_on);
message("Number dust T bins = %i",
message("UV redshift off = %g", tmp->UVbackground_redshift_off);
tmp->NumberOfDustTemperatureBins);
message("UV redshift fullon = %g", tmp->UVbackground_redshift_fullon);
message("Dust T start = %g", tmp->DustTemperatureStart);
message("UV redshift drop = %g", tmp->UVbackground_redshift_drop);
message("Dust T end = %g", tmp->DustTemperatureEnd);
message("Cloudy electron fraction = %g", tmp->cloudy_electron_fraction_factor);
message("Compton xray heating = %i", tmp->Compton_xray_heating);
message("LW background sawtooth suppression = %i",
message("Use radiative transfer = %i", tmp->use_radiative_transfer);
tmp->LWbackground_sawtooth_suppression);
message("RT coupled rate solver = %i", tmp->radiative_transfer_coupled_rate_solver);
message("LW background intensity = %g", tmp->LWbackground_intensity);
message("RT intermediate step = %i", tmp->radiative_transfer_intermediate_step);
message("UV redshift on = %g",
message("RT H only = %i", tmp->radiative_transfer_hydrogen_only);
tmp->UVbackground_redshift_on);
message("UV redshift off = %g",
message("Self shielding method = %i", tmp->self_shielding_method);
tmp->UVbackground_redshift_off);
*/
message("UV redshift fullon = %g",
tmp->UVbackground_redshift_fullon);
message("UV redshift drop = %g",
tmp->UVbackground_redshift_drop);
message("Cloudy electron fraction = %g",
tmp->cloudy_electron_fraction_factor);
message("Use radiative transfer = %i", tmp->use_radiative_transfer);
message("RT coupled rate solver = %i",
tmp->radiative_transfer_coupled_rate_solver);
message("RT intermediate step = %i",
tmp->radiative_transfer_intermediate_step);
message("RT H only = %i",
tmp->radiative_transfer_hydrogen_only);
message("Self shielding method = %i", tmp->self_shielding_method);
*/
#endif
#endif
}
}
...
@@ -272,7 +290,8 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend(
...
@@ -272,7 +290,8 @@ __attribute__((always_inline)) INLINE static void cooling_print_backend(
*
*
* @param data the #grackle_field_data
* @param data the #grackle_field_data
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_malloc_data
(
grackle_field_data
*
data
)
{
__attribute__
((
always_inline
))
INLINE
static
void
cooling_malloc_data
(
grackle_field_data
*
data
)
{
#if COOLING_GRACKLE_MODE >= 1
#if COOLING_GRACKLE_MODE >= 1
/* primordial chemistry >= 1 */
/* primordial chemistry >= 1 */
...
@@ -282,21 +301,21 @@ __attribute__((always_inline)) INLINE static void cooling_malloc_data(grackle_fi
...
@@ -282,21 +301,21 @@ __attribute__((always_inline)) INLINE static void cooling_malloc_data(grackle_fi
data
->
HeII_density
=
malloc
(
sizeof
(
gr_float
));
data
->
HeII_density
=
malloc
(
sizeof
(
gr_float
));
data
->
HeIII_density
=
malloc
(
sizeof
(
gr_float
));
data
->
HeIII_density
=
malloc
(
sizeof
(
gr_float
));
data
->
e_density
=
malloc
(
sizeof
(
gr_float
));
data
->
e_density
=
malloc
(
sizeof
(
gr_float
));
#endif // MODE >= 1
#endif
// MODE >= 1
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
/* primordial chemistry >= 2 */
/* primordial chemistry >= 2 */
data
->
HM_density
=
malloc
(
sizeof
(
gr_float
));
data
->
HM_density
=
malloc
(
sizeof
(
gr_float
));
data
->
H2I_density
=
malloc
(
sizeof
(
gr_float
));
data
->
H2I_density
=
malloc
(
sizeof
(
gr_float
));
data
->
H2II_density
=
malloc
(
sizeof
(
gr_float
));
data
->
H2II_density
=
malloc
(
sizeof
(
gr_float
));
#endif // MODE 2
#endif
// MODE 2
#if COOLING_GRACKLE_MODE >= 3
#if COOLING_GRACKLE_MODE >= 3
/* primordial chemistry >= 3 */
/* primordial chemistry >= 3 */
data
->
DI_density
=
malloc
(
sizeof
(
gr_float
));
data
->
DI_density
=
malloc
(
sizeof
(
gr_float
));
data
->
DII_density
=
malloc
(
sizeof
(
gr_float
));
data
->
DII_density
=
malloc
(
sizeof
(
gr_float
));
data
->
HDI_density
=
malloc
(
sizeof
(
gr_float
));
data
->
HDI_density
=
malloc
(
sizeof
(
gr_float
));
#endif // MODE >= 3
#endif
// MODE >= 3
/* metal cooling = 1 */
/* metal cooling = 1 */
data
->
metal_density
=
malloc
(
sizeof
(
gr_float
));
data
->
metal_density
=
malloc
(
sizeof
(
gr_float
));
...
@@ -306,7 +325,6 @@ __attribute__((always_inline)) INLINE static void cooling_malloc_data(grackle_fi
...
@@ -306,7 +325,6 @@ __attribute__((always_inline)) INLINE static void cooling_malloc_data(grackle_fi
/* /\* specific heating rate *\/ */
/* /\* specific heating rate *\/ */
/* data->specific_heating_rate = NULL; */
/* data->specific_heating_rate = NULL; */
}
}
/**
/**
...
@@ -315,7 +333,8 @@ __attribute__((always_inline)) INLINE static void cooling_malloc_data(grackle_fi
...
@@ -315,7 +333,8 @@ __attribute__((always_inline)) INLINE static void cooling_malloc_data(grackle_fi
* @param data the #grackle_field_data
* @param data the #grackle_field_data
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_free_data
(
grackle_field_data
*
data
)
{
__attribute__
((
always_inline
))
INLINE
static
void
cooling_free_data
(
grackle_field_data
*
data
)
{
#if COOLING_GRACKLE_MODE >= 1
#if COOLING_GRACKLE_MODE >= 1
/* primordial chemistry >= 1 */
/* primordial chemistry >= 1 */
...
@@ -325,21 +344,21 @@ __attribute__((always_inline)) INLINE static void cooling_free_data(grackle_fiel
...
@@ -325,21 +344,21 @@ __attribute__((always_inline)) INLINE static void cooling_free_data(grackle_fiel
free
(
data
->
HeII_density
);
free
(
data
->
HeII_density
);
free
(
data
->
HeIII_density
);
free
(
data
->
HeIII_density
);
free
(
data
->
e_density
);
free
(
data
->
e_density
);
#endif // MODE >= 1
#endif
// MODE >= 1
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
/* primordial chemistry >= 2 */
/* primordial chemistry >= 2 */
free
(
data
->
HM_density
);
free
(
data
->
HM_density
);
free
(
data
->
H2I_density
);
free
(
data
->
H2I_density
);
free
(
data
->
H2II_density
);
free
(
data
->
H2II_density
);
#endif // MODE 2
#endif
// MODE 2
#if COOLING_GRACKLE_MODE >= 3
#if COOLING_GRACKLE_MODE >= 3
/* primordial chemistry >= 3 */
/* primordial chemistry >= 3 */
free
(
data
->
DI_density
);
free
(
data
->
DI_density
);
free
(
data
->
DII_density
);
free
(
data
->
DII_density
);
free
(
data
->
HDI_density
);
free
(
data
->
HDI_density
);
#endif // MODE >= 3
#endif
// MODE >= 3
/* metal cooling = 1 */
/* metal cooling = 1 */
free
(
data
->
metal_density
);
free
(
data
->
metal_density
);
...
@@ -349,7 +368,6 @@ __attribute__((always_inline)) INLINE static void cooling_free_data(grackle_fiel
...
@@ -349,7 +368,6 @@ __attribute__((always_inline)) INLINE static void cooling_free_data(grackle_fiel
/* /\* specific heating rate *\/ */
/* /\* specific heating rate *\/ */
/* data->specific_heating_rate = NULL; */
/* data->specific_heating_rate = NULL; */
}
}
/**
/**
...
@@ -360,7 +378,8 @@ __attribute__((always_inline)) INLINE static void cooling_free_data(grackle_fiel
...
@@ -360,7 +378,8 @@ __attribute__((always_inline)) INLINE static void cooling_free_data(grackle_fiel
* @param data the #grackle_field_data
* @param data the #grackle_field_data
* @param xp the #xpart
* @param xp the #xpart
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_copy_to_data
(
grackle_field_data
*
data
,
const
struct
xpart
*
xp
)
{
__attribute__
((
always_inline
))
INLINE
static
void
cooling_copy_to_data
(
grackle_field_data
*
data
,
const
struct
xpart
*
xp
)
{
#if COOLING_GRACKLE_MODE >= 1
#if COOLING_GRACKLE_MODE >= 1
/* primordial chemistry >= 1 */
/* primordial chemistry >= 1 */
...
@@ -370,21 +389,21 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_data(grackle_f
...
@@ -370,21 +389,21 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_data(grackle_f
data
->
HeII_density
[
0
]
=
xp
->
cooling_data
.
HeII_frac
;
data
->
HeII_density
[
0
]
=
xp
->
cooling_data
.
HeII_frac
;
data
->
HeIII_density
[
0
]
=
xp
->
cooling_data
.
HeIII_frac
;
data
->
HeIII_density
[
0
]
=
xp
->
cooling_data
.
HeIII_frac
;
data
->
e_density
[
0
]
=
xp
->
cooling_data
.
e_frac
;
data
->
e_density
[
0
]
=
xp
->
cooling_data
.
e_frac
;
#endif // MODE >= 1
#endif
// MODE >= 1
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
/* primordial chemistry >= 2 */
/* primordial chemistry >= 2 */
data
->
HM_density
[
0
]
=
xp
->
cooling_data
.
HM_frac
;
data
->
HM_density
[
0
]
=
xp
->
cooling_data
.
HM_frac
;
data
->
H2I_density
[
0
]
=
xp
->
cooling_data
.
H2I_frac
;
data
->
H2I_density
[
0
]
=
xp
->
cooling_data
.
H2I_frac
;
data
->
H2II_density
[
0
]
=
xp
->
cooling_data
.
H2II_frac
;
data
->
H2II_density
[
0
]
=
xp
->
cooling_data
.
H2II_frac
;
#endif // MODE 2
#endif
// MODE 2
#if COOLING_GRACKLE_MODE >= 3
#if COOLING_GRACKLE_MODE >= 3
/* primordial chemistry >= 3 */
/* primordial chemistry >= 3 */
data
->
DI_density
[
0
]
=
xp
->
cooling_data
.
DI_frac
;
data
->
DI_density
[
0
]
=
xp
->
cooling_data
.
DI_frac
;
data
->
DII_density
[
0
]
=
xp
->
cooling_data
.
DII_frac
;
data
->
DII_density
[
0
]
=
xp
->
cooling_data
.
DII_frac
;
data
->
HDI_density
[
0
]
=
xp
->
cooling_data
.
HDI_frac
;
data
->
HDI_density
[
0
]
=
xp
->
cooling_data
.
HDI_frac
;
#endif // MODE >= 3
#endif
// MODE >= 3
/* metal cooling = 1 */
/* metal cooling = 1 */
data
->
metal_density
[
0
]
=
xp
->
cooling_data
.
metal_frac
;
data
->
metal_density
[
0
]
=
xp
->
cooling_data
.
metal_frac
;
...
@@ -396,14 +415,14 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_data(grackle_f
...
@@ -396,14 +415,14 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_data(grackle_f
data
->
specific_heating_rate
=
NULL
;
data
->
specific_heating_rate
=
NULL
;
}
}
/**
/**
* @brief copy data to xp
* @brief copy data to xp
*
*
* @param data the #grackle_field_data
* @param data the #grackle_field_data
* @param xp the #xpart
* @param xp the #xpart
*/
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_copy_to_particle
(
const
grackle_field_data
*
data
,
struct
xpart
*
xp
)
{
__attribute__
((
always_inline
))
INLINE
static
void
cooling_copy_to_particle
(
const
grackle_field_data
*
data
,
struct
xpart
*
xp
)
{
#if COOLING_GRACKLE_MODE >= 1
#if COOLING_GRACKLE_MODE >= 1
/* primordial chemistry >= 1 */
/* primordial chemistry >= 1 */
...
@@ -413,21 +432,21 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_particle(const
...
@@ -413,21 +432,21 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_particle(const
xp
->
cooling_data
.
HeII_frac
=
data
->
HeII_density
[
0
];
xp
->
cooling_data
.
HeII_frac
=
data
->
HeII_density
[
0
];
xp
->
cooling_data
.
HeIII_frac
=
data
->
HeIII_density
[
0
];
xp
->
cooling_data
.
HeIII_frac
=
data
->
HeIII_density
[
0
];
xp
->
cooling_data
.
e_frac
=
data
->
e_density
[
0
];
xp
->
cooling_data
.
e_frac
=
data
->
e_density
[
0
];
#endif // MODE >= 1
#endif
// MODE >= 1
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
/* primordial chemistry >= 2 */
/* primordial chemistry >= 2 */
xp
->
cooling_data
.
HM_frac
=
data
->
HM_density
[
0
];
xp
->
cooling_data
.
HM_frac
=
data
->
HM_density
[
0
];
xp
->
cooling_data
.
H2I_frac
=
data
->
H2I_density
[
0
];
xp
->
cooling_data
.
H2I_frac
=
data
->
H2I_density
[
0
];
xp
->
cooling_data
.
H2II_frac
=
data
->
H2II_density
[
0
];
xp
->
cooling_data
.
H2II_frac
=
data
->
H2II_density
[
0
];
#endif // MODE 2
#endif
// MODE 2
#if COOLING_GRACKLE_MODE >= 3
#if COOLING_GRACKLE_MODE >= 3
/* primordial chemistry >= 3 */
/* primordial chemistry >= 3 */
xp
->
cooling_data
.
DI_frac
=
data
->
DI_density
[
0
];
xp
->
cooling_data
.
DI_frac
=
data
->
DI_density
[
0
];
xp
->
cooling_data
.
DII_frac
=
data
->
DII_density
[
0
];
xp
->
cooling_data
.
DII_frac
=
data
->
DII_density
[
0
];
xp
->
cooling_data
.
HDI_frac
=
data
->
HDI_density
[
0
];
xp
->
cooling_data
.
HDI_frac
=
data
->
HDI_density
[
0
];
#endif // MODE >= 3
#endif
// MODE >= 3
/* metal cooling = 1 */
/* metal cooling = 1 */
xp
->
cooling_data
.
metal_frac
=
data
->
metal_density
[
0
];
xp
->
cooling_data
.
metal_frac
=
data
->
metal_density
[
0
];
...
@@ -437,10 +456,8 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_particle(const
...
@@ -437,10 +456,8 @@ __attribute__((always_inline)) INLINE static void cooling_copy_to_particle(const
/* /\* specific heating rate *\/ */
/* /\* specific heating rate *\/ */
/* data->specific_heating_rate = NULL; */
/* data->specific_heating_rate = NULL; */
}
}
/**
/**
* @brief Compute the cooling rate and update the particle chemistry data
* @brief Compute the cooling rate and update the particle chemistry data
*
*
...
@@ -458,8 +475,7 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
...
@@ -458,8 +475,7 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
const
struct
unit_system
*
restrict
us
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
cooling_function_data
*
restrict
cooling
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
double
dt
)
{
double
dt
)
{
/* set current time */
/* set current time */
code_units
units
=
cooling
->
units
;
code_units
units
=
cooling
->
units
;
...
@@ -625,7 +641,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
...
@@ -625,7 +641,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
cooling
->
units
.
velocity_units
=
cooling
->
units
.
a_units
*
cooling
->
units
.
velocity_units
=
cooling
->
units
.
a_units
*
cooling
->
units
.
length_units
/
cooling
->
units
.
length_units
/
cooling
->
units
.
time_units
;
cooling
->
units
.
time_units
;
chemistry_data
*
chemistry
=
&
cooling
->
chemistry
;
chemistry_data
*
chemistry
=
&
cooling
->
chemistry
;
/* Create a chemistry object for parameters and rate data. */
/* Create a chemistry object for parameters and rate data. */
...
@@ -636,7 +652,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
...
@@ -636,7 +652,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
// Set parameter values for chemistry.
// Set parameter values for chemistry.
chemistry
->
use_grackle
=
1
;
chemistry
->
use_grackle
=
1
;
chemistry
->
with_radiative_cooling
=
1
;
chemistry
->
with_radiative_cooling
=
1
;
/* molecular network with H, He, D
/* molecular network with H, He, D
From Cloudy table */
From Cloudy table */
chemistry
->
primordial_chemistry
=
COOLING_GRACKLE_MODE
;
chemistry
->
primordial_chemistry
=
COOLING_GRACKLE_MODE
;
...
@@ -647,7 +663,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
...
@@ -647,7 +663,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
chemistry
->
use_radiative_transfer
=
0
;
chemistry
->
use_radiative_transfer
=
0
;
chemistry
->
use_volumetric_heating_rate
=
0
;
chemistry
->
use_volumetric_heating_rate
=
0
;
chemistry
->
use_specific_heating_rate
=
0
;
chemistry
->
use_specific_heating_rate
=
0
;
/* Initialize the chemistry object. */
/* Initialize the chemistry object. */
if
(
initialize_chemistry_data
(
&
cooling
->
units
)
==
0
)
{
if
(
initialize_chemistry_data
(
&
cooling
->
units
)
==
0
)
{
error
(
"Error in initialize_chemistry_data."
);
error
(
"Error in initialize_chemistry_data."
);
...
...
This diff is collapsed.
Click to expand it.
src/cooling/grackle/cooling_struct.h
+
5
−
5
View file @
1ccdb8c6
...
@@ -58,7 +58,7 @@ struct cooling_xpart_data {
...
@@ -58,7 +58,7 @@ struct cooling_xpart_data {
/*! Energy radiated away by this particle since the start of the run */
/*! Energy radiated away by this particle since the start of the run */
float
radiated_energy
;
float
radiated_energy
;
/* here all fractions are mass fraction */
/* here all fractions are mass fraction */
#if COOLING_GRACKLE_MODE >= 1
#if COOLING_GRACKLE_MODE >= 1
/* primordial chemistry >= 1 */
/* primordial chemistry >= 1 */
float
HI_frac
;
float
HI_frac
;
...
@@ -79,12 +79,12 @@ struct cooling_xpart_data {
...
@@ -79,12 +79,12 @@ struct cooling_xpart_data {
float
DI_frac
;
float
DI_frac
;
float
DII_frac
;
float
DII_frac
;
float
HDI_frac
;
float
HDI_frac
;
#endif // MODE >= 3
#endif
// MODE >= 3
#endif // MODE >= 2
#endif // MODE >= 2
#endif // MODE >= 1
#endif // MODE >= 1
/* metal cooling = 1 */
/* metal cooling = 1 */
float
metal_frac
;
float
metal_frac
;
};
};
...
...
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