
[Sponsors] 
June 4, 2008, 05:34 
Hi everybody,
is it possibl

#1 
New Member
Christian Egerer
Join Date: Mar 2009
Posts: 8
Rep Power: 17 
Hi 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 

June 4, 2008, 08:35 
A while back I wrote a simpleF

#2 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33 
A 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
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

June 5, 2008, 01:37 
As long as the pressure residu

#3 
New Member
Christian Egerer
Join Date: Mar 2009
Posts: 8
Rep Power: 17 
As 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 

June 5, 2008, 02:18 
This is a tricky question. If

#4 
Senior Member
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33 
This 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://openfoamextend.svn.sourceforge.net/viewvc/openfoamextend/trunk/Core/Ope nFOAM1.4.1dev/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 timestep 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
__________________
Hrvoje Jasak Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk 

June 6, 2008, 03:15 
In fact I don't really know if

#5 
New Member
Christian Egerer
Join Date: Mar 2009
Posts: 8
Rep Power: 17 
In 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 tetramesh but have now switched to a hexamesh, 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 thoughtproviking 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 (10e10); 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 

September 29, 2010, 13:37 

#6 
Member
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17 
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 

October 4, 2010, 05:57 

#7  
Senior Member
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17 
Quote:
Is this application valid for OF 1.6.x or is a modification neccesary? How I must to run the application? Thanks 

November 2, 2010, 11:10 

#8  
Senior Member
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23 
Hi,
Quote:
mad 

January 12, 2011, 04:29 

#9 
Senior Member

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
__________________
Best regards, Dr. Alexander VAKHRUSHEV Christian Doppler Laboratory for "Metallurgical Applications of Magnetohydrodynamics" Simulation and Modelling of Metallurgical Processes Department of Metallurgy University of Leoben http://smmp.unileoben.ac.at Last edited by makaveli_lcf; January 13, 2011 at 03:06. 

March 8, 2011, 05:25 

#10 
Member
Vishal Jambhekar
Join Date: Mar 2009
Location: University Stuttgart, Stuttgart Germany
Posts: 90
Blog Entries: 1
Rep Power: 17 
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.cfdonline.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......!!!"
__________________
Cheers, Vishal Jambhekar... "Simulate the way ahead......!!!" 

March 8, 2011, 05:26 

#11 
Member
Vishal Jambhekar
Join Date: Mar 2009
Location: University Stuttgart, Stuttgart Germany
Posts: 90
Blog Entries: 1
Rep Power: 17 
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.cfdonline.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......!!!" 

May 19, 2011, 09:01 

#12  
Senior Member
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 15 
Quote:
http://www.cfdonline.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. 

October 10, 2013, 05:29 

#13 
Senior Member
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17 
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? 

September 11, 2018, 08:44 

#14 
Member
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 8 
Hello Foamers,
Is there a way of calculating the averages of residuals in OpenFoam? I have a log file with residuals but I want to plot the average values of them. You may help to know How if exist. Regards! 

October 31, 2018, 09:47 

#15 
New Member
Join Date: Jan 2017
Posts: 22
Rep Power: 9 
Hi!
If you still need it, you could try: https://www.openfoam.com/releases/op...esidualfields Regards, Okubo 

October 31, 2018, 10:59 

#16 
New Member
Join Date: Jan 2017
Posts: 22
Rep Power: 9 

March 5, 2024, 08:15 

#17  
New Member
Join Date: Jun 2016
Posts: 2
Rep Power: 0 
Quote:
Hello Foamers, I challenge the same issue. Has anyone found a solution on how to handle the residual field calculation for transient cases so the residuals are in reasonable ranges? 

March 6, 2024, 09:42 

#18 
New Member
Join Date: Jun 2016
Posts: 2
Rep Power: 0 
I am aware of the workarounds using the functionsObjects "residuals" and "solverInfo" in recent openFoam versions but I need to have a stand alone utility calculating the residual fields. Aside from than that it seems to be an open issue why the ranges of the local residuals have such a high magnitude.


Thread Tools  Search this Thread 
Display Modes  


Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
OpenFoam local and local  sven82  OpenFOAM Installation  1  December 9, 2008 09:40 
local age of air in starccm+  Mike23  Siemens  3  September 20, 2008 11:16 
[Netgen] Local refinement  anita  OpenFOAM Meshing & Mesh Conversion  0  March 28, 2008 07:32 
sum local  stephan  OpenFOAM Running, Solving & CFD  1  July 24, 2007 10:41 
Is FEM Local Conservative  R.A.Khurram  Main CFD Forum  9  July 2, 2003 02:47 