# Algorithm to solve 2D incompressible Navier-Stokes isn't working

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 LinkBack Thread Tools Search this Thread Display Modes September 11, 2018, 18:52 Algorithm to solve 2D incompressible Navier-Stokes isn't working #1 New Member   Join Date: Sep 2018 Posts: 4 Rep Power: 4 I'm trying to figure out why the algorithm I've come up with to solve the 2D incompressible Navier-Stokes equations isn't working. I'm using a finite difference discretized mesh on a square, with colocated velocity and pressure variables. I'm also using the Backwards Euler scheme for time advancement. The model I'm using is a simple driven cavity, with an initial velocity of zero inside the mesh and on all the boundaries except the top wall, which has an initial X velocity of 1 m/s. I discretize the velocity derivatives and second derivatives with central differences, and discretize the pressure derivative with backward differences. I also linearize the non-linear terms by multiplying them by the velocities from the previous time step. So for example in the X momentum equation there is the term U*dU/dx, so I replace "U" with the U velocity from the previous step. To compute a time step, first I build a matrix and a right-hand side representing the linear equations. This is done by looping through all of the mesh points and adding three rows for each mesh point; two for the X and Y momentum equations, and one for the continuity equation. I assume that the pressure gradient perpendicular to a boundary is zero. I also pin the pressure at one of the mesh points to be zero. Then I solve this system of linear equations to get the velocity and pressure values at the next time step. However this isn't working because the matrix has a rank that is always 1 less than the number of unknowns, so it doesn't have a unique solution. Should this algorithm work in principle, and I could just be missing one small thing that is causing the matrix to be rank-deficient by 1? Last edited by cactus man; September 11, 2018 at 20:27. Reason: Added information on how I linearized the non-linear terms.   September 11, 2018, 23:58 #2 New Member   Join Date: Apr 2015 Posts: 17 Rep Power: 7 This sounds an awful lot like Step 11 of CFD Python: 12 steps to Navier-Stokes. Are you following this set of tutorials? Even if not, perhaps the code provided therein can help you pinpoint the error in your code.   September 12, 2018, 00:19 #3
New Member

Join Date: Sep 2018
Posts: 4
Rep Power: 4 Quote:
 Originally Posted by gdbb89 This sounds an awful lot like Step 11 of CFD Python: 12 steps to Navier-Stokes. Are you following this set of tutorials? Even if not, perhaps the code provided therein can help you pinpoint the error in your code.
I was not following that tutorial. One big difference I see between my algorithm and the one in that tutorial is that the tutorial uses the Pressure Poisson Equation instead of the Continuity Equation.

I developed my algorithm as a way to answer the question "What velocity and pressure field at time 't + h' will result in a velocity gradient that when evolved backwards in time using the Backwards Euler method will result in the already known velocity field at time 't', and the velocity field satisfies the Continuity Equation?" But I'm not sure if that is exactly the correct question to be asking.

Last edited by cactus man; September 12, 2018 at 00:23. Reason: clarification   September 12, 2018, 01:58 #4
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,666
Rep Power: 60   Quote:
 Originally Posted by cactus man I was not following that tutorial. One big difference I see between my algorithm and the one in that tutorial is that the tutorial uses the Pressure Poisson Equation instead of the Continuity Equation. I developed my algorithm as a way to answer the question "What velocity and pressure field at time 't + h' will result in a velocity gradient that when evolved backwards in time using the Backwards Euler method will result in the already known velocity field at time 't', and the velocity field satisfies the Continuity Equation?" But I'm not sure if that is exactly the correct question to be asking.

What exactly are you doing? The NSE are not reversible in time.
Furthermore, the Poisson equation for the pressure is nothing else that the continuity equation div v = 0.   September 12, 2018, 03:19 #5
New Member

Join Date: Sep 2018
Posts: 4
Rep Power: 4 Quote:
 Originally Posted by FMDenaro What exactly are you doing? The NSE are not reversible in time. Furthermore, the Poisson equation for the pressure is nothing else that the continuity equation div v = 0.
I'm just using the Backwards Euler scheme. For example here it says that a fully implicit solver could use the Backwards Euler scheme. http://hplgit.github.io/INF5620/doc/pub/main_ns.html   September 12, 2018, 03:54 #6
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,666
Rep Power: 60   Quote:
 Originally Posted by cactus man I'm just using the Backwards Euler scheme. For example here it says that a fully implicit solver could use the Backwards Euler scheme. http://hplgit.github.io/INF5620/doc/pub/main_ns.html

When you work with the incompressible form of the NSE you have to consider that the pressure is only an auxiliary variable. In general, you can work using fully coupled method or some of the splitting-based method.
To understand the matrix form of the full system, see Eq.(2) here

http://www.ecs.umass.edu/mie/tcfd/Pa...ot_cfd2007.pdf

the you can see the possible splitting methods.

Note that in literature you can find a lot of fractional methods.  Tags algorithm, incompressible, solver Thread Tools Search this Thread Show Printable Version Email this Page Search this Thread: Advanced Search Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are Off Pingbacks are On Refbacks are On Forum Rules Similar Threads Thread Thread Starter Forum Replies Last Post Palani Velladurai Main CFD Forum 7 September 6, 2013 02:51 Jose Choy Main CFD Forum 3 October 24, 2003 02:28 Robert Main CFD Forum 0 December 20, 2002 02:14 Jose Choy Main CFD Forum 2 May 18, 2000 05:45 Yangang Bao Main CFD Forum 0 September 29, 1999 10:26

All times are GMT -4. The time now is 22:28.

 Contact Us - CFD Online - Privacy Statement - Top