deepxde
deepxde copied to clipboard
Can deepxde be dimensionless?
Hi @lululxvi , In some special cases, the input and output need to be scaled to a certain range. Take the following example: def pde(x,y): c_star=4.0 r_star=20.0 t_star=30.0 yd = y/c_star rd = x[:,0]/r_star td = x[:,1]/t_star dy_t = dde.grad.jacobian(yd,td,i=0,j=0) dy_rr = dde.grad.hessian(yd,rd,i=0,j=0) return dy_rr-dy_t But there will be an error running, how to solve it?
FWIW, I never have division anywhere inside my PDE function. In the past it has resulted in nan values in my losses and just created a lot of numerical instability. Was it a hassle to reformulate everything in order to handle this? Yes, but it was the only thing to make the program run.
Let's use some mathematics to overcome this problem. For example, you can use the chain rule to compute dy'/dt' as followings:
- dy'/dt' = dy'/dy * dy/dt * dt / dt'
where - dy'/dy = 1/c_star because y' = y/c_start
- dt / dt' = t_star because t' = t/t_start
So the final code should be:
dy_prime_dt_prime = dde.grad.jacobian(y,t,i=0,j=0) * t_star/c_star