1 // =============================================================================
2 // PROJECT CHRONO - http://projectchrono.org
3 //
4 // Copyright (c) 2014 projectchrono.org
5 // All rights reserved.
6 //
7 // Use of this source code is governed by a BSD-style license that can be found
8 // in the LICENSE file at the top level of the distribution and at
9 // http://projectchrono.org/license-chrono.txt.
10 //
11 // =============================================================================
12 // Author:Arman Pazouki, Milad Rakhsha, Wei Hu
13 // =============================================================================
14 //
15 // Structure to hold the simulation parameters.
16 //
17 // For more informaiton about these parameters see the following:
18 //
19 // - Using a half-implicit integration scheme for the SPH-based solution of
20 //   fluid-solid interaction problems,
21 //   Milad Rakhsha, Arman Pazouki, Radu Serban, Dan Negrut,
22 //   Computer Methods in Applied Mechanics and Engineering
23 //
24 // - A Consistent Multi-Resolution Smoothed Particle Hydrodynamics Method,
25 //   Wei Hu, Wenxiao Pan, Milad Rakhsha, Qiang Tian, Haiyan Hu, Dan Negrut,
26 //   Computer Methods in Applied Mechanics and Engineering, 2018
27 // =============================================================================
28 
29 #ifndef CH_FSI_PARAMS_H
30 #define CH_FSI_PARAMS_H
31 
32 #include <ctime>
33 #include "chrono_fsi/math/ChFsiLinearSolver.h"
34 #include "chrono_fsi/math/custom_math.h"
35 
36 namespace chrono {
37 namespace fsi {
38 
39 /// @addtogroup fsi_physics
40 /// @{
41 
42 /// Approach to handle BCE particles
43 enum class BceVersion { ADAMI = 0, mORIGINAL = 1 };
44 
45 /// PPE_SolutionType
46 enum class PPE_SolutionType { MATRIX_FREE, FORM_SPARSE_MATRIX };
47 
48 /// Rheology type
49 enum class rheology { Inertia_rheology, nonlocal_fluidity };
50 
51 /// Friction law in ISPH
52 enum class friction_law { constant, linear, nonlinear };
53 
54 /// Dynamics solver type for fluid/granular
55 enum class fluid_dynamics { IISPH, I2SPH, WCSPH };
56 
57 /// Structure with FSI simulation parameters.
58 struct SimParams {
59     fluid_dynamics fluid_dynamic_type;  ///< Type of SPH mehtod (WCSPH, IISPH, or I2SPH)
60     char out_name[256]; ///< Name of the output directory.
61     char demo_dir[2048]; ///< Demo output directory.
62 
63     int3 gridSize;        ///< dx, dy, dz distances between particle centers.
64     Real3 worldOrigin;    ///< Origin point.
65     Real3 cellSize;       ///< Size of the neighbor particle searching cell.
66     uint numBodies;       ///< Number of FSI bodies.
67     Real3 boxDims;        ///< Dimensions of the domain. How big is the box that the domain is in.
68     Real HSML;            ///< Interaction Radius (or h)
69     Real INVHSML;         ///< 1.0/h
70     Real MULT_INITSPACE;  ///< Multiplier to hsml to determine the initial separation of the fluid particles and the
71                           ///< fixed separation for the boundary particles. This means that the separation will always
72                           ///< be a multiple of hsml. Default value = 1.0.
73     Real MULT_INITSPACE_Cables; ///< Multiplier to hsml in cable elements.
74     Real MULT_INITSPACE_Shells; ///< Multiplier to hsml in shell elements.
75     int num_neighbors; ///< Number of neighbor particles.
76     Real epsMinMarkersDis;    ///< epsilon mult for minimum distance between markers (d_min = eps * HSML)
77     int NUM_BOUNDARY_LAYERS;  ///< Number of particles layers that will be used in the boundary. Default value = 3.
78     Real toleranceZone;  ///< Helps determine the particles that are in the domain but are outside the boundaries, so
79                          ///< they are not considered fluid particles and are dropped at the beginning of the simulation.
80     int NUM_BCE_LAYERS; ///< Number of fixed particle layers to rigid/flexible bodies which act as the boundaries.
81                         ///< Default value = 2.
82 
83     Real BASEPRES;            ///< Relative value of pressure applied to the whole domain.
84     Real LARGE_PRES;  ///< Artificial pressure for boundary particles. Make sure fluid particles do not go through the
85                       ///< boundaries.Note that if time step is not small enough particles near the boundaries might
86                       ///< build up huge pressures and will make the simulation unstable.
87 
88     Real3 deltaPress;  ///< Change in Pressure. This is needed for periodic BC. The change in pressure of a particle
89                        ///< when it moves from end boundary to beginning.
90 
91     Real3 V_in;  ///< Inlet velocity. This is needed for inlet BC.
92     Real x_in; ///< Inlet position. This is needed for inlet BC.
93 
94     Real3 gravity;     ///< Gravity. Applied to fluid, rigid and flexible.
95     Real3 bodyForce3;  ///< Constant force applied to the fluid. Flexible and rigid bodies are not affected by this
96                        ///< force directly, but instead they are affected indirectly through the fluid.
97 
98     Real rho0;       ///< Density
99     Real invrho0;    ///< Density's inverse
100     Real rho_solid;  ///< Solid Density
101     Real volume0;    ///< Volume
102 
103     Real markerMass;  ///< marker mass
104     Real mu0;         ///< Viscosity
105     Real kappa;       ///< surface tension parameter
106     Real v_Max;       ///< Max velocity of fluid used in equation of state. Run simulation once to be able to determine it.
107     Real EPS_XSPH;       ///< Method to modify particle velocity.
108     Real beta_shifting;  ///< this is the beta coefficient in the shifting vector formula. See
109     Real Vis_Dam;        ///< Viscous damping force
110 
111     Real dT;  ///< Time step. Depending on the model this will vary and the only way to determine what time step to use
112               ///< is to run simulations multiple time and find which one is the largest dT that produces a stable
113               ///< simulation.
114 
115     enum fluidity_model { frictional_plasticity, Inertia_rheology, nonlocal_fluidity };
116 
117     Real dT_Flex; ///< Setpsize for the flexible bodies dynamics.
118     Real Co_number; ///< Constant in CFL condition.
119     Real dT_Max; ///< Maximum setpsize.
120     Real out_fps; ///< Output frames per second.
121     Real tFinal;     ///< Total simulation time.
122     Real timePause;  ///< Time that we let pass before applying body forces. This is done to allow the particles to
123                      ///< stabilize first.Run the fluid only during this time, with dTm = 0.1 * dT
124 
125     Real timePauseRigidFlex;  ///< Time before letting rigid/flex move. Keep the rigid and flex stationary during this
126                               ///< time  (timePause + timePauseRigidFlex) until the fluid is fully developed
127 
128     Real kdT;      ///< Implicit integration parameter. Not very important
129     Real gammaBB;  ///< Equation of state parameter.
130     Real3 cMin;    ///< Lower leftmost part of the space shown in a simulation frame. This point is usually outside the
131                    ///< tolerance zone.
132     Real3 cMax;    ///< Upper right most part of the space shown in a simulation frame. This point is usually outside
133                    ///< thetolerance zone.
134 
135     Real3 cMinInit;                    ///< Minimum point of the fluid domain.
136     Real3 cMaxInit;                    ///< Maximum point of the fluid domain.
137     Real3 straightChannelBoundaryMin;  ///< Origin of the coordinate system (Point (0,0,0)). In this case (straigh
138                                        ///< channel) this point is where the leftmost particle of the 3rd layer of
139                                        ///< boundary particles is located. Everything below this point is outside the
140                                        ///< tolerance zone, this means that everything below is not considered part of
141                                        ///< the system
142     Real3 straightChannelBoundaryMax;  ///< Upper right most part of the system, this is Point(2 * mm, 1 * mm, 3 * mm)
143                                        ///< where mm is a constant defined at the beginning of main.cpp.This is also the
144                                        ///< rightmost particle of the 3rd layer of the top boundaryparticles.Everything
145                                        ///< above this point is not considered part of thesystem.
146     Real binSize0;  ///< Suggests the length of the bin each particle occupies. Normally this would be 2*hsml since
147                     ///< hsml is the radius of the particle, but when we have periodic boundary condition varies a
148                     ///< little from 2 hsml.This may change slightly due to the location of the periodic BC.
149 
150     Real3 rigidRadius;  ///< Radius of rigid bodies.
151 
152     int densityReinit;  ///< Reinitialize density after densityReinit steps. Note that doing this more frequently helps
153                         /// in getting more accurate incompressible fluid, but more stable solution is obtained for
154                         /// larger densityReinit
155 
156     int contactBoundary;  ///< 0: straight channel, 1: serpentine
157 
158     BceVersion bceType;  ///< Type of boundary conditions, ADAMI or mORIGINAL
159 
160     bool Conservative_Form;  ///< Whether conservative or consistent discretization should be used
161     int gradient_type; ///< Type of the gradient operator.
162     int laplacian_type; ///< Type of the laplacian operator.
163 
164     bool USE_NonIncrementalProjection;  ///< Used in the I2SPH implementation
165     bool DensityBaseProjetion; ///< Set true to use density based projetion scheme in ISPH solver
166 
167     bool USE_LinearSolver;     ///< If a linear solver should be used to solve Ax=b, otherwise basics methods such as
168                                ///< Jacobi-SOR are used
169     bool Pressure_Constraint;  ///< Whether the singularity of the pressure equation should be fixed
170     ChFsiLinearSolver::SolverType LinearSolver;  ///< Type of the linear solver
171 
172     Real Alpha;  ///< Poisson Pressure Equation source term constant. This is used for controlling the noise in the FS
173                  ///< forces, F_new=beta*F_old+(1-beta)*F_t beta=1 highly damped force, beta=0 : no modificaiton to force
174     Real Beta;  ///< moving exponential weighted average coefficient
175 
176     Real LinearSolver_Abs_Tol;  ///< Poisson Pressure Equation residual
177     Real LinearSolver_Rel_Tol;  ///< Poisson Pressure Equation Absolute residual
178     int LinearSolver_Max_Iter;  ///< Linear Solver maximum number of iteration
179     bool Verbose_monitoring;    ///< Poisson Pressure Equation Absolute residual
180 
181     Real Max_Pressure;                   ///< Max Pressure in the pressure solver
182     PPE_SolutionType PPE_Solution_type;  ///< MATRIX_FREE, FORM_SPARSE_MATRIX see Rakhsha et al. 2018 paper for details
183                                          ///< omega relaxation in the pressure equation, something less than 0.5 is
184                                          ///< necessary for Jacobi solver
185     Real PPE_relaxation; ///< PPE_relaxation
186     bool ClampPressure;  ///< Clamp pressure to 0 if negative, based on the IISPH paper by Ihmsen et al. (2013)
187     Real IncompressibilityFactor; ///< Incompressibility factor, default = 1
188     Real Cs; ///< Speed of sound.
189 
190     bool Adaptive_time_stepping;  ///< Works only with IISPH for now, use Co_number can be used as the criteria for
191                                   ///< adaptivity. dT_Max is set either from the Co_number, or the time step the is
192                                   ///< required for outputting data
193     bool Apply_BC_U;              ///< This option lets you apply a velocity BC on the BCE markers
194     Real L_Characteristic;        ///< Some length characteristic for Re number computation
195 
196     bool non_newtonian; ///< Set true to model non-newtonian fluid.
197     bool granular_material; ///< Set true to model granular material dynamcis using I2SPH
198     rheology rheology_model; ///< Model of the rheology (Inertia_rheology or nonlocal_fluidity)
199     Real ave_diam;  ///< average particle diameter
200     Real cohesion;  ///< c in the stress model sigma=(mu*p+c)/|D|
201     friction_law mu_of_I; ///< Constant I in granular material dyanmcis
202     Real mu_max;     ///< maximum viscosity
203     Real mu_fric_s;  ///< friction mu_s
204     Real mu_fric_2;  ///< mu_2 constant in mu=mu(I)
205     Real mu_I0;      ///< Reference Inertia number
206     Real mu_I_b;     ///< b constant in mu=mu(I)=mu_s+b*I
207     Real Shear_Mod;  ///< G
208 
209     Real HB_sr0;   ///< Herschel–Bulkley consistency index
210     Real HB_k;     ///< Herschel–Bulkley consistency index
211     Real HB_n;     ///< Herschel–Bulkley  power
212     Real HB_tau0;  ///< Herschel–Bulkley yeild stress
213 
214 
215     bool elastic_SPH;   ///< Handles the WCSPH solver for fluid (0) or granular (1)
216     Real E_young;       ///< Young's modulus
217     Real G_shear;       ///< Shear modulus
218     Real K_bulk;        ///< Bulk modulus
219     Real Nu_poisson;    ///< Poisson’s ratio
220     Real Ar_stress;     ///< Artifical stress
221     Real Ar_vis_alpha;  ///< Artifical viscosity coefficient
222     Real Ar_vis_beta;   ///< Artifical viscosity coefficient
223     Real Fri_angle;     ///< Frictional angle of granular material
224     Real Dil_angle;     ///< Dilate angle of granular material
225     Real Coh_coeff;     ///< Cohesion coefficient
226     Real Q_FA;          ///< Material constants calculate from frictional angle
227     Real Q_DA;          ///< Material constants calculate from dilate angle
228     Real K_FA;          ///< Material constants calculate from frictional angle and cohesion coefficient
229     Real C_Wi;          ///< Threshold of the integration of the kernel function
230 
231     Real boxDimX; ///< Dimension of the space domain - X
232     Real boxDimY; ///< Dimension of the space domain - Y
233     Real boxDimZ; ///< Dimension of the space domain - Z
234 
235     Real fluidDimX;  ///< Dimension of the fluid domain - X
236     Real fluidDimY;  ///< Dimension of the fluid domain - Y
237     Real fluidDimZ;  ///< Dimension of the fluid domain - Z
238 
239     Real bodyDimX; ///< Size of the FSI body - X
240     Real bodyDimY; ///< Size of the FSI body - Y
241     Real bodyDimZ; ///< Size of the FSI body - Z
242     Real bodyRad;  ///< Radisu of the FSI body
243     Real bodyLength; ///< Length of the FSI body
244     Real bodyIniPosX; ///< Initial position of the FSI body - X
245     Real bodyIniPosY; ///< Initial position of the FSI body - Y
246     Real bodyIniPosZ; ///< Initial position of the FSI body - Z
247     Real bodyIniVelX; ///< Initial velocity of the FSI body - X
248     Real bodyIniVelY; ///< Initial velocity of the FSI body - Y
249     Real bodyIniVelZ; ///< Initial velocity of the FSI body - Z
250     Real bodyIniAngVel; ///< Initial angular velocity of the FSI body
251     Real bodyMass; ///< Mass of the FSI body
252     Real bodyDensity; ///< Density of the FSI body
253 };
254 
255 /// @} fsi_physics
256 
257 }  // namespace fsi
258 }  // namespace chrono
259 
260 #endif
261