datatypes.h - sphere - GPU-based 3D discrete element method algorithm with optional fluid coupling
HTML git clone git://src.adamsgaard.dk/sphere
DIR Log
DIR Files
DIR Refs
DIR LICENSE
---
datatypes.h (9565B)
---
1 // Avoiding multiple inclusions of header file
2 #ifndef DATATYPES_H_
3 #define DATATYPES_H_
4
5 #include <math.h>
6 #ifdef SPHERE_GPU
7 #include "vector_functions.h"
8 #endif
9 #include "typedefs.h"
10 #include "constants.h"
11
12
13 ////////////////////////////
14 // STRUCTURE DECLARATIONS //
15 ////////////////////////////
16
17 // Structure containing kinematic particle values
18 struct Kinematics {
19 Float4 *x; // Positions + radii (w)
20 Float4 *xyzsum; // Horizontal distance traveled
21 Float4 *vel; // Translational velocities + fixvels (w)
22 Float4 *acc; // Translational accelerations
23 Float4 *force; // Sums of forces
24 Float4 *angpos; // Angular positions
25 Float4 *angvel; // Angular velocities
26 Float4 *angacc; // Angular accelerations
27 Float4 *torque; // Sums of torques
28 unsigned int *contacts; // List of contacts per particle
29 Float4 *distmod; // Distance modifiers across periodic boundaries
30 Float4 *delta_t; // Accumulated shear distance of contacts
31 uint2 *bonds; // Particle bond pairs
32 Float4 *bonds_delta; // Particle bond displacement
33 Float4 *bonds_omega; // Particle bond rotation
34 int *color; // Color index for visualization
35 };
36
37 // Structure containing individual particle energies
38 struct Energies {
39 Float *es_dot; // Frictional dissipation rates
40 Float *es; // Frictional dissipations
41 Float *ev_dot; // Viscous dissipation rates
42 Float *ev; // Viscous dissipations
43 Float *p; // Pressures
44 };
45
46 // Structure containing grid parameters
47 struct Grid {
48 Float origo[ND]; // World coordinate system origo
49 Float L[ND]; // World dimensions
50 unsigned int num[ND]; // Neighbor-search cells along each axis
51 int periodic; // Behavior of boundaries at 1st and 2nd world edge
52 int adaptive; // Continuously rescale grid size to wall positions
53 };
54
55 struct Sorting {
56 Float4 *x_sorted; // Positions + radii (w) (sorted)
57 Float4 *vel_sorted; // Velocities + fixvels (w) (sorted)
58 Float4 *angvel_sorted; // Angular velocities (sorted)
59 unsigned int *gridParticleCellID; // Hash key (cell idx) in grid
60 unsigned int *gridParticleIndex; // Original indexes of particles
61 unsigned int *cellStart; // First index of sorted idx'es in cells
62 unsigned int *cellEnd; // Last index of sorted idx'es in cells
63 };
64
65
66 // Structure containing time parameters
67 struct Time {
68 Float dt; // Computational time step length
69 double current; // Current time
70 double total; // Total time (at the end of experiment)
71 Float file_dt; // Time between output files
72 unsigned int step_count; // Number of output files written
73 };
74
75 // Structure containing constant, global physical parameters
76 struct Params {
77 Float g[ND]; // Gravitational acceleration
78 Float k_n; // Normal stiffness
79 Float k_t; // Tangential stiffness
80 Float k_r; // Rotational stiffness
81 Float E; // Young's modulus
82 Float gamma_n; // Normal viscosity
83 Float gamma_t; // Tangential viscosity
84 Float gamma_r; // Rotational viscosity
85 Float mu_s; // Static friction coefficient
86 Float mu_d; // Dynamic friction coefficient
87 Float mu_r; // Rotational friction coefficient
88 Float gamma_wn; // Wall normal viscosity
89 Float gamma_wt; // Wall tangential viscosity
90 Float mu_ws; // Wall static friction coefficient
91 Float mu_wd; // Wall dynamic friction coefficient
92 Float rho; // Material density
93 unsigned int contactmodel; // Inter-particle contact model
94 Float kappa; // Capillary bond prefactor
95 Float db; // Capillary bond debonding distance
96 Float V_b; // Volume of fluid in capillary bond
97 Float lambda_bar; // Radius multiplier to parallel-bond radii
98 unsigned int nb0; // Number of inter-particle bonds at t=0
99 Float sigma_b; // Bond tensile strength
100 Float tau_b; // Bond shear strength
101 Float sigma0_A; // Amplitude of modulations in normal stress
102 Float sigma0_f; // Frequency of modulations in normal stress
103 };
104
105 // Structure containing wall parameters
106 struct Walls {
107 unsigned int nw; // Number of walls (<= MAXWALLS)
108 int wmode[MAXWALLS]; // Wall modes
109 Float4* nx; // Wall normal and position
110 Float4* mvfd; // Wall mass, velocity, force and normal stress
111 Float* tau_x; // Wall shear stress
112 };
113
114 // Structures containing fluid parameters
115 struct NavierStokes {
116 int nx, ny, nz; // Number of cells in each dim
117 Float dx, dy, dz; // Cell length in each dim
118 Float* p; // Cell hydraulic pressures
119 Float3* v; // Cell fluid velocity
120 Float* v_x; // Fluid velocity in staggered grid
121 Float* v_y; // Fluid velocity in staggered grid
122 Float* v_z; // Fluid velocity in staggered grid
123 //Float3* v_p; // Predicted fluid velocity
124 //Float* v_p_x; // Predicted fluid velocity in staggered grid
125 //Float* v_p_y; // Predicted fluid velocity in staggered grid
126 //Float* v_p_z; // Predicted fluid velocity in staggered grid
127 Float* phi; // Cell porosity
128 Float* dphi; // Cell porosity change
129 Float* norm; // Normalized residual of epsilon updates
130 Float* epsilon; // Iterative solution parameter
131 Float* epsilon_new; // Updated value of iterative solution parameter
132 Float p_mod_A; // Pressure modulation amplitude at top
133 Float p_mod_f; // Pressure modulation frequency at top
134 Float p_mod_phi; // Pressure modulation phase at top
135 int bc_bot; // 0: Dirichlet, 1: Neumann, 3: Periodic, 4: Flux
136 int bc_top; // 0: Dirichlet, 1: Neumann, 3: Periodic, 4: Flux
137 int free_slip_bot; // 0: no, 1: yes
138 int free_slip_top; // 0: no, 1: yes
139 Float bc_bot_flux; // Flux normal to boundary
140 Float bc_top_flux; // Flux normal to boundary
141 int* p_constant; // Keep pressure in cell constant (0: False, 1:True)
142 Float gamma; // Solver parameter: Smoothing
143 Float theta; // Solver parameter: Under-relaxation
144 Float beta; // Solver parameter: Solution method
145 Float tolerance; // Solver parameter: Max residual tolerance
146 unsigned int maxiter; // Solver parameter: Max iterations to perform
147 unsigned int ndem; // Solver parameter: DEM time steps per CFD step
148 Float c_phi; // Porosity scaling coefficient
149 Float c_v; // Fluid velocity scaling coefficient
150 Float dt_dem_fac; // DEM-CFD time scaling coefficient
151 Float4* f_d; // Drag force on particles
152 Float4* f_p; // Pressure force on particles
153 Float4* f_v; // Viscous force on particles
154 Float4* f_sum; // Viscous force on particles
155 Float mu; // Fluid dynamic viscosity
156 Float rho_f; // Fluid density
157 };
158
159 struct Darcy {
160 int nx, ny, nz; // Number of cells in each dimension
161 Float dx, dy, dz; // Cell length in each dim
162 Float* p; // Cell hydraulic pressures
163 Float3* v; // Cell fluid velocity
164 Float* k; // Cell hydraulic permeability
165 Float* phi; // Cell porosity
166 Float* dphi; // Cell porosity change
167 Float* norm; // Normalized residual of epsilon updates
168 Float p_top_orig; // Pressure at top boundary at t=0
169 Float p_mod_A; // Pressure modulation amplitude at top
170 Float p_mod_f; // Pressure modulation frequency at top
171 Float p_mod_phi; // Pressure modulation phase at top
172 int bc_xn; // 0: Dirichlet, 1: Neumann, 3: Periodic
173 int bc_xp; // 0: Dirichlet, 1: Neumann, 3: Periodic
174 int bc_yn; // 0: Dirichlet, 1: Neumann, 3: Periodic
175 int bc_yp; // 0: Dirichlet, 1: Neumann, 3: Periodic
176 int bc_bot; // 0: Dirichlet, 1: Neumann
177 int bc_top; // 0: Dirichlet, 1: Neumann
178 int free_slip_bot; // 0: no, 1: yes
179 int free_slip_top; // 0: no, 1: yes
180 Float bc_bot_flux; // Flux normal to boundary
181 Float bc_top_flux; // Flux normal to boundary
182 int* p_constant; // Keep pressure in cell constant (0: False, 1:True)
183 Float tolerance; // Solver parameter: Max residual tolerance
184 unsigned int maxiter; // Solver parameter: Max iterations to perform
185 unsigned int ndem; // Solver parameter: DEM time steps per CFD step
186 Float c_phi; // Porosity scaling coefficient
187 Float4* f_p; // Pressure force on particles
188 Float beta_f; // Adiabatic fluid compressibility
189 Float k_c; // Permeability prefactor in Kozeny-Carman eq.
190 Float mu; // Fluid dynamic viscosity
191 Float rho_f; // Fluid density
192 };
193
194 // Image structure
195 struct rgba {
196 unsigned char r; // Red
197 unsigned char g; // Green
198 unsigned char b; // Blue
199 unsigned char a; // Alpha
200 };
201
202 #endif
203 // vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4