I am trying to solve the following 2-equation system (PDE) for U (output) and V (output) where x(1D space) and t(time)is the input. I have used DeepXDE but the model can’t decrease the loss but rather increases to NAN. The boundary condition for U is 1+0.01sin(2pifreqt) at x = 0. The initial condition (t = 0) for U is 1 and V is 0. Could you please kindly give me any suggestions on where should I look into? Thank you. I have attached the screenshot of the code.
import tensorflow as tf
import deepxde as dde
import numpy as np
import matplotlib.pyplot as plt
e = 1.6e-19
m = 0.73 * 9.1e-31
L = 50
T = 20e-12
count = 0
f = 1e12
geom = dde.geometry.Interval(-L/2, L/2)
timedomain = dde.geometry.TimeDomain(0, T)
geomtime = dde.geometry.GeometryXTime(geom, timedomain)
def boundary_source(X, on_boundary):
on_source = np.logical_and((np.isclose(X[0],-L/2,rtol=1e-05,atol=1e-08)),on_boundary)
return on_source
def initial_u(X, on_initial):
on_initial_u = np.logical_and((np.isclose(X[1],0,rtol=1e-15,atol=1e-18)),on_initial)
return on_initial_u
def initial_v(X, on_initial):
on_initial_v = np.logical_and((np.isclose(X[1],0,rtol=1e-15,atol=1e-18)),on_initial)
return on_initial_v
bc_source_u = dde.icbc.DirichletBC(geomtime, lambda X: 1 + 0.01 * np.sin(2 * np.pi * f * X[:, 1:2]), boundary_source, component= 0)
ic_source_u = dde.icbc.IC(geomtime, lambda X: 1, initial_u, component= 0)
ic_source_v = dde.icbc.IC(geomtime, lambda X: 0, initial_v, component= 1)
def pde(X,Y):
du_x =dde.grad.jacobian(Y, X, i=0, j=0)
du_t =dde.grad.jacobian(Y, X, i=0, j=1)
dv_x =dde.grad.jacobian(Y, X, i=1, j=0)
dv_t =dde.grad.jacobian(Y, X, i=1, j=1)
eq_eular = dv_t + Y[:,1:2]*dv_x + e/m * du_x
eq_cont = du_t + Y[:,1:2]*du_x + Y[:,0:1]*dv_x
return [eq_eular, eq_cont]
data = dde.data.TimePDE(geomtime,
pde,
[bc_source_u, ic_source_u, ic_source_v],
num_domain = 1000,
num_boundary= 100,
num_initial= 100,
num_test = 10)
net = dde.maps.FNN([2] + [30]*2 + [40]*2 + [40]*2 + [30]*2 + [2] , "tanh", "Glorot uniform")
model = dde.Model(data, net)
model.compile("adam",lr=1e-3)
losshistory, train_state = model.train(epochs = 10000)
Equation one
Equation two
Muhammad Mahmudul Hasan is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.