Could you please help me with the issue of poor training results for Pinn #1317
Unanswered
greenhand1e
asked this question in
Q&A
Replies: 1 comment 3 replies
-
|
See FAQ for some suggestions. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I have been using deepxde for training recently and the training effect has been poor, and this issue has been bothering me for a long time. Please help me analyze the reason.
My partial differential equation model is as follows:
5 * dy_tt + 50 * dy_xxxx=sin(3.1627766*t)
This is a simply supported beam model subjected to uniformly distributed harmonic loads.Where x belongs to [0,1] and t belongs to [0,5].I hope to predict the structural displacement within 5 seconds through pinn.
We know that for a simply supported beam, there are four boundary conditions and one initial condition, which are:
The displacement and bending moment at both ends of the beam are 0
x=0, y(0,t)=0, dy_xx(0,t)=0
x=1, y(1,t)=0, dy_xx(1,t)=0
At the initial moment, the displacement of all positions of the beam is 0
t=0, y(x,0)=0
Therefore, I wrote the following code using the pytorch environment and deepxde:
`
import deepxde as dde
import numpy as np
import torch
def ddxx(x, y):
return dde.grad.hessian(y, x, i=0, j=0)
def pde(x, y):
dy_tt = dde.grad.hessian(y, x, i=0, j=1)
dy_xx = dde.grad.hessian(y, x, i=0, j=0)
dy_xxxx = dde.grad.hessian(dy_xx, x, i=0, j=0)
return 5 * dy_tt + 50 * dy_xxxx-torch.sin(3.1627766 * x[:, 1:])
def boundary_l(x, on_boundary):
return on_boundary and np.isclose(x[0], 0)
def boundary_r(x, on_boundary):
return on_boundary and np.isclose(x[0], 1)
geom = dde.geometry.Interval(0, 1)
timedomain = dde.geometry.TimeDomain(0, 4.99)
geomtime = dde.geometry.GeometryXTime(geom, timedomain)
bc1 = dde.icbc.DirichletBC(geomtime, lambda x: 0, boundary_l)
bc2 = dde.icbc.DirichletBC(geomtime, lambda x: 0, boundary_r)
bc3 = dde.icbc.OperatorBC(geomtime, lambda x, y, _: ddxx(x, y), boundary_l)
bc4 = dde.icbc.OperatorBC(geomtime, lambda x, y, _: ddxx(x, y), boundary_r)
ic = dde.icbc.IC(geomtime, lambda x: 0, lambda _, on_initial: on_initial)
data = dde.data.TimePDE(
geomtime, pde, [bc1, bc2, bc3, bc4, ic], num_domain=2540, num_boundary=80, num_initial=160)
net = dde.nn.FNN([2] + [20] * 3 + [1], "tanh", "Glorot uniform")
model = dde.Model(data, net)
model.compile("adam", lr=0.001)
model.train(iterations=25000)
model.compile("L-BFGS")
losshistory, train_state = model.train()
dde.saveplot(losshistory, train_state, issave=True, isplot=True)`
In theory, the training result should be that the displacement on the three boundaries of x=0, x=1, and t=0 is 0, and a 3D image with alternating peaks and valleys appears at x=0.5 in the defined domain. (Stereoscopic images similar to sin (x))





However, the actual training results obtained are as follows:
(The positions circled in red on the graph are extreme points, and they all occur on the boundary instead of the intermediate position of x=0.5.)
The extreme value of displacement does not appear at x=0 within the defined domain, but on the boundaries of x=0 and x=1, and the displacement values of x=0 and x=1 at the same time are not 0 and equal, which does not meet the set boundary conditions. Only when the initial condition t=0, y=0 is satisfied.
Surprisingly, when I removed the bending moment boundary conditions bc3 and bc4 in the code, the extreme value of displacement appeared in the middle of the definition domain, which is consistent with expectations.
The red circle in the figure indicates the areas where peak and valley values occur. The boundary in the direction of the arrow should always be 0. Although the peak and valley values are relatively close to the ideal situation on this figure, the boundary conditions are still not met.
And I found that when I removed the bending moment condition, only iterations between 15000 and 25000 would result in the extreme values of displacement appearing within the defined domain, and not every training would result in such results. In multiple training sessions, the expected results would appear several times, and at other times, the results would still not meet the requirements.
Therefore, I would like your help with the following three questions:
The two boundaries of x=0 and x=1 cannot always satisfy the boundary condition of y=0. How can they be made to satisfy.
When there are two bending moment boundary conditions, the training results do not meet the expectations. Two bending moment boundary conditions were removed (it is unknown whether this approach is correct), and a result that meets the expectations but still does not meet the boundary conditions was obtained. May I ask how I can modify it to make the training results better and ensure that a good result is always obtained without occasional occurrences.
In the t-direction, the farther away from time 0, the greater the error in the training results. As shown in the figure, the closer t is to 5, the greater the dispersion of the training results.
Sincerely hope that you can give me some help, thank you!
Beta Was this translation helpful? Give feedback.
All reactions