|
[Sponsors] |
April 2, 2014, 09:59 |
Cell areas in a patch
|
#1 |
New Member
Euan Foster
Join Date: Jan 2014
Posts: 12
Rep Power: 12 |
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? |
|
April 5, 2014, 10:59 |
|
#2 |
New Member
Euan Foster
Join Date: Jan 2014
Posts: 12
Rep Power: 12 |
||
June 21, 2019, 15:51 |
quick regex solution
|
#3 |
Member
Join Date: Feb 2016
Posts: 41
Rep Power: 10 |
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 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 Last edited by LeeRuns; June 21, 2019 at 15:54. Reason: cleaning up spacing |
|
Tags |
cell, cell area, patch |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
AMI speed performance | danny123 | OpenFOAM | 21 | October 24, 2020 05:13 |
[CGNS] CGNS converters available | mbeaudoin | OpenFOAM Meshing & Mesh Conversion | 137 | December 14, 2018 05:20 |
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) | cfdonline2mohsen | OpenFOAM | 3 | October 21, 2013 10:28 |
Cyclic Boundary Condition | Luiz Eduardo Bittencourt Sampaio (Sampaio) | OpenFOAM Running, Solving & CFD | 36 | July 2, 2012 13:23 |
Multicomponent fluid | Andrea | CFX | 2 | October 11, 2004 06:12 |