-
Notifications
You must be signed in to change notification settings - Fork 10
/
NewtonianFluid.py
114 lines (95 loc) · 5.32 KB
/
NewtonianFluid.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
from geotaichi import *
init()
mpm = MPM()
mpm.set_configuration(domain=ti.Vector([1.7, 0.25, 2.5]),
background_damping=0.00,
alphaPIC=0.002,
mapping="USL",
shape_function="GIMP",
material_type="Fluid")
mpm.set_solver(solver={
"Timestep": 1e-5,
"SimulationTime": 2.5,
"SaveInterval": 0.02
})
mpm.memory_allocate(memory={
"max_material_number": 1,
"max_particle_number": 8.64e5,
"max_constraint_number": {
"max_reflection_constraint": 950000
}
})
mpm.add_material(model="Newtonian",
material={
"MaterialID": 1,
"Density": 1000.,
"Modulus": 3.6e5,
"Viscosity": 1e-3
})
mpm.add_element(element={
"ElementType": "R8N3D",
"ElementSize": ti.Vector([0.01, 0.01, 0.01])
})
mpm.add_region(region={
"Name": "region1",
"Type": "Rectangle",
"BoundingBoxPoint": ti.Vector([0.05, 0.05, 0.05]),
"BoundingBoxSize": ti.Vector([0.6, 0.15, 0.6]),
"zdirection": ti.Vector([0., 0., 1.])
})
mpm.add_body(body={
"Template": {
"RegionName": "region1",
"nParticlesPerCell": 2,
"BodyID": 0,
"MaterialID": 1,
"ParticleStress": {
"GravityField": True,
"InternalStress": ti.Vector([-0., -0., -0., 0., 0., 0.]),
"Traction": {}
},
"InitialVelocity":ti.Vector([0, 0, 0]),
"FixVelocity": ["Free", "Free", "Free"]
}
})
mpm.add_boundary_condition(boundary=[
{
"BoundaryType": "ReflectionConstraint",
"Norm": [0., 0., -1.],
"StartPoint": [0., 0., 0.],
"EndPoint": [1.7, 0.25, 0.05]
},
{
"BoundaryType": "ReflectionConstraint",
"Norm": [-1., 0., 0.],
"StartPoint": [0., 0., 0.],
"EndPoint": [0.05, 0.25, 2.5]
},
{
"BoundaryType": "ReflectionConstraint",
"Norm": [1., 0., 0.],
"StartPoint": [1.66, 0., 0.],
"EndPoint": [1.7, 0.25, 2.5]
},
{
"BoundaryType": "ReflectionConstraint",
"Norm": [0., -1., 0.],
"StartPoint": [0., 0., 0.],
"EndPoint": [1.7, 0.05, 2.5]
},
{
"BoundaryType": "ReflectionConstraint",
"Norm": [0., 1., 0.],
"StartPoint": [0., 0.2, 0.],
"EndPoint": [1.7, 0.25, 2.5]
},
{
"BoundaryType": "ReflectionConstraint",
"Norm": [0., 0., 1],
"StartPoint": [0., 0., 2.4],
"EndPoint": [1.7, 0.25, 2.5]
}
])
mpm.select_save_data()
mpm.run()
mpm.postprocessing()