star_formation.h 10.2 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
/*******************************************************************************
 * This file is part of SWIFT.
 * Copyright (c) 2018 Folkert Nobels (nobels@strw.leidenuniv.nl)
 *
 * 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/>.
 *
 *******************************************************************************/
19
20
#ifndef SWIFT_NONE_STAR_FORMATION_H
#define SWIFT_NONE_STAR_FORMATION_H
21
22
23

/* Local includes */
#include "cosmology.h"
Folkert Nobels's avatar
Folkert Nobels committed
24
#include "entropy_floor.h"
Folkert Nobels's avatar
Folkert Nobels committed
25
#include "error.h"
26
#include "hydro_properties.h"
Folkert Nobels's avatar
Folkert Nobels committed
27
#include "parser.h"
Folkert Nobels's avatar
Folkert Nobels committed
28
#include "part.h"
Folkert Nobels's avatar
Folkert Nobels committed
29
#include "physical_constants.h"
30
31
32
33
34
#include "units.h"

/* Starformation struct */
struct star_formation {};

35
36
37
38
39
/* Does the star formation model move the hydro particles?
   This will update the c->hydro.dx_max_part and
   c->hydro.dx_max_sort after forming a star. */
#define star_formation_need_update_dx_max 0

40
/**
41
42
43
44
 * @brief Calculate if the gas has the potential of becoming
 * a star.
 *
 * No star formation should occur, so return 0.
45
46
 *
 * @param starform the star formation law properties to use.
47
48
49
50
51
52
53
 * @param p the gas particles.
 * @param xp the additional properties of the gas particles.
 * @param phys_const the physical constants in internal units.
 * @param cosmo the cosmological parameters and properties.
 * @param hydro_props The properties of the hydro scheme.
 * @param us The internal system of units.
 * @param cooling The cooling data struct.
54
 *
55
 */
56
INLINE static int star_formation_is_star_forming(
57
    const struct part* restrict p, const struct xpart* restrict xp,
58
59
    const struct star_formation* starform, const struct phys_const* phys_const,
    const struct cosmology* cosmo,
60
61
    const struct hydro_props* restrict hydro_props,
    const struct unit_system* restrict us,
Folkert Nobels's avatar
Folkert Nobels committed
62
    const struct cooling_function_data* restrict cooling,
63
    const struct entropy_floor_properties* restrict entropy_floor) {
64
65
66
67

  return 0;
}

68
/**
69
70
 * @brief Compute the star-formation rate of a given particle and store
 * it into the #xpart.
71
 *
72
 * Nothing to do here.
73
 *
74
75
76
77
 * @param p #part.
 * @param xp the #xpart.
 * @param starform the star formation law properties to use
 * @param phys_const the physical constants in internal units.
78
 * @param hydro_props The properties of the hydro scheme.
79
80
81
82
83
84
 * @param cosmo the cosmological parameters and properties.
 * @param dt_star The time-step of this particle.
 */
INLINE static void star_formation_compute_SFR(
    const struct part* restrict p, struct xpart* restrict xp,
    const struct star_formation* starform, const struct phys_const* phys_const,
85
86
    const struct hydro_props* hydro_props, const struct cosmology* cosmo,
    const double dt_star) {}
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108

/**
 * @brief Decides whether a particle should be converted into a
 * star or not.
 *
 * No SF should occur, so return 0.
 *
 * @param p The #part.
 * @param xp The #xpart.
 * @param starform The properties of the star formation model.
 * @param e The #engine (for random numbers).
 * @param dt_star The time-step of this particle
 * @return 1 if a conversion should be done, 0 otherwise.
 */
INLINE static int star_formation_should_convert_to_star(
    const struct part* p, const struct xpart* xp,
    const struct star_formation* starform, const struct engine* e,
    const double dt_star) {

  return 0;
}

Loic Hausammann's avatar
Loic Hausammann committed
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
 * @brief Decides whether a new particle should be created or if the hydro
 * particle needs to be transformed.
 *
 * @param p The #part.
 * @param xp The #xpart.
 * @param starform The properties of the star formation model.
 *
 * @return 1 if a new spart needs to be created.
 */
INLINE static int star_formation_should_spawn_spart(
    struct part* p, struct xpart* xp, const struct star_formation* starform) {
  return 0;
}

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
/**
 * @brief Update the SF properties of a particle that is not star forming.
 *
 * Nothing to do here.
 *
 * @param p The #part.
 * @param xp The #xpart.
 * @param e The #engine.
 * @param starform The properties of the star formation model.
 * @param with_cosmology Are we running with cosmology switched on?
 */
INLINE static void star_formation_update_part_not_SFR(
    struct part* p, struct xpart* xp, const struct engine* e,
    const struct star_formation* starform, const int with_cosmology) {}

/**
 * @brief Copies the properties of the gas particle over to the
 * star particle.
 *
 * Nothing to do here.
 *
 * @param e The #engine
 * @param p the gas particles.
 * @param xp the additional properties of the gas particles.
 * @param sp the new created star particle with its properties.
 * @param starform the star formation law properties to use.
 * @param phys_const the physical constants in internal units.
 * @param cosmo the cosmological parameters and properties.
 * @param with_cosmology if we run with cosmology.
Loic Hausammann's avatar
Loic Hausammann committed
153
 * @param convert_part Did we convert a part (or spawned one)?
154
 */
155
INLINE static void star_formation_copy_properties(
156
157
    const struct part* p, const struct xpart* xp, struct spart* sp,
    const struct engine* e, const struct star_formation* starform,
Folkert Nobels's avatar
Folkert Nobels committed
158
159
160
161
    const struct cosmology* cosmo, const int with_cosmology,
    const struct phys_const* phys_const,
    const struct hydro_props* restrict hydro_props,
    const struct unit_system* restrict us,
Loic Hausammann's avatar
Loic Hausammann committed
162
163
    const struct cooling_function_data* restrict cooling,
    const int convert_part) {}
164

165
/**
Folkert Nobels's avatar
Folkert Nobels committed
166
 * @brief initialization of the star formation law
167
168
169
170
171
172
 *
 * @param parameter_file The parsed parameter file
 * @param phys_const Physical constants in internal units
 * @param us The current internal system of units
 * @param starform the star formation law properties to initialize
 *
173
 */
174
INLINE static void starformation_init_backend(
Folkert Nobels's avatar
Folkert Nobels committed
175
    struct swift_params* parameter_file, const struct phys_const* phys_const,
176
177
    const struct unit_system* us, const struct hydro_props* hydro_props,
    const struct star_formation* starform) {}
178

179
180
/**
 * @brief Prints the used parameters of the star formation law
181
182
 *
 * @param starform the star formation law properties.
183
 */
184
INLINE static void starformation_print_backend(
Folkert Nobels's avatar
Folkert Nobels committed
185
    const struct star_formation* starform) {
186
187
188
189

  message("Star formation law is 'No Star Formation'");
}

190
191
192
193
194
195
/**
 * @brief Finishes the density calculation.
 *
 * Nothing to do here.
 *
 * @param p The particle to act upon
Loic Hausammann's avatar
Gear    
Loic Hausammann committed
196
 * @param xp The extra particle to act upon
197
198
199
200
 * @param cd The global star_formation information.
 * @param cosmo The current cosmological model.
 */
__attribute__((always_inline)) INLINE static void star_formation_end_density(
Loic Hausammann's avatar
Gear    
Loic Hausammann committed
201
202
    struct part* restrict p, struct xpart* restrict xp,
    const struct star_formation* cd, const struct cosmology* cosmo) {}
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252

/**
 * @brief Sets all particle fields to sensible values when the #part has 0 ngbs.
 *
 * Nothing to do here.
 *
 * @param p The particle to act upon
 * @param xp The extended particle data to act upon
 * @param cd #star_formation containing star_formation informations.
 * @param cosmo The current cosmological model.
 */
__attribute__((always_inline)) INLINE static void
star_formation_part_has_no_neighbours(struct part* restrict p,
                                      struct xpart* restrict xp,
                                      const struct star_formation* cd,
                                      const struct cosmology* cosmo) {}

/**
 * @brief Sets the star_formation properties of the (x-)particles to a valid
 * state to start the density loop.
 *
 * Nothing to do here.
 *
 * @param data The global star_formation information used for this run.
 * @param p Pointer to the particle data.
 */
__attribute__((always_inline)) INLINE static void star_formation_init_part(
    struct part* restrict p, const struct star_formation* data) {}

/**
 * @brief Sets the star_formation properties of the (x-)particles to a valid
 * start state at the beginning of the simulation after the ICs have been read.
 *
 * Nothing to do here.
 *
 * @param phys_const The physical constant in internal units.
 * @param us The unit system.
 * @param cosmo The current cosmological model.
 * @param data The global star_formation information used for this run.
 * @param p Pointer to the particle data.
 * @param xp Pointer to the extended particle data.
 */
__attribute__((always_inline)) INLINE static void
star_formation_first_init_part(const struct phys_const* restrict phys_const,
                               const struct unit_system* restrict us,
                               const struct cosmology* restrict cosmo,
                               const struct star_formation* data,
                               const struct part* restrict p,
                               struct xpart* restrict xp) {}

253
254
255
256
257
258
259
260
261
262
/**
 * @brief Split the star formation content of a particle into n pieces
 *
 * @param p The #part.
 * @param xp The #xpart.
 * @param n The number of pieces to split into.
 */
__attribute__((always_inline)) INLINE static void star_formation_split_part(
    struct part* p, struct xpart* xp, const double n) {}

Loic Hausammann's avatar
Loic Hausammann committed
263
264
265
266
267
268
269
270
271
272
273
274
/**
 * @brief Deal with the case where no spart are available for star formation.
 *
 * @param e The #engine.
 * @param p The #part.
 * @param xp The #xpart.
 */
__attribute__((always_inline)) INLINE static void
star_formation_no_spart_available(const struct engine* e, const struct part* p,
                                  const struct xpart* xp) {
  /* Nothing to do, we just skip it and deal with it next step */
}
Loic Hausammann's avatar
Loic Hausammann committed
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290

/**
 * @brief Compute some information for the star formation model based
 * on all the particles that were read in.
 *
 * This is called once on start-up of the code.
 *
 * Nothing to do here.
 *
 * @param star_form The #star_formation structure.
 * @param e The #engine.
 */
__attribute__((always_inline)) INLINE static void
star_formation_first_init_stats(struct star_formation* star_form,
                                const struct engine* e) {}

291
#endif /* SWIFT_NONE_STAR_FORMATION_H */