|
[Sponsors] |
August 18, 2017, 21:19 |
Computing Patch Average During Simulation
|
#1 |
New Member
Join Date: Nov 2016
Posts: 10
Rep Power: 10 |
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. |
|
August 29, 2017, 13:28 |
Post-processing Function Object Definitions
|
#2 |
New Member
Join Date: Nov 2016
Posts: 10
Rep Power: 10 |
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! |
|
November 28, 2018, 06:23 |
|
#3 | ||
New Member
Arthur
Join Date: Oct 2018
Location: Glasgow
Posts: 20
Rep Power: 8 |
Quote:
I was wondering what file you have the first section of code in?: Quote:
Thanks, Arthur Last edited by amdk136; November 28, 2018 at 06:25. Reason: formatting |
|||
Tags |
co-processing, patch average, post processing |
|
|
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 |
[OpenFOAM.org] Compile OF 2.3 on Mac OS X .... the patch | gschaider | OpenFOAM Installation | 225 | August 25, 2015 20:43 |
[Commercial meshers] Using starToFoam | clo | OpenFOAM Meshing & Mesh Conversion | 33 | September 26, 2012 05:04 |
chtMultiRegionFoam Tutorial | m.nichols19 | OpenFOAM | 12 | September 9, 2010 12:56 |
[Other] StarToFoam error | Kart | OpenFOAM Meshing & Mesh Conversion | 1 | February 4, 2010 05:38 |