Open bch0w opened 5 months ago
Hi @Rohit-Kakodkarm here is a broad-strokes outline of what I think needs to be done to implement SPECFEM++ in SeisFlows. I'll use the terms 'specfemft' to refer to the Fortran version, and 'specfempp' to refer to SPECFEM++.
Our first goal should be to run a forward simulation (https://github.com/adjtomo/seisflows/blob/devel/seisflows/workflow/forward.py) with SeisFlows controlling SPECFEM++ under the hood. From there we can build to adjoint simulations, etc.
In the main workflow
classes of SeisFlows, specfemft (2d, 3d and 3d_globe) is generalized as solver
so we will need to make sure that a newly written specfempp
solver class contains all the same generic functions that are expected of the solver class.
Solver
class: We'll need to follow some of the structure laid out in the current specfemft version (https://github.com/adjtomo/seisflows/blob/devel/seisflows/solver/specfem.py)forward_simulation
and adjoint_simulation
which perform set up and tear down tasks (e.g., setting correct parameters and saving output files) as well as running specfemft executablesolver
in the Forward workflow (https://github.com/adjtomo/seisflows/blob/devel/seisflows/workflow/forward.py)specfempp
solver module, and if that gets too large we can split them off into a separate tool module
-getpar
and setpar
probably the most important, allows other modules to get and set parameters in a SPECFEM parameter fileModel
class, which stores an internal NumPy representation of a distributed model.
SPECFEM++ developer @Rohit-Kakodkar and I agreed it would be great for the community to build in SeisFlows support for SPECFEM++, to handle workflow management for forward and adjoint simulations (and eventually inversions!).
SPECFEM++ works slightly differently than the Fortran version of the code (e.g., YAML parameter file, different source setups) and will likely need an entirely new Solver base class. Likely some minor reworking of the SeisFlows archicture will be needed as well to accommodate these changes. This will be a great first step into incorporating other numerical solvers into the SeisFlows codebase, which until now has only worked with different flavors of Fortran-based SPECFEM.
Putting this issue here as a tracker for progress on this front.