lululxvi / deepxde

A library for scientific machine learning and physics-informed learning
https://deepxde.readthedocs.io
GNU Lesser General Public License v2.1
2.67k stars 747 forks source link

Implementing nested PDEs in Deepxde #160

Closed DavidBraun97 closed 3 years ago

DavidBraun97 commented 3 years ago

Dear @lululxvi , Thanks for your remarkable work!! I am trying to solve the following inverse problem:

image

Using deepxde I would like to extract both the magnitude P and the location of load application a. In this case, the PDE is of the following type:

image

To my knowledge there is no straight forward way of implementing the dirac function in tensorflow. I initially thought about training two models (1 for the left and 1 for the right part of the beam, modelling the force as a BC) but this failed as the geometry in that case would be (0-a) for model1 and (a-1) for model2 which is not feasible given that a is an unknown parameter. That's why I thought about using some nested logic within the PDE. I propose sth. like the following:

a = tf.Variable(1.0) P= tf.Variable(1.0)

def ddy(x, y): return dde.grad.hessian(y, x) def dddy(x, y): return tf.gradients(ddy(x, y), x)[0]

@tf.function def pde(x, y): dy_xxxx = tf.gradients(dddy(x, y), x)[0] if (x==a) return dy_xxxx - P else return dy_xxxx

I've been trying to get sth. like this running but ran into many tf errors... Do you think such a nested PDE is a valid approach to this inverse problem?

Thanks so much for your continuous support and great feedback!!!

With best regards, David

lululxvi commented 3 years ago

Even in classical numerical methods, like finite difference, we cannot deal with delta function directly. Try to use a normal distribution with a small variance to approximate the delta function.

DavidBraun97 commented 3 years ago

thanks for your reply! Ill give that a try then. I was hoping there was some workaround ;)

happyzhouch commented 2 years ago

@DavidBraun97 Have you solved this problem? I also encountered this problem to incorporate the delta function in PINN. Could you share your experience about dealing with this problem?