Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SWIFT
SWIFTsim
Commits
114cd0ae
Commit
114cd0ae
authored
Dec 16, 2017
by
Matthieu Schaller
Browse files
Code formatting
parent
57c54841
Changes
5
Hide whitespace changes
Inline
Side-by-side
configure.ac
View file @
114cd0ae
...
...
@@ -78,7 +78,6 @@ if test "$enable_ipo" = "yes"; then
fi
fi
# Check for MPI. Need to do this before characterising the compiler (C99 mode),
# as this changes the compiler.
# We should consider using AX_PROG_CC_MPI to replace AC_PROG_CC when compiling
...
...
src/Makefile.am
View file @
114cd0ae
...
...
@@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Add the debug flag to the whole thing
AM_CFLAGS
=
$(HDF5_CPPFLAGS)
# Assign a "safe" version number
...
...
src/cooling/grackle/cooling.h
View file @
114cd0ae
...
...
@@ -39,7 +39,6 @@
/* include the grackle wrapper */
#include
"grackle_wrapper.h"
/**
* @brief Compute the cooling rate
*
...
...
@@ -59,8 +58,7 @@ __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
);
...
...
@@ -99,8 +97,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
const
struct
cooling_function_data
*
restrict
cooling
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
float
dt
)
{
if
(
dt
==
0
.)
return
;
if
(
dt
==
0
.)
return
;
/* Current du_dt */
const
float
hydro_du_dt
=
hydro_get_internal_energy_dt
(
p
);
...
...
@@ -237,7 +234,7 @@ static INLINE void cooling_print_backend(
message
(
"UVbackground = %d"
,
cooling
->
UVbackground
);
message
(
"GrackleRedshift = %g"
,
cooling
->
GrackleRedshift
);
message
(
"GrackleHSShieldingDensityThreshold = %g atom/cm3"
,
cooling
->
GrackleHSShieldingDensityThreshold
);
cooling
->
GrackleHSShieldingDensityThreshold
);
}
#endif
/* SWIFT_COOLING_GRACKLE_H */
src/cooling/grackle/grackle_wrapper.c
View file @
114cd0ae
...
...
@@ -165,66 +165,63 @@ 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
(
"
\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
);
}
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
]);
}
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
)
{
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
);
}
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
]);
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
]);
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
]);
message
(
"
\t
Mean molecular weigth: (%g, ..., %g)"
,
c
.
mmw_data
[
0
],
c
.
mmw_data
[
N
-
1
]);
}
src/cooling/grackle/grackle_wrapper.h
View file @
114cd0ae
...
...
@@ -16,8 +16,8 @@
#include
"config.h"
#include
"error.h"
#include
<grackle.h>
#include
<chemistry_data.h>
#include
<grackle.h>
#include
<math.h>
#include
<stdio.h>
#include
<stdlib.h>
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment