- **OpenFOAM Running, Solving & CFD**
(*http://www.cfd-online.com/Forums/openfoam-solving/*)

- - **Local residuals**
(*http://www.cfd-online.com/Forums/openfoam-solving/58836-local-residuals.html*)

Hi everybody,
is it possiblHi everybody,
is it possible to display local residuals in OpenFOAM? I'm asking because I would like to see where the pressure solver has its problems. Thanks, Christian |

A while back I wrote a simpleFA while back I wrote a simpleFoamResidual application a while back - this will calculate and write a residual field for a simpleFoam run. Is this what you are after or do you need only the pressure residual?
Hrv |

As long as the pressure residuAs long as the pressure residual is included, I will be happy with it.
Is it included in OpenFOAM 1.4.1, because I haven't found it yet. Would it be possible (difficult) to adapt the code to run with turbFoam, too? Thanks for the quick reply. Christian |

This is a tricky question. IfThis is a tricky question. If you want "pure" pressure residual, plot fvc::div(phi) and we are done. In fact, it will tell you very little...
For the momentum residual, you can find the code in: http://openfoam-extend.svn.sourceforge.net/viewvc/openfoam-extend/trunk/Core/Ope nFOAM-1.4.1-dev/applications/utilities/errorEstimation/simpleFoamResidual/ and no changes are needed. If you wish to run it with the ddt term, this should be added into simpleFoamResidual, BUT you also need to write U_0 for every time-step during your simulation. If you just forget it, the residual picture will be (very slightly) polluted by ddt(U) - which tends to be small. Please keep me posted, Hrv |

In fact I don't really know ifIn fact I don't really know if I want "pure" pressure residuals. I just want a measure where I can find the bad parts of my mesh. If the momentum residual can tell me that I will use it.
Is the momentum residual comparable to the features you can use, for example, in CFX to display local residuals? So, if I have the expert at hand, I have to ask a few more questions: I'm struggling now for approx. 2 month to figure out how to get done the simulations I want to do for the flow around the ahmed car at 25deg (other angles should follow). I started with a tetra-mesh but have now switched to a hexa-mesh, both were generated with ICEM. According to the quality measures in ICEM(determinant, angle, skew, overall quality) the hexa one should be a quite good mesh. The boundary layers are highly resolved because I want to use a turbulence model without wall functions (LaunderSharma, LienCubicKELowRe) to get an accurate separation point. CheckMesh returns warnings for short edges and high aspect ratio cells. I'm using turbFoam. All solvers for the pressure I tried (PCG with DIC, GAMG) need approx. the same number of iterations for each pressure correction loop, regardless of the discretisation schemes used. For initialization I used a solution obtained with potentialFoam. Here what makes me a little bit thought-proviking is, that at the edges at the back of the car unusual high velocities up to 200m/s occur. My boundary conditions: Inlet: fixedValue for U, k, epsilon; zeroGradient for pressure. Outlet: fixedValue for p; zero Gradient for U, k, epsilon. Ahmed body (wall): fixedValue for U (0 0 0), k (10e-10); zeroGradient for epsilon, p. Same for the floor to compare the setup with wind tunnel tests. Bounding Walls: slip for U, zeroGradient for p, k, epsilon. So, after this "short" outline of the problems I encountered so far, now the questions: (1) Can short edges and high aspect ratios be the reason for getting bad convergence with the pressure solver? These short edges and high aspect ratio cells are due to the highly resolved boundary layer around the ahmed body and floor and a comparatively rather coarse resolution in the other two directions, I think? Similar simulations were done with CFX on a slightly different hybrid mesh but also with a highly resolved boundary layer and this made no problems. (2) Can this bad initial solution from potentialFoam spoil the rest of the solution? (3) Are the boundary conditions usable? I would be glad if you could give me some hints or could point me in the right direction to resolve these problems. Thanks in advance, Christian |

Hello,
I would like to calculate the residual for the spatial terms of the momentum eq. in the rhoPisoFoam solver. However as a test I included the transient term to see that the momentum equation is fulfilled, which it is not, even though the initial residuals during computations are small for U. I tried to perform my computations explicitly as in the code given in the thread above, volScalarField uResidual1 ( mag ( fvc::ddt(rho, U) + fvc::div(phi, U) + fvc::div(turbulence->devRhoReff()) + fvc::grad(p) ) ); Info<< "uResidual1 max: " << max(uResidual1.internalField()) << " mean: " << sum(uResidual1.internalField()*mesh.V())/sum(mesh.V()).value() << endl; Results: uResidual1 max: 11795617.43 mean: 93960.83833 1) Any suggestion to what could be wrong when computing the residual as above? 2) Is there a way to compute the viscous term exactly as in rhoPisoFoam, i.e. using turbulence->divDevRhoReff(U)? (However the viscous terms are small anyway) 3) How are the residuals for the fvMatrix calculated? (I don't understand the code in IduMatrix.C) Thanks /NW |

Quote:
Is this application valid for OF 1.6.x or is a modification neccesary? How I must to run the application? Thanks |

Hi,
Quote:
mad |

Hi all!
Is it possible to get initialResidual values without actually solving the linear equations system? The problem arises, because solverPerformance data is created by the lduMatrix/fvMatrix solve() method. Is there any mechanism just to get the initial information only, regarding the system to be solved? Waiting for your response! Thank you and have a nice day! Alexander |

Hi All,
I am also trying to do flow simulation for a city model. And using Simplefoam form the same. I am also facing similer kind of issues as MALLALENA please rever to following post for case details. http://http://www.cfd-online.com/For...urbulence.html I was thinking it is due to inlet conditions but I found out that the pressure solwing is getting blown up after few iterations. I am using tetrahedral mesh. Thanks a lot for ur kind help __________________ Cheers, Vishal Jambhekar... "Simulate the way ahead......!!!" |

Hi All,
I am also trying to do flow simulation for a city model. And using Simplefoam form the same. I am also facing similer kind of issues as MALLALENA please rever to following post for case details. http://http://www.cfd-online.com/For...urbulence.html I was thinking it is due to inlet conditions but I found out that the pressure solwing is getting blown up after few iterations. I am using tetrahedral mesh. Thanks a lot for ur kind help.. |

Quote:
http://www.cfd-online.com/Forums/ope...tml#post308363 Can anyone tell me if the equation fvc::div(phi, U) + fvc::div(turbulence->R()) + fvc::grad(p) which is used in the routine simpleFoamResiduals.C is the same as the momentum equation in simpleFoam.C which reads: fvm::div(phi, U) + turbulence->divDevReff(U) + fvc::grad(p) ? Thank you for your answer in advance. |

I am still interested in this topic. Is It the same?
How can I interpretate the uResidual field? 2000 is a high number? Is there a physical meaning for that figure? |

All times are GMT -4. The time now is 21:42. |