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]
579 mw_rect = [dx0-wpd, mw_dy1+wpd, dz0, dx1+wpd, mw_dy1+rwp, dz0]
582 max_dist_check = 20.*dx1
590 dt_out_n = num_steps / num_outputs
591 test_dt_out_n = dt_out_n / 100
598 E1 = get_E(K1, poisson1)
599 G1 = get_G(E1, poisson1)
605 E2 = get_E(K2, poisson2)
606 G2 = get_G(E2, poisson2)
613 E3 = get_E(K3, poisson3)
614 G3 = get_G(E3, poisson3)
621 E4 = get_E(K4, poisson4)
622 G4 = get_G(E4, poisson4)
628 R_contact_factor = 0.95
635 Kn_11 = 18. * get_eff_k(K1, K1) / (np.pi * np.power(horizon, 5))
636 Kn_22 = 18. * get_eff_k(K2, K2) / (np.pi * np.power(horizon, 5))
637 Kn_33 = 18. * get_eff_k(K3, K3) / (np.pi * np.power(horizon, 5))
638 Kn_44 = 18. * get_eff_k(K4, K4) / (np.pi * np.power(horizon, 5))
639 Kn_12 = 18. * get_eff_k(K1, K2) / (np.pi * np.power(horizon, 5))
640 Kn_13 = 18. * get_eff_k(K1, K3) / (np.pi * np.power(horizon, 5))
641 Kn_14 = 18. * get_eff_k(K1, K4) / (np.pi * np.power(horizon, 5))
642 Kn_23 = 18. * get_eff_k(K2, K3) / (np.pi * np.power(horizon, 5))
643 Kn_24 = 18. * get_eff_k(K2, K4) / (np.pi * np.power(horizon, 5))
644 Kn_34 = 18. * get_eff_k(K3, K4) / (np.pi * np.power(horizon, 5))
648 damping_active =
True
649 friction_active =
False
653 gravity_active =
True
654 gravity = [0., -10., 0.]
664 inpf = open(sim_inp_dir +
'input_' + str(pp_tag) +
'.yaml',
'w')
665 inpf.write(
"Model:\n")
666 inpf.write(
" Dimension: 2\n")
667 inpf.write(
" Discretization_Type:\n")
668 inpf.write(
" Spatial: finite_difference\n")
669 inpf.write(
" Time: central_difference\n")
670 inpf.write(
" Final_Time: %4.6e\n" % (final_time))
671 inpf.write(
" Time_Steps: %d\n" % (num_steps))
676 inpf.write(
"Container:\n")
677 inpf.write(
" Geometry:\n")
678 inpf.write(
" Type: rectangle\n")
679 inpf.write(
" Parameters: " + print_dbl_list(rwo_rect))
684 inpf.write(
"Zone:\n")
685 inpf.write(
" Zones: 4\n")
688 inpf.write(
" Zone_1:\n")
689 inpf.write(
" Is_Wall: false\n")
692 inpf.write(
" Zone_2:\n")
693 inpf.write(
" Is_Wall: false\n")
696 inpf.write(
" Zone_3:\n")
697 inpf.write(
" Is_Wall: true\n")
698 inpf.write(
" Type: rectangle\n")
699 inpf.write(
" Parameters: " + print_dbl_list(rwo_rect))
702 inpf.write(
" Zone_4:\n")
703 inpf.write(
" Is_Wall: true\n")
704 inpf.write(
" Type: rectangle\n")
705 inpf.write(
" Parameters: " + print_dbl_list(mw_rect))
710 inpf.write(
"Particle:\n")
712 inpf.write(
" Test_Name: compressive_test\n")
713 inpf.write(
" Compressive_Test:\n")
714 inpf.write(
" Wall_Id: 1\n")
715 inpf.write(
" Wall_Force_Direction: 2\n")
717 inpf.write(
" Zone_1:\n")
718 inpf.write(
" Type: circle\n")
719 p1_geom = [R1, center[0], center[1], center[2]]
720 inpf.write(
" Parameters: " + print_dbl_list(p1_geom))
721 inpf.write(
" Zone_2:\n")
722 inpf.write(
" Type: hexagon\n")
723 hex_axis = [1., 0., 0.]
724 p2_geom = [R2, center[0], center[1], center[2], hex_axis[0], hex_axis[1], hex_axis[2]]
725 inpf.write(
" Parameters: " + print_dbl_list(p2_geom))
730 inpf.write(
"Wall:\n")
731 inpf.write(
" Zone_3:\n")
732 inpf.write(
" Type: flexible\n")
733 inpf.write(
" All_Dofs_Constrained: true\n")
734 inpf.write(
" Mesh: true\n")
736 inpf.write(
" Zone_4:\n")
737 inpf.write(
" Type: flexible\n")
738 inpf.write(
" All_Dofs_Constrained: false\n")
739 inpf.write(
" Mesh: true\n")
744 inpf.write(
"Particle_Generation:\n")
745 inpf.write(
" From_File: particle_locations_" + str(pp_tag) +
".csv\n")
747 inpf.write(
" File_Data_Type: loc_rad_orient\n")
752 inpf.write(
"Mesh:\n")
755 inpf.write(
" Zone_1:\n")
756 inpf.write(
" File: mesh_particle_1_" + str(pp_tag) +
".msh \n")
759 inpf.write(
" Zone_2:\n")
760 inpf.write(
" File: mesh_particle_2_" + str(pp_tag) +
".msh \n")
763 inpf.write(
" Zone_3:\n")
764 inpf.write(
" File: mesh_rigid_wall_" + str(pp_tag) +
".msh \n")
767 inpf.write(
" Zone_4:\n")
768 inpf.write(
" File: mesh_moving_wall_" + str(pp_tag) +
".msh \n")
773 inpf.write(
"Contact:\n")
776 inpf.write(
" Zone_11:\n")
778 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
780 if damping_active ==
False:
781 inpf.write(
" Damping_On: false\n")
782 if friction_active ==
False:
783 inpf.write(
" Friction_On: false\n")
785 inpf.write(
" Kn: %4.6e\n" % (Kn_11))
786 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
787 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
788 inpf.write(
" Kn_Factor: 1.0\n")
789 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
792 inpf.write(
" Zone_12:\n")
793 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
795 if damping_active ==
False:
796 inpf.write(
" Damping_On: false\n")
797 if friction_active ==
False:
798 inpf.write(
" Friction_On: false\n")
800 inpf.write(
" Kn: %4.6e\n" % (Kn_12))
801 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
802 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
803 inpf.write(
" Kn_Factor: 1.0\n")
804 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
807 inpf.write(
" Zone_13:\n")
808 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
810 if damping_active ==
False:
811 inpf.write(
" Damping_On: false\n")
812 if friction_active ==
False:
813 inpf.write(
" Friction_On: false\n")
815 inpf.write(
" Kn: %4.6e\n" % (Kn_13))
816 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
817 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
818 inpf.write(
" Kn_Factor: 1.0\n")
819 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
822 inpf.write(
" Zone_14:\n")
823 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
825 if damping_active ==
False:
826 inpf.write(
" Damping_On: false\n")
827 if friction_active ==
False:
828 inpf.write(
" Friction_On: false\n")
830 inpf.write(
" Kn: %4.6e\n" % (Kn_14))
831 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
832 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
833 inpf.write(
" Kn_Factor: 1.0\n")
834 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
837 inpf.write(
" Zone_22:\n")
838 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
840 if damping_active ==
False:
841 inpf.write(
" Damping_On: false\n")
842 if friction_active ==
False:
843 inpf.write(
" Friction_On: false\n")
845 inpf.write(
" Kn: %4.6e\n" % (Kn_22))
846 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
847 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
848 inpf.write(
" Kn_Factor: 1.0\n")
849 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
852 inpf.write(
" Zone_23:\n")
853 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
855 if damping_active ==
False:
856 inpf.write(
" Damping_On: false\n")
857 if friction_active ==
False:
858 inpf.write(
" Friction_On: false\n")
860 inpf.write(
" Kn: %4.6e\n" % (Kn_23))
861 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
862 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
863 inpf.write(
" Kn_Factor: 1.0\n")
864 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
867 inpf.write(
" Zone_24:\n")
868 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
870 if damping_active ==
False:
871 inpf.write(
" Damping_On: false\n")
872 if friction_active ==
False:
873 inpf.write(
" Friction_On: false\n")
875 inpf.write(
" Kn: %4.6e\n" % (Kn_24))
876 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
877 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
878 inpf.write(
" Kn_Factor: 1.0\n")
879 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
882 inpf.write(
" Zone_33:\n")
883 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
885 if damping_active ==
False:
886 inpf.write(
" Damping_On: false\n")
887 if friction_active ==
False:
888 inpf.write(
" Friction_On: false\n")
890 inpf.write(
" Kn: %4.6e\n" % (Kn_33))
891 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
892 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
893 inpf.write(
" Kn_Factor: 1.0\n")
894 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
897 inpf.write(
" Zone_34:\n")
898 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
900 if damping_active ==
False:
901 inpf.write(
" Damping_On: false\n")
902 if friction_active ==
False:
903 inpf.write(
" Friction_On: false\n")
905 inpf.write(
" Kn: %4.6e\n" % (Kn_34))
906 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
907 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
908 inpf.write(
" Kn_Factor: 1.0\n")
909 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
912 inpf.write(
" Zone_44:\n")
913 inpf.write(
" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
915 if damping_active ==
False:
916 inpf.write(
" Damping_On: false\n")
917 if friction_active ==
False:
918 inpf.write(
" Friction_On: false\n")
920 inpf.write(
" Kn: %4.6e\n" % (Kn_44))
921 inpf.write(
" Epsilon: %4.6e\n" % (beta_n_eps))
922 inpf.write(
" Friction_Coeff: %4.6e\n" % (friction_coeff))
923 inpf.write(
" Kn_Factor: 1.0\n")
924 inpf.write(
" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
929 inpf.write(
"Neighbor:\n")
930 inpf.write(
" Update_Criteria: simple_all\n")
931 inpf.write(
" Search_Factor: 5.0\n")
936 inpf.write(
"Material:\n")
939 inpf.write(
" Zone_1:\n")
940 inpf.write(
" Type: PDState\n")
941 inpf.write(
" Horizon: %4.6e\n" % (horizon))
942 inpf.write(
" Density: %4.6e\n" % (rho1))
943 inpf.write(
" Compute_From_Classical: true\n")
944 inpf.write(
" K: %4.6e\n" % (K1))
945 inpf.write(
" G: %4.6e\n" % (G1))
946 inpf.write(
" Gc: %4.6e\n" % (Gc1))
947 inpf.write(
" Influence_Function:\n")
948 inpf.write(
" Type: 1\n")
951 inpf.write(
" Zone_2:\n")
952 inpf.write(
" Type: PDState\n")
953 inpf.write(
" Horizon: %4.6e\n" % (horizon))
954 inpf.write(
" Density: %4.6e\n" % (rho2))
955 inpf.write(
" Compute_From_Classical: true\n")
956 inpf.write(
" K: %4.6e\n" % (K2))
957 inpf.write(
" G: %4.6e\n" % (G2))
958 inpf.write(
" Gc: %4.6e\n" % (Gc2))
959 inpf.write(
" Influence_Function:\n")
960 inpf.write(
" Type: 1\n")
963 inpf.write(
" Zone_3:\n")
964 inpf.write(
" Type: PDState\n")
965 inpf.write(
" Horizon: %4.6e\n" % (horizon))
966 inpf.write(
" Density: %4.6e\n" % (rho3))
967 inpf.write(
" Compute_From_Classical: true\n")
968 inpf.write(
" K: %4.6e\n" % (K3))
969 inpf.write(
" G: %4.6e\n" % (G3))
970 inpf.write(
" Gc: %4.6e\n" % (Gc3))
971 inpf.write(
" Influence_Function:\n")
972 inpf.write(
" Type: 1\n")
975 inpf.write(
" Zone_4:\n")
976 inpf.write(
" Type: PDState\n")
977 inpf.write(
" Horizon: %4.6e\n" % (horizon))
978 inpf.write(
" Density: %4.6e\n" % (rho4))
979 inpf.write(
" Compute_From_Classical: true\n")
980 inpf.write(
" K: %4.6e\n" % (K4))
981 inpf.write(
" G: %4.6e\n" % (G4))
982 inpf.write(
" Gc: %4.6e\n" % (Gc4))
983 inpf.write(
" Influence_Function:\n")
984 inpf.write(
" Type: 1\n")
989 if gravity_active ==
True:
990 inpf.write(
"Force_BC:\n")
991 inpf.write(
" Gravity: " + print_dbl_list(gravity))
996 inpf.write(
"Displacement_BC:\n")
997 inpf.write(
" Sets: 2\n")
999 inpf.write(
" Set_1:\n")
1000 inpf.write(
" Wall_List: [0]\n")
1001 inpf.write(
" Direction: [1,2]\n")
1002 inpf.write(
" Time_Function:\n")
1003 inpf.write(
" Type: constant\n")
1004 inpf.write(
" Parameters:\n")
1005 inpf.write(
" - 0.0\n")
1006 inpf.write(
" Spatial_Function:\n")
1007 inpf.write(
" Type: constant\n")
1008 inpf.write(
" Zero_Displacement: true\n")
1010 inpf.write(
" Set_2:\n")
1011 inpf.write(
" Wall_List: [1]\n")
1012 inpf.write(
" Direction: [2]\n")
1013 inpf.write(
" Time_Function:\n")
1014 inpf.write(
" Type: linear\n")
1015 inpf.write(
" Parameters:\n")
1016 inpf.write(
" - %4.6e\n" % (mw_vy))
1017 inpf.write(
" Spatial_Function:\n")
1018 inpf.write(
" Type: constant\n")
1023 inpf.write(
"Output:\n")
1024 inpf.write(
" Path: ../out/\n")
1025 inpf.write(
" Tags:\n")
1026 inpf.write(
" - Displacement\n")
1027 inpf.write(
" - Velocity\n")
1028 inpf.write(
" - Force\n")
1029 inpf.write(
" - Force_Density\n")
1030 inpf.write(
" - Damage_Z\n")
1031 inpf.write(
" - Damage\n")
1032 inpf.write(
" - Nodal_Volume\n")
1033 inpf.write(
" - Zone_ID\n")
1034 inpf.write(
" - Particle_ID\n")
1035 inpf.write(
" - Fixity\n")
1036 inpf.write(
" - Force_Fixity\n")
1038 inpf.write(
" - No_Fail_Node\n")
1039 inpf.write(
" - Boundary_Node_Flag\n")
1042 inpf.write(
" Output_Interval: %d\n" % (dt_out_n))
1043 inpf.write(
" Compress_Type: zlib\n")
1044 inpf.write(
" Perform_FE_Out: false\n")
1046 inpf.write(
" Perform_Out: true\n")
1048 inpf.write(
" Perform_Out: false\n")
1049 inpf.write(
" Test_Output_Interval: %d\n" % (test_dt_out_n))
1051 inpf.write(
" Debug: 1\n")
1052 inpf.write(
" Tag_PP: %d\n" %(int(pp_tag)))
1053 inpf.write(
" Output_Criteria: \n")
1056 inpf.write(
" Type: max_node_dist\n")
1057 inpf.write(
" Parameters: [%4.6e]\n" % (max_dist_check))
1062 inpf.write(
"Restart:\n")
1063 inpf.write(
" File: output_400\n")
1064 inpf.write(
" Step: 600000\n")
1066 inpf.write(
"HPX:\n")
1067 inpf.write(
" Partitions: 1\n")
1074 re_generate_files =
False
1075 if re_generate_files:
1076 particle_locations(inp_dir, pp_tag, R1, R2, [dx0, dy0, dz0, dx1, dy1, dz1], mesh_size, particle_padding)
1079 generate_cir_particle_gmsh_input(inp_dir,
'mesh_particle_1', center, R1, mesh_size, pp_tag)
1080 generate_hex_particle_gmsh_input(inp_dir,
'mesh_particle_2', center, R2, mesh_size, pp_tag)
1081 generate_moving_wall_gmsh_input(inp_dir,
'mesh_moving_wall', mw_rect, mesh_size, pp_tag)
1082 generate_rigid_wall_gmsh_input(inp_dir,
'mesh_rigid_wall', rwo_rect, rwi_rect, mesh_size, pp_tag)
1088if len(sys.argv) > 1:
1089 pp_tag = int(sys.argv[1])
1091create_input_file(inp_dir, pp_tag)