forked from Genesis-Embodied-AI/Genesis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpbd_liquid.py
47 lines (36 loc) · 1.25 KB
/
pbd_liquid.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
import argparse
import numpy as np
import genesis as gs
def main():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--vis", action="store_true", default=False)
args = parser.parse_args()
########################## init ##########################
gs.init(seed=0, precision="32", logging_level="debug")
scene = gs.Scene(
sim_options=gs.options.SimOptions(
dt=2e-3,
),
viewer_options=gs.options.ViewerOptions(
camera_pos=(3.5, 1.0, 2.5),
camera_lookat=(0.0, 0.0, 0.5),
camera_fov=40,
),
show_viewer=args.vis,
pbd_options=gs.options.PBDOptions(
lower_bound=(0.0, 0.0, 0.0),
upper_bound=(1.0, 1.0, 1.0),
max_density_solver_iterations=10,
max_viscosity_solver_iterations=1,
),
)
########################## entities ##########################
liquid = scene.add_entity(
material=gs.materials.PBD.Liquid(rho=1.0, density_relaxation=1.0, viscosity_relaxation=0.0, sampler="regular"),
morph=gs.morphs.Box(lower=(0.2, 0.1, 0.1), upper=(0.4, 0.3, 0.5)),
)
scene.build()
for i in range(10000):
scene.step()
if __name__ == "__main__":
main()