hydro_properties.h 4.41 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*******************************************************************************
 * 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_HYDRO_PROPERTIES
#define SWIFT_HYDRO_PROPERTIES

22
23
24
25
26
/**
 * @file hydro_properties.h
 * @brief Contains all the constants and parameters of the hydro scheme
 */

27
28
29
/* Config parameters. */
#include "../config.h"

30
31
32
33
#if defined(HAVE_HDF5)
#include <hdf5.h>
#endif

34
/* Local includes. */
35
#include "restart.h"
36
37
38
39
40
41
42

/* Forward declarations */
struct cosmology;
struct swift_params;
struct gravity_props;
struct phys_const;
struct unit_system;
43
44
45
46
47
48

/**
 * @brief Contains all the constants and parameters of the hydro scheme
 */
struct hydro_props {

49
  /*! Resolution parameter */
50
  float eta_neighbours;
51
52

  /*! Target weightd number of neighbours (for info only)*/
53
  float target_neighbours;
54
55
56
57
58

  /*! Smoothing length tolerance */
  float h_tolerance;

  /*! Tolerance on neighbour number  (for info only)*/
59
60
  float delta_neighbours;

61
  /*! Maximal smoothing length */
62
63
  float h_max;

64
65
66
67
68
69
  /*! Minimal smoothing length expressed as ratio to softening length */
  float h_min_ratio;

  /*! Minimal smoothing length */
  float h_min;

70
  /*! Maximal number of iterations to converge h */
71
72
  int max_smoothing_iterations;

73
  /*! Time integration properties */
74
  float CFL_condition;
75
76

  /*! Maximal change of h over one time-step */
77
  float log_max_h_change;
78

79
80
81
  /*! Minimal temperature allowed */
  float minimal_temperature;

82
  /*! Minimal physical internal energy per unit mass */
83
84
  float minimal_internal_energy;

85
86
87
  /*! Initial temperature */
  float initial_temperature;

88
  /*! Initial physical internal energy per unit mass */
89
90
  float initial_internal_energy;

Josh Borrow's avatar
Josh Borrow committed
91
  /*! Primordial hydrogen mass fraction for initial energy conversion */
92
  float hydrogen_mass_fraction;
93
94
95

  /*! Temperature of the neutral to ionized transition of Hydrogen */
  float hydrogen_ionization_temperature;
Josh Borrow's avatar
Josh Borrow committed
96

97
98
99
100
101
102
  /*! Mean molecular weight below hydrogen ionization temperature */
  float mu_neutral;

  /*! Mean molecular weight above hydrogen ionization temperature */
  float mu_ionised;

Josh Borrow's avatar
Josh Borrow committed
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
  /*! Artificial viscosity parameters */
  struct {
    /*! For the fixed, simple case. Also used to set the initial AV
        coefficient for variable schemes. */
    float alpha;

    /*! Artificial viscosity (max) for the variable case (e.g. M&M) */
    float alpha_max;

    /*! Artificial viscosity (min) for the variable case (e.g. M&M) */
    float alpha_min;

    /*! The decay length of the artificial viscosity (used in M&M, etc.) */
    float length;
  } viscosity;
Josh Borrow's avatar
Josh Borrow committed
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135

  /*! Thermal diffusion parameters */
  struct {

    /*! Initialisation value, or the case for constant thermal diffusion coeffs
     */
    float alpha;

    /*! Tuning parameter for speed of ramp up/down */
    float beta;

    /*! Maximal value for alpha_diff */
    float alpha_max;

    /*! Minimal value for alpha_diff */
    float alpha_min;

  } diffusion;
136
137
138
};

void hydro_props_print(const struct hydro_props *p);
139
140
141
void hydro_props_init(struct hydro_props *p,
                      const struct phys_const *phys_const,
                      const struct unit_system *us,
lhausamm's avatar
lhausamm committed
142
                      struct swift_params *params);
143

144
145
146
void hydro_props_update(struct hydro_props *p, const struct gravity_props *gp,
                        const struct cosmology *cosmo);

147
148
149
150
#if defined(HAVE_HDF5)
void hydro_props_print_snapshot(hid_t h_grpsph, const struct hydro_props *p);
#endif

151
152
153
154
/* Dump/restore. */
void hydro_props_struct_dump(const struct hydro_props *p, FILE *stream);
void hydro_props_struct_restore(const struct hydro_props *p, FILE *stream);

Josh Borrow's avatar
Josh Borrow committed
155
156
157
/* Setup for tests */
void hydro_props_init_no_hydro(struct hydro_props *p);

158
#endif /* SWIFT_HYDRO_PROPERTIES */