hydro_part.h 4.96 KB
Newer Older
 Matthieu Schaller committed Feb 13, 2016 1 2 /******************************************************************************* * This file is part of SWIFT.  3  * Copyright (c) 2016 Matthieu Schaller (matthieu.schaller@durham.ac.uk)  Matthieu Schaller committed Feb 13, 2016 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 . * ******************************************************************************/  Matthieu Schaller committed Aug 16, 2016 19 20 21 22 23 24 25 26 27 28 29 30 #ifndef SWIFT_MINIMAL_HYDRO_PART_H #define SWIFT_MINIMAL_HYDRO_PART_H /** * @file Minimal/hydro_part.h * @brief Minimal conservative implementation of SPH (Particle definition) * * The thermal variable is the internal energy (u). Simple constant * viscosity term without switches is implemented. No thermal conduction * term is implemented. * * This corresponds to equations (43), (44), (45), (101), (103) and (104) with  Matthieu Schaller committed Sep 08, 2016 31 32  * \f$\beta=3\f$ and \f$\alpha_u=0\f$ of Price, D., Journal of Computational * Physics, 2012, Volume 231, Issue 3, pp. 759-794.  Matthieu Schaller committed Aug 16, 2016 33  */  Matthieu Schaller committed Feb 13, 2016 34   Matthieu Schaller committed Jan 17, 2018 35 #include "chemistry_struct.h"  36 #include "cooling_struct.h"  37 #include "star_formation_struct.h"  Matthieu Schaller committed Dec 17, 2018 38 #include "tracers_struct.h"  39   40 41 42 43 44 45 46 /** * @brief Particle fields not needed during the SPH loops over neighbours. * * This structure contains the particle fields that are not used in the * density or force loops. Quantities should be used in the kick, drift and * potentially ghost tasks only. */  Matthieu Schaller committed Feb 13, 2016 47 48 struct xpart {  Matthieu Schaller committed Sep 08, 2016 49 50  /*! Offset between current position and position at last tree rebuild. */ float x_diff[3];  Matthieu Schaller committed Feb 13, 2016 51   Matthieu Schaller committed Apr 27, 2017 52 53 54  /*! Offset between the current position and position at the last sort. */ float x_diff_sort[3];  Matthieu Schaller committed Sep 08, 2016 55 56  /*! Velocity at the last full step. */ float v_full[3];  Matthieu Schaller committed Feb 13, 2016 57   Matthieu Schaller committed Feb 27, 2018 58 59 60  /*! Gravitational acceleration at the last full step. */ float a_grav[3];  Matthieu Schaller committed Jan 07, 2017 61 62 63  /*! Internal energy at the last full step. */ float u_full;  Matthieu Schaller committed Sep 08, 2016 64 65  /*! Additional data used to record cooling information */ struct cooling_xpart_data cooling_data;  66   Matthieu Schaller committed Dec 17, 2018 67 68 69  /* Additional data used by the tracers */ struct tracers_xpart_data tracers_data;  70 71 72  /* Additional data used by the tracers */ struct star_formation_xpart_data sf_data;  Matthieu Schaller committed Sep 08, 2016 73 } SWIFT_STRUCT_ALIGN;  Matthieu Schaller committed Feb 13, 2016 74   75 76 77 78 79 80 81 /** * @brief Particle fields for the SPH particles * * The density and force substructures are used to contain variables only used * within the density and force loops over neighbours. All more permanent * variables should be declared in the main part of the part structure, */  Matthieu Schaller committed Feb 13, 2016 82 83 struct part {  Matthieu Schaller committed Jan 07, 2017 84 85 86 87 88 89  /*! Particle unique ID. */ long long id; /*! Pointer to corresponding gravity part. */ struct gpart* gpart;  Matthieu Schaller committed Sep 08, 2016 90 91  /*! Particle position. */ double x[3];  Matthieu Schaller committed Feb 13, 2016 92   Matthieu Schaller committed Sep 08, 2016 93 94  /*! Particle predicted velocity. */ float v[3];  Matthieu Schaller committed Feb 13, 2016 95   Matthieu Schaller committed Sep 08, 2016 96 97  /*! Particle acceleration. */ float a_hydro[3];  Matthieu Schaller committed Feb 13, 2016 98   Matthieu Schaller committed Sep 08, 2016 99 100  /*! Particle mass. */ float mass;  Matthieu Schaller committed Feb 14, 2016 101   Matthieu Schaller committed Sep 08, 2016 102 103  /*! Particle smoothing length. */ float h;  Matthieu Schaller committed Feb 13, 2016 104   Matthieu Schaller committed Sep 08, 2016 105 106  /*! Particle internal energy. */ float u;  Matthieu Schaller committed Feb 13, 2016 107   Matthieu Schaller committed Sep 08, 2016 108 109  /*! Time derivative of the internal energy. */ float u_dt;  Matthieu Schaller committed Feb 14, 2016 110   Matthieu Schaller committed Sep 08, 2016 111 112  /*! Particle density. */ float rho;  Matthieu Schaller committed Feb 13, 2016 113 114  /* Store density/force specific stuff. */  Matthieu Schaller committed Feb 14, 2016 115  union {  Matthieu Schaller committed Feb 13, 2016 116   117 118 119 120 121 122 123  /** * @brief Structure for the variables only used in the density loop over * neighbours. * * Quantities in this sub-structure should only be accessed in the density * loop over neighbours and the ghost task. */  Matthieu Schaller committed Feb 14, 2016 124  struct {  Matthieu Schaller committed Feb 13, 2016 125   Matthieu Schaller committed Sep 08, 2016 126 127 128 129 130  /*! Neighbour number count. */ float wcount; /*! Derivative of the neighbour number with respect to h. */ float wcount_dh;  Matthieu Schaller committed Feb 13, 2016 131   Matthieu Schaller committed Sep 14, 2016 132 133 134  /*! Derivative of density with respect to h */ float rho_dh;  Josh Borrow committed Oct 15, 2018 135 136 137 138 139 140  /*! Velocity divergence */ float div_v; /*! Velocity curl */ float rot_v[3];  Matthieu Schaller committed Feb 14, 2016 141  } density;  Matthieu Schaller committed Feb 13, 2016 142   143 144 145 146 147  /** * @brief Structure for the variables only used in the force loop over * neighbours. * * Quantities in this sub-structure should only be accessed in the force  Matthieu Schaller committed Jul 21, 2016 148  * loop over neighbours and the ghost, drift and kick tasks.  149  */  Matthieu Schaller committed Feb 14, 2016 150  struct {  Matthieu Schaller committed Feb 13, 2016 151   Matthieu Schaller committed Sep 14, 2016 152 153 154  /*! "Grad h" term */ float f;  Matthieu Schaller committed Sep 08, 2016 155 156  /*! Particle pressure. */ float pressure;  Matthieu Schaller committed Feb 13, 2016 157   158 159 160  /*! Particle soundspeed. */ float soundspeed;  Matthieu Schaller committed Sep 08, 2016 161 162  /*! Particle signal velocity */ float v_sig;  Matthieu Schaller committed Feb 13, 2016 163   Matthieu Schaller committed Sep 08, 2016 164 165  /*! Time derivative of smoothing length */ float h_dt;  Matthieu Schaller committed Jul 21, 2016 166   Josh Borrow committed Oct 15, 2018 167 168 169  /*! Balsara switch */ float balsara;  Matthieu Schaller committed Feb 14, 2016 170 171  } force; };  Matthieu Schaller committed Feb 13, 2016 172   Matthieu Schaller committed Jan 17, 2018 173 174 175  /* Chemistry information */ struct chemistry_part_data chemistry_data;  Matthieu Schaller committed Jan 07, 2017 176 177  /*! Time-step length */ timebin_t time_bin;  Matthieu Schaller committed Feb 13, 2016 178   Matthieu Schaller committed Dec 17, 2018 179  /* Need waking-up ? */  Josh Borrow committed Feb 07, 2019 180  timebin_t wakeup;  Matthieu Schaller committed Dec 17, 2018 181   Matthieu Schaller committed Jan 07, 2017 182 183 184 185 186 187 188 189 190 #ifdef SWIFT_DEBUG_CHECKS /* Time of the last drift */ integertime_t ti_drift; /* Time of the last kick */ integertime_t ti_kick; #endif  Matthieu Schaller committed Feb 13, 2016 191   Matthieu Schaller committed Sep 08, 2016 192 } SWIFT_STRUCT_ALIGN;  Matthieu Schaller committed Aug 16, 2016 193 194  #endif /* SWIFT_MINIMAL_HYDRO_PART_H */