You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run the example of "2d compressible isothermal flow equations" in weak formulation SINDy, I get a seriously inconsistent results with the document and the true equations even when there is no noise. Here is my result:
However, the derivative p' should not include v^-1, and the result in the document is similar to (p)' = -0.997 pv_2 + -0.999 vp_2 + -1.000 pu_1 + -0.998 up_1. According to the true equation, the real result should be similar to (p)' = -1.000 pv_2 + -1.000 vp_2 + -1.000 pu_1 + -1.000 up_1.
Here is my code, which is almost consistent with document, except the function_library is commented and the inputs library_functions and function_names are used when building weak_pde_lib( refer to #478 ). Besides, my python version is 3.8.10 and numpy version is 1.24.4.
At first, we ipmort necessary package and define the function used in solve_ivp.
importnumpyasnpfromscipy.integrateimportsolve_ivpimportpysindyasps# Seed the random number generators for reproducibilitynp.random.seed(100)
# integration keywords for solve_ivp, typically needed for chaotic systemsintegrator_keywords= {}
integrator_keywords["rtol"] =1e-12integrator_keywords["method"] ="LSODA"integrator_keywords["atol"] =1e-12defcompressible(t, U, dx, N, mu, RT):
u=U.reshape(N, N, 3)[:, :, 0]
v=U.reshape(N, N, 3)[:, :, 1]
rho=U.reshape(N, N, 3)[:, :, 2]
ux=ps.differentiation.FiniteDifference(
d=1,
axis=0,
periodic=True,
)._differentiate(u, dx)
uy=ps.differentiation.FiniteDifference(
d=1,
axis=1,
periodic=True,
)._differentiate(u, dx)
uxx=ps.differentiation.FiniteDifference(
d=2,
axis=0,
periodic=True,
)._differentiate(u, dx)
uyy=ps.differentiation.FiniteDifference(
d=2,
axis=1,
periodic=True,
)._differentiate(u, dx)
vx=ps.differentiation.FiniteDifference(
d=1,
axis=0,
periodic=True,
)._differentiate(v, dx)
vy=ps.differentiation.FiniteDifference(
d=1,
axis=1,
periodic=True,
)._differentiate(v, dx)
vxx=ps.differentiation.FiniteDifference(
d=2,
axis=0,
periodic=True,
)._differentiate(v, dx)
vyy=ps.differentiation.FiniteDifference(
d=2,
axis=1,
periodic=True,
)._differentiate(v, dx)
px=ps.differentiation.FiniteDifference(
d=1,
axis=0,
periodic=True,
)._differentiate(rho*RT, dx)
py=ps.differentiation.FiniteDifference(
d=1,
axis=1,
periodic=True,
)._differentiate(rho*RT, dx)
ret=np.zeros((N, N, 3))
ret[:, :, 0] =-(u*ux+v*uy) - (px-mu* (uxx+uyy)) /rhoret[:, :, 1] =-(u*vx+v*vy) - (py-mu* (vxx+vyy)) /rhoret[:, :, 2] =-(u*px/RT+v*py/RT+rho*ux+rho*vy)
returnret.reshape(3*N*N)
When I run the example of "2d compressible isothermal flow equations" in weak formulation SINDy, I get a seriously inconsistent results with the document and the true equations even when there is no noise. Here is my result:
However, the derivative
p'
should not includev^-1
, and the result in the document is similar to(p)' = -0.997 pv_2 + -0.999 vp_2 + -1.000 pu_1 + -0.998 up_1
. According to the true equation, the real result should be similar to(p)' = -1.000 pv_2 + -1.000 vp_2 + -1.000 pu_1 + -1.000 up_1
.Here is my code, which is almost consistent with document, except the
function_library
is commented and the inputslibrary_functions
andfunction_names
are used when buildingweak_pde_lib
( refer to #478 ). Besides, my python version is 3.8.10 and numpy version is 1.24.4.At first, we ipmort necessary package and define the function used in
solve_ivp
.Then generate the data and add noise。
Finally, run SINDy and weak SINDy, and print the results.
Thank you very much for reading my question, and if there is any important information not mentioned above, please let me know.
The text was updated successfully, but these errors were encountered: