dynamicslab / hydrogym

An RL-Gym for Challenge Problems in Data-Driven Modeling and Control of Fluid Dynamics.
https://hydrogym.readthedocs.io
MIT License
45 stars 10 forks source link

BDF/EXT time-stepper #134

Closed jcallaham closed 4 months ago

jcallaham commented 4 months ago

Add a BDF solver with an equal-order extrapolation estimate for the nonlinear term. This results in a semi-implicit solver that only needs one linear system solve per time step. The scheme is based on the time-stepping in Nek5000.

This solver is slower to solve an individual time step compared to IPCS (because it uses a mixed formulation instead of split velocity/pressure systems), but typically faster overall since it can take larger time steps. For example, on the cylinder (single core on my laptop, medium-resolution mesh), the BDF3 solver takes about 14.5 sec wall clock time per unit of simulation time, compared to about 54.3 sec per unit of sim time for IPCS (about a 4x speedup). We can probably improve on this further by using a stabilized formulation like SUPG so that we can use equal-order elements and have a smaller mixed linear system to solve.

Profiling

Time to run each environment to tf=1.0, using approximately the maximum stable time step for each method and the default mesh for each environment. Times reported are wall clock times.

Cylinder Pinball Cavity Step
IPCS (nproc=1) 0:57 3:34
IPCS (nproc=4) 0:48 1:50
IPCS (nproc=8) 0:43 1:30
IPCS (nproc=32) 1:15 1:43 1:10:30 13:13
BDF3 (nproc=1) 0:22 1:34
BDF3 (nproc=4) 0:15 0:43
BDF3 (nproc=8) 0:15 0:40
BDF3 (nproc=32) 0:25 0:47 12:13 3:57
Max speedup 2.9x 2.3x 5.8x 3.3x

Looks like ~3x speedup on average, maybe more for larger problems. The mixed element systems do lead to larger linear system solves, but hopefully that can be somewhat mitigated with SUPG stabilization or linear velocity elements.

Changes

TODO