5def print_bool(arg, prefix = ""):
14def print_dbl(arg, prefix = ""):
16 str = prefix +
"%4.6e\n" % (arg)
19def print_int(arg, prefix = ""):
20 str = prefix +
"%d\n" % (arg)
23def print_dbl_list(arg, prefix = ""):
27 str +=
"%4.6e" % (arg[i])
35def print_int_list(arg, prefix = ""):
39 str +=
"%d" % (arg[i])
47def does_intersect(p, r, R, particles, padding):
51 pq = np.array([p[i] - q[i]
for i
in range(3)])
52 if np.linalg.norm(pq) <= r + R + padding:
58def does_intersect_rect(p, r, particles, padding, rect):
61 pr = [p[0] - r, p[1] - r, p[2], p[0] + r, p[1] + r, p[2]]
63 if pr[0] < rect[0] + padding
or pr[1] < rect[1] + padding
or pr[3] > rect[3] - padding
or pr[4] > rect[4] - padding:
81 return 3. * K * (1. - 2. * nu)
84 return E / (2. * (1. + nu))
88 return 2. * k1 * k2 / (k1 + k2)
96def rotate(p, theta, axis):
99 axis_np = np.array(axis)
105 p_dot_n = np.dot(p_np,axis_np)
108 n_cross_p = np.cross(axis_np, p_np)
110 return (1. - ct) * p_dot_n * axis_np + ct * p_np + st * n_cross_p
113def get_ref_hex_points(center, radius, add_center = False):
138 rotate_axis = [0., 0., 1.]
142 points.append(center)
145 xi = rotate(axis, i*np.pi/3., rotate_axis)
146 points.append([center[i] + radius * xi[i]
for i
in range(3)])
151def particle_locations(inp_dir, pp_tag, R1, R2, rect, mesh_size, padding, add_orient = True):
152 """Generate particle location data"""
168 rows = int((rect[3] - rect[0])/ check_r)
169 cols = int((rect[4] - rect[1])/ check_r)
175 x_old_right = rect[3]
188 for i
in range(rows):
191 y_old = cy + get_max(row_rads)
200 while num_p_cols < cols - 1
and j < 500:
205 x_old_right = rect[3]
209 if np.random.uniform(0., 1.) < 0.7:
215 r = r0 + np.random.uniform(-0.1 * r0, 0.1 * r0)
220 rph = np.random.uniform(-0.1 * r0, 0.1 * r0)
222 cx0 = x_old + pad + r
226 cx0 = x_old_right - pad - r
231 inters = does_intersect_rect([cx, cy, cz], r, particles, pad, rect)
232 inters_parts = does_intersect
235 particles.append([float(ptype), cx, cy, cz, r])
250 inpf = open(inp_dir +
'particle_locations_' + str(pp_tag) +
'.csv',
'w')
252 inpf.write(
"i, x, y, z, r, o\n")
255 inpf.write(
"%d, %Lf, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4], np.random.uniform(0., 2.*np.pi)))
258 inpf.write(
"i, x, y, z, r\n")
260 inpf.write(
"%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
266 points.append([p[1], p[2], p[3]])
268 points = np.array(points)
269 mesh = pv.PolyData(points)
270 pv.save_meshio(
'particle_locations_' + str(pp_tag) +
'.vtu', mesh)
272 print(
'number of particles created = {}'.format(len(particles)))
275def generate_cir_particle_gmsh_input(inp_dir, filename, center, radius, mesh_size, pp_tag):
277 sim_inp_dir = str(inp_dir)
291 geof = open(sim_inp_dir + filename +
'_' + str(pp_tag) +
'.geo',
'w')
292 geof.write(
"cl__1 = 1;\n")
293 geof.write(
"Mesh.MshFileVersion = 2.2;\n")
298 geof.write(
"Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy, sim_Cz, sim_h));
299 geof.write(
"Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx + sim_radius, sim_Cy, sim_Cz, sim_h))
300 geof.write(
"Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx - sim_radius, sim_Cy, sim_Cz, sim_h))
301 geof.write(
"Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy + sim_radius, sim_Cz, sim_h))
302 geof.write(
"Point(5) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy - sim_radius, sim_Cz, sim_h))
307 geof.write(
"Circle(1) = {2, 1, 4};\n")
308 geof.write(
"Circle(2) = {4, 1, 3};\n")
309 geof.write(
"Circle(3) = {3, 1, 5};\n")
310 geof.write(
"Circle(4) = {5, 1, 2};\n")
315 geof.write(
"Line Loop(1) = {2, 3, 4, 1};\n")
320 geof.write(
"Plane Surface(1) = {1};\n")
329 geof.write(
"Point{1} In Surface {1};")
335def generate_hex_particle_gmsh_input(inp_dir, filename, center, radius, mesh_size, pp_tag):
337 sim_inp_dir = str(inp_dir)
339 points = get_ref_hex_points(center, radius,
True)
344 geof = open(sim_inp_dir + filename +
'_' + str(pp_tag) +
'.geo',
'w')
345 geof.write(
"cl__1 = 1;\n")
346 geof.write(
"Mesh.MshFileVersion = 2.2;\n")
353 sts =
"Point({}) = ".format(i+1)
355 sts +=
"{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
362 geof.write(
"Line(1) = {2, 3};\n")
363 geof.write(
"Line(2) = {3, 4};\n")
364 geof.write(
"Line(3) = {4, 5};\n")
365 geof.write(
"Line(4) = {5, 6};\n")
366 geof.write(
"Line(5) = {6, 7};\n")
367 geof.write(
"Line(6) = {7, 2};\n")
372 geof.write(
"Line Loop(1) = {1, 2, 3, 4, 5, 6};\n")
377 geof.write(
"Plane Surface(1) = {1};\n")
386 geof.write(
"Point{1} In Surface {1};")
392def generate_rigid_wall_gmsh_input(inp_dir, filename, outer_rect, inner_rect, mesh_size, pp_tag):
394 sim_inp_dir = str(inp_dir)
397 sim_Lx_out1 = outer_rect[0]
398 sim_Ly_out1 = outer_rect[1]
399 sim_Lz_out1 = outer_rect[2]
400 sim_Lx_out2 = outer_rect[3]
401 sim_Ly_out2 = outer_rect[4]
402 sim_Lz_out2 = outer_rect[5]
405 sim_Lx_in1 = inner_rect[0]
406 sim_Ly_in1 = inner_rect[1]
407 sim_Lz_in1 = inner_rect[2]
408 sim_Lx_in2 = inner_rect[3]
409 sim_Ly_in2 = inner_rect[4]
410 sim_Lz_in2 = inner_rect[5]
418 geof = open(sim_inp_dir + filename +
'_' + str(pp_tag) +
'.geo',
'w')
419 geof.write(
"cl__1 = 1;\n")
420 geof.write(
"Mesh.MshFileVersion = 2.2;\n")
444 geof.write(
"Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out1, sim_Lz_out1, sim_h))
445 geof.write(
"Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out1, sim_Lz_out1, sim_h))
446 geof.write(
"Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out2, sim_Lz_out1, sim_h))
447 geof.write(
"Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out2, sim_Lz_out1, sim_h))
449 geof.write(
"Point(5) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in1, sim_Ly_in1, sim_Lz_in1, sim_h))
450 geof.write(
"Point(6) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in2, sim_Ly_in1, sim_Lz_in1, sim_h))
451 geof.write(
"Point(7) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in2, sim_Ly_out2, sim_Lz_in1, sim_h))
452 geof.write(
"Point(8) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in1, sim_Ly_out2, sim_Lz_in1, sim_h))
457 geof.write(
"Line(1) = {1, 2};\n")
458 geof.write(
"Line(2) = {2, 3};\n")
459 geof.write(
"Line(3) = {3, 7};\n")
460 geof.write(
"Line(4) = {7, 6};\n")
461 geof.write(
"Line(5) = {6, 5};\n")
462 geof.write(
"Line(6) = {5, 8};\n")
463 geof.write(
"Line(7) = {8, 4};\n")
464 geof.write(
"Line(8) = {4, 1};\n")
469 geof.write(
"Line Loop(1) = {1, 2, 3, 4, 5, 6, 7, 8};\n")
474 geof.write(
"Plane Surface(1) = {1};\n")
479 tag =
'"' +
"a" +
'"'
480 geof.write(
"Physical Surface(%s) = {1};\n" % (tag))
486def generate_moving_wall_gmsh_input(inp_dir, filename, rectangle, mesh_size, pp_tag):
488 sim_inp_dir = str(inp_dir)
491 sim_Lx_out1 = rectangle[0]
492 sim_Ly_out1 = rectangle[1]
493 sim_Lz_out1 = rectangle[2]
494 sim_Lx_out2 = rectangle[3]
495 sim_Ly_out2 = rectangle[4]
496 sim_Lz_out2 = rectangle[5]
504 geof = open(sim_inp_dir + filename +
'_' + str(pp_tag) +
'.geo',
'w')
505 geof.write(
"cl__1 = 1;\n")
506 geof.write(
"Mesh.MshFileVersion = 2.2;\n")
511 geof.write(
"Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out1, sim_Lz_out1, sim_h));
512 geof.write(
"Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out1, sim_Lz_out1, sim_h))
513 geof.write(
"Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out2, sim_Lz_out1, sim_h))
514 geof.write(
"Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out2, sim_Lz_out1, sim_h))
519 geof.write(
"Line(1) = {1, 2};\n")
520 geof.write(
"Line(2) = {2, 3};\n")
521 geof.write(
"Line(3) = {3, 4};\n")
522 geof.write(
"Line(4) = {4, 1};\n")
527 geof.write(
"Line Loop(1) = {1, 2, 3, 4};\n")
532 geof.write(
"Plane Surface(1) = {1};\n")
537 tag =
'"' +
"a" +
'"'
538 geof.write(
"Physical Surface(%s) = {1};\n" % (tag))
544def create_input_file(inp_dir, pp_tag):
545 """Generates input file for two-particle test"""
547 sim_inp_dir = str(inp_dir)
550 dx0, dy0, dz0 = 0., 0., 0.
551 dx1, dy1, dz1 = 0.0685, 0.041, 0.
554 center = [0., 0., 0.]
561 horizon = 3. * mesh_size
562 particle_dist = 0.001
565 particle_padding = 0.3 * R1
570 wpd = 1.1 * mesh_size
572 rwo_rect = [dx0 - rwp, dy0 - rwp, dz0, dx1 + rwp, dy1 + rwp, dz0]
573 rwi_rect = [dx0 - wpd, dy0 - wpd, dz0, dx1 + wpd, dy1 + wpd, dz0]
578 mw_rect = [dx0-wpd, mw_dy1+wpd, dz0, dx1+wpd, mw_dy1+rwp, dz0]
581 max_dist_check = 20.*dx1
589 dt_out_n = num_steps / num_outputs
590 test_dt_out_n = dt_out_n / 100
597 E1 = get_E(K1, poisson1)
598 G1 = get_G(E1, poisson1)
604 E2 = get_E(K2, poisson2)
605 G2 = get_G(E2, poisson2)
612 E3 = get_E(K3, poisson3)
613 G3 = get_G(E3, poisson3)
620 E4 = get_E(K4, poisson4)
621 G4 = get_G(E4, poisson4)
627 R_contact_factor = 0.95
634 Kn_11 = 18. * get_eff_k(K1, K1) / (np.pi * np.power(horizon, 5))
635 Kn_22 = 18. * get_eff_k(K2, K2) / (np.pi * np.power(horizon, 5))
636 Kn_33 = 18. * get_eff_k(K3, K3) / (np.pi * np.power(horizon, 5))
637 Kn_44 = 18. * get_eff_k(K4, K4) / (np.pi * np.power(horizon, 5))
638 Kn_12 = 18. * get_eff_k(K1, K2) / (np.pi * np.power(horizon, 5))
639 Kn_13 = 18. * get_eff_k(K1, K3) / (np.pi * np.power(horizon, 5))
640 Kn_14 = 18. * get_eff_k(K1, K4) / (np.pi * np.power(horizon, 5))
641 Kn_23 = 18. * get_eff_k(K2, K3) / (np.pi * np.power(horizon, 5))
642 Kn_24 = 18. * get_eff_k(K2, K4) / (np.pi * np.power(horizon, 5))
643 Kn_34 = 18. * get_eff_k(K3, K4) / (np.pi * np.power(horizon, 5))
647 damping_active =
True
648 friction_active =
False
652 gravity_active =
True
653 gravity = [0., -10., 0.]
663 inpf = open(sim_inp_dir +
'input_' + str(pp_tag) +
'.yaml',
'w')
664 inpf.write(
"Model:\n")
665 inpf.write(
" Dimension: 2\n")
666 inpf.write(
" Discretization_Type:\n")
667 inpf.write(
" Spatial: finite_difference\n")
668 inpf.write(
" Time: central_difference\n")
669 inpf.write(
" Final_Time: %4.6e\n" % (final_time))
670 inpf.write(
" Time_Steps: %d\n" % (num_steps))
675 inpf.write(
"Container:\n")
676 inpf.write(
" Geometry:\n")
677 inpf.write(
" Type: rectangle\n")
678 inpf.write(
" Parameters: " + print_dbl_list(rwo_rect))
683 inpf.write(
"Zone:\n")
684 inpf.write(
" Zones: 4\n")
687 inpf.write(
" Zone_1:\n")
688 inpf.write(
" Is_Wall: false\n")
691 inpf.write(
" Zone_2:\n")
692 inpf.write(
" Is_Wall: false\n")
695 inpf.write(
" Zone_3:\n")
696 inpf.write(
" Is_Wall: true\n")
697 inpf.write(
" Type: rectangle\n")
698 inpf.write(
" Parameters: " + print_dbl_list(rwo_rect))
701 inpf.write(
" Zone_4:\n")
702 inpf.write(
" Is_Wall: true\n")
703 inpf.write(
" Type: rectangle\n")
704 inpf.write(
" Parameters: " + print_dbl_list(mw_rect))
709 inpf.write(
"Particle:\n")
711 inpf.write(
" Test_Name: compressive_test\n")
712 inpf.write(
" Compressive_Test:\n")
713 inpf.write(
" Wall_Id: 1\n")
714 inpf.write(
" Wall_Force_Direction: 2\n")
716 inpf.write(
" Zone_1:\n")
717 inpf.write(
" Type: circle\n")
718 p1_geom = [R1, center[0], center[1], center[2]]
719 inpf.write(
" Parameters: " + print_dbl_list(p1_geom))
720 inpf.write(
" Zone_2:\n")
721 inpf.write(
" Type: hexagon\n")
722 hex_axis = [1., 0., 0.]
723 p2_geom = [R2, center[0], center[1], center[2], hex_axis[0], hex_axis[1], hex_axis[2]]
724 inpf.write(
" Parameters: " + print_dbl_list(p2_geom))
729 inpf.write(
"Wall:\n")
730 inpf.write(
" Zone_3:\n")
731 inpf.write(
" Type: flexible\n")
732 inpf.write(
" All_Dofs_Constrained: true\n")
733 inpf.write(
" Mesh: true\n")
735 inpf.write(
" Zone_4:\n")
736 inpf.write(
" Type: flexible\n")
737 inpf.write(
" All_Dofs_Constrained: false\n")
738 inpf.write(
" Mesh: true\n")
743 inpf.write(
"Particle_Generation:\n")
744 inpf.write(
" From_File: particle_locations_" + str(pp_tag) +
".csv\n")
746 inpf.write(
" File_Data_Type: loc_rad_orient\n")
751 inpf.write(
"Mesh:\n")
754 inpf.write(
" Zone_1:\n")
755 inpf.write(
" File: mesh_particle_1_" + str(pp_tag) +
".msh \n")
758 inpf.write(
" Zone_2:\n")
759 inpf.write(
" File: mesh_particle_2_" + str(pp_tag) +
".msh \n")
762 inpf.write(
" Zone_3:\n")
763 inpf.write(
" File: mesh_rigid_wall_" + str(pp_tag) +
".msh \n")
766 inpf.write(
" Zone_4:\n")
767 inpf.write(
" File: mesh_moving_wall_" + str(pp_tag) +
".msh \n")
772 inpf.write(
"Contact:\n")
775 inpf.write(
" Zone_11:\n")
777 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
779 if damping_active ==
False:
780 inpf.write(
" Damping_On: false\n")
781 if friction_active ==
False:
782 inpf.write(
" Friction_On: false\n")
784 inpf.write(
" Kn: %4.6e\n" % (Kn_11))
785 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
786 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
787 inpf.write(
" Kn_Factor: 1.0\n")
788 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
791 inpf.write(
" Zone_12:\n")
792 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
794 if damping_active ==
False:
795 inpf.write(
" Damping_On: false\n")
796 if friction_active ==
False:
797 inpf.write(
" Friction_On: false\n")
799 inpf.write(
" Kn: %4.6e\n" % (Kn_12))
800 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
801 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
802 inpf.write(
" Kn_Factor: 1.0\n")
803 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
806 inpf.write(
" Zone_13:\n")
807 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
809 if damping_active ==
False:
810 inpf.write(
" Damping_On: false\n")
811 if friction_active ==
False:
812 inpf.write(
" Friction_On: false\n")
814 inpf.write(
" Kn: %4.6e\n" % (Kn_13))
815 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
816 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
817 inpf.write(
" Kn_Factor: 1.0\n")
818 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
821 inpf.write(
" Zone_14:\n")
822 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
824 if damping_active ==
False:
825 inpf.write(
" Damping_On: false\n")
826 if friction_active ==
False:
827 inpf.write(
" Friction_On: false\n")
829 inpf.write(
" Kn: %4.6e\n" % (Kn_14))
830 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
831 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
832 inpf.write(
" Kn_Factor: 1.0\n")
833 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
836 inpf.write(
" Zone_22:\n")
837 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
839 if damping_active ==
False:
840 inpf.write(
" Damping_On: false\n")
841 if friction_active ==
False:
842 inpf.write(
" Friction_On: false\n")
844 inpf.write(
" Kn: %4.6e\n" % (Kn_22))
845 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
846 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
847 inpf.write(
" Kn_Factor: 1.0\n")
848 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
851 inpf.write(
" Zone_23:\n")
852 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
854 if damping_active ==
False:
855 inpf.write(
" Damping_On: false\n")
856 if friction_active ==
False:
857 inpf.write(
" Friction_On: false\n")
859 inpf.write(
" Kn: %4.6e\n" % (Kn_23))
860 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
861 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
862 inpf.write(
" Kn_Factor: 1.0\n")
863 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
866 inpf.write(
" Zone_24:\n")
867 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
869 if damping_active ==
False:
870 inpf.write(
" Damping_On: false\n")
871 if friction_active ==
False:
872 inpf.write(
" Friction_On: false\n")
874 inpf.write(
" Kn: %4.6e\n" % (Kn_24))
875 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
876 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
877 inpf.write(
" Kn_Factor: 1.0\n")
878 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
881 inpf.write(
" Zone_33:\n")
882 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
884 if damping_active ==
False:
885 inpf.write(
" Damping_On: false\n")
886 if friction_active ==
False:
887 inpf.write(
" Friction_On: false\n")
889 inpf.write(
" Kn: %4.6e\n" % (Kn_33))
890 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
891 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
892 inpf.write(
" Kn_Factor: 1.0\n")
893 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
896 inpf.write(
" Zone_34:\n")
897 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
899 if damping_active ==
False:
900 inpf.write(
" Damping_On: false\n")
901 if friction_active ==
False:
902 inpf.write(
" Friction_On: false\n")
904 inpf.write(
" Kn: %4.6e\n" % (Kn_34))
905 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
906 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
907 inpf.write(
" Kn_Factor: 1.0\n")
908 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
911 inpf.write(
" Zone_44:\n")
912 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
914 if damping_active ==
False:
915 inpf.write(
" Damping_On: false\n")
916 if friction_active ==
False:
917 inpf.write(
" Friction_On: false\n")
919 inpf.write(
" Kn: %4.6e\n" % (Kn_44))
920 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
921 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
922 inpf.write(
" Kn_Factor: 1.0\n")
923 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
928 inpf.write(
"Neighbor:\n")
929 inpf.write(
" Update_Criteria: simple_all\n")
930 inpf.write(
" Search_Factor: 5.0\n")
935 inpf.write(
"Material:\n")
938 inpf.write(
" Zone_1:\n")
939 inpf.write(
" Type: PDState\n")
940 inpf.write(
" Horizon: %4.6e\n" % (horizon))
941 inpf.write(
" Density: %4.6e\n" % (rho1))
942 inpf.write(
" Compute_From_Classical: true\n")
943 inpf.write(
" K: %4.6e\n" % (K1))
944 inpf.write(
" G: %4.6e\n" % (G1))
945 inpf.write(
" Gc: %4.6e\n" % (Gc1))
946 inpf.write(
" Influence_Function:\n")
947 inpf.write(
" Type: 1\n")
950 inpf.write(
" Zone_2:\n")
951 inpf.write(
" Type: PDState\n")
952 inpf.write(
" Horizon: %4.6e\n" % (horizon))
953 inpf.write(
" Density: %4.6e\n" % (rho2))
954 inpf.write(
" Compute_From_Classical: true\n")
955 inpf.write(
" K: %4.6e\n" % (K2))
956 inpf.write(
" G: %4.6e\n" % (G2))
957 inpf.write(
" Gc: %4.6e\n" % (Gc2))
958 inpf.write(
" Influence_Function:\n")
959 inpf.write(
" Type: 1\n")
962 inpf.write(
" Zone_3:\n")
963 inpf.write(
" Type: PDState\n")
964 inpf.write(
" Horizon: %4.6e\n" % (horizon))
965 inpf.write(
" Density: %4.6e\n" % (rho3))
966 inpf.write(
" Compute_From_Classical: true\n")
967 inpf.write(
" K: %4.6e\n" % (K3))
968 inpf.write(
" G: %4.6e\n" % (G3))
969 inpf.write(
" Gc: %4.6e\n" % (Gc3))
970 inpf.write(
" Influence_Function:\n")
971 inpf.write(
" Type: 1\n")
974 inpf.write(
" Zone_4:\n")
975 inpf.write(
" Type: PDState\n")
976 inpf.write(
" Horizon: %4.6e\n" % (horizon))
977 inpf.write(
" Density: %4.6e\n" % (rho4))
978 inpf.write(
" Compute_From_Classical: true\n")
979 inpf.write(
" K: %4.6e\n" % (K4))
980 inpf.write(
" G: %4.6e\n" % (G4))
981 inpf.write(
" Gc: %4.6e\n" % (Gc4))
982 inpf.write(
" Influence_Function:\n")
983 inpf.write(
" Type: 1\n")
988 if gravity_active ==
True:
989 inpf.write(
"Force_BC:\n")
990 inpf.write(
" Gravity: " + print_dbl_list(gravity))
995 inpf.write(
"Displacement_BC:\n")
996 inpf.write(
" Sets: 2\n")
998 inpf.write(
" Set_1:\n")
999 inpf.write(
" Wall_List: [0]\n")
1000 inpf.write(
" Direction: [1,2]\n")
1001 inpf.write(
" Time_Function:\n")
1002 inpf.write(
" Type: constant\n")
1003 inpf.write(
" Parameters:\n")
1004 inpf.write(
" - 0.0\n")
1005 inpf.write(
" Spatial_Function:\n")
1006 inpf.write(
" Type: constant\n")
1007 inpf.write(
" Zero_Displacement: true\n")
1009 inpf.write(
" Set_2:\n")
1010 inpf.write(
" Wall_List: [1]\n")
1011 inpf.write(
" Direction: [2]\n")
1012 inpf.write(
" Time_Function:\n")
1013 inpf.write(
" Type: linear\n")
1014 inpf.write(
" Parameters:\n")
1015 inpf.write(
" - %4.6e\n" % (mw_vy))
1016 inpf.write(
" Spatial_Function:\n")
1017 inpf.write(
" Type: constant\n")
1022 inpf.write(
"Output:\n")
1023 inpf.write(
" Path: ../out/\n")
1024 inpf.write(
" Tags:\n")
1025 inpf.write(
" - Displacement\n")
1026 inpf.write(
" - Velocity\n")
1027 inpf.write(
" - Force\n")
1028 inpf.write(
" - Force_Density\n")
1029 inpf.write(
" - Damage_Z\n")
1030 inpf.write(
" - Damage\n")
1031 inpf.write(
" - Nodal_Volume\n")
1032 inpf.write(
" - Zone_ID\n")
1033 inpf.write(
" - Particle_ID\n")
1034 inpf.write(
" - Fixity\n")
1035 inpf.write(
" - Force_Fixity\n")
1036 inpf.write(
" - Contact_Data\n")
1037 inpf.write(
" - No_Fail_Node\n")
1038 inpf.write(
" - Boundary_Node_Flag\n")
1041 inpf.write(
" Output_Interval: %d\n" % (dt_out_n))
1042 inpf.write(
" Compress_Type: zlib\n")
1043 inpf.write(
" Perform_FE_Out: false\n")
1045 inpf.write(
" Perform_Out: true\n")
1047 inpf.write(
" Perform_Out: false\n")
1048 inpf.write(
" Test_Output_Interval: %d\n" % (test_dt_out_n))
1050 inpf.write(
" Debug: 1\n")
1051 inpf.write(
" Tag_PP: %d\n" %(int(pp_tag)))
1052 inpf.write(
" Output_Criteria: \n")
1055 inpf.write(
" Type: max_node_dist\n")
1056 inpf.write(
" Parameters: [%4.6e]\n" % (max_dist_check))
1067 inpf.write(
"HPX:\n")
1068 inpf.write(
" Partitions: 1\n")
1075 re_generate_files =
False
1076 if re_generate_files:
1077 particle_locations(inp_dir, pp_tag, R1, R2, [dx0, dy0, dz0, dx1, dy1, dz1], mesh_size, particle_padding)
1080 generate_cir_particle_gmsh_input(inp_dir,
'mesh_particle_1', center, R1, mesh_size, pp_tag)
1081 generate_hex_particle_gmsh_input(inp_dir,
'mesh_particle_2', center, R2, mesh_size, pp_tag)
1082 generate_moving_wall_gmsh_input(inp_dir,
'mesh_moving_wall', mw_rect, mesh_size, pp_tag)
1083 generate_rigid_wall_gmsh_input(inp_dir,
'mesh_rigid_wall', rwo_rect, rwi_rect, mesh_size, pp_tag)
1089if len(sys.argv) > 1:
1090 pp_tag = int(sys.argv[1])
1092create_input_file(inp_dir, pp_tag)