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
12
Merge Requests
12
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
b4868c7e
Commit
b4868c7e
authored
Mar 19, 2018
by
lhausamm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gear: Change chemistry_data -> chemistry_global_data + minor changes
parent
65e0568d
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
19 deletions
+53
-19
src/chemistry/gear/chemistry.h
src/chemistry/gear/chemistry.h
+13
-8
src/chemistry/gear/chemistry_io.h
src/chemistry/gear/chemistry_io.h
+30
-6
src/chemistry/gear/chemistry_struct.h
src/chemistry/gear/chemistry_struct.h
+7
-1
src/cooling/grackle/cooling.h
src/cooling/grackle/cooling.h
+1
-1
src/cooling/grackle/cooling_io.h
src/cooling/grackle/cooling_io.h
+2
-3
No files found.
src/chemistry/gear/chemistry.h
View file @
b4868c7e
...
...
@@ -29,6 +29,7 @@
#include <math.h>
/* Local includes. */
#include "chemistry_io.h"
#include "chemistry_struct.h"
#include "error.h"
#include "hydro.h"
...
...
@@ -62,14 +63,18 @@ chemistry_get_element_name(enum chemistry_element elem) {
*/
static
INLINE
void
chemistry_init_backend
(
const
struct
swift_params
*
parameter_file
,
const
struct
unit_system
*
us
,
const
struct
phys_const
*
phys_const
,
struct
chemistry_data
*
data
)
{}
const
struct
phys_const
*
phys_const
,
struct
chemistry_global_data
*
data
)
{
/* read parameters */
chemistry_read_parameters
(
parameter_file
,
us
,
phys_const
,
data
);
}
/**
* @brief Prints the properties of the chemistry model to stdout.
*
* @brief The #chemistry_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_data
*
data
)
{
static
INLINE
void
chemistry_print_backend
(
const
struct
chemistry_
global_
data
*
data
)
{
message
(
"Chemistry function is 'Gear'."
);
}
...
...
@@ -81,10 +86,10 @@ static INLINE void chemistry_print_backend(const struct chemistry_data* data) {
* the various smooth metallicity tasks
*
* @param p The particle to act upon
* @param cd #chemistry_data containing chemistry informations.
* @param cd #chemistry_
global_
data containing chemistry informations.
*/
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_init_part
(
struct
part
*
restrict
p
,
const
struct
chemistry_data
*
cd
)
{
struct
part
*
restrict
p
,
const
struct
chemistry_
global_
data
*
cd
)
{
struct
chemistry_part_data
*
cpd
=
&
p
->
chemistry_data
;
...
...
@@ -102,11 +107,11 @@ __attribute__((always_inline)) INLINE static void chemistry_init_part(
* This function requires the #hydro_end_density to have been called.
*
* @param p The particle to act upon.
* @param cd #chemistry_data containing chemistry informations.
* @param cd #chemistry_
global_
data containing chemistry informations.
* @param cosmo The current cosmological model.
*/
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_end_density
(
struct
part
*
restrict
p
,
const
struct
chemistry_data
*
cd
,
struct
part
*
restrict
p
,
const
struct
chemistry_
global_
data
*
cd
,
const
struct
cosmology
*
cosmo
)
{
/* Some smoothing length multiples. */
...
...
@@ -139,7 +144,7 @@ __attribute__((always_inline)) INLINE static void chemistry_end_density(
*/
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_first_init_part
(
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
chemistry_data
*
data
)
{
const
struct
chemistry_
global_
data
*
data
)
{
chemistry_init_part
(
p
,
data
);
}
...
...
src/chemistry/gear/chemistry_io.h
View file @
b4868c7e
...
...
@@ -22,6 +22,10 @@
#include "chemistry.h"
#include "chemistry_struct.h"
#include "io_properties.h"
#include "parser.h"
#include "part.h"
#include "physical_constants.h"
#include "units.h"
/**
* @brief Specifies which particle fields to read from a dataset
...
...
@@ -31,15 +35,30 @@
*
* @return Returns the number of fields to read.
*/
int
chemistry_read_particles
(
struct
part
*
parts
,
struct
io_props
*
list
)
{
__attribute__
((
always_inline
))
INLINE
static
int
chemistry_read_particles
(
struct
part
*
parts
,
struct
io_props
*
list
)
{
/* List what we want to read */
list
[
0
]
=
io_make_input_field
(
"ElementAbundance"
,
FLOAT
,
chemistry_element_count
,
OPTIONAL
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
metal_mass_fraction
);
return
1
;
list
[
1
]
=
io_make_input_field
(
"Z"
,
FLOAT
,
1
,
OPTIONAL
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
Z
);
return
2
;
}
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_read_parameters
(
const
struct
swift_params
*
parameter_file
,
const
struct
unit_system
*
us
,
const
struct
phys_const
*
phys_const
,
struct
chemistry_global_data
*
data
)
{
data
->
initial_metallicity
=
parser_get_opt_param_float
(
parameter_file
,
"GearChemistry:InitialMetallicity"
,
-
1
);
}
/**
* @brief Specifies which particle fields to write to a dataset
*
...
...
@@ -48,18 +67,21 @@ int chemistry_read_particles(struct part* parts, struct io_props* list) {
*
* @return Returns the number of fields to write.
*/
int
chemistry_write_particles
(
const
struct
part
*
parts
,
struct
io_props
*
list
)
{
__attribute__
((
always_inline
))
INLINE
static
int
chemistry_write_particles
(
const
struct
part
*
parts
,
struct
io_props
*
list
)
{
/* List what we want to write */
list
[
0
]
=
io_make_output_field
(
"SmoothedElementAbundance"
,
FLOAT
,
chemistry_element_count
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
smoothed_metal_mass_fraction
);
list
[
1
]
=
io_make_output_field
(
"Z"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
Z
);
list
[
1
]
=
io_make_output_field
(
"ElementAbundance"
,
FLOAT
,
list
[
2
]
=
io_make_output_field
(
"ElementAbundance"
,
FLOAT
,
chemistry_element_count
,
UNIT_CONV_NO_UNITS
,
parts
,
chemistry_data
.
metal_mass_fraction
);
return
2
;
return
3
;
}
#ifdef HAVE_HDF5
...
...
@@ -68,7 +90,8 @@ int chemistry_write_particles(const struct part* parts, struct io_props* list) {
* @brief Writes the current model of SPH to the file
* @param h_grp The HDF5 group in which to write
*/
void
chemistry_write_flavour
(
hid_t
h_grp
)
{
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_write_flavour
(
hid_t
h_grpsph
)
{
io_write_attribute_s
(
h_grp
,
"Chemistry Model"
,
"GEAR"
);
for
(
enum
chemistry_element
i
=
chemistry_element_O
;
...
...
@@ -80,4 +103,5 @@ void chemistry_write_flavour(hid_t h_grp) {
}
#endif
#endif
/* SWIFT_CHEMISTRY_IO_GEAR_H */
src/chemistry/gear/chemistry_struct.h
View file @
b4868c7e
...
...
@@ -38,7 +38,11 @@ enum chemistry_element {
/**
* @brief Global chemical abundance information.
*/
struct
chemistry_data
{};
struct
chemistry_global_data
{
/* Initial metallicity Z */
float
initial_metallicity
;
};
/**
* @brief Properties of the chemistry function.
...
...
@@ -50,6 +54,8 @@ struct chemistry_part_data {
/*! Smoothed fraction of the particle mass in a given element */
float
smoothed_metal_mass_fraction
[
chemistry_element_count
];
float
Z
;
};
#endif
/* SWIFT_CHEMISTRY_STRUCT_GEAR_H */
src/cooling/grackle/cooling.h
View file @
b4868c7e
...
...
@@ -810,7 +810,7 @@ __attribute__((always_inline)) INLINE static void cooling_init_backend(
error
(
"Grackle with multiple particles not implemented"
);
/* read parameters */
cooling_
parse_argument
s
(
parameter_file
,
cooling
);
cooling_
read_parameter
s
(
parameter_file
,
cooling
);
/* Set up the units system. */
cooling_init_units
(
us
,
cooling
);
...
...
src/cooling/grackle/cooling_io.h
View file @
b4868c7e
...
...
@@ -119,10 +119,11 @@ __attribute__((always_inline)) INLINE static int cooling_write_particles(
/**
* @brief Parser the parameter file and initialize the #cooling_function_data
*
* @param parameter_file The parser parameter file
* @param cooling The cooling properties to initialize
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_
parse_argument
s
(
__attribute__
((
always_inline
))
INLINE
static
void
cooling_
read_parameter
s
(
const
struct
swift_params
*
parameter_file
,
struct
cooling_function_data
*
cooling
)
{
...
...
@@ -146,7 +147,6 @@ __attribute__((always_inline)) INLINE static void cooling_parse_arguments(
cooling
->
self_shielding_method
=
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:SelfShieldingMethod"
,
0
);
#if COOLING_GRACKLE_MODE > 0
cooling
->
output_mode
=
parser_get_opt_param_int
(
parameter_file
,
"GrackleCooling:OutputMode"
,
0
);
...
...
@@ -158,7 +158,6 @@ __attribute__((always_inline)) INLINE static void cooling_parse_arguments(
cooling
->
omega
=
parser_get_opt_param_double
(
parameter_file
,
"GrackleCooling:Omega"
,
0
.
8
);
#endif
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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