|
[Sponsors] |
How to compute the gradient of a scalar as a post-processing |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
August 25, 2010, 06:06 |
How to compute the gradient of a scalar as a post-processing
|
#1 |
New Member
Join Date: Mar 2009
Posts: 29
Rep Power: 17 |
Hi foamers,
For some reasons, I need to compute the laplacian of a scalar, which is the divergency of the gradient of this scalar, as a post-processing. Thanks to foamCalc tool, I found the div operator and the magGrad operator ; but I'm struggling to find the grad operator. I suppose that if foamCalc can compute magGrad, ha can as well compute and write grad, but my poor knowledge in coding doesn't help me here. Does anyone know how to write the gradient of a scalar as a post-processing ? The answer may be simple, but as for now I didn't find it. Cheers, Fabien |
|
February 11, 2011, 05:43 |
|
#2 |
Senior Member
Andrea Ferrari
Join Date: Dec 2010
Posts: 319
Rep Power: 16 |
Hi ayoros,
Have you found any solution? I got the same problem with interfoam. I need the gradient of alpha1 (3 components, not the absolute value) in all the cell. Thanks andrea |
|
February 11, 2011, 22:53 |
|
#3 |
Senior Member
Santiago Marquez Damian
Join Date: Aug 2009
Location: Santa Fe, Santa Fe, Argentina
Posts: 452
Rep Power: 24 |
Hi guys, decompress the gzip tarball in your $HOME/OpenFOAM/<user>/applications directory and do wmake. It'll allow you to use solutionGradient post-process tool in your case directory that will give you the gradient of field T for each timestep. Change the code (line 74) to whatever scalarField you want. The gradient will be stored in gradient volVectorField
Enjoy!
__________________
Santiago MÁRQUEZ DAMIÁN, Ph.D. Research Scientist Research Center for Computational Methods (CIMEC) - CONICET/UNL Tel: 54-342-4511594 Int. 7032 Colectora Ruta Nac. 168 / Paraje El Pozo (3000) Santa Fe - Argentina. http://www.cimec.org.ar |
|
August 4, 2011, 10:17 |
|
#4 |
New Member
Join Date: May 2009
Posts: 1
Rep Power: 0 |
Dear FOAMers,
i compiled the solutionGradient-tool and switched the temperatur T to U, but Openfoam brings up this errormessage: ______________________________________________ --> FOAM FATAL IO ERROR: cannot open file file: /home/OpenFOAM/oeg-1.7.1/run/test/0/gradient at line 0. From function regIOobject::readStream() in file db/regIOobject/regIOobjectRead.C at line 61. FOAM exiting _______________________________________________ I tried the original file, but still the same Error occurred. Im not sure where the problem is, can somebody please help me Thx Oeg |
|
October 10, 2011, 11:56 |
|
#5 | |
Member
Eysteinn Helgason
Join Date: Sep 2009
Location: Gothenburg, Sweden
Posts: 53
Rep Power: 17 |
Quote:
You need to add a file in your latest time directory called gradient. In your case the easiest way would be to copy your U file and lower the dimensions for length by 1 ( second value in the dimensions) |
||
December 20, 2012, 14:56 |
0/gradient file
|
#6 | |
New Member
Jeff Freeman
Join Date: Mar 2012
Posts: 9
Rep Power: 14 |
Quote:
Could you please describe the 0/gradient file that we need to make when using your tool? I've tried using solutionGradient after modifying it for rho so that I can plot a numerical Schlieren image. I followed the following steps in making the 0/gradient file:
----------------------------------------------------------------------------------------------------- --> FOAM FATAL ERROR: Attempt to cast type N4Foam5token8CompoundINS_4ListIdEEEE to type N4Foam5token8CompoundINS_4ListINS_6VectorIdEEEEEE From function dynamicCast<To>(From&) in file /opt/openfoam211/src/OpenFOAM/lnInclude/typeInfo.H at line 93. FOAM aborting ----------------------------------------------------------------------------------------------------- A more complete description and possibly a sample case would be very much appreciated. Thank you for your help, -Jeff |
||
January 11, 2013, 04:37 |
|
#7 | |
Member
Eysteinn Helgason
Join Date: Sep 2009
Location: Gothenburg, Sweden
Posts: 53
Rep Power: 17 |
Quote:
Have you managed to solve this? /Eysteinn |
||
January 11, 2013, 07:30 |
|
#8 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
funkySetFields -latestTime -create -field gradRho -expression "grad(rho)" (adaption for U is trivial)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
January 11, 2013, 10:41 |
|
#9 |
Member
Eysteinn Helgason
Join Date: Sep 2009
Location: Gothenburg, Sweden
Posts: 53
Rep Power: 17 |
||
January 11, 2013, 10:54 |
|
#10 |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
But not as much fun (==challenge) I'm afraid
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
|
January 11, 2013, 13:28 |
|
#11 | |
New Member
Jeff Freeman
Join Date: Mar 2012
Posts: 9
Rep Power: 14 |
Quote:
I'm in the process of acquiring swak4Foam so that I can use funkySetFields. Unfortunately, there seems to be a copyright issue going on with openFoam-extend on SourceForge and I am unable to download the program (either through svn or via tarball). Does anybody know an alternate way of getting the program? Cheers, Jeff |
||
January 11, 2013, 15:15 |
|
#12 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
Usually the development version I pushed to a public repository only has finished features (so WHAT is there should work) but occasionally I broke stuff without knowing it. The releases are more thoroughly checked. If you don't want to live on the bleeding edge: the webinterface at bitbucket allows downloading the sources in the state of the last release. That would be The version for OpenFOAM 2.x https://bitbucket.org/bgschaid/swak4...0.2.1_v2.x.zip For OpenFOAM 1.x https://bitbucket.org/bgschaid/swak4...sion_0.2.1.zip If you chose to use one of these links and it worked for you could you please gibe me feedback and I'll add the links to the Wiki-page (or you can add them)
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
January 15, 2013, 00:00 |
|
#13 | |
New Member
Jeff Freeman
Join Date: Mar 2012
Posts: 9
Rep Power: 14 |
Quote:
Hi Bernhard, Sorry for the late reply; I had some other things come up. I began with the link for the version associated with OpenFOAM 2.x, but I underestimated how long it would take to install. When my terminal stopped outputting information for a (seemingly) long time, I canceled it and tried the development version from Mercurial. After seeing that it was the same, I gave it some more patience. It installed without any problems and preliminary uses (i.e. gradients of rho and U) are working just fine. I can't wait to find out what else this tool comes with! Thanks, Jeff |
||
January 15, 2013, 04:23 |
|
#14 | |
Assistant Moderator
Bernhard Gschaider
Join Date: Mar 2009
Posts: 4,225
Rep Power: 51 |
Quote:
__________________
Note: I don't use "Friend"-feature on this forum out of principle. Ah. And by the way: I'm not on Facebook either. So don't be offended if I don't accept your invitation/friend request |
||
January 15, 2013, 11:56 |
|
#15 | |
New Member
Jeff Freeman
Join Date: Mar 2012
Posts: 9
Rep Power: 14 |
Quote:
|
||
August 7, 2015, 05:48 |
|
#16 |
Senior Member
Freedom
Join Date: May 2014
Posts: 209
Rep Power: 13 |
Dear Santiago,
Do you know how to implement gradient explicit in a solver? That means we do not use the schemes in the OF, but code them directly in solver. I want to calculate the gradient explicitly for special use. ----I want to implement sign distance function into OF. mag(Grad(phi)) =1 |
|
March 21, 2018, 07:02 |
|
#17 |
Senior Member
Join Date: Sep 2015
Location: Singapore
Posts: 102
Rep Power: 11 |
Hello Foamers,
For those who don't have funkySetFields, here's the grad function implemented through foamCalc. Steps
Hope this helps. Regards, USV |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
dieselFoam problem!! trying to introduce a new heat transfer model | vivek070176 | OpenFOAM Programming & Development | 10 | December 24, 2014 00:48 |
post processing for KIVA | dirga | Main CFD Forum | 5 | April 23, 2009 11:58 |
Gradient of Scalar calculation in 3D BFCskew grids | james T | Phoenics | 0 | March 28, 2007 08:12 |
Post Processing in FEM | Abhijit Tilak | Main CFD Forum | 0 | April 26, 2004 12:59 |
How to compute gradient for non-orthogonal grids? | Paul Hsieh | Main CFD Forum | 3 | November 11, 2003 05:52 |