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