hydro_part.h 4.64 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*******************************************************************************
 * This file is part of SWIFT.
 * Coypright (c) 2012 Pedro Gonnet (pedro.gonnet@durham.ac.uk)
 *                    Matthieu Schaller (matthieu.schaller@durham.ac.uk)
 *                    Bert Vandenbroucke (bert.vandenbroucke@ugent.be)
 *
 * 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/>.
 *
 ******************************************************************************/

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

25
26
  /* Offset between current position and position at last tree rebuild. */
  float x_diff[3];
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41

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

  /* Old density. */
  float omega;

} __attribute__((aligned(xpart_align)));

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

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

42
  /* Particle predicted velocity. */
43
44
45
46
47
48
49
50
51
52
53
54
55
56
  float v[3];

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

  /* Particle cutoff radius. */
  float h;

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

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

57
  /* The primitive hydrodynamical variables. */
58
59
  struct {

60
61
    /* Fluid velocity. */
    float v[3];
62

63
64
    /* Density. */
    float rho;
65

66
67
    /* Pressure. */
    float P;
68

69
    /* Gradients of the primitive variables. */
70
71
    struct {

72
73
      /* Density gradients. */
      float rho[3];
74

75
76
      /* Fluid velocity gradients. */
      float v[3][3];
77

78
79
      /* Pressure gradients. */
      float P[3];
80
81
82

    } gradients;

83
    /* Quantities needed by the slope limiter. */
84
85
    struct {

86
87
      /* Extreme values of the density among the neighbours. */
      float rho[2];
88

89
90
      /* Extreme values of the fluid velocity among the neighbours. */
      float v[3][2];
91

92
93
      /* Extreme values of the pressure among the neighbours. */
      float P[2];
94

95
      /* Maximal distance to all neighbouring faces. */
96
97
98
99
100
101
      float maxr;

    } limiter;

  } primitives;

102
  /* The conserved hydrodynamical variables. */
103
104
  struct {

105
106
    /* Fluid momentum. */
    float momentum[3];
107

108
109
    /* Fluid mass (this field already exists outside of this struct as well). */
    float mass;
110

111
    /* Fluid thermal energy (not per unit mass!). */
112
    float energy;
113

114
115
116
117
118
119
120
121
122
123
124
125
126
127
    /* Fluxes. */
    struct {

      /* Mass flux. */
      float mass;

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

      /* Energy flux. */
      float energy;

    } flux;

128
129
  } conserved;

130
  /* Geometrical quantities used for hydro. */
131
132
  struct {

133
    /* Volume of the particle. */
134
135
    float volume;

136
137
    /* Geometrical shear matrix used to calculate second order accurate
       gradients */
138
139
140
141
    float matrix_E[3][3];

  } geometry;

142
  /* Variables used for timestep calculation (currently not used). */
143
144
  struct {

145
    /* Maximum fluid velocity among all neighbours. */
146
147
148
149
    float vmax;

  } timestepvars;

150
  /* Quantities used during the volume (=density) loop. */
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
  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;

167
168
169
  /* Quantities used during the force loop. */
  struct {

170
    /* Needed to drift the primitive variables. */
171
172
173
174
175
    float h_dt;

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

Bert Vandenbroucke's avatar
Bert Vandenbroucke committed
176
177
178
    /* Actual velocity of the particle. */
    float v_full[3];

179
180
  } force;

181
182
183
184
185
186
187
188
189
190
191
192
193
194
  /* 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;

195
196
197
  /* Particle mass (this field is also part of the conserved quantities...). */
  float mass;

198
  /* Particle ID. */
199
  long long id;
200
201
202
203

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

204
205
206
  /* Variables needed for the code to compile (should be removed/replaced). */
  float rho;

207
208
209
  /* Old internal energy flux */
  float du_dt;

210
} __attribute__((aligned(part_align)));