@@ -24,6 +24,13 @@ What do they do?
2424
2525The following function allows us to query the maximum allowed time step size from preCICE:
2626
27+
28+ <ul id="apiTabs" class="nav nav-tabs">
29+ <li class="active"><a href="#cpp" data-toggle="tab">C++</a></li>
30+ <li><a href="#python" data-toggle="tab">Python</a></li>
31+ </ul>
32+ <div class="tab-content">
33+ <div role="tabpanel" class="tab-pane active" id="cpp" markdown="1">
2734```cpp
2835double getMaxTimeStepSize();
2936```
@@ -53,3 +60,29 @@ while (not simulationDone()){ // time loop
5360precice.finalize(); // frees data structures and closes communication channels
5461turnOffSolver();
5562```
63+ </div>
64+ <div role="tabpanel" class="tab-pane" id="python" markdown="1">
65+ ```python
66+ import precice
67+
68+ turn_on_solver() # e.g. setup and partition mesh
69+
70+ precice = precice.Interface(
71+ "FluidSolver", "precice-config.xml", rank, size
72+ )
73+ precice_dt = precice.initialize()
74+
75+ u = initialize_solution()
76+
77+ while t < t_end: # time loop
78+ dt = compute_adaptive_dt()
79+ dt = min(precice_dt, dt) # more about this in Step 5
80+ u = solve_time_step(dt, u) # returns new solution
81+ precice_dt = precice.advance(dt)
82+ t = t + dt
83+
84+ precice.finalize() # frees data structures and closes communication channels
85+ ```
86+ </div >
87+ </div >
88+
0 commit comments