-
Notifications
You must be signed in to change notification settings - Fork 97
/
Copy pathViscousFriction.py
86 lines (71 loc) · 3 KB
/
ViscousFriction.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# =================================================================================================
# This code is part of PyLith, developed through the Computational Infrastructure
# for Geodynamics (https://github.com/geodynamics/pylith).
#
# Copyright (c) 2010-2025, University of California, Davis and the PyLith Development Team.
# All rights reserved.
#
# See https://mit-license.org/ and LICENSE.md and for license information.
# =================================================================================================
# @file pylith/friction/ViscousFriction.py
#
# @brief Python object implementing viscous friction.
#
# Factory: friction_model.
# ISA FrictionModel
from pylith.friction.FrictionModel import FrictionModel
# Import the SWIG module ViscousFriction object and rename it
# ModuleViscousFriction so that it doesn't clash with the local Python
# class of the same name.
from frictioncontrib import ViscousFriction as ModuleViscousFriction
# ViscousFriction class
class ViscousFriction(FrictionModel, ModuleViscousFriction):
"""
Python object implementing viscous friction.
Factory: friction_model.
"""
# PUBLIC METHODS /////////////////////////////////////////////////////
def __init__(self, name="viscousfriction"):
"""
Constructor.
"""
FrictionModel.__init__(self, name)
# Set the fields that are available for output. These are the
# stored physical properties and state variables. The friction
# model information is output with the fault information, so we
# can also output slip, slip rate and the fault tractions.
#
# There are no cell fields because the fault constitutive model
# operations on quantities evaluated at the fault vertices.
#
# Do not change the name of this variable. The output manager will
# request this variable by name.
self.availableFields = \
{'vertex':
{'info': ["static_coefficient",
"reference_slip_rate"],
'data': ["slip_rate"]},
'cell':
{'info': [],
'data': []}}
self._loggingPrefix = "FrVisc " # Prefix that appears in PETSc logging
return
# PRIVATE METHODS ////////////////////////////////////////////////////
def _createModuleObj(self):
"""
Call constructor for module object for access to C++ object. This
function is called automatically by the generic Python FrictionModel
object. It must have this name and self as the only argument.
"""
ModuleViscousFriction.__init__(self)
return
# FACTORIES ////////////////////////////////////////////////////////////
# This is the function that is called when you invoke
# friction = pylith.pylith.contrib.ViscousFfriction
# The name of this function MUST be 'friction_model'.
def friction_model():
"""
Factory associated with ViscousFriction.
"""
return ViscousFriction() # Return our object
# End of file