PhysicsInformedNN: sampling strategy for pde_loss evaluation on pre-defined could points

Hello all,

I am trying to solve an inverse problem with NeuralPDE as presented in the documentation here.

I am wondering if it was possible to define a sampling strategy to evaluate the pde_loss of the NeuralPDE.PhysicsInformedNN interface at the same points as the one used in the additional_loss?

(u_ , t_) = ground_truth_data

depvars = [:x,:y,:z]
function additional_loss(phi, θ , p)
    return sum(sum(abs2, phi[i](t_ , θ[depvars[i]]) .- u_[[i], :])/len for i in 1:1:3)

discretization = NeuralPDE.PhysicsInformedNN([chain1 , chain2, chain3],stratedy=NeuralPDE.GridTraining(dt), param_estim=true, additional_loss=additional_loss)

In other words, is it possible to evaluate the pde_loss only on the points where we have ground truth data?

Thanks in advance!

You cannot. But I’m curious why you would see that as necessary. For the PINN training process, you have one term for satisfying the PDE and one term for matching the trajectories. Since those terms are independent, they do not need to be done at the same points. In fact, you may generally want a denser sample of the PDE part than the data part “most” of the time since the first is about solving the PDE to sufficient accuracy and the second is about finding its parameters. Also, you generally want to sample the PDE term stochastically so that there are no “in-between” points that are missed due to overfitting a finite set.