|
[Sponsors] |
August 8, 2019, 14:32 |
fieldAverage and coded function
|
#1 |
Member
Joaquín Neira
Join Date: Oct 2017
Posts: 38
Rep Power: 9 |
Hello,
I'm trying to calculate the turbulence intensity of my simulation. the formula for this is: or, in terms of openFoam: So, my idea is to use the fieldAverage function: Code:
fieldAverage1 { type fieldAverage; libs ("libfieldFunctionObjects.so"); writeControl writeTime; restartOnRestart true; restartOnOutput false; periodicRestart true; restartPeriod 5; fields ( U { mean on; prime2Mean off; base time; } ); } Code:
turbulenceIntensity { functionObjectLibs ("libutilityFunctionObjects.so"); type coded; writeControl writeTime; name writeTurbulenceIntensity; codeWrite #{ const volVectorField& U = mesh().lookupObject<volVectorField>("U"); const volVectorField& Umean = mesh().lookupObject<volVectorField>("Umean"); volScalarField turbulenceIntensity ( IOobject ( "turbulenceIntensity", mesh().time().timeName(), mesh(), IOobject::NO_READ, IOobject::AUTO_WRITE ), sqrt(1.0/3.0)*mag(U-Umean)/mag(Umean) ); turbulenceIntensity.checkIn(); #}; } Code:
... turbulenceIntensity { mean on; prime2Mean off; base time; } ... How can I do this? |
|
October 2, 2019, 10:14 |
|
#2 |
New Member
Emily
Join Date: Nov 2017
Posts: 24
Rep Power: 9 |
Hi,
OpenFOAM already has a postprocessing function for turbulence intensity. You can include this in your controlDict to write out the TI field during run time - simply include #includeFunc turbulenceIntensity in your functions section. Emily |
|
Tags |
fieldaverage, registry, turbulence intensity |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Initialization of symmTensor by a coded function | jsagg | OpenFOAM Programming & Development | 5 | April 22, 2023 07:21 |
Unknown function type loadPsiThermoModel | immortality | OpenFOAM Running, Solving & CFD | 1 | June 9, 2017 08:50 |
coded function object and field average | matthias | OpenFOAM Post-Processing | 3 | June 30, 2014 05:52 |