1 #pragma once 2 3 /// \file QuantityIds.h 4 /// \brief Quantity identifiers 5 /// \author Pavel Sevecek (sevecek at sirrah.troja.mff.cuni.cz) 6 /// \date 2016-2021 7 8 #include "objects/containers/String.h" 9 #include "physics/Units.h" 10 #include "quantities/QuantityHelpers.h" 11 12 NAMESPACE_SPH_BEGIN 13 14 /// \brief Unique IDs of basic quantities of SPH particles. 15 /// 16 /// Values of quantity IDs cannot be changed in order to allow opening older binary files (using \ref 17 /// BinaryOutput)! New quantities can be added if they get a unique ID, quantities that are no longer used can 18 /// be removed; removed IDs can then be reused again. 19 enum class QuantityId { 20 /// \name Common quantities 21 ///@{ 22 23 /// Positions (velocities, accelerations) of particles, always a vector quantity, 24 POSITION = 0, 25 26 /// Paricles masses, always a scalar quantity. 27 MASS = 1, 28 29 /// Pressure, affected by yielding and fragmentation model, always a scalar quantity. 30 PRESSURE = 2, 31 32 /// Density, always a scalar quantity. 33 DENSITY = 3, 34 35 /// Specific internal energy, always a scalar quantity. 36 ENERGY = 4, 37 38 /// Sound speed, always a scalar quantity. 39 SOUND_SPEED = 5, 40 41 /// Deviatoric stress tensor, always a traceless tensor. 42 DEVIATORIC_STRESS = 6, 43 44 /// Specific entropy, always a scalar quantity. 45 SPECIFIC_ENTROPY = 7, 46 47 /// Temperature, always a scalar quantity 48 TEMPERATURE = 46, 49 50 ///@} 51 52 /// \name Density-independent SPH formulation 53 ///@{ 54 55 /// The "Y" quantity defined by \cite Hosono_2016, used to compute equation of motion and energy in DISPH. 56 GENERALIZED_ENERGY = 8, 57 58 /// \todo 59 GENERALIZED_PRESSURE = 9, 60 61 ///@} 62 63 /// \name Damage and fragmentation model (see Benz & Asphaug, 1994) 64 ///@{ 65 66 /// Damage 67 DAMAGE = 10, 68 69 /// Activation strait rate 70 EPS_MIN = 11, 71 72 /// Coefficient M_0 of the stretched Weibull distribution 73 M_ZERO = 12, 74 75 /// Explicit growth of fractures 76 EXPLICIT_GROWTH = 13, 77 78 /// Number of explicit flaws per particle 79 N_FLAWS = 14, 80 81 /// Total stress reduction factor due to damage and yielding. Is always scalar. 82 STRESS_REDUCING = 16, 83 84 /// Ratio of the solid and bulk density (parameter alpha in P-alpha and eps-alpha models). 85 DISTENTION = 17, 86 87 /// Vibrational particle velocity, used by the block model of acoustic fluidization. 88 VIBRATIONAL_VELOCITY = 47, 89 90 ///@} 91 92 /// \name N-body & Solid sphere physics 93 ///@{ 94 95 /// Index of the aggregate containing this particle. 96 AGGREGATE_ID = 19, 97 98 /// Angular frequency of particles. Note that SPH particles in standard formulation have no angular 99 /// frequency, this quantity is used by solid sphere solvers or by SPH modifications that include particle 100 /// rotation. 101 ANGULAR_FREQUENCY = 20, 102 103 /// Angular momentum of particles. Useful replacement of angular velocity quantity as angular momentum is 104 /// always conserved. 105 ANGULAR_MOMENTUM = 21, 106 107 /// Current rotation state of the particles. This is only needed for testing purposes, as SPH particles 108 /// are spherically symmetric. 109 PHASE_ANGLE = 22, 110 111 /// Moment of inertia of particles, analogy of particle masses for rotation 112 MOMENT_OF_INERTIA = 23, 113 114 /// Local coordinates of a particle; moment of inertia is typically expressed in these coordinates. 115 LOCAL_FRAME = 24, 116 117 118 ///@} 119 120 /// \name Stress-strain analysis 121 ///@{ 122 123 /// Displacement vector, a solution of the stress analysis 124 DISPLACEMENT = 25, 125 126 ///@} 127 128 /// \name Intermediate quantities 129 ///@{ 130 131 /// Velocity gradient 132 VELOCITY_GRADIENT = 26, 133 134 /// Velocity divergence 135 VELOCITY_DIVERGENCE = 27, 136 137 /// Velocity rotation 138 VELOCITY_ROTATION = 28, 139 140 /// Correction tensor used to improve conservation of total angular momentum 141 STRAIN_RATE_CORRECTION_TENSOR = 29, 142 143 /// Laplacian of internal energy, used in heat diffusion equation 144 ENERGY_LAPLACIAN = 30, 145 146 ///@} 147 148 /// \name Artificial velocity 149 ///@{ 150 151 /// Coefficient alpha of the artificial viscosity. Coefficient beta is always 2*alpha. 152 AV_ALPHA = 31, 153 154 /// Balsara factor 155 AV_BALSARA = 33, 156 157 /// Artificial stress by Monaghan \cite Monaghan_1999 158 AV_STRESS = 34, 159 160 /// Auxiliary quantity needed for evaluating artificial stress 161 INTERPARTICLE_SPACING_KERNEL = 35, 162 163 ///@} 164 165 /// \name SPH modifications & corrections 166 ///@{ 167 168 /// Grad-h terms, appear in self-consistent derivation of SPH equatios due to non-uniform smoothing 169 /// lenghts. 170 GRAD_H = 36, 171 172 /// XSPH corrections to velocity. Only modifies evolution equation for particle position, velocity (as an 173 /// input for velocity divergence, ...) is NOT affected. 174 XSPH_VELOCITIES = 37, 175 176 DELTASPH_DENSITY_GRADIENT = 45, 177 178 ///@} 179 180 /// \name SPH statistics & auxiliary data 181 ///@{ 182 183 /// Number of neighboring particles (in radius h * kernel.radius) 184 NEIGHBOR_CNT = 38, 185 186 /// Vector approximating surface normal 187 SURFACE_NORMAL = 39, 188 189 /// Initial position of particles, kept constant during the run 190 INITIAL_POSITION = 40, 191 192 /// Smoothing lengths of particles. Note that ordinarily the smoothing lenghts are stored as 4th component 193 /// of position vectors, so this ID cannot be used to obtain smoothing lenghts from Storage object. It can 194 /// be useful for other uses of quantities, like data output, visualization etc. 195 SMOOTHING_LENGTH = 41, 196 197 ///@} 198 199 /// \name Particle flags & Materials 200 ///@{ 201 202 /// ID of original body, used to implement discontinuities between bodies in SPH 203 FLAG = 42, 204 205 /// Index of material of the particle. Can be generally different than the flag value. 206 MATERIAL_ID = 43, 207 208 /// Persistent index of the particle that does not change when adding or removing particles in the 209 /// storage. Useful when we need to track particle with given index; particle index in storage may change 210 /// when some particles from the middle of the storage are removed. Indices of removed particles are made 211 /// available again and can be reused by newly created particles. 212 PERSISTENT_INDEX = 44, 213 214 ///@} 215 216 /// \name Miscellaneous 217 ///@{ 218 219 /// Texture mapping coordinates, 220 UVW = 1000, 221 222 ///@} 223 224 // TEMPORARY QUANTITIES, TO BE REMOVED 225 226 VELOCITY_LAPLACIAN = 100, 227 228 VELOCITY_GRADIENT_OF_DIVERGENCE = 101, 229 230 FRICTION = 102, 231 232 233 }; 234 235 /// \brief Auxiliary information about quantity that aren't stored directly in \ref Quantity 236 struct QuantityMetadata { 237 238 /// \brief Full name of the quantity (i.e. 'Density', 'Deviatoric stress', ...) 239 String quantityName; 240 241 /// \brief Name of the 1st derivative. 242 /// 243 /// Usually it's just quantityName + 'derivative', but not always (for example 'Velocity' instead of 244 /// 'Position derivative') 245 String derivativeName; 246 247 /// \brief Name of the second derivative. 248 /// 249 /// Usually it's just quantityName + '2nd derivative' 250 String secondDerivativeName; 251 252 /// \brief Short designation of the quantity (i.e. 'rho', 's', ...). 253 String label; 254 255 /// \todo Units & dimensional analysis ! 256 257 /// \brief Variable expectedType contains a type the quantity will most likely have. 258 /// 259 /// The code does not assign fixed types to quantities, i.e. it's possible to create a tensor quantity 260 /// QuantityId::DENSITY. This allows to use different modifications of SPH (tensor artificial viscosity, 261 /// etc.), even though most quantities have only one type in any meaningful SPH simulation (density will 262 /// always be scalar, for example). 263 ValueEnum expectedType; 264 265 UnitDimensions expectedUnit = BasicDimension::LENGTH; 266 267 QuantityMetadata(const String& fullName, 268 const String& label, 269 const ValueEnum type, 270 const String& derivativeName = "", 271 const String& secondDerivativeName = ""); 272 }; 273 274 /// \brief Returns the quantity information using quantity ID. 275 QuantityMetadata getMetadata(const QuantityId key); 276 277 /// \brief Print full quantity name into the stream. 278 template <typename TStream> 279 INLINE TStream& operator<<(TStream& stream, const QuantityId key) { 280 stream << getMetadata(key).quantityName; 281 return stream; 282 } 283 284 NAMESPACE_SPH_END 285