NVIDIA / modulus-sym

Framework providing pythonic APIs, algorithms and utilities to be used with Modulus core to physics inform model training as well as higher level abstraction for domain experts
https://developer.nvidia.com/modulus
Apache License 2.0
147 stars 60 forks source link

A missed term in the navier_stokes equation #22

Closed zhangzhen117 closed 1 year ago

zhangzhen117 commented 1 year ago

Hi, there is a term missed in the Navier-Stokes equation, i.e. mux_j*u_jx_i for the i th momentum equation.

ns = NavierStokes(nu='nu', rho=1, dim=2, time=False) ns.pprint() the result should be: continuity: 1.0u__x + 1.0vy momentum_x: -1.0nuuxx - 1.0nuuyy + 1.0uux + 1.0vuy - 2.0nu__xux - 1.0*nuyu__y - 1.0nuy*vx + p__x momentum_y: -1.0nuvxx - 1.0nuvyy + 1.0uvx + 1.0vvy - 1.0*nuxu__y - 1.0nux*vx - 2.0nu__yvy + py instead of: continuity: ux + vy momentum_x: -nuuxx - nuuyy + uu__x + vuy - nuxux - nuyuy + px momentum_y: -nuvxx - nuvyy + uv__x + vvy - nuxvx - nuyvy + py

misawann commented 1 year ago

Taking an example of momentum_x, I think the following term is missing in the implementation, which is consistent of the above comment in the 2D case.

image The implementation might be changed like this;

self.equations["momentum_x"] = (
    (rho * u).diff(t)
    + (
    u * ((rho * u).diff(x))
    + v * ((rho * u).diff(y))
    + w * ((rho * u).diff(z))
    + rho * u * (curl)
    )
    + p.diff(x)
    - (-2 / 3 * mu * (curl)).diff(x)
    - (mu * u.diff(x)).diff(x)
    - (mu * u.diff(y)).diff(y)
    - (mu * u.diff(z)).diff(z)
    - (mu * (curl).diff(x))
    # missing terms
    - mu.diff(x) * u.diff(x)
    - mu.diff(y) * v.diff(x)
    - mu.diff(z) * w.diff(x)
)

I can open a pull request if I am correct.

zhangzhen117 commented 1 year ago

Yes, I think you are correct.

misawann commented 1 year ago

Thank you. I opened a PR.

ktangsali commented 1 year ago

Thanks for the issue report and the PR. The team is looking into it and will get back soon.