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
c0af35dc
Commit
c0af35dc
authored
7 years ago
by
lhausamm
Browse files
Options
Downloads
Patches
Plain Diff
Add output for grackle
parent
6a7cbbfd
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!499
Improved grackle
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cooling/grackle/cooling.h
+1
-43
1 addition, 43 deletions
src/cooling/grackle/cooling.h
src/cooling/grackle/cooling_io.h
+149
-0
149 additions, 0 deletions
src/cooling/grackle/cooling_io.h
src/cooling/grackle/cooling_struct.h
+3
-0
3 additions, 0 deletions
src/cooling/grackle/cooling_struct.h
with
153 additions
and
43 deletions
src/cooling/grackle/cooling.h
+
1
−
43
View file @
c0af35dc
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
/* Local includes. */
/* Local includes. */
#include
"../config.h"
#include
"../config.h"
#include
"cooling_io.h"
#include
"error.h"
#include
"error.h"
#include
"hydro.h"
#include
"hydro.h"
#include
"io_properties.h"
#include
"io_properties.h"
...
@@ -43,19 +44,6 @@
...
@@ -43,19 +44,6 @@
#define GRACKLE_NPART 1
#define GRACKLE_NPART 1
#define GRACKLE_RANK 3
#define GRACKLE_RANK 3
#ifdef HAVE_HDF5
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_write_flavour
(
hid_t
h_grpsph
)
{
io_write_attribute_s
(
h_grpsph
,
"Cooling Model"
,
"Grackle"
);
}
#endif
/**
/**
* @brief Sets the cooling properties of the (x-)particles to a valid start
* @brief Sets the cooling properties of the (x-)particles to a valid start
* state.
* state.
...
@@ -446,36 +434,6 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
...
@@ -446,36 +434,6 @@ __attribute__((always_inline)) INLINE static float cooling_timestep(
}
}
/**
* @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_arguments
(
const
struct
swift_params
*
parameter_file
,
struct
cooling_function_data
*
cooling
)
{
parser_get_param_string
(
parameter_file
,
"GrackleCooling:CloudyTable"
,
cooling
->
cloudy_table
);
cooling
->
with_uv_background
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:WithUVbackground"
);
cooling
->
redshift
=
parser_get_param_double
(
parameter_file
,
"GrackleCooling:Redshift"
);
cooling
->
with_metal_cooling
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:WithMetalCooling"
);
cooling
->
provide_volumetric_heating_rates
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:ProvideVolumetricHeatingRates"
);
cooling
->
provide_specific_heating_rates
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:ProvideSpecificHeatingRates"
);
cooling
->
self_shielding_method
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:SelfShieldingMethod"
);
}
/**
/**
* @brief Initialises the cooling unit system.
* @brief Initialises the cooling unit system.
...
...
This diff is collapsed.
Click to expand it.
src/cooling/grackle/cooling_io.h
0 → 100644
+
149
−
0
View file @
c0af35dc
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#ifndef SWIFT_COOLING_GRACKLE_IO_H
#define SWIFT_COOLING_GRACKLE_IO_H
#include
"../config.h"
#include
"cooling_struct.h"
#include
"io_properties.h"
#ifdef HAVE_HDF5
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
*/
__attribute__
((
always_inline
))
INLINE
static
void
cooling_write_flavour
(
hid_t
h_grpsph
)
{
io_write_attribute_s
(
h_grpsph
,
"Cooling Model"
,
"Grackle"
);
}
#endif
/**
* @brief Writes the current model of SPH to the file
* @param h_grpsph The HDF5 group in which to write
*/
__attribute__
((
always_inline
))
INLINE
static
int
cooling_write_particles
(
const
struct
xpart
*
xparts
,
struct
io_props
*
list
,
const
struct
cooling_function_data
*
cooling
)
{
int
num
=
0
;
if
(
cooling
->
output_mode
==
0
)
return
num
;
#if COOLING_GRACKLE_MODE >= 1
/* List what we want to write */
list
[
0
]
=
io_make_output_field
(
"HI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
HI_frac
);
list
[
1
]
=
io_make_output_field
(
"HII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
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
,
xparts
,
cooling_data
.
HeII_frac
);
list
[
4
]
=
io_make_output_field
(
"HeIII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
HeIII_frac
);
list
[
5
]
=
io_make_output_field
(
"e"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
e_frac
);
num
+=
6
;
#endif
if
(
cooling
->
output_mode
==
1
)
return
num
;
#if COOLING_GRACKLE_MODE >= 2
list
+=
num
;
list
[
0
]
=
io_make_output_field
(
"HM"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
HM_frac
);
list
[
1
]
=
io_make_output_field
(
"H2I"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
H2I_frac
);
list
[
2
]
=
io_make_output_field
(
"H2II"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
H2II_frac
);
num
+=
3
;
#endif
if
(
cooling
->
output_mode
==
2
)
return
num
;
#if COOLING_GRACKLE_MODE >= 3
list
+=
num
;
list
[
0
]
=
io_make_output_field
(
"DI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
DI_frac
);
list
[
1
]
=
io_make_output_field
(
"DII"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
DII_frac
);
list
[
2
]
=
io_make_output_field
(
"HDI"
,
FLOAT
,
1
,
UNIT_CONV_NO_UNITS
,
xparts
,
cooling_data
.
HDI_frac
);
num
+=
3
;
#endif
return
num
;
}
/**
* @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_arguments
(
const
struct
swift_params
*
parameter_file
,
struct
cooling_function_data
*
cooling
)
{
parser_get_param_string
(
parameter_file
,
"GrackleCooling:CloudyTable"
,
cooling
->
cloudy_table
);
cooling
->
with_uv_background
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:WithUVbackground"
);
cooling
->
redshift
=
parser_get_param_double
(
parameter_file
,
"GrackleCooling:Redshift"
);
cooling
->
with_metal_cooling
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:WithMetalCooling"
);
cooling
->
provide_volumetric_heating_rates
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:ProvideVolumetricHeatingRates"
);
cooling
->
provide_specific_heating_rates
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:ProvideSpecificHeatingRates"
);
cooling
->
self_shielding_method
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:SelfShieldingMethod"
);
cooling
->
output_mode
=
parser_get_param_int
(
parameter_file
,
"GrackleCooling:OutputMode"
);
}
#endif // SWIFT_COOLING_GRACKLE_IO_H
This diff is collapsed.
Click to expand it.
src/cooling/grackle/cooling_struct.h
+
3
−
0
View file @
c0af35dc
...
@@ -60,6 +60,9 @@ struct cooling_function_data {
...
@@ -60,6 +60,9 @@ struct cooling_function_data {
/* Self shielding method (<= 3) means grackle modes */
/* Self shielding method (<= 3) means grackle modes */
int
self_shielding_method
;
int
self_shielding_method
;
/* Output mode (correspond to primordial chemistry mode */
int
output_mode
;
};
};
/**
/**
...
...
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