tgrain.h - granular - granular dynamics simulation (HTM) git clone git://src.adamsgaard.dk/granular (DIR) Log (DIR) Files (DIR) Refs (DIR) README (DIR) LICENSE --- tgrain.h (1776B) --- 1 #ifndef GRANULAR_GRAIN_ 2 #define GRANULAR_GRAIN_ 3 4 #include <stdio.h> 5 #include "contact.h" 6 7 #define MAXCONTACTS 32 8 9 struct grain { 10 11 double diameter; 12 double pos[3]; 13 double vel[3]; 14 double acc[3]; 15 int acc_lock[3]; 16 double force[3]; 17 double angpos[3]; 18 double angvel[3]; 19 double angacc[3]; 20 double torque[3]; 21 double disp[3]; 22 double forceext[3]; 23 double density; 24 int fixed; 25 int rotating; 26 int enabled; 27 double youngs_modulus; 28 double poissons_ratio; 29 double friction_coeff; 30 double damping_n; 31 double damping_t; 32 double tensile_strength; 33 double shear_strength; 34 double fracture_toughness; 35 size_t gridpos[3]; 36 size_t ncontacts; 37 struct contact contacts[MAXCONTACTS]; 38 double contact_stress[3]; 39 double thermal_energy; 40 int color; 41 }; 42 43 struct grain grain_new(void); 44 void grain_defaults(struct grain *g); 45 46 void grain_print(FILE *stream, const struct grain *g); 47 struct grain * grain_read(char *line); 48 49 int grain_check_values(const struct grain *g); 50 51 double grain_volume(const struct grain *g); 52 double grain_mass(const struct grain *g); 53 double grain_moment_of_inertia(const struct grain *g); 54 void grain_zero_kinematics(struct grain *g); 55 void grain_force_reset(struct grain *g); 56 double grain_translational_kinetic_energy(const struct grain *g); 57 double grain_rotational_kinetic_energy(const struct grain *g); 58 double grain_kinetic_energy(const struct grain *g); 59 double grain_thermal_energy(const struct grain *g); 60 void grain_temporal_integration(struct grain *g, double dt); 61 62 void grain_register_contact(struct grain *g, size_t i, size_t j, 63 double centerdist[3], double overlap); 64 65 double grain_stiffness_normal(const struct grain *g); 66 double grain_stiffness_tangential(const struct grain *g); 67 double grain_collision_time(const struct grain *g); 68 69 #endif