seisflows.solver.specfem3d_globe

This class provides utilities for the Seisflows solver interactions with Specfem3D Globe. It is built on top of the Specfem base class.

Some key differences between 3D and 3D_GLOBE implementations:

  1. SPECFEM3D_GLOBE does not require ‘xgenerate_databases’ which is

    required for Cartesian.

  2. Related to (1), we do NOT want to re-run the mesher, event at

    the very beginning. The Solver will simply re-load GLL model when run with a valid GLL model

  3. 3DGLOBE cannot toggle attenuation on/off. If it was on to create

    the model, it MUST be on for the solver (otherwise throws a weird ‘recompile solver’ error)

  4. Does not allow SU seismogram outputs, only ASCII, SAC, ASDF, 3D_Array

  5. SPECFEM3D_GLOBE ASCII synthetics have extension ‘.ascii’, but

    the adjoint sources are NOT supposed to have this, i.e., they should have extension ‘.adj’

  6. 3DGLOBE breaks its files into 3 regions (reg1: mantle, reg2: outer core,

    reg3: inner core) which affects file bookkeeping

Module Contents

Classes

Specfem3DGlobe

Solver SPECFEM3D_GLOBE

class seisflows.solver.specfem3d_globe.Specfem3DGlobe(source_prefix='CMTSOLUTION', export_vtk=True, prune_scratch=True, regions='123', smooth_type='laplacian', **kwargs)

Bases: seisflows.solver.specfem.Specfem

Solver SPECFEM3D_GLOBE

SPECFEM3D_Globe-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

type regions

str

param regions

which regions of the chunk to consider in your ‘model’. Valid regions are 1, 2 and 3. If you want all regions, set as ‘123’. If you only want region 1, set as ‘1’, etc. Order insensitive.

type smooth_type

str

param smooth_type

choose how smoothing is performed for gradients. these are tied to the internal smoothing functions available. - ‘gaussian’: convolve with a 3D gaussian, slow and computationally

intensive, but default and matches 2D and 3D_Cartesian smoothing

  • ‘laplacian’ (default): average points around vertex to smooth.

    faster and preferred method for GLOBE code

Paths

***

property kernel_databases

The location of kernel output files, for 3DGLOBE usually DATABASES_MPI. This can be determined by ‘LOCAL_PATH’ in the Par_file. Points to model_databases as it is assumed they are the same path

property model_databases

The location of model output files, for 3DGLOBE usually DATABASES_MPI. This can be determined by ‘LOCAL_PATH’ in the Par_file and must be defined relative to the main directory

__doc__
check()

Checks parameter validity for SPECFEM3D_GLOBE parameters

data_wildcard(comp='?')

Returns a wildcard identifier for synthetic data Currently only support for ASCII seismograms

Return type

str

Returns

wildcard identifier for channels

forward_simulation(executables=None, save_traces=False, export_traces=False, **kwargs)

Calls SPECFEM3D_GLOBE forward solver, exports solver outputs to traces.

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)

Supers SPECFEM3D for adjoint solver and removes GLOBE-specific fwd files Also deals with anisotropic kernels (or lack thereof)

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(input_path, output_path, parameters=None)

Overwrite of xcombine_sem with an additional file check as SPECFEM3D_GLOBE requires file ‘mesh_parameters.bin’

Parameters
  • input_path (str) – path to data

  • output_path (strs) – path to export the outputs of xcombine_sem

  • parameters (list) – optional list of parameters, defaults to self._parameters

smooth(input_path, output_path, parameters=None, span_h=None, span_v=None, use_gpu=False)

Logic function to choose between available smoothing types for GLOBE

Parameters
  • input_path (str) – path to data

  • output_path (str) – path to export the outputs of xcombine_sem

  • parameters (list) – optional list of parameters, defaults to self._parameters

  • span_h (float) – horizontal smoothing length in meters

  • span_v (float) – vertical smoothing length in meters

  • use_gpu (bool) – whether to use GPU acceleration for smoothing. Requires GPU compiled binaries and GPU compute node.

smooth_laplacian(input_path, output_path, parameters=None, span_h=None, span_v=None)

Wrapper for SPECFEM binary: xsmooth_laplacian_sem

Smooths kernels by with Laplacian smoothing which takes averages of a mesh corner with all it’s surrounding points.

Note

Externally this smooth function behaves almost identically to the normal gaussian smoothing function

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 smooth task

Parameters
  • input_path (str) – path to data

  • output_path (str) – path to export the outputs of xcombine_sem

  • parameters (list) – optional list of parameters, defaults to self._parameters

  • span_h (float) – horizontal smoothing length in km

  • span_v (float) – vertical smoothing length in km

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