Optimization solvers
Module for solving the optimization problem to determine the load factor in crack propagation simulations.
This module provides the LoadFactorSolver class, which implements the GMERR (Generalized Maximum Energy Release Rate) criterion for crack propagation.
The solver is based on the work of Amestoy and Leblond (1992) and is designed to work with the gcrack.lefm module.
References
Amestoy, M., & Leblond, J. B. (1992). A new numerical method for crack growth prediction. International Journal of Solids and Structures, 29(21), 2619-2638. https://doi.org/10.1016/0020-7683(92)90210-K
LoadFactorSolver
Solver for load factors and crack propagation angles using the GMERR criterion.
This class implements the GMERR (Generalized Maximum Energy Release Rate) criterion for crack propagation. It uses automatic differentiation to compute gradients and Hessians of the objective function, and employs gradient descent with line search to find the optimal crack propagation angle and load factor.
Attributes:
| Name | Type | Description |
|---|---|---|
model |
ElasticModel
|
The elastic model used for the simulation. |
Gc |
Callable
|
The critical energy release rate function. |
grad |
Callable
|
The gradient of the objective function. |
hess |
Callable
|
The Hessian of the objective function. |
grad_pert |
Callable
|
The gradient of the perturbed objective function. |
hess_pert |
Callable
|
The Hessian of the perturbed objective function. |
Source code in src/gcrack/optimization_solvers.py
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 | |
__init__(model, Gc_func, xc)
Initializes the LoadFactorSolver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
ElasticModel
|
The elastic model used for the simulation. |
required |
Gc_func
|
Callable
|
The critical energy release rate function. |
required |
xc
|
List
|
Position of the crack tip. |
required |
Source code in src/gcrack/optimization_solvers.py
objective(x, Ep, s, KIc, KIIc, Tc, KIp, KIIp, Tp, phi0)
Computes the objective function for the GMERR criterion.
This function computes the objective function for the GMERR criterion, which is used to find the optimal crack propagation angle and load factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
The optimization variables (crack propagation angle). |
required |
Ep
|
float
|
Plane strain modulus. |
required |
s
|
float
|
Internal length associated with T-stress. |
required |
KIc
|
float
|
Mode I stress intensity factor for the controlled problem. |
required |
KIIc
|
float
|
Mode II stress intensity factor for the controlled problem. |
required |
Tc
|
float
|
T-stress for the controlled problem. |
required |
KIp
|
float
|
Mode I stress intensity factor for the prescribed problem. |
required |
KIIp
|
float
|
Mode II stress intensity factor for the prescribed problem. |
required |
Tp
|
float
|
T-stress for the prescribed problem. |
required |
phi0
|
float
|
Initial crack angle. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The value of the objective function. |
Source code in src/gcrack/optimization_solvers.py
objective_pert(x, Ep, s, KIc, KIIc, Tc, KIp, KIIp, Tp, phi0)
Computes the perturbed objective function for the GMERR criterion.
This function adds a small perturbation to the objective function to avoid convergence to a maximum instead of a minimum.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
x
|
ndarray
|
The optimization variables (crack propagation angle). |
required |
Ep
|
float
|
Plane strain modulus. |
required |
s
|
float
|
Internal length associated with T-stress. |
required |
KIc
|
float
|
Mode I stress intensity factor for the controlled problem. |
required |
KIIc
|
float
|
Mode II stress intensity factor for the controlled problem. |
required |
Tc
|
float
|
T-stress for the controlled problem. |
required |
KIp
|
float
|
Mode I stress intensity factor for the prescribed problem. |
required |
KIIp
|
float
|
Mode II stress intensity factor for the prescribed problem. |
required |
Tp
|
float
|
T-stress for the prescribed problem. |
required |
phi0
|
float
|
Initial crack angle. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The value of the perturbed objective function. |
Source code in src/gcrack/optimization_solvers.py
solve(phi0, SIFs_controlled, SIFs_prescribed, s)
Solves for the optimal crack propagation angle and load factor.
This function uses gradient descent with line search to find the optimal crack propagation angle and load factor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
phi0
|
float
|
Initial crack angle. |
required |
SIFs_controlled
|
dict
|
Stress intensity factors for the controlled problem. |
required |
SIFs_prescribed
|
dict
|
Stress intensity factors for the prescribed problem. |
required |
s
|
float
|
Internal length associated with T-stress. |
required |
Returns:
| Type | Description |
|---|---|
|
Tuple[float, float]: The optimal crack propagation angle and load factor. |
Source code in src/gcrack/optimization_solvers.py
find_local_min(phi0, grad_func, kwargs, tol=1e-10, max_expand=60)
Finds the local minimum reached by descending -grad(phi0).
- Walk downhill with geometrically growing steps until grad changes sign.
- Refine the sign-change bracket with brentq (robust to discontinuous grad: a jump from - to + across a kink is bracketed just like a smooth zero).