Cell areas in a patch
Dear all,
I have a trapezoidal pipe network that I have completed a simulation for. I now need to find the area-weighted average of the wall shear stress of which I need to know the cell area. Previously all my simulation have been with rectangular cross sections so I have been able to find out the cell area with ease by doing it manually. I have come across this post about finding the cell areas: http://www.cfd-online.com/Forums/ope...rea-patch.html and that subsequently refers you to this post: http://www.cfd-online.com/Forums/ope...tml#post297002 They suggest various lines of code to be implemented. But since I am a pretty new user of openFoam and linux in general, I am not too sure of how and where they are implementing this code? Does anyone have any suggestions? Or an alternative technique? |
|
quick regex solution
TLDR:use this regex code, only tested in openfoam 4! ;)
Code:
postProcess -func 'patchIntegrate(name=somePatchName,someFiledName)' | grep -Po "((?<=total area =).*([0-9])*)" By using the postProcess function utility we can check the value of a field such as U,p,k,nut, T over a whole patch. To be able to have the integrated value the computer must have an area. Luckily that area gets printed when we perform a funciton such as integrate velocity over a face. So then you can just use regex string to manipulate the return from openfoam. Notes that I am not a regex star, so i did an exact string which requires that there is a line with 'total area' followed by 3 spaces and then an equals sign. If someone else has a better solution then pls supply :D 1. GO TO THE CASE DIRECTORY
Here is an applied example in which the "inlet" patch is the one i want to find the area of and I use the U field to get it's area printed. This works because my simulation calculates the velocity. Whether the velocity is a set value or is varied by the solver is irrelevant. Code:
postProcess -func 'patchIntegrate(name=inlet,U)' | grep -Po "((?<=total area =).*([0-9])*)" While the openfoam naitive compilation is a great solution. Here is a a |
All times are GMT -4. The time now is 09:41. |