CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Post-Processing

How to plot local residuals' field (for each cell) ? OF 5.x

Register Blogs Community New Posts Updated Threads Search

Like Tree3Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 18, 2018, 13:01
Default How to plot local residuals' field (for each cell) ? OF 5.x
  #1
Senior Member
 
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9
deepbandivadekar is on a distinguished road
Hello,

I was wondering if at all it is possible to do this. If yes, I could locate the problem areas in the mesh quickly whenever the run crashes. So I looked up on the forum and found mostly very old and semi-inconclusive threads.

So I am using OF 5.x version and I want to plot residuals for quantities like T, p, U for each cell in the domain and maybe view that in paraview. I came across this relatively recent thread, but this is not what I want. I have been doing this using gnuplot script. But this is average residual of each quantity with respect to time. I want it for each cell and of course for each time step. So that I can see exactly what's happening where in the field right before it crashes.

I'm not sure if pyFoam can be used. If so, could you point me to latest resource compatible with OF 5 please (I found very old resources)?

I am hoping someone could point me to correct tool/way to do this?
deepbandivadekar is offline   Reply With Quote

Old   May 9, 2018, 05:10
Default
  #2
New Member
 
manu ebn
Join Date: Aug 2015
Location: Switzerland
Posts: 18
Rep Power: 11
Triggin is on a distinguished road
Hi deep

Have you found a solution for this?

I would like to have the same. All i found was the following thread:
Residual Field OpenFOAM

They calculate the residuals manually, by compiling a new solver. The solver calculates then the residuals based on the matrix equation:

Ax = b
where A is the coeff.matrix, x is the vector with the cell-values and b stays for BC's.

The residuals are defined as followed:
r = b - Ax

I tried to do the same, but one of the coefficients was to big (i think it was the convection term) and therefore i didnt get sufficient residuals.

Best wishes
Triggin
Triggin is offline   Reply With Quote

Old   May 17, 2018, 14:13
Default
  #3
Senior Member
 
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9
deepbandivadekar is on a distinguished road
Quote:
Originally Posted by Triggin View Post
Hi deep
Have you found a solution for this?

I would like to have the same. All i found was the following thread:
Residual Field OpenFOAM

They calculate the residuals manually, by compiling a new solver. The solver calculates then the residuals based on the matrix equation:

Ax = b
where A is the coeff.matrix, x is the vector with the cell-values and b stays for BC's.

The residuals are defined as followed:
r = b - Ax

I tried to do the same, but one of the coefficients was to big (i think it was the convection term) and therefore i didnt get sufficient residuals.

Best wishes
Triggin
Hey!


Sorry I missed your post. It seems I missed another from a month ago!

No, I haven't yet found any solution to this. However I don't have any sudden changes in variable values so exploring this has taken a back seat for now. However I'm definitely interested in finding a solution.

The thread you've mentioned wasn't much useful. simpleFoamResidual gives me temporal residuals not spatial.


For the record, with OF5.x the correct command is
Code:
solverName -postProcess -func simpleFoamResidual
deepbandivadekar is offline   Reply With Quote

Old   June 9, 2018, 21:39
Default How to plot local residuals' field (for each cell) ? OF 5.x
  #4
Senior Member
 
abdikerim kurbanaliev
Join Date: Jun 2010
Location: Kyrgyzstan, Osh
Posts: 121
Rep Power: 16
kerim is on a distinguished road
Dear Deep,
Were you able to solve this problem? I'm interested in it too.
I found another links for that:
1. Local residuals.
2. https://github.com/Unofficial-Extend...FoamResidual.C

Regards,
Kerim
kerim is offline   Reply With Quote

Old   June 11, 2018, 07:22
Default
  #5
Senior Member
 
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9
deepbandivadekar is on a distinguished road
Quote:
Originally Posted by kerim View Post
Dear Deep,
Were you able to solve this problem? I'm interested in it too.
I found another links for that:
1. Local residuals.
2. https://github.com/Unofficial-Extend...FoamResidual.C

Regards,
Kerim
Hello Kerim,
I have been through these before. Weren't much useful, especially because this is for 1.6 and OF has evolved a lot since then. For my purpose, Co was very high and I could plot a Co filed and it sufficed. So still looking for residuals...
Code:
solverName -postProcess -func CourantNo
(This is listed on U-185 of user guide OF 5.0)
deepbandivadekar is offline   Reply With Quote

Old   October 3, 2018, 11:43
Question Any new ideas?
  #6
New Member
 
Miguel
Join Date: Apr 2018
Posts: 2
Rep Power: 0
mserra is on a distinguished road
Hi all,

Has any of you found some way of achieving this? I'm also struggling to represent a residual field for each time step.

It would be super useful for finding the area of the simulation where the trouble begins...

Cheers,
Serra
mserra is offline   Reply With Quote

Old   October 4, 2018, 08:23
Default
  #7
Senior Member
 
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9
deepbandivadekar is on a distinguished road
Quote:
Originally Posted by mserra View Post
Hi all,

Has any of you found some way of achieving this? I'm also struggling to represent a residual field for each time step.


Cheers,
Serra
No Serra Serra. (#sorry)

Quote:
Originally Posted by mserra View Post
It would be super useful for finding the area of the simulation where the trouble begins...
Indeed. However, I haven't found any solution so far. Will update this if I do.
deepbandivadekar is offline   Reply With Quote

Old   October 4, 2018, 08:55
Default
  #8
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hi!


I didn't have a chance to try it yet, but the residuals function object seems to do the job in openFoam-v1806 according to the releases notes : https://www.openfoam.com/releases/op...esidual-fields


Not sure it's available in the foundation branch though, I didn't check.
Yann is offline   Reply With Quote

Old   October 4, 2018, 09:26
Default
  #9
New Member
 
Miguel
Join Date: Apr 2018
Posts: 2
Rep Power: 0
mserra is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hi!


I didn't have a chance to try it yet, but the residuals function object seems to do the job in openFoam-v1806 according to the releases notes : https://www.openfoam.com/releases/op...esidual-fields


Not sure it's available in the foundation branch though, I didn't check.
Great!! Thanks for sharing it! It seems to be just what we wanted I'm going to try it in the CFD-Support version for windows (The only one that could be installed at my work )

Quote:
Originally Posted by deepbandivadekar View Post
No Serra Serra. (#sorry)
mserra is offline   Reply With Quote

Old   October 4, 2018, 09:58
Default
  #10
Senior Member
 
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9
deepbandivadekar is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hi!


I didn't have a chance to try it yet, but the residuals function object seems to do the job in openFoam-v1806 according to the releases notes : https://www.openfoam.com/releases/op...esidual-fields


Not sure it's available in the foundation branch though, I didn't check.

That's interesting. It does look like there's a similar function for OF 5 as well as OF 6:
https://github.com/OpenFOAM/OpenFOAM...ls/residuals.H

When I had posted this question I was primarily working on a branch of OF 2.4.x. It didn't have functionObjects. However, am still not sure if this is the right utility that we are looking for. I tried it on a case and it doesn't write the residuals as suggested in the header file. Or perhaps am not using the it the right way (I added it in the controlDict file)?
deepbandivadekar is offline   Reply With Quote

Old   October 4, 2018, 10:28
Default
  #11
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,236
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Quote:
Originally Posted by deepbandivadekar View Post
When I had posted this question I was primarily working on a branch of OF 2.4.x. It didn't have functionObjects. However, am still not sure if this is the right utility that we are looking for. I tried it on a case and it doesn't write the residuals as suggested in the header file. Or perhaps am not using the it the right way (I added it in the controlDict file)?

residuals is quite an old functionObject. As far as I remember, it was already there in OF 2.3.x. But the original function only writes a dat file reporting the residuals in the postProcessing directory.
What's new is the possibility to write residuals as a volume field.

This new functionality seems to be specific to OF v1806 since the residuals functionObject source code in OF 6 lacks the writeFields option.

2 options for you : trying the residuals functionObject in OF v1806 or trying to compile the source code from the v1806 function in OF 6.
Yann is offline   Reply With Quote

Old   October 4, 2018, 11:02
Default
  #12
Senior Member
 
Deep
Join Date: Oct 2017
Posts: 180
Rep Power: 9
deepbandivadekar is on a distinguished road
Quote:
Originally Posted by Yann View Post
residuals is quite an old functionObject. As far as I remember, it was already there in OF 2.3.x. But the original function only writes a dat file reporting the residuals in the postProcessing directory.
What's new is the possibility to write residuals as a volume field.

This new functionality seems to be specific to OF v1806 since the residuals functionObject source code in OF 6 lacks the writeFields option.
Yes I knew that, I meant the functionObject that writes residuals as volume field rather than the typical dat file.


Quote:
Originally Posted by Yann View Post
2 options for you : trying the residuals functionObject in OF v1806 or trying to compile the source code from the v1806 function in OF 6.
Alright, that's about it then.
deepbandivadekar is offline   Reply With Quote

Old   October 9, 2018, 01:47
Default
  #13
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
Hi all,

to sum up, the information of the discussed residual object function is presented here https://www.openfoam.com/releases/op...esidual-fields
C. Okubo likes this.
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   January 24, 2019, 06:47
Default
  #14
New Member
 
Gerhard
Join Date: Mar 2017
Posts: 26
Rep Power: 9
Gerhard is on a distinguished road
Yes, this is exactly what I would also like to do.
Thanks for the thread you posted Tobi. It is great, but I just do not know how to implement this into OpenFOAM v5.0?


The residuals functionObject in OF50 does not allow for writeFields to be set to true. The date of this "New and Improved Post-Processing" post was on 29/06/2018. OpenFOAM v5.0 is older. Is there thus a way to update it or something so that the new residuals functionObject comes into play?
Gerhard is offline   Reply With Quote

Old   October 19, 2023, 19:55
Default For OpenFOAM-11
  #15
New Member
 
Sam Mallinson
Join Date: Aug 2013
Posts: 6
Rep Power: 13
SamMallinson is on a distinguished road
For OpenFOAM-11, the command is


postProcess -func residuals -fields '(U p)'
Gerhard likes this.
SamMallinson is offline   Reply With Quote

Old   December 20, 2023, 11:58
Default
  #16
Member
 
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 64
Rep Power: 4
unilord is on a distinguished road
Hey, I used that command but it just creates a .dat file with three lines:

# Residuals
# Time
100 (this is the timestep on which I am trying to calculate the residuals)

Am I doing something wrong? Do I need to have any "residual" file in /system or controlDict?
unilord is offline   Reply With Quote

Old   March 5, 2024, 11:09
Default
  #17
Member
 
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 64
Rep Power: 4
unilord is on a distinguished road
Quote:
Originally Posted by SamMallinson View Post
For OpenFOAM-11, the command is


postProcess -func residuals -fields '(U p)'
Hey guys,

Any tips? Still haven't found the answer.
unilord is offline   Reply With Quote

Old   March 5, 2024, 12:27
Default
  #18
Super Moderator
 
Tobi's Avatar
 
Tobias Holzmann
Join Date: Oct 2010
Location: Bad Wörishofen
Posts: 2,711
Blog Entries: 6
Rep Power: 52
Tobi has a spectacular aura aboutTobi has a spectacular aura aboutTobi has a spectacular aura about
Send a message via ICQ to Tobi Send a message via Skype™ to Tobi
You don't provide any information.

For the ESI-Opencfd v2312 version, you can see that there is an optional parameter one can set to write out the volScalarFields

https://develop.openfoam.com/Develop...type=heads#L67

Tobi
__________________
Keep foaming,
Tobias Holzmann
Tobi is offline   Reply With Quote

Old   March 5, 2024, 12:37
Default
  #19
Member
 
Pedro Gouveia
Join Date: Oct 2022
Location: Portugal
Posts: 64
Rep Power: 4
unilord is on a distinguished road
Quote:
Originally Posted by Tobi View Post
You don't provide any information.

For the ESI-Opencfd v2312 version, you can see that there is an optional parameter one can set to write out the volScalarFields

https://develop.openfoam.com/Develop...type=heads#L67

Tobi
Hey Tobi.

I am using OF11, incompressibleFluid solver running a steady state. I want to plot a coutour of residual field of pressure and velocity. However the command sugested above does not work for me. That is what I was asking. At the moment I am not able to swap to ESI version. Is there any way to do it in the foundation version?
blr likes this.
unilord is offline   Reply With Quote

Old   June 18, 2024, 11:39
Default
  #20
New Member
 
Michael Henzinger
Join Date: Aug 2023
Location: Wels, Austria
Posts: 1
Rep Power: 0
MH_lift is on a distinguished road
I believe there is no such thing as "writeResidualFields" in the OF 11 Version. If you want to have it there, you need to create a custom function object.

The Source guide https://cpp.openfoam.org/v11/classFo...residuals.html is a good way to start looking for a way to implement this kind of function object. If you have no coding experience, it will take up some time. But it is definitely possible.
MH_lift is offline   Reply With Quote

Reply

Tags
openfoam 5.x, pyfoam, residual, residual field


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
Moving mesh Niklas Wikstrom (Wikstrom) OpenFOAM Running, Solving & CFD 122 June 15, 2014 07:20
Help for the small implementation in turbulence model shipman OpenFOAM Programming & Development 25 March 19, 2014 11:08
FvMatrix coefficients shrina OpenFOAM Running, Solving & CFD 10 October 3, 2013 15:38
AMI interDyMFoam for mixer nu problem danny123 OpenFOAM Programming & Development 8 September 6, 2013 03:34
Convergence moving mesh lr103476 OpenFOAM Running, Solving & CFD 30 November 19, 2007 15:09


All times are GMT -4. The time now is 10:22.