How to ignore reference solution #1563
Unanswered
divyanshjnv1
asked this question in
Q&A
Replies: 1 comment 1 reply
-
|
Remove |
Beta Was this translation helpful? Give feedback.
1 reply
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.
-
i am replicating for euler beam code given in deepxde library.
It is mentioned that if i don't have reference solution then i can ignore it, but I'm not able to figure it out. When i comment out func (reference solution) it show error in 'data' block . if i remove 'solution = func' from data block also it shows error in this line
losshistory, train_state = model.train(iterations=10000)
(this issue is occurring for me in all the available codes)
reference code is this
"""Backend supported: tensorflow.compat.v1, tensorflow, pytorch, paddle"""
import deepxde as dde
import numpy as np
def ddy(x, y):
return dde.grad.hessian(y, x)
def dddy(x, y):
return dde.grad.jacobian(ddy(x, y), x)
def pde(x, y):
dy_xx = ddy(x, y)
dy_xxxx = dde.grad.hessian(dy_xx, x)
return dy_xxxx + 1
def boundary_l(x, on_boundary):
return on_boundary and dde.utils.isclose(x[0], 0)
def boundary_r(x, on_boundary):
return on_boundary and dde.utils.isclose(x[0], 1)
def func(x):
return -(x4) / 24 + x3 / 6 - x**2 / 4
geom = dde.geometry.Interval(0, 1)
bc1 = dde.icbc.DirichletBC(geom, lambda x: 0, boundary_l)
bc2 = dde.icbc.NeumannBC(geom, lambda x: 0, boundary_l)
bc3 = dde.icbc.OperatorBC(geom, lambda x, y, _: ddy(x, y), boundary_r)
bc4 = dde.icbc.OperatorBC(geom, lambda x, y, _: dddy(x, y), boundary_r)
data = dde.data.PDE(
geom,
pde,
[bc1, bc2, bc3, bc4],
num_domain=10,
num_boundary=2,
solution=func,
num_test=100,
)
layer_size = [1] + [20] * 3 + [1]
activation = "tanh"
initializer = "Glorot uniform"
net = dde.nn.FNN(layer_size, activation, initializer)
model = dde.Model(data, net)
model.compile("adam", lr=0.001, metrics=["l2 relative error"])
losshistory, train_state = model.train(iterations=10000)
dde.saveplot(losshistory, train_state, issave=True, isplot=True)
please resolve the issue.
thanks .
Beta Was this translation helpful? Give feedback.
All reactions