Peano
Loading...
Searching...
No Matches
hydro_parameters.h
Go to the documentation of this file.
1/*******************************************************************************
2 * This file is part of SWIFT.
3 * Copyright (c) 2019 Josh Borrow (joshua.borrow@durham.ac.uk)
4 *
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published
8 * by the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 *
19 ******************************************************************************/
20
21#ifndef SWIFT_MINIMAL_HYDRO_PARAMETERS_H
22#define SWIFT_MINIMAL_HYDRO_PARAMETERS_H
23
24/* Configuration file */
25#include <config.h>
26
27/* Global headers */
28#if defined(HAVE_HDF5)
29#include <hdf5.h>
30#endif
31
32/* Local headers */
33//#include "common_io.h"
34//#include "error.h"
35#include "inline.h"
36
46/* Viscosity parameters -- FIXED -- MUST BE DEFINED AT COMPILE-TIME */
47
48/* Cosmology default beta=3.0.
49 * Alpha can be set in the parameter file.
50 * Beta is defined as in e.g. Price (2010) Eqn (103) */
51#define const_viscosity_beta 3.0f
52
53/* The viscosity that the particles are reset to after being hit by a
54 * feedback event. This should be set to the same value as the
55 * hydro_props_default_viscosity_alpha in fixed schemes, and likely
56 * to hydro_props_default_viscosity_alpha_max in variable schemes. */
57#define hydro_props_default_viscosity_alpha_feedback_reset 0.8f
58
59/* Viscosity paramaters -- Defaults; can be changed at run-time */
60
61/* The "initial" hydro viscosity, or the fixed value for non-variable
62 * schemes. This usually takes the value 0.8. */
63#define hydro_props_default_viscosity_alpha 0.8f
64
65/* Structs that store the relevant variables */
66
71 float alpha;
72};
73
76
77/* Functions for reading from parameter file */
78
79/* Forward declartions */
80struct swift_params;
81struct phys_const;
82struct unit_system;
83
84/* Viscosity */
85
95static INLINE void viscosity_init(struct swift_params* params,
96 const struct unit_system* us,
97 const struct phys_const* phys_const,
98 struct viscosity_global_data* viscosity) {
99
100 /* Read the artificial viscosity parameters from the file, if they exist,
101 * otherwise set them to the defaults defined above. */
102
104}
105
113 struct viscosity_global_data* viscosity) {
115}
116
124 const struct viscosity_global_data* viscosity) {
125// printf("Artificial viscosity parameters set to alpha: %.3f\n",
126// viscosity->alpha);
127}
128
129#if defined(HAVE_HDF5)
136static INLINE void viscosity_print_snapshot(
137 hid_t h_grpsph, const struct viscosity_global_data* viscosity) {
138
139 io_write_attribute_f(h_grpsph, "Alpha viscosity", viscosity->alpha);
140 io_write_attribute_f(h_grpsph, "Beta viscosity", const_viscosity_beta);
141}
142#endif
143
144/* Diffusion */
145
155static INLINE void diffusion_init(struct swift_params* params,
156 const struct unit_system* us,
157 const struct phys_const* phys_const,
158 struct diffusion_global_data* diffusion) {}
159
167 struct diffusion_global_data* diffusion) {}
168
176 const struct diffusion_global_data* diffusion) {}
177
178#ifdef HAVE_HDF5
185static INLINE void diffusion_print_snapshot(
186 hid_t h_grpsph, const struct diffusion_global_data* diffusion) {}
187#endif
188
189#endif /* SWIFT_MINIMAL_HYDRO_PARAMETERS_H */
static INLINE void viscosity_print(const struct viscosity_global_data *viscosity)
Prints out the viscosity parameters at the start of a run.
#define hydro_props_default_viscosity_alpha
#define const_viscosity_beta
static INLINE void diffusion_print(const struct diffusion_global_data *diffusion)
Prints out the diffusion parameters at the start of a run.
static INLINE void diffusion_init_no_hydro(struct diffusion_global_data *diffusion)
Initialises a diffusion struct to sensible numbers for mocking purposes.
static INLINE void viscosity_init(struct swift_params *params, const struct unit_system *us, const struct phys_const *phys_const, struct viscosity_global_data *viscosity)
Initialises the viscosity parameters in the struct from the parameter file, or sets them to defaults.
static INLINE void diffusion_init(struct swift_params *params, const struct unit_system *us, const struct phys_const *phys_const, struct diffusion_global_data *diffusion)
Initialises the diffusion parameters in the struct from the parameter file, or sets them to defaults.
static INLINE void viscosity_init_no_hydro(struct viscosity_global_data *viscosity)
Initialises a viscosity struct to sensible numbers for mocking purposes.
#define INLINE
Defines inline.
Definition inline.h:36