svMultiPhysics
Loading...
Searching...
No Matches
ArtificialNeuralNetMaterial.h
1// SPDX-FileCopyrightText: Copyright (c) Stanford University, The Regents of the University of California, and others.
2// SPDX-License-Identifier: BSD-3-Clause
3
4/* This material model implementation is based on the following paper:
5Peirlinck, M., Hurtado, J.A., Rausch, M.K. et al. A universal material model subroutine
6for soft matter systems. Engineering with Computers 41, 905–927 (2025).
7https://doi.org/10.1007/s00366-024-02031-w */
8
9#ifndef ArtificialNeuralNet_model_H
10#define ArtificialNeuralNet_model_H
11
12#include "mat_fun.h"
13#include "utils.h"
14#include "Parameters.h"
15#include <vector>
16#include "eigen3/Eigen/Core"
17#include "eigen3/Eigen/Dense"
18#include "eigen3/unsupported/Eigen/CXX11/Tensor"
19
20using namespace mat_fun;
21
22// Class for parameter table for material models discovered by constitutive artificial neural network (CANN)
23
24/* This material model implementation is based on the following paper:
25Peirlinck, M., Hurtado, J.A., Rausch, M.K. et al. A universal material model subroutine
26for soft matter systems. Engineering with Computers 41, 905–927 (2025).
27https://doi.org/10.1007/s00366-024-02031-w */
28
30{
31 public:
32
33 // Invariant indices
34 Vector<int> invariant_indices;
35
36 // Activation functions
37 Array<int> activation_functions;
38
39 // Weights
40 Array<double> weights;
41
42 // Number of rows in parameter table
43 int num_rows;
44
45 // Outputs from each layer
46 void uCANN_h0(const double x, const int kf, double &f, double &df, double &ddf) const;
47 void uCANN_h1(const double x, const int kf, const double W, double &f, double &df, double &ddf) const;
48 void uCANN_h2(const double x, const int kf, const double W, double &f, double &df, double &ddf) const;
49
50 // Strain energy and derivatives
51 void uCANN(const double xInv, const int kInv,
52 const int kf0, const int kf1, const int kf2,
53 const double W0, const double W1, const double W2,
54 double &psi, double (&dpsi)[9], double (&ddpsi)[9]) const;
55
56
57 void evaluate(const double aInv[9], double &psi, double (&dpsi)[9], double (&ddpsi)[9]) const;
58
59 // Helper for compute_pk2cc
60 template<size_t nsd>
61 void computeInvariantsAndDerivatives(
62 const Matrix<nsd>& C, const Matrix<nsd>& fl, int nfd, double J2d, double J4d, const Matrix<nsd>& Ci,
63 const Matrix<nsd>& Idm, const double Tfa, Matrix<nsd>& N1, double& psi, double (&Inv)[9], std::array<Matrix<nsd>,9>& dInv,
64 std::array<Tensor<nsd>,9>& ddInv) const;
65
66};
67
68#endif // ArtificialNeuralNet_model_H
Definition ArtificialNeuralNetMaterial.h:30
void uCANN_h1(const double x, const int kf, const double W, double &f, double &df, double &ddf) const
1st layer output of CANN for activation func kf, input x, weight W
Definition ArtificialNeuralNetMaterial.cpp:41
void uCANN(const double xInv, const int kInv, const int kf0, const int kf1, const int kf2, const double W0, const double W1, const double W2, double &psi, double(&dpsi)[9], double(&ddpsi)[9]) const
Updates psi and its derivatives.
Definition ArtificialNeuralNetMaterial.cpp:71
void uCANN_h0(const double x, const int kf, double &f, double &df, double &ddf) const
0th layer output of CANN for activation func kf, input x
Definition ArtificialNeuralNetMaterial.cpp:17
void evaluate(const double aInv[9], double &psi, double(&dpsi)[9], double(&ddpsi)[9]) const
function to build psi and dpsidI1 to 9
Definition ArtificialNeuralNetMaterial.cpp:90
void uCANN_h2(const double x, const int kf, const double W, double &f, double &df, double &ddf) const
2nd layer output of CANN for activation func kf, input x, weight W
Definition ArtificialNeuralNetMaterial.cpp:54
The Vector template class is used for storing int and double data.
Definition Vector.h:23
The classes defined here duplicate the data structures in the Fortran MATFUN module defined in MATFUN...
Definition mat_fun.cpp:14