MATLAB Implementation of Physics Informed Deep Neural Networks for Forward and Inverse Structural Vibration Problems

In this work, we illustrate the implementation of physics informed neural networks (PINNs) for solving forward and inverse problems in structural vibration. Physics informed deep learning has lately proven to be a powerful tool for the solution and data-driven discovery of physical systems governed by differential equations. In spite of the popularity of PINNs, their application in structural vibrations is limited. This motivates the extension of the application of PINNs in yet another new domain and leverages from the available knowledge in the form of governing physical laws. On investigating the performance of conventional PINNs in vibrations, it is mostly found that it suffers from a very recently pointed out similar scaling or regularization issue, leading to inaccurate predictions. It is thereby demonstrated that a simple strategy of modifying the loss function helps to combat the situation and enhance the approximation accuracy signi ﬁ cantly without adding any extra computational cost. In addition to the above two contributing factors of this work, the implementation of the conventional and modi ﬁ ed PINNs is performed in the MATLAB environment owing to its recently developed rich deep learning library. Since all the developments of PINNs till date is Python based, this is expected to diversify the ﬁ eld and reach out to greater scienti ﬁ c audience who are more pro ﬁ cient in MATLAB but are interested to explore the prospect of deep learning in computational science and engineering. As a bonus, complete executable codes of all four representative (both forward and inverse) problems in structural vibrations have been provided along with their line-by-line lucid explanation and well-interpreted results for better understanding.


INTRODUCTION
Deep learning (DL) has recently emerged as an incredibly successful tool for solving ordinary differential equations (ODEs) and partial differential equations (PDEs).One of the major reasons for the popularity of DL as an alternative ODE/PDE solver which may be attributed to the exploitation of the recent developments in automatic differentiation (AD) [1] and high-performance computing open-source softwares such as TensorFlow [2], PyTorch [3] and Keras [4].This led to the development of a simple, general and potent class of forward ODE/PDE solvers and also novel data-driven methods for model inversion and identification, referred to as physics-informed machine learning or more specifically, physics-informed neural networks (PINNs) [5,6].Although PINNs have been applied to diverse range of problems in disciplines [7][8][9], not limited to fluid mechanics, computational biology, optics, geophysics, quantum mechanics, its application in structural vibrations has been observed to be limited and is gaining attention recently [10][11][12][13][14][15].
The architecture of PINNs can be customized to comply with any symmetries, invariance, or conservation principles originating from the governing physical laws modelled by time-dependant and nonlinear ODEs and PDEs.This feature make PINNs an ideal platform to incorporate this domain of knowledge in the form of soft constraints so that this prior information can act as a regularization mechanism to effectively explore and exploit the space of feasible solutions.Due to the above features and generalized framework of PINNs, they are expected to be as suitable in structural vibration problems as in any other applications of computational physics.Therefore, in this paper, we investigate the performance of conventional PINNs for solving forward and inverse problems in structural vibrations.Then, it is shown that with the modification of the loss function, the scaling or regularization issue which is an inherent drawback of first generation PINNs referred to as "gradient pathology" [16], significant improvement in approximation accuracy can be achieved.One important thing about the above strategy is that it does not require any additional training points to be generated and hence does not contribute to the computational cost.Moreover, since all of the implementation of PINNs is performed in Python, this work explores MATLAB environment for the first time.This is possible due to the new development of the DL library and AD built-in routines in MATLAB.The solution and identification of four representative structural vibration problems have been carried out using PINNs.We also provide complete executable MATLAB codes for all the examples and their line-by-line explanation for easy reproduction.This is expected to serve a large section of engineering community interested in the application of DL in structural mechanics or other fields and are more proficient and comfortable in MATLAB.Special emphasis has also been provided to present a generalized code so that all the recent improvements in PINNs architecture and its variants (otherwise coded in Python) can be easily reproduced using our present implementation.

FORMULATION OF PHYSICS-INFORMED NEURAL NETWORKS
One of the major challenges PINNs circumvent is the overdependence of data-centric deep neural networks (DNN) on training data.This is especially useful as sufficient information in the form of data is often not available for physical systems.The basic concept of PINNs is to evaluate hyperparameters of the DNN by making use of the governing physics and encoding this prior information within the architecture in the form of the ODE/PDE.As a result of the soft constraining, it ensures the conservation of the physical laws modelled by the governing equation, initial and boundary conditions and available measurements.
Considering the PDE for the solution u(t, x) parameterized by system parameters ξ defined in the domain Ω with the following initial (I ) and boundary conditions (B), respectively, as, here t and x represent the time and spatial coordinates, respectively and ∂Ω is the boundary of Ω.For solving the PDE via PINNs, the solution u(t, x) is approximated by constructing a neural network N u (t, x; θ) to yield û(t, x; θ) such that u(t, x) ≈ û(t, x; θ), where θ denotes a concise representation of all the trainable parameters.The trainable parameters (denoted as θ for tractability) consist of weight matrices and bias vectors.These matrices and vector components of a neural network are randomly initialized and are optimized by minimising the loss function during the training process.Hereafter, the training strategy of PINNs to be followed has been illustrated point-wise.
• A set of collocation points inside the domain (D F ) is generated using a suitable experimental design scheme.
Another set of points is to be generated individually on the boundary (D B ) and corresponding to the initial conditions (D I ).• The loss function that penalizes the PDE residual (L F ) is formulated based on the generated interior collocation points as, ∂x i ∂x j in Eq. 3 are computed using AD.
• The loss functions that ensure the satisfaction of the boundary (L B ) and initial conditions (L I ), respectively are defined as, • The composite loss function (L) is defined as the sum of the above individual loss terms, namely, the loss of the PDE residual (L F ), boundary (L B ) and initial conditions (L I ).
• The final goal is to compute the parameters (θ) by minimizing the loss function (L) in Eq. 6 as shown below and construct a DNN representation.
Usually, L(θ) is minimized using the stochastic gradient descent method.Once the PINNs model is constructed, it can be used to predict the system response û at unknown input ( t, x).
Despite immense success, the plain vanilla version of PINNs (as discussed above) has been often criticized for not performing well even for simple problems.This is due to the regularization of the composite loss term as defined in Eq. 6.In particular, the individual loss functions L F , L B and L I are of widely varying scales leading to gradient imbalances between the loss terms and eventually resulting in an inaccurate representation of the PDE solution.This issue has been recently analyzed in detail [16].Since manual tuning to vary the importance of each term can be tedious, numerous studies on multi-objective optimization have been undertaken which allow adaptive/automatic scaling of each term in the loss function, including the popular weighted sum approach.A scaling approach was proposed by Wang et al. [16] for PINNs based on balancing the distribution of gradients of each term in the loss function.Although their approach proved to be effective, it entails extra computational effort.
Alternatively, we employ a different approach to address the scaling issue and at the same time requires no extra computational effort.To avoid multiple terms in the composite loss function, the DNN output û is modified to ûmod so that the PDE residual, initial and/or, boundary conditions are satisfied simultaneously (û mod g(û, t, x)).The determination of mapping function g involves simple manipulation of the expression of DNN approximated solution which has been illustrated later in the numerical examples section.In presence of the modified neural network output ûmod , the new loss function (L new ) can be expressed as,  1 for further clarity.This depicts the encoding of the PDE physics in the form of soft constraints within the DNN as illustrated by the physics informed training block in the right side of the diagram.For generality, the flow diagram consists of both training strategies adopted for conventional (vanilla) and modified PINNs.Later, with the help of numerical examples, it is illustrated that the modified PINNs alleviates the scaling issue and leads to better approximation without generating any extra sampling points.As the physics will change from problem to problem depending on the ICs and BCs, the mapping function g will have to be determined separately for every problem.Once determined, it can be implemented with minimal effort and has been demonstrated in the next section.It is worth noting that no computations are performed on the actual system (i.e., any response/output data is not required) during the entire training phase of PINNs for capturing the forward solution and hence, is a simulation free ODE/PDE solver.
One useful feature of PINNs is that the same framework can be employed for solving inverse problems with a slight modification of the loss function.The necessary modification is discussed next.If the parameter ξ in Eq. 1 is not known, and instead D M set of measurements of response u* is available, then an additional loss term minimizing the discrepancy between the measurements and the neural network output can be defined as, This term L M determines the unknown parameters along with the solution.Thus, the combined loss term (L) is expressed as, Lastly, the parameters (θ, ξ) are computed by minimizing the loss function (L) in Eq. 10 as shown below.

MATLAB IMPLEMENTATION OF PINNS
In this section, the implementation of PINNs in MATLAB has been presented following its theoretical formulation discussed in the previous section.A step-wise explanatory approach has been adopted for better understanding of the readers and care has been taken to maintain the code as generalized as possible so that others can easily edit only the necessary portions of the code for their purpose.The complete code has been divided into several sub-parts and each of these are explained in detail separately for the solution of forward and inverse problems.

Input Data Generation
The first part is the input data generation.For the conventional PINNs, points have to be generated 1) in the interior of domain to satisfy the PDE residual, 2) on the boundary of domain to satisfy the boundary conditions, and 3) additional points to satisfy the initial conditions.However, in the modified approach, since the output is adapted so as to satisfy all of the conditions simultaneously, only the interior points are required to be generated.The part of the code generating the interior data points by Latin hypercube sampling has been illustrated in the following snippet.

Initialization of Network Parameters
Next, the fully connected deep neural net architecture is constructed according to the user-defined number of layers "numLayers" and number of neurons per layer "numNeurons."The trainable parameters (weights and biases) for every layer is initialized and stored in the fields of a structure array called "parameters."The instance of initializing the weights and biases of the first fully connected layer has been captured by the following snippet.Here, the network weights are initialized by the He initialization [17] implemented by the function "initializeHe."The He initializer samples the weights out of a normal distribution with zero mean and variance 2 Ni , where N i is the number of input channels.This function "initializeHe" takes in two input arguments, one is the size of trainable parameters "sz"and the other is "N i " and returns the sampled weights as a "dlarray" object.Note that "dlarray" is a built-in deep learning array in MATLAB employed for customizing the training process of DNNs.It enables numerous numerical operations including the computation of derivatives through AD.The network biases have been initialized by the zeros initialization implemented by the function "initializeZeros."As it is evident that the initialization schemes can be easily customized, other initializers like Glorot or Xavier, Gaussian, orthogonal and others can be readily employed depending on the model type and choice of the user.In fact, a wide variety of initialization schemes of trainable parameters for various type of DNNs can be found in the MATLAB documentation.1

Neural Network Training
At this stage, the network is to be trained with user-specified value of parameters like, number of epochs, initial learning, decay rate along with several other tuning options.It is worth noting that multiple facilities to allocate hardware resources are available in MATLAB for training the network in an optimal computational cost.This include using CPU, GPU, multi GPU, parallel (local or remote) and cloud computing.The steps performed during the model training within the nested loops of epoch and iteration in mini-batches have been illustrated in the following snippet.To recall, an epoch is the full pass of the training algorithm over the entire training set and an iteration is one step of the gradient descent algorithm towards minimizing the loss function using a mini-batch.As it can be observed from the snippet that three operations are involved during the model training.These are 1) evaluating the model gradients and loss using "dlfeval"2 by calling the function "modelGradients" (which is explained in the next snippet), 2) updating the learning rate with every iteration and epoch and 3) finally updating the network parameters during the backpropagation using adaptive moment estimation (ADAM) [18].In addition to ADAM, other stochastic gradient descent algorithms like, stochastic gradient descent with momentum (SGDM) and root mean square propagation (RMSProp) can be readily implemented via their built-in MATLAB routines.

Encoding the Physics in the Loss Function
The next snippet presents the function "modelGradients."This sub-routine is the distinctive feature of PINNs where the physics of the problem is encoded in the loss functions.As mentioned previously, in conventional PINNs, the system response is assumed to be a DNN such that U=modelU(parameters,dlX,dlY,dlT).A difference to the expression of U can be observed in this snippet where the DNN output is modified based on the ICs and BCs.As obvious, this modification will change from problem to problem.In this case, the expression is shown for illustration and is related to Eq. 33 of Example 4 defined in the next section.As the name "dlgradient" suggests, it is used to compute the derivatives via AD.After evaluating the gradients, the loss term enforcing the PDE residual is computed.
As the modified DNN output ensures the satisfaction of ICs and BCs, only the loss term corresponding to PDE residual is necessary.Instead, if conventional PINNs was used, separate loss terms originating from the ICs and BCs would have to be added to the residual loss.Finally, the gradients of the combined loss w.r.t. the network parameters are computed and passed as the function output.These gradients are further used during backpropagation.
As obvious, there will be another loss term involved while solving an inverse problem which minimizes the discrepancy between the model prediction and the measured data.The parameter to be identified is updated as another additional hyperparameter of the DNN along with the network weights and biases.This can be easily implemented by adding the following line: c_update = parameters.("fc"+ numLayers).opt_param; and evaluating the PDE residual as f1 = c_update*(Uxx + Uyy) -Utt in Example 4. In doing so, note that c in line 22 of the snippet will be replaced by c_update.

Fully Connect Operations
The "modelU" function has been illustrated in the next snippet.Here, the fully connected deep neural network (FC-DNN) model is constructed as per the dimensionality of input and network parameters.In particular, the fully connect operations are performed via "fullyconnect."This function uses the weighted sum to connect all the inputs to each output feature using the "weights," and adds a "bias."Sinusoidal activation function has been used here.The sub-routine returns the weighted output features as a dlarray "dlU" having the same underlying data type as the input "dlXYT." Once the PINNs model is trained, it can be used to predict on the test dataset.It is worth noting that the deep learning library of

NUMERICAL EXAMPLES Forced Vibration of an Undamped Spring-Mass System
The forced vibration of the spring-mass system can be expressed by where u, ü, ω n , f n , ω and t represent displacement, acceleration, natural frequency, forcing amplitude, forcing frequency and time, respectively.The initial conditions are u(t = 0) = 0 and ü (t = 0) = 0, where ü represents the velocity.The analytical solution to the above system is given by where, r = ω/ω n is the frequency ratio.
As mentioned previously, in the realm of the PINNs framework, solution space (of the ODE, for this case) can be approximated by DNN such that û N u (t, θ), where the residual of ODE is evaluated with the help of AD.Essentially, this is an optimization problem which can be expressed as, arg min where, • denotes ℓ 2 -norm.For the numerical illustration, it is assumed that ω 3, r 1.5 and f 0 1.The displacement u is approximated using a fully-connected neural network with 4 hidden layers and 20 neurons per layer.Sinusoidal activation function has been used due to the known periodic nature of the data [19].20,000 collocation points have been generated for time data t ∈ [0 4π] with the help of Latin hypercube sampling.The neural network is run for 1,000 epochs and the mini-batch size is 1,000.The initial learning rate is assumed to be 0.01 and the popular ADAM optimizer is employed.For testing the PINNs framework, 5,000 points were uniformly generated for time t ∈ [0 4π].The solution û obtained using the PINNs framework has been compared with the actual (analytical) solution u in Figure 2A.It can be observed from Figure 2A that the conventional PINNs framework is not capable of capturing the time response variation satisfactorily.As discussed in the previous sections, the reason is related to the regularization of the loss term in Eq. 14 and has been recently addressed in [16].Although their approach proved to be effective, it entails extra computational effort.
Therefore, an alternative approach has been employed in this work to address the scaling issue which requires no additional computational cost compared to that of conventional PINNs.For avoiding multiple terms in the loss function, a simple scheme for modifying the neural network output has been adopted so that the initial and/or, boundary conditions are satisfied.To automatically satisfy the initial conditions in the above problem, the output of the neural network û is modified as, Since the modified neural network output is ûmod , the new loss function can be expressed as, arg min Following this approach, significant improvement in approximation of the displacement response has been achieved as shown in Figure 2B.Next, the implementation of PINNs has been illustrated for an inverse setting.For doing so, the same problem as defined by Eq. 12 is re-formulated such that the displacement time history is given in the form of measurements and the natural frequency ω n has to be identified.The optimization problem can be expressed as, arg min where, u* represents the measured displacement data.15,000 collocation points have been generated for time data t ∈ [0 4π] with the help of Latin hypercube sampling.2,500 displacement data points were used for artificially simulating the measurement data and 5% uniform random noise was added.The architecture and the parameters of the neural network is the same as the previous case.The results have been presented in the form of convergence of the identified parameter ω in Figure 2C.The converged value of ω 3.0 demonstrates exact match with the actual value.It is worth mentioning that the PINNs framework is inherently adapted to also provide the solution to the ODE along with the identified parameter in the inverse setup.This demonstrates that the PINNs framework can be easily adapted for solving forward and inverse problems in structural vibration.

Forced Vibration of a Damped Spring-Mass System
The second example concerns a forced vibration of a damped spring-mass system and can be expressed by where u, _ u, ü, ω n , ζ, f 0 , ω and t represent displacement, velocity, acceleration, natural frequency, damping ratio, forcing amplitude, forcing frequency and time, respectively.The initial conditions are u(t = 0) = 0 and _ u(t = 0) = 0.The analytical solution to the above system can be found in [20].
As mentioned previously, in the realm of the PINNs framework, solution space (of the ODE, for this case) can be approximated by DNN such that û N u (t, θ), where the residual of ODE is evaluated with the help of AD.Essentially, this is an optimization problem which can be expressed as, arg min where, • denotes ℓ 2 -norm.For the numerical illustration, it is assumed that ω 3, ζ 0.025, r 1.5 and f 0 1.The displacement u is approximated using a fully-connected neural network with 4 hidden layers and 20 neurons per layer.Sinusoidal activation function has been used due to the known periodic nature of the data [19].The neural network is run for 1,000 epochs and the mini-batch size is 1,000.The initial learning rate is assumed to be 0.01 and the popular ADAM optimizer is employed.The solution û obtained using the PINNs framework has been compared with the actual (analytical) solution u in Figure 3A.20,000 collocation points have been generated for time data t ∈ [0 8π] with the help of Latin hypercube sampling to obtain the results in Figures 3A, B.
For testing the PINNs framework, 5,000 points were uniformly generated for time t ∈ [0 8π] to obtain the results in Figures 3A, B. It can be observed from Figure 3A that the conventional PINNs framework is not capable of capturing the time response variation satisfactorily.As discussed in the previous sections, the reason is related to the regularization of the loss term in Eq. 14.Therefore, to automatically satisfy the initial conditions, modified output of the neural network ûmod is the same as Eq. 15 as the initial conditions are identical to that of the first example.Therefore, the new loss function can be expressed as, arg min Following this approach, significant improvement in approximation of the displacement response has been achieved as shown in Figure 3B.The displacement response is presented over extended time in Figure 3C so as to investigate the performance of PINNs on the steady state response after the transients have died out.For generating the result in Figure 3C, 60,000 collocation points have been generated for the time data t ∈ [0 50] for training the network.For testing the PINNs framework, 40,000 points were uniformly generated for time t ∈ [0 50].The approximation by PINNs is found to be excellent in terms of capturing the response trends.
Next, the implementation of PINNs has been illustrated for an inverse setting.For doing so, the same problem as defined by Eq. 18 is re-formulated such that the displacement time history is given in the form of measurements and both natural frequency ω n and damping ratio ζ have to be identified simultaneously.The optimization problem can be expressed as, arg min

Free Vibration of a 2-DOF Discrete System
A 2-DOF lumped mass system as shown in Figure 5 is considered in this example [20].This example has been included to illustrate with initial conditions q(0) and _ q(0).In Eq. 22, q i , _ q i , € q i represent the displacement, velocity, acceleration of the i th DOF, respectively, m i and f i represent the mass of the i th DOF and force acting at the i th DOF, respectively, c j and k j are the damping and stiffness coefficient of the j th connecting element, respectively.For this 2-DOF system, i 1, 2 and j 1, 2, 3. Since the free vibration problem has been undertaken, the right hand side of Eq. 22 is zero.Two cases of the free vibration problem have been considered, undamped and damped.For each of these cases, both forward and inverse formulations have been presented.The analytical solution to the above governing ODE considering undamped and damped cases, respectively, can be determined as, q t ( ) where, constants d i and ϕ i have to be determined from the given initial conditions.n represents the number of DOFs, therefore n 2 for the above system.ω i and u i are the i th undamped natural frequency and mode shape vector, respectively, obtained from the modal analysis.In Eq. 24, ζ i and ω di represent the i th damping ratio and damped natural frequency, respectively.As opposed to the previous examples, in general, the response associated with each DOF has to be represented by an output node of (multi-output) FC-DNN.Since the above example is a 2-DOF system, the response of the two DOFs are represented by two output nodes of an FC-DNN in the realm of PINNs architecture such that q q1 q2 N q (t, θ).The optimization problem can be expressed as, arg min where, the gradients arising in Eq. 25 can be computed by AD.
The following parameter values are adopted, m 1 9, m 2 1, k 1 24, k 2 3, k 3 0, c 1 1, c 2 0.125, c 3 0.An FC-DNN with 4 hidden layers and 20 neurons per layer is used.Sinusoidal activation function has been used due to the known periodic nature of the data.The neural network is run for 1,000 epochs and the mini-batch size is 1,000.The initial learning rate is assumed to be 0.01 and the popular ADAM optimizer is employed.Collocation points have been generated for time data t ∈ [0 8π] with the help of Latin hypercube sampling to obtain the results in Figures 6-8.For testing the conventional PINNs framework, 10,000 points were uniformly generated for time t ∈ [0 8π] to obtain the results in Figure 6.The undamped and damped time response obtained using conventional PINNs framework have been compared with the actual (analytical) solution in Figure 6.It can be observed from Figure 6 that the conventional PINNs framework is capable of capturing the undamped and damped time response variation satisfactorily for two different ICs.The IC q 0 q 01 q 02 1 3 , _ q 0 0 is adopted so that the system vibrates with the first natural frequency only as shown in Figures 6A, C, whereas the IC q 0 q 01 q 02 1 0 , _ q 0 0 is a more general one resulting in a multi-frequency response as shown in Figures 6B, D. It is worth mentioning that the beat phenomenon exists in the free response of the above 2-DOF system due to close proximity of the two natural frequencies (ω 1 2 √ and ω 2 2).Next, PINNs has been implemented in an inverse setup for identification of system parameters both for the undamped and damped cases.For doing so, the same problem as defined by Eq. 22 is re-formulated such that the displacement time history data is available in the form of measurements and stiffness parameters (k 1 and k 2 ) for the undamped case and stiffness and damping parameters (k 1 , k 2 , c 1 and c 2 ) for the damped case, have to be identified simultaneously.The optimization problem for the undamped and damped case, respectively, can be expressed as, FIGURE 6 | Results of free vibration of the 2-DOF lumped mass system.(A) Undamped response for IC q 0 [ q 01 q 02 ] T [ 1 3] T , _ q 0 0. The predicted responses have been obtained using 60,000 collocation points.(B) Undamped response for IC q 0 [ q 01 q 02 ] T [ 1 0] T , _ q 0 0. The predicted responses have been obtained using 100,000 collocation points.(C) Damped response for IC q 0 [ q 01 q 02 ] T [ 1 3] T , _ q 0 0. The predicted responses have been obtained using 40,000 collocation points.(D) Damped response for IC q 0 [ q 01 q 02 ] T [ 1 0] T , _ q 0 0. The predicted responses have been obtained using 120,000 collocation points.
where, q* represents the measured displacement data.Collocation points have been generated for time data t ∈ [0 8π] with the help of Latin hypercube sampling.2,000 displacement data points were used for artificially simulating the measurement data and 1% uniform random noise was added.The architecture and the parameters of the neural network is the same as the forward formulation.The results have been presented in the form of convergence of identified system parameters in Figures 7, 8 for the undamped and damped case, respectively.The converged values of k 1 24.0031 and k 2 2.9995 have been obtained from Figure 7 for the undamped case.The converged values of k 1 24.0064, k 2 2.9995, c 1 1.0030 and c 2 0.1248 have been obtained from Figure 8 for the damped case.The converged values of identified system parameters demonstrate close match with the actual values k 1 24, k 2 3, c 1 1 and c 2 0.125.This demonstrates that the PINNs framework can be easily adapted for solving forward and inverse problems in multi-DOF systems.In addition to the adopted strategy to employ a single two-output FC-DNN to solve a 2-DOF system, two individual single output FC-DNNs were investigated.However, the latter failed to map the time response accurately due to the inability of two independent networks to adequately capture the dependencies of the coupled differential equations and hence, minimize the loss.

Free Vibration of a Rectangular Membrane
A rectangular membrane with unit dimensions excited by an initial displacement u sin πx sin πy has been considered in this example.The governing partial differential equation (PDE), initial and boundary conditions can be expressed as where, u is the displacement and c is the velocity of wave propagation.In Eqs 28-31, x, y represent the spatial coordinates, t represents time and Γ u denotes the spatial domain.The analytical solution to the governing PDE is u(x, y, t) sin πx sin πy cos 2 √ πt.Using the PINNs framework, solution of the PDE is approximated by a DNN such that û N u (x, y, t, θ), where residual of the PDE is evaluated with the help of AD.The optimization problem can be expressed as, arg min The displacement u is approximated using a fullyconnected neural network with 4 hidden layers and )] with the help of Latin hypercube sampling.The neural network is run for 1,000 epochs and the mini-batch size is 1,000.The initial learning rate is assumed to be 0.01 and the popular ADAM optimizer is employed.For testing the PINNs framework, 1,000 points were uniformly generated for x, y and t.The solution in space obtained using the PINNs framework û (Figure 9B) has been compared with the actual (analytical) solution u (Figure 9A) for four different time instants t 0.1, 0.15, 0.2 and 0.25.It can be observed from Figure 9B that the conventional PINNs framework is not capable of capturing the time response variation satisfactorily.The reason is once again related to the regularization of the loss term in Eq. 32.The different terms related to the residual, initial and boundary conditions in the loss function are not satisfied Since the modified neural network output is ûmod , the new optimization problem can be expressed as, arg min Following this modified PINNs approach, significant improvement in the spatial distribution of the displacement response has been achieved as shown in Figure 9C.Next, the implementation of PINNs has been illustrated in solving another inverse problem.For doing so, the same problem as defined by Eqs 28-31 is re-formulated such that the displacement time history is given in the form of measurements and the wave velocity c has to be identified.The optimization problem can be expressed as, arg min where, u* represents the measured displacement data.25,000 collocation points have been generated for spatial coordinates x, y ∈ [0 1] and time t ∈ [0 1/(2 2 √ )] with the help of Latin hypercube sampling.5,000 displacement data points were used for artificially simulating the measurement data and 2% uniform random noise was added.The architecture and the parameters of the neural network is the same as for the forward problem.The results have been presented in the form of convergence of the identified parameter c at the end of 10,000 epochs in Figure 9D.The converged value of c 0.9902 demonstrates good match with the actual value c 1.0.It is worth noting that the PINNs framework is inherently adapted to also provide the solution to the PDE along with the identified parameter in the inverse setup.This demonstrates that the PINNs framework can be easily adapted for solving forward and inverse problems in structural vibration.

SUMMARY AND CONCLUSION
This work presents the MATLAB implementation of PINNs for solving forward and inverse problems in structural vibrations.The contribution of the study lies in the following: 1.It is one of the very few applications of PINNs in structural vibrations till date and thus aims to fill-up the gap.This also makes the work timely in nature.

It demonstrates a critical drawback of the first generation
PINNs while solving vibration problems, which leads to inaccurate predictions.3. It mostly addresses the above drawback with the help of a simple modification in the PINNs framework without adding any extra computational cost.This results in significant improvement in the approximation accuracy.4. The implementation of conventional and modified PINNs is performed in MATLAB.As per the authors' knowledge, this is the first published PINNs code for structural vibrations carried out in MATLAB, which is expected to benefit a wide scientific audience interested in the application of deep learning in computational science and engineering.

Complete executable MATLAB codes of all the examples
undertaken have been provided along with their line-byline explanation so that the interested readers can readily implement these codes.
Four representative problems in structural vibrations, involving ODE and PDE have been solved including multi-DOF systems.Both forward and inverse problems have been addressed while solving each of the problems.The results in three examples involving single DOF systems clearly state that the conventional PINNs is incapable of approximating the response due to a regularization issue.The modified PINNs approach addresses the above issue and captures the solution of the ODE/PDE adequately.For the 2-DOF system, the conventional PINNs performs satisfactorily for the inference and identification formulations.It is recommended to employ n-output layer neural network to solve n-DOF system instead of employing n number of individual neural networks which fails to capture the dependencies of the coupled differential equations (physics).
Making the codes public is a humble and timely attempt for expanding the scientific contribution of deep learning in MATLAB, owing to its recently developed rich deep learning library.The research model can be based similar to that of authors adding their Python codes in public repositories like, GitHub.Since the topic is hot, it is expected to quickly populate with the latest developments and improvements, bringing the best to the research community.The authors can envision a huge prospect of their modest research of a recently developed and widely popular method in a new application field and its implementation in a new and more user-friendly software.
Our investigation of the proposed PINNs approach on complex structural dynamic problems, such as beams, plates, and nonlinear oscillators (e.g., cubic stiffness and Van der Pol oscillator), showed opportunities for improvement.To better capture the forward solution and identify unknown parameters in inverse problems, modifications to the proposed approach in this paper are needed.Based on our observation, the need for further systematic investigation has been identified.This aligns with the recent findings in [21].Future work should focus on automated weight tuning of fully connected neural networks (e.g., [16]), explore physics-informed neural ODEs [11] and symplectic geometry [22].

FIGURE 1 |
FIGURE 1 | A schematic flow diagram of physics informed neural networks (PINNs).In the figure, the abbreviations FC-DNN, PDE, AD, BCs and ICs represent fully connected deep neural network, partial differential equation, automatic differentiation, boundary conditions and initial conditions, respectively.All of the symbols used here to express the mathematical quantities are explained in Formulation of Physics-Informed Neural Networks section.

FIGURE 2 |
FIGURE 2 | Results of the forced spring-mass system (A) Forward solution without modifying the neural network output.(B) Forward solution after modifying the neural network output.(C) Inverse solution in the form of convergence of the identified parameter ω.

FIGURE 3 |
FIGURE 3 | Results of the damped forced spring-mass system (A) Forward solution without modifying the neural network output.(B) Forward solution after modifying the neural network output.(C) Forward solution over extended time after modifying the neural network output to observe the steady state response (after the transients have died out).

FIGURE 4 |
FIGURE 4 | Identification results for the damped forced spring-mass system (A) Convergence of the identified natural frequency.(B) Convergence of the identified damping ratio.

FIGURE 5 |
FIGURE 5 | A schematic representation of the 2-DOF lumped mass system.

FIGURE 7 |
FIGURE 7 | Identification results for the undamped 2-DOF system (A) Convergence of the identified stiffness parameter k 1 .(B) Convergence of the identified stiffness parameter k 2 .For obtaining these results, 45,000 collocation points and 2,000 data points with 1% random uniform noise were used to train the PINNs model.

FIGURE 8 |
FIGURE 8 | Identification results for the damped 2-DOF system (A) Convergence of the identified stiffness parameter k 1 , (B) Convergence of the identified stiffness parameter k 2 , (C) Convergence of the identified damping parameter c 1 , (D) Convergence of the identified damping parameter c 2 .For obtaining these results, 70,000 collocation points and 2000 data points with 1% random uniform noise were used to train the PINNs model.

FIGURE 9 |
FIGURE 9 | Results of free vibration of the rectangular membrane (A) True forward spatial solution, (B) Predicted forward spatial solution by conventional PINNs, (C) Predicted forward spatial solution by modified PINNs, (D) Inverse solution in the form of convergence of the identified parameter c.
∂ 2 ûmod ∂t 2 , ∂ 2 ûmod ∂x i ∂x j in Eq. 8 are computed using AD.Next, a flow diagram of the PINNs architecture is presented in Figure MATLAB is rich and consists of a diverse range of built-in functions, providing the users adequate choice and modelling freedom.In the next section, the performance of conventional and modified PINNs is accessed for solving four representative structural vibration problems, involving solution of ODE including multi-DOF systems, and PDE.In doing so, both forward and inverse problems have been addressed.