The fields Class

The fields class holds information regarding initial conditions and material properties. This includes the initial stresses (which can be spatially uniform or spatially heterogeneous) as well as heterogeneous elastic properties of the medium. While this information more accurately exists at the block level, because of how the C++ code is parallelized there are some performance benefits to placing all grid data in a single array to facilitate data sharing between processors.

The user does not typically interact with fields objects, as one is created automatically when initializing a domain. The problem class contains wrapper functions that perform any relevant modifications of the fields for a given simulation. Documentation is provided here for completeness.

class fdfault.fields(ndim, mode)

Class representing fields in a dynamic rupture problem

When initializing a fields object, one is created holding default attributes, including

Variables:
  • ndim (int) – Number of spatial dimensions (2 or 3; default is 2)
  • mode (int) – Rupture mode (2 or 3, default is 2; only relevant for 2D problems)
  • material (str) – Simulation material type ('elastic' or 'plastic', default is 'elastic')
  • s0 (list) – Initial stress tensor (list of floats, ordering is [sxx, sxy, sxz, syy, syz, szz], default is zero for all components). All components must be specified for any problem type, however, the code will only refer to the relevant values. Note that for mode 3 problems, the in-plane normal stresses sxx and syy will be used to determine the normal stress on any faults in the simulation, even though the normal stresses do not change during the simulation.
__init__(ndim, mode)

Initializes an instance of the fields class

Creates a new instance of the fields class. Attributes required to create a new instance is the number of dimensions and rupture mode. By default, the new fields instance is an elastic simulation with a stress tensor initialized to zero. The simulation also does not have a heterogeneous stress or heterogeneous material properties.

Parameters:
  • ndim (int) – Number of dimensions in the simulation (must be 2 or 3)
  • mode (int) – Rupture mode (2 or 3, only relevant for 2D problems)
Returns:

New instance of the fields class

Return type:

fields

get_het_material()

Returns heterogeneous material properties for simulation

Returns a numpy array with shape (3, nx, ny, nz). First index indicates parameter value (0 = density, 1 = Lame parameter, 2 = Shear modulus). The other three indicate grid coordinates. If no heterogeneous material parameters are specified, returns None

Returns:ndarray
get_het_stress()

Returns heterogeneous stress initial values.

Returns a numpy array with shape (ns, nx, ny, nz). First index indicates stress component. The following three indices indicate grid coordinates.If no array is currently specified, returns None.

For 2D mode 3 problems, indices for ns are (0 = sxz, 1 = syz)

For elastic 2D mode 2 problems, indices for ns are (0 = sxx, 1 = sxy, 2 = syy). For plastic 2D mode 2 problems, indices for ns are (0 = sxx, 1 = sxy, 2 = syy, 3 = szz).

For 3D problems, indices for ns are (0 = sxx, 1 = sxy, 2 = sxz, 3 = syy, 4 = syz, 5 = szz)

Returns:ndarray
get_material()

Returns material type (‘elastic’ or ‘plasitc’)

Returns:Material type
Return type:str
get_stress()

Returns uniform intial stress values

Note that 2D simulations do not use all stress components. Mode 2 elastic simulations only use sxx, sxy, and syy, and mode 3 elastic simulations use sxz, and syz (though the normal stresses sxx and syy can be set to constant values that are applied to any frictional failure criteria). Mode 2 plastic simulations use szz, and mode 3 plastic simulations use all three normal stress components in evaluating the yield criterion.

Returns:Initial stress tensor (list of floats). Format is [sxx, sxy, sxz, syy, syz, szz]
Return type:list
set_het_material(mat)

Sets heterogeneous material properties for simulation

New heterogeneous material properties must be a numpy array with shape (3, nx, ny, nz). First index indicates parameter value (0 = density, 1 = Lame parameter, 2 = Shear modulus). The other three indicate grid coordinates

An array with the wrong shape will result in an error.

Parameters:mat (ndarray) – New material properties array (numpy array with shape (3, nx, ny, nz))
Returns:None
set_het_stress(s)

Sets heterogeneous stress initial values

Sets initial heterogeneous stress. New stress must be a numpy array with shape (ns, nx, ny, nz). First index indicates stress component. The following three indices indicate grid coordinates.

For 2D mode 3 problems, indices for ns are (0 = sxz, 1 = syz)

For elastic 2D mode 2 problems, indices for ns are (0 = sxx, 1 = sxy, 2 = syy). For plastic 2D mode 2 problems, indices for ns are (0 = sxx, 1 = sxy, 2 = syy, 3 = szz).

For 3D problems, indices for ns are (0 = sxx, 1 = sxy, 2 = sxz, 3 = syy, 4 = syz, 5 = szz)

Providing arrays of the incorrect size will result in an error.

Parameters:s (ndarray) – New heterogeneous stress array (numpy array with shape (3, nx, ny, nz)
Returns:None
set_material(material)

Sets field and block material type (‘elastic’ or ‘plastic’)

Sets the material type for the simulation. Options are ‘elastic’ for an elastic simulation and ‘plastic’ for a plastic simulation. Anything else besides these options will cause the code to raise an error.

Parameters:mattype (str) – New material type (‘elastic’ or ‘plastic’)
Returns:None
set_stress(s)

Sets uniform intial stress

Changes initial uniform stress tensor. New stress tensor must be a list of six floats.

Note that 2D simulations do not use all stress components. Mode 2 elastic simulations only use sxx, sxy, and syy, and mode 3 elastic simulations use sxz, and syz (though the normal stresses sxx and syy can be set to constant values that are applied to any frictional failure criteria). Mode 2 plastic simulations use szz, and mode 3 plastic simulations use all three normal stress components in evaluating the yield criterion.

Params s:New stress tensor (list of 6 floats). Format is [sxx, sxy, sxz, syy, syz, szz]
Returns:None
write_input(f, probname, directory, endian='=')

Writes field information to input file

Method writes the current state of a domain to an input file, also writing any binary data to file (i.e. block boundary curves, heterogeneous stress tensors, heterogeneous material properties, heterogeneous interface tractions, heterogeneous state variables, or heterogeneous friction parameters).

Arguments include the input file f (file handle), problem name probname (string), output directory directory, and endianness of binary files ``endian. endian has a default value of = (native), other options inlcude < (little) and > (big).

Parameters:
  • f (file) – file handle for text input file
  • probname (str) – problem name (used for any binary files)
  • directory (str) – Location where input file should be written
  • endian – Byte-ordering for files. Should match byte ordering of the system where the simulation will be run (it helps to run the Python script directly with native byte ordering enabled). Default is native (=), other options include < for little endian and > for big endian.
Returns:

None