The interface
Class¶
The interface
class and its derived classes describe interfaces that link neighboring blocks
together. The code includes several types of interfaces: the standard interface
class is for
a locked interface where no relative slip is allowed between the neighboring blocks. Other
interface types allow for frictional slip following several possible constitutive friction laws. The other
types are derived from the main interface
class and thus inherit much of their functionality.
The interface
class will not usually be invoked directly. This is because interfaces are
created automatically based on the number of blocks in the simulation. When the user
changes the number of blocks in the simulation, locked interfaces are automatically created
between all neighboring blocks. To modify the type of interface, it is preferred to use the
set_iftype
method of a problem to ensure that only the correct interfaces remain in the simulation.
Other interface types include: friction
, which describes frictionless interfaces; paramfric
, which
is a generic class for interfaces with parameters describing their behavior; statefric
, which is
a generic class for friction laws with a state variable; slipweak
, which describes slip weakening
and kinematically forced rupture interfaces; and stz
, which describes friction laws governed by
Shear Transformation Zone Theory. As with basic interfaces, none of these will be invoked directly,
and paramfric
and statefric
only create template methods for the generic behavior of
the corresponding type of interfaces and thus are not used in setting up a problem.
-
class
fdfault.
interface
(ndim, index, direction, bm, bp)¶ Class representing a locked interface between blocks
This is the parent class of all other interfaces. The
interface
class describes locked interfaces, while other interfaces require additional information to describe how relative slip can occur between the blocks.Interfaces have the following attributes:
Variables: - ndim – Number of dimensions in problem (2 or 3)
- iftype – Type of interface (‘locked’ for all standard interfaces)
- index – index of interface (used for identification purposes only, order is irrelevant in simulation)
- bm – Indices of block in the “minus” direction (tuple of 3 integers)
- bp – Indices of block in the “plus” direction (tuple of 3 integers)
- direction – Normal direction in computational space (“x”, “y”, or “z”)
-
__init__
(ndim, index, direction, bm, bp)¶ Initializes an instance of the
interface
classCreate a new
interface
given an index, direction, and block coordinates.Parameters: - ndim (int) – Number of spatial dimensions (must be 2 or 3)
- index (int) – Interface index, used for bookkeeping purposes, must be nonnegative
- direction (str) – String indicating normal direction of interface in computational space,
must be
'x'
,'y'
, or'z'
, with'z'
only allowed for 3D problems) - bm (tuple) – Coordinates of block in minus direction (tuple of length 3 of integers)
- bp (tuple) – Coordinates of block in plus direction (tuple of length 3 or integers, must
differ from
bm
by 1 only along the given direction to ensure blocks are neighboring one another)
Returns: New instance of interface class
Return type:
-
add_load
(newload)¶ Adds a load to list of load perturbations
Method adds the load provided to the list of load perturbations. If the
newload
parameter is not a load perturbation, this will result in an error.Parameters: newload (load) – New load to be added to the interface (must have type load
)Returns: None
-
add_pert
(newpert)¶ Add new friction parameter perturbation to an interface
Method adds a frictional parameter perturbation to an interface.
newpert
must be a parameter perturbation of the correct kind for the given interface type (i.e. if the interface is of typeslipweak
, thennewpert
must have typeswparam
).Parameters: newpert (pert (more precisely, one of the derived classes of friction parameter perturbations)) – New perturbation to be added. Must have a type that matches the interface(s) in question. Returns: None
-
delete_load
(index=-1)¶ Deletes load at position index from the list of loads
Method deletes the load from the list of loads at position
index
. Default is most recently added load if an index is not provided.index
must be a valid index into the list of loads.Parameters: index (int) – Position within load list to remove (optional, default is -1) Returns: None
-
delete_loadfile
()¶ Deletes the loadfile for the interface.
Returns: None
-
delete_paramfile
()¶ Deletes friction parameter file for the interface
Removes the friction parameter file for the interface. The interface must be a frictional interface that can accept parameter files.
Returns: None
-
delete_pert
(index=-1)¶ Deletes frictional parameter perturbation from interface
index
is an integer that indicates the position within the list of perturbations. Default is most recently added (-1).Parameters: index (int) – Index within perturbation list of the given interface to remove. Default is last item (-1, or most recently added) Returns: None
-
get_bm
()¶ Returns block on negative side
Returns tuple of block indices on negative size
Returns: Block indices on negative side (tuple of integers) Return type: tuple
-
get_bp
()¶ Returns block on positive side
Returns tuple of block indices on positive size
Returns: Block indices on positive side (tuple of integers) Return type: tuple
-
get_direction
()¶ Returns interface orientation
Returns orientation (string indicating normal direction in computational space).
Returns: Interface orientation in computational space (‘x’, ‘y’, or ‘z’) Return type: str
-
get_index
()¶ Returns index
Returns the numerical index corresponding to the interface in question. Note that this is just for bookkeeping purposes, the interfaces may be arranged in any order as long as no index is repeated. The code will automatically handle the indices, so this is typically not modified in any way.
Returns: Interface index Return type: int
-
get_load
(index=None)¶ Returns load at position index
Returns a load from the list of load perturbations at position
index
. If no index is provided (orNone
is given), the method returns entire list.index
must be a valid list index given the number of loads.Parameters: index (int or None) – Index within load list (optional, default is None
to return full list)Returns: load or list
-
get_loadfile
()¶ Returns loadfile for interface
Loadfile sets any surface tractions set for the interface. Note that these tractions are added to any any set by the constant initial stress tensor, initial heterogeneous stress, or interface traction perturbations
Returns: Current loadfile for the interface (if the interface does not have a loadfile, returns None) Return type: loadfile or None
-
get_nloads
()¶ Returns number of load perturbations on the interface
Method returns the number of load perturbations presently in the list of loads.
Returns: Number of load perturbations Return type: int
-
get_nperts
()¶ Returns number of friction parameter perturbations on interface
Method returns the number of parameter perturbations for the list
Returns: Number of parameter perturbations Return type: int
-
get_paramfile
()¶ Returns paramfile (holds arrays of heterogeneous friction parameters) for interface. Can return a subtype of paramfile corresponding to any of the specific friction law types.
Returns: paramfile
-
get_pert
(index=None)¶ Returns perturbation at position index
Method returns a perturbation from the interface.
index
is the index into the perturbation list for the particular index. Ifindex
is not provided or isNone
, the method returns the entire list.Parameters: index (int or None) – Index into the perturbation list for the index in question (optional, if not provided or None
, then returns entire list)Returns: pert or list
-
get_type
()¶ Returns string of interface type
Returns the type of the given interface (“locked”, “frictionless”, “slipweak”, or “stz”)
Returns: Interface type Return type: str
-
set_index
(index)¶ Sets interface index
Changes value of interface index. New index must be a nonnegative integer
Parameters: index (int) – New value of index (nonnegative integer) Returns: None
-
set_loadfile
(newloadfile)¶ Sets loadfile for interface
newloadfile
is the new loadfile (must have typeloadfile
). If the index is bad or the loadfile type is not correct, the code will raise an error. Errors can also result if the shape of the loadfile does not match with the interface.Parameters: newloadfile (loadfile) – New loadfile to be used for the given interface Returns: None
-
set_paramfile
(newparamfile)¶ Sets paramfile for the interface
Method sets the file holding frictional parameters for the interface.
newparamfile
must be a parameter perturbation file of the correct type for the given interface type (i.e. if the interface is of typeslipweak
, thennewpert
must have typeswparamfile
). Errors can also result if the shape of the paramfile does not match with the interface.Parameters: newparamfile (paramfile (actual type must be the appropriate subclass for the friction law of the particular interface and have the right shape)) – New frictional parameter file (type depends on interface in question) Returns: None
-
write_input
(f, probname, directory, endian='=')¶ Writes interface details to input file
This routine is called for every interface when writing problem data to file. It writes the appropriate section for the interface in the input file. It also writes any necessary binary files holding interface loads, parameters, or state variables.
Parameters: - f (file) – File handle for input file
- probname (str) – problem name (used for naming binary files)
- directory (str) – Directory for output
- endian (str) – Byte ordering for binary files (
'<'
little endian,'>'
big endian,'='
native, default is native)
Returns: None