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

Computing Patch Average During Simulation

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   August 18, 2017, 20:19
Default Computing Patch Average During Simulation
  #1
New Member
 
Join Date: Nov 2016
Posts: 6
Rep Power: 3
victorious_BIG is on a distinguished road
Hi,

I spent some time trying to figure out an effective way to calculate the average of a scalar quantity of over a patch while the solver is iterating. I appended the code below to the bottom of my solver. In this example, the patch of interest is named "outlet":


runTime.write();

const label& patchID = mesh.boundaryMesh().findPatchID("outlet");
const fvPatch& outletPatch = mesh.boundary()[patchID];
const fvPatchField<scalar>& T =
outletPatch.lookupPatchField<volScalarField, scalar>("T");

Info << "Average Outlet Temp: "
<< sum(T * T.patch().magSf()) / sum(T.patch().magSf()) << endl;


This gave me the same result as running the post processing command from the terminal prompt:

>> postProcess -func 'patchAverage(name=outlet,T)'

Note: I have only tested this on a regular mesh.

I'd be happy to hear feedback as to whether there is a more effective/efficient method to do this than what I have written above.
victorious_BIG is offline   Reply With Quote

Old   August 29, 2017, 12:28
Default Post-processing Function Object Definitions
  #2
New Member
 
Join Date: Nov 2016
Posts: 6
Rep Power: 3
victorious_BIG is on a distinguished road
Hi,

I have been trying to search the source code for the location of the function object definitions. For example, in my post above I am using a possible definition to determine an average concentration. I've tried to find the location of the function object definitions in the source code using oxygen but haven't had much luck.

Does anyone know where the specific source code files for the function definition is located?

Thanks!
victorious_BIG is offline   Reply With Quote

Reply

Tags
co-processing, patch average, post processing

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Near wall treatment in k-omega SST Arnoldinho OpenFOAM Running, Solving & CFD 38 March 8, 2017 14:48
Compile OF 2.3 on Mac OS X .... the patch gschaider OpenFOAM Installation on Windows, Mac and other Unsupported Platforms 225 August 25, 2015 19:43
Using starToFoam clo OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 33 September 26, 2012 04:04
chtMultiRegionFoam Tutorial m.nichols19 OpenFOAM 12 September 9, 2010 11:56
StarToFoam error Kart OpenFOAM Meshing & Mesh Conversion 1 February 4, 2010 05:38


All times are GMT -4. The time now is 16:10.