Skip to content

Commit

Permalink
Deleted old implementation of contact mechanics.
Browse files Browse the repository at this point in the history
  • Loading branch information
keileg committed Jul 2, 2019
1 parent 1c9cffa commit bfe25d3
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 1,830 deletions.
3 changes: 1 addition & 2 deletions src/porepy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@
from porepy.numerics.interface_laws.elliptic_interface_laws import (
RobinCoupling,
FluxPressureContinuity,
RobinContact,
StressDisplacementContinuity,
)

from porepy.numerics.interface_laws.cell_dof_face_dof_map import CellDofFaceDofMap
from porepy.numerics.mixed_dim.assembler import Assembler

Expand Down
28 changes: 22 additions & 6 deletions src/porepy/numerics/fv/biot.py
Original file line number Diff line number Diff line change
Expand Up @@ -792,11 +792,29 @@ def compute_stress(self, g, u, data):
return stress


class GradP(
pp.numerics.interface_laws.elliptic_discretization.VectorEllipticDiscretization
):
class GradP():
""" Class for the pressure gradient term of the Biot equation.
"""

def __init__(self, keyword):
""" Set the discretization, with the keyword used for storing various
information associated with the discretization.
Paramemeters:
keyword (str): Identifier of all information used for this
discretization.
"""
self.keyword = keyword

def _key(self):
""" Get the keyword of this object, on a format friendly to access relevant
fields in the data dictionary
Returns:
String, on the form self.keyword + '_'.
"""
return self.keyword + "_"

def ndof(self, g):
""" Return the number of degrees of freedom associated to the method.
Expand Down Expand Up @@ -974,9 +992,7 @@ def enforce_neumann_int_bound(self, *_):
pass


class DivU(
pp.numerics.interface_laws.elliptic_discretization.VectorEllipticDiscretization
):
class DivU():
""" Class for the displacement divergence term of the Biot equation.
"""

Expand Down
26 changes: 23 additions & 3 deletions src/porepy/numerics/fv/mpsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,29 @@
logger = logging.getLogger(__name__)


class Mpsa(
pp.numerics.interface_laws.elliptic_discretization.VectorEllipticDiscretization
):
class Mpsa():


def __init__(self, keyword):
""" Set the discretization, with the keyword used for storing various
information associated with the discretization.
Paramemeters:
keyword (str): Identifier of all information used for this
discretization.
"""
self.keyword = keyword

def _key(self):
""" Get the keyword of this object, on a format friendly to access relevant
fields in the data dictionary
Returns:
String, on the form self.keyword + '_'.
"""
return self.keyword + "_"

def ndof(self, g):
"""
Return the number of degrees of freedom associated to the method.
Expand Down
293 changes: 0 additions & 293 deletions src/porepy/numerics/interface_laws/elliptic_discretization.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,296 +332,3 @@ def enforce_neumann_int_bound(
matrix (scipy.sparse.matrix): Discretization matrix to be modified.
"""
raise NotImplementedError("Method not implemented")


class VectorEllipticDiscretization:
""" Superclass for finite volume discretizations of the vector elliptic equation.
Should not be used by itself, instead use a subclass that implements an
actual discretization method. Known subclass is Mpsa.
"""

def __init__(self, keyword):
""" Set the discretization, with the keyword used for storing various
information associated with the discretization.
Paramemeters:
keyword (str): Identifier of all information used for this
discretization.
"""
self.keyword = keyword

def _key(self):
""" Get the keyword of this object, on a format friendly to access relevant
fields in the data dictionary
Returns:
String, on the form self.keyword + '_'.
"""
return self.keyword + "_"

def ndof(self, g):
""" Abstract method. Return the number of degrees of freedom associated to the
method.
Parameter:
g (grid): Computational grid
Returns:
int: the number of degrees of freedom.
"""
raise NotImplementedError("Method not implemented")

def extract_displacement(self, g, solution_array, d):
""" Abstract method. Extract the displacement part of a solution.
The implementation will depend on what the primary variables of the specific
implementation are.
Parameters:
g (grid): To which the solution array belongs.
solution_array (np.array): Solution for this grid obtained from
either a mono-dimensional or a mixed-dimensional problem.
d (dictionary): Data dictionary associated with the grid. Not used,
but included for consistency reasons.
Returns:
np.array (g.num_cells): Displacement solution vector.
Raises:
NotImplementedError if the method
"""
raise NotImplementedError("Method not implemented")

def extract_traction(self, g, solution_array, d):
""" Abstract method. Extract the traction part of a solution.
The implementation will depend on what the primary variables of the specific
implementation are.
Parameters:
g (grid): To which the solution array belongs.
solution_array (np.array): Solution for this grid obtained from
either a mono-dimensional or a mixed-dimensional problem. Will
correspond to the displacement solution.
d (dictionary): Data dictionary associated with the grid.
Returns:
np.array (g.num_faces): Traction vector.
"""
raise NotImplementedError()

# ------------------------------------------------------------------------------#

def assemble_matrix_rhs(self, g, data):
""" Return the matrix and right-hand side for a discretization of a second
order elliptic vector equation.
Parameters:
g : grid, or a subclass, with geometry fields computed.
data: dictionary to store the data. For details on necessary keywords,
see method discretize()
discretize (boolean, optional): default True. Whether to discetize prior to
matrix assembly. If False, data should already contain discretization.
Returns:
matrix: sparse csr (self.ndof, self.ndof) discretization matrix.
rhs: np.ndarray (self.ndof) Right-hand side which contains the boundary
conditions and the vector source term.
"""
raise NotImplementedError("Method not implemented")

def assemble_matrix(self, g, data):
"""Return the matrix for a discretization of a second order elliptic vector
equation.
Parameters:
g (Grid): Computational grid, with geometry fields computed.
data (dictionary): With data stored.
Returns:
scipy.sparse.csr_matrix: System matrix of this discretization. The
size of the matrix will depend on the specific discretization.
"""
raise NotImplementedError("Method not implemented")

# ------------------------------------------------------------------------------#

def assemble_rhs(self, g, data):
""" Return the right-hand side for a discretization of a second order elliptic
vector equation.
Also discretize the necessary operators if the data dictionary does not
contain a discretization of the boundary equation.
Parameters:
g (Grid): Computational grid, with geometry fields computed.
data (dictionary): With data stored.
Returns:
np.ndarray: Right hand side vector with representation of boundary
conditions. The size of the vector will depend on the discretization.
"""
raise NotImplementedError("Method not implemented")

def assemble_int_bound_stress(
self, g, data, data_edge, grid_swap, cc, matrix, rhs, self_ind
):
"""Assemble the contribution from an internal boundary, manifested as a
stress boundary condition.
The intended use is when the internal boundary is coupled to another
node in a mixed-dimensional method. Specific usage depends on the
interface condition between the nodes; this method will typically be
used to impose stress continuity on a higher-dimensional domain.
Implementations of this method will use an interplay between the grid
on the node and the mortar grid on the relevant edge.
Parameters:
g (Grid): Grid which the condition should be imposed on.
data (dictionary): Data dictionary for the node in the
mixed-dimensional grid.
data_edge (dictionary): Data dictionary for the edge in the
mixed-dimensional grid.
grid_swap (boolean): If True, the grid g is identified with the @
slave side of the mortar grid in data_adge.
cc (block matrix, 3x3): Block matrix for the coupling condition.
The first and second rows and columns are identified with the
master and slave side; the third belongs to the edge variable.
The discretization of the relevant term is done in-place in cc.
matrix (block matrix 3x3): Discretization matrix for the edge and
the two adjacent nodes.
rhs (block_array 3x1): Right hand side contribution for the edge and
the two adjacent nodes.
self_ind (int): Index in cc and matrix associated with this node.
Should be either 1 or 2.
"""
raise NotImplementedError("Method not implemented")

def assemble_int_bound_source(
self, g, data, data_edge, grid_swap, cc, matrix, rhs, self_ind
):
""" Abstract method. Assemble the contribution from an internal
boundary, manifested as a body force term.
The intended use is when the internal boundary is coupled to another
node in a mixed-dimensional method. Specific usage depends on the
interface condition between the nodes; this method will typically be
used to impose stress continuity on a lower-dimensional domain.
Implementations of this method will use an interplay between the grid on
the node and the mortar grid on the relevant edge.
Parameters:
g (Grid): Grid which the condition should be imposed on.
data (dictionary): Data dictionary for the node in the
mixed-dimensional grid.
data_edge (dictionary): Data dictionary for the edge in the
mixed-dimensional grid.
grid_swap (boolean): If True, the grid g is identified with the @
slave side of the mortar grid in data_adge.
cc (block matrix, 3x3): Block matrix for the coupling condition.
The first and second rows and columns are identified with the
master and slave side; the third belongs to the edge variable.
The discretization of the relevant term is done in-place in cc.
matrix (block matrix 3x3): Discretization matrix for the edge and
the two adjacent nodes.
rhs (block_array 3x1): Right hand side contribution for the edge and
the two adjacent nodes.
self_ind (int): Index in cc and matrix associated with this node.
Should be either 1 or 2.
"""
raise NotImplementedError("Method not implemented")

def assemble_int_bound_displacement_trace(
self, g, data, data_edge, grid_swap, cc, matrix, rhs, self_ind
):
""" Abstract method. Assemble the contribution from an internal
boundary, manifested as a condition on the boundary displacement.
The intended use is when the internal boundary is coupled to another
node in a mixed-dimensional method. Specific usage depends on the
interface condition between the nodes; this method will typically be
used to impose stress continuity on a higher-dimensional domain.
Implementations of this method will use an interplay between the grid on
the node and the mortar grid on the relevant edge.
Parameters:
g (Grid): Grid which the condition should be imposed on.
data (dictionary): Data dictionary for the node in the
mixed-dimensional grid.
data_edge (dictionary): Data dictionary for the edge in the
mixed-dimensional grid.
grid_swap (boolean): If True, the grid g is identified with the @
slave side of the mortar grid in data_adge.
cc (block matrix, 3x3): Block matrix for the coupling condition.
The first and second rows and columns are identified with the
master and slave side; the third belongs to the edge variable.
The discretization of the relevant term is done in-place in cc.
matrix (block matrix 3x3): Discretization matrix for the edge and
the two adjacent nodes.
rhs (block_array 3x1): Right hand side contribution for the edge and
the two adjacent nodes.
self_ind (int): Index in cc and matrix associated with this node.
Should be either 1 or 2.
"""
raise NotImplementedError("Method not implemented")

def assemble_int_bound_displacement_cell(
self, g, data, data_edge, grid_swap, cc, matrix, rhs, self_ind
):
""" Abstract method. Assemble the contribution from an internal
boundary, manifested as a condition on the cell displacement.
The intended use is when the internal boundary is coupled to another
node in a mixed-dimensional method. Specific usage depends on the
interface condition between the nodes; this method will typically be
used to impose stress continuity on a lower-dimensional domain.
Implementations of this method will use an interplay between the grid on
the node and the mortar grid on the relevant edge.
Parameters:
g (Grid): Grid which the condition should be imposed on.
data (dictionary): Data dictionary for the node in the
mixed-dimensional grid.
data_edge (dictionary): Data dictionary for the edge in the
mixed-dimensional grid.
grid_swap (boolean): If True, the grid g is identified with the @
slave side of the mortar grid in data_adge.
cc (block matrix, 3x3): Block matrix for the coupling condition.
The first and second rows and columns are identified with the
master and slave side; the third belongs to the edge variable.
The discretization of the relevant term is done in-place in cc.
matrix (block matrix 3x3): Discretization matrix for the edge and
the two adjacent nodes.
rhs (block_array 3x1): Right hand side contribution for the edge and
the two adjacent nodes.
self_ind (int): Index in cc and matrix associated with this node.
Should be either 1 or 2.
"""
raise NotImplementedError("Method not implemented")

def enforce_neumann_int_bound(
self, g_master, data_edge, matrix, swap_grid, self_ind
):
""" Enforce Neumann boundary conditions on a given system matrix.
The method is void for finite volume approaches, but is implemented
to be compatible with the general framework.
Parameters:
g (Grid): On which the equation is discretized
data (dictionary): Of data related to the discretization.
matrix (scipy.sparse.matrix): Discretization matrix to be modified.
"""
raise NotImplementedError("Method not implemented")
Loading

0 comments on commit bfe25d3

Please sign in to comment.