Models
Module for defining the elastic model.
This module provides the ElasticModel class, which encapsulates the material properties and mechanical behavior of elastic materials.
It supports both homogeneous and heterogeneous material properties, as well as different 2D assumptions (plane stress, plane strain, anti-plane).
The class also provides methods for computing displacement gradients, strain tensors, stress tensors, and elastic energy.
ElasticModel
Class for defining an elastic material model in finite element simulations.
This class encapsulates the material properties and mechanical behavior of elastic materials. It supports both homogeneous and heterogeneous material properties, as well as different 2D assumptions (plane stress, plane strain, anti-plane). The class provides methods for computing displacement gradients, strain tensors, stress tensors, and elastic energy.
Attributes:
| Name | Type | Description |
|---|---|---|
E |
float or Function
|
Young's modulus. |
nu |
float or Function
|
Poisson's ratio. |
la |
float or Function
|
Lame coefficient lambda. |
mu |
float or Function
|
Lame coefficient mu. |
assumption |
str
|
2D assumption for the simulation (e.g., "plane_stress", "plane_strain", "anti_plane"). |
Ep |
float
|
Plane strain modulus. |
ka |
float
|
Kolosov constant. |
Source code in src/gcrack/models.py
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 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
__init__(pars, domain=None)
Initializes the ElasticModel.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pars
|
dict
|
Dictionary containing parameters of the material model. Required keys: "E" (Young's modulus), "nu" (Poisson's ratio), and "2D_assumption" (2D assumption). |
required |
domain
|
domain
|
Domain object, it is only used to initialize heterogeneous properties. Defaults to None. |
None
|
Source code in src/gcrack/models.py
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 | |
displays_warnings(pars)
Check the parameters and display warnings if necessary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pars
|
dict
|
Dictionary of the model parameters. |
required |
Source code in src/gcrack/models.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
elastic_energy(u, domain)
Computes the elastic energy.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
Function
|
FEM function of the displacement field. |
required |
domain
|
domain
|
The domain object representing the computational domain. |
required |
Returns:
| Type | Description |
|---|---|
|
ufl.classes.Expr: Elastic energy. |
Source code in src/gcrack/models.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
eps(u)
Computes the strain tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
Function
|
FEM function of the displacement field. |
required |
Returns:
| Type | Description |
|---|---|
Expr
|
ufl.classes.Expr: Strain tensor. |
Source code in src/gcrack/models.py
163 164 165 166 167 168 169 170 171 172 173 | |
grad_u(u)
Computes the gradient of the displacement field.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
Function
|
FEM function of the displacement field. |
required |
Returns:
| Type | Description |
|---|---|
Expr
|
ufl.classes.Expr: Gradient of the displacement field in 3D. |
Source code in src/gcrack/models.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 | |
sig(u)
Computes the stress tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
Function
|
FEM function of the displacement field. |
required |
Returns:
| Type | Description |
|---|---|
Expr
|
ufl.classes.Expr: Stress tensor. |
Source code in src/gcrack/models.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 | |
u_to_3D(u)
Converts a 2D displacement field to its 3D version.
The conversion depends on the 2D assumption (plane stress, plane strain, or anti-plane).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
u
|
Function
|
FEM function of the displacement field. |
required |
Returns:
| Type | Description |
|---|---|
Expr
|
ufl.classes.Expr: Displacement in 3D. |
Source code in src/gcrack/models.py
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |