/
problem_setup.py
705 lines (567 loc) · 18.3 KB
/
problem_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
import os
import numpy as np
import sys
def print_bool(arg, prefix = ""):
str = prefix
if arg == True:
str += "True\n"
else:
str += "False\n"
return str
def print_dbl(arg, prefix = ""):
str = prefix + "%4.6e\n" % (arg)
return str
def print_int(arg, prefix = ""):
str = prefix + "%d\n" % (arg)
return str
def print_dbl_list(arg, prefix = ""):
str = prefix + "["
N = len(arg)
for i in range(N):
str += "%4.6e" % (arg[i])
if i < N - 1:
str += ", "
else:
str += "]\n"
return str
def print_int_list(arg, prefix = ""):
str = prefix + "["
N = len(arg)
for i in range(N):
str += "%d" % (arg[i])
if i < N - 1:
str += ", "
else:
str += "]\n"
return str
def does_intersect(p, r, R, particles, padding):
for q in particles:
pq = np.array([p[i] - q[i] for i in range(3)])
if np.linalg.norm(pq) <= r + R + padding:
return True
return False
def get_E(K, nu):
return 3. * K * (1. - 2. * nu)
def get_G(E, nu):
return E / (2. * (1. + nu))
def get_eff_k(k1, k2):
return 2. * k1 * k2 / (k1 + k2)
def particle_locations(inp_dir, pp_tag, R1, R2, offset):
"""Generate particle location data"""
sim_particles = []
sim_particles.append([0., R1, R1, 0., R1])
sim_particles.append([1., R1, 2. * R1 + R2 + offset, 0., R2])
inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
inpf.write("i, x, y, z, r\n")
for p in sim_particles:
inpf.write("%d, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4]))
inpf.close()
def particle_locations_orient(inp_dir, pp_tag, R1, R2, offset):
"""Generate particle location data"""
sim_particles = []
sim_particles.append([0., R1, R1, 0., R1, 0.5*np.pi])
sim_particles.append([1., R1+1.*R1*np.sin(np.pi/3.), 2. * R1 + R2 + offset, 0., R2, 0.5*np.pi])
inpf = open(inp_dir + 'particle_locations_' + str(pp_tag) + '.csv','w')
inpf.write("i, x, y, z, r, o\n")
for p in sim_particles:
inpf.write("%d, %Lf, %Lf, %Lf, %Lf, %Lf\n" % (int(p[0]), p[1], p[2], p[3], p[4], p[5]))
inpf.close()
def rotate(p, theta, axis):
p_np = np.array(p)
axis_np = np.array(axis)
ct = np.cos(theta);
st = np.sin(theta);
# dot
p_dot_n = np.dot(p_np,axis_np)
# cross
n_cross_p = np.cross(axis_np, p_np)
return (1. - ct) * p_dot_n * axis_np + ct * p_np + st * n_cross_p
def get_ref_drum_points(center, radius, width, add_center = False):
# drum2d
#
# v3 v2
# + +
#
#
# + o +
# v4 x v1
#
# + +
# v5 v6
#
# Axis is a vector from x to v1
#
axis = [1., 0., 0.]
# center and radius
sim_Cx = center[0]
sim_Cy = center[1]
sim_Cz = center[2]
sim_radius = radius
rotate_axis = [0., 0., 1.]
x1 = rotate(axis, np.pi/3., rotate_axis)
x2 = rotate(axis, -np.pi/3., rotate_axis)
points = []
if add_center:
points.append(center)
# v1
points.append([center[i] + width*0.5*axis[i] for i in range(3)])
# v2
points.append([center[i] + radius*x1[i] for i in range(3)])
# v3
points.append([center[i] + radius*x1[i] - radius*axis[i] for i in range(3)])
# v4
points.append([center[i] - width*0.5*axis[i] for i in range(3)])
# v5
v6 = [center[i] + radius*x2[i] for i in range(3)]
points.append([v6[i] - radius*axis[i] for i in range(3)])
# v6
points.append(v6)
return points
def generate_particle_gmsh_input(inp_dir, filename, center, radius, width, mesh_size, pp_tag):
sim_inp_dir = str(inp_dir)
# points
points = get_ref_drum_points(center, radius, width, True)
#
# create .geo file for gmsh
#
geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
geof.write("cl__1 = 1;\n")
geof.write("Mesh.MshFileVersion = 2.2;\n")
#
# points
#
for i in range(7):
p = points[i]
sts = "Point({}) = ".format(i+1)
sts += "{"
sts += "{}, {}, {}, {}".format(p[0], p[1], p[2], mesh_size)
sts += "};\n"
geof.write(sts);
#
# circlular arc
#
geof.write("Line(1) = {2, 3};\n")
geof.write("Line(2) = {3, 4};\n")
geof.write("Line(3) = {4, 5};\n")
geof.write("Line(4) = {5, 6};\n")
geof.write("Line(5) = {6, 7};\n")
geof.write("Line(6) = {7, 2};\n")
#
# surfaces
#
geof.write("Line Loop(1) = {1, 2, 3, 4, 5, 6};\n")
#
# plane surface
#
geof.write("Plane Surface(1) = {1};\n")
#
# physical surface
#
# tag = '"' + "a" + '"'
# geof.write("Physical Surface(%s) = {1};\n" % (tag))
# # add center point to plane surface
geof.write("Point{1} In Surface {1};")
# close file
geof.close()
def generate_wall_gmsh_input(inp_dir, filename, rectangle, mesh_size, pp_tag):
sim_inp_dir = str(inp_dir)
# outer rectangle
sim_Lx_out1 = rectangle[0]
sim_Ly_out1 = rectangle[1]
sim_Lz_out1 = rectangle[2]
sim_Lx_out2 = rectangle[3]
sim_Ly_out2 = rectangle[4]
sim_Lz_out2 = rectangle[5]
# mesh size
sim_h = mesh_size
#
# create .geo file for gmsh
#
geof = open(sim_inp_dir + filename + '_' + str(pp_tag) + '.geo','w')
geof.write("cl__1 = 1;\n")
geof.write("Mesh.MshFileVersion = 2.2;\n")
#
# points
#
geof.write("Point(1) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out1, sim_Lz_out1, sim_h));
geof.write("Point(2) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out1, sim_Lz_out1, sim_h))
geof.write("Point(3) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out2, sim_Ly_out2, sim_Lz_out1, sim_h))
geof.write("Point(4) = {%4.6e, %4.6e, %4.6e, %4.6e};\n" % (sim_Lx_out1, sim_Ly_out2, sim_Lz_out1, sim_h))
#
# lines
#
geof.write("Line(1) = {1, 2};\n")
geof.write("Line(2) = {2, 3};\n")
geof.write("Line(3) = {3, 4};\n")
geof.write("Line(4) = {4, 1};\n")
#
# surfaces
#
geof.write("Line Loop(1) = {1, 2, 3, 4};\n")
#
# plane surface
#
geof.write("Plane Surface(1) = {1};\n")
#
# physical surface
#
tag = '"' + "a" + '"'
geof.write("Physical Surface(%s) = {1};\n" % (tag))
# close file
geof.close()
def create_input_file(inp_dir, pp_tag):
"""Generates input file for two-particle test"""
sim_inp_dir = str(inp_dir)
## 1 - bottom 2 - top 3 - wall
center = [0., 0., 0.]
R1 = 0.001
R2 = 0.0015
mesh_size = R1 / 10.
if R2 < R1:
mesh_size = R2 / 10.
horizon = 3. * mesh_size
particle_dist = 0.001
## wall
wall_bottom_particle_dist = 1.5 * mesh_size
wall_rect = [-R1, -horizon - wall_bottom_particle_dist, 0., 3.*R1, -wall_bottom_particle_dist, 0.]
if R2 > R1:
wall_rect[0] = R1-2.*R2
wall_rect[3] = R1+2.*R2
## time
final_time = 0.005
num_steps = 800000
# final_time = 0.00002
# num_steps = 2
num_outputs = 100
dt_out_n = num_steps / num_outputs
perform_out = True
## material
poisson1 = 0.25
rho1 = 1200.
K1 = 2.16e+7
E1 = get_E(K1, poisson1)
G1 = get_G(E1, poisson1)
Gc1 = 50.
poisson2 = 0.25
rho2 = 1200.
K2 = 2e+9
E2 = get_E(K2, poisson2)
G2 = get_G(E2, poisson2)
Gc2 = 500.
# wall
poisson3 = 0.25
rho3 = 1200.
K3 = 2e+9
E3 = get_E(K3, poisson3)
G3 = get_G(E3, poisson3)
Gc3 = 500.
## contact
# R_contact = 0.95 * mesh_size
# R_contact = 1.74e-04
R_contact_factor = 0.95
# Kn_V_max = 7.385158e+05
# Kn = np.power(Kn_V_max, 2)
# compute from bulk modulus
# from bulk modulus
Kn_11 = 18. * get_eff_k(K1, K1) / (np.pi * np.power(horizon, 5))
Kn_22 = 18. * get_eff_k(K2, K2) / (np.pi * np.power(horizon, 5))
Kn_33 = 18. * get_eff_k(K3, K3) / (np.pi * np.power(horizon, 5))
Kn_12 = 18. * get_eff_k(K1, K2) / (np.pi * np.power(horizon, 5))
Kn_13 = 18. * get_eff_k(K1, K3) / (np.pi * np.power(horizon, 5))
Kn_23 = 18. * get_eff_k(K2, K3) / (np.pi * np.power(horizon, 5))
beta_n_eps = 0.95
friction_coeff = 0.5
damping_active = True
friction_active = False
beta_n_factor = 100.
## gravity
gravity_active = True
gravity = [0., -10., 0.]
## assign free fall velocity to second particle
free_fall_dist = particle_dist - horizon
free_fall_vel = [0., 0., 0.]
#free_fall_vel[1] = -np.sqrt(2. * np.abs(gravity[1]) * free_fall_dist)
free_fall_vel[1] = -5.
### ---------------------------------------------------------------- ###
# generate YAML file
### ---------------------------------------------------------------- ###
# print('\nGenerating imput file\n')
inpf = open(sim_inp_dir + 'input_' + str(pp_tag) + '.yaml','w')
inpf.write("Model:\n")
inpf.write(" Dimension: 2\n")
inpf.write(" Discretization_Type:\n")
inpf.write(" Spatial: finite_difference\n")
inpf.write(" Time: central_difference\n")
inpf.write(" Final_Time: %4.6e\n" % (final_time))
inpf.write(" Time_Steps: %d\n" % (num_steps))
#
# container info
#
inpf.write("Container:\n")
inpf.write(" Geometry:\n")
inpf.write(" Type: rectangle\n")
contain_params = [-R1, -horizon - wall_bottom_particle_dist, 0., 3.*R1, 2.*R1 + 2.*R2 + particle_dist, 0.]
if R2 > R1:
contain_params[0] = R1-2.*R2
contain_params[3] = R1+2.*R2
inpf.write(" Parameters: " + print_dbl_list(contain_params))
#
# zone info
#
inpf.write("Zone:\n")
inpf.write(" Zones: 3\n")
## zone 1 (bottom particle)
inpf.write(" Zone_1:\n")
inpf.write(" Is_Wall: false\n")
## zone 2 (top particle)
inpf.write(" Zone_2:\n")
inpf.write(" Is_Wall: false\n")
## zone 3 (wall)
inpf.write(" Zone_3:\n")
inpf.write(" Is_Wall: true\n")
inpf.write(" Type: rectangle\n")
inpf.write(" Parameters: " + print_dbl_list(wall_rect))
#
# particle info
#
inpf.write("Particle:\n")
inpf.write(" Test_Name: two_particle_wall\n")
inpf.write(" Zone_1:\n")
inpf.write(" Type: drum2d\n")
drum_axis = [1., 0., 0.]
drum1_neck_width = 0.5*R1
p1_geom = [R1, drum1_neck_width, center[0], center[1], center[2], drum_axis[0], drum_axis[1], drum_axis[2]]
inpf.write(" Parameters: " + print_dbl_list(p1_geom))
inpf.write(" Zone_2:\n")
inpf.write(" Type: drum2d\n")
drum2_neck_width = 0.5*R2
p2_geom = [R2, drum2_neck_width, center[0], center[1], center[2], drum_axis[0], drum_axis[1], drum_axis[2]]
inpf.write(" Parameters: " + print_dbl_list(p2_geom))
#
# wall info
#
inpf.write("Wall:\n")
inpf.write(" Zone_3:\n")
inpf.write(" Type: flexible\n")
inpf.write(" All_Dofs_Constrained: true\n")
inpf.write(" Mesh: true\n")
#
# particle generation
#
inpf.write("Particle_Generation:\n")
inpf.write(" From_File: particle_locations_" + str(pp_tag) + ".csv\n")
# specify that we also provide the orientation information in the file
inpf.write(" File_Data_Type: loc_rad_orient\n")
#
# Mesh info
#
inpf.write("Mesh:\n")
## zone 1
inpf.write(" Zone_1:\n")
inpf.write(" File: mesh_drum_1_" + str(pp_tag) + ".msh \n")
## zone 2
inpf.write(" Zone_2:\n")
inpf.write(" File: mesh_drum_2_" + str(pp_tag) + ".msh \n")
## zone 3 (wall)
inpf.write(" Zone_3:\n")
inpf.write(" File: mesh_wall_" + str(pp_tag) + ".msh \n")
#
# Contact info
#
inpf.write("Contact:\n")
## 11
inpf.write(" Zone_11:\n")
# inpf.write(" Contact_Radius: %4.6e\n" % (R_contact))
inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
if damping_active == False:
inpf.write(" Damping_On: false\n")
if friction_active == False:
inpf.write(" Friction_On: false\n")
inpf.write(" Kn: %4.6e\n" % (Kn_11))
inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
inpf.write(" Kn_Factor: 1.0\n")
inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
## 12
inpf.write(" Zone_12:\n")
inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
if damping_active == False:
inpf.write(" Damping_On: false\n")
if friction_active == False:
inpf.write(" Friction_On: false\n")
inpf.write(" Kn: %4.6e\n" % (Kn_12))
inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
inpf.write(" Kn_Factor: 1.0\n")
inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
## 13
inpf.write(" Zone_13:\n")
inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
if damping_active == False:
inpf.write(" Damping_On: false\n")
if friction_active == False:
inpf.write(" Friction_On: false\n")
inpf.write(" Kn: %4.6e\n" % (Kn_13))
inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
inpf.write(" Kn_Factor: 1.0\n")
inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
## 22
inpf.write(" Zone_22:\n")
inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
if damping_active == False:
inpf.write(" Damping_On: false\n")
if friction_active == False:
inpf.write(" Friction_On: false\n")
inpf.write(" Kn: %4.6e\n" % (Kn_22))
inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
inpf.write(" Kn_Factor: 1.0\n")
inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
## 23
inpf.write(" Zone_23:\n")
inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
if damping_active == False:
inpf.write(" Damping_On: false\n")
if friction_active == False:
inpf.write(" Friction_On: false\n")
inpf.write(" Kn: %4.6e\n" % (Kn_23))
inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
inpf.write(" Kn_Factor: 1.0\n")
inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
## 33
inpf.write(" Zone_33:\n")
inpf.write(" Contact_Radius_Factor: %4.6e\n" % (R_contact_factor))
if damping_active == False:
inpf.write(" Damping_On: false\n")
if friction_active == False:
inpf.write(" Friction_On: false\n")
inpf.write(" Kn: %4.6e\n" % (Kn_33))
inpf.write(" Epsilon: %4.6e\n" % (beta_n_eps))
inpf.write(" Friction_Coeff: %4.6e\n" % (friction_coeff))
inpf.write(" Kn_Factor: 1.0\n")
inpf.write(" Beta_n_Factor: %4.6e\n" % (beta_n_factor))
#
# Neighbor info
#
inpf.write("Neighbor:\n")
inpf.write(" Update_Criteria: simple_all\n")
inpf.write(" Search_Factor: 5.0\n")
#
# Material info
#
inpf.write("Material:\n")
## zone 1
inpf.write(" Zone_1:\n")
inpf.write(" Type: PDState\n")
inpf.write(" Horizon: %4.6e\n" % (horizon))
inpf.write(" Density: %4.6e\n" % (rho1))
inpf.write(" Compute_From_Classical: true\n")
inpf.write(" K: %4.6e\n" % (K1))
inpf.write(" G: %4.6e\n" % (G1))
inpf.write(" Gc: %4.6e\n" % (Gc1))
inpf.write(" Influence_Function:\n")
inpf.write(" Type: 1\n")
## zone 2
inpf.write(" Zone_2:\n")
inpf.write(" Type: PDState\n")
inpf.write(" Horizon: %4.6e\n" % (horizon))
inpf.write(" Density: %4.6e\n" % (rho2))
inpf.write(" Compute_From_Classical: true\n")
inpf.write(" K: %4.6e\n" % (K2))
inpf.write(" G: %4.6e\n" % (G2))
inpf.write(" Gc: %4.6e\n" % (Gc2))
inpf.write(" Influence_Function:\n")
inpf.write(" Type: 1\n")
## zone 3
inpf.write(" Zone_3:\n")
inpf.write(" Type: PDState\n")
inpf.write(" Horizon: %4.6e\n" % (horizon))
inpf.write(" Density: %4.6e\n" % (rho3))
inpf.write(" Compute_From_Classical: true\n")
inpf.write(" K: %4.6e\n" % (K3))
inpf.write(" G: %4.6e\n" % (G3))
inpf.write(" Gc: %4.6e\n" % (Gc3))
inpf.write(" Influence_Function:\n")
inpf.write(" Type: 1\n")
#
# Force
#
if gravity_active == True:
inpf.write("Force_BC:\n")
inpf.write(" Gravity: " + print_dbl_list(gravity))
#
# IC
#
inpf.write("IC:\n")
inpf.write(" Constant_Velocity:\n")
inpf.write(" Velocity_Vector: " + print_dbl_list(free_fall_vel))
inpf.write(" Particle_List: [1]\n")
#
# Displacement
#
inpf.write("Displacement_BC:\n")
inpf.write(" Sets: 1\n")
inpf.write(" Set_1:\n")
inpf.write(" Wall_List: [0]\n")
inpf.write(" Direction: [1,2]\n")
inpf.write(" Time_Function:\n")
inpf.write(" Type: constant\n")
inpf.write(" Parameters:\n")
inpf.write(" - 0.0\n")
inpf.write(" Spatial_Function:\n")
inpf.write(" Type: constant\n")
inpf.write(" Zero_Displacement: true\n")
#
# Output info
#
inpf.write("Output:\n")
inpf.write(" Path: ../out/\n")
inpf.write(" Tags:\n")
inpf.write(" - Displacement\n")
inpf.write(" - Velocity\n")
inpf.write(" - Force\n")
inpf.write(" - Force_Density\n")
inpf.write(" - Damage_Z\n")
inpf.write(" - Damage\n")
inpf.write(" - Nodal_Volume\n")
inpf.write(" - Zone_ID\n")
inpf.write(" - Particle_ID\n")
inpf.write(" - Fixity\n")
inpf.write(" - Force_Fixity\n")
inpf.write(" - Contact_Data\n")
inpf.write(" - No_Fail_Node\n")
inpf.write(" - Boundary_Node_Flag\n")
# inpf.write(" - Strain_Stress\n")
inpf.write(" Output_Interval: %d\n" % (dt_out_n))
inpf.write(" Compress_Type: zlib\n")
inpf.write(" Perform_FE_Out: false\n")
if perform_out:
inpf.write(" Perform_Out: true\n")
else:
inpf.write(" Perform_Out: false\n")
inpf.write(" Test_Output_Interval: %d\n" % (dt_out_n))
inpf.write(" Debug: 1\n")
inpf.write(" Tag_PP: %d\n" %(int(pp_tag)))
# inpf.write(" Output_Criteria: \n")
# inpf.write(" Type: max_particle_dist\n")
# inpf.write(" Parameters: [%4.6e]\n" % (2. * sim_h))
inpf.write("HPX:\n")
inpf.write(" Partitions: 1\n")
# close file
inpf.close()
# generate particle locations
# particle_locations(inp_dir, pp_tag, R1, R2, particle_dist - free_fall_dist)
particle_locations_orient(inp_dir, pp_tag, R1, R2, particle_dist - free_fall_dist)
# generate particle .geo file (large)
generate_particle_gmsh_input(inp_dir, 'mesh_drum_1', center, R1, drum1_neck_width, mesh_size, pp_tag)
generate_particle_gmsh_input(inp_dir, 'mesh_drum_2', center, R2, drum2_neck_width, mesh_size, pp_tag)
generate_wall_gmsh_input(inp_dir, 'mesh_wall', wall_rect, mesh_size, pp_tag)
##-------------------------------------------------------##
##-------------------------------------------------------##
inp_dir = './'
pp_tag = 0
if len(sys.argv) > 1:
pp_tag = int(sys.argv[1])
create_input_file(inp_dir, pp_tag)