seisflows.solver.specfem3d
This class provides utilities for the Seisflows solver interactions with Specfem3D Cartesian.
Module Contents
Classes
Solver SPECFEM3D |
- class seisflows.solver.specfem3d.Specfem3D(source_prefix='CMTSOLUTION', export_vtk=True, prune_scratch=True, **kwargs)
Bases:
seisflows.solver.specfem.Specfem
Solver SPECFEM3D
SPECFEM3D-specific alterations to the base SPECFEM module
Parameters
- type source_prefix
str
- param source_prefix
Prefix of source files in path SPECFEM_DATA. Must be in [‘CMTSOLUTION’, ‘FORCESOLUTION’]. Defaults to ‘CMTSOLUTION’
- type export_vtk
bool
- param export_vtk
anytime a model, kernel or gradient is considered, generate a VTK file and store it in the scratch/ directory for the User to visualize at their leisure.
- type prune_scratch
bool
- param prune_scratch
prune/remove database files as soon as they are used, to keep overall filesystem burden down - removes *.vt? files after they’re generated by a forward simulation - removes proc*_absorb_field.bin and proc*_save_forward_array.bin
files after adjoint simulations
Paths
- property model_databases
The location of databases for model outputs, usually OUTPUT_FILES/DATABASES_MPI. This can be determined by ‘LOCAL_PATH’ in your Par_file
- property kernel_databases
The location of databases for kernel outputs, usually the same as ‘model_databases’
- __doc__
- setup()
Generate .vtk files for the initial and target (if applicable) models, which the User can use for external visualization
- data_wildcard(comp='?')
Returns a wildcard identifier for synthetic data
TODO where does SU put its component?
- Return type
str
- Returns
wildcard identifier for channels
- forward_simulation(executables=None, save_traces=False, export_traces=False, **kwargs)
Calls SPECFEM3D forward solver, exports solver outputs to traces dir
- Parameters
executables (list or None) – list of SPECFEM executables to run, in order, to complete a forward simulation. This can be left None in most cases, which will select default values based on the specific solver being called (2D/3D/3D_GLOBE). It is made an optional parameter to keep the function more general for inheritance purposes.
save_traces (str) – move files from their native SPECFEM output location to another directory. This is used to move output waveforms to ‘traces/obs’ or ‘traces/syn’ so that SeisFlows knows where to look for them, and so that SPECFEM doesn’t overwrite existing files during subsequent forward simulations
export_traces (str) – export traces from the scratch directory to a more permanent storage location. i.e., copy files from their original location
- adjoint_simulation(executables=None, save_kernels=False, export_kernels=False)
Calls SPECFEM3D adjoint solver, creates the SEM folder with adjoint traces which is required by the adjoint solver
- Parameters
executables (list or None) – list of SPECFEM executables to run, in order, to complete an adjoint simulation. This can be left None in most cases, which will select default values based on the specific solver being called (2D/3D/3D_GLOBE). It is made an optional parameter to keep the function more general for inheritance purposes.
save_kernels (str) – move the kernels from their native SPECFEM output location to another path. This is used to move kernels to another SeisFlows scratch directory so that they are discoverable by other modules. The typical location they are moved to is path_eval_grad
export_kernels (str) – export/copy/save kernels from the scratch directory to a more permanent storage location. i.e., copy files from their original location. Note that kernel file sizes are LARGE, so exporting kernels can lead to massive storage requirements.
- combine_vol_data_vtk(input_path, output_path, hi_res=False, parameters=None)
Wrapper for ‘xcombine_vol_data_vtk’. Combines binary files together to generate a single .VTK file that can be visualized by external software like ParaView
xcombine_data start end quantity input_dir output_dir hi/lo-res
Note
It is ASSUMED that this function is being called by system.run(single=True) so that we can use the main solver directory to perform the kernel summation task
- Parameters
input_path (str) – path to database files to be summed.
output_path (strs) – path to export the outputs of xcombine_sem
hi_res (bool) – Set the high resolution flag to 1 or True, which will generate .vtk files with data at EACH GLL point, rather than at each nodal vertex. These files are LARGE, and we discourage using `hi_res`==True unless you know you want these files.
parameters (list) – optional list of parameters, defaults to self._parameters