You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Uploading image.png…
Question
Although train loss = 10e-5 and test loss = 10e-5, the result (the second picture) is wrong)
Please tell me what should I do, thanks?
I wonder if DEEPXDE can solve this problem
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
model is as follows:
image
`import deepxde as dde
import matplotlib.pyplot as plt
from scipy.interpolate import griddata
import numpy as np
from deepxde.backend import torch
dde.config.set_random_seed(48)
dde.config.set_default_float('float64')
#parameter
h_thick=0.008
C=1
Pa=0
Ps=0.25
r_bearing = 30
r_hole = 0.1
#pde
def pde(x,y):
dp_xx = dde.grad.hessian(y, x, i=0, j=0)
dp_yy = dde.grad.hessian(y, x, i=1, j=1)
reynolds= dp_xx + dp_yy
return reynolds
#modeling
center=[0,0]
center1=[15,0]
center2=[0,15]
center3=[-15,0]
center4=[0,-15]
radius=r_bearing
radius_hole=r_hole
radius_points=1
inside_circle = dde.geometry.Disk(center, 10)
outer=dde.geometry.Disk(center, radius)
inner1=dde.geometry.Disk(center1, radius_hole)
innera= dde.geometry.Disk(center1, radius_points)
inner2=dde.geometry.Disk(center2, radius_hole)
innerb= dde.geometry.Disk(center2, radius_points)
inner3=dde.geometry.Disk(center3, radius_hole)
innerc= dde.geometry.Disk(center3, radius_points)
inner4=dde.geometry.Disk(center4, radius_hole)
innerd= dde.geometry.Disk(center4, radius_points)
def boundary(_, on_boundary):
return on_boundary
def boundary_outer(x, on_boundary):
return on_boundary and outer.on_boundary(x)
def boundary_inner1(x, on_boundary):
return on_boundary and inner1.on_boundary(x)
def boundary_inner2(x, on_boundary):
return on_boundary and inner2.on_boundary(x)
def boundary_inner3(x, on_boundary):
return on_boundary and inner3.on_boundary(x)
def boundary_inner4(x, on_boundary):
return on_boundary and inner4.on_boundary(x)
def funPs(x):
return Ps
def funPa(x):
return Pa
geom=outer - inner1 -inner2 - inner3 - inner4
outer_points = outer.uniform_boundary_points(2000)
inner1_points = inner1.random_boundary_points(0)
inner1_dom = inner1.uniform_points(12)
inner2_points = inner2.random_boundary_points(0)
inner2_dom = inner2.uniform_points(12)
inner3_points = inner3.random_boundary_points(0)
inner3_dom = inner3.uniform_points(12)
inner4_points = inner4.random_boundary_points(0)
inner4_dom = inner4.uniform_points(12)
innera_dom = innera.uniform_points(100)
innerb_dom = innerb.uniform_points(100)
innerc_dom = innerc.uniform_points(100)
innerd_dom = innerd.uniform_points(100)
points = np.append(inner1_points , inner1_dom , axis = 0)
points = np.append(points, inner2_points , axis=0)
points = np.append(points,inner2_dom , axis = 0)
points = np.append(points , inner3_points , axis = 0)
points = np.append(points,inner3_dom , axis = 0)
points = np.append(points , inner4_points , axis = 0)
points = np.append(points , inner4_dom , axis = 0)
points = np.append(points , innera_dom , axis = 0)
points = np.append(points , innerb_dom , axis = 0)
points = np.append(points , innerc_dom , axis = 0)
points = np.append(points , innerd_dom , axis = 0)
points = np.append(points , outer_points,axis = 0)
bc_in1 = dde.icbc.DirichletBC(inner1, funPs, boundary_inner1)
bc_in2 = dde.icbc.DirichletBC(inner2, funPs, boundary_inner2)
bc_in3 = dde.icbc.DirichletBC(inner3, funPs, boundary_inner3)
bc_in4 = dde.icbc.DirichletBC(inner4, funPs, boundary_inner4)
bc_out = dde.icbc.DirichletBC(outer, funPa, boundary_outer)
bcs= [bc_out, bc_in1, bc_in2, bc_in3, bc_in4]
data = dde.data.PDE(
geom,
pde,
bcs,
num_domain=5000,
num_boundary=200,
num_test=8000,
anchors= points
)
plt.figure(figsize = (32, 18))
plt.scatter(data.train_x_all[:,0], data.train_x_all[:,1], s = 0.3)
plt.axis('equal')
dde.config.set_default_float('float64')
layer_size = [2] +3* [50] + [1]
activation = 'tanh'
initializer = 'Glorot uniform'
net = dde.nn.FNN(layer_size, activation, initializer)
model = dde.Model(data, net)
loss_weights=[1, 1, 5, 5, 5, 5]
model.compile(
"adam",
lr=1e-3,
loss_weights=loss_weights
)
checkpointer=dde.callbacks.ModelCheckpoint(
"model/model", save_better_only=True, period=1000)
#model.compile("L-BFGS")
losshistory, train_state = model.train(iterations=5000,
display_every = 1000,
model_restore_path="model/model-4000.pt",
callbacks=[checkpointer]
)
dde.saveplot(losshistory, train_state, issave=True, isplot=True)`
Uploading image.png…
Question
Although train loss = 10e-5 and test loss = 10e-5, the result (the second picture) is wrong)
Please tell me what should I do, thanks?
I wonder if DEEPXDE can solve this problem
Beta Was this translation helpful? Give feedback.
All reactions