NeuroDiffGym / neurodiffeq

A library for solving differential equations using neural networks based on PyTorch, used by multiple research groups around the world, including at Harvard IACS.
http://pypi.org/project/neurodiffeq/
MIT License
680 stars 89 forks source link

Special Type Boundary Condition #160

Closed udemirezen closed 2 years ago

udemirezen commented 2 years ago

Hi, Can we create a special type of boundary condition given below: Dg(s(t,1)) ~ ks*(sa-s(t,1)), Dg is the differentiation on r (spherical coordinates) Dg(f(t,r))/Dr. If yes, could you show it? Thank you

shuheng-liu commented 2 years ago

Hi @udemirezen , I'm not sure I understand the notation used here. Can you clarify a little bit more?

udemirezen commented 2 years ago

Hi @udemirezen , I'm not sure I understand the notation used here. Can you clarify a little bit more?

Sorry for unclear explanation. I mean:

4D18ED93-6B72-4278-9DAA-631ABA2E4082

these kind of boundary conditions. Here rl is lower value, ru is upper value rl =0 and ru=1 in this case.

udemirezen commented 2 years ago

Hi @udemirezen , I'm not sure I understand the notation used here. Can you clarify a little bit more?

Sorry for unclear explanation. I mean:

4D18ED93-6B72-4278-9DAA-631ABA2E4082

these kind of boundary conditions. Here rl is lower value, ru is upper value rl =0 and ru=1 in this case.

especially these Boundary conditions that i wanted to ask: DEC1C742-5D57-4B98-A9FA-90048CEAE6CF

Is This type of BVC possible to implement? Thank you

shuheng-liu commented 2 years ago

Hi, this looks like a Robin condition if I understand correctly. Currently, we don't have a stable implementation. However, I would recommend adding the boundary constraint to your loss function. You can override the additional_loss function of your solver. Check this documentation and this line of code for more. Note your new additional_loss(self, residual, funcs, coords) function must return a scalar (usually mean squared residual) that will be minimized.

Feel free to reach out if are not sure how to do that.