How to compute the gradient of a scalar as a post-processing
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 |
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 |
1 Attachment(s)
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! |
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 |
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) |
0/gradient file
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 |
Quote:
Have you managed to solve this? /Eysteinn |
Quote:
funkySetFields -latestTime -create -field gradRho -expression "grad(rho)" (adaption for U is trivial) |
Quote:
|
Quote:
|
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 |
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) |
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 |
Quote:
|
Quote:
|
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 |
1 Attachment(s)
Hello Foamers,
For those who don't have funkySetFields, here's the grad function implemented through foamCalc. Steps
Hope this helps. Regards, USV |
All times are GMT -4. The time now is 18:59. |