Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
SWIFTsim
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
72
Issues
72
List
Boards
Labels
Milestones
Merge Requests
14
Merge Requests
14
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
SWIFT
SWIFTsim
Commits
ac2365c9
Commit
ac2365c9
authored
Apr 22, 2018
by
Matthieu Schaller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Code formatting
parent
647eceac
Changes
22
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
254 additions
and
266 deletions
+254
-266
src/chemistry.c
src/chemistry.c
+4
-3
src/chemistry/EAGLE/chemistry.h
src/chemistry/EAGLE/chemistry.h
+6
-4
src/chemistry/gear/chemistry.h
src/chemistry/gear/chemistry.h
+6
-6
src/chemistry/gear/chemistry_io.h
src/chemistry/gear/chemistry_io.h
+10
-12
src/chemistry/none/chemistry.h
src/chemistry/none/chemistry.h
+6
-4
src/cooling/EAGLE/cooling.h
src/cooling/EAGLE/cooling.h
+0
-1
src/cooling/EAGLE/cooling_io.h
src/cooling/EAGLE/cooling_io.h
+2
-2
src/cooling/const_du/cooling.h
src/cooling/const_du/cooling.h
+1
-2
src/cooling/const_du/cooling_io.h
src/cooling/const_du/cooling_io.h
+2
-2
src/cooling/const_lambda/cooling.h
src/cooling/const_lambda/cooling.h
+0
-1
src/cooling/const_lambda/cooling_io.h
src/cooling/const_lambda/cooling_io.h
+2
-2
src/cooling/grackle/cooling.h
src/cooling/grackle/cooling.h
+127
-143
src/cooling/grackle/cooling_io.h
src/cooling/grackle/cooling_io.h
+44
-50
src/cooling/none/cooling.h
src/cooling/none/cooling.h
+2
-3
src/cooling/none/cooling_io.h
src/cooling/none/cooling_io.h
+2
-2
src/debug.c
src/debug.c
+3
-1
src/engine.c
src/engine.c
+14
-10
src/engine.h
src/engine.h
+12
-9
src/parallel_io.c
src/parallel_io.c
+3
-2
src/serial_io.c
src/serial_io.c
+3
-3
src/single_io.c
src/single_io.c
+3
-3
src/vector.h
src/vector.h
+2
-1
No files found.
src/chemistry.c
View file @
ac2365c9
...
@@ -46,7 +46,8 @@ void chemistry_init(const struct swift_params* parameter_file,
...
@@ -46,7 +46,8 @@ void chemistry_init(const struct swift_params* parameter_file,
*
*
* Calls chemistry_print_backend for the chosen chemistry model.
* Calls chemistry_print_backend for the chosen chemistry model.
*
*
* @brief The #chemistry_global_data containing information about the current model.
* @brief The #chemistry_global_data containing information about the current
* model.
*/
*/
void
chemistry_print
(
const
struct
chemistry_global_data
*
data
)
{
void
chemistry_print
(
const
struct
chemistry_global_data
*
data
)
{
chemistry_print_backend
(
data
);
chemistry_print_backend
(
data
);
...
@@ -60,8 +61,8 @@ void chemistry_print(const struct chemistry_global_data* data) {
...
@@ -60,8 +61,8 @@ void chemistry_print(const struct chemistry_global_data* data) {
*/
*/
void
chemistry_struct_dump
(
const
struct
chemistry_global_data
*
chemistry
,
void
chemistry_struct_dump
(
const
struct
chemistry_global_data
*
chemistry
,
FILE
*
stream
)
{
FILE
*
stream
)
{
restart_write_blocks
((
void
*
)
chemistry
,
sizeof
(
struct
chemistry_global_data
),
1
,
restart_write_blocks
((
void
*
)
chemistry
,
sizeof
(
struct
chemistry_global_data
),
stream
,
"chemistry"
,
"chemistry function"
);
1
,
stream
,
"chemistry"
,
"chemistry function"
);
}
}
/**
/**
...
...
src/chemistry/EAGLE/chemistry.h
View file @
ac2365c9
...
@@ -90,8 +90,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
...
@@ -90,8 +90,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
chemistry_global_data
*
data
,
const
struct
chemistry_global_data
*
data
,
struct
part
*
restrict
p
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
struct
xpart
*
restrict
xp
)
{
p
->
chemistry_data
.
metal_mass_fraction_total
=
p
->
chemistry_data
.
metal_mass_fraction_total
=
data
->
initial_metal_mass_fraction_total
;
data
->
initial_metal_mass_fraction_total
;
...
@@ -136,9 +136,11 @@ static INLINE void chemistry_init_backend(
...
@@ -136,9 +136,11 @@ static INLINE void chemistry_init_backend(
/**
/**
* @brief Prints the properties of the chemistry model to stdout.
* @brief Prints the properties of the chemistry model to stdout.
*
*
* @brief The #chemistry_global_data containing information about the current model.
* @brief The #chemistry_global_data containing information about the current
* model.
*/
*/
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_global_data
*
data
)
{
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_global_data
*
data
)
{
message
(
"Chemistry model is 'EAGLE' tracking %d elements."
,
message
(
"Chemistry model is 'EAGLE' tracking %d elements."
,
chemistry_element_count
);
chemistry_element_count
);
...
...
src/chemistry/gear/chemistry.h
View file @
ac2365c9
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "physical_constants.h"
#include "physical_constants.h"
#include "units.h"
#include "units.h"
/**
/**
* @brief Compute the metal mass fraction
* @brief Compute the metal mass fraction
*
*
...
@@ -46,9 +45,10 @@
...
@@ -46,9 +45,10 @@
* @param xp Pointer to the extended particle data.
* @param xp Pointer to the extended particle data.
* @param data The global chemistry information.
* @param data The global chemistry information.
*/
*/
__attribute__
((
always_inline
))
INLINE
static
float
chemistry_metal_mass_fraction
(
__attribute__
((
always_inline
))
INLINE
static
float
const
struct
part
*
restrict
p
,
const
struct
xpart
*
restrict
xp
)
{
chemistry_metal_mass_fraction
(
const
struct
part
*
restrict
p
,
return
p
->
chemistry_data
.
Z
;
const
struct
xpart
*
restrict
xp
)
{
return
p
->
chemistry_data
.
Z
;
}
}
/**
/**
...
@@ -136,8 +136,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
...
@@ -136,8 +136,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
chemistry_global_data
*
data
,
const
struct
chemistry_global_data
*
data
,
struct
part
*
restrict
p
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
struct
xpart
*
restrict
xp
)
{
p
->
chemistry_data
.
Z
=
data
->
initial_metallicity
;
p
->
chemistry_data
.
Z
=
data
->
initial_metallicity
;
chemistry_init_part
(
p
,
data
);
chemistry_init_part
(
p
,
data
);
...
...
src/chemistry/gear/chemistry_io.h
View file @
ac2365c9
...
@@ -43,9 +43,11 @@ chemistry_get_element_name(enum chemistry_element elem) {
...
@@ -43,9 +43,11 @@ chemistry_get_element_name(enum chemistry_element elem) {
/**
/**
* @brief Prints the properties of the chemistry model to stdout.
* @brief Prints the properties of the chemistry model to stdout.
*
*
* @brief The #chemistry_global_data containing information about the current model.
* @brief The #chemistry_global_data containing information about the current
* model.
*/
*/
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_global_data
*
data
)
{
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_global_data
*
data
)
{
message
(
"Chemistry function is 'Gear'."
);
message
(
"Chemistry function is 'Gear'."
);
}
}
...
@@ -65,9 +67,8 @@ __attribute__((always_inline)) INLINE static int chemistry_read_particles(
...
@@ -65,9 +67,8 @@ __attribute__((always_inline)) INLINE static int chemistry_read_particles(
list
[
0
]
=
io_make_input_field
(
list
[
0
]
=
io_make_input_field
(
"ElementAbundance"
,
FLOAT
,
chemistry_element_count
,
OPTIONAL
,
"ElementAbundance"
,
FLOAT
,
chemistry_element_count
,
OPTIONAL
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
metal_mass_fraction
);
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
metal_mass_fraction
);
list
[
1
]
=
list
[
1
]
=
io_make_input_field
(
"Z"
,
FLOAT
,
1
,
OPTIONAL
,
UNIT_CONV_NO_UNITS
,
io_make_input_field
(
"Z"
,
FLOAT
,
1
,
OPTIONAL
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
Z
);
parts
,
chemistry_data
.
Z
);
return
2
;
return
2
;
}
}
...
@@ -76,12 +77,10 @@ __attribute__((always_inline)) INLINE static void chemistry_read_parameters(
...
@@ -76,12 +77,10 @@ __attribute__((always_inline)) INLINE static void chemistry_read_parameters(
const
struct
swift_params
*
parameter_file
,
const
struct
unit_system
*
us
,
const
struct
swift_params
*
parameter_file
,
const
struct
unit_system
*
us
,
const
struct
phys_const
*
phys_const
,
struct
chemistry_global_data
*
data
)
{
const
struct
phys_const
*
phys_const
,
struct
chemistry_global_data
*
data
)
{
data
->
initial_metallicity
=
data
->
initial_metallicity
=
parser_get_opt_param_float
(
parser_get_opt_param_float
(
parameter_file
,
"GearChemistry:InitialMetallicity"
,
parameter_file
,
"GearChemistry:InitialMetallicity"
,
-
1
);
-
1
);
}
}
/**
/**
* @brief Specifies which particle fields to write to a dataset
* @brief Specifies which particle fields to write to a dataset
*
*
...
@@ -97,8 +96,8 @@ __attribute__((always_inline)) INLINE static int chemistry_write_particles(
...
@@ -97,8 +96,8 @@ __attribute__((always_inline)) INLINE static int chemistry_write_particles(
list
[
0
]
=
io_make_output_field
(
list
[
0
]
=
io_make_output_field
(
"SmoothedElementAbundance"
,
FLOAT
,
chemistry_element_count
,
"SmoothedElementAbundance"
,
FLOAT
,
chemistry_element_count
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
smoothed_metal_mass_fraction
);
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
smoothed_metal_mass_fraction
);
list
[
1
]
=
io_make_output_field
(
"Z"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
1
]
=
io_make_output_field
(
"Z"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
parts
,
parts
,
chemistry_data
.
Z
);
chemistry_data
.
Z
);
list
[
2
]
=
io_make_output_field
(
"ElementAbundance"
,
FLOAT
,
list
[
2
]
=
io_make_output_field
(
"ElementAbundance"
,
FLOAT
,
chemistry_element_count
,
UNIT_CONV_NO_UNITS
,
chemistry_element_count
,
UNIT_CONV_NO_UNITS
,
...
@@ -126,5 +125,4 @@ __attribute__((always_inline)) INLINE static void chemistry_write_flavour(
...
@@ -126,5 +125,4 @@ __attribute__((always_inline)) INLINE static void chemistry_write_flavour(
}
}
#endif
#endif
#endif
/* SWIFT_CHEMISTRY_IO_GEAR_H */
#endif
/* SWIFT_CHEMISTRY_IO_GEAR_H */
src/chemistry/none/chemistry.h
View file @
ac2365c9
...
@@ -66,9 +66,11 @@ static INLINE void chemistry_init_backend(
...
@@ -66,9 +66,11 @@ static INLINE void chemistry_init_backend(
/**
/**
* @brief Prints the properties of the chemistry model to stdout.
* @brief Prints the properties of the chemistry model to stdout.
*
*
* @brief The #chemistry_global_data containing information about the current model.
* @brief The #chemistry_global_data containing information about the current
* model.
*/
*/
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_global_data
*
data
)
{
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_global_data
*
data
)
{
message
(
"Chemistry function is 'No chemistry'."
);
message
(
"Chemistry function is 'No chemistry'."
);
}
}
...
@@ -98,8 +100,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
...
@@ -98,8 +100,8 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
chemistry_global_data
*
data
,
const
struct
chemistry_global_data
*
data
,
const
struct
part
*
restrict
p
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
struct
xpart
*
restrict
xp
)
{}
/**
/**
* @brief Sets the chemistry properties of the (x-)particles to a valid start
* @brief Sets the chemistry properties of the (x-)particles to a valid start
...
...
src/cooling/EAGLE/cooling.h
View file @
ac2365c9
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "physical_constants.h"
#include "physical_constants.h"
#include "units.h"
#include "units.h"
/**
/**
* @brief Apply the cooling function to a particle.
* @brief Apply the cooling function to a particle.
*
*
...
...
src/cooling/EAGLE/cooling_io.h
View file @
ac2365c9
...
@@ -45,8 +45,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
...
@@ -45,8 +45,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
*/
*/
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
cooling_function_data
*
cooling
)
{
return
0
;
return
0
;
}
}
#endif // SWIFT_COOLING_EAGLE_IO_H
#endif
// SWIFT_COOLING_EAGLE_IO_H
src/cooling/const_du/cooling.h
View file @
ac2365c9
...
@@ -45,7 +45,6 @@
...
@@ -45,7 +45,6 @@
#include "physical_constants.h"
#include "physical_constants.h"
#include "units.h"
#include "units.h"
/**
/**
* @brief Apply the cooling function to a particle.
* @brief Apply the cooling function to a particle.
*
*
...
@@ -80,7 +79,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
...
@@ -80,7 +79,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
float
cooling_du_dt
=
-
cooling
->
cooling_rate
;
float
cooling_du_dt
=
-
cooling
->
cooling_rate
;
/* Integrate cooling equation to enforce energy floor */
/* Integrate cooling equation to enforce energy floor */
if
(
u_old
+
hydro_du_dt
*
dt
<
u_floor
)
{
if
(
u_old
+
hydro_du_dt
*
dt
<
u_floor
)
{
cooling_du_dt
=
0
.
f
;
cooling_du_dt
=
0
.
f
;
}
else
if
(
u_old
+
(
hydro_du_dt
+
cooling_du_dt
)
*
dt
<
u_floor
)
{
}
else
if
(
u_old
+
(
hydro_du_dt
+
cooling_du_dt
)
*
dt
<
u_floor
)
{
cooling_du_dt
=
(
u_old
+
dt
*
hydro_du_dt
-
u_floor
)
/
dt
;
cooling_du_dt
=
(
u_old
+
dt
*
hydro_du_dt
-
u_floor
)
/
dt
;
...
...
src/cooling/const_du/cooling_io.h
View file @
ac2365c9
...
@@ -47,8 +47,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
...
@@ -47,8 +47,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
*/
*/
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
cooling_function_data
*
cooling
)
{
return
0
;
return
0
;
}
}
#endif // SWIFT_COOLING_CONST_DU_IO_H
#endif
// SWIFT_COOLING_CONST_DU_IO_H
src/cooling/const_lambda/cooling.h
View file @
ac2365c9
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "physical_constants.h"
#include "physical_constants.h"
#include "units.h"
#include "units.h"
/**
/**
* @brief Calculates du/dt in code units for a particle.
* @brief Calculates du/dt in code units for a particle.
*
*
...
...
src/cooling/const_lambda/cooling_io.h
View file @
ac2365c9
...
@@ -49,8 +49,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
...
@@ -49,8 +49,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
*/
*/
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
cooling_function_data
*
cooling
)
{
return
0
;
return
0
;
}
}
#endif // SWIFT_COOLING_CONST_LAMBDA_IO_H
#endif
// SWIFT_COOLING_CONST_LAMBDA_IO_H
src/cooling/grackle/cooling.h
View file @
ac2365c9
This diff is collapsed.
Click to expand it.
src/cooling/grackle/cooling_io.h
View file @
ac2365c9
...
@@ -57,74 +57,70 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
...
@@ -57,74 +57,70 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
*/
*/
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
cooling_function_data
*
cooling
)
{
int
num
=
0
;
int
num
=
0
;
if
(
cooling
->
output_mode
==
0
)
if
(
cooling
->
output_mode
==
0
)
return
num
;
return
num
;
#if COOLING_GRACKLE_MODE >= 1
#if COOLING_GRACKLE_MODE >= 1
/* List what we want to write */
/* List what we want to write */
list
[
0
]
=
io_make_output_field
(
"HI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
0
]
=
io_make_output_field
(
"HI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
HI_frac
);
cooling_data
.
HI_frac
);
list
[
1
]
=
io_make_output_field
(
"HII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
1
]
=
io_make_output_field
(
"HII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
HII_frac
);
cooling_data
.
HII_frac
);
list
[
2
]
=
io_make_output_field
(
"HeI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
HeI_frac
);
list
[
3
]
=
io_make_output_field
(
"HeII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
2
]
=
io_make_output_field
(
"HeI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
HeI
I_frac
);
cooling_data
.
He
I_frac
);
list
[
4
]
=
io_make_output_field
(
"HeIII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
3
]
=
io_make_output_field
(
"HeII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
HeI
II_frac
);
cooling_data
.
He
II_frac
);
list
[
5
]
=
io_make_output_field
(
"e"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
4
]
=
io_make_output_field
(
"HeIII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
e_frac
);
cooling_data
.
HeIII_frac
);
list
[
5
]
=
io_make_output_field
(
"e"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
e_frac
);
num
+=
6
;
num
+=
6
;
#endif
#endif
if
(
cooling
->
output_mode
==
1
)
if
(
cooling
->
output_mode
==
1
)
return
num
;
return
num
;
#if COOLING_GRACKLE_MODE >= 2
#if COOLING_GRACKLE_MODE >= 2
list
+=
num
;
list
+=
num
;
list
[
0
]
=
io_make_output_field
(
"HM"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
0
]
=
io_make_output_field
(
"HM"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
HM_frac
);
cooling_data
.
HM_frac
);
list
[
1
]
=
io_make_output_field
(
"H2I"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
1
]
=
io_make_output_field
(
"H2I"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
H2I_frac
);
cooling_data
.
H2I_frac
);
list
[
2
]
=
io_make_output_field
(
"H2II"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
2
]
=
io_make_output_field
(
"H2II"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
H2II_frac
);
cooling_data
.
H2II_frac
);
num
+=
3
;
num
+=
3
;
#endif
#endif
if
(
cooling
->
output_mode
==
2
)
if
(
cooling
->
output_mode
==
2
)
return
num
;
return
num
;
#if COOLING_GRACKLE_MODE >= 3
#if COOLING_GRACKLE_MODE >= 3
list
+=
num
;
list
+=
num
;
list
[
0
]
=
io_make_output_field
(
"DI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
0
]
=
io_make_output_field
(
"DI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
DI_frac
);
cooling_data
.
DI_frac
);
list
[
1
]
=
io_make_output_field
(
"DII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
1
]
=
io_make_output_field
(
"DII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
DII_frac
);
cooling_data
.
DII_frac
);
list
[
2
]
=
io_make_output_field
(
"HDI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
list
[
2
]
=
io_make_output_field
(
"HDI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
xparts
,
cooling_data
.
HDI_frac
);
cooling_data
.
HDI_frac
);
num
+=
3
;
num
+=
3
;
#endif
#endif
return
num
;
return
num
;
}
}
/**
/**
...
@@ -146,27 +142,25 @@ __attribute__((always_inline)) INLINE static void cooling_read_parameters(
...
@@ -146,27 +142,25 @@ __attribute__((always_inline)) INLINE static void cooling_read_parameters(
parser_get_param_double
(
parameter_file
,
"GrackleCooling:Redshift"
);
parser_get_param_double
(
parameter_file
,
"GrackleCooling:Redshift"
);
cooling
->
with_metal_cooling
=
cooling
->
with_metal_cooling
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:WithMetalCooling"
);
parser_get_param_int
(
parameter_file
,
"GrackleCooling:WithMetalCooling"
);
cooling
->
provide_volumetric_heating_rates
=
cooling
->
provide_volumetric_heating_rates
=
parser_get_opt_param_int
(
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:ProvideVolumetricHeatingRates"
,
0
);
parameter_file
,
"GrackleCooling:ProvideVolumetricHeatingRates"
,
0
);
cooling
->
provide_specific_heating_rates
=
cooling
->
provide_specific_heating_rates
=
parser_get_opt_param_int
(
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:ProvideSpecificHeatingRates"
,
0
);
parameter_file
,
"GrackleCooling:ProvideSpecificHeatingRates"
,
0
);
cooling
->
self_shielding_method
=
cooling
->
self_shielding_method
=
parser_get_opt_param_int
(
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:SelfShieldingMethod"
,
0
);
parameter_file
,
"GrackleCooling:SelfShieldingMethod"
,
0
);
cooling
->
output_mode
=
cooling
->
output_mode
=
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:OutputMode"
,
0
);
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:OutputMode"
,
0
);
cooling
->
max_step
=
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:MaxSteps"
,
10000
);
cooling
->
convergence_limit
=
cooling
->
max_step
=
parser_get_opt_param_int
(
parser_get_opt_param_double
(
parameter_file
,
"GrackleCooling:ConvergenceLimit"
,
1e-2
);
parameter_file
,
"GrackleCooling:MaxSteps"
,
10000
);
cooling
->
convergence_limit
=
parser_get_opt_param_double
(
parameter_file
,
"GrackleCooling:ConvergenceLimit"
,
1e-2
);
}
}
#endif // SWIFT_COOLING_GRACKLE_IO_H
#endif // SWIFT_COOLING_GRACKLE_IO_H
src/cooling/none/cooling.h
View file @
ac2365c9
...
@@ -38,7 +38,6 @@
...
@@ -38,7 +38,6 @@
#include "physical_constants.h"
#include "physical_constants.h"
#include "units.h"
#include "units.h"
/**
/**
* @brief Apply the cooling function to a particle.
* @brief Apply the cooling function to a particle.
*
*
...
@@ -93,8 +92,8 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part(
...
@@ -93,8 +92,8 @@ __attribute__((always_inline)) INLINE static void cooling_first_init_part(
const
struct
phys_const
*
restrict
phys_const
,
const
struct
phys_const
*
restrict
phys_const
,
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
*
data
,
const
struct
cooling_function_data
*
data
,
const
struct
part
*
restrict
p
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
struct
xpart
*
restrict
xp
)
{}
/**
/**
* @brief Returns the total radiated energy by this particle.
* @brief Returns the total radiated energy by this particle.
...
...
src/cooling/none/cooling_io.h
View file @
ac2365c9
...
@@ -45,8 +45,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
...
@@ -45,8 +45,8 @@ __attribute__((always_inline)) INLINE static void cooling_write_flavour(
*/
*/
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
cooling_function_data
*
cooling
)
{
return
0
;
return
0
;
}
}
#endif // SWIFT_COOLING_NONE_IO_H
#endif
// SWIFT_COOLING_NONE_IO_H
src/debug.c
View file @
ac2365c9
...
@@ -326,7 +326,9 @@ static void dumpCells_map(struct cell *c, void *data) {
...
@@ -326,7 +326,9 @@ static void dumpCells_map(struct cell *c, void *data) {
/* So output local super cells that are active and have MPI
/* So output local super cells that are active and have MPI
* tasks as requested. */
* tasks as requested. */
if
(
c
->
nodeID
==
e
->
nodeID
&&
(
!
super
||
((
super
&&
c
->
super
==
c
)
||
(
c
->
parent
==
NULL
)))
&&
active
&&
mpiactive
)
{
if
(
c
->
nodeID
==
e
->
nodeID
&&
(
!
super
||
((
super
&&
c
->
super
==
c
)
||
(
c
->
parent
==
NULL
)))
&&
active
&&
mpiactive
)
{
/* If requested we work out how many particles are active in this cell. */
/* If requested we work out how many particles are active in this cell. */
int
pactcount
=
0
;
int
pactcount
=
0
;
...
...
src/engine.c
View file @
ac2365c9
...
@@ -5202,15 +5202,18 @@ void engine_unpin() {
...
@@ -5202,15 +5202,18 @@ void engine_unpin() {
* @param chemistry The chemistry information.
* @param chemistry The chemistry information.
* @param sourceterms The properties of the source terms function.
* @param sourceterms The properties of the source terms function.
*/
*/
void
engine_init
(
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
struct
engine
*
e
,
struct
space
*
s
,
const
struct
swift_params
*
params
,
const
struct
swift_params
*
params
,
long
long
Ngas
,
long
long
Ngas
,
long
long
Ndm
,
int
policy
,
int
verbose
,
long
long
Ndm
,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
const
struct
unit_system
*
internal_units
,
struct
repartition
*
reparttype
,
const
struct
phys_const
*
physical_constants
,
struct
cosmology
*
cosmo
,
const
struct
unit_system
*
internal_units
,
const
struct
hydro_props
*
hydro
,
struct
gravity_props
*
gravity
,
const
struct
phys_const
*
physical_constants
,
const
struct
external_potential
*
potential
,
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro
,
const
struct
cooling_function_data
*
cooling_func
,
struct
gravity_props
*
gravity
,
const
struct
chemistry_global_data
*
chemistry
,
struct
sourceterms
*
sourceterms
)
{
const
struct
external_potential
*
potential
,
const
struct
cooling_function_data
*
cooling_func
,
const
struct
chemistry_global_data
*
chemistry
,
struct
sourceterms
*
sourceterms
)
{
/* Clean-up everything */
/* Clean-up everything */
bzero
(
e
,
sizeof
(
struct
engine
));
bzero
(
e
,
sizeof
(
struct
engine
));
...
@@ -5974,7 +5977,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
...
@@ -5974,7 +5977,8 @@ void engine_struct_restore(struct engine *e, FILE *stream) {
e
->
cooling_func
=
cooling_func
;
e
->
cooling_func
=
cooling_func
;
struct
chemistry_global_data
*
chemistry
=
struct
chemistry_global_data
*
chemistry
=
(
struct
chemistry_global_data
*
)
malloc
(
sizeof
(
struct
chemistry_global_data
));
(
struct
chemistry_global_data
*
)
malloc
(
sizeof
(
struct
chemistry_global_data
));
chemistry_struct_restore
(
chemistry
,
stream
);
chemistry_struct_restore
(
chemistry
,
stream
);
e
->
chemistry
=
chemistry
;
e
->
chemistry
=
chemistry
;
...
...
src/engine.h
View file @
ac2365c9
...
@@ -330,15 +330,18 @@ void engine_drift_top_multipoles(struct engine *e);
...
@@ -330,15 +330,18 @@ void engine_drift_top_multipoles(struct engine *e);
void
engine_reconstruct_multipoles
(
struct
engine
*
e
);
void
engine_reconstruct_multipoles
(
struct
engine
*
e
);
void
engine_print_stats
(
struct
engine
*
e
);
void
engine_print_stats
(
struct
engine
*
e
);
void
engine_dump_snapshot
(
struct
engine
*
e
);
void
engine_dump_snapshot
(
struct
engine
*
e
);
void
engine_init
(
void
engine_init
(
struct
engine
*
e
,
struct
space
*
s
,
struct
engine
*
e
,
struct
space
*
s
,
const
struct
swift_params
*
params
,
const
struct
swift_params
*
params
,
long
long
Ngas
,
long
long
Ngas
,
long
long
Ndm
,
int
policy
,
int
verbose
,
long
long
Ndm
,
int
policy
,
int
verbose
,
struct
repartition
*
reparttype
,
const
struct
unit_system
*
internal_units
,
struct
repartition
*
reparttype
,
const
struct
phys_const
*
physical_constants
,
struct
cosmology
*
cosmo
,
const
struct
unit_system
*
internal_units
,
const
struct
hydro_props
*
hydro
,
struct
gravity_props
*
gravity
,
const
struct
phys_const
*
physical_constants
,
const
struct
external_potential
*
potential
,
struct
cosmology
*
cosmo
,
const
struct
hydro_props
*
hydro
,
const
struct
cooling_function_data
*
cooling_func
,
struct
gravity_props
*
gravity
,
const
struct
chemistry_global_data
*
chemistry
,
struct
sourceterms
*
sourceterms
);
const
struct
external_potential
*
potential
,
const
struct
cooling_function_data
*
cooling_func
,
const
struct
chemistry_global_data
*
chemistry
,
struct
sourceterms
*
sourceterms
);
void
engine_config
(
int
restart
,
struct
engine
*
e
,
void
engine_config
(
int
restart
,
struct
engine
*
e
,
const
struct
swift_params
*
params
,
int
nr_nodes
,
int
nodeID
,
const
struct
swift_params
*
params
,
int
nr_nodes
,
int
nodeID
,
int
nr_threads
,
int
with_aff
,
int
verbose
,
int
nr_threads
,
int
with_aff
,
int
verbose
,
...
...
src/parallel_io.c
View file @
ac2365c9
...
@@ -860,7 +860,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
...
@@ -860,7 +860,7 @@ void prepare_file(struct engine* e, const char* baseName, long long N_total[6],
int
periodic
=
e
->
s
->
periodic
;
int
periodic
=
e
->
s
->
periodic
;
int
numFiles
=
1
;
int
numFiles
=
1
;
const
struct
cooling_function_data
*
cooling
=
e
->
cooling_func
;
const
struct
cooling_function_data
*
cooling
=
e
->
cooling_func
;
/* First time, we need to create the XMF file */
/* First time, we need to create the XMF file */
if
(
e
->
snapshotOutputCount
==
0
)
xmf_create_file
(
baseName
);
if
(
e
->
snapshotOutputCount
==
0
)
xmf_create_file
(
baseName
);
...
@@ -1245,7 +1245,8 @@ void write_output_parallel(struct engine* e, const char* baseName,
...
@@ -1245,7 +1245,8 @@ void write_output_parallel(struct engine* e, const char* baseName,
Nparticles
=
Ngas
;
Nparticles
=
Ngas
;
hydro_write_particles
(
parts
,
xparts
,
list
,
&
num_fields
);
hydro_write_particles
(
parts
,
xparts
,
list
,
&
num_fields
);
num_fields
+=
chemistry_write_particles
(
parts
,
list
+
num_fields
);
num_fields
+=
chemistry_write_particles
(
parts
,
list
+
num_fields
);
num_fields
+=
cooling_write_particles
(
xparts
,
list
+
num_fields
,
cooling
);
num_fields
+=
cooling_write_particles
(
xparts
,
list
+
num_fields
,
cooling
);
break
;
break
;
case
swift_type_dark_matter
:
case
swift_type_dark_matter
:
...
...
src/serial_io.c
View file @
ac2365c9
...
@@ -744,7 +744,7 @@ void write_output_serial(struct engine* e, const char* baseName,
...
@@ -744,7 +744,7 @@ void write_output_serial(struct engine* e, const char* baseName,
const
struct
gpart
*
gparts
=
e
->
s
->
gparts
;
const
struct
gpart
*
gparts
=
e
->
s
->
gparts
;
struct
gpart
*
dmparts
=
NULL
;
struct
gpart
*
dmparts
=
NULL
;
const
struct
spart
*
sparts
=
e
->
s
->
sparts
;
const
struct
spart
*
sparts
=
e
->
s
->
sparts
;
const
struct
cooling_function_data
*
cooling
=
e
->
cooling_func
;
const
struct
cooling_function_data
*
cooling
=
e
->
cooling_func
;
FILE
*
xmfFile
=
0
;
FILE
*
xmfFile
=
0
;
/* Number of unassociated gparts */
/* Number of unassociated gparts */
...
@@ -993,8 +993,8 @@ void write_output_serial(struct engine* e, const char* baseName,
...
@@ -993,8 +993,8 @@ void write_output_serial(struct engine* e, const char* baseName,
Nparticles
=
Ngas
;
Nparticles
=
Ngas
;
hydro_write_particles
(
parts
,
xparts
,
list
,
&
num_fields
);
hydro_write_particles
(
parts
,
xparts
,
list
,
&
num_fields
);
num_fields
+=
chemistry_write_particles
(
parts
,
list
+
num_fields
);
num_fields
+=
chemistry_write_particles
(
parts
,
list
+
num_fields
);
num_fields
+=
cooling_write_particles
(
xparts
,
list
+
num_fields
,
num_fields
+=
cooling
);
cooling_write_particles
(
xparts
,
list
+
num_fields
,
cooling
);
break
;
break
;