Open adolfocorreia opened 2 years ago
Use BC for this.
Thanks for the suggestion. My model is working now using BC!
However, if I may share my impressions on this workaround, it seems not ideal to me to conflate space and time dimensions in the same geometry structure. Besides, DeepXDE is still sampling from both t=0 and t=T and then filtering out t=0 points. As a side effect of this, the actual number of boundary train points being used is lower than the num_boundary
argument passed to the PDE class. To compensate for this I need to artificially increase the value of the argument by a factor of at least two.
I'm thinking about implementing my own TerminalCondition class and maybe I could share it with you later.
In any case, I think this issue could be closed if you don't have any more comments.
Yes, implementing a new TerminalCondition would be better.
Hello, I have the same problem with you. I consider that the initial condition is sampled from t = T, and IC cannot be used. Apply BC according to Dr. Lulu's method, but my initial condition has a Nan value during training. How do you use BC to sample the initial condition at t = T?
geom = dde.geometry.Interval(0, 10) timedomain = dde.geometry.TimeDomain(0, 1) geomtime = dde.geometry.GeometryXTime(geom, timedomain) 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],10) def boundary_t(x,on_boundary): return on_boundary and np.isclose(x[1],1)#Actually, this is my initial condition def func1(x): return K* np.exp(-r*(T-x[:,1:2])) def func2(x): return np.maximum(K-(x[:,0:1]),0)#Actually, this is my initial condition
bc_l = dde.DirichletBC(geomtime,func1, boundary_l) bc_r = dde.DirichletBC(geomtime,lambda x:0, boundary_r) bc_i = dde.DirichletBC(geomtime, func2, boundary_t)
![image](https://user-images.githubusercontent.com/103088959/167990592-bc46a631-6c5e-4e02-b45a-db4aa247c6ee.png)
Unfortunately, the Nan value appears in the bc_i column.I suspect it is due to the problem of definition, so I want to ask you how to solve this problem. I look forward to your reply. Thank you in advance!
The issue could be that there are no points sampled for t=T. You may sample some points manually and then pass them via anchors
as dde.data.TimePDE(..., anchors=)
When I applied pointseBC according to your method, the initial conditions finally worked. Thank you very much!
Any tips on using DeepXDE to solve PDEs with terminal time boundary conditions? Consider a PDE problem for a function u(x,t) defined on the time interval [0, T] with the terminal boundary condition u(x,T) = g(x). How should I model it with DeepXDE?
First I tried defining the TimeDomain object with inverted arguments
but I got an error because DeepXDE is internally computing this interval's diameter as a negative value (-T).
I also tried defining an
on_terminal
function such asand passing it to the IC object as in
but the TimePDE object still samples from the time boundary with t = 0. Any way to make it sample with t = T?
Maybe there should be a
dde.icbc.TC
class specific for such terminal condition problems.