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
881ad540
Commit
881ad540
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
Add printing functions for grackle
parent
fffcb442
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!469
Update cooling grackle
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cooling/grackle/cooling.h
+9
-2
9 additions, 2 deletions
src/cooling/grackle/cooling.h
src/cooling/grackle/grackle_wrapper.c
+64
-0
64 additions, 0 deletions
src/cooling/grackle/grackle_wrapper.c
src/cooling/grackle/grackle_wrapper.h
+5
-0
5 additions, 0 deletions
src/cooling/grackle/grackle_wrapper.h
with
78 additions
and
2 deletions
src/cooling/grackle/cooling.h
+
9
−
2
View file @
881ad540
...
...
@@ -59,7 +59,8 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
const
struct
cooling_function_data
*
restrict
cooling
,
struct
part
*
restrict
p
,
float
dt
)
{
if
(
cooling
->
GrackleRedshift
==
-
1
)
error
(
"TODO time dependant redshift"
);
if
(
cooling
->
GrackleRedshift
==
-
1
)
error
(
"TODO time dependant redshift"
);
/* Get current internal energy (dt=0) */
double
u_old
=
hydro_get_internal_energy
(
p
);
...
...
@@ -73,7 +74,6 @@ __attribute__((always_inline)) INLINE static double cooling_rate(
Grackle v2.1) */
double
Z
=
0
.
02041
;
if
(
wrap_do_cooling
(
rho
,
&
u_new
,
dt
,
Z
,
a_now
)
==
0
)
{
error
(
"Error in do_cooling.
\n
"
);
return
0
;
...
...
@@ -217,6 +217,7 @@ static INLINE void cooling_init_backend(
}
#ifdef SWIFT_DEBUG_CHECKS
grackle_print_data
();
message
(
""
);
message
(
"***************************************"
);
#endif
...
...
@@ -231,6 +232,12 @@ static INLINE void cooling_print_backend(
const
struct
cooling_function_data
*
cooling
)
{
message
(
"Cooling function is 'Grackle'."
);
message
(
"CloudyTable = %s"
,
cooling
->
GrackleCloudyTable
);
message
(
"UVbackground = %d"
,
cooling
->
UVbackground
);
message
(
"GrackleRedshift = %g"
,
cooling
->
GrackleRedshift
);
message
(
"GrackleHSShieldingDensityThreshold = %g atom/cm3"
,
cooling
->
GrackleHSShieldingDensityThreshold
);
}
#endif
/* SWIFT_COOLING_GRACKLE_H */
This diff is collapsed.
Click to expand it.
src/cooling/grackle/grackle_wrapper.c
+
64
−
0
View file @
881ad540
...
...
@@ -164,3 +164,67 @@ int wrap_do_cooling(double rho, double *u, double dt, double Z, double a_now) {
return
1
;
}
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
);
message
(
"
\t
With radiative cooling: %i"
,
grackle_data
.
with_radiative_cooling
);
message
(
"
\t
With UV background: %i"
,
grackle_data
.
UVbackground
);
message
(
"
\t
With primordial chemistry: %i"
,
grackle_data
.
primordial_chemistry
);
message
(
"
\t
Number temperature bins: %i"
,
grackle_data
.
NumberOfTemperatureBins
);
message
(
"
\t
T = (%g, ..., %g)"
,
grackle_data
.
TemperatureStart
,
grackle_data
.
TemperatureEnd
);
message
(
"Primordial Cloudy"
);
cloudy_print_data
(
grackle_data
.
cloudy_primordial
,
1
);
if
(
grackle_data
.
metal_cooling
)
{
message
(
"Metal Cooling"
);
cloudy_print_data
(
grackle_data
.
cloudy_metal
,
0
);
}
message
(
"
\t
Gamma: %g"
,
grackle_data
.
Gamma
);
/* UVB */
if
(
grackle_data
.
UVbackground
&&
grackle_data
.
primordial_chemistry
!=
0
)
{
struct
UVBtable
uvb
=
grackle_data
.
UVbackground_table
;
long
long
N
=
uvb
.
Nz
;
message
(
"
\t
UV Background"
);
message
(
"
\t\t
Redshift from %g to %g with %lli steps"
,
uvb
.
zmin
,
uvb
.
zmax
,
N
);
message
(
"
\t\t
z = (%g, ..., %g)"
,
uvb
.
z
[
0
],
uvb
.
z
[
N
-
1
]);
}
}
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
]);
}
This diff is collapsed.
Click to expand it.
src/cooling/grackle/grackle_wrapper.h
+
5
−
0
View file @
881ad540
...
...
@@ -17,6 +17,7 @@
#include
"error.h"
#include
<grackle.h>
#include
<chemistry_data.h>
#include
<math.h>
#include
<stdio.h>
#include
<stdlib.h>
...
...
@@ -40,4 +41,8 @@ int wrap_get_cooling_time(double rho, double u, double Z, double a_now,
int
wrap_do_cooling
(
double
density
,
double
*
energy
,
double
dtime
,
double
Z
,
double
a_now
);
void
grackle_print_data
();
void
cloudy_print_data
(
const
cloudy_data
c
,
const
int
print_mmw
);
#endif
/* SWIFT_COOLING_GRACKLE_WRAPPER_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