CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Local residuals

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By hjasak
  • 1 Post By vishal

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 4, 2008, 05:34
Default Hi everybody, is it possibl
  #1
New Member
 
Christian Egerer
Join Date: Mar 2009
Posts: 8
Rep Power: 17
chrisegerer is on a distinguished road
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
chrisegerer is offline   Reply With Quote

Old   June 4, 2008, 08:35
Default 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
hjasak will become famous soon enough
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
hjasak is offline   Reply With Quote

Old   June 5, 2008, 01:37
Default As long as the pressure residu
  #3
New Member
 
Christian Egerer
Join Date: Mar 2009
Posts: 8
Rep Power: 17
chrisegerer is on a distinguished road
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
chrisegerer is offline   Reply With Quote

Old   June 5, 2008, 02:18
Default This is a tricky question. If
  #4
Senior Member
 
Hrvoje Jasak
Join Date: Mar 2009
Location: London, England
Posts: 1,905
Rep Power: 33
hjasak will become famous soon enough
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://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
arvindpj likes this.
__________________
Hrvoje Jasak
Providing commercial FOAM/OpenFOAM and CFD Consulting: http://wikki.co.uk
hjasak is offline   Reply With Quote

Old   June 6, 2008, 03:15
Default In fact I don't really know if
  #5
New Member
 
Christian Egerer
Join Date: Mar 2009
Posts: 8
Rep Power: 17
chrisegerer is on a distinguished road
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 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
chrisegerer is offline   Reply With Quote

Old   September 29, 2010, 13:37
Default
  #6
Member
 
Niklas Winkler
Join Date: Mar 2009
Location: Stockholm, Stockholm, Sweden
Posts: 73
Rep Power: 17
nikwin is on a distinguished road
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
nikwin is offline   Reply With Quote

Old   October 4, 2010, 05:57
Default
  #7
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
Quote:
Originally Posted by hjasak View Post
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
I hope hjasak will read this message.

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

Thanks
be_inspired is offline   Reply With Quote

Old   November 2, 2010, 11:10
Default
  #8
Senior Member
 
maddalena's Avatar
 
maddalena
Join Date: Mar 2009
Posts: 436
Rep Power: 23
maddalena will become famous soon enough
Hi,
Quote:
Originally Posted by be_inspired View Post
Is this application valid for OF 1.6.x or is a modification neccesary?
How I must to run the application?
You must change the turbulence definition on the posted file in order to match the new OF 1.6 definition. You can have an idea comparing the files as above to the simpleFoam solver files in OF 1.6. The correction is straight away.

mad
maddalena is offline   Reply With Quote

Old   January 12, 2011, 04:29
Default
  #9
Senior Member
 
Dr. Alexander Vakhrushev
Join Date: Mar 2009
Posts: 250
Blog Entries: 1
Rep Power: 19
makaveli_lcf is on a distinguished road
Send a message via ICQ to makaveli_lcf
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.
makaveli_lcf is offline   Reply With Quote

Old   March 8, 2011, 05:25
Default
  #10
Member
 
Vishal Jambhekar
Join Date: Mar 2009
Location: University Stuttgart, Stuttgart Germany
Posts: 90
Blog Entries: 1
Rep Power: 17
vishal is on a distinguished road
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......!!!"
Asier_Aragon likes this.
__________________
Cheers,

Vishal Jambhekar...
"Simulate the way ahead......!!!"
vishal is offline   Reply With Quote

Old   March 8, 2011, 05:26
Default
  #11
Member
 
Vishal Jambhekar
Join Date: Mar 2009
Location: University Stuttgart, Stuttgart Germany
Posts: 90
Blog Entries: 1
Rep Power: 17
vishal is on a distinguished road
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......!!!"
vishal is offline   Reply With Quote

Old   May 19, 2011, 09:01
Default
  #12
Senior Member
 
Anne Gerdes
Join Date: Aug 2010
Location: Hamburg
Posts: 168
Rep Power: 15
Anne Lincke is on a distinguished road
Quote:
Originally Posted by be_inspired View Post
I hope hjasak will read this message.

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

Thanks
If you still face those problems this discussion might be helpful:

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.
Anne Lincke is offline   Reply With Quote

Old   October 10, 2013, 05:29
Default
  #13
Senior Member
 
M. Montero
Join Date: Mar 2009
Location: Madrid
Posts: 153
Rep Power: 17
be_inspired is on a distinguished road
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?
be_inspired is offline   Reply With Quote

Old   September 11, 2018, 08:44
Default
  #14
Member
 
Ben 017
Join Date: Nov 2017
Posts: 70
Rep Power: 8
Ben UWIHANGANYE is on a distinguished road
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!
Ben UWIHANGANYE is offline   Reply With Quote

Old   October 31, 2018, 09:47
Default
  #15
New Member
 
Join Date: Jan 2017
Posts: 22
Rep Power: 9
C. Okubo is on a distinguished road
Hi!

If you still need it, you could try:

https://www.openfoam.com/releases/op...esidual-fields

Regards,

Okubo
C. Okubo is offline   Reply With Quote

Old   October 31, 2018, 10:59
Default
  #16
New Member
 
Join Date: Jan 2017
Posts: 22
Rep Power: 9
C. Okubo is on a distinguished road
Also, this information could help:

https://www.openfoam.com/documentati...residuals.html
C. Okubo is offline   Reply With Quote

Old   March 5, 2024, 08:15
Default
  #17
New Member
 
Join Date: Jun 2016
Posts: 2
Rep Power: 0
mfenix is on a distinguished road
Quote:
Originally Posted by nikwin View Post
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

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?
mfenix is offline   Reply With Quote

Old   March 6, 2024, 09:42
Default
  #18
New Member
 
Join Date: Jun 2016
Posts: 2
Rep Power: 0
mfenix is on a distinguished road
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.
mfenix is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 13:11.