hydro_part.h 4.43 KB
Newer Older
1
2
/*******************************************************************************
 * This file is part of SWIFT.
3
 * Coypright (c) 2014 Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
 *
 * 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
21
22
#ifndef SWIFT_GIZMO_HYDRO_PART_H
#define SWIFT_GIZMO_HYDRO_PART_H

#include "cooling_struct.h"
23
24
25
26

/* Extra particle data not needed during the computation. */
struct xpart {

27
28
  /* Offset between current position and position at last tree rebuild. */
  float x_diff[3];
29
30
31

  /* Velocity at the last full step. */
  float v_full[3];
32

33
34
35
  /* Additional data used to record cooling information */
  struct cooling_xpart_data cooling_data;

36
} SWIFT_STRUCT_ALIGN;
37
38
39
40
41
42
43

/* Data of a single particle. */
struct part {

  /* Particle position. */
  double x[3];

44
  /* Particle predicted velocity. */
45
46
47
48
49
  float v[3];

  /* Particle acceleration. */
  float a_hydro[3];

50
  /* Particle smoothing length. */
51
52
53
54
55
56
57
58
  float h;

  /* Particle time of beginning of time-step. */
  int ti_begin;

  /* Particle time of end of time-step. */
  int ti_end;

59
60
61
  /* Old internal energy flux */
  float du_dt;

62
  /* The primitive hydrodynamical variables. */
63
64
  struct {

65
66
    /* Fluid velocity. */
    float v[3];
67

68
69
    /* Density. */
    float rho;
70

71
72
    /* Pressure. */
    float P;
73

74
    /* Gradients of the primitive variables. */
75
76
    struct {

77
78
      /* Density gradients. */
      float rho[3];
79

80
81
      /* Fluid velocity gradients. */
      float v[3][3];
82

83
84
      /* Pressure gradients. */
      float P[3];
85
86
87

    } gradients;

88
    /* Quantities needed by the slope limiter. */
89
90
    struct {

91
92
      /* Extreme values of the density among the neighbours. */
      float rho[2];
93

94
95
      /* Extreme values of the fluid velocity among the neighbours. */
      float v[3][2];
96

97
98
      /* Extreme values of the pressure among the neighbours. */
      float P[2];
99

100
      /* Maximal distance to all neighbouring faces. */
101
102
103
104
105
106
      float maxr;

    } limiter;

  } primitives;

107
  /* The conserved hydrodynamical variables. */
108
109
  struct {

110
111
    /* Fluid momentum. */
    float momentum[3];
112

113
    /* Fluid mass */
114
    float mass;
115

116
    /* Fluid thermal energy (not per unit mass!). */
117
    float energy;
118

119
120
121
122
123
124
125
126
127
128
129
130
131
132
    /* Fluxes. */
    struct {

      /* Mass flux. */
      float mass;

      /* Momentum flux. */
      float momentum[3];

      /* Energy flux. */
      float energy;

    } flux;

133
134
  } conserved;

135
  /* Geometrical quantities used for hydro. */
136
137
  struct {

138
    /* Volume of the particle. */
139
140
    float volume;

141
142
    /* Geometrical shear matrix used to calculate second order accurate
       gradients */
143
144
145
146
    float matrix_E[3][3];

  } geometry;

147
  /* Variables used for timestep calculation (currently not used). */
148
149
  struct {

150
    /* Maximum fluid velocity among all neighbours. */
151
152
153
154
    float vmax;

  } timestepvars;

155
  /* Quantities used during the volume (=density) loop. */
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
  struct {

    /* Particle velocity divergence. */
    float div_v;

    /* Derivative of particle number density. */
    float wcount_dh;

    /* Particle velocity curl. */
    float curl_v[3];

    /* Particle number density. */
    float wcount;

  } density;

172
173
174
  /* Quantities used during the force loop. */
  struct {

175
    /* Needed to drift the primitive variables. */
176
177
178
179
180
    float h_dt;

    /* Physical time step of the particle. */
    float dt;

Bert Vandenbroucke's avatar
Bert Vandenbroucke committed
181
182
183
    /* Actual velocity of the particle. */
    float v_full[3];

184
185
  } force;

186
187
188
189
190
191
192
193
194
195
196
197
198
199
  /* Specific stuff for the gravity-hydro coupling. */
  struct {

    /* Previous value of the gravitational acceleration. */
    float old_a[3];

    /* Previous value of the mass flux vector. */
    float old_mflux[3];

    /* Current value of the mass flux vector. */
    float mflux[3];

  } gravity;

200
  /* Particle ID. */
201
  long long id;
202
203
204
205

  /* Associated gravitas. */
  struct gpart *gpart;

206
207
208
} SWIFT_STRUCT_ALIGN;

#endif /* SWIFT_GIZMO_HYDRO_PART_H */