PhysicsInformer not computing loss value

Dear experts,

I am trying to calculate the loss value of continuity equation using the loss function defined in modulus/examples/cfd/stokes_mgn/pi_fine_tuning.py at main · NVIDIA/modulus · GitHub, which is using PhysicsInformer from modulus.sym.eq.phy_informer. I intend to use this continuity loss as the loss function in my neural network model.

pi_fine_tuning.py is working as desired and calculated continuity loss with no problem. However, when I am testing it in a separate script (attached) the PhysicsInformer (grad_method = ‘autodiff’) always returns value zero no matter what input I give, while there was no error raised. Although the example in phy_inform.py works with no problem

I am using the latest version of modulus.sym, Python 3.10 and CUDA 11.7
test.txt (583 Bytes)

Many thanks