Discussion Closed This discussion was created more than 6 months ago and has been closed. To start a new discussion with a link back to this one, click here.

Navier-Stokes Simulation using General Form PDE: The Continuity Equation

Please login with a confirmed email address before reporting spam

Greetings all.

I am working to solve a standard fluid flow problem (e.g. flow in a pipe as a start) using the General Form PDE interfaces instead of the Fluid Flow built in GUI. I am able to define a u-momentum and a v-momentum equation without too much difficulty, but it is the continuity equation that I am struggling with. Right now I have 3 instances of PDE General Form (2 momentum equations + 1 continuity equation). For the continuity equation, all of the coefficients are set to zero with the exception of the source, f. The source f is set equal to -(ux + vy), giving the spatial derivatives of the velocity components equal to zero (incompressible, Newtonian fluid). The problem now becomes the boundary conditions - the continuity equation must be satisfied everywhere (not just on the boundaries) in the domain! I can set all the boundaries to zero and it works fine, but I don't get a converged velocity field because there is no enforcement of continuity.

Does anyone have any insight on how the built in Fluid Flow module implements the continuity constraint? Perhaps I could use a probe to integrate "abs(ux+vy)" over the domain, but then I have no way of requiring that to be zero (or some small number).

Any advice would be greatly appreciated! Thanks!

13 Replies Last Post 05.09.2016, 14:15 GMT-4

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 03.09.2011, 07:49 GMT-4
Hi Mark,

Define two PDE, the first with u and v and the second with p, the continuity equation is defined in the second PDE, see the mph file.

--
JM Buchot
Hi Mark, Define two PDE, the first with u and v and the second with p, the continuity equation is defined in the second PDE, see the mph file. -- JM Buchot


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 07.09.2011, 15:32 GMT-4
Thank you JM for the advice.

I now have a follow-up question. I have the equations set up and I let the solver run. Eventually it reaches its maximum number of iterations and tells me that it could not find a converged solution. HOWEVER, the "solution" from the last iteration step seems completely converged. I know the solution for flow in a pipe (or between two plates), the pressure profile is perfect and continuity is satisfied. Why didn't the solver stop?? I have tried changing the solver settings (originally just used the default), tolerances, etc - but they all give the same result: returning what appears to be a converged solution without realizing it.

I am baffled and clearly missing something. Is there a way to tell *what* isn't converged and why the solver has not stopped? At one point, the MUMPS solver showed a convergence of 10^-11 but didn't stop. The next step showed convergence of 2.5!

Any advice anybody can provide would be greatly appreciated!

Solver settings:
Stationary, Direct Solver: MUMPS
Max Iterations: 25
Tolerance Factor: 1
Relative Tolerance: 0.001

Mark
Thank you JM for the advice. I now have a follow-up question. I have the equations set up and I let the solver run. Eventually it reaches its maximum number of iterations and tells me that it could not find a converged solution. HOWEVER, the "solution" from the last iteration step seems completely converged. I know the solution for flow in a pipe (or between two plates), the pressure profile is perfect and continuity is satisfied. Why didn't the solver stop?? I have tried changing the solver settings (originally just used the default), tolerances, etc - but they all give the same result: returning what appears to be a converged solution without realizing it. I am baffled and clearly missing something. Is there a way to tell *what* isn't converged and why the solver has not stopped? At one point, the MUMPS solver showed a convergence of 10^-11 but didn't stop. The next step showed convergence of 2.5! Any advice anybody can provide would be greatly appreciated! Solver settings: Stationary, Direct Solver: MUMPS Max Iterations: 25 Tolerance Factor: 1 Relative Tolerance: 0.001 Mark

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17.11.2011, 09:00 GMT-5

Hi Mark,

Define two PDE, the first with u and v and the second with p, the continuity equation is defined in the second PDE, see the mph file.

--
JM Buchot


Dear JM,
According to your suggestion, I defined a coupled model by 2 PDEs to reproduce the Navier-Stokes module(built-in model) in Comsol module library. Comparing the simulation result by this defined model and the built-in model, the pressure(p) is not smooth or converged by the defined model, although the u, v looks very similar. This puzzled me after I try to make both models with the same solver parameters and mesh. Could you please give me some suggestion. I can forward both model to you by email if you would like to.
The mph file I downloaded couldn't be opened in Comsol 3.5 or 4.1. Thanks a lot.
[QUOTE] Hi Mark, Define two PDE, the first with u and v and the second with p, the continuity equation is defined in the second PDE, see the mph file. -- JM Buchot [/QUOTE] Dear JM, According to your suggestion, I defined a coupled model by 2 PDEs to reproduce the Navier-Stokes module(built-in model) in Comsol module library. Comparing the simulation result by this defined model and the built-in model, the pressure(p) is not smooth or converged by the defined model, although the u, v looks very similar. This puzzled me after I try to make both models with the same solver parameters and mesh. Could you please give me some suggestion. I can forward both model to you by email if you would like to. The mph file I downloaded couldn't be opened in Comsol 3.5 or 4.1. Thanks a lot.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17.11.2011, 12:16 GMT-5
Try changing the element type for pressure from Quadratic to linear. It solved my problem.
Try changing the element type for pressure from Quadratic to linear. It solved my problem.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 18.11.2011, 02:49 GMT-5
Yes!, It works. I changed mesh element for p to linear and it works before I got your warmhearted reply. Anyway, thanks so much.
Yes!, It works. I changed mesh element for p to linear and it works before I got your warmhearted reply. Anyway, thanks so much.

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.12.2012, 07:45 GMT-5
Hi guys,

Can someone tell me how to change mesh element for p to linear ?

Thanks
Hi guys, Can someone tell me how to change mesh element for p to linear ? Thanks

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.12.2012, 10:03 GMT-5
Hi
check your main physics node for the Discretization tab, if not there turn it on via the view icon "discretization" of the "options - preferences - show - discretization"

--
Good luck
Ivar
Hi check your main physics node for the Discretization tab, if not there turn it on via the view icon "discretization" of the "options - preferences - show - discretization" -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.12.2012, 12:05 GMT-5

Try changing the element type for pressure from Quadratic to linear. It solved my problem.



Why can changing the element order improve the convergence?

--
Pu, ZHANG ??
Departamento de Física Teórica de la Materia Condensada,
Universidad Autónoma de Madrid,
Madrid, Spain.
[QUOTE] Try changing the element type for pressure from Quadratic to linear. It solved my problem. [/QUOTE] Why can changing the element order improve the convergence? -- Pu, ZHANG ?? Departamento de Física Teórica de la Materia Condensada, Universidad Autónoma de Madrid, Madrid, Spain.

Ivar KJELBERG COMSOL Multiphysics(r) fan, retired, former "Senior Expert" at CSEM SA (CH)

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 14.12.2012, 14:17 GMT-5
Hi

there are probably several possible explanations, but the higher the order the higher you might get oscillations to your esults, and these might be "wrong" hence increasing the rrors used by COMSOL to control the convergence, and then give poor or no convergence. Try interpolating a few ponts in Excel with a linear, secondary, third order etc polynomial, you will quickly se the tendencies to get oscillations, if you move your reference point up and down. You can go further in your study if you use matalb or another numerical tool

--
Good luck
Ivar
Hi there are probably several possible explanations, but the higher the order the higher you might get oscillations to your esults, and these might be "wrong" hence increasing the rrors used by COMSOL to control the convergence, and then give poor or no convergence. Try interpolating a few ponts in Excel with a linear, secondary, third order etc polynomial, you will quickly se the tendencies to get oscillations, if you move your reference point up and down. You can go further in your study if you use matalb or another numerical tool -- Good luck Ivar

Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 17.12.2012, 04:15 GMT-5
Hi dear all,

I'm simulating a flow in a porous media but I still have a problem with the convergence.
I'm using Comsol 4.2a and I have implemented my equations (Momentum equations and continuity equation) with 2 general PDE.

In the 1st PDE, I have the 2 momentum equations (2D case) where the dependent variables are u and v and using a quadratic discretisation order.

In the 2nd PDE, I have the continuity equation. The dependent variable is p (pressure) and I'm using a linear discretisation order (as you have suggested before).

Can you please take a look at my model (here attached).

PS : I'm using a dimensionless NS equations.
Hi dear all, I'm simulating a flow in a porous media but I still have a problem with the convergence. I'm using Comsol 4.2a and I have implemented my equations (Momentum equations and continuity equation) with 2 general PDE. In the 1st PDE, I have the 2 momentum equations (2D case) where the dependent variables are u and v and using a quadratic discretisation order. In the 2nd PDE, I have the continuity equation. The dependent variable is p (pressure) and I'm using a linear discretisation order (as you have suggested before). Can you please take a look at my model (here attached). PS : I'm using a dimensionless NS equations.


Please login with a confirmed email address before reporting spam

Posted: 1 decade ago 27.06.2013, 17:07 GMT-4
Hi:
I have this problem: How do you solve a similar problem, but in 3d. For example in a square duct with adimensionalized equations:

Geometry: Lz=1/2, Ly=1/2, Lx+=1;

u*ux+v*uy+w*uz=-px+1/Re^2*uxx+uyy+uzz

u*vx+v*vy+w*vz=-py*Re^2+1/Re*vxx+vyy+vzz

u*wx+v*wy+w*wz=-pz*Re^2+1/Re*wxx+wyy+wzz

ux+vy+wz=0

BC=
u,v,w=0 on walls;
u=1 at x=0

Thanks in advance!!
Hi: I have this problem: How do you solve a similar problem, but in 3d. For example in a square duct with adimensionalized equations: Geometry: Lz=1/2, Ly=1/2, Lx+=1; u*ux+v*uy+w*uz=-px+1/Re^2*uxx+uyy+uzz u*vx+v*vy+w*vz=-py*Re^2+1/Re*vxx+vyy+vzz u*wx+v*wy+w*wz=-pz*Re^2+1/Re*wxx+wyy+wzz ux+vy+wz=0 BC= u,v,w=0 on walls; u=1 at x=0 Thanks in advance!!

Please login with a confirmed email address before reporting spam

Posted: 10 years ago 28.11.2014, 15:22 GMT-5
Hi, not sure if the forum protocol is to keep old chains alive or start a new one. Anyway, I have a question which follows on this discussion. The coding up of the PDE's is relatively straightforward and the choice of quadratic/linear/etc, not so bad.

But then you get into the details - crosswind diffusion, streamline diffusion, etc. How to add that?

And then for time-dependent equations how do you specify upwind differentiation, etc? I've stumbled over this in the past.

For example, I've had occasion often enough to try to solve turbulent Navier-Stokes with uniform cross-section (d/dz=0 except for dp/dz). Should be easy enough to type this in by hand, but the only way I've got it to work is to load up the full Navier Stokes from COMSOL and edit the equations to try to delete all of the items I expect to be zero.

Any thoughts? For that matter - "out-of-plane" models already exist for heat transfer, but could be popular to add to the list for Navier-Stokes too.

Regards, John

Hi, not sure if the forum protocol is to keep old chains alive or start a new one. Anyway, I have a question which follows on this discussion. The coding up of the PDE's is relatively straightforward and the choice of quadratic/linear/etc, not so bad. But then you get into the details - crosswind diffusion, streamline diffusion, etc. How to add that? And then for time-dependent equations how do you specify upwind differentiation, etc? I've stumbled over this in the past. For example, I've had occasion often enough to try to solve turbulent Navier-Stokes with uniform cross-section (d/dz=0 except for dp/dz). Should be easy enough to type this in by hand, but the only way I've got it to work is to load up the full Navier Stokes from COMSOL and edit the equations to try to delete all of the items I expect to be zero. Any thoughts? For that matter - "out-of-plane" models already exist for heat transfer, but could be popular to add to the list for Navier-Stokes too. Regards, John

Please login with a confirmed email address before reporting spam

Posted: 8 years ago 05.09.2016, 14:15 GMT-4
Hi Yao

I am working on a pipe flow simulation almost exactly like your case by using general PDE interface to solve the Navier-Sotkes equation. However, after I created 2 momentum + 1 continuity equation ( pressure defined, linear Lagrange ), it still can not give me a converged solution with pressure inlet and pressure outlet boundary condition.

I noticed that you have solve your problem, Is that possible to give me some more advice or teach me how you did it?

Best
Di Shen
Hi Yao I am working on a pipe flow simulation almost exactly like your case by using general PDE interface to solve the Navier-Sotkes equation. However, after I created 2 momentum + 1 continuity equation ( pressure defined, linear Lagrange ), it still can not give me a converged solution with pressure inlet and pressure outlet boundary condition. I noticed that you have solve your problem, Is that possible to give me some more advice or teach me how you did it? Best Di Shen

Note that while COMSOL employees may participate in the discussion forum, COMSOL® software users who are on-subscription should submit their questions via the Support Center for a more comprehensive response from the Technical Support team.