Improve hard constraint on Boundary Condition #4
Conversation
Exp: No hard-constraintI reduce high frequency to |
Exp: with BC enforcementy = g0 + (x-0)/(1-0)*(g1 - g0) + (1 - torch.exp(0-x)) * (1 - torch.exp(x-1)) * y # in domain x in [0, 1] |
QuestionWhy smaller PINN loss does not lead to accurate solution?compare to Does problem 1 actually have 1 solution?1D PDE problem: and homogeneous boundary conditions (BC) The analytical solution is
|
| y = g0 * (1 - x) + g1 * x + (1 - torch.exp(x)) * (1 - torch.exp(x-1)) * y | ||
| y = g0 * (1 - x) + g1 * x + x * (1 - x) * y | ||
| #y = g0 * (1 - x) + g1 * x + (1 - torch.exp(x)) * (1 - torch.exp(x-1)) * y | ||
| #y = g0 + (x-0)/(1-0)*(g1 - g0) + (1 - torch.exp(0-x)) * (1 - torch.exp(x-1)) * y # in domain x in [0, 1] |
There was a problem hiding this comment.
lines 260 and 261 seems to be the same math to me.
There was a problem hiding this comment.
The difference is (1-torch.exp(0-x)) keeps positive during the domain [0,1]
This is followed by the idea in page 5 of this paper:
https://arxiv.org/pdf/2102.04626
- We may need to remove #260
There was a problem hiding this comment.
OK. I see. A minor question: why you write things like exp(0-x) instead of exp(-x), and also (x-0)/(1-0). Are these necessary? Thanks
There was a problem hiding this comment.
No, it is just for understanding the boundary is
There was a problem hiding this comment.
No it is OK. Actually we should update the code use mesh.ax and mesh.bx, to allow intervals that are not [0,1]
There was a problem hiding this comment.
I added this as future feature #6 , and will be added after we figure out the bug of training in this PR.
Good question. I am not sure. @siuwuncheung ideas? Refer to: #5 |
* Improve hard constraint on Boundary Condition (#4) * Add Tony's toy code * Add missing file * Create note.tex * revise encforce bc equation and learning rate * fix bug: setting frequency * AD: retain graph * remove g0 g1 * enforce BC by linear * fix: use linear scale BC enforcement * remove retain_graph=True followed by https://docs.pytorch.org/docs/stable/generated/torch.autograd.grad.html --------- Co-authored-by: Siu Wun Cheung <cheung26@llnl.gov> * minor change * code cleanup --------- Co-authored-by: Steven Chiu <stchiu@email.tamu.edu> Co-authored-by: Siu Wun Cheung <cheung26@llnl.gov>





Reference:
Page 5, https://arxiv.org/pdf/2102.04626
Topic about bounday condition and multi-dnn is discussed in #7 (comment)