ehsanhaghighat / sciann

Deep learning for Engineers - Physics Informed Deep Learning
htttp://sciann.com
Other
325 stars 116 forks source link

Nonlinear formula to define constrains? #62

Open alfonsogijon opened 2 years ago

alfonsogijon commented 2 years ago

Hi all, I would like to use SciANN to build a model learning from data and some constrains included in the loss function. I am following the example about the Navier-Stokes problem (https://github.com/sciann/sciann-applications/blob/master/SciANN-NavierStokes/SciANN-NavierStokes.ipynb).

In the Navier-Stokes problem, constrains are linear expressions defined as

c1 = sn.Tie(-p_x, u_t+lambda1*(u*u_x+v*u_y)-lambda2*(u_xx+u_yy))

c2 = sn.Tie(-p_y, v_t+lambda1*(u*v_x+v*v_y)-lambda2*(v_xx+v_yy))

In my case, I need to implement an exponential operation in the formula for the constrains, but when I try it with the np.exp() function or similar, I obtain messages like "MLPFunctional has no callable exp method".

Is there any way to include an exp function in the constraints? Thank you

alfonsogijon commented 2 years ago

I just used the exp function from sciann.utils.math and it works!