analysiscenter / pydens

PyDEns is a framework for solving Ordinary and Partial Differential Equations (ODEs & PDEs) using neural networks
Apache License 2.0
283 stars 65 forks source link

How to solve Elliptic PDE with four different boundary conditions? #30

Open dapratama opened 3 years ago

dapratama commented 3 years ago

Hi, @roman-kh @akoryagin @SergeyTsimfer @dpodvyaznikov

Firstly I want to thanks to you guys for making great library for solving PDE with NN. Now I'm going on project for solving PDE with NN too and interested to used your library and on practicing using it. But, I have an issue when try to solve Poisson eq with 4 different bc. For the example I practiced to solve this eq:

                              Uxx+Uyy = 4, 

with BC:

u(x, 0) = x^2,        u(x, 2) = (x-2)^2,          0<= x <=1
u(0, y) = y^2,        u(1, y) = (y-1)^2,          0<= y <=2

I can't find the correct solution to solving this PDE. I realized that there was a mistake when writing the code. But I can't find any correction in your documentation. Could you please help me how to write the correct code for this kind of PDE? Thank you very much.

pde = {
    'n_dims': 2, 
    'form': lambda u, x, y: D(D(u, x), x) + D(D(u, y), y) - 4,
    'boundary_condition': .........    <------- (how to write those BC mentioned above to here?)
}