Computing Patch Average During Simulation
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. |
Post-processing Function Object Definitions
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! |
Quote:
I was wondering what file you have the first section of code in?: Quote:
Thanks, Arthur |
All times are GMT -4. The time now is 19:08. |