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
fa808c1c
Commit
fa808c1c
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
Fix new version of cooling and update configure.ac for grackle v3
parent
4d3dd839
No related branches found
No related tags found
1 merge request
!484
Rework of Grackle
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
configure.ac
+1
-1
1 addition, 1 deletion
configure.ac
src/cooling/grackle/cooling.h
+56
-55
56 additions, 55 deletions
src/cooling/grackle/cooling.h
with
57 additions
and
56 deletions
configure.ac
+
1
−
1
View file @
fa808c1c
...
...
@@ -451,7 +451,7 @@ if test "x$with_grackle" != "xno"; then
AC_CHECK_LIB(
[grackle],
[initialize_
grackle
],
[initialize_
chemistry_data
],
[AC_DEFINE([HAVE_GRACKLE],1,[The GRACKLE library appears to be present.]),
AC_DEFINE([CONFIG_BFLOAT_8],1,[Use doubles in grackle])
],
...
...
This diff is collapsed.
Click to expand it.
src/cooling/grackle/cooling.h
+
56
−
55
View file @
fa808c1c
...
...
@@ -66,6 +66,29 @@ __attribute__((always_inline)) INLINE static float cooling_get_radiated_energy(
}
/**
* @brief Prints the properties of the cooling model to stdout.
*
* @param cooling The properties of the cooling function.
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_print_backend
(
const
struct
cooling_function_data
*
cooling
)
{
message
(
"Cooling function is 'Grackle'."
);
message
(
"CloudyTable = %s"
,
cooling
->
cloudy_table
);
message
(
"UVbackground = %d"
,
cooling
->
uv_background
);
message
(
"Redshift = %g"
,
cooling
->
redshift
);
message
(
"Density Self Shielding = %g"
,
cooling
->
density_self_shielding
);
message
(
"Units:"
);
message
(
"
\t
Comoving = %i"
,
cooling
->
units
.
comoving_coordinates
);
message
(
"
\t
Length = %g"
,
cooling
->
units
.
length_units
);
message
(
"
\t
Density = %g"
,
cooling
->
units
.
density_units
);
message
(
"
\t
Time = %g"
,
cooling
->
units
.
time_units
);
message
(
"
\t
Scale Factor = %g"
,
cooling
->
units
.
a_units
);
}
/**
* @brief Compute the cooling rate
*
...
...
@@ -84,7 +107,7 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
struct
part
*
restrict
p
,
float
dt
)
{
/* set current time */
float
scale_factor
;
float
scale_factor
=
1
.
;
if
(
cooling
->
redshift
==
-
1
)
error
(
"TODO time dependant redshift"
);
else
...
...
@@ -117,7 +140,8 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
int
grid_end
[
3
]
=
{
0
,
0
,
0
};
/* solve chemistry with table */
if
(
solve_chemistry_table
(
&
cooling
->
units
,
scale_factor
,
dt
,
grid_rank
,
grid_dimension
,
code_units
units
=
cooling
->
units
;
if
(
solve_chemistry_table
(
&
units
,
scale_factor
,
dt
,
GRACKLE_NPART
,
grid_dimension
,
grid_start
,
grid_end
,
density
,
energy
,
x_velocity
,
y_velocity
,
z_velocity
,
metal_density
)
==
0
)
{
error
(
"Error in solve_chemistry."
);
...
...
@@ -182,7 +206,7 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @param phys_const The physical constants in internal units.
* @param cooling The cooling properties to initialize
*/
static
INLINE
void
cooling_init_backend
(
__attribute__
((
always_inline
))
INLINE
static
void
cooling_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
unit_system
*
us
,
const
struct
phys_const
*
phys_const
,
struct
cooling_function_data
*
cooling
)
{
...
...
@@ -212,7 +236,7 @@ static INLINE void cooling_init_backend(
/* We assume here all physical quantities to
be in proper coordinate (not comobile) */
cooling
->
comoving_coordinates
=
0
;
cooling
->
units
.
comoving_coordinates
=
0
;
/* then units */
cooling
->
units
.
density_units
=
us
->
UnitMass_in_cgs
/
pow
(
us
->
UnitLength_in_cgs
,
3
);
...
...
@@ -267,35 +291,44 @@ static INLINE void cooling_init_backend(
}
/**
* @brief
P
rint
s the properties of the cooling model to stdout.
* @brief
p
rint
data in cloudy struct
*
*
@param cooling The properties of the cooling function.
*
Should only be used for debugging
*/
static
INLINE
void
cooling_print_backend
(
const
struct
cooling_function_data
*
cooling
)
{
__attribute__
((
always_inline
))
INLINE
static
void
cloudy_print_data
(
const
cloudy_data
c
,
const
int
print_mmw
)
{
long
long
N
=
c
.
data_size
;
message
(
"
\t
Data size: %lli"
,
N
);
message
(
"
\t
Grid rank: %lli"
,
c
.
grid_rank
);
message
(
"Cooling function is 'Grackle'."
);
message
(
"CloudyTable = %s"
,
cooling
->
cloudy_table
);
message
(
"UVbackground = %d"
,
cooling
->
uv_background
);
message
(
"Redshift = %g"
,
cooling
->
redshift
);
message
(
"Density Self Shielding = %g"
,
cooling
->
density_self_shielding
);
message
(
"Units:"
);
message
(
"
\t
Comoving = %g"
,
cooling
->
units
.
comoving_coordinates
)
message
(
"
\t
Length = %g"
,
cooling
->
units
.
length_units
);
message
(
"
\t
Density = %g"
,
cooling
->
units
.
density_units
);
message
(
"
\t
Time = %g"
,
cooling
->
units
.
time_units
);
message
(
"
\t
Scale Factor = %g"
,
cooling
->
units
.
a_units
);
}
char
msg
[
200
]
=
"
\t
Dimension: ("
;
for
(
long
long
i
=
0
;
i
<
c
.
grid_rank
;
i
++
)
{
char
tmp
[
200
]
=
"%lli%s"
;
if
(
i
==
c
.
grid_rank
-
1
)
sprintf
(
tmp
,
tmp
,
c
.
grid_dimension
[
i
],
")"
);
else
sprintf
(
tmp
,
tmp
,
c
.
grid_dimension
[
i
],
", "
);
strcat
(
msg
,
tmp
);
}
message
(
"%s"
,
msg
);
if
(
c
.
heating_data
)
message
(
"
\t
Heating: (%g, ..., %g)"
,
c
.
heating_data
[
0
],
c
.
heating_data
[
N
-
1
]);
if
(
c
.
cooling_data
)
message
(
"
\t
Cooling: (%g, ..., %g)"
,
c
.
cooling_data
[
0
],
c
.
cooling_data
[
N
-
1
]);
if
(
c
.
mmw_data
&&
print_mmw
)
message
(
"
\t
Mean molecular weigth: (%g, ..., %g)"
,
c
.
mmw_data
[
0
],
c
.
mmw_data
[
N
-
1
]);
}
/**
* @brief print data in grackle struct
*
* Should only be used for debugging
*/
void
grackle_print_data
()
{
__attribute__
((
always_inline
))
INLINE
static
void
grackle_print_data
()
{
message
(
"Grackle Data:"
);
message
(
"
\t
Data file: %s"
,
grackle_data
.
grackle_data_file
);
message
(
"
\t
With grackle: %i"
,
grackle_data
.
use_grackle
);
...
...
@@ -328,37 +361,5 @@ void grackle_print_data() {
}
}
/**
* @brief print data in cloudy struct
*
* Should only be used for debugging
*/
void
cloudy_print_data
(
const
cloudy_data
c
,
const
int
print_mmw
)
{
long
long
N
=
c
.
data_size
;
message
(
"
\t
Data size: %lli"
,
N
);
message
(
"
\t
Grid rank: %lli"
,
c
.
grid_rank
);
char
msg
[
200
]
=
"
\t
Dimension: ("
;
for
(
long
long
i
=
0
;
i
<
c
.
grid_rank
;
i
++
)
{
char
tmp
[
200
]
=
"%lli%s"
;
if
(
i
==
c
.
grid_rank
-
1
)
sprintf
(
tmp
,
tmp
,
c
.
grid_dimension
[
i
],
")"
);
else
sprintf
(
tmp
,
tmp
,
c
.
grid_dimension
[
i
],
", "
);
strcat
(
msg
,
tmp
);
}
message
(
"%s"
,
msg
);
if
(
c
.
heating_data
)
message
(
"
\t
Heating: (%g, ..., %g)"
,
c
.
heating_data
[
0
],
c
.
heating_data
[
N
-
1
]);
if
(
c
.
cooling_data
)
message
(
"
\t
Cooling: (%g, ..., %g)"
,
c
.
cooling_data
[
0
],
c
.
cooling_data
[
N
-
1
]);
if
(
c
.
mmw_data
&&
print_mmw
)
message
(
"
\t
Mean molecular weigth: (%g, ..., %g)"
,
c
.
mmw_data
[
0
],
c
.
mmw_data
[
N
-
1
]);
}
#endif
/* SWIFT_COOLING_GRACKLE_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