CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

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

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 11, 2018, 18:52
Default Algorithm to solve 2D incompressible Navier-Stokes isn't working
  #1
New Member
 
Join Date: Sep 2018
Posts: 4
Rep Power: 4
cactus man is on a distinguished road
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.
cactus man is offline   Reply With Quote

Old   September 11, 2018, 23:58
Default
  #2
New Member
 
Join Date: Apr 2015
Posts: 17
Rep Power: 7
gdbb89 is on a distinguished road
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.
gdbb89 is offline   Reply With Quote

Old   September 12, 2018, 00:19
Default
  #3
New Member
 
Join Date: Sep 2018
Posts: 4
Rep Power: 4
cactus man is on a distinguished road
Quote:
Originally Posted by gdbb89 View Post
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
cactus man is offline   Reply With Quote

Old   September 12, 2018, 01:58
Default
  #4
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,666
Rep Power: 60
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by cactus man View Post
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.
FMDenaro is offline   Reply With Quote

Old   September 12, 2018, 03:19
Default
  #5
New Member
 
Join Date: Sep 2018
Posts: 4
Rep Power: 4
cactus man is on a distinguished road
Quote:
Originally Posted by FMDenaro View Post
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
cactus man is offline   Reply With Quote

Old   September 12, 2018, 03:54
Default
  #6
Senior Member
 
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 5,666
Rep Power: 60
FMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura aboutFMDenaro has a spectacular aura about
Quote:
Originally Posted by cactus man View Post
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.
FMDenaro is offline   Reply With Quote

Reply

Tags
algorithm, incompressible, solver

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtered navier stokes equation..LES:: Palani Velladurai Main CFD Forum 7 September 6, 2013 02:51
Navier stokes compresible viscid flow fea, somebody can help? Jose Choy Main CFD Forum 3 October 24, 2003 02:28
1-d navier stokes equation Robert Main CFD Forum 0 December 20, 2002 02:14
help: I am trying to solve Navier Stokes compressible and viscid flow Jose Choy Main CFD Forum 2 May 18, 2000 05:45
any better way to solve 3D stokes flow? Yangang Bao Main CFD Forum 0 September 29, 1999 10:26


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