PeriDEM 0.2.0
PeriDEM -- Peridynamics-based high-fidelity model for granular media
Loading...
Searching...
No Matches
problem_setup Namespace Reference

Functions

 print_bool (arg, prefix="")
 
 print_dbl (arg, prefix="")
 
 print_int (arg, prefix="")
 
 print_dbl_list (arg, prefix="")
 
 print_int_list (arg, prefix="")
 
 write_contact_zone_part (inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, zone_string, Kn)
 
 write_material_zone_part (inpf, zone_string, horizon, rho, K, G, Gc)
 
 copy_contact_zone (inpf, zone_numbers, zone_copy_from)
 
 get_E (K, nu)
 
 get_G (E, nu)
 
 get_eff_k (k1, k2)
 
 get_max (l)
 
 rotate (p, theta, axis)
 
 get_ref_rect_points (center, radius, add_center=False)
 
 get_ref_triangle_points (center, radius, add_center=False)
 
 get_ref_hex_points (center, radius, add_center=False)
 
 get_ref_drum_points (center, radius, width, add_center=False)
 
 does_rect_intersect_rect (r1, r2, padding)
 
 does_intersect_with_cylindrical_wall (p, particles, R_in, center, bar_rect, padding)
 
 particle_locations (inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, N1, N2, R_in, bar_rect, z_coord, add_orient=True)
 
 generate_cir_particle_gmsh_input (inp_dir, filename, center, radius, mesh_size, pp_tag)
 
 generate_hex_particle_gmsh_input (inp_dir, filename, center, radius, mesh_size, pp_tag)
 
 generate_tri_particle_gmsh_input (inp_dir, filename, center, radius, mesh_size, pp_tag)
 
 generate_drum2d_particle_gmsh_input (inp_dir, filename, center, radius, width, mesh_size, pp_tag)
 
 generate_cylindrical_wall_gmsh_input (inp_dir, filename, center, outer_radius, inner_radius, bar_width, bar_length, mesh_size, pp_tag)
 
 create_input_file (inp_dir, pp_tag)
 
 does_intersect_rect (p, r, particles, padding, rect)
 
 particle_locations (inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, Nmax, R_in, bar_rect, z_coord, add_orient=True)
 
 generate_wall_gmsh_input (inp_dir, filename, center, outer_radius, inner_radius, bar_width, bar_length, mesh_size, pp_tag)
 
 particle_locations (inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, R_in, bar_rect, z_coord, add_orient=True)
 
 get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening (center, Lin, Win)
 
 get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening (center, Lin, Win)
 
 write_point_geo (geof, p_id, x, h)
 
 write_line_geo (geof, l_id, p1_id, p2_id)
 
 write_cir_line_geo (geof, l_id, p1_id, p2_id, p3_id)
 
 get_ref_rect_points (center, L, W, add_center=False)
 
 does_rect_intersect_rect_use_pair_coord (r1, r2, padding)
 
 does_intersect_with_rectangle_wall_with_protrusion_and_opening (p, particles, Lin, Win, center, padding)
 
 generate_rect_floor_gmsh_input (inp_dir, filename, center, L, W, mesh_size, pp_tag)
 
 generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2 (inp_dir, filename, center, Lin, Win, L, W, mesh_size, pp_tag)
 
 generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3 (inp_dir, filename, center, Lin, Win, L, W, mesh_size, pp_tag)
 
 serialize_matrix_list (p)
 
 get_center (p1, p2)
 
 generate_rect_container_gmsh_input (inp_dir, filename, pi1, pi2, dx, dy, mesh_size, pp_tag)
 
 does_particle_intersect_rect (p, r2, padding)
 
 does_particle_intersect (p, particles, rect, padding)
 
 particle_locations_old (inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, N1, N2, rect, z_coord, add_orient=True)
 
 generate_rigid_rect_container_moving_wall_setup_gmsh_input (inp_dir, filename, outer_rect, inner_rect, mesh_size, pp_tag)
 
 generate_moving_rect_wall_gmsh_input (inp_dir, filename, rectangle, mesh_size, pp_tag)
 
 does_intersect (p, r, R, particles, padding)
 
 particle_locations (inp_dir, pp_tag, R1, R2, rect, mesh_size, padding, add_orient=True)
 
 generate_rigid_wall_gmsh_input (inp_dir, filename, outer_rect, inner_rect, mesh_size, pp_tag)
 
 generate_moving_wall_gmsh_input (inp_dir, filename, rectangle, mesh_size, pp_tag)
 
 particle_locations (inp_dir, pp_tag, R1, R2, offset)
 
 generate_particle_gmsh_input (inp_dir, filename, center, radius, mesh_size, pp_tag)
 
 particle_locations_orient (inp_dir, pp_tag, R1, R2, offset)
 
 generate_drum_particle_gmsh_input (inp_dir, filename, center, radius, width, mesh_size, pp_tag)
 
 rect_to_five_param (r)
 
 particle_locations (inp_dir, pp_tag, R1, R2, offset, w1_rect_five_format, w2_rect_five_format)
 
 particle_locations_orient (inp_dir, pp_tag, R1, R2, offset, w1_rect_five_format, w2_rect_five_format)
 
 generate_particle_gmsh_input (inp_dir, filename, center, radius, width, mesh_size, pp_tag)
 
 generate_wall_gmsh_input (inp_dir, filename, rectangle, mesh_size, pp_tag)
 

Variables

str inp_dir = './'
 ----------------------------------------------------—## ----------------------------------------------------—##
 
int pp_tag = 0
 

Function Documentation

◆ copy_contact_zone()

problem_setup.copy_contact_zone (   inpf,
  zone_numbers,
  zone_copy_from 
)

Definition at line 77 of file problem_setup.py.

77def copy_contact_zone(inpf, zone_numbers, zone_copy_from):
78 for s in zone_numbers:
79 inpf.write(" Zone_%d:\n" % (s))
80 inpf.write(" Copy_Contact_Data: " + print_int_list(zone_copy_from))
81

References print_int_list().

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_input_file()

problem_setup.create_input_file (   inp_dir,
  pp_tag 
)
Generates input file for two-particle test

Definition at line 784 of file problem_setup.py.

784def create_input_file(inp_dir, pp_tag):
785 """Generates input file for two-particle test"""
786
787 sim_inp_dir = str(inp_dir)
788
789 # 1 - small particle circle
790 # 2 - small particle triangle
791 # 3 - small particle drum2d
792 # 4 - small particle hex
793 # 5 - large particle circle
794 # 6 - large particle triangle
795 # 7 - large particle drum2d
796 # 8 - large particle hex
797 # 9 - cylindrical wall
798
799
800 center = [0., 0., 0.]
801 R_small = 0.001
802 R_large = 0.002
803
804 mesh_size = R_small / 5.
805 horizon = 2. * mesh_size
806
807 R_in = 0.015
808 R_out = R_in + 1.5*mesh_size
809
810 L_bar = 0.004
811 W_bar = 1.5*mesh_size
812 bar_rectangle_attached_to_cylinder = [R_in - L_bar, -0.5 * W_bar, 0., R_in, 0.5 * W_bar, 0.]
813
814 # define geometric parameters
815 # wall
816 wall_circle_plus = [R_out, center[0], center[1], center[2]]
817 wall_circle_minus = [R_in, center[0], center[1], center[2]]
818 wall_rectangle_plus = bar_rectangle_attached_to_cylinder
819 wall_params = wall_circle_plus + wall_circle_minus + wall_rectangle_plus
820
821 # small circle
822 small_circle = [R_small, center[0], center[1], center[2]]
823 # small triangle
824 small_triangle = small_circle
825 # small drum2d
826 w_small_drum2d = R_small * 0.2
827 small_drum2d = [R_small, w_small_drum2d, center[0], center[1], center[2]]
828 # small hex
829 small_hex = small_circle
830
831 # large circle
832 large_circle = [R_large, center[0], center[1], center[2]]
833 # large triangle
834 large_triangle = large_circle
835 # large drum2d
836 w_large_drum2d = R_large* 0.2
837 large_drum2d = [R_large, w_large_drum2d, center[0], center[1], center[2]]
838 # large hex
839 large_hex = large_circle
840
841
842 final_time = 0.1
843 num_steps = 40000
844 # final_time = 0.00002
845 # num_steps = 2
846 num_outputs = 40
847 dt_out_n = num_steps / num_outputs
848 test_dt_out_n = dt_out_n / 10
849 perform_out = True
850
851
852 poisson = 0.25
853
854 rho_wall = 600.
855 K_wall = 1.e+4
856 E_wall = get_E(K_wall, poisson)
857 G_wall = get_G(E_wall, poisson)
858 Gc_wall = 100.
859
860 rho_small = 600.
861 K_small = 5.e+3
862 E_small = get_E(K_small, poisson)
863 G_small = get_G(E_small, poisson)
864 Gc_small = 100.
865
866 rho_large = rho_small
867 K_large = K_small
868 E_large = E_small
869 G_large = G_small
870 Gc_large = Gc_small
871
872
875 R_contact_factor = 0.95
876
877 # Kn_V_max = 7.385158e+05
878 # Kn = np.power(Kn_V_max, 2)
879 # compute from bulk modulus
880
881 # from bulk modulus
882 Kn_small_small = 18. * get_eff_k(K_small, K_small) / (np.pi * np.power(horizon, 5))
883 Kn_large_large = 18. * get_eff_k(K_large, K_large) / (np.pi * np.power(horizon, 5))
884 Kn_wall_wall = 18. * get_eff_k(K_wall, K_wall) / (np.pi * np.power(horizon, 5))
885 Kn_small_large = 18. * get_eff_k(K_small, K_large) / (np.pi * np.power(horizon, 5))
886 Kn_small_wall = 18. * get_eff_k(K_small, K_wall) / (np.pi * np.power(horizon, 5))
887 Kn_large_wall = 18. * get_eff_k(K_large, K_wall) / (np.pi * np.power(horizon, 5))
888
889 beta_n_eps = 0.95
890 friction_coeff = 0.5
891 damping_active = False
892 friction_active = False
893 beta_n_factor = 100.
894 Kn_factor = 1.
895
896
897 gravity_active = True
898 gravity = [0., -10., 0.]
899
900
901 wall_rotation_rate = -40. * np.pi
902 wall_rotation_center = [-0.2*R_in, 0.2*R_in, 0.]
903
904
905 neigh_search_factor = 10.
906 neigh_search_interval = 100
907 neigh_search_criteria = "simple_all"
908
909
912
913 # generate particle locations
914 padding = 1.1 * R_contact_factor * mesh_size
915 max_y = 0.4*R_in
916 # number of particles of small and large sizes
917 N1, N2 = 40, 12
918 num_particles_zones_1_to_8, particles_zones_1_to_8 = particle_locations(inp_dir, pp_tag, center, padding, max_y, mesh_size, R_small, R_large, [0, 1, 2, 3], [4, 5, 6, 7], N1, N2, R_in, bar_rectangle_attached_to_cylinder, z_coord = 0., add_orient = True)
919
920 # generate particle .geo file (large)
921 zones_mesh_fnames = ["mesh_cir_small", "mesh_tri_small", "mesh_drum2d_small", "mesh_hex_small", "mesh_cir_large", "mesh_tri_large", "mesh_drum2d_large", "mesh_hex_large", "mesh_wall"]
922
923
924 generate_cir_particle_gmsh_input(inp_dir, zones_mesh_fnames[0], center, R_small, mesh_size, pp_tag)
925 generate_cir_particle_gmsh_input(inp_dir, zones_mesh_fnames[4], center, R_large, mesh_size, pp_tag)
926
927
928 generate_tri_particle_gmsh_input(inp_dir, zones_mesh_fnames[1], center, R_small, mesh_size, pp_tag)
929 generate_tri_particle_gmsh_input(inp_dir, zones_mesh_fnames[5], center, R_large, mesh_size, pp_tag)
930
931
932 generate_drum2d_particle_gmsh_input(inp_dir, zones_mesh_fnames[2], center, R_small, 2.*w_small_drum2d, mesh_size, pp_tag)
933 generate_drum2d_particle_gmsh_input(inp_dir, zones_mesh_fnames[6], center, R_large, 2.*w_large_drum2d, mesh_size, pp_tag)
934
935
936 generate_hex_particle_gmsh_input(inp_dir, zones_mesh_fnames[3], center, R_small, mesh_size, pp_tag)
937 generate_hex_particle_gmsh_input(inp_dir, zones_mesh_fnames[7], center, R_large, mesh_size, pp_tag)
938
939
940 generate_cylindrical_wall_gmsh_input(inp_dir, zones_mesh_fnames[8], center, R_out, R_in, W_bar, L_bar, mesh_size, pp_tag)
941
942 os.system("mkdir -p ../out")
943
944 for s in zones_mesh_fnames:
945 print('\n')
946 print(s)
947 print("gmsh {}_{}.geo -2 &> /dev/null".format(s, pp_tag))
948 print('\n')
949
950 os.system("gmsh {}_{}.geo -2".format(s, pp_tag))
951 #os.system("gmsh {}_{}.geo -2 &> /dev/null".format(s, pp_tag))
952 #os.system("gmsh {}_{}.geo -2 -o {}_{}.vtk &> /dev/null".format(s, pp_tag, s, pp_tag))
953
954
955
959 inpf = open(sim_inp_dir + 'input_' + str(pp_tag) + '.yaml','w')
960 inpf.write("Model:\n")
961 inpf.write(" Dimension: 2\n")
962 inpf.write(" Discretization_Type:\n")
963 inpf.write(" Spatial: finite_difference\n")
964 inpf.write(" Time: central_difference\n")
965 inpf.write(" Final_Time: %4.6e\n" % (final_time))
966 inpf.write(" Time_Steps: %d\n" % (num_steps))
967
968 # container info
969 inpf.write("Container:\n")
970 inpf.write(" Geometry:\n")
971 inpf.write(" Type: complex\n")
972 inpf.write(" Vec_Type: [circle, circle, rectangle]\n")
973 inpf.write(" Vec_Flag: [plus, minus, plus]\n")
974 inpf.write(" Parameters: " + print_dbl_list(wall_params))
975
976 # zone info
977 inpf.write("Zone:\n")
978 inpf.write(" Zones: 9\n")
979
980 for i in range(9):
981 inpf.write(" Zone_%d:\n" % (i+1))
982 if i == 8:
983 inpf.write(" Is_Wall: true\n")
984 else:
985 inpf.write(" Is_Wall: false\n")
986
987 # particle info
988 inpf.write("Particle:\n")
989 inpf.write(" Test_Name: multi_particle_attrition\n")
990
991 particle_data = [['circle', small_circle], ['triangle', small_triangle], ['drum2d', small_drum2d], ['hexagon', small_hex], ['circle', large_circle], ['triangle', large_triangle], ['drum2d', large_drum2d], ['hexagon', large_hex]]
992 for i in range(len(particle_data)):
993 inpf.write(" Zone_%d:\n" % (i+1))
994 inpf.write(" Type: %s\n" % (particle_data[i][0]))
995 inpf.write(" Parameters: " + print_dbl_list((particle_data[i][1])))
996
997
998 inpf.write(" Zone_9:\n")
999 inpf.write(" Is_Wall: true\n")
1000 inpf.write(" Type: complex\n")
1001 inpf.write(" Vec_Type: [circle, circle, rectangle]\n")
1002 inpf.write(" Vec_Flag: [plus, minus, plus]\n")
1003 inpf.write(" Parameters: " + print_dbl_list(wall_params))
1004 inpf.write(" All_Dofs_Constrained: true\n")
1005 inpf.write(" Create_Particle_Using_ParticleZone_GeomObject: true\n")
1006
1007 # particle generation
1008 inpf.write("Particle_Generation:\n")
1009 inpf.write(" From_File: particle_locations_" + str(pp_tag) + ".csv\n")
1010 inpf.write(" File_Data_Type: loc_rad_orient\n")
1011
1012 # Mesh info
1013 inpf.write("Mesh:\n")
1014
1015 for i in range(9):
1016 inpf.write(" Zone_%d:\n" % (i+1))
1017 inpf.write(" File: %s\n" % (zones_mesh_fnames[i] + "_" + str(pp_tag) + ".msh"))
1018
1019 # Contact info
1020 inpf.write("Contact:\n")
1021
1022
1023 write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, "11", Kn_small_small)
1024
1025
1026 copy_contact_zone(inpf, [12, 13, 14], [1, 1])
1027
1028
1029 write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, "15", Kn_small_large)
1030
1031
1032 copy_contact_zone(inpf, [16, 17, 18], [1, 5])
1033
1034
1035 write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, "19", Kn_small_wall)
1036
1037
1038 copy_contact_zone(inpf, [22, 23, 24], [1, 1])
1039
1040
1041 copy_contact_zone(inpf, [25, 26, 27, 28], [1, 5])
1042
1043
1044 copy_contact_zone(inpf, [29], [1, 9])
1045
1046
1047 copy_contact_zone(inpf, [33, 34], [1, 1])
1048
1049
1050 copy_contact_zone(inpf, [35, 36, 37, 38], [1, 5])
1051
1052
1053 copy_contact_zone(inpf, [39], [1, 9])
1054
1055
1056 copy_contact_zone(inpf, [44], [1, 1])
1057
1058
1059 copy_contact_zone(inpf, [45, 46, 47, 48], [1, 5])
1060
1061
1062 copy_contact_zone(inpf, [49], [1, 9])
1063
1064
1065 write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, "55", Kn_large_large)
1066
1067
1068 copy_contact_zone(inpf, [56, 57, 58], [5, 5])
1069
1070
1071 write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, "59", Kn_large_wall)
1072
1073
1074 copy_contact_zone(inpf, [66, 67, 68], [5, 5])
1075
1076
1077 copy_contact_zone(inpf, [69], [5, 9])
1078
1079
1080 copy_contact_zone(inpf, [77, 78], [5, 5])
1081
1082
1083 copy_contact_zone(inpf, [79], [5, 9])
1084
1085
1086 copy_contact_zone(inpf, [88], [5, 5])
1087
1088
1089 copy_contact_zone(inpf, [89], [5, 9])
1090
1091
1092 write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, "99", Kn_wall_wall)
1093
1094 # Neighbor info
1095 inpf.write("Neighbor:\n")
1096 inpf.write(" Update_Criteria: %s\n" % (neigh_search_criteria))
1097 inpf.write(" Search_Factor: %4.e\n" % (neigh_search_factor))
1098 inpf.write(" Search_Interval: %d\n" % (neigh_search_interval))
1099
1100 # Material info
1101 inpf.write("Material:\n")
1102
1103
1104 write_material_zone_part(inpf, "1", horizon, rho_small, K_small, G_small, Gc_small)
1105
1106
1107 inpf.write(" Zone_2:\n")
1108 inpf.write(" Copy_Material_Data: 1\n")
1109
1110
1111 inpf.write(" Zone_3:\n")
1112 inpf.write(" Copy_Material_Data: 1\n")
1113
1114
1115 inpf.write(" Zone_4:\n")
1116 inpf.write(" Copy_Material_Data: 1\n")
1117
1118
1119 write_material_zone_part(inpf, "5", horizon, rho_large, K_large, G_large, Gc_large)
1120
1121
1122 inpf.write(" Zone_6:\n")
1123 inpf.write(" Copy_Material_Data: 5\n")
1124
1125
1126 inpf.write(" Zone_7:\n")
1127 inpf.write(" Copy_Material_Data: 5\n")
1128
1129
1130 inpf.write(" Zone_8:\n")
1131 inpf.write(" Copy_Material_Data: 5\n")
1132
1133
1134 write_material_zone_part(inpf, "9", horizon, rho_wall, K_wall, G_wall, Gc_wall)
1135
1136 # Force
1137 if gravity_active == True:
1138 inpf.write("Force_BC:\n")
1139 inpf.write(" Gravity: " + print_dbl_list(gravity))
1140
1141 # Displacement
1142 inpf.write("Displacement_BC:\n")
1143 inpf.write(" Sets: 1\n")
1144
1145 inpf.write(" Set_1:\n")
1146 # wall particle id will be num_particles_zones_1_to_8
1147 inpf.write(" Particle_List: [%d]\n" % (num_particles_zones_1_to_8))
1148 inpf.write(" Direction: [1,2]\n")
1149 inpf.write(" Time_Function:\n")
1150 inpf.write(" Type: rotation\n")
1151 inpf.write(" Parameters: "+print_dbl_list([wall_rotation_rate, wall_rotation_center[0], wall_rotation_center[1], wall_rotation_center[2]]))
1152 inpf.write(" Spatial_Function:\n")
1153 inpf.write(" Type: rotation\n")
1154 inpf.write(" Zero_Displacement: false\n")
1155
1156 #
1157 # Output info
1158 #
1159 inpf.write("Output:\n")
1160 inpf.write(" Path: ../out/\n")
1161 inpf.write(" Tags:\n")
1162 inpf.write(" - Displacement\n")
1163 inpf.write(" - Velocity\n")
1164 inpf.write(" - Force\n")
1165 inpf.write(" - Force_Density\n")
1166 inpf.write(" - Damage_Z\n")
1167 inpf.write(" - Damage\n")
1168 inpf.write(" - Nodal_Volume\n")
1169 inpf.write(" - Zone_ID\n")
1170 inpf.write(" - Particle_ID\n")
1171 inpf.write(" - Fixity\n")
1172 inpf.write(" - Force_Fixity\n")
1173 inpf.write(" - Contact_Nodes\n")
1174 inpf.write(" - No_Fail_Node\n")
1175 inpf.write(" - Boundary_Node_Flag\n")
1176 # inpf.write(" - Contact_Data\n")
1177 # inpf.write(" - Strain_Stress\n")
1178 inpf.write(" Output_Interval: %d\n" % (dt_out_n))
1179 inpf.write(" Compress_Type: zlib\n")
1180 inpf.write(" Perform_FE_Out: false\n")
1181 if perform_out:
1182 inpf.write(" Perform_Out: true\n")
1183 else:
1184 inpf.write(" Perform_Out: false\n")
1185 inpf.write(" Test_Output_Interval: %d\n" % (test_dt_out_n))
1186
1187 inpf.write(" Debug: 2\n")
1188 inpf.write(" Tag_PP: %d\n" %(int(pp_tag)))
1189
1190 # close file
1191 inpf.close()
1192
1193

References copy_contact_zone(), generate_cir_particle_gmsh_input(), generate_cylindrical_wall_gmsh_input(), generate_drum2d_particle_gmsh_input(), generate_hex_particle_gmsh_input(), generate_tri_particle_gmsh_input(), get_E(), get_eff_k(), get_G(), particle_locations(), print_dbl_list(), write_contact_zone_part(), and write_material_zone_part().

Referenced by generate_drum_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), generate_wall_gmsh_input(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ does_intersect()

problem_setup.does_intersect (   p,
  r,
  R,
  particles,
  padding 
)

Definition at line 47 of file problem_setup.py.

47def does_intersect(p, r, R, particles, padding):
48
49 for q in particles:
50
51 pq = np.array([p[i] - q[i] for i in range(3)])
52 if np.linalg.norm(pq) <= r + R + padding:
53 return True
54
55 return False
56
57

References rotate().

Here is the call graph for this function:

◆ does_intersect_rect()

problem_setup.does_intersect_rect (   p,
  r,
  particles,
  padding,
  rect 
)

Definition at line 49 of file problem_setup.py.

49def does_intersect_rect(p, r, particles, padding, rect):
50
51 # check intersection with rectangle
52 pr = [p[0] - r, p[1] - r, p[2], p[0] + r, p[1] + r, p[2]]
53
54 if pr[0] < rect[0] + padding or pr[1] < rect[1] + padding or pr[3] > rect[3] - padding or pr[4] > rect[4] - padding:
55
56 # print('circle (xc = {}, r = {:5.3e}) intersects rect = {} with pad = {:5.3e}'.format(p, r, rect, padding))
57
58 return True
59
60 # loop over particles
61 # for pi in particles:
62 # dx = [p[0] - pi[1], p[1] - pi[2], p[2] - pi[3]]
63 # rR = r + pi[4] + padding
64 # if np.linalg.norm(dx) < rR:
65 # return True
66
67 # print('circle (xc = {}, r = {:5.3e}) does not intersects rect = {} with pad = {:5.3e}'.format(p, r, rect, padding))
68 return False
69

References rotate().

Referenced by particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ does_intersect_with_cylindrical_wall()

problem_setup.does_intersect_with_cylindrical_wall (   p,
  particles,
  R_in,
  center,
  bar_rect,
  padding 
)

Definition at line 248 of file problem_setup.py.

248def does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding):
249
250 # p -> [id, x, y, z, r]
251
252 p_center = [p[i+1] for i in range(3)]
253 p_r = p[4]
254
255 for q in particles:
256
257 pq = np.array([p[i+1] - q[i+1] for i in range(3)])
258 if np.linalg.norm(pq) <= p[-1] + q[-1] + padding:
259 return True
260
261 dx = np.array([p[i+1] - center[i] for i in range(3)])
262 if np.linalg.norm(dx) > R_in - p[-1] - padding:
263 return True
264
265
266 p_rect = [p_center[0] - p_r, p_center[1] - p_r, p_center[2], p_center[0] + p_r, p_center[1] + p_r, p_center[2]]
267
268 return does_rect_intersect_rect(p_rect, bar_rect, padding)
269

References does_rect_intersect_rect().

Referenced by particle_locations(), particle_locations(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ does_intersect_with_rectangle_wall_with_protrusion_and_opening()

problem_setup.does_intersect_with_rectangle_wall_with_protrusion_and_opening (   p,
  particles,
  Lin,
  Win,
  center,
  padding 
)

Definition at line 304 of file problem_setup.py.

304def does_intersect_with_rectangle_wall_with_protrusion_and_opening(p, particles, Lin, Win, center, padding):
305
306 # p -> [id, x, y, z, r]
307
308 p_center = [p[i+1] for i in range(3)]
309 p_r = p[4]
310 p_rect = [[p_center[0] - p_r, p_center[1] - p_r, p_center[2]], [p_center[0] + p_r, p_center[1] + p_r, p_center[2]]]
311
312 for q in particles:
313
314 pq = np.array([p[i+1] - q[i+1] for i in range(3)])
315 if np.linalg.norm(pq) <= p[-1] + q[-1] + padding:
316 return True
317
318 dx = np.array([p[i+1] - center[i] for i in range(3)])
319 if np.abs(dx[0]) > 0.5*Lin - p[-1] - padding:
320 return True
321
322 if np.abs(dx[1]) > 0.5*Win - p[-1] - padding:
323 return True
324
325 # get protrusion points and approximate the protruding region using rectangle and check for intersection
326 # process triangle protrusion
327 p2, p1, p3 = get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win)
328 tri_protrsn_rect_left_bottom = p2
329 tri_protrsn_rect_right_top = [p2[0] + (p1[0] - p2[0]), p2[1] + (p3[1] - p2[1]), p2[2]]
330
331 if does_rect_intersect_rect_use_pair_coord(p_rect, [tri_protrsn_rect_left_bottom, tri_protrsn_rect_right_top], padding):
332 return True
333
334
335 # process circular protrusion
336 circ_protrsn_r, p1, p4, p2, p3 = get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win)
337
338 circ_protrsn_rect_left_bottom = p1
339 circ_protrsn_rect_right_top = [p1[0] + 2 * circ_protrsn_r, p1[1] + circ_protrsn_r, p1[2]]
340
341 return does_rect_intersect_rect_use_pair_coord(p_rect, [circ_protrsn_rect_left_bottom, circ_protrsn_rect_right_top], padding)
342

References does_intersect_with_rectangle_wall_with_protrusion_and_opening(), does_rect_intersect_rect_use_pair_coord(), get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), get_ref_drum_points(), get_ref_hex_points(), get_ref_triangle_points(), and get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening().

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), and get_center().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ does_particle_intersect()

problem_setup.does_particle_intersect (   p,
  particles,
  rect,
  padding 
)

Definition at line 294 of file problem_setup.py.

294def does_particle_intersect(p, particles, rect, padding):
295
296 # p -> [id, x, y, z, r]
297
298 p_center = [p[i+1] for i in range(3)]
299 p_r = p[4]
300 p_rect = [p_center[0] - p_r, p_center[1] - p_r, p_center[2], p_center[0] + p_r, p_center[1] + p_r, p_center[2]]
301
302 if p_rect[0] < rect[0] + padding or p_rect[1] < rect[1] + padding or p_rect[3] > rect[3] - padding or p_rect[4] > rect[4] - padding:
303 return True
304
305 for q in particles:
306 pq = np.array([p[i+1] - q[i+1] for i in range(3)])
307 if np.linalg.norm(pq) <= p[-1] + q[-1] + padding:
308 return True
309
310 return False
311
312

References does_particle_intersect(), and get_max().

Referenced by does_particle_intersect().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ does_particle_intersect_rect()

problem_setup.does_particle_intersect_rect (   p,
  r2,
  padding 
)

Definition at line 286 of file problem_setup.py.

286def does_particle_intersect_rect(p, r2, padding):
287
288 pr = p[4]
289 pc = [p[1], p[2], p[3]]
290 p_rect = [pc[0] - pr, pc[1] - pr, pc[2], pc[1] + pr, pc[2] + pr, pc[2]]
291
292 return does_rect_intersect_rect(p_rect, r2, padding)
293

References does_rect_intersect_rect().

Here is the call graph for this function:

◆ does_rect_intersect_rect()

problem_setup.does_rect_intersect_rect (   r1,
  r2,
  padding 
)

Definition at line 241 of file problem_setup.py.

241def does_rect_intersect_rect(r1, r2, padding):
242
243 # enlarge rectangle by adding padding
244 r1_padding = [r1[0] - padding, r1[1] - padding, r1[2], r1[3] + padding, r1[4] + padding, r1[5]]
245
246 return r1_padding[0] < r2[3] and r1_padding[3] > r2[0] and r1_padding[1] < r2[4] and r1_padding[4] > r2[1]
247

Referenced by does_intersect_with_cylindrical_wall(), and does_particle_intersect_rect().

Here is the caller graph for this function:

◆ does_rect_intersect_rect_use_pair_coord()

problem_setup.does_rect_intersect_rect_use_pair_coord (   r1,
  r2,
  padding 
)

Definition at line 293 of file problem_setup.py.

293def does_rect_intersect_rect_use_pair_coord(r1, r2, padding):
294
295 # enlarge rectangle by adding padding
296 p1_r1_padding = [r1[0][0] - padding, r1[0][1] - padding, r1[0][2]]
297 p2_r1_padding = [r1[1][0] + padding, r1[1][1] + padding, r1[0][2]]
298
299 p1_r2 = r2[0]
300 p2_r2 = r2[1]
301
302 return p1_r1_padding[0] < p2_r2[0] and p2_r1_padding[0] > p1_r2[0] and p1_r1_padding[1] < p2_r2[1] and p2_r1_padding[1] > p1_r2[1]
303

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), and get_center().

Here is the caller graph for this function:

◆ generate_cir_particle_gmsh_input()

problem_setup.generate_cir_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  mesh_size,
  pp_tag 
)

Definition at line 466 of file problem_setup.py.

466def generate_cir_particle_gmsh_input(inp_dir, filename, center, radius, mesh_size, pp_tag):
467
468 sim_inp_dir = str(inp_dir)
469
470 # center and radius
471 sim_Cx = center[0]
472 sim_Cy = center[1]
473 sim_Cz = center[2]
474 sim_radius = radius
475
476 # mesh size
477 sim_h = mesh_size
478
479 #
480 # create .geo file for gmsh
481 #
482 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
483 geof.write("cl__1 = 1;\n")
484 geof.write("Mesh.MshFileVersion = 2.2;\n")
485
486 #
487 # points
488 #
489 geof.write("Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy, sim_Cz, sim_h));
490 geof.write("Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx + sim_radius, sim_Cy, sim_Cz, sim_h))
491 geof.write("Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx - sim_radius, sim_Cy, sim_Cz, sim_h))
492 geof.write("Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy + sim_radius, sim_Cz, sim_h))
493 geof.write("Point(5) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy - sim_radius, sim_Cz, sim_h))
494
495 #
496 # circlular arc
497 #
498 geof.write("Circle(1) = {2, 1, 4};\n")
499 geof.write("Circle(2) = {4, 1, 3};\n")
500 geof.write("Circle(3) = {3, 1, 5};\n")
501 geof.write("Circle(4) = {5, 1, 2};\n")
502
503 #
504 # surfaces
505 #
506 geof.write("Line Loop(1) = {2, 3, 4, 1};\n")
507
508 #
509 # plane surface
510 #
511 geof.write("Plane Surface(1) = {1};\n")
512
513 #
514 # physical surface
515 #
516 # tag = '"' + "a" + '"'
517 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
518
519 # # add center point to plane surface
520 geof.write("Point{1} In Surface {1};")
521
522 # close file
523 geof.close()
524
525

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ generate_cylindrical_wall_gmsh_input()

problem_setup.generate_cylindrical_wall_gmsh_input (   inp_dir,
  filename,
  center,
  outer_radius,
  inner_radius,
  bar_width,
  bar_length,
  mesh_size,
  pp_tag 
)

Definition at line 696 of file problem_setup.py.

696def generate_cylindrical_wall_gmsh_input(inp_dir, filename, center, outer_radius, inner_radius, bar_width, bar_length, mesh_size, pp_tag):
697
698 sim_inp_dir = str(inp_dir)
699
700 # center and radius
701 Cx = center[0]
702 Cy = center[1]
703 Cz = center[2]
704
705 #
706 # create .geo file for gmsh
707 #
708 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
709 geof.write("cl__1 = 1;\n")
710 geof.write("Mesh.MshFileVersion = 2.2;\n")
711
712 #
713 # points
714 #
715 points = []
716 points.append([Cx, Cy, Cz])
717 points.append([outer_radius, 0., 0.])
718 points.append([0., outer_radius, 0.])
719 points.append([-outer_radius, 0., 0.])
720 points.append([0., -outer_radius, 0.])
721 points.append([inner_radius, 0.5*bar_width, 0.])
722 points.append([inner_radius, -0.5*bar_width, 0.])
723 points.append([0., inner_radius, 0.])
724 points.append([-inner_radius, 0., 0.])
725 points.append([0., -inner_radius, 0.])
726 points.append([inner_radius - bar_length, 0.5*bar_width, 0.])
727 points.append([inner_radius - bar_length, -0.5*bar_width, 0.])
728
729 count = 0
730 for p in points:
731 count += 1
732 geof.write("Point(%d) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (count, p[0], p[1], p[2], mesh_size))
733
734
735 #
736 # circular arc
737 #
738 circles = []
739 circles.append([2, 1, 3])
740 circles.append([3, 1, 4])
741 circles.append([4, 1, 5])
742 circles.append([5, 1, 2])
743
744 circles.append([6, 1, 8])
745 circles.append([8, 1, 9])
746 circles.append([9, 1, 10])
747 circles.append([10, 1, 7])
748
749 count = 0
750 for c in circles:
751 count += 1
752 geof.write("Circle(%d) = {%d, %d, %d};\n" % (count, c[0], c[1], c[2]))
753
754 #
755 # line
756 #
757 lines = []
758 lines.append([6, 11])
759 lines.append([11, 12])
760 lines.append([12, 7])
761 #count = 0
762 for l in lines:
763 count += 1
764 geof.write("Line(%d) = {%d, %d};\n" % (count, l[0], l[1]))
765
766 #
767 # curve loop
768 #
769 geof.write("Line Loop(1) = {2, 3, 4, 1};\n")
770 geof.write("Line Loop(2) = {6, 7, 8, -11, -10, -9, 5};\n")
771
772 #
773 # plane surface and physical tag
774 #
775 geof.write("Plane Surface(1) = {1, 2};\n")
776 #geof.write("Physical Surface(1) = {1};\n")
777 #geof.write("Physical Point(2) = {9, 4, 10, 5, 2, 7, 6, 11, 12, 3, 8};\n")
778 tag = '"' + "a" + '"'
779 geof.write("Physical Surface(%s) = {1};\n" % (tag))
780
781 geof.close()
782
783

Referenced by create_input_file().

Here is the caller graph for this function:

◆ generate_drum2d_particle_gmsh_input()

problem_setup.generate_drum2d_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  width,
  mesh_size,
  pp_tag 
)

Definition at line 638 of file problem_setup.py.

638def generate_drum2d_particle_gmsh_input(inp_dir, filename, center, radius, width, mesh_size, pp_tag):
639
640 sim_inp_dir = str(inp_dir)
641
642 # points
643 points = get_ref_drum_points(center, radius, width, True)
644
645 #
646 # create .geo file for gmsh
647 #
648 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
649 geof.write("cl__1 = 1;\n")
650 geof.write("Mesh.MshFileVersion = 2.2;\n")
651
652 #
653 # points
654 #
655 for i in range(7):
656 p = points[i]
657 sts = "Point({}) = ".format(i+1)
658 sts += "{"
659 sts += "{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
660 sts += "};\n"
661 geof.write(sts);
662
663 #
664 # circlular arc
665 #
666 geof.write("Line(1) = {2, 3};\n")
667 geof.write("Line(2) = {3, 4};\n")
668 geof.write("Line(3) = {4, 5};\n")
669 geof.write("Line(4) = {5, 6};\n")
670 geof.write("Line(5) = {6, 7};\n")
671 geof.write("Line(6) = {7, 2};\n")
672
673 #
674 # surfaces
675 #
676 geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6};\n")
677
678 #
679 # plane surface
680 #
681 geof.write("Plane Surface(1) = {1};\n")
682
683 #
684 # physical surface
685 #
686 # tag = '"' + "a" + '"'
687 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
688
689 # # add center point to plane surface
690 geof.write("Point{1} In Surface {1};")
691
692 # close file
693 geof.close()
694
695

References get_ref_drum_points().

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_drum_particle_gmsh_input()

problem_setup.generate_drum_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  width,
  mesh_size,
  pp_tag 
)

Definition at line 260 of file problem_setup.py.

260def generate_drum_particle_gmsh_input(inp_dir, filename, center, radius, width, mesh_size, pp_tag):
261
262 sim_inp_dir = str(inp_dir)
263
264 # points
265 points = get_ref_drum_points(center, radius, width, True)
266
267 #
268 # create .geo file for gmsh
269 #
270 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
271 geof.write("cl__1 = 1;\n")
272 geof.write("Mesh.MshFileVersion = 2.2;\n")
273
274 #
275 # points
276 #
277 for i in range(7):
278 p = points[i]
279 sts = "Point({}) = ".format(i+1)
280 sts += "{"
281 sts += "{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
282 sts += "};\n"
283 geof.write(sts);
284
285 #
286 # circlular arc
287 #
288 geof.write("Line(1) = {2, 3};\n")
289 geof.write("Line(2) = {3, 4};\n")
290 geof.write("Line(3) = {4, 5};\n")
291 geof.write("Line(4) = {5, 6};\n")
292 geof.write("Line(5) = {6, 7};\n")
293 geof.write("Line(6) = {7, 2};\n")
294
295 #
296 # surfaces
297 #
298 geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6};\n")
299
300 #
301 # plane surface
302 #
303 geof.write("Plane Surface(1) = {1};\n")
304
305 #
306 # physical surface
307 #
308 # tag = '"' + "a" + '"'
309 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
310
311 # # add center point to plane surface
312 geof.write("Point{1} In Surface {1};")
313
314 # close file
315 geof.close()
316
317
318

References create_input_file(), generate_drum_particle_gmsh_input(), generate_hex_particle_gmsh_input(), get_E(), get_eff_k(), get_G(), get_ref_drum_points(), particle_locations_orient(), and print_dbl_list().

Referenced by generate_drum_particle_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_hex_particle_gmsh_input()

problem_setup.generate_hex_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  mesh_size,
  pp_tag 
)

Definition at line 526 of file problem_setup.py.

526def generate_hex_particle_gmsh_input(inp_dir, filename, center, radius, mesh_size, pp_tag):
527
528 sim_inp_dir = str(inp_dir)
529
530 points = get_ref_hex_points(center, radius, True)
531
532 #
533 # create .geo file for gmsh
534 #
535 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
536 geof.write("cl__1 = 1;\n")
537 geof.write("Mesh.MshFileVersion = 2.2;\n")
538
539 #
540 # points
541 #
542 for i in range(7):
543 p = points[i]
544 sts = "Point({}) = ".format(i+1)
545 sts += "{"
546 sts += "{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
547 sts += "};\n"
548 geof.write(sts);
549
550 #
551 # circlular arc
552 #
553 geof.write("Line(1) = {2, 3};\n")
554 geof.write("Line(2) = {3, 4};\n")
555 geof.write("Line(3) = {4, 5};\n")
556 geof.write("Line(4) = {5, 6};\n")
557 geof.write("Line(5) = {6, 7};\n")
558 geof.write("Line(6) = {7, 2};\n")
559
560 #
561 # surfaces
562 #
563 geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6};\n")
564
565 #
566 # plane surface
567 #
568 geof.write("Plane Surface(1) = {1};\n")
569
570 #
571 # physical surface
572 #
573 # tag = '"' + "a" + '"'
574 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
575
576 # # add center point to plane surface
577 geof.write("Point{1} In Surface {1};")
578
579 # close file
580 geof.close()
581
582

References get_ref_hex_points().

Referenced by create_input_file(), generate_drum_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_moving_rect_wall_gmsh_input()

problem_setup.generate_moving_rect_wall_gmsh_input (   inp_dir,
  filename,
  rectangle,
  mesh_size,
  pp_tag 
)

Definition at line 1096 of file problem_setup.py.

1096def generate_moving_rect_wall_gmsh_input(inp_dir, filename, rectangle, mesh_size, pp_tag):
1097
1098 sim_inp_dir = str(inp_dir)
1099
1100 # outer rectangle
1101 sim_Lx_out1 = rectangle[0]
1102 sim_Ly_out1 = rectangle[1]
1103 sim_Lz_out1 = rectangle[2]
1104 sim_Lx_out2 = rectangle[3]
1105 sim_Ly_out2 = rectangle[4]
1106 sim_Lz_out2 = rectangle[5]
1107
1108 # mesh size
1109 sim_h = mesh_size
1110
1111 #
1112 # create .geo file for gmsh
1113 #
1114 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
1115 geof.write("cl__1 = 1;\n")
1116 geof.write("Mesh.MshFileVersion = 2.2;\n")
1117
1118 #
1119 # points
1120 #
1121 geof.write("Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out1, sim_Lz_out1, sim_h));
1122 geof.write("Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out1, sim_Lz_out1, sim_h))
1123 geof.write("Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out2, sim_Lz_out1, sim_h))
1124 geof.write("Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out2, sim_Lz_out1, sim_h))
1125
1126 #
1127 # lines
1128 #
1129 geof.write("Line(1) = {1, 2};\n")
1130 geof.write("Line(2) = {2, 3};\n")
1131 geof.write("Line(3) = {3, 4};\n")
1132 geof.write("Line(4) = {4, 1};\n")
1133
1134 #
1135 # surfaces
1136 #
1137 geof.write("Line Loop(1) = {1, 2, 3, 4};\n")
1138
1139 #
1140 # plane surface
1141 #
1142 geof.write("Plane Surface(1) = {1};\n")
1143
1144 #
1145 # physical surface
1146 #
1147 tag = '"' + "a" + '"'
1148 geof.write("Physical Surface(%s) = {1};\n" % (tag))
1149
1150 # close file
1151 geof.close()
1152

References copy_contact_zone(), create_input_file(), generate_cir_particle_gmsh_input(), generate_drum2d_particle_gmsh_input(), generate_hex_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_rigid_rect_container_moving_wall_setup_gmsh_input(), generate_tri_particle_gmsh_input(), get_E(), get_eff_k(), get_G(), particle_locations(), print_dbl_list(), write_contact_zone_part(), and write_material_zone_part().

Referenced by generate_moving_rect_wall_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_moving_wall_gmsh_input()

problem_setup.generate_moving_wall_gmsh_input (   inp_dir,
  filename,
  rectangle,
  mesh_size,
  pp_tag 
)

Definition at line 486 of file problem_setup.py.

486def generate_moving_wall_gmsh_input(inp_dir, filename, rectangle, mesh_size, pp_tag):
487
488 sim_inp_dir = str(inp_dir)
489
490 # outer rectangle
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]
497
498 # mesh size
499 sim_h = mesh_size
500
501 #
502 # create .geo file for gmsh
503 #
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")
507
508 #
509 # points
510 #
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))
515
516 #
517 # lines
518 #
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")
523
524 #
525 # surfaces
526 #
527 geof.write("Line Loop(1) = {1, 2, 3, 4};\n")
528
529 #
530 # plane surface
531 #
532 geof.write("Plane Surface(1) = {1};\n")
533
534 #
535 # physical surface
536 #
537 tag = '"' + "a" + '"'
538 geof.write("Physical Surface(%s) = {1};\n" % (tag))
539
540 # close file
541 geof.close()
542
543

References create_input_file(), generate_cir_particle_gmsh_input(), generate_hex_particle_gmsh_input(), generate_moving_wall_gmsh_input(), generate_rigid_wall_gmsh_input(), get_E(), get_eff_k(), get_G(), particle_locations(), and print_dbl_list().

Referenced by generate_moving_wall_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_particle_gmsh_input() [1/2]

problem_setup.generate_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  mesh_size,
  pp_tag 
)

Definition at line 84 of file problem_setup.py.

84def generate_particle_gmsh_input(inp_dir, filename, center, radius, mesh_size, pp_tag):
85
86 sim_inp_dir = str(inp_dir)
87
88 # center and radius
89 sim_Cx = center[0]
90 sim_Cy = center[1]
91 sim_Cz = center[2]
92 sim_radius = radius
93
94 # mesh size
95 sim_h = mesh_size
96
97 #
98 # create .geo file for gmsh
99 #
100 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
101 geof.write("cl__1 = 1;\n")
102 geof.write("Mesh.MshFileVersion = 2.2;\n")
103
104 #
105 # points
106 #
107 geof.write("Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy, sim_Cz, sim_h));
108 geof.write("Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx + sim_radius, sim_Cy, sim_Cz, sim_h))
109 geof.write("Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx - sim_radius, sim_Cy, sim_Cz, sim_h))
110 geof.write("Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy + sim_radius, sim_Cz, sim_h))
111 geof.write("Point(5) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Cx, sim_Cy - sim_radius, sim_Cz, sim_h))
112
113 #
114 # circlular arc
115 #
116 geof.write("Circle(1) = {2, 1, 4};\n")
117 geof.write("Circle(2) = {4, 1, 3};\n")
118 geof.write("Circle(3) = {3, 1, 5};\n")
119 geof.write("Circle(4) = {5, 1, 2};\n")
120
121 #
122 # surfaces
123 #
124 geof.write("Line Loop(1) = {2, 3, 4, 1};\n")
125
126 #
127 # plane surface
128 #
129 geof.write("Plane Surface(1) = {1};\n")
130
131 #
132 # physical surface
133 #
134 # tag = '"' + "a" + '"'
135 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
136
137 # # add center point to plane surface
138 geof.write("Point{1} In Surface {1};")
139
140 # close file
141 geof.close()
142
143
144

References create_input_file(), generate_particle_gmsh_input(), get_E(), get_eff_k(), get_G(), particle_locations(), and print_dbl_list().

Referenced by generate_particle_gmsh_input(), and generate_wall_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_particle_gmsh_input() [2/2]

problem_setup.generate_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  width,
  mesh_size,
  pp_tag 
)

Definition at line 173 of file problem_setup.py.

173def generate_particle_gmsh_input(inp_dir, filename, center, radius, width, mesh_size, pp_tag):
174
175 sim_inp_dir = str(inp_dir)
176
177 # points
178 points = get_ref_drum_points(center, radius, width, True)
179
180 #
181 # create .geo file for gmsh
182 #
183 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
184 geof.write("cl__1 = 1;\n")
185 geof.write("Mesh.MshFileVersion = 2.2;\n")
186
187 #
188 # points
189 #
190 for i in range(7):
191 p = points[i]
192 sts = "Point({}) = ".format(i+1)
193 sts += "{"
194 sts += "{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
195 sts += "};\n"
196 geof.write(sts);
197
198 #
199 # circlular arc
200 #
201 geof.write("Line(1) = {2, 3};\n")
202 geof.write("Line(2) = {3, 4};\n")
203 geof.write("Line(3) = {4, 5};\n")
204 geof.write("Line(4) = {5, 6};\n")
205 geof.write("Line(5) = {6, 7};\n")
206 geof.write("Line(6) = {7, 2};\n")
207
208 #
209 # surfaces
210 #
211 geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6};\n")
212
213 #
214 # plane surface
215 #
216 geof.write("Plane Surface(1) = {1};\n")
217
218 #
219 # physical surface
220 #
221 # tag = '"' + "a" + '"'
222 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
223
224 # # add center point to plane surface
225 geof.write("Point{1} In Surface {1};")
226
227 # close file
228 geof.close()
229
230

References get_ref_drum_points().

Here is the call graph for this function:

◆ generate_rect_container_gmsh_input()

problem_setup.generate_rect_container_gmsh_input (   inp_dir,
  filename,
  pi1,
  pi2,
  dx,
  dy,
  mesh_size,
  pp_tag 
)

Definition at line 688 of file problem_setup.py.

688def generate_rect_container_gmsh_input(inp_dir, filename, pi1, pi2, dx, dy, mesh_size, pp_tag):
689
690 sim_inp_dir = str(inp_dir)
691
692 innr_pts = get_ref_rect_points(get_center(pi1, pi2), pi2[0] - pi1[0], pi2[1] - pi1[1])
693
694 outr_pts = get_ref_rect_points(get_center(pi1, pi2), pi2[0] - pi1[0] + 2*dx, pi2[1] - pi1[1] + 2*dy)
695
696 h = mesh_size
697 hout = h # 5*h
698
699 #
700 # create .geo file for gmsh
701 #
702 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
703 geof.write("cl__1 = 1;\n")
704 geof.write("Mesh.MshFileVersion = 2.2;\n")
705
706 # points
707 p_id = 1
708 for i in range(4):
709 p_id = write_point_geo(geof, p_id, outr_pts[i], h)
710
711 for i in range(4):
712 p_id = write_point_geo(geof, p_id, innr_pts[i], h)
713
714 # line
715 l_id = 1
716 l_id = write_line_geo(geof, l_id, 1, 2)
717 l_id = write_line_geo(geof, l_id, 2, 3)
718 l_id = write_line_geo(geof, l_id, 3, 4)
719 l_id = write_line_geo(geof, l_id, 4, 1)
720
721 l_id = write_line_geo(geof, l_id, 5, 6)
722 l_id = write_line_geo(geof, l_id, 6, 7)
723 l_id = write_line_geo(geof, l_id, 7, 8)
724 l_id = write_line_geo(geof, l_id, 8, 5)
725
726 # line loop to define surface
727 geof.write("Line Loop(9) = {1, 2, 3, 4};\n")
728 geof.write("Line Loop(10) = {5, 6, 7, 8};\n")
729
730 # define surface
731 geof.write("Plane Surface(11) = {9, 10};\n")
732
733 # close file
734 geof.close()
735

References copy_contact_zone(), create_input_file(), generate_cir_particle_gmsh_input(), generate_drum2d_particle_gmsh_input(), generate_hex_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_tri_particle_gmsh_input(), get_center(), get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), get_E(), get_eff_k(), get_G(), get_ref_rect_points(), get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), particle_locations(), print_dbl_list(), serialize_matrix_list(), write_cir_line_geo(), write_contact_zone_part(), write_line_geo(), write_material_zone_part(), and write_point_geo().

Referenced by generate_rect_container_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_rect_floor_gmsh_input()

problem_setup.generate_rect_floor_gmsh_input (   inp_dir,
  filename,
  center,
  L,
  W,
  mesh_size,
  pp_tag 
)

Definition at line 671 of file problem_setup.py.

671def generate_rect_floor_gmsh_input(inp_dir, filename, center, L, W, mesh_size, pp_tag):
672
673 sim_inp_dir = str(inp_dir)
674
675 points = get_ref_rect_points(center, L, W, False)
676
677 h = mesh_size
678 hout = h # 5*h
679
680 #
681 # create .geo file for gmsh
682 #
683 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
684 geof.write("cl__1 = 1;\n")
685 geof.write("Mesh.MshFileVersion = 2.2;\n")
686
687 # points
688 write_point_geo(geof, 1, points[0], hout)
689 write_point_geo(geof, 2, points[1], hout)
690 write_point_geo(geof, 3, points[2], h)
691 write_point_geo(geof, 4, points[3], h)
692
693 # line
694 geof.write("Line(1) = {1, 2};\n")
695 geof.write("Line(2) = {2, 3};\n")
696 geof.write("Line(3) = {3, 4};\n")
697 geof.write("Line(4) = {4, 1};\n")
698
699 # surfaces
700 geof.write("Line Loop(1) = {1, 2, 3, 4};\n")
701
702 # plane surface
703 geof.write("Plane Surface(1) = {1};\n")
704
705 # close file
706 geof.close()
707

References get_ref_rect_points(), and write_point_geo().

Referenced by generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2()

problem_setup.generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2 (   inp_dir,
  filename,
  center,
  Lin,
  Win,
  L,
  W,
  mesh_size,
  pp_tag 
)

Definition at line 708 of file problem_setup.py.

708def generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2(inp_dir, filename, center, Lin, Win, L, W, mesh_size, pp_tag):
709
710 sim_inp_dir = str(inp_dir)
711
712 # center and radius
713 Cx = center[0]
714 Cy = center[1]
715 Cz = center[2]
716
717 # Domain
718 h = mesh_size
719 hout = 3*h
720
721 # hole in bottom edge
722 hole_radius = 0.5 * (0.5*(W - Win))# half of thickness in vertical direction
723 # left side points
724 p5 = [Cx + 0.2*L, Cy - 0.5*W, Cz]
725 p12 = [Cx + 0.2*L, Cy - 0.5*Win, Cz]
726 p13 = [Cx + 0.2*L, Cy - 0.5*W + hole_radius, Cz]
727 p14 = [Cx + 0.2*L + hole_radius, Cy - 0.5*W + hole_radius, Cz]
728
729 p6 = [Cx + 0.28*L, Cy - 0.5*W, Cz]
730 p16 = [Cx + 0.28*L, Cy - 0.5*Win, Cz]
731 p17 = [Cx + 0.28*L, Cy - 0.5*W + hole_radius, Cz]
732 p15 = [Cx + 0.28*L - hole_radius, Cy - 0.5*W + hole_radius, Cz]
733
734 # triangle protrusion on upper-right corner
735 #p20 = [Cx + 0.5*Lin - 0.15*Lin, Cy + 0.5*Win - 0.3*Win, Cz]
736 #p19 = [Cx + 0.5*Lin, Cy + 0.5*Win - 0.1*Win, Cz]
737 #p21 = [Cx + 0.5*Lin - 0.1*Lin, Cy + 0.5*Win, Cz]
738 p20, p19, p21 = get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win)
739
740 # circular protrusion at bottom
741 #circ_protrsn_r = 0.2*Win
742 #p8 = [Cx - 0.5*Lin + 0.25*Lin, Cy - 0.5*Win, Cz]
743 #p11 = [Cx - 0.5*Lin + 0.25*Lin + 2*circ_protrsn_r, Cy - 0.5*Win, Cz]
744 #p9 = [Cx - 0.5*Lin + 0.25*Lin + circ_protrsn_r, Cy - 0.5*Win, Cz]
745 #p10 = [Cx - 0.5*Lin + 0.25*Lin + circ_protrsn_r, Cy - 0.5*Win + circ_protrsn_r, Cz]
746 circ_protrsn_r, p8, p11, p9, p10 = get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win)
747
748 # create gmsh input file
749 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
750 geof.write("cl__1 = 1;\n")
751 geof.write("Mesh.MshFileVersion = 2.2;\n")
752
753 # ---------------------- #
754 # points #
755 # ---------------------- #
756 # points (as shown in drawing above)
757 p_id = 1
758 # points on outer side
759 p_id = write_point_geo(geof, p_id, [Cx -0.5*L, Cy - 0.5*W, Cz], hout)
760 p_id = write_point_geo(geof, p_id, [Cx + 0.5*L, Cy - 0.5*W, Cz], hout)
761 p_id = write_point_geo(geof, p_id, [Cx + 0.5*L, Cy + 0.5*W, Cz], hout)
762 p_id = write_point_geo(geof, p_id, [Cx - 0.5*L, Cy + 0.5*W, Cz], hout)
763
764 p_id = write_point_geo(geof, p_id, p5, hout)
765 p_id = write_point_geo(geof, p_id, p6, hout)
766
767 # points on inner side
768 p_id = write_point_geo(geof, p_id, [Cx - 0.5*Lin, Cy - 0.5*Win, Cz], h)
769
770
771 p_id = write_point_geo(geof, p_id, p8, h)
772 p_id = write_point_geo(geof, p_id, p9, hout) # treat this internal point as control for coarse mesh
773 p_id = write_point_geo(geof, p_id, p10, h)
774 p_id = write_point_geo(geof, p_id, p11, h)
775
776 # circular opening points
777 p_id = write_point_geo(geof, p_id, p12, h)
778 p_id = write_point_geo(geof, p_id, p13, hout)
779 p_id = write_point_geo(geof, p_id, p14, h)
780
781 p_id = write_point_geo(geof, p_id, p15, h)
782 p_id = write_point_geo(geof, p_id, p16, h)
783 p_id = write_point_geo(geof, p_id, p17, hout)
784
785 p_id = write_point_geo(geof, p_id, [Cx + 0.5*Lin, Cy - 0.5*Win, Cz], h)
786
787 # triangular protrusion
788 p_id = write_point_geo(geof, p_id, p19, h)
789 p_id = write_point_geo(geof, p_id, p20, h)
790 p_id = write_point_geo(geof, p_id, p21, h)
791
792 p_id = write_point_geo(geof, p_id, [Cx - 0.5*Lin, Cy + 0.5*Win, Cz], h)
793
794 # ---------------------- #
795 # lines #
796 # ---------------------- #
797 # lines to form outer boundary (careful with the bottom edge as this will be divided into two lines)
798 l_id = 1
799 l_id = write_line_geo(geof, l_id, 1, 5)
800 l_id = write_line_geo(geof, l_id, 6, 2)
801 l_id = write_line_geo(geof, l_id, 2, 3)
802 l_id = write_line_geo(geof, l_id, 3, 4)
803 l_id = write_line_geo(geof, l_id, 4, 1)
804
805 l_id = write_line_geo(geof, l_id, 7, 8)
806
807 # circular arc for protrusion
808 l_id = write_cir_line_geo(geof, l_id, 8, 9, 10)
809 l_id = write_cir_line_geo(geof, l_id, 10, 9, 11)
810
811 l_id = write_line_geo(geof, l_id, 11, 12)
812
813 # circular arc for opening
814 l_id = write_cir_line_geo(geof, l_id, 12, 13, 14)
815 l_id = write_cir_line_geo(geof, l_id, 14, 13, 5)
816
817 l_id = write_cir_line_geo(geof, l_id, 16, 17, 15)
818 l_id = write_cir_line_geo(geof, l_id, 15, 17, 6)
819
820 l_id = write_line_geo(geof, l_id, 16, 18)
821 l_id = write_line_geo(geof, l_id, 18, 19)
822 l_id = write_line_geo(geof, l_id, 19, 20)
823 l_id = write_line_geo(geof, l_id, 20, 21)
824 l_id = write_line_geo(geof, l_id, 21, 22)
825 l_id = write_line_geo(geof, l_id, 22, 7)
826
827 # ---------------------- #
828 # line loops, ... #
829 # ---------------------- #
830 # line loop to define surface
831 # this works too ---> geof.write("Curve Loop(13) = {10, 6, -11, -1, -5, -4, -3, -2, -12, 7, 8, 9};\n")
832 geof.write("Curve Loop(20) = {14, 15, 16, 17, 18, 19, 6, 7, 8, 9, 10, 11, -1, -5, -4, -3, -2, -12, -13};\n")
833
834 # define surface
835 geof.write("Plane Surface(21) = {20};\n")
836
837 # # define physical groups
838 # geof.write("Physical Point(22) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22};\n")
839
840 # geof.write("Physical Line(23) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19};\n")
841
842 # tag = '"' + "a" + '"'
843 # geof.write("Physical Surface(%s) = {21};\n" % (tag))
844
845 # close file
846 geof.close()
847
848

References get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), write_cir_line_geo(), write_line_geo(), and write_point_geo().

Here is the call graph for this function:

◆ generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3()

problem_setup.generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3 (   inp_dir,
  filename,
  center,
  Lin,
  Win,
  L,
  W,
  mesh_size,
  pp_tag 
)

Definition at line 849 of file problem_setup.py.

849def generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(inp_dir, filename, center, Lin, Win, L, W, mesh_size, pp_tag):
850
851 sim_inp_dir = str(inp_dir)
852
853 # center and radius
854 Cx = center[0]
855 Cy = center[1]
856 Cz = center[2]
857
858 # Domain
859 h = mesh_size
860 hout = h #3*h
861
862 # hole in bottom edge
863 # left side points
864 p5 = [Cx + 0.2*L, Cy - 0.5*W, Cz]
865 p12 = [Cx + 0.2*L, Cy - 0.5*Win, Cz]
866
867 p6 = [Cx + 0.3*L, Cy - 0.5*W, Cz]
868 p13 = [Cx + 0.3*L, Cy - 0.5*Win, Cz]
869
870 # triangle protrusion on upper-right corner
871 #p20 = [Cx + 0.5*Lin - 0.15*Lin, Cy + 0.5*Win - 0.3*Win, Cz]
872 #p19 = [Cx + 0.5*Lin, Cy + 0.5*Win - 0.1*Win, Cz]
873 #p21 = [Cx + 0.5*Lin - 0.1*Lin, Cy + 0.5*Win, Cz]
874 p16, p15, p17 = get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win)
875
876 # circular protrusion at bottom
877 #circ_protrsn_r = 0.2*Win
878 #p8 = [Cx - 0.5*Lin + 0.25*Lin, Cy - 0.5*Win, Cz]
879 #p11 = [Cx - 0.5*Lin + 0.25*Lin + 2*circ_protrsn_r, Cy - 0.5*Win, Cz]
880 #p9 = [Cx - 0.5*Lin + 0.25*Lin + circ_protrsn_r, Cy - 0.5*Win, Cz]
881 #p10 = [Cx - 0.5*Lin + 0.25*Lin + circ_protrsn_r, Cy - 0.5*Win + circ_protrsn_r, Cz]
882 circ_protrsn_r, p8, p11, p9, p10 = get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win)
883
884 # create gmsh input file
885 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
886 geof.write("cl__1 = 1;\n")
887 geof.write("Mesh.MshFileVersion = 2.2;\n")
888
889 # ---------------------- #
890 # points #
891 # ---------------------- #
892 # points (as shown in drawing above)
893 p_id = 1
894 # points on outer side
895 p_id = write_point_geo(geof, p_id, [Cx -0.5*L, Cy - 0.5*W, Cz], hout)
896 p_id = write_point_geo(geof, p_id, [Cx + 0.5*L, Cy - 0.5*W, Cz], hout)
897 p_id = write_point_geo(geof, p_id, [Cx + 0.5*L, Cy + 0.5*W, Cz], hout)
898 p_id = write_point_geo(geof, p_id, [Cx - 0.5*L, Cy + 0.5*W, Cz], hout)
899
900 p_id = write_point_geo(geof, p_id, p5, hout)
901 p_id = write_point_geo(geof, p_id, p6, hout)
902
903 # points on inner side
904 p_id = write_point_geo(geof, p_id, [Cx - 0.5*Lin, Cy - 0.5*Win, Cz], h)
905
906
907 p_id = write_point_geo(geof, p_id, p8, h)
908 p_id = write_point_geo(geof, p_id, p9, hout) # treat this internal point as control for coarse mesh
909 p_id = write_point_geo(geof, p_id, p10, h)
910 p_id = write_point_geo(geof, p_id, p11, h)
911
912 # opening points
913 p_id = write_point_geo(geof, p_id, p12, h)
914 p_id = write_point_geo(geof, p_id, p13, h)
915
916 p_id = write_point_geo(geof, p_id, [Cx + 0.5*Lin, Cy - 0.5*Win, Cz], h)
917
918 # triangular protrusion
919 p_id = write_point_geo(geof, p_id, p15, h)
920 p_id = write_point_geo(geof, p_id, p16, h)
921 p_id = write_point_geo(geof, p_id, p17, h)
922
923 p_id = write_point_geo(geof, p_id, [Cx - 0.5*Lin, Cy + 0.5*Win, Cz], h)
924
925 # ---------------------- #
926 # lines #
927 # ---------------------- #
928 # lines to form outer boundary (careful with the bottom edge as this will be divided into two lines)
929 l_id = 1
930 l_id = write_line_geo(geof, l_id, 1, 5)
931 l_id = write_line_geo(geof, l_id, 6, 2)
932 l_id = write_line_geo(geof, l_id, 2, 3)
933 l_id = write_line_geo(geof, l_id, 3, 4)
934 l_id = write_line_geo(geof, l_id, 4, 1)
935
936 l_id = write_line_geo(geof, l_id, 7, 8)
937
938 # circular arc for protrusion
939 l_id = write_cir_line_geo(geof, l_id, 8, 9, 10)
940 l_id = write_cir_line_geo(geof, l_id, 10, 9, 11)
941
942 l_id = write_line_geo(geof, l_id, 11, 12)
943
944 # opening
945 l_id = write_line_geo(geof, l_id, 5, 12)
946 l_id = write_line_geo(geof, l_id, 13, 6)
947
948 l_id = write_line_geo(geof, l_id, 13, 14)
949 l_id = write_line_geo(geof, l_id, 14, 15)
950 l_id = write_line_geo(geof, l_id, 15, 16)
951 l_id = write_line_geo(geof, l_id, 16, 17)
952 l_id = write_line_geo(geof, l_id, 17, 18)
953 l_id = write_line_geo(geof, l_id, 18, 7)
954
955 # ---------------------- #
956 # line loops, ... #
957 # ---------------------- #
958 # line loop to define surface
959 geof.write("Curve Loop(20) = {12, 13, 14, 15, 16, 17, 6, 7, 8, 9, -10, -1, -5, -4, -3, -2, -11};\n")
960
961 # define surface
962 geof.write("Plane Surface(21) = {20};\n")
963
964 # # define physical groups
965 # geof.write("Physical Point(22) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18};\n")
966
967 # geof.write("Physical Line(23) = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17};\n")
968
969 # tag = '"' + "a" + '"'
970 # geof.write("Physical Surface(%s) = {21};\n" % (tag))
971
972 # # add center point to plane surface
973 geof.write("Point{9} In Surface {21};")
974
975 # close file
976 geof.close()
977

References copy_contact_zone(), create_input_file(), generate_cir_particle_gmsh_input(), generate_drum2d_particle_gmsh_input(), generate_hex_particle_gmsh_input(), generate_rect_floor_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_tri_particle_gmsh_input(), get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), get_E(), get_eff_k(), get_G(), get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), particle_locations(), print_dbl_list(), write_cir_line_geo(), write_contact_zone_part(), write_line_geo(), write_material_zone_part(), and write_point_geo().

Referenced by generate_rect_container_gmsh_input(), and generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_rigid_rect_container_moving_wall_setup_gmsh_input()

problem_setup.generate_rigid_rect_container_moving_wall_setup_gmsh_input (   inp_dir,
  filename,
  outer_rect,
  inner_rect,
  mesh_size,
  pp_tag 
)

Definition at line 1002 of file problem_setup.py.

1002def generate_rigid_rect_container_moving_wall_setup_gmsh_input(inp_dir, filename, outer_rect, inner_rect, mesh_size, pp_tag):
1003
1004 sim_inp_dir = str(inp_dir)
1005
1006 # outer rectangle
1007 sim_Lx_out1 = outer_rect[0]
1008 sim_Ly_out1 = outer_rect[1]
1009 sim_Lz_out1 = outer_rect[2]
1010 sim_Lx_out2 = outer_rect[3]
1011 sim_Ly_out2 = outer_rect[4]
1012 sim_Lz_out2 = outer_rect[5]
1013
1014 # inner rectangle
1015 sim_Lx_in1 = inner_rect[0]
1016 sim_Ly_in1 = inner_rect[1]
1017 sim_Lz_in1 = inner_rect[2]
1018 sim_Lx_in2 = inner_rect[3]
1019 sim_Ly_in2 = inner_rect[4]
1020 sim_Lz_in2 = inner_rect[5]
1021
1022 # mesh size
1023 sim_h = mesh_size
1024
1025 #
1026 # create .geo file for gmsh
1027 #
1028 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
1029 geof.write("cl__1 = 1;\n")
1030 geof.write("Mesh.MshFileVersion = 2.2;\n")
1031
1032 #
1033 # L7 L3
1034 # 4 + --- + 8 7 + --- + 3
1035 # | | | |
1036 # | | | |
1037 # | | L6 L4 | |
1038 # L8 | | | |
1039 # | | | | L2
1040 # | | L5 | |
1041 # | + ------------------- + |
1042 # | 5 6 |
1043 # | |
1044 # 1 + ------------------------------- + 2
1045 # L1
1046 #
1047 #
1048 # for point 8 and 7 --> choose y coordinate from outer rectangle and x
1049 # coordinate from inner rectangle
1050
1051 #
1052 # points
1053 #
1054 geof.write("Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out1, sim_Lz_out1, sim_h))
1055 geof.write("Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out1, sim_Lz_out1, sim_h))
1056 geof.write("Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out2, sim_Lz_out1, sim_h))
1057 geof.write("Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out2, sim_Lz_out1, sim_h))
1058
1059 geof.write("Point(5) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in1, sim_Ly_in1, sim_Lz_in1, sim_h))
1060 geof.write("Point(6) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in2, sim_Ly_in1, sim_Lz_in1, sim_h))
1061 geof.write("Point(7) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in2, sim_Ly_out2, sim_Lz_in1, sim_h))
1062 geof.write("Point(8) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_in1, sim_Ly_out2, sim_Lz_in1, sim_h))
1063
1064 #
1065 # lines
1066 #
1067 geof.write("Line(1) = {1, 2};\n")
1068 geof.write("Line(2) = {2, 3};\n")
1069 geof.write("Line(3) = {3, 7};\n")
1070 geof.write("Line(4) = {7, 6};\n")
1071 geof.write("Line(5) = {6, 5};\n")
1072 geof.write("Line(6) = {5, 8};\n")
1073 geof.write("Line(7) = {8, 4};\n")
1074 geof.write("Line(8) = {4, 1};\n")
1075
1076 #
1077 # surfaces
1078 #
1079 geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6, 7, 8};\n")
1080
1081 #
1082 # plane surface
1083 #
1084 geof.write("Plane Surface(1) = {1};\n")
1085
1086 #
1087 # physical surface
1088 #
1089 tag = '"' + "a" + '"'
1090 geof.write("Physical Surface(%s) = {1};\n" % (tag))
1091
1092 # close file
1093 geof.close()
1094
1095

Referenced by generate_moving_rect_wall_gmsh_input().

Here is the caller graph for this function:

◆ generate_rigid_wall_gmsh_input()

problem_setup.generate_rigid_wall_gmsh_input (   inp_dir,
  filename,
  outer_rect,
  inner_rect,
  mesh_size,
  pp_tag 
)

Definition at line 392 of file problem_setup.py.

392def generate_rigid_wall_gmsh_input(inp_dir, filename, outer_rect, inner_rect, mesh_size, pp_tag):
393
394 sim_inp_dir = str(inp_dir)
395
396 # outer rectangle
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]
403
404 # inner rectangle
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]
411
412 # mesh size
413 sim_h = mesh_size
414
415 #
416 # create .geo file for gmsh
417 #
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")
421
422 #
423 # L7 L3
424 # 4 + --- + 8 7 + --- + 3
425 # | | | |
426 # | | | |
427 # | | L6 L4 | |
428 # L8 | | | |
429 # | | | | L2
430 # | | L5 | |
431 # | + ------------------- + |
432 # | 5 6 |
433 # | |
434 # 1 + ------------------------------- + 2
435 # L1
436 #
437 #
438 # for point 8 and 7 --> choose y coordinate from outer rectangle and x
439 # coordinate from inner rectangle
440
441 #
442 # points
443 #
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))
448
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))
453
454 #
455 # lines
456 #
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")
465
466 #
467 # surfaces
468 #
469 geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6, 7, 8};\n")
470
471 #
472 # plane surface
473 #
474 geof.write("Plane Surface(1) = {1};\n")
475
476 #
477 # physical surface
478 #
479 tag = '"' + "a" + '"'
480 geof.write("Physical Surface(%s) = {1};\n" % (tag))
481
482 # close file
483 geof.close()
484
485

Referenced by generate_moving_wall_gmsh_input().

Here is the caller graph for this function:

◆ generate_tri_particle_gmsh_input()

problem_setup.generate_tri_particle_gmsh_input (   inp_dir,
  filename,
  center,
  radius,
  mesh_size,
  pp_tag 
)

Definition at line 583 of file problem_setup.py.

583def generate_tri_particle_gmsh_input(inp_dir, filename, center, radius, mesh_size, pp_tag):
584
585 sim_inp_dir = str(inp_dir)
586
587 # points
588 points = get_ref_triangle_points(center, radius, True)
589
590 #
591 # create .geo file for gmsh
592 #
593 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
594 geof.write("cl__1 = 1;\n")
595 geof.write("Mesh.MshFileVersion = 2.2;\n")
596
597 #
598 # points
599 #
600 for i in range(4):
601 p = points[i]
602 sts = "Point({}) = ".format(i+1)
603 sts += "{"
604 sts += "{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
605 sts += "};\n"
606 geof.write(sts);
607
608 #
609 # circlular arc
610 #
611 geof.write("Line(1) = {2, 3};\n")
612 geof.write("Line(2) = {3, 4};\n")
613 geof.write("Line(3) = {4, 2};\n")
614
615 #
616 # surfaces
617 #
618 geof.write("Line Loop(1) = {1, 2, 3};\n")
619
620 #
621 # plane surface
622 #
623 geof.write("Plane Surface(1) = {1};\n")
624
625 #
626 # physical surface
627 #
628 # tag = '"' + "a" + '"'
629 # geof.write("Physical Surface(%s) = {1};\n" % (tag))
630
631 # # add center point to plane surface
632 geof.write("Point{1} In Surface {1};")
633
634 # close file
635 geof.close()
636
637

References get_ref_triangle_points().

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_wall_gmsh_input() [1/2]

problem_setup.generate_wall_gmsh_input (   inp_dir,
  filename,
  center,
  outer_radius,
  inner_radius,
  bar_width,
  bar_length,
  mesh_size,
  pp_tag 
)

Definition at line 705 of file problem_setup.py.

705def generate_wall_gmsh_input(inp_dir, filename, center, outer_radius, inner_radius, bar_width, bar_length, mesh_size, pp_tag):
706
707 sim_inp_dir = str(inp_dir)
708
709 # center and radius
710 Cx = center[0]
711 Cy = center[1]
712 Cz = center[2]
713
714 #
715 # create .geo file for gmsh
716 #
717 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
718 geof.write("cl__1 = 1;\n")
719 geof.write("Mesh.MshFileVersion = 2.2;\n")
720
721 #
722 # points
723 #
724 points = []
725 points.append([Cx, Cy, Cz])
726 points.append([outer_radius, 0., 0.])
727 points.append([0., outer_radius, 0.])
728 points.append([-outer_radius, 0., 0.])
729 points.append([0., -outer_radius, 0.])
730 points.append([inner_radius, 0.5*bar_width, 0.])
731 points.append([inner_radius, -0.5*bar_width, 0.])
732 points.append([0., inner_radius, 0.])
733 points.append([-inner_radius, 0., 0.])
734 points.append([0., -inner_radius, 0.])
735 points.append([inner_radius - bar_length, 0.5*bar_width, 0.])
736 points.append([inner_radius - bar_length, -0.5*bar_width, 0.])
737
738 count = 0
739 for p in points:
740 count += 1
741 geof.write("Point(%d) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (count, p[0], p[1], p[2], mesh_size))
742
743
744 #
745 # circular arc
746 #
747 circles = []
748 circles.append([2, 1, 3])
749 circles.append([3, 1, 4])
750 circles.append([4, 1, 5])
751 circles.append([5, 1, 2])
752
753 circles.append([6, 1, 8])
754 circles.append([8, 1, 9])
755 circles.append([9, 1, 10])
756 circles.append([10, 1, 7])
757
758 count = 0
759 for c in circles:
760 count += 1
761 geof.write("Circle(%d) = {%d, %d, %d};\n" % (count, c[0], c[1], c[2]))
762
763 #
764 # line
765 #
766 lines = []
767 lines.append([6, 11])
768 lines.append([11, 12])
769 lines.append([12, 7])
770 #count = 0
771 for l in lines:
772 count += 1
773 geof.write("Line(%d) = {%d, %d};\n" % (count, l[0], l[1]))
774
775 #
776 # curve loop
777 #
778 geof.write("Line Loop(1) = {2, 3, 4, 1};\n")
779 geof.write("Line Loop(2) = {6, 7, 8, -11, -10, -9, 5};\n")
780
781 #
782 # plane surface and physical tag
783 #
784 geof.write("Plane Surface(1) = {1, 2};\n")
785 #geof.write("Physical Surface(1) = {1};\n")
786 #geof.write("Physical Point(2) = {9, 4, 10, 5, 2, 7, 6, 11, 12, 3, 8};\n")
787 tag = '"' + "a" + '"'
788 geof.write("Physical Surface(%s) = {1};\n" % (tag))
789
790 geof.close()
791
792

References create_input_file(), generate_cir_particle_gmsh_input(), generate_drum2d_particle_gmsh_input(), generate_tri_particle_gmsh_input(), generate_wall_gmsh_input(), get_E(), get_eff_k(), get_G(), particle_locations(), print_dbl_list(), write_contact_zone_part(), and write_material_zone_part().

Referenced by generate_wall_gmsh_input(), generate_wall_gmsh_input(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ generate_wall_gmsh_input() [2/2]

problem_setup.generate_wall_gmsh_input (   inp_dir,
  filename,
  rectangle,
  mesh_size,
  pp_tag 
)

Definition at line 231 of file problem_setup.py.

231def generate_wall_gmsh_input(inp_dir, filename, rectangle, mesh_size, pp_tag):
232
233 sim_inp_dir = str(inp_dir)
234
235 # outer rectangle
236 sim_Lx_out1 = rectangle[0]
237 sim_Ly_out1 = rectangle[1]
238 sim_Lz_out1 = rectangle[2]
239 sim_Lx_out2 = rectangle[3]
240 sim_Ly_out2 = rectangle[4]
241 sim_Lz_out2 = rectangle[5]
242
243 # mesh size
244 sim_h = mesh_size
245
246 #
247 # create .geo file for gmsh
248 #
249 geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
250 geof.write("cl__1 = 1;\n")
251 geof.write("Mesh.MshFileVersion = 2.2;\n")
252
253 #
254 # points
255 #
256 geof.write("Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out1, sim_Lz_out1, sim_h));
257 geof.write("Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out1, sim_Lz_out1, sim_h))
258 geof.write("Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out2, sim_Lz_out1, sim_h))
259 geof.write("Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out2, sim_Lz_out1, sim_h))
260
261 #
262 # lines
263 #
264 geof.write("Line(1) = {1, 2};\n")
265 geof.write("Line(2) = {2, 3};\n")
266 geof.write("Line(3) = {3, 4};\n")
267 geof.write("Line(4) = {4, 1};\n")
268
269 #
270 # surfaces
271 #
272 geof.write("Line Loop(1) = {1, 2, 3, 4};\n")
273
274 #
275 # plane surface
276 #
277 geof.write("Plane Surface(1) = {1};\n")
278
279 #
280 # physical surface
281 #
282 tag = '"' + "a" + '"'
283 geof.write("Physical Surface(%s) = {1};\n" % (tag))
284
285 # close file
286 geof.close()
287
288

References create_input_file(), generate_particle_gmsh_input(), generate_wall_gmsh_input(), get_E(), get_eff_k(), get_G(), particle_locations_orient(), print_dbl_list(), and rect_to_five_param().

Here is the call graph for this function:

◆ get_center()

problem_setup.get_center (   p1,
  p2 
)

Definition at line 146 of file problem_setup.py.

146def get_center(p1, p2):
147 return [0.5*(p1[i] + p2[i]) for i in range(3)]
148

References does_intersect_with_rectangle_wall_with_protrusion_and_opening(), does_rect_intersect_rect_use_pair_coord(), get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), get_ref_drum_points(), get_ref_hex_points(), get_ref_triangle_points(), get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(), and rotate().

Referenced by generate_rect_container_gmsh_input(), and particle_locations_old().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening()

problem_setup.get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening (   center,
  Lin,
  Win 
)

Definition at line 63 of file problem_setup.py.

63def get_circ_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win):
64
65 Cx = center[0]
66 Cy = center[1]
67 Cz = center[2]
68
69 # circular protrusion at bottom
70 circ_protrsn_r = 0.1*Win
71 p8 = [Cx - 0.5*Lin + 0.2*Lin, Cy - 0.5*Win, Cz]
72 p11 = [Cx - 0.5*Lin + 0.2*Lin + 2*circ_protrsn_r, Cy - 0.5*Win, Cz]
73 p9 = [Cx - 0.5*Lin + 0.2*Lin + circ_protrsn_r, Cy - 0.5*Win, Cz]
74 p10 = [Cx - 0.5*Lin + 0.2*Lin + circ_protrsn_r, Cy - 0.5*Win + circ_protrsn_r, Cz]
75
76 return circ_protrsn_r, p8, p11, p9, p10
77
78

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), and get_center().

Here is the caller graph for this function:

◆ get_E()

problem_setup.get_E (   K,
  nu 
)

Definition at line 82 of file problem_setup.py.

82def get_E(K, nu):
83 return 3. * K * (1. - 2. * nu)
84

Referenced by create_input_file(), generate_drum_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ get_eff_k()

problem_setup.get_eff_k (   k1,
  k2 
)

Definition at line 89 of file problem_setup.py.

89def get_eff_k(k1, k2):
90 return 2. * k1 * k2 / (k1 + k2)
91
92

Referenced by create_input_file(), generate_drum_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ get_G()

problem_setup.get_G (   E,
  nu 
)

Definition at line 85 of file problem_setup.py.

85def get_G(E, nu):
86 return E / (2. * (1. + nu))
87
88

Referenced by create_input_file(), generate_drum_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ get_max()

problem_setup.get_max (   l)

Definition at line 93 of file problem_setup.py.

93def get_max(l):
94 l = np.array(l)
95 return l.max()
96
97

Referenced by does_particle_intersect(), particle_locations(), particle_locations(), particle_locations(), particle_locations(), and particle_locations_old().

Here is the caller graph for this function:

◆ get_ref_drum_points()

problem_setup.get_ref_drum_points (   center,
  radius,
  width,
  add_center = False 
)

Definition at line 191 of file problem_setup.py.

191def get_ref_drum_points(center, radius, width, add_center = False):
192
193 # drum2d
194 #
195 # v3 v2
196 # + +
197 #
198 #
199 # + o +
200 # v4 x v1
201 #
202 # + +
203 # v5 v6
204 #
205 # Axis is a vector from x to v1
206 #
207
208 axis = [1., 0., 0.]
209
210 # center and radius
211 sim_Cx = center[0]
212 sim_Cy = center[1]
213 sim_Cz = center[2]
214 sim_radius = radius
215
216 rotate_axis = [0., 0., 1.]
217
218 x1 = rotate(axis, np.pi/3., rotate_axis)
219 x2 = rotate(axis, -np.pi/3., rotate_axis)
220
221 points = []
222 if add_center:
223 points.append(center)
224
225 # v1
226 points.append([center[i] + width*0.5*axis[i] for i in range(3)])
227 # v2
228 points.append([center[i] + radius*x1[i] for i in range(3)])
229 # v3
230 points.append([center[i] + radius*x1[i] - radius*axis[i] for i in range(3)])
231 # v4
232 points.append([center[i] - width*0.5*axis[i] for i in range(3)])
233 # v5
234 v6 = [center[i] + radius*x2[i] for i in range(3)]
235 points.append([v6[i] - radius*axis[i] for i in range(3)])
236 # v6
237 points.append(v6)
238
239 return points
240

References rotate().

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), generate_drum2d_particle_gmsh_input(), generate_drum_particle_gmsh_input(), generate_particle_gmsh_input(), get_center(), particle_locations(), particle_locations(), and particle_locations_old().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_ref_hex_points()

problem_setup.get_ref_hex_points (   center,
  radius,
  add_center = False 
)

Definition at line 154 of file problem_setup.py.

154def get_ref_hex_points(center, radius, add_center = False):
155
156 # drum2d
157 #
158 # v3 v2
159 # + +
160 #
161 #
162 # + o +
163 # v4 x v1
164 #
165 # + +
166 # v5 v6
167 #
168 # Axis is a vector from x to v1
169 #
170
171 axis = [1., 0., 0.]
172
173 # center and radius
174 sim_Cx = center[0]
175 sim_Cy = center[1]
176 sim_Cz = center[2]
177 sim_radius = radius
178
179 rotate_axis = [0., 0., 1.]
180
181 points = []
182 if add_center:
183 points.append(center)
184
185 for i in range(6):
186 xi = rotate(axis, i*np.pi/3., rotate_axis)
187 points.append([center[i] + radius * xi[i] for i in range(3)])
188
189 return points
190

References rotate().

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), generate_hex_particle_gmsh_input(), get_center(), particle_locations(), particle_locations(), particle_locations(), particle_locations_old(), and particle_locations_orient().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_ref_rect_points() [1/2]

problem_setup.get_ref_rect_points (   center,
  L,
  W,
  add_center = False 
)

Definition at line 155 of file problem_setup.py.

155def get_ref_rect_points(center, L, W, add_center = False):
156
157 points = []
158 if add_center:
159 points.append(center)
160
161 points.append([center[0] - 0.5*L, center[1] - 0.5*W, center[2]])
162 points.append([center[0] + 0.5*L, center[1] - 0.5*W, center[2]])
163 points.append([center[0] + 0.5*L, center[1] + 0.5*W, center[2]])
164 points.append([center[0] - 0.5*L, center[1] + 0.5*W, center[2]])
165
166 return points
167

References rotate().

Here is the call graph for this function:

◆ get_ref_rect_points() [2/2]

problem_setup.get_ref_rect_points (   center,
  radius,
  add_center = False 
)

Definition at line 114 of file problem_setup.py.

114def get_ref_rect_points(center, radius, add_center = False):
115
116 p1 = [center[0] - radius, center[1] - radius, center[2]]
117 p2 = [center[0] + radius, center[1] - radius, center[2]]
118 p3 = [center[0] + radius, center[1] + radius, center[2]]
119 p4 = [center[0] - radius, center[1] + radius, center[2]]
120
121 return [p1, p2, p3, p4]
122

Referenced by generate_rect_container_gmsh_input(), generate_rect_floor_gmsh_input(), and particle_locations_old().

Here is the caller graph for this function:

◆ get_ref_triangle_points()

problem_setup.get_ref_triangle_points (   center,
  radius,
  add_center = False 
)

Definition at line 123 of file problem_setup.py.

123def get_ref_triangle_points(center, radius, add_center = False):
124
125 # triangle
126 # 2
127 # +
128 #
129 #
130 # o
131 # 1
132 #
133 # +-------------------+
134 # 3 4
135
136 # center and radius
137 sim_Cx = center[0]
138 sim_Cy = center[1]
139 sim_Cz = center[2]
140 sim_radius = radius
141
142 cp = np.cos(np.pi/6.)
143 sp = np.sin(np.pi/6.)
144
145 points = []
146 if add_center:
147 points.append([sim_Cx, sim_Cy, sim_Cz])
148 points.append([sim_Cx, sim_Cy + sim_radius, sim_Cz])
149 points.append([sim_Cx - sim_radius*cp, sim_Cy - sim_radius*sp, sim_Cz])
150 points.append([sim_Cx + sim_radius*cp, sim_Cy - sim_radius*sp, sim_Cz])
151
152 return points
153

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), generate_tri_particle_gmsh_input(), get_center(), particle_locations(), particle_locations(), and particle_locations_old().

Here is the caller graph for this function:

◆ get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening()

problem_setup.get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening (   center,
  Lin,
  Win 
)

Definition at line 49 of file problem_setup.py.

49def get_tri_protrusion_points_for_rectangle_wall_with_protrusion_and_opening(center, Lin, Win):
50
51 Cx = center[0]
52 Cy = center[1]
53 Cz = center[2]
54
55 # triangle protrusion on upper-right corner
56 p20 = [Cx + 0.5*Lin - 0.15*Lin, Cy + 0.5*Win - 0.3*Win, Cz]
57 p19 = [Cx + 0.5*Lin, Cy + 0.5*Win - 0.1*Win, Cz]
58 p21 = [Cx + 0.5*Lin - 0.1*Lin, Cy + 0.5*Win, Cz]
59
60 return p20, p19, p21
61
62

Referenced by does_intersect_with_rectangle_wall_with_protrusion_and_opening(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), and get_center().

Here is the caller graph for this function:

◆ particle_locations() [1/6]

problem_setup.particle_locations (   inp_dir,
  pp_tag,
  center,
  padding,
  max_y,
  mesh_size,
  R1,
  R2,
  id_choices1,
  id_choices2,
  N1,
  N2,
  R_in,
  bar_rect,
  z_coord,
  add_orient = True 
)

Definition at line 270 of file problem_setup.py.

270def particle_locations(inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, N1, N2, R_in, bar_rect, z_coord, add_orient = True):
271
272 np.random.seed(30)
273 sim_inp_dir = str(inp_dir)
274
275 """Generate particle location data"""
276
277 particles = []
278 points = []
279
280 method_to_use = 0
281
282 if method_to_use == 0:
283 pcount = 0
284 count = 0
285 select_count = 0
286 while pcount < N2 and count < 100*N2:
287 if count%N2 == 0:
288 print('large particle iter = ', count)
289
290 # random radius and center location
291 r = R2 + np.random.uniform(-0.1 * R2, 0.1 * R2)
292 x = center[0] + np.random.uniform(-R_in + R2 + padding, R_in - R2- padding)
293 y = np.random.uniform(-R_in + R2+padding, max_y - R2-padding)
294 #p_zone = np.random.choice(id_choices2, size=1)[0]
295 p_zone = id_choices2[select_count % len(id_choices2)]
296 p = [p_zone, x, y, center[2], r]
297
298 # check if it collides of existing particles
299 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
300
301 if pintersect == False:
302 particles.append(p)
303 pcount += 1
304 select_count += 1
305
306 count +=1
307
308 pcount = 0
309 count = 0
310 select_count = 0
311 while pcount < N1 and count < 100*N1:
312 if count%N1 == 0:
313 print('small particle iter = ', count)
314
315 # random radius and center location
316 r = R1 + np.random.uniform(-0.1 * R1, 0.1 * R1)
317 x = center[0] + np.random.uniform(-R_in + R1 + padding, R_in - R1- padding)
318 y = np.random.uniform(-R_in + R1 + padding, max_y - R1 - padding)
319 #p_zone = np.random.choice(id_choices1, size=1)[0]
320 p_zone = id_choices1[select_count % len(id_choices1)]
321 p = [p_zone, x,y,center[2], r]
322
323 # check if it collides of existing particles
324 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
325
326 if pintersect == False:
327 particles.append(p)
328 pcount += 1
329 select_count += 1
330
331 count +=1
332
333 elif method_to_use == 1:
334 Nmax = N1 + N2
335 # find how approximate number of rows and cols we can have
336 check_r = R1
337 if R1 > R2:
338 check_r = R2
339
340 rows = int(R_in / check_r)
341 cols = int(R_in / check_r)
342
343 rads = [R1, R2]
344
345 counter = 0
346 x_old = -R_in
347 x_old_right = R_in
348 y_old = -R_in
349 pad = padding
350
351 cx = 0.
352 cy = 0.
353 cz = z_coord
354 r = 0.
355
356 row_rads = []
357 row_rads.append(R1)
358 row_rads.append(R2)
359
360 for i in range(rows):
361
362 if i > 0:
363 y_old = cy + get_max(row_rads)
364
365 # reset
366 row_rads = []
367 row_rads.append(R1)
368 row_rads.append(R2)
369
370 num_p_cols = 0
371 j = 0
372 while num_p_cols < cols - 1 and j < Nmax:
373
374 if j == 0:
375 # for odd row, take x_old as first and for even take as last
376 x_old = -R_in
377 x_old_right = R_in
378
379 # ptype = counter % 2
380 p_type = 0 # 1 or 2
381 p_index = 0 # zone this particle it belongs
382 if np.random.uniform(0., 1.) < 0.7:
383 p_type = 0
384 p_index = np.random.choice(id_choices1, size=1)[0]
385 else:
386 p_type = 1
387 p_index = np.random.choice(id_choices2, size=1)[0]
388
389 r0 = rads[p_type]
390
391 # perturb radius
392 r = r0 + np.random.uniform(-0.1 * r0, 0.1 * r0)
393 # r = r0
394 row_rads.append(r)
395
396 # random horizontal perturbation by 10% of radius
397 rph = np.random.uniform(-0.1 * r0, 0.1 * r0)
398
399 cx0 = x_old + pad + r
400 cx = cx0 + rph
401 # for even row, we start from right edge of rectange
402 if i%2 == 0:
403 cx0 = x_old_right - pad - r
404 cx = cx0 - rph
405 cy = y_old + pad + r
406
407 # check if it collides of existing particles
408 p = [float(p_index), cx, cy, cz, r]
409 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
410
411 if pintersect == False:
412 particles.append([float(p_index), cx, cy, cz, r])
413
414 # set x_old
415 if i % 2 == 0:
416 x_old_right = cx - r
417 else:
418 x_old = cx + r
419
420 counter += 1
421
422 num_p_cols += 1
423
424 j += 1
425
426
427 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
428 if add_orient:
429 inpf.write("i, x, y, z, r, o\n")
430 counter = 0
431 for p in particles:
432 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)))
433 counter += 1
434 else:
435 inpf.write("i, x, y, z, r\n")
436 for p in particles:
437 inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
438
439
440 inpf.close()
441
442 # to visualize in paraview
443 write_vtu = False
444 if write_vtu:
445 points = []
446 rads = []
447 zones = []
448 for p in particles:
449 points.append([p[1], p[2], p[3]])
450 rads.append(p[-1])
451 zones.append(int(p[0]))
452
453 points = np.array(points)
454 rads = np.array(rads)
455 zones = np.array(zones)
456 mesh = pv.PolyData(points)
457 mesh["radius"] = rads
458 mesh["zone"] = zones
459 pv.save_meshio(sim_inp_dir + 'particle_locations_' + str(pp_tag) + '.vtu', mesh)
460
461 print('number of particles created = {}'.format(len(particles)))
462
463 return len(particles), particles
464
465

References does_intersect_with_cylindrical_wall(), and get_max().

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), and particle_locations().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ particle_locations() [2/6]

problem_setup.particle_locations (   inp_dir,
  pp_tag,
  center,
  padding,
  max_y,
  mesh_size,
  R1,
  R2,
  id_choices1,
  id_choices2,
  Nmax,
  R_in,
  bar_rect,
  z_coord,
  add_orient = True 
)

Definition at line 287 of file problem_setup.py.

287def particle_locations(inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, Nmax, R_in, bar_rect, z_coord, add_orient = True):
288
289 np.random.seed(30)
290 sim_inp_dir = str(inp_dir)
291
292 """Generate particle location data"""
293
294 particles = []
295 points = []
296
297 method_to_use = 0
298
299 if method_to_use == 0:
300 N1 = 30
301 N2 = 10
302 pcount = 0
303 count = 0
304 while pcount < N2 and count < 100*N2:
305 if count%N2 == 0:
306 print('large particle iter = ', count)
307
308 # random radius and center location
309 r = R2 + np.random.uniform(-0.1 * R2, 0.1 * R2)
310 x = center[0] + np.random.uniform(-R_in + R2 + padding, R_in - R2- padding)
311 y = np.random.uniform(-R_in + R2+padding, max_y - R2-padding)
312 p_zone = np.random.choice(id_choices2, size=1)[0]
313 p = [p_zone, x, y, center[2], r]
314
315 # check if it collides of existing particles
316 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
317
318 if pintersect == False:
319 particles.append(p)
320 pcount += 1
321
322 count +=1
323
324 pcount = 0
325 count = 0
326 while pcount < N1 and count < 100*N1:
327 if count%N1 == 0:
328 print('small particle iter = ', count)
329
330 # random radius and center location
331 r = R1 + np.random.uniform(-0.1 * R1, 0.1 * R1)
332 x = center[0] + np.random.uniform(-R_in + R1 + padding, R_in - R1- padding)
333 y = np.random.uniform(-R_in + R1 + padding, max_y - R1 - padding)
334 p_zone = np.random.choice(id_choices1, size=1)[0]
335 p = [p_zone, x,y,center[2], r]
336
337 # check if it collides of existing particles
338 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
339
340 if pintersect == False:
341 particles.append(p)
342 pcount += 1
343 count +=1
344
345 elif method_to_use == 1:
346 # find how approximate number of rows and cols we can have
347 check_r = R1
348 if R1 > R2:
349 check_r = R2
350
351 rows = int(R_in / check_r)
352 cols = int(R_in / check_r)
353
354 rads = [R1, R2]
355
356 counter = 0
357 x_old = -R_in
358 x_old_right = R_in
359 y_old = -R_in
360 pad = padding
361
362 cx = 0.
363 cy = 0.
364 cz = z_coord
365 r = 0.
366
367 row_rads = []
368 row_rads.append(R1)
369 row_rads.append(R2)
370
371 for i in range(rows):
372
373 if i > 0:
374 y_old = cy + get_max(row_rads)
375
376 # reset
377 row_rads = []
378 row_rads.append(R1)
379 row_rads.append(R2)
380
381 num_p_cols = 0
382 j = 0
383 while num_p_cols < cols - 1 and j < Nmax:
384
385 if j == 0:
386 # for odd row, take x_old as first and for even take as last
387 x_old = -R_in
388 x_old_right = R_in
389
390 # ptype = counter % 2
391 p_type = 0 # 1 or 2
392 p_index = 0 # zone this particle it belongs
393 if np.random.uniform(0., 1.) < 0.7:
394 p_type = 0
395 p_index = np.random.choice(id_choices1, size=1)[0]
396 else:
397 p_type = 1
398 p_index = np.random.choice(id_choices2, size=1)[0]
399
400 r0 = rads[p_type]
401
402 # perturb radius
403 r = r0 + np.random.uniform(-0.1 * r0, 0.1 * r0)
404 # r = r0
405 row_rads.append(r)
406
407 # random horizontal perturbation by 10% of radius
408 rph = np.random.uniform(-0.1 * r0, 0.1 * r0)
409
410 cx0 = x_old + pad + r
411 cx = cx0 + rph
412 # for even row, we start from right edge of rectange
413 if i%2 == 0:
414 cx0 = x_old_right - pad - r
415 cx = cx0 - rph
416 cy = y_old + pad + r
417
418 # check if it collides of existing particles
419 p = [float(p_index), cx, cy, cz, r]
420 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
421
422 if pintersect == False:
423 particles.append([float(p_index), cx, cy, cz, r])
424
425 # set x_old
426 if i % 2 == 0:
427 x_old_right = cx - r
428 else:
429 x_old = cx + r
430
431 counter += 1
432
433 num_p_cols += 1
434
435 j += 1
436
437
438 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
439 if add_orient:
440 inpf.write("i, x, y, z, r, o\n")
441 counter = 0
442 for p in particles:
443 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)))
444 counter += 1
445 else:
446 inpf.write("i, x, y, z, r\n")
447 for p in particles:
448 inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
449
450
451 inpf.close()
452
453 # to visualize in paraview
454 points = []
455 rads = []
456 zones = []
457 for p in particles:
458 points.append([p[1], p[2], p[3]])
459 rads.append(p[-1])
460 zones.append(int(p[0]))
461
462 points = np.array(points)
463 rads = np.array(rads)
464 zones = np.array(zones)
465 mesh = pv.PolyData(points)
466 mesh["radius"] = rads
467 mesh["zone"] = zones
468 pv.save_meshio(sim_inp_dir + 'particle_locations_' + str(pp_tag) + '.vtu', mesh)
469
470 print('number of particles created = {}'.format(len(particles)))
471
472 return len(particles), particles
473
474

References does_intersect_with_cylindrical_wall(), get_max(), get_ref_drum_points(), get_ref_hex_points(), and get_ref_triangle_points().

Here is the call graph for this function:

◆ particle_locations() [3/6]

problem_setup.particle_locations (   inp_dir,
  pp_tag,
  center,
  padding,
  max_y,
  mesh_size,
  R1,
  R2,
  id_choices1,
  id_choices2,
  R_in,
  bar_rect,
  z_coord,
  add_orient = True 
)

Definition at line 270 of file problem_setup.py.

270def particle_locations(inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, R_in, bar_rect, z_coord, add_orient = True):
271
272 np.random.seed(30)
273 sim_inp_dir = str(inp_dir)
274
275 """Generate particle location data"""
276
277 particles = []
278 points = []
279
280 method_to_use = 0
281
282 if method_to_use == 0:
283 N1 = 40
284 N2 = 10
285 pcount = 0
286 count = 0
287 while pcount < N2 and count < 100*N2:
288 if count%N2 == 0:
289 print('large particle iter = ', count)
290
291 # random radius and center location
292 r = R2 + np.random.uniform(-0.1 * R2, 0.1 * R2)
293 x = center[0] + np.random.uniform(-R_in + R2 + padding, R_in - R2- padding)
294 y = np.random.uniform(-R_in + R2+padding, max_y - R2-padding)
295 p_zone = np.random.choice(id_choices2, size=1)[0]
296 p = [p_zone, x, y, center[2], r]
297
298 # check if it collides of existing particles
299 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
300
301 if pintersect == False:
302 particles.append(p)
303 pcount += 1
304
305 count +=1
306
307 pcount = 0
308 count = 0
309 while pcount < N1 and count < 100*N1:
310 if count%N1 == 0:
311 print('small particle iter = ', count)
312
313 # random radius and center location
314 r = R1 + np.random.uniform(-0.1 * R1, 0.1 * R1)
315 x = center[0] + np.random.uniform(-R_in + R1 + padding, R_in - R1- padding)
316 y = np.random.uniform(-R_in + R1 + padding, max_y - R1 - padding)
317 p_zone = np.random.choice(id_choices1, size=1)[0]
318 p = [p_zone, x,y,center[2], r]
319
320 # check if it collides of existing particles
321 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
322
323 if pintersect == False:
324 particles.append(p)
325 pcount += 1
326 count +=1
327
328 elif method_to_use == 1:
329 Nmax = 50
330 # find how approximate number of rows and cols we can have
331 check_r = R1
332 if R1 > R2:
333 check_r = R2
334
335 rows = int(R_in / check_r)
336 cols = int(R_in / check_r)
337
338 rads = [R1, R2]
339
340 counter = 0
341 x_old = -R_in
342 x_old_right = R_in
343 y_old = -R_in
344 pad = padding
345
346 cx = 0.
347 cy = 0.
348 cz = z_coord
349 r = 0.
350
351 row_rads = []
352 row_rads.append(R1)
353 row_rads.append(R2)
354
355 for i in range(rows):
356
357 if i > 0:
358 y_old = cy + get_max(row_rads)
359
360 # reset
361 row_rads = []
362 row_rads.append(R1)
363 row_rads.append(R2)
364
365 num_p_cols = 0
366 j = 0
367 while num_p_cols < cols - 1 and j < Nmax:
368
369 if j == 0:
370 # for odd row, take x_old as first and for even take as last
371 x_old = -R_in
372 x_old_right = R_in
373
374 # ptype = counter % 2
375 p_type = 0 # 1 or 2
376 p_index = 0 # zone this particle it belongs
377 if np.random.uniform(0., 1.) < 0.7:
378 p_type = 0
379 p_index = np.random.choice(id_choices1, size=1)[0]
380 else:
381 p_type = 1
382 p_index = np.random.choice(id_choices2, size=1)[0]
383
384 r0 = rads[p_type]
385
386 # perturb radius
387 r = r0 + np.random.uniform(-0.1 * r0, 0.1 * r0)
388 # r = r0
389 row_rads.append(r)
390
391 # random horizontal perturbation by 10% of radius
392 rph = np.random.uniform(-0.1 * r0, 0.1 * r0)
393
394 cx0 = x_old + pad + r
395 cx = cx0 + rph
396 # for even row, we start from right edge of rectange
397 if i%2 == 0:
398 cx0 = x_old_right - pad - r
399 cx = cx0 - rph
400 cy = y_old + pad + r
401
402 # check if it collides of existing particles
403 p = [float(p_index), cx, cy, cz, r]
404 pintersect = does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding)
405
406 if pintersect == False:
407 particles.append([float(p_index), cx, cy, cz, r])
408
409 # set x_old
410 if i % 2 == 0:
411 x_old_right = cx - r
412 else:
413 x_old = cx + r
414
415 counter += 1
416
417 num_p_cols += 1
418
419 j += 1
420
421
422 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
423 if add_orient:
424 inpf.write("i, x, y, z, r, o\n")
425 counter = 0
426 for p in particles:
427 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)))
428 counter += 1
429 else:
430 inpf.write("i, x, y, z, r\n")
431 for p in particles:
432 inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
433
434
435 inpf.close()
436
437 # to visualize in paraview
438 write_vtu = False
439 if write_vtu:
440 points = []
441 rads = []
442 zones = []
443 for p in particles:
444 points.append([p[1], p[2], p[3]])
445 rads.append(p[-1])
446 zones.append(int(p[0]))
447
448 points = np.array(points)
449 rads = np.array(rads)
450 zones = np.array(zones)
451 mesh = pv.PolyData(points)
452 mesh["radius"] = rads
453 mesh["zone"] = zones
454 pv.save_meshio(sim_inp_dir + 'particle_locations_' + str(pp_tag) + '.vtu', mesh)
455
456 print('number of particles created = {}'.format(len(particles)))
457
458 return len(particles), particles
459
460

References copy_contact_zone(), create_input_file(), does_intersect_with_cylindrical_wall(), generate_cir_particle_gmsh_input(), generate_drum2d_particle_gmsh_input(), generate_hex_particle_gmsh_input(), generate_tri_particle_gmsh_input(), generate_wall_gmsh_input(), get_E(), get_eff_k(), get_G(), get_max(), get_ref_drum_points(), get_ref_hex_points(), get_ref_triangle_points(), particle_locations(), print_dbl_list(), write_contact_zone_part(), and write_material_zone_part().

Here is the call graph for this function:

◆ particle_locations() [4/6]

problem_setup.particle_locations (   inp_dir,
  pp_tag,
  R1,
  R2,
  offset 
)
Generate particle location data

Definition at line 69 of file problem_setup.py.

69def particle_locations(inp_dir, pp_tag, R1, R2, offset):
70 """Generate particle location data"""
71
72 sim_particles = []
73 sim_particles.append([0., R1, R1, 0., R1, 0.])
74 sim_particles.append([1., R1, 2. * R1 + R2 + offset, 0., R2, np.pi*0.5])
75
76 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
77 inpf.write("i, x, y, z, r, o\n")
78 for p in sim_particles:
79 inpf.write("%d, %Lf, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4], p[5]))
80
81 inpf.close()
82
83

◆ particle_locations() [5/6]

problem_setup.particle_locations (   inp_dir,
  pp_tag,
  R1,
  R2,
  offset,
  w1_rect_five_format,
  w2_rect_five_format 
)
Generate particle location data

Definition at line 71 of file problem_setup.py.

71def particle_locations(inp_dir, pp_tag, R1, R2, offset, w1_rect_five_format, w2_rect_five_format):
72 """Generate particle location data"""
73
74 sim_particles = []
75 sim_particles.append([0., R1, R1, 0., R1])
76 sim_particles.append([1., R1, 2. * R1 + R2 + offset, 0., R2])
77
78 sim_particles.append([2., w1_rect_five_format[2], w1_rect_five_format[3], w1_rect_five_format[4], w1_rect_five_format[0]])
79 sim_particles.append([3., w2_rect_five_format[2], w2_rect_five_format[3], w2_rect_five_format[4], w2_rect_five_format[0]])
80
81 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
82 inpf.write("i, x, y, z, r\n")
83 for p in sim_particles:
84 inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
85
86 inpf.close()
87

◆ particle_locations() [6/6]

problem_setup.particle_locations (   inp_dir,
  pp_tag,
  R1,
  R2,
  rect,
  mesh_size,
  padding,
  add_orient = True 
)
Generate particle location data

Definition at line 151 of file problem_setup.py.

151def particle_locations(inp_dir, pp_tag, R1, R2, rect, mesh_size, padding, add_orient = True):
152 """Generate particle location data"""
153
154 #
155 #
156 # Given rectangle, we want to fill it with particles of R1 and R2 radius
157 # in alternate fashion with padding between each particle
158 #
159 #
160 particles = []
161 points = []
162
163 # find how approximate number of rows and cols we can have
164 check_r = R1
165 if R1 > R2:
166 check_r = R2
167
168 rows = int((rect[3] - rect[0])/ check_r)
169 cols = int((rect[4] - rect[1])/ check_r)
170
171 rads = [R1, R2]
172
173 counter = 0
174 x_old = rect[0]
175 x_old_right = rect[3]
176 y_old = rect[1]
177 pad = padding
178
179 cx = 0.
180 cy = 0.
181 cz = 0.
182 r = 0.
183
184 row_rads = []
185 row_rads.append(R1)
186 row_rads.append(R2)
187
188 for i in range(rows):
189
190 if i > 0:
191 y_old = cy + get_max(row_rads)
192
193 # reset
194 row_rads = []
195 row_rads.append(R1)
196 row_rads.append(R2)
197
198 num_p_cols = 0
199 j = 0
200 while num_p_cols < cols - 1 and j < 500:
201
202 if j == 0:
203 # for odd row, take x_old as first and for even take as last
204 x_old = rect[0]
205 x_old_right = rect[3]
206
207 # ptype = counter % 2
208 ptype = 1
209 if np.random.uniform(0., 1.) < 0.7:
210 ptype = 0
211
212 r0 = rads[ptype]
213
214 # perturb radius
215 r = r0 + np.random.uniform(-0.1 * r0, 0.1 * r0)
216 # r = r0
217 row_rads.append(r)
218
219 # random horizontal perturbation by 10% of radius
220 rph = np.random.uniform(-0.1 * r0, 0.1 * r0)
221
222 cx0 = x_old + pad + r
223 cx = cx0 + rph
224 # for even row, we start from right edge of rectange
225 if i%2 == 0:
226 cx0 = x_old_right - pad - r
227 cx = cx0 - rph
228 cy = y_old + pad + r
229 cz = rect[2]
230
231 inters = does_intersect_rect([cx, cy, cz], r, particles, pad, rect)
232 inters_parts = does_intersect
233
234 if inters == False:
235 particles.append([float(ptype), cx, cy, cz, r])
236
237 # set x_old
238 if i % 2 == 0:
239 x_old_right = cx - r
240 else:
241 x_old = cx + r
242
243 counter += 1
244
245 num_p_cols += 1
246
247 j += 1
248
249
250 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
251 if add_orient:
252 inpf.write("i, x, y, z, r, o\n")
253 counter = 0
254 for p in particles:
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)))
256 counter += 1
257 else:
258 inpf.write("i, x, y, z, r\n")
259 for p in particles:
260 inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
261
262
263 inpf.close()
264
265 # for p in particles:
266 # points.append([p[1], p[2], p[3]])
267
268 # points = np.array(points)
269 # mesh = pv.PolyData(points)
270 # pv.save_meshio('particle_locations_' + str(pp_tag) + '.vtu', mesh)
271
272 print('number of particles created = {}'.format(len(particles)))
273
274

References does_intersect_rect(), get_max(), and get_ref_hex_points().

Here is the call graph for this function:

◆ particle_locations_old()

problem_setup.particle_locations_old (   inp_dir,
  pp_tag,
  center,
  padding,
  max_y,
  mesh_size,
  R1,
  R2,
  id_choices1,
  id_choices2,
  N1,
  N2,
  rect,
  z_coord,
  add_orient = True 
)
Generate particle location data

Definition at line 547 of file problem_setup.py.

547def particle_locations_old(inp_dir, pp_tag, center, padding, max_y, mesh_size, R1, R2, id_choices1, id_choices2, N1, N2, rect, z_coord, add_orient = True):
548
549 """Generate particle location data"""
550
551
552 def does_intersect_old(p, r, R, particles, padding):
553
554 for q in particles:
555
556 pq = np.array([p[i] - q[i] for i in range(3)])
557 if np.linalg.norm(pq) <= r + R + padding:
558 return True
559
560 return False
561
562
563 def does_intersect_rect_old(p, r, particles, padding, rect):
564
565 # check intersection with rectangle
566 pr = [p[0] - r, p[1] - r, p[2], p[0] + r, p[1] + r, p[2]]
567
568 if pr[0] < rect[0] + padding or pr[1] < rect[1] + padding or pr[3] > rect[3] - padding or pr[4] > rect[4] - padding:
569
570 # print('circle (xc = {}, r = {:5.3e}) intersects rect = {} with pad = {:5.3e}'.format(p, r, rect, padding))
571
572 return True
573
574 # loop over particles
575 # for pi in particles:
576 # dx = [p[0] - pi[1], p[1] - pi[2], p[2] - pi[3]]
577 # rR = r + pi[4] + padding
578 # if np.linalg.norm(dx) < rR:
579 # return True
580
581 # print('circle (xc = {}, r = {:5.3e}) does not intersects rect = {} with pad = {:5.3e}'.format(p, r, rect, padding))
582 return False
583
584 #
585 #
586 # Given rectangle, we want to fill it with particles of R1 and R2 radius
587 # in alternate fashion with padding between each particle
588 #
589 #
590 particles = []
591 points = []
592
593 # find how approximate number of rows and cols we can have
594 check_r = R1
595 if R1 > R2:
596 check_r = R2
597
598 rows = int((rect[3] - rect[0])/ check_r)
599 cols = int((rect[4] - rect[1])/ check_r)
600
601 rads = [R1, R2]
602
603 counter = 0
604 x_old = rect[0]
605 x_old_right = rect[3]
606 y_old = rect[1]
607 pad = padding
608
609 cx = 0.
610 cy = 0.
611 cz = 0.
612 r = 0.
613
614 row_rads = []
615 row_rads.append(R1)
616 row_rads.append(R2)
617
618 for i in range(rows):
619
620 if i > 0:
621 y_old = cy + get_max(row_rads)
622
623 # reset
624 row_rads = []
625 row_rads.append(R1)
626 row_rads.append(R2)
627
628 num_p_cols = 0
629 j = 0
630 while num_p_cols < cols - 1 and j < 500:
631
632 if j == 0:
633 # for odd row, take x_old as first and for even take as last
634 x_old = rect[0]
635 x_old_right = rect[3]
636
637 # type of particle (type 1 or 2, e.g., small or large)
638 p_type = counter % 2
639
640 r0 = rads[p_type]
641
642 # zone this particle belongs to
643 p_zone = 0
644 if p_type == 0:
645 p_zone = np.random.choice(id_choices1, size=1)[0]
646 else:
647 p_zone = np.random.choice(id_choices2, size=1)[0]
648
649 # perturb radius
650 r = r0 + np.random.uniform(-0.1 * r0, 0.1 * r0)
651 # r = r0
652 row_rads.append(r)
653
654 # random horizontal perturbation by 10% of radius
655 rph = np.random.uniform(-0.1 * r0, 0.1 * r0)
656
657 cx0 = x_old + pad + r
658 cx = cx0 + rph
659 # for even row, we start from right edge of rectange
660 if i%2 == 0:
661 cx0 = x_old_right - pad - r
662 cx = cx0 - rph
663
664 cy = y_old + pad + r
665 cz = rect[2]
666
667 inters = does_intersect_rect_old([cx, cy, cz], r, particles, pad, rect)
668 inters_parts = does_intersect_old
669
670 if inters == False:
671 particles.append([float(p_zone), cx, cy, cz, r])
672
673 # set x_old
674 if i % 2 == 0:
675 x_old_right = cx - r
676 else:
677 x_old = cx + r
678
679 counter += 1
680
681 num_p_cols += 1
682
683 j += 1
684
685
686 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
687 if add_orient:
688 inpf.write("i, x, y, z, r, o\n")
689 counter = 0
690 for p in particles:
691 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)))
692 counter += 1
693 else:
694 inpf.write("i, x, y, z, r\n")
695 for p in particles:
696 inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
697
698
699 inpf.close()
700
701 # to visualize in paraview
702 write_vtu = False
703 if write_vtu:
704 points = []
705 rads = []
706 zones = []
707 for p in particles:
708 points.append([p[1], p[2], p[3]])
709 rads.append(p[-1])
710 zones.append(int(p[0]))
711
712 points = np.array(points)
713 rads = np.array(rads)
714 zones = np.array(zones)
715 mesh = pv.PolyData(points)
716 mesh["radius"] = rads
717 mesh["zone"] = zones
718 pv.save_meshio(sim_inp_dir + 'particle_locations_' + str(pp_tag) + '.vtu', mesh)
719
720 print('number of particles created = {}'.format(len(particles)))
721
722 return len(particles), particles
723
724

References get_center(), get_max(), get_ref_drum_points(), get_ref_hex_points(), get_ref_rect_points(), get_ref_triangle_points(), write_line_geo(), and write_point_geo().

Here is the call graph for this function:

◆ particle_locations_orient() [1/2]

problem_setup.particle_locations_orient (   inp_dir,
  pp_tag,
  R1,
  R2,
  offset 
)
Generate particle location data

Definition at line 83 of file problem_setup.py.

83def particle_locations_orient(inp_dir, pp_tag, R1, R2, offset):
84 """Generate particle location data"""
85
86 sim_particles = []
87 sim_particles.append([0., R1, R1, 0., R1, 0.5*np.pi])
88 sim_particles.append([1., R1, 2. * R1 + R2 + offset, 0., R2, 0.])
89
90 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
91 inpf.write("i, x, y, z, r, o\n")
92 for p in sim_particles:
93 inpf.write("%d, %Lf, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4], p[5]))
94
95 inpf.close()
96

References get_ref_hex_points(), and rotate().

Referenced by generate_drum_particle_gmsh_input(), and generate_wall_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ particle_locations_orient() [2/2]

problem_setup.particle_locations_orient (   inp_dir,
  pp_tag,
  R1,
  R2,
  offset,
  w1_rect_five_format,
  w2_rect_five_format 
)
Generate particle location data

Definition at line 88 of file problem_setup.py.

88def particle_locations_orient(inp_dir, pp_tag, R1, R2, offset, w1_rect_five_format, w2_rect_five_format):
89 """Generate particle location data"""
90
91 sim_particles = []
92 sim_particles.append([0., R1, R1, 0., R1, 0.5*np.pi])
93 sim_particles.append([1., R1+1.*R1*np.sin(np.pi/3.), 2. * R1 + R2 + offset, 0., R2, 0.3*np.pi])
94
95 sim_particles.append([2., w1_rect_five_format[2], w1_rect_five_format[3], w1_rect_five_format[4], w1_rect_five_format[0], 0.])
96 sim_particles.append([3., w2_rect_five_format[2], w2_rect_five_format[3], w2_rect_five_format[4], w2_rect_five_format[0], 0.])
97
98 inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
99 inpf.write("i, x, y, z, r, o\n")
100 for p in sim_particles:
101 inpf.write("%d, %Lf, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4], p[5]))
102
103 inpf.close()
104

References rotate().

Here is the call graph for this function:

◆ print_bool()

problem_setup.print_bool (   arg,
  prefix = "" 
)

Definition at line 7 of file problem_setup.py.

7def print_bool(arg, prefix = ""):
8
9 str = prefix
10 if arg == True:
11 str += "True\n"
12 else:
13 str += "False\n"
14 return str
15

◆ print_dbl()

problem_setup.print_dbl (   arg,
  prefix = "" 
)

Definition at line 16 of file problem_setup.py.

16def print_dbl(arg, prefix = ""):
17
18 str = prefix + "%4.6e\n" % (arg)
19 return str
20

◆ print_dbl_list()

problem_setup.print_dbl_list (   arg,
  prefix = "" 
)

Definition at line 25 of file problem_setup.py.

25def print_dbl_list(arg, prefix = ""):
26 str = prefix + "["
27 N = len(arg)
28 for i in range(N):
29 str += "%4.6e" % (arg[i])
30 if i < N - 1:
31 str += ", "
32 else:
33 str += "]\n"
34
35 return str
36

Referenced by create_input_file(), generate_drum_particle_gmsh_input(), generate_moving_rect_wall_gmsh_input(), generate_moving_wall_gmsh_input(), generate_particle_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ print_int()

problem_setup.print_int (   arg,
  prefix = "" 
)

Definition at line 21 of file problem_setup.py.

21def print_int(arg, prefix = ""):
22 str = prefix + "%d\n" % (arg)
23 return str
24

◆ print_int_list()

problem_setup.print_int_list (   arg,
  prefix = "" 
)

Definition at line 37 of file problem_setup.py.

37def print_int_list(arg, prefix = ""):
38 str = prefix + "["
39 N = len(arg)
40 for i in range(N):
41 str += "%d" % (arg[i])
42 if i < N - 1:
43 str += ", "
44 else:
45 str += "]\n"
46
47 return str
48
49

Referenced by copy_contact_zone(), serialize_matrix_list(), and write_cir_line_geo().

Here is the caller graph for this function:

◆ rect_to_five_param()

problem_setup.rect_to_five_param (   r)

Definition at line 68 of file problem_setup.py.

68def rect_to_five_param(r):
69 return [r[3] - r[0], r[4] - r[1], 0.5*(r[0] + r[3]), 0.5*(r[1] + r[4]), 0.5*(r[2] + r[5])]
70

Referenced by generate_wall_gmsh_input().

Here is the caller graph for this function:

◆ rotate()

problem_setup.rotate (   p,
  theta,
  axis 
)

Definition at line 98 of file problem_setup.py.

98def rotate(p, theta, axis):
99
100 p_np = np.array(p)
101 axis_np = np.array(axis)
102
103 ct = np.cos(theta);
104 st = np.sin(theta);
105
106 # dot
107 p_dot_n = np.dot(p_np,axis_np)
108
109 # cross
110 n_cross_p = np.cross(axis_np, p_np)
111
112 return (1. - ct) * p_dot_n * axis_np + ct * p_np + st * n_cross_p
113

Referenced by does_intersect(), does_intersect_rect(), get_center(), get_ref_drum_points(), get_ref_hex_points(), get_ref_rect_points(), particle_locations_orient(), and particle_locations_orient().

Here is the caller graph for this function:

◆ serialize_matrix_list()

problem_setup.serialize_matrix_list (   p)

Definition at line 49 of file problem_setup.py.

49def serialize_matrix_list(p):
50 s = []
51 for q in p:
52 for w in q:
53 s.append(w)
54
55 return s
56

References print_int_list().

Referenced by generate_rect_container_gmsh_input().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_cir_line_geo()

problem_setup.write_cir_line_geo (   geof,
  l_id,
  p1_id,
  p2_id,
  p3_id 
)

Definition at line 87 of file problem_setup.py.

87def write_cir_line_geo(geof, l_id, p1_id, p2_id, p3_id):
88 geof.write("Circle(%d) = {%d, %d, %d};\n" % (l_id, p1_id, p2_id, p3_id))
89 return l_id + 1
90

References print_int_list().

Referenced by generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2(), and generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ write_contact_zone_part()

problem_setup.write_contact_zone_part (   inpf,
  R_contact_factor,
  damping_active,
  friction_active,
  beta_n_eps,
  friction_coeff,
  Kn_factor,
  beta_n_factor,
  zone_string,
  Kn 
)

Definition at line 50 of file problem_setup.py.

50def write_contact_zone_part(inpf, R_contact_factor, damping_active, friction_active, beta_n_eps, friction_coeff, Kn_factor, beta_n_factor, zone_string, Kn):
51 inpf.write(" Zone_%s:\n" % (zone_string))
52 inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
53
54 if damping_active == False:
55 inpf.write(" Damping_On: false\n")
56 if friction_active == False:
57 inpf.write(" Friction_On: false\n")
58
59 inpf.write(" Kn: %4.6e\n" % (Kn))
60 inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
61 inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
62 inpf.write(" Kn_Factor: %4.6e\n" % (Kn_factor))
63 inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
64

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ write_line_geo()

problem_setup.write_line_geo (   geof,
  l_id,
  p1_id,
  p2_id 
)

Definition at line 83 of file problem_setup.py.

83def write_line_geo(geof, l_id, p1_id, p2_id):
84 geof.write("Line(%d) = {%d, %d};\n" % (l_id, p1_id, p2_id))
85 return l_id + 1
86

Referenced by generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), and particle_locations_old().

Here is the caller graph for this function:

◆ write_material_zone_part()

problem_setup.write_material_zone_part (   inpf,
  zone_string,
  horizon,
  rho,
  K,
  G,
  Gc 
)

Definition at line 65 of file problem_setup.py.

65def write_material_zone_part(inpf, zone_string, horizon, rho, K, G, Gc):
66 inpf.write(" Zone_%s:\n" % (zone_string))
67 inpf.write(" Type: PDState\n")
68 inpf.write(" Horizon: %4.6e\n" % (horizon))
69 inpf.write(" Density: %4.6e\n" % (rho))
70 inpf.write(" Compute_From_Classical: true\n")
71 inpf.write(" K: %4.6e\n" % (K))
72 inpf.write(" G: %4.6e\n" % (G))
73 inpf.write(" Gc: %4.6e\n" % (Gc))
74 inpf.write(" Influence_Function:\n")
75 inpf.write(" Type: 1\n")
76

Referenced by create_input_file(), generate_moving_rect_wall_gmsh_input(), generate_rect_container_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), generate_wall_gmsh_input(), and particle_locations().

Here is the caller graph for this function:

◆ write_point_geo()

problem_setup.write_point_geo (   geof,
  p_id,
  x,
  h 
)

Definition at line 79 of file problem_setup.py.

79def write_point_geo(geof, p_id, x, h):
80 geof.write("Point(%d) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (p_id, x[0], x[1], x[2], h))
81 return p_id + 1
82

Referenced by generate_rect_container_gmsh_input(), generate_rect_floor_gmsh_input(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type2(), generate_rectangle_with_protrusion_and_opening_wall_gmsh_input_type3(), and particle_locations_old().

Here is the caller graph for this function:

Variable Documentation

◆ inp_dir

str problem_setup.inp_dir = './'

----------------------------------------------------—## ----------------------------------------------------—##

Definition at line 1196 of file problem_setup.py.

◆ pp_tag

int problem_setup.pp_tag = 0

Definition at line 1197 of file problem_setup.py.