API Reference¶
Mechanics¶
SymbolicHandler
¶
A class that handles symbolic computations for Continuum Mechanics Hyperelastic Frameworks using SymPy.
Attributes:
| Name | Type | Description |
|---|---|---|
c_tensor |
Matrix
|
A 3x3 matrix of symbols. |
Source code in hyper_surrogate/mechanics/symbolic.py
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 | |
invariant3
property
¶
Compute the third invariant of the c_tensor.
Returns:
| Name | Type | Description |
|---|---|---|
Expr |
Expr
|
The third invariant of the c_tensor. |
isochoric_invariant1
property
¶
Compute the first isochoric invariant of the c_tensor.
Returns:
| Name | Type | Description |
|---|---|---|
Expr |
Expr
|
The first isochoric invariant of the c_tensor. |
isochoric_invariant2
property
¶
Compute the second isochoric invariant of the c_tensor. I2_bar = ½ * (I1^2 - trace(C^2)) * J^{-4/3}
Returns:
| Name | Type | Description |
|---|---|---|
Expr |
Expr
|
The second isochoric invariant of the c_tensor. |
c_symbols()
¶
Return the c_tensor flattened symbols.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[Symbol]
|
A list of c_tensor symbols. |
Source code in hyper_surrogate/mechanics/symbolic.py
49 50 51 52 53 54 55 56 | |
cauchy(sef, f)
¶
Compute the Cauchy stress tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sef
|
Expr
|
The strain energy function. |
required |
f
|
Matrix
|
The deformation gradient tensor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Matrix |
Matrix
|
The Cauchy stress tensor. |
Source code in hyper_surrogate/mechanics/symbolic.py
145 146 147 148 149 150 151 152 153 154 155 156 | |
cmat(pk2)
¶
Compute the cmat tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pk2
|
Matrix
|
The pk2 tensor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ImmutableDenseNDimArray |
ImmutableDenseNDimArray
|
The stiffness tensor (3x3x3x3) with minor symmetry. |
Source code in hyper_surrogate/mechanics/symbolic.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
evaluate_iterator(lambdified_tensor, numerical_c_tensors, *args, **kwargs)
¶
Evaluate a lambdified tensor with specific values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lambdified_tensor
|
function
|
A lambdified tensor function. |
required |
args
|
dict
|
Additional substitution lists of symbols. |
()
|
kwargs
|
dict
|
Additional keyword arguments. |
{}
|
Returns:
| Type | Description |
|---|---|
None
|
Generator[Any, None, None]: The evaluated tensor. |
Source code in hyper_surrogate/mechanics/symbolic.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 | |
f_symbols()
¶
Return the f_tensor flattened symbols.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[Symbol]
|
A list of f_tensor symbols. |
Source code in hyper_surrogate/mechanics/symbolic.py
31 32 33 34 35 36 37 38 | |
jr(sigma)
staticmethod
¶
Compute the Jaumann rate contribution for the spatial elasticity tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sigma
|
Matrix
|
The Cauchy stress tensor (2nd order tensor). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ImmutableDenseNDimArray |
ImmutableDenseNDimArray
|
The Jaumann rate contribution (4th order tensor). |
Source code in hyper_surrogate/mechanics/symbolic.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 | |
lambdify(symbolic_tensor, *args)
¶
Create a lambdified function from a symbolic tensor that can be used for numerical evaluation.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbolic_tensor
|
Expr or Matrix
|
The symbolic tensor to be lambdified. |
required |
args
|
dict
|
Additional substitution lists of symbols. |
()
|
Returns: function: A function that can be used to numerically evaluate the tensor with specific values.
Source code in hyper_surrogate/mechanics/symbolic.py
223 224 225 226 227 228 229 230 231 232 233 234 | |
pk2(sef)
¶
Compute the pk2 tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sef
|
Expr
|
The strain energy function. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Matrix |
Matrix
|
The pk2 tensor. |
Source code in hyper_surrogate/mechanics/symbolic.py
110 111 112 113 114 115 116 117 118 119 120 121 122 | |
pushforward_2nd_order(tensor2, f)
staticmethod
¶
Push forward a 2nd order tensor in material configuration.
args: tensor2: Any - The 2nd order tensor f: Any - The deformation gradient tensor
returns: Any - The pushforwarded 2nd order tensor
Source code in hyper_surrogate/mechanics/symbolic.py
323 324 325 326 327 328 329 330 331 332 333 334 335 | |
pushforward_4th_order(tensor4, f)
staticmethod
¶
Push forward a 4th order tensor in material configuration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor4
|
MutableDenseNDimArray
|
The 4th order tensor. |
required |
f
|
Matrix
|
The deformation gradient tensor (2nd order tensor). |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ImmutableDenseNDimArray |
ImmutableDenseNDimArray
|
The pushforwarded 4th order tensor. |
Source code in hyper_surrogate/mechanics/symbolic.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 | |
spatial_tangent(pk2, f)
¶
Compute the spatial tangent stiffness tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
pk2
|
Matrix
|
The pk2 tensor. |
required |
f
|
Matrix
|
The deformation gradient tensor. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
ImmutableDenseNDimArray |
ImmutableDenseNDimArray
|
The spatial tangent stiffness tensor. |
Source code in hyper_surrogate/mechanics/symbolic.py
158 159 160 161 162 163 164 165 166 167 168 169 | |
substitute(symbolic_tensor, numerical_c_tensor, *args)
¶
Automatically substitute numerical values from a given 3x3 numerical matrix into c_tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbolic_tensor
|
Matrix
|
A symbolic tensor to substitute numerical values into. |
required |
numerical_c_tensor
|
ndarray
|
A 3x3 numerical matrix to substitute into c_tensor. |
required |
args
|
dict
|
Additional substitution dictionaries. |
()
|
Returns:
| Name | Type | Description |
|---|---|---|
Matrix |
Matrix
|
The symbolic_tensor with numerical values substituted. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If numerical_tensor is not a 3x3 matrix. |
Source code in hyper_surrogate/mechanics/symbolic.py
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 | |
substitute_iterator(symbolic_tensor, numerical_c_tensors, *args)
¶
Automatically substitute numerical values from a given 3x3 numerical matrix into c_tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
symbolic_tensor
|
Matrix
|
A symbolic tensor to substitute numerical values into. |
required |
numerical_c_tensors
|
ndarray
|
N 3x3 numerical matrices to substitute into c_tensor. |
required |
args
|
dict
|
Additional substitution dictionaries. |
()
|
Returns:
| Type | Description |
|---|---|
None
|
Generator[Matrix, None, None]: The symbolic_tensor with numerical values substituted. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If numerical_tensor is not a 3x3 matrix. |
Source code in hyper_surrogate/mechanics/symbolic.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
to_voigt_2(tensor)
staticmethod
¶
Convert a 3x3 matrix to 6x1 matrix using Voigt notation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
Matrix
|
A 3x3 symmetric matrix. |
required |
Returns:
| Type | Description |
|---|---|
Matrix
|
sp.Matrix: A 6x1 matrix. |
Source code in hyper_surrogate/mechanics/symbolic.py
267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | |
to_voigt_4(tensor)
staticmethod
¶
Convert a 3x3x3x3 matrix to 6x6 matrix using Voigt notation
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
ImmutableDenseNDimArray
|
A 3x3x3x3 matrix. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Matrix |
Matrix
|
A 6x6 matrix. |
Source code in hyper_surrogate/mechanics/symbolic.py
291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | |
Kinematics
¶
A class that provides various kinematic methods.
Attributes:
| Name | Type | Description |
|---|---|---|
None |
This class does not have any attributes. |
Methods:
| Name | Description |
|---|---|
jacobian |
Compute the Jacobian of the deformation gradient. |
trace_invariant |
Calculate the first invariant (trace) of each tensor in the batch. |
quadratic_invariant |
Calculate the second invariant of the tensor. |
det_invariant |
Calculate the third invariant (determinant) of the tensor. |
isochoric_invariant1 |
Calculate the isochoric first invariant. |
isochoric_invariant2 |
Calculate the isochoric second invariant. |
right_cauchy_green |
Compute the right Cauchy-Green deformation tensor for a batch of deformation gradients. |
left_cauchy_green |
Compute the left Cauchy-Green deformation tensor for a batch of deformation gradients. |
rotation_tensor |
Compute the rotation tensors. |
pushforward |
Forward tensor configuration. |
principal_stretches |
Compute the principal stretches. |
principal_directions |
Compute the principal directions. |
Source code in hyper_surrogate/mechanics/kinematics.py
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 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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | |
det_invariant(c)
staticmethod
¶
Calculate the third invariant (determinant) of the tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ndarray
|
Tensor of shape (N, 3, 3). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The third invariant. |
Source code in hyper_surrogate/mechanics/kinematics.py
68 69 70 71 72 73 74 75 76 77 78 79 | |
fiber_invariant4(c, a0)
staticmethod
¶
Fiber invariant I4 = a0 . C . a0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ndarray
|
Right Cauchy-Green tensor (N, 3, 3). |
required |
a0
|
ndarray
|
Fiber direction (3,) or (N, 3). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
I4 values (N,). |
Source code in hyper_surrogate/mechanics/kinematics.py
201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 | |
fiber_invariant5(c, a0)
staticmethod
¶
Fiber invariant I5 = a0 . C^2 . a0.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ndarray
|
Right Cauchy-Green tensor (N, 3, 3). |
required |
a0
|
ndarray
|
Fiber direction (3,) or (N, 3). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
I5 values (N,). |
Source code in hyper_surrogate/mechanics/kinematics.py
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 | |
fiber_invariants_multi(c, fiber_directions)
staticmethod
¶
Compute I4, I5 for multiple fiber families.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ndarray
|
Right Cauchy-Green tensor (N, 3, 3). |
required |
fiber_directions
|
list[ndarray]
|
List of fiber direction vectors, each (3,). |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
Array of shape (N, 2*num_fibers) with columns [I4_1, I5_1, I4_2, I5_2, ...]. |
Source code in hyper_surrogate/mechanics/kinematics.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 | |
isochoric_invariant1(c)
staticmethod
¶
Isochoric first invariant: tr(C) * det(C)^(-⅓).
Source code in hyper_surrogate/mechanics/kinematics.py
81 82 83 84 | |
isochoric_invariant2(c)
staticmethod
¶
Isochoric second invariant: 0.5*(I1^2 - tr(C^2)) * det(C)^(-⅔).
Source code in hyper_surrogate/mechanics/kinematics.py
86 87 88 89 90 91 92 | |
jacobian(f)
staticmethod
¶
Compute the Jacobian of the deformation gradient.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
4D tensor of shape (N, 3, 3). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The Jacobian of the deformation gradient. |
Source code in hyper_surrogate/mechanics/kinematics.py
29 30 31 32 33 34 35 36 37 38 39 40 | |
left_cauchy_green(f)
staticmethod
¶
Compute the left Cauchy-Green deformation tensor for a batch of deformation gradients using a more efficient vectorized approach.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradient tensor with shape (N, 3, 3), where N is the number of deformation gradients. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The batch of left Cauchy-Green deformation tensors, shape (N, 3, 3). |
Source code in hyper_surrogate/mechanics/kinematics.py
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 | |
left_stretch_tensor(f)
¶
Compute the left stretch tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradient. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The left stretch tensor. |
Source code in hyper_surrogate/mechanics/kinematics.py
188 189 190 191 192 193 194 195 196 197 198 199 | |
principal_directions(f)
¶
Compute the principal directions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradient. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The principal directions. |
Source code in hyper_surrogate/mechanics/kinematics.py
163 164 165 166 167 168 169 170 171 172 173 | |
principal_stretches(f)
¶
Compute the principal stretches.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradient. |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
np.ndarray: The principal stretches. |
Source code in hyper_surrogate/mechanics/kinematics.py
151 152 153 154 155 156 157 158 159 160 161 | |
pushforward(f, tensor2D)
staticmethod
¶
Forward tensor configuration. Ftensor2DF^T. This is the forward transformation of a 2D tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
deformation gradient # (N, 3, 3) |
required |
tensor2D
|
ndarray
|
The 2D tensor to be mapped # (N, 3, 3) |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The transformed tensor. |
Source code in hyper_surrogate/mechanics/kinematics.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 | |
quadratic_invariant(c)
staticmethod
¶
Calculate the second invariant of the tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ndarray
|
Tensor of shape (N, 3, 3). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The second invariant. |
Source code in hyper_surrogate/mechanics/kinematics.py
55 56 57 58 59 60 61 62 63 64 65 66 | |
right_cauchy_green(f)
staticmethod
¶
Compute the right Cauchy-Green deformation tensor for a batch of deformation gradients using a more efficient vectorized approach. $\(C = F^T F\)$
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradient tensor with shape (N, 3, 3), where N is the number of deformation gradients. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The batch of right Cauchy-Green deformation tensors, shape (N, 3, 3). |
Source code in hyper_surrogate/mechanics/kinematics.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | |
right_stretch_tensor(f)
¶
Compute the right stretch tensor.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradient. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The right stretch tensor. |
Source code in hyper_surrogate/mechanics/kinematics.py
175 176 177 178 179 180 181 182 183 184 185 186 | |
rotation_tensor(f)
¶
Compute the rotation tensors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
f
|
ndarray
|
The deformation gradients. batched with shape (N, 3, 3). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
np.ndarray: The rotation tensors. batched with shape (N, 3, 3). |
Source code in hyper_surrogate/mechanics/kinematics.py
251 252 253 254 255 256 257 258 259 260 261 | |
trace_invariant(c)
staticmethod
¶
Calculate the first invariant (trace) of each tensor in the batch.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
c
|
ndarray
|
Tensor of shape (N, 3, 3). |
required |
Returns:
| Type | Description |
|---|---|
Any
|
The first invariant of each tensor in the batch. |
Source code in hyper_surrogate/mechanics/kinematics.py
42 43 44 45 46 47 48 49 50 51 52 53 | |
Demiray
¶
Bases: Material
Demiray exponential hyperelastic model.
W = (C1 / C2) * (exp(C2 * (I1_bar - 3)) - 1) + vol(J)
Source code in hyper_surrogate/mechanics/materials.py
451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 | |
Fung
¶
Bases: Material
Fung-type exponential model with configurable Q quadratic form.
W = (c / 2) * (exp(Q) - 1) + vol(J)
Q = sum_ij b_ij * E_ij * E_ij (Green-Lagrange strain components)
Default: isotropic Q = b1(E11^2 + E22^2 + E33^2) + b2(E12^2 + E13^2 + E23^2)
Source code in hyper_surrogate/mechanics/materials.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 | |
evaluate_energy(c_batch)
¶
Evaluate Fung energy via Green strain.
Source code in hyper_surrogate/mechanics/materials.py
760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 | |
evaluate_energy_grad_invariants(c_batch)
¶
Not available for Fung — uses C-component formulation, not invariants.
Source code in hyper_surrogate/mechanics/materials.py
802 803 804 805 | |
evaluate_energy_grad_voigt(c_batch)
¶
Numerical gradient dW/dC via finite differences on the 6 Voigt components of C.
Returns (N, 6) array. Not to be confused with invariant gradients.
Source code in hyper_surrogate/mechanics/materials.py
784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 | |
GasserOgdenHolzapfel
¶
Bases: Material
Gasser-Ogden-Holzapfel model with fiber dispersion (kappa).
W = (a/2b)(exp(b(I1_bar - 3)) - 1) + (af/2bf)(exp(bf * E_bar^2) - 1) + vol(J)
where E_bar = kappa(I1_bar - 3) + (1 - 3kappa)*(I4 - 1).
kappa in [0, ⅓]: kappa=0 recovers HolzapfelOgden, kappa=⅓ gives isotropic fiber.
Source code in hyper_surrogate/mechanics/materials.py
331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 | |
Guccione
¶
Bases: Material
Guccione transversely isotropic cardiac model.
W = (C / 2) * (exp(Q) - 1) + vol(J)
Q = bf * E_ff^2 + bt * (E_ss^2 + E_nn^2 + E_sn^2 + E_ns^2) + bfs * (E_fs^2 + E_sf^2 + E_fn^2 + E_nf^2)
where E = (C - I) / 2 is the Green-Lagrange strain in the fiber frame.
Source code in hyper_surrogate/mechanics/materials.py
592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 | |
evaluate_energy(c_batch)
¶
Evaluate Guccione energy via Green strain in fiber frame.
Source code in hyper_surrogate/mechanics/materials.py
658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 | |
evaluate_energy_grad_invariants(c_batch)
¶
Not available for Guccione — uses C-component formulation, not invariants.
Source code in hyper_surrogate/mechanics/materials.py
712 713 714 715 | |
evaluate_energy_grad_voigt(c_batch)
¶
Numerical gradient dW/dC via finite differences on the 6 Voigt components of C.
Returns (N, 6) array. Not to be confused with invariant gradients.
Source code in hyper_surrogate/mechanics/materials.py
694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | |
HolzapfelOgden
¶
Bases: Material
Holzapfel-Ogden transversely isotropic hyperelastic model.
W = (a/2b)(exp(b(I1_bar - 3)) - 1) + (af/2bf)(exp(bf*
where
Source code in hyper_surrogate/mechanics/materials.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | |
HolzapfelOgdenBiaxial
¶
Bases: Material
Two-fiber Holzapfel-Ogden model for arterial wall tissue.
W = (a/2b)(exp(b(I1_bar - 3)) - 1) + sum_{k=1}^{2} (af/2bf)(exp(bf*(I4_k - 1)^2) - 1) + vol(J)
Each fiber family contributes an I4 term; both share the same parameters.
Source code in hyper_surrogate/mechanics/materials.py
808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 | |
evaluate_energy(c_batch)
¶
Evaluate strain energy for (N,3,3) C tensors via invariants.
Source code in hyper_surrogate/mechanics/materials.py
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 | |
Material
¶
Base class for constitutive material models using composition.
Source code in hyper_surrogate/mechanics/materials.py
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 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 | |
fiber_direction
property
¶
First fiber direction (backward compat). None if isotropic.
fiber_directions
property
¶
All fiber directions. Empty list if isotropic.
input_dim
property
¶
Invariant input dimension: 3 (isotropic) + 2 per fiber family.
is_anisotropic
property
¶
Whether this material depends on fiber invariants (I4, I5).
num_fiber_families
property
¶
Number of fiber families.
cauchy_voigt(f)
¶
Voigt-reduced Cauchy stress (6x1) in symbolic form.
Source code in hyper_surrogate/mechanics/materials.py
194 195 196 197 | |
evaluate_cmat(c_batch)
¶
Vectorized CMAT evaluation over (N,3,3) C tensors.
Source code in hyper_surrogate/mechanics/materials.py
127 128 129 130 131 132 133 134 | |
evaluate_energy(c_batch)
¶
Evaluate strain energy for (N,3,3) C tensors. Returns (N,).
Source code in hyper_surrogate/mechanics/materials.py
179 180 181 182 183 184 185 186 187 188 189 190 | |
evaluate_energy_grad_invariants(c_batch)
¶
Compute dW/d(invariants) for (N,3,3) C tensors.
Returns (N, input_dim) where input_dim = 3 + 2*num_fiber_families.
Source code in hyper_surrogate/mechanics/materials.py
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 | |
evaluate_pk2(c_batch)
¶
Vectorized PK2 evaluation over (N,3,3) C tensors.
Source code in hyper_surrogate/mechanics/materials.py
118 119 120 121 122 123 124 125 | |
sef_from_all_invariants(i1_bar, i2_bar, j, fiber_invariants=None)
¶
Return SEF as a function of all invariant symbols including multi-fiber.
fiber_invariants is a list of (I4_k, I5_k) tuples, one per fiber family.
Default implementation delegates to :meth:sef_from_invariants for 0 or 1 fibers.
Override in multi-fiber subclasses.
Source code in hyper_surrogate/mechanics/materials.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | |
sef_from_invariants(i1_bar, i2_bar, j, i4=None, i5=None)
¶
Return SEF as a function of invariant symbols (I1_bar, I2_bar, J[, I4, I5]).
Override in subclasses to enable energy gradient computation w.r.t. invariants.
Source code in hyper_surrogate/mechanics/materials.py
67 68 69 70 71 72 73 74 75 76 77 78 79 | |
tangent_voigt(f, use_jaumann_rate=False)
¶
Voigt-reduced tangent (6x6) in symbolic form.
Source code in hyper_surrogate/mechanics/materials.py
199 200 201 202 203 204 205 | |
Ogden
¶
Bases: Material
Ogden hyperelastic model (N-term, principal stretch formulation).
W = sum_p (mu_p / alpha_p) * (lambda1^alpha_p + lambda2^alpha_p + lambda3^alpha_p - 3) + vol(J)
This model is expressed in principal stretches, not invariants. The sef_from_invariants method approximates via I1_bar and I2_bar using the relationship between invariants and symmetric functions of stretches.
Source code in hyper_surrogate/mechanics/materials.py
495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 | |
evaluate_energy(c_batch)
¶
Evaluate Ogden energy via eigenvalues of C.
Source code in hyper_surrogate/mechanics/materials.py
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 | |
evaluate_energy_grad_invariants(c_batch)
¶
Not available for Ogden — uses principal stretch formulation, not invariants.
Source code in hyper_surrogate/mechanics/materials.py
586 587 588 589 | |
evaluate_energy_grad_voigt(c_batch)
¶
Numerical gradient dW/dC via finite differences on the 6 Voigt components of C.
Returns (N, 6) array. Not to be confused with invariant gradients.
Source code in hyper_surrogate/mechanics/materials.py
568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 | |
Yeoh
¶
Bases: Material
Yeoh hyperelastic model (third-order reduced polynomial).
W = C10(I1_bar - 3) + C20(I1_bar - 3)^2 + C30*(I1_bar - 3)^3 + vol(J)
Source code in hyper_surrogate/mechanics/materials.py
399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 | |
Data¶
DeformationGenerator
¶
Generates physically valid deformation gradients for training data.
Source code in hyper_surrogate/data/deformation.py
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 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 | |
fiber_directions(n, preferred=None, dispersion=0.0)
¶
Generate fiber direction vectors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Number of samples. |
required |
preferred
|
ndarray | None
|
Preferred fiber direction (3,). Default: [1, 0, 0]. |
None
|
dispersion
|
float
|
Cone half-angle in radians. 0 = all aligned. |
0.0
|
Returns:
| Type | Description |
|---|---|
ndarray
|
Fiber directions (N, 3), unit vectors. |
Source code in hyper_surrogate/data/deformation.py
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 | |
MaterialDataset
¶
Bases: Dataset
Wraps (input, target) pairs for training.
Source code in hyper_surrogate/data/dataset.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | |
Normalizer
¶
Standard (zero-mean, unit-variance) normalization with export support.
Source code in hyper_surrogate/data/dataset.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | |
create_datasets(material, n_samples, input_type='invariants', target_type='pk2_voigt', val_fraction=0.15, seed=42)
¶
Generate data, normalize, split, and wrap in datasets.
Source code in hyper_surrogate/data/dataset.py
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 | |
Models¶
BranchInfo
dataclass
¶
Describes one branch of a multi-branch model (e.g. PolyconvexICNN).
Source code in hyper_surrogate/models/base.py
17 18 19 20 21 22 23 | |
SurrogateModel
¶
Bases: Module, ABC
Source code in hyper_surrogate/models/base.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
branch_sequence()
¶
Return branch info for multi-branch models. None for single-branch.
Source code in hyper_surrogate/models/base.py
38 39 40 | |
ICNN
¶
Bases: SurrogateModel
Input-Convex Neural Network (Amos+ 2017).
Guarantees convexity of output w.r.t. input via: - Non-negative weights on z-path (enforced via softplus) - Skip connections from input to every layer
Source code in hyper_surrogate/models/icnn.py
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 87 88 89 90 91 92 93 94 95 96 97 98 | |
Training¶
SparseLoss
¶
Bases: Module
Energy-stress loss with L1 regularization on model weights for CANN model discovery.
Encourages sparsity in CANN basis function weights, so surviving terms reveal the minimal constitutive law.
Source code in hyper_surrogate/training/losses.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | |
StressTangentLoss
¶
Bases: Module
Source code in hyper_surrogate/training/losses.py
13 14 15 16 17 18 19 20 21 22 23 | |
forward(pred, target)
¶
pred and target are both (N, 27): first 6 = stress, rest = tangent.
Source code in hyper_surrogate/training/losses.py
19 20 21 22 23 | |
Export¶
FortranEmitter
¶
Emits Fortran 90 code for neural network inference.
Source code in hyper_surrogate/export/fortran/emitter.py
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 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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
emit_polyconvex()
¶
Emit Fortran for PolyconvexICNN: per-branch forward + backward.
Source code in hyper_surrogate/export/fortran/emitter.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 | |
Hybrid UMAT generator: NN-based SEF with analytical continuum mechanics.
The NN learns W(invariants). Everything else — kinematics, stress, and tangent — is computed analytically in Fortran:
DFGRD1 → C → invariants → NN(W) → backprop(dW/dI, d²W/dI²)
→ PK2 → Cauchy stress → spatial tangent + Jaumann correction
Supports
- Isotropic: W(I1_bar, I2_bar, J) — input_dim=3
- Anisotropic: W(I1_bar, I2_bar, J, I4, I5) — input_dim=5
HybridUMATEmitter
¶
Emit a complete Abaqus UMAT subroutine with NN-based strain energy.
Source code in hyper_surrogate/export/fortran/hybrid.py
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 | |
emit()
¶
Generate the complete hybrid UMAT Fortran code.
Source code in hyper_surrogate/export/fortran/hybrid.py
620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 | |
write(path)
¶
Write the hybrid UMAT to a file.
Source code in hyper_surrogate/export/fortran/hybrid.py
988 989 990 | |
UMATHandler
¶
Source code in hyper_surrogate/export/fortran/analytical.py
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 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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
cauchy
property
¶
Generate the symbolic expression for the Cauchy stress tensor.
f
property
¶
The deformation gradient tensor.
sub_exp
property
¶
Substitution expressions for the right Cauchy-Green tensor.
tangent
property
¶
Generate the symbolic expression for the tangent matrix.
__init__(material_model)
¶
Initialize the UMAT handler with a specific material model.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
material_model
|
Material
|
The material model (e.g., NeoHooke) to generate UMAT code for. |
required |
Source code in hyper_surrogate/export/fortran/analytical.py
11 12 13 14 15 16 17 18 19 20 | |
code_as_string(code)
staticmethod
¶
Convert a list of code lines into a single string.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
code
|
list
|
The list of code lines. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
str |
str
|
The code as a single string. |
Source code in hyper_surrogate/export/fortran/analytical.py
136 137 138 139 140 141 142 143 144 145 146 147 | |
common_subexpressions(tensor, var_name)
staticmethod
¶
Perform common subexpression elimination on a vector or matrix and generate Fortran code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
var_name
|
str
|
The base name for the variables in the Fortran code. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
list[str]
|
A tuple containing Fortran code for auxiliary variables and reduced expressions. |
Source code in hyper_surrogate/export/fortran/analytical.py
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 | |
generate(filename)
¶
Generate the UMAT code for the material model and write it to a file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
str
|
The file path where the UMAT code will be written. |
required |
Source code in hyper_surrogate/export/fortran/analytical.py
88 89 90 91 92 93 94 95 96 97 98 99 100 101 | |
generate_props_code()
¶
Generate the Fortran code for material properties.
Returns:
| Name | Type | Description |
|---|---|---|
list |
list[str]
|
The Fortran code for material properties. |
Source code in hyper_surrogate/export/fortran/analytical.py
119 120 121 122 123 124 125 126 127 128 129 130 | |
write_umat_code(props_code_str, sigma_code_str, smat_code_str, filename)
¶
Write the generated Fortran code into a UMAT subroutine file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filename
|
Path
|
The file path where the UMAT code will be written. |
required |
Source code in hyper_surrogate/export/fortran/analytical.py
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
Reporting¶
Reporter
¶
Generate a PDF report with deformation diagnostics.
Accepts a batch of (N, 3, 3) tensors — either deformation gradients F or right Cauchy-Green tensors C — and produces histograms of key continuum-mechanics quantities (eigenvalues, determinants, invariants, principal stretches).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tensor
|
ndarray
|
Array of shape |
required |
tensor_type
|
str
|
|
'C'
|
Example::
from hyper_surrogate.reporting.reporter import Reporter
reporter = Reporter(C) # (N, 3, 3)
reporter.fig_eigenvalues()
reporter.fig_determinants()
reporter.fig_invariants()
reporter.fig_principal_stretches()
reporter.generate_report("report/")
Source code in hyper_surrogate/reporting/reporter.py
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 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
n_samples
property
¶
Number of samples in the batch.
basic_statistics()
¶
Per-quantity summary statistics.
Returns a dict keyed by quantity name, each containing
mean, std, min, max.
Source code in hyper_surrogate/reporting/reporter.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 | |
fig_determinants()
¶
Histogram of det(C).
Source code in hyper_surrogate/reporting/reporter.py
130 131 132 133 134 135 136 137 138 139 | |
fig_eigenvalues()
¶
Histogram of eigenvalues of C.
Source code in hyper_surrogate/reporting/reporter.py
116 117 118 119 120 121 122 123 124 125 126 127 128 | |
fig_invariants()
¶
Histograms of isochoric invariants I1_bar, I2_bar, and J.
Source code in hyper_surrogate/reporting/reporter.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | |
fig_principal_stretches()
¶
Histogram of principal stretches (sorted).
Source code in hyper_surrogate/reporting/reporter.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
fig_volume_change()
¶
Histogram of volume ratio J = sqrt(det(C)).
Source code in hyper_surrogate/reporting/reporter.py
177 178 179 180 181 182 183 184 185 186 187 188 | |
generate_figures()
¶
Generate all report figures.
Source code in hyper_surrogate/reporting/reporter.py
194 195 196 197 198 199 200 | |
generate_report(save_dir, layout='combined')
¶
Create a PDF report.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
save_dir
|
str | Path
|
Directory to write the report into (created if needed). |
required |
layout
|
str
|
|
'combined'
|
Source code in hyper_surrogate/reporting/reporter.py
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |