pressure_floor.h 5.78 KB
Newer Older
Loic Hausammann's avatar
Loic Hausammann committed
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) 2019 Matthieu Schaller (schaller@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/>.
 *
 ******************************************************************************/
#ifndef SWIFT_PRESSURE_FLOOR_NONE_H
#define SWIFT_PRESSURE_FLOOR_NONE_H

Loic Hausammann's avatar
Loic Hausammann committed
22
23
24
25
26
27
28
29
/* Pre-declarations */
struct cosmology;
struct hydro_props;
struct phys_const;
struct part;
struct xpart;
struct swift_params;
struct unit_system;
Loic Hausammann's avatar
Loic Hausammann committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45

/**
 * @file src/pressure_floor/none/pressure_floor.h
 * @brief Model without pressure floor
 */

/**
 * @brief Properties of the pressure floor in the NONE model.
 */
struct pressure_floor_properties {};

/**
 * @brief Compute the physical pressure floor of a given #part.
 *
 * Note that the particle is not updated!!
 *
Loic Hausammann's avatar
Loic Hausammann committed
46
47
48
 * Since this is the 'none' model for floor, there is no floor and
 * we just return the physical pressure that was received.
 *
49
 * @param p The #part.
Loic Hausammann's avatar
Loic Hausammann committed
50
 * @param physical_pressure The physical pressure without any pressure floor.
51
 * @param cosmo The #cosmology model.
52
53
54
 *
 * @return The physical pressure with the floor.
 */
55
static INLINE float pressure_floor_get_physical_pressure(
Loic Hausammann's avatar
Format    
Loic Hausammann committed
56
57
    const struct part* p, const float physical_pressure,
    const struct cosmology* cosmo) {
Loic Hausammann's avatar
Loic Hausammann committed
58
  return physical_pressure;
59
60
61
62
63
64
}

/**
 * @brief Compute the comoving pressure floor of a given #part.
 *
 * Note that the particle is not updated!!
Loic Hausammann's avatar
Loic Hausammann committed
65
 *
Loic Hausammann's avatar
Loic Hausammann committed
66
67
68
 * Since this is the 'none' model for floor, there is no floor and
 * we just return the comoving pressure that was received.
 *
Loic Hausammann's avatar
Loic Hausammann committed
69
 * @param p The #part.
Loic Hausammann's avatar
Loic Hausammann committed
70
 * @param comoving_pressure The comoving pressure without any pressure floor.
71
 * @param cosmo The #cosmology model.
Loic Hausammann's avatar
Loic Hausammann committed
72
 *
73
 * @return The comoving pressure with the floor.
Loic Hausammann's avatar
Loic Hausammann committed
74
 */
75
static INLINE float pressure_floor_get_comoving_pressure(
Loic Hausammann's avatar
Format    
Loic Hausammann committed
76
77
    const struct part* p, const float comoving_pressure,
    const struct cosmology* cosmo) {
Loic Hausammann's avatar
Loic Hausammann committed
78
  return comoving_pressure;
Loic Hausammann's avatar
Loic Hausammann committed
79
80
81
82
83
84
}

/**
 * @brief Initialise the pressure floor by reading the parameters and converting
 * to internal units.
 *
Loic Hausammann's avatar
Loic Hausammann committed
85
 * Nothing to do here.
Loic Hausammann's avatar
Loic Hausammann committed
86
87
88
89
90
91
92
 *
 * @param params The YAML parameter file.
 * @param us The system of units used internally.
 * @param phys_const The physical constants.
 * @param hydro_props The propoerties of the hydro scheme.
 * @param props The pressure floor properties to fill.
 */
Loic Hausammann's avatar
Format    
Loic Hausammann committed
93
94
95
96
97
static INLINE void pressure_floor_init(struct pressure_floor_properties* props,
                                       const struct phys_const* phys_const,
                                       const struct unit_system* us,
                                       const struct hydro_props* hydro_props,
                                       struct swift_params* params) {}
Loic Hausammann's avatar
Loic Hausammann committed
98
99
100
101
102
103
104

/**
 * @brief Print the properties of the pressure floor to stdout.
 *
 * @param props The pressure floor properties.
 */
static INLINE void pressure_floor_print(
Loic Hausammann's avatar
Loic Hausammann committed
105
106
107
108
    const struct pressure_floor_properties* props) {

  message("Pressure floor is 'none'");
}
Loic Hausammann's avatar
Loic Hausammann committed
109
110
111
112
113
114
115
116
117
118
119
120
121

#ifdef HAVE_HDF5

/**
 * @brief Writes the current model of pressure floor to the file
 * @param h_grp The HDF5 group in which to write
 */
INLINE static void pressure_floor_print_snapshot(hid_t h_grp) {

  io_write_attribute_s(h_grp, "Pressure floor", "none");
}
#endif

122
/**
Loic Hausammann's avatar
Loic Hausammann committed
123
124
125
 * @brief Finishes the density calculation for the pressure floor properties.
 *
 * Nothing to do here.
126
127
128
129
130
 *
 * @param p The particle to act upon
 * @param cosmo The current cosmological model.
 */
__attribute__((always_inline)) INLINE static void pressure_floor_end_density(
Loic Hausammann's avatar
Format    
Loic Hausammann committed
131
    struct part* restrict p, const struct cosmology* cosmo) {}
132
133

/**
Loic Hausammann's avatar
Loic Hausammann committed
134
135
136
137
 * @brief Sets all the pressure floor fields to sensible values when the #part
 * has 0 ngbs.
 *
 * Nothing to do here.
138
139
140
141
142
143
144
145
146
147
148
149
150
151
 *
 * @param p The particle to act upon
 * @param xp The extended particle data to act upon
 * @param cosmo The current cosmological model.
 */
__attribute__((always_inline)) INLINE static void
pressure_floor_part_has_no_neighbours(struct part* restrict p,
                                      struct xpart* restrict xp,
                                      const struct cosmology* cosmo) {}

/**
 * @brief Sets the pressure_floor properties of the (x-)particles to a valid
 * start state.
 *
Loic Hausammann's avatar
Loic Hausammann committed
152
153
 * Nothing to do here.
 *
154
155
156
157
158
159
160
161
162
163
 * @param p Pointer to the particle data.
 * @param xp Pointer to the extended particle data.
 */
__attribute__((always_inline)) INLINE static void pressure_floor_init_part(
    struct part* restrict p, struct xpart* restrict xp) {}

/**
 * @brief Sets the pressure_floor properties of the (x-)particles to a valid
 * start state.
 *
Loic Hausammann's avatar
Loic Hausammann committed
164
165
 * Nothing to do here.
 *
166
167
168
169
170
171
 * @param phys_const The physical constant in internal units.
 * @param us The unit system.
 * @param cosmo The current cosmological model.
 * @param p Pointer to the particle data.
 * @param xp Pointer to the extended particle data.
 */
Loic Hausammann's avatar
Format    
Loic Hausammann committed
172
173
174
175
176
177
__attribute__((always_inline)) INLINE static void
pressure_floor_first_init_part(const struct phys_const* restrict phys_const,
                               const struct unit_system* restrict us,
                               const struct cosmology* restrict cosmo,
                               struct part* restrict p,
                               struct xpart* restrict xp) {}
178

Loic Hausammann's avatar
Loic Hausammann committed
179
#endif /* SWIFT_PRESSURE_FLOOR_NONE_H */