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
70
Issues
70
List
Boards
Labels
Milestones
Merge Requests
13
Merge Requests
13
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
55c84bb5
Commit
55c84bb5
authored
Apr 18, 2018
by
lhausamm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update cooling and chemistry functions
parent
2fb0f958
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
45 additions
and
27 deletions
+45
-27
src/chemistry/EAGLE/chemistry.h
src/chemistry/EAGLE/chemistry.h
+12
-9
src/chemistry/EAGLE/chemistry_struct.h
src/chemistry/EAGLE/chemistry_struct.h
+1
-1
src/chemistry/none/chemistry.h
src/chemistry/none/chemistry.h
+10
-7
src/chemistry/none/chemistry_struct.h
src/chemistry/none/chemistry_struct.h
+1
-1
src/cooling/EAGLE/cooling.h
src/cooling/EAGLE/cooling.h
+5
-2
src/cooling/const_du/cooling.h
src/cooling/const_du/cooling.h
+6
-3
src/cooling/const_lambda/cooling.h
src/cooling/const_lambda/cooling.h
+5
-2
src/cooling/none/cooling.h
src/cooling/none/cooling.h
+5
-2
No files found.
src/chemistry/EAGLE/chemistry.h
View file @
55c84bb5
...
...
@@ -57,10 +57,10 @@ chemistry_get_element_name(enum chemistry_element elem) {
* 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
)
{}
/**
* @brief Finishes the smooth metal calculation.
...
...
@@ -71,11 +71,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
)
{}
/**
...
...
@@ -87,8 +87,11 @@ __attribute__((always_inline)) INLINE static void chemistry_end_density(
* @param data The global chemistry information.
*/
__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
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
chemistry_global_data
*
data
,
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
p
->
chemistry_data
.
metal_mass_fraction_total
=
data
->
initial_metal_mass_fraction_total
;
...
...
@@ -107,7 +110,7 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
*/
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 the total metallicity */
data
->
initial_metal_mass_fraction_total
=
...
...
@@ -133,9 +136,9 @@ static INLINE void chemistry_init_backend(
/**
* @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 model is 'EAGLE' tracking %d elements."
,
chemistry_element_count
);
...
...
src/chemistry/EAGLE/chemistry_struct.h
View file @
55c84bb5
...
...
@@ -38,7 +38,7 @@ enum chemistry_element {
/**
* @brief Global chemical abundance information in the EAGLE model.
*/
struct
chemistry_data
{
struct
chemistry_
global_
data
{
/*! Fraction of the particle mass in given elements at the start of the run */
float
initial_metal_mass_fraction
[
chemistry_element_count
];
...
...
src/chemistry/none/chemistry.h
View file @
55c84bb5
...
...
@@ -61,14 +61,14 @@ 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
)
{}
/**
* @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 'No chemistry'."
);
}
...
...
@@ -81,7 +81,7 @@ static INLINE void chemistry_print_backend(const struct chemistry_data* data) {
* @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
)
{}
/**
...
...
@@ -95,8 +95,11 @@ __attribute__((always_inline)) INLINE static void chemistry_end_density(
* @param data The global chemistry information used for this run.
*/
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_first_init_part
(
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
chemistry_data
*
data
)
{}
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
chemistry_global_data
*
data
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
/**
* @brief Sets the chemistry properties of the (x-)particles to a valid start
...
...
@@ -108,6 +111,6 @@ __attribute__((always_inline)) INLINE static void chemistry_first_init_part(
* @param data The global chemistry information.
*/
__attribute__
((
always_inline
))
INLINE
static
void
chemistry_init_part
(
struct
part
*
restrict
p
,
const
struct
chemistry_data
*
data
)
{}
struct
part
*
restrict
p
,
const
struct
chemistry_
global_
data
*
data
)
{}
#endif
/* SWIFT_CHEMISTRY_NONE_H */
src/chemistry/none/chemistry_struct.h
View file @
55c84bb5
...
...
@@ -34,7 +34,7 @@ enum chemistry_element { chemistry_element_count = 0 };
*
* Nothing here.
*/
struct
chemistry_data
{};
struct
chemistry_
global_
data
{};
/**
* @brief Chemistry properties carried by the #part.
...
...
src/cooling/EAGLE/cooling.h
View file @
55c84bb5
...
...
@@ -84,8 +84,11 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @param cooling The properties of the cooling function.
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_first_init_part
(
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cooling_function_data
*
cooling
)
{}
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
/**
* @brief Returns the total radiated energy by this particle.
...
...
src/cooling/const_du/cooling.h
View file @
55c84bb5
...
...
@@ -80,7 +80,7 @@ __attribute__((always_inline)) INLINE static void cooling_cool_part(
float
cooling_du_dt
=
-
cooling
->
cooling_rate
;
/* 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
;
}
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
;
...
...
@@ -130,8 +130,11 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @param cooling The properties of the cooling function.
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_first_init_part
(
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
xp
->
cooling_data
.
radiated_energy
=
0
.
f
;
}
...
...
src/cooling/const_lambda/cooling.h
View file @
55c84bb5
...
...
@@ -143,8 +143,11 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @param cooling The properties of the cooling function.
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_first_init_part
(
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cooling_function_data
*
cooling
)
{
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cooling_function_data
*
restrict
cooling
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{
xp
->
cooling_data
.
radiated_energy
=
0
.
f
;
}
...
...
src/cooling/none/cooling.h
View file @
55c84bb5
...
...
@@ -90,8 +90,11 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
* @param cooling The properties of the cooling function.
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_first_init_part
(
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
,
const
struct
cooling_function_data
*
cooling
)
{}
const
struct
phys_const
*
restrict
phys_const
,
const
struct
unit_system
*
restrict
us
,
const
struct
cosmology
*
restrict
cosmo
,
const
struct
cooling_function_data
*
data
,
const
struct
part
*
restrict
p
,
struct
xpart
*
restrict
xp
)
{}
/**
* @brief Returns the total radiated energy by this particle.
...
...
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