clawpack/2d/advection/filament_swirl contains two executables
filament_swirl where both solvers are on MPI_COMM_WORLD and time stepping switches between both solvers.
filament_swirl_split where both solvers are on split communicators.
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:
Add fclaw_filesystem.h this contains two functions fclaw_cd and fclaw_cwd. Changing the working directory is needed to allow for the input/output of two solvers to be in two separate directories.
Add custom log handlers to fclaw_base.c to allow for a prefix to be added to each log message. This makes it easier to tell which message belongs to which solver. fclaw_set_logging_prefix is added to change the logging prefix.
[swirl][fclaw] Level 2 (4-6) step 80 : dt = 1.651e-01; maxcfl (step) = 2.192; Final time = 3.2776
[swirl][fclaw] WARNING : Maximum CFL exceeded; retaking time step
[swirl][fclaw] Level 2 (4-6) step 80 : dt = 6.777e-02; maxcfl (step) = 0.599; Final time = 3.1803
[swirl][fclaw] Level 2 (4-6) step 81 : dt = 1.018e-01; maxcfl (step) = 1.382; Final time = 3.2821
[swirl][fclaw] WARNING : Maximum CFL exceeded; retaking time step
[swirl][fclaw] Level 2 (4-6) step 81 : dt = 6.630e-02; maxcfl (step) = 0.795; Final time = 3.2466
[swirl][fclaw] Paused at time 3.2466
[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.
Examples
clawpack/2d/advection/filament_swirl
contains two executablesfilament_swirl
where both solvers are onMPI_COMM_WORLD
and time stepping switches between both solvers.filament_swirl_split
where both solvers are on split communicators.elliptic/heat_phasefield
andgeoclaw/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:
fclaw_filesystem.h
this contains two functionsfclaw_cd
andfclaw_cwd
. Changing the working directory is needed to allow for the input/output of two solvers to be in two separate directories.fclaw_base.c
to allow for a prefix to be added to each log message. This makes it easier to tell which message belongs to which solver.fclaw_set_logging_prefix
is added to change the logging prefix.[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