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="")
 
 does_intersect_rect (p, r, particles, padding, rect)
 
 does_intersect_with_cylindrical_wall (p, particles, R_in, center, bar_rect, padding)
 
 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)
 
 get_E (K, nu)
 
 get_G (E, nu)
 
 get_eff_k (k1, k2)
 
 get_max (l)
 
 rotate (p, theta, axis)
 
 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)
 
 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_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_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)
 
 copy_contact_zone (inpf, zone_numbers, zone_copy_from)
 
 get_ref_rect_points (center, radius, add_center=False)
 
 does_rect_intersect_rect (r1, r2, padding)
 
 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)
 
 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_cylindrical_wall_gmsh_input (inp_dir, filename, center, outer_radius, inner_radius, bar_width, bar_length, mesh_size, pp_tag)
 
 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_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_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)
 
 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)
 
 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)
 

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 generate_cylindrical_wall_gmsh_input(), 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 793 of file problem_setup.py.

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

References 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_cylindrical_wall_gmsh_input(), 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(), particle_locations(), and particle_locations_orient().

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

Referenced by particle_locations().

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 70 of file problem_setup.py.

70def does_intersect_with_cylindrical_wall(p, particles, R_in, center, bar_rect, padding):
71
72 # p -> [id, x, y, z, r]
73
74 for q in particles:
75
76 pq = np.array([p[i+1] - q[i+1] for i in range(3)])
77 if np.linalg.norm(pq) <= p[-1] + q[-1] + padding:
78 return True
79
80 dx = np.array([p[i+1] - center[i] for i in range(3)])
81 if np.linalg.norm(dx) > R_in - p[-1] - padding:
82 return True
83
84 r = p[-1]
85 for i in range(4):
86 pr = [p[i+1] for i in range(3)]
87 if i == 0:
88 pr[0] = pr[0] - r
89 pr[1] = pr[1] - r
90 elif i == 1:
91 pr[0] = pr[0] - r
92 pr[1] = pr[1] + r
93 elif i == 2:
94 pr[0] = pr[0] + r
95 pr[1] = pr[1] - r
96 elif i == 3:
97 pr[0] = pr[0] + r
98 pr[1] = pr[1] + r
99
100 if pr[0] > bar_rect[0] - padding and pr[1] > bar_rect[1] - padding and pr[0] < bar_rect[3] + padding and pr[1] < bar_rect[4] + padding:
101
102 return True
103
104 return False
105
106
107

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

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

References does_rect_intersect_rect().

Referenced by does_particle_intersect_rect(), and does_rect_intersect_rect().

Here is the call graph for this function:
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 475 of file problem_setup.py.

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

Referenced by create_input_file(), generate_cylindrical_wall_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 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 689 of file problem_setup.py.

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

References copy_contact_zone(), create_input_file(), 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_cylindrical_wall_gmsh_input().

Here is the call graph for this function:
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 647 of file problem_setup.py.

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

References get_ref_drum_points().

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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:

◆ 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 535 of file problem_setup.py.

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

References get_ref_hex_points().

Referenced by generate_cylindrical_wall_gmsh_input(), 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(), generate_wall_gmsh_input(), and particle_locations_orient().

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 165 of file problem_setup.py.

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

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 592 of file problem_setup.py.

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

References get_ref_triangle_points().

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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:

◆ 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

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

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 223 of file problem_setup.py.

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

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

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 136 of file problem_setup.py.

136def get_E(K, nu):
137 return 3. * K * (1. - 2. * nu)
138

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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(), particle_locations(), and particle_locations_orient().

Here is the caller graph for this function:

◆ get_eff_k()

problem_setup.get_eff_k (   k1,
  k2 
)

Definition at line 143 of file problem_setup.py.

143def get_eff_k(k1, k2):
144 return 2. * k1 * k2 / (k1 + k2)
145
146

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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(), particle_locations(), and particle_locations_orient().

Here is the caller graph for this function:

◆ get_G()

problem_setup.get_G (   E,
  nu 
)

Definition at line 139 of file problem_setup.py.

139def get_G(E, nu):
140 return E / (2. * (1. + nu))
141
142

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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(), particle_locations(), and particle_locations_orient().

Here is the caller graph for this function:

◆ get_max()

problem_setup.get_max (   l)

Definition at line 147 of file problem_setup.py.

147def get_max(l):
148 l = np.array(l)
149 return l.max()
150
151

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 236 of file problem_setup.py.

236def get_ref_drum_points(center, radius, width, add_center = False):
237
238 # drum2d
239 #
240 # v3 v2
241 # + +
242 #
243 #
244 # + o +
245 # v4 x v1
246 #
247 # + +
248 # v5 v6
249 #
250 # Axis is a vector from x to v1
251 #
252
253 axis = [1., 0., 0.]
254
255 # center and radius
256 sim_Cx = center[0]
257 sim_Cy = center[1]
258 sim_Cz = center[2]
259 sim_radius = radius
260
261 rotate_axis = [0., 0., 1.]
262
263 x1 = rotate(axis, np.pi/3., rotate_axis)
264 x2 = rotate(axis, -np.pi/3., rotate_axis)
265
266 points = []
267 if add_center:
268 points.append(center)
269
270 # v1
271 points.append([center[i] + width*0.5*axis[i] for i in range(3)])
272 # v2
273 points.append([center[i] + radius*x1[i] for i in range(3)])
274 # v3
275 points.append([center[i] + radius*x1[i] - radius*axis[i] for i in range(3)])
276 # v4
277 points.append([center[i] - width*0.5*axis[i] for i in range(3)])
278 # v5
279 v6 = [center[i] + radius*x2[i] for i in range(3)]
280 points.append([v6[i] - radius*axis[i] for i in range(3)])
281 # v6
282 points.append(v6)
283
284 return points
285
286

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(), 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_hex_points()

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

Definition at line 199 of file problem_setup.py.

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

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(), and particle_locations_old().

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

References rotate().

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

Here is the call graph for this function:
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 168 of file problem_setup.py.

168def get_ref_triangle_points(center, radius, add_center = False):
169
170 # triangle
171 # 2
172 # +
173 #
174 #
175 # o
176 # 1
177 #
178 # +-------------------+
179 # 3 4
180
181 # center and radius
182 sim_Cx = center[0]
183 sim_Cy = center[1]
184 sim_Cz = center[2]
185 sim_radius = radius
186
187 cp = np.cos(np.pi/6.)
188 sp = np.sin(np.pi/6.)
189
190 points = []
191 if add_center:
192 points.append([sim_Cx, sim_Cy, sim_Cz])
193 points.append([sim_Cx, sim_Cy + sim_radius, sim_Cz])
194 points.append([sim_Cx - sim_radius*cp, sim_Cy - sim_radius*sp, sim_Cz])
195 points.append([sim_Cx + sim_radius*cp, sim_Cy - sim_radius*sp, sim_Cz])
196
197 return points
198

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

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() [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(), and get_max().

Referenced by create_input_file(), generate_cylindrical_wall_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(), and particle_locations().

Here is the call graph for this function:
Here is the caller 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+1.*R1*np.sin(np.pi/3.), 2. * R1 + R2 + offset, 0., R2, 0.5*np.pi])
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 rotate().

Referenced by generate_drum_particle_gmsh_input(), generate_wall_gmsh_input(), and particle_locations_orient().

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 create_input_file(), generate_particle_gmsh_input(), generate_wall_gmsh_input(), get_E(), get_eff_k(), get_G(), get_ref_drum_points(), particle_locations_orient(), print_dbl_list(), rect_to_five_param(), and 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_cylindrical_wall_gmsh_input(), 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(), particle_locations(), and particle_locations_orient().

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

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 particle_locations_orient().

Here is the caller graph for this function:

◆ rotate()

problem_setup.rotate (   p,
  theta,
  axis 
)

Definition at line 152 of file problem_setup.py.

152def rotate(p, theta, axis):
153
154 p_np = np.array(p)
155 axis_np = np.array(axis)
156
157 ct = np.cos(theta);
158 st = np.sin(theta);
159
160 # dot
161 p_dot_n = np.dot(p_np,axis_np)
162
163 # cross
164 n_cross_p = np.cross(axis_np, p_np)
165
166 return (1. - ct) * p_dot_n * axis_np + ct * p_np + st * n_cross_p
167

Referenced by does_intersect(), get_center(), get_ref_drum_points(), get_ref_hex_points(), get_ref_rect_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 108 of file problem_setup.py.

108def 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):
109 inpf.write(" Zone_%s:\n" % (zone_string))
110 inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
111
112 if damping_active == False:
113 inpf.write(" Damping_On: false\n")
114 if friction_active == False:
115 inpf.write(" Friction_On: false\n")
116
117 inpf.write(" Kn: %4.6e\n" % (Kn))
118 inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
119 inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
120 inpf.write(" Kn_Factor: %4.6e\n" % (Kn_factor))
121 inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
122

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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 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 123 of file problem_setup.py.

123def write_material_zone_part(inpf, zone_string, horizon, rho, K, G, Gc):
124 inpf.write(" Zone_%s:\n" % (zone_string))
125 inpf.write(" Type: PDState\n")
126 inpf.write(" Horizon: %4.6e\n" % (horizon))
127 inpf.write(" Density: %4.6e\n" % (rho))
128 inpf.write(" Compute_From_Classical: true\n")
129 inpf.write(" K: %4.6e\n" % (K))
130 inpf.write(" G: %4.6e\n" % (G))
131 inpf.write(" Gc: %4.6e\n" % (Gc))
132 inpf.write(" Influence_Function:\n")
133 inpf.write(" Type: 1\n")
134
135

Referenced by create_input_file(), generate_cylindrical_wall_gmsh_input(), 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 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 1219 of file problem_setup.py.

◆ pp_tag

int problem_setup.pp_tag = 0

Definition at line 1220 of file problem_setup.py.