ForestClaw / forestclaw

Quadtree/octree adaptive PDE solver based based on p4est.
http://www.forestclaw.org
BSD 2-Clause "Simplified" License
57 stars 21 forks source link

Two Solver Examples #244

Closed scottaiton closed 1 year ago

scottaiton commented 1 year ago

Examples

clawpack/2d/advection/filament_swirl contains two executables

elliptic/heat_phasefield and geoclaw/bowl_radial_slosh both run one solver to full completion and then the next solver.

Changes to ForestClaw Library

Some changes to accommodate two solvers were needed:

[flmnt][fclaw] Level 3 (3-3) step 662 : dt = 4.857e-03; maxcfl (step) = 0.900; Final time = 3.2089 [flmnt][fclaw] Level 3 (3-3) step 663 : dt = 4.857e-03; maxcfl (step) = 0.900; Final time = 3.2137 [flmnt][fclaw] Level 3 (3-3) step 664 : dt = 4.857e-03; maxcfl (step) = 0.900; Final time = 3.2186 [flmnt][fclaw] Level 3 (3-3) step 665 : dt = 4.857e-03; maxcfl (step) = 0.900; Final time = 3.2234



- Add `fclaw_app_new_on_comm` constructor which takes an mpi communicator as an additional argument. `fclaw_app_new` calls `MPI_Init` and calls `sc_init` with the `MPI_COMM_WORLD` communicator. For solvers on split communicators, `MPI_Init` needs to be called before the app constructor and `sc_init` needs to be called with the split communicator passed to it.

- `fclaw_gauges.c` was using a static variable to store gauge info. Gauge info is now store in the `glob` to allow for two solvers with gauges.
- Add `run_directory` and `logging_prefix` as options to the `fclaw2d_options` struct.
- Add `fclaw2d_set_global_context` and `fclaw2d_clear_global_context` to `fclaw2d_global.c`. These are only used when running two solvers.
  - `fclaw2d_set_global_context` changes the logging prefix and changes the current working directory based on the values in `fclaw2d_options`. 
  - `fclaw2d_clear_global_context` clears the logging prefix and returns to the previous working directory.
- In `geoclaw_set_modules_fort.f90` added check to deallocate `mthlim` if `mthlim` is already allocated.