Output Derivatives in Inverse Problem!!!! #967
-
Dear Lu Lu Firstly, thanks alot for bringing in this open source library and it works great..... Secondly,I am trying to solve inverse problem involving simple Fick's First Law of Diffusion wherein I wish to get the values of derivatives at each training point in post processing so that I can verify my simulation and from one of the examples I implemented it as But upon running I am getting an output as many Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The problem here is that np.savetxt. Check here https://stackoverflow.com/questions/51218937/saving-a-3d-numpy-array-to-txt-file. def get_derivatives(x,M):
dM1_x = dde.grad.jacobian(M,x,i=0,j=0)
dM2_x = dde.grad.jacobian(M,x,i=1,j=0)
return dM1_x,dM2_x
f=model.predict(observe_x,operator = get_derivatives)
res_stacked = np.hstack((observe_x.reshape(-1,1),f[0].reshape(-1,1),f[1].reshape(-1,1)))
np.savetxt("Derivatives.dat",res_stacked) |
Beta Was this translation helpful? Give feedback.
The problem here is that np.savetxt. Check here https://stackoverflow.com/questions/51218937/saving-a-3d-numpy-array-to-txt-file.
I think this should work