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

Cell areas in a patch

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 2, 2014, 08:59
Default Cell areas in a patch
  #1
New Member
 
Euan Foster
Join Date: Jan 2014
Posts: 12
Rep Power: 12
EFoster2 is on a distinguished road
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?
EFoster2 is offline   Reply With Quote

Old   April 5, 2014, 09:59
Default
  #2
New Member
 
Euan Foster
Join Date: Jan 2014
Posts: 12
Rep Power: 12
EFoster2 is on a distinguished road
The answer

http://www.cfd-online.com/Forums/ope...nt-planes.html
EFoster2 is offline   Reply With Quote

Old   June 21, 2019, 14:51
Default quick regex solution
  #3
Member
 
Join Date: Feb 2016
Posts: 41
Rep Power: 10
LeeRuns is on a distinguished road
TLDR:use this regex code, only tested in openfoam 4!
Code:
postProcess -func 'patchIntegrate(name=somePatchName,someFiledName)' | grep -Po "((?<=total area   =).*([0-9])*)"
Full Description:
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
  1. change directory to case you want to analyze
  2. punch this in
    (must replace somePatchName, someFieldName

    Code:
    postProcess -func 'patchIntegrate(name=somePatchName,someFiledName)' | grep -Po "((?<=total area   =).*([0-9])*)"

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])*)"
that will print the value to the terminal, in reality this will work with most programming languages bc they all support regex.







While the openfoam naitive compilation is a great solution. Here is a a

Last edited by LeeRuns; June 21, 2019 at 14:54. Reason: cleaning up spacing
LeeRuns is offline   Reply With Quote

Reply

Tags
cell, cell area, patch


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
AMI speed performance danny123 OpenFOAM 21 October 24, 2020 04:13
[CGNS] CGNS converters available mbeaudoin OpenFOAM Meshing & Mesh Conversion 137 December 14, 2018 04:20
Possible Bug in pimpleFoam (or createPatch) (or fluent3DMeshToFoam) cfdonline2mohsen OpenFOAM 3 October 21, 2013 09:28
Cyclic Boundary Condition Luiz Eduardo Bittencourt Sampaio (Sampaio) OpenFOAM Running, Solving & CFD 36 July 2, 2012 12:23
Multicomponent fluid Andrea CFX 2 October 11, 2004 05:12


All times are GMT -4. The time now is 09:57.