model.py
Here we define custom PyTorch classes used in our NN-EUCLID framework.
class convexLinear(torch.nn.Module):
Custom linear layer with enforced positive weights and no bias. The operation is done as follows:
- \(z = softplus(W)*x\)
where \(W\) contains size_in*size_out
trainable parameters.
Initialization arguments:
-
size_in
- Input dimension -
size_out
- Output dimension
Input arguments:
x
- input data
Output arguments:
z
- linear transformation of x
class ICNN(torch.nn.Module):
Material model based on Input convex neural network.
Initialization arguments:
n_input
- Input layer sizen_hidden
- List with number of neurons for each layern_output
- Output layer sizeuse_dropout
- Activate dropout during trainingdropout_rate
- Dropout probability.anisotropy_flag
- Possible arguments: {single
,double
} -> type of fiber familiesfiber_type
- Possible arguments: {mirror
,general
} -> type of fiber arrangement in case of two (or more) fiber families. In case ofmirror
the second fiber is set as: \(\alpha_2 = -\alpha_1\). In case ofgeneral
the second fiber is set as: \(\alpha_2 = \alpha_1+90°\).
Input arguments:
x
- Deformation gradient in the form:(F11,F12,F21,F22)
Output arguments:
W_NN
= NN-based strain energy density