|
[Sponsors] |
Coupled Solver Include Y-velocity terms in X-momentum equation? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 25, 2020, 13:55 |
Coupled Solver Include Y-velocity terms in X-momentum equation?
|
#1 |
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
All,
I have a general question about coupled solvers for NS equations: does it simply put the segregated coefficients for X-momentum Y-momentum and continuity into a giant matrix and solve, or does it fully linearize all the terms? i.e. in the matrix, do the X-momentum equations include implicit y-velocity components in the matrix, and vice versa? I hope my question is clear. TIA EDIT: to further clarify-- does the benefit of stability and convergence rate only come with coupled solvers when all the implicit terms are included i.e. fully-linearized, or in general, is there benefit even if the coefficients are essentially the same as the segregated solver, but the pressure and velocity are more directly coupled? Last edited by arkie87; May 25, 2020 at 13:59. Reason: clarification |
|
May 25, 2020, 17:04 |
|
#2 |
Senior Member
|
I can't answer for any form of coupled solvers, but for preconditioned density based ones you have the implicit terms with respect to all the variables. That is, the implicit block is w.r.t. each of the variables. I expect the same for pressure based ones, but I expect it to also depend on other aspects (like if incompressible or not, how it is coded, etc.)
|
|
May 25, 2020, 17:12 |
|
#3 |
Senior Member
|
Consider also that, once you have a coupled solver, it costs you nothing to add all the implicit terms.
Also, I don't expect any advantage by simply solving the equations together. |
|
May 25, 2020, 18:51 |
|
#4 | ||
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
Quote:
Also, your answers are very helpful. Thanks again! |
|||
May 25, 2020, 19:20 |
|
#5 |
Senior Member
|
Banded structure is preserved at the block level, so it really isn't an issue. The point is, once you have a block instead of a single scalar, filling the block or not is not going to impact the overall cost.
Using only the pressure coupling, instead of the full one, is along the same line. The point is that once you solve for a coupled set of equations, say n, you incur a cost, which is mostly memory, which is a factor n^2 higher, and you want a good reason for it. Adding few more coefficients to a matrix that already has a given dimension will cost you nothing and is just the core of the coupling. I don't know the details for pressure based coupled solvers, but I think they are no different. Also, the term you allude to for the inter-velocity coupling is actually a mass flux that contains the pressure as well for Rhie-Chow like treatments, so you kind of want to consider it in any case |
|
May 25, 2020, 19:35 |
|
#6 | ||||
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
Quote:
Quote:
Also, if we are dealing with sparse matrices, then the memory requirements should be closer to n, not n^2, no? Quote:
Thanks again! |
|||||
May 25, 2020, 20:14 |
|
#7 |
Senior Member
|
Well... no, no and no.
Given a traditional matrix of a segregated solver with scalar elements aij, a coupled solver has matrix elements Aij. That is, each element is an nxn matrix itself, or a block. The overall matrix is said to be a block matrix. The matrix structure is the same of the scalar one if looked at the block level. So a coupled solver already has nxn more memory allocated. You can fill the blocks on the diagonal only (roughly equivalent to just putting the segregated equations in the same system), but it comes at practically no cost filling the rest of the block. I don't know if adding only pressure dependence is enough. What I claim is that it has no sense to have an nxn block and filling it only in part. In a blocked matrix algebraic solver for CFD, gaussian elimination enters in the inversion of the single Aij blocks, but certainly not the full matrix. The system is typically solved using iterative methods whose main difference with respect to non blocked versions is the use of the inverse instead of division by matrix elements. Again, given the additional cost of the gaussian elimination, it makes little difference if the block is full or not. The only way a momentum equation depends from the other ones is trough the mass flux in the convective term. When you use Rhie-Chow, this mass flux also contains the pressure. So, even if you only want to take pressure into account, you still have to consider it in the convective term as well. At that point, dude, just do it as it is intended to be. |
|
May 25, 2020, 21:57 |
|
#8 | ||||||||
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
I dont see how. It should only be 4x more memory for 3D problems, since the matrix is sparse. Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Quote:
Please, no need to be salty. |
|||||||||
May 25, 2020, 22:14 |
|
#9 | |
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
|
||
May 26, 2020, 00:53 |
|
#10 |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,291
Rep Power: 35 |
For implicit type of solver
1. The coupled system does include the terms related to other variables (u,v,w and p). It is there for both pressure based and density based solver. 2. The main difference between pressure based and density based coupled solver is how their coupled matrix is constructed. They are not the same (obviously). For density based solver in Fluent and starccm one of the core paper is this https://arc.aiaa.org/doi/abs/10.2514/3.12946 For pressure based solver refer: https://www.aub.edu.lb/msfea/researc...ts/CFD-P18.pdf Now there are other coupled solvers too, there is one present in Polyflow and this is based on Newton type iteration using Jacobian of Navier Stokes to step to next time level. This types of coupled solvers are popular in High speed flows like detonation for example though Polyflow uses them for visco-elastic flows. |
|
May 26, 2020, 01:19 |
|
#11 | ||||
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
I am asking because I have two 2-D Matlab CFD codes. One uses SIMPLE and one uses a "coupled" algorithm i wrote (which basically couples velocity to pressure, but not velocity to velocity in momentum equation, but velocity is coupled to velocity in continuity equation), and it still takes much fewer iterations than SIMPLE (40 vs 400). Quote:
http://www.tfd.chalmers.se/~hani/kur...s_20130917.pdf Quote:
Quote:
P,U,V 0,X,X Continuity X,X,0 X-Momentum X,0,X Y-Momentum Where 0 means all zeros, and X means some elements are filled out. |
|||||
May 26, 2020, 01:38 |
|
#12 | |
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
|
||
May 26, 2020, 07:32 |
|
#13 |
Senior Member
|
I didn't want to be salty, but we clearly are not on the same page.
You use MATLAB and divide to solve the system, so you couldn't care less how the equations are ordered in your matrix, and I suspect that you are ordering them like: pressure eq. at node 1 pressure eq. at node 2 . pressure eq. at node N u eq. at node 1 u eq. at node 2 . u eq. at node N v eq. at node 1 v eq. at node 2 . v eq. at node N This is nice and all, but it is the matrix structure that you use to actually exploit Schur complement approaches, that eventually lead to segregated solvers. Nobody writes coupled solvers like that in CFD, because it is largely inefficient compared to the other way around, which is what I was referring to (and please also consider the second reference posted by Arjun, equations 30 and 43 specifically, but also the slides you posted, on page 24): pressure eq. at node 1 u eq. at node 1 v eq. at node 1 pressure eq. at node 2 u eq. at node 2 v eq. at node 2 . pressure eq. at node N u eq. at node N v eq. at node N Or, reasoning at the block level: block eq. at node 1 block eq. at node 2 . block eq. at node N where each block is an nxn (with n=3 in 2D) matrix and this is the block I was referring to in my posts. It is this block that is inverted by Gaussian elimination. Note that this is very different from your NxN blocks, with N referring to the number of nodes in the grid. Now, the following holds for this approach: 1) Each block needs an nxn matrix already, independently from how you actually fill the block. So, for a given matrix structure, if instead of scalar elements you have nxn blocks, do we agree that the coupled solver has a memory requirement which is a factor n^2 higher? 2) If your solution variables are stored accordingly (see the OF slides you posted or the 2nd paper posted by Arjun), you exploit cache efficiency at the highest level, because you run over the nodes (faces in FV as OpenFOAM) of the grid and retrieve the relative variables only once (vs n times for the segregated solver). 3) As per 2, you have all the variables to build your full coupling and you got them as efficiently as possible. Is there a reason to drop some coupling terms, considering that the cost of updating the general matrix will be the same? In general NO, unless you know they will do some harm to the matrix properties you care the most. Now, I certainly expect the pressure coupling to be more impactful than the velocity coupling, no doubt, but I was trying to explain that in the common approach to coupled solvers the inter-velocity coupling really comes at no additional cost. With your ordering it is clearly different, but probably that's your last problem as well. For what concerns Rhie-Chow, it is not relevant in your staggered case, but it is in the more general unstructured cell-centered cases. |
|
May 26, 2020, 11:44 |
|
#14 | |||||||
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
Quote:
I do Quote:
Quote:
Quote:
Quote:
Quote:
The last thing I am confused about is how the coupled solver loops/works. It seems like you are saying it inverts only the blocks i.e. 3x3 matrix, and then moves around to each cell. Thus, it requires storage of the full 3Nx3N matrix, which runs into the problem i mentioned earlier. The other thing I am confused about is how this achieves the full coupling. It seems like it couples U,V, and P together well, but decouples them from their neighboring cells. So it seems like there would need to be lots of Guass-Seidel iterations to achieve convergence of the coupled solver, which defeats the purpose in my mind. Alternatively, it inverts the blocks of the first cell (3x3), and then inverts the blocks of its neighboring cells (3x3nb). I suppose then it could multiply the first row of the matrix by the RHS (b) to get the values of U V and P in the first cell? Is that right (is that what Schur complement approach is)? It could then forget the matrix inverse values and move onto the next cell. Once again, thanks again for all your help! |
||||||||
May 26, 2020, 14:46 |
|
#15 |
Senior Member
Filippo Maria Denaro
Join Date: Jul 2010
Posts: 6,897
Rep Power: 73 |
I haven't read carefully all the comments and answers, the last comments seem to address that one of the reasons for confusion is about the difference between the matrix form of the governing equations and the matrix of the resulting algebric systems, isn't that?
|
|
May 26, 2020, 15:59 |
|
#16 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,291
Rep Power: 35 |
Quote:
On top of that Gauss Seidel does not really work in pressure based coupled solver. This is one of the many issues with pressure based coupled solver. Coupled solver on paper is nice but in cases where grid is not so good, you might find that it is less efficient than a well implemented SIMPLE. For example if you have an example of coupled solver then try comparing it with Fluent's SIMPLE which is example of a good SIMPLE implementation. Fluent also have pressure based coupled solver (from 2007) and there is a reason why it is not their main solver. |
||
May 26, 2020, 16:06 |
|
#17 | |
Member
Raphael
Join Date: Nov 2012
Posts: 68
Rep Power: 14 |
Quote:
To me, that seems like it should completely negate the benefit of the coupled solver due to Gauss Seidel iterations being slow... though I guess fluent just uses AMG rather than Gauss Seidel. Though I'm not sure how one implements AMG or GMG with a blocked matrix. |
||
May 26, 2020, 16:12 |
|
#18 | |
Senior Member
Arjun
Join Date: Mar 2009
Location: Nurenberg, Germany
Posts: 1,291
Rep Power: 35 |
Quote:
Fluent uses AMG and needs some sort of under-relaxation (or diagonal dominance) to make that AMG work. It is shown that for such problems Gauss Seidel is not a good smoother. Braess-Sarazin smoother is preferred. http://perso.unifr.ch/ales.janka/papers/emg_slides.pdf |
||
May 26, 2020, 17:19 |
|
#19 | |||||
Senior Member
|
Quote:
Quote:
Now, no matter how well ordered are the faces and cells, there is always some cache issue in retrieving variables from cells and putting back some other values. That is, at some point (unless the problem is very small), you will need a cell value that is out of cache, during each of those loops. Now, solving a segregated problem implies that those problems are encountered n times. Also, you kind of end up retrieving and computing the same variable multiple times (imagine the diffusion coefficients, for example). With a coupled solver you do only one face loop and one cell loop, retrieve all the variables only once, compute what you need once, and put back stuff once. All the variables of a cell, in my ordering, are stored together and don't incur cache misses when retrieved together. Actually, this effectively reduces the number of cells in cache (because there are more variables per cell), but the cache misses are reduced. Quote:
Quote:
Quote:
|
||||||
May 26, 2020, 17:32 |
|
#20 | |
Senior Member
|
Quote:
I once found myself at a dinner with a group of prominent linear algebra professors, except that I didn't know it (I knew they were somehow involved in math/engineering, but didn't know exactly on which topic), and then I suddenly dropped this bomb (using plain SGS in a production code that solves large system of equations)... they were all ... I was all "I know, but it just works"... it was fun |
||
Tags |
coupled solver, linearize, segregated solver |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fluent do not use my velocity field(by UDF) to solve energy equation | tangleiplus | Fluent UDF and Scheme Programming | 6 | January 21, 2019 22:28 |
Domain Reference Pressure and mass flow inlet boundary | AdidaKK | CFX | 75 | August 20, 2018 06:37 |
Question about adaptive timestepping | Guille1811 | CFX | 25 | November 12, 2017 18:38 |
pressure-based coupled solver for compressible NS equation | wangmianzhi | Main CFD Forum | 19 | July 29, 2016 04:37 |
Explicit evaluation of all the terms of momentum equation | Andrea_85 | OpenFOAM | 0 | November 25, 2014 10:39 |