Surface
- class Surface
A surface discontinuity representing either a fault or a cavity.
- Surface(model: Model, coordinates: Coordinates, indices: Indices)
The constructor
- Parameters:
model (Model) – The model for which this surface belongs to
coordinates (Coordinates) – the vertices coordinates as a flat array [x,y,z,x,y,z,…]
indices (Indices) – the triangle indices as a flat array [i,j,k, i,j,k,…]
# 4 vertices coordinates vertices = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0] # triangles indices triangles = [0,1,2, 0,2,3] surface = Surface(model, vertices, triangles)
- vertices() Coordinates
Get the vertices coordinates as a flat array.
- triangles() Indices
Get the triangle indices as a flat array.
- nbTriangles() int
Get the number of triangle making this surface
- nbVertices() int
Get the number of vertices making this surface
- Setup boundary conditions and others
- changeCoordinates(c: Coordinates) None
- setBC(axis: str, typeBc: str, value: float) None
Set the boundary conditions on this discontinuity using a constant value.
- Parameters:
axis (str) – the axis name (
normal,strikeordip)typeBc (str) – the type of boubdary condition. For traction boundary condition, possible names are
t,0,free,traction,neumannorunknown. For displacement boundary condition, possible names areb,1,displ,displacement,fixed,dirichlet,lockedorimposed.value (float) – the constant initial value
s = Surface(model, vertices, triangles) s.setBC("normal", "free", 0)
- setBC(axis: str, typeBc: str, fct: CoordinateFunctor) None
Set the boundary conditions on this discontinuity using a lambda function.
- Parameters:
axis (str) – the axis name (
normal,strikeordip)typeBc (str) – the type of boubdary condition. For traction boundary condition, possible names are
t,0,free,traction,neumannorunknown. For displacement boundary condition, possible names areb,1,displ,displacement,fixed,dirichlet,lockedorimposed.value (lambda) – the lambda function
rho = 1200 g = 9.81 s = Surface(model, vertices, triangles) s.setBC("normal", "free", lambda x,y,z: -rho*g*abs(z))
- setBCValues(v: float) None
Reset the boundary condition values as a constant value
- setBCValues(values: Vector) None
Set the boundary condition values
- setDisplFromVertices(displ: Vector) None
Set the displacement discontinuity at vertices (will interpolate at triangles)
- setDisplFromTriangles(displ: Vector) None
Set the displacement discontinuity at triangles
- addConstraint(ineq: Inequality) None
Add a new inequality constraint
- Output
- seismicMoment() float
Get the seismic moment for this surface
- burgers(bool local, bool atTriangles) Vector
Get the displacement discontinuity (Burger’s vectors) as a flat array
- Parameters:
local (bool) – If displacement discontinuities have to stay in triangle local coordinate system
atTriangles (bool) – If displacement discontinuities have to be interpolated at vertices or not
- burgersPlus(bool local, bool atTriangles, delta: float = 1e-7) Vector
Get the displacement discontinuity on the positive side as a flat array
- Parameters:
local (bool) – If displacement discontinuities have to stay in triangle local coordinate system
atTriangles (bool) – If displacement discontinuities have to be interpolated at vertices or not
delta (float) – The distance to the triangle in order to avoid singularities
- burgersMinus(bool local, bool atTriangles, delta: float = 1e-7) Vector
Get the displacement discontinuity on the negative side as a flat array
- Parameters:
local (bool) – If displacement discontinuities have to stay in triangle local coordinate system
atTriangles (bool) – If displacement discontinuities have to be interpolated at vertices or not
delta (float) – The distance to the triangle in order to avoid singularities
- residualTractions() Vector
Get the residual tractions if any (e.g., when frictio is used.
Usage
# 4 vertices coordinates vertices = [0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 0.0, 1.0, 0.0, 0.0] # triangles indices triangles = [0,1,2, 0,2,3] # Surface s is directly put into the model s = Surface(model, coordinates = vertices, indices = triangles)