# Solution of Stokes Equations in 3D in Structured Grids - P-v Coupling

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

 June 20, 2020, 10:11 Solution of Stokes Equations in 3D in Structured Grids - P-v Coupling #1 New Member   Rafael March Join Date: Mar 2020 Posts: 5 Rep Power: 5 Hello, I need to develop a code to solve Stokes Equations in 3D in cubic geometries (structured grid, uniform mesh spacing). My code needs to take a pressure gradient in one direction as a BC (pinlet=p1, poutlet=p0) and no-slip BC's in the other 4 faces of the cubic geometry. I started to develop this code in Python, using a staggered grid FV approach; pressure at the center of the FV cells, ux velocities at the faces normal to the x direction and so on. My code gives strange results, which has made me wonder if I am considering the correct approach to solve such system. I am currently assembling a system of equations that considers [p, ux, uy] as unknowns and solving it in "one go". That is, I build a matrix and solve the linear system, which gives me the solution. The degrees of freedom are coupled through Stokes equations and continuity equation, but the coupling is "solved" by assembling the coefficients to the matrix. However, whenever I research numerical codes and books on Navier-Stokes equations, they usually give a couple of strategies to treat the pressure-velocity coupling, typically "guess and correct" approaches, where you guess a pressure field, and correct it iteratively to satisfy continuity (e.g. SIMPLE, SIMPLEC, PISO). These approaches are usually formulated in the Navier-Stokes context, but Stokes equations have the same type of pressure-velocity coupling; they just don't have the nonlinear inertia term. So I assume these strategies would be applicable to Stokes equations as well. So my question to the community is: Is there something "wrong" with my approach to solve Stokes equations in one go, implicitly, by solving one linear system? Or do I need to consider iterative methods to treat the pressure-velocity coupling? Thank you! Rafael March.

June 20, 2020, 12:04
#2
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,742
Rep Power: 71
Quote:
 Originally Posted by rafaelmarch3 Hello, I need to develop a code to solve Stokes Equations in 3D in cubic geometries (structured grid, uniform mesh spacing). My code needs to take a pressure gradient in one direction as a BC (pinlet=p1, poutlet=p0) and no-slip BC's in the other 4 faces of the cubic geometry. I started to develop this code in Python, using a staggered grid FV approach; pressure at the center of the FV cells, ux velocities at the faces normal to the x direction and so on. My code gives strange results, which has made me wonder if I am considering the correct approach to solve such system. I am currently assembling a system of equations that considers [p, ux, uy] as unknowns and solving it in "one go". That is, I build a matrix and solve the linear system, which gives me the solution. The degrees of freedom are coupled through Stokes equations and continuity equation, but the coupling is "solved" by assembling the coefficients to the matrix. However, whenever I research numerical codes and books on Navier-Stokes equations, they usually give a couple of strategies to treat the pressure-velocity coupling, typically "guess and correct" approaches, where you guess a pressure field, and correct it iteratively to satisfy continuity (e.g. SIMPLE, SIMPLEC, PISO). These approaches are usually formulated in the Navier-Stokes context, but Stokes equations have the same type of pressure-velocity coupling; they just don't have the nonlinear inertia term. So I assume these strategies would be applicable to Stokes equations as well. So my question to the community is: Is there something "wrong" with my approach to solve Stokes equations in one go, implicitly, by solving one linear system? Or do I need to consider iterative methods to treat the pressure-velocity coupling? Thank you! Rafael March.

First of all, any bug in a code can be always present. But I want to ask you what is your goal. If I understand correctly, you just want to solve a viscous steady laminar flow problem in a square duct, isn't that?

 June 21, 2020, 09:31 #3 New Member   Rafael March Join Date: Mar 2020 Posts: 5 Rep Power: 5 I might or might not have a bug, this is more of a conceptual question. Yes, right now I would like to solve Stokes in a cubic duct. The code will then be extended from this point to inclue Stokes-Darcy-Brinkman models, that is, modelling "free-flow" combined with porous media flow. So I need to solve Stokes first. Thank you, Rafael.

June 21, 2020, 11:05
#4
Senior Member

Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,742
Rep Power: 71
Quote:
 Originally Posted by rafaelmarch3 I might or might not have a bug, this is more of a conceptual question. Yes, right now I would like to solve Stokes in a cubic duct. The code will then be extended from this point to inclue Stokes-Darcy-Brinkman models, that is, modelling "free-flow" combined with porous media flow. So I need to solve Stokes first. Thank you, Rafael.

In Stokes flows, the equations are linearized in a very simple form like

Lap v = f

in your case you have the Poisson problem (with homogenouse Dirichlet conditions) for the streamwise velocity component that balances the action of the pressure difference.
Numerically you have to solve an elliptic equation, for example using a standard iterative method.

Thus, I don't understand why you compare to the standard methods for the NSE that are differently based.