Description
Hi dear DeepXDE users,
I would like to modify the Iinverse problem for the Navier-Stokes equation of incompressible flow around cylinder (https://github.com/lululxvi/deepxde/blob/master/examples/pinn_inverse/Navier_Stokes_inverse.py) (https://github.com/lululxvi/deepxde/blob/master/examples/pinn_inverse/Navier_Stokes_inverse.py) by adding regularizations L1/L2 losses on the network parameters and the two unknown parameters (
My first attempt was to update the pde loss function as in #174
'''
Define Navier Stokes Equations (Time-dependent PDEs)
def Navier_Stokes_Equation(x, y):
u = y[:, 0:1]
v = y[:, 1:2]
p = y[:, 2:3]
du_x = dde.grad.jacobian(y, x, i=0, j=0)
du_y = dde.grad.jacobian(y, x, i=0, j=1)
du_t = dde.grad.jacobian(y, x, i=0, j=2)
dv_x = dde.grad.jacobian(y, x, i=1, j=0)
dv_y = dde.grad.jacobian(y, x, i=1, j=1)
dv_t = dde.grad.jacobian(y, x, i=1, j=2)
dp_x = dde.grad.jacobian(y, x, i=2, j=0)
dp_y = dde.grad.jacobian(y, x, i=2, j=1)
du_xx = dde.grad.hessian(y, x, component=0, i=0, j=0)
du_yy = dde.grad.hessian(y, x, component=0, i=1, j=1)
dv_xx = dde.grad.hessian(y, x, component=1, i=0, j=0)
dv_yy = dde.grad.hessian(y, x, component=1, i=1, j=1)
continuity = du_x + dv_y
x_momentum = du_t + C1 * (u * du_x + v * du_y) + dp_x - C2 * (du_xx + du_yy)
y_momentum = dv_t + C1 * (u * dv_x + v * dv_y) + dp_y - C2 * (dv_xx + dv_yy)
regularization_C1 = lambda_C1 * dde.backend.tf.keras.backend.sum(C1**2)
regularization_C2 = lambda_C2 * dde.backend.tf.keras.backend.sum(C2**2)
return [continuity, x_momentum, y_momentum, regularization_C1, regularization_C2]
'''
and got the same error
'''
ValueError: Index out of range using input dim 0;
'''
within model.complile().
In my case, I can't define the constraints using OperatorBC.
I would like to ask how can I implement the L1/L2 regularization terms for the two unknown variables?
Thank you for your time.