## 3 ANN Flow Law Implementation in FE Software
### Implementation of the ANN Flow Law  
If we refer to the general flowchart of a finite element code as shown in Figure 6, integrating the flow law described by the ANN concerns the computation of the stress tensor \(\mathcal{O}_{1}\) at the end of an increment, in the yellow rectangle on the figure. Within the framework of a FE formulation in large deformations such as the one used in thermomechanical modeling of processes, this computation of the stress tensor \(\mathcal{O}_{1}\) is to be carried out on all the integration points of each element of the studied structure. Since the numerical model can include thousands of elements, themselves comprising between 1 and 8 integration points depending on the elements used, this stress computation must be as fast as possible in order not to increase the CPU time too much, but precise enough so that the results are under the physics of the process. This is even more important if we want to integrate this flow law in an explicit FE code, such as Abaqus/Explicit, for which one second of physical simulation corresponds to several million iterations of these stress computations. Thus, the complexity of the ANN, i.e., the number of computational steps that must be performed to compute the flow stress as a function of the input variables, is a major parameter in the choice of the neural network. As an example, for the model presented in Section 2.3, 180 internal variables, 15 neurons on the first hidden layer and 7 neurons on the second hidden layer were listed. Given the equations described in Sections 2.1 and 2.2, it will be necessary to compute 22 exponentials, to make matrix-vector products of size \(15\times 3\) and \(15\times 7\) plus many other numerical operations to compute the flow stress \(\sigma^{y}\) and the 3 derivatives of it with respect to \(\epsilon^{p}\), \(\dot{\epsilon}\) and \(T\). Implementing the ANN flow law identified above is realized here in a VUHARD subroutine, similarly as proposed by [PERSON] et al. [PERSON] et al. (2018), used by the Abaqus Explicit FE code in order to allow a user to program the computation of the flow stress \(\sigma^{y}\) and its 3 derivatives as a function of the model input data. This subroutine is used when calculating the stress tensor \(\mathcal{O}_{1}\) at the end of an increment from the stress tensor at the beginning of the increment \(\mathcal{O}_{0}\), the deformations, the material parameters and the history of the deformation at each finite element integration points, according to the stress integration algorithm based on the radial return method as described in [PERSON] et al. [PERSON] et al. (2018) for the general aspects, [PERSON] et al. [PERSON] et al. (2018) for Abaqus Explicit FE code, or [PERSON] et al. [PERSON] et al. (2018) for the DynELA FE code. Thus, without going into too much detail about the stress integration scheme used in finite element codes (the curious reader can refer to [PERSON] et al. (2018); [PERSON] et al. (2018); [PERSON] et al. (2018); [PERSON] et al. (2018) for details about this method), Figure 7 shows the location of the VUHARD subroutine used to compute the flow stress \(\sigma^{y}\) and its derivative \(\partial\sigma^{y}/\partial\Gamma\) used in the writing of the two quantities \(\gamma(\Gamma)\) and \(\gamma^{{}^{\prime}}(\Gamma)\) used in the Newton-Raphson solving procedure from the following relation:  
\[\frac{d\sigma^{y}}{d\Gamma}=\sqrt{\frac{2}{3}}\bigg{(}\frac{\partial\sigma^{ y}}{\partial\epsilon^{p}}+\frac{1}{\Delta t}\frac{\partial\sigma^{y}}{ \partial\epsilon^{p}}+\frac{\eta\sigma^{y}}{\rho C_{p}}\frac{\partial\sigma^ {y}}{\partial T}\bigg{)}\,, \tag{18}\]  
Figure 6: General flowchart of a FE code, focus on the stresses computation using an iterative solving procedure. where \(\Gamma\) is the consistency parameter used in the radial return algorithm as defined by [PERSON] et al.