Skip to content

Commit b7f8321

Browse files
committed
- added documentation for Python scenes
1 parent 82b5da2 commit b7f8321

File tree

1 file changed

+32
-1
lines changed

1 file changed

+32
-1
lines changed

doc/py_creating_scenes.md

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([-1.5, 0.0
3131
scene.fluidBlocks.append(Scenes.FluidBlock(id='Fluid', box=Scenes.Box([0.5, 0.0, 0.5], [1.5, 2.0, 1.5]), mode=0, initialVelocity=[0.0, 0.0, 0.0]))
3232
```
3333

34-
This will recreate a somewhat larger scene than the default double dam break
34+
This will recreate a somewhat larger scene than the default double dam break.
35+
3536

3637
## Putting it all together
3738

@@ -64,6 +65,36 @@ if __name__ == "__main__":
6465
main()
6566
```
6667

68+
## Changing parameters of the simulation
69+
70+
The command ```base.run()``` at the end of the example above is a shortcut for the commands:
71+
```python
72+
base.initSimulation() # init simulation, fluid models, time step, ...
73+
base.runSimulation() # start the simulation
74+
base.cleanup() # cleanup everything after the simulation
75+
```
76+
77+
If you want to change the parameters of the fluid model or the simulation, you first have to initialize the scene. Therefore, exchange ```base.run()``` by the three commands above. Then, you can change the parameters after the call of ```base.initSimulation()```.
78+
79+
Here is an example:
80+
81+
```python
82+
base.initSimulation()
83+
84+
# change rest density of first fluid model
85+
fluid = sim.getFluidModel(0)
86+
fluid.setValueFloat(fluid.DENSITY0, 800.0)
87+
88+
# change viscosity coefficient
89+
visco = fluid.getViscosityBase()
90+
visco.setValueFloat(visco.VISCOSITY_COEFFICIENT, 0.015)
91+
92+
base.runSimulation()
93+
base.cleanup()
94+
```
95+
96+
97+
6798
## Loading a scene from file
6899

69100
Loading a scene from a file is as simple as simply specifying a custom scene file in the init function.

0 commit comments

Comments
 (0)