spectralDNS / shenfun

High performance computational platform in Python for the spectral Galerkin method

Home Page:http://shenfun.readthedocs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to compute the integral about the nonlinear term in the Navier-Stokes equation?

liqihao2000 opened this issue · comments

commented

Dear Mikael,

How to compute the following integral

$$\int_\Omega (\bf{u}^0\cdot \nabla)\bf{u}^0 \cdot \bf{u}^0 ~dx ,$$
where the $\bf{u}^0$ is known which is the initial velocity vector in the Navier-Stokes equation. For example, I want compute the integral after the u_hat with following code in demo/NavierStokesPC.py:

    # Update (9.107)
    rhsU.fill(0)
    rhsU += inner(v, ut_hat) - inner(v, dt*grad(phi_hat))
    u_hat = Lu1.solve(rhsU, u=u_hat)

    # Update (9.105)
    rhsP.fill(0)
    rhsP += inner(q, phi_hat) + inner(q, p_hat) - inner(q, div(ut_hat))
    p_hat = Lu2.solve(rhsP, u=p_hat, constraints=((0, 0, 0),))

Hi
Sorry about the late reply. The integral you refer to is just a number since there are no test or trial functions. Is this what you want? You can compute the integral in physical space. If this is what you want, then compute the convection vector $\boldsymbol{N}$ in physical space and take the dot product with $\boldsymbol{u}^0$. Then integrate using inner(1, dot(N, u0)). The inner with test function 1 is a non-weighted integral over the domain that returns a number.

commented

Great, it works for me. Thanks very much.