|
[Sponsors] |
Conditional array manipulation in order to avoid negative components |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 23, 2013, 12:09 |
Conditional array manipulation in order to avoid negative components
|
#1 |
Member
Marcus Letzel
Join Date: Sep 2012
Location: Bremen
Posts: 35
Rep Power: 13 |
Dear Foamers,
in a modified LES solver, I calculate the turbulence intensity Iav from Uav and U2av as follows: Code:
Uav = ( Uav*(time-startAveraging) + U*dt ) / (time-startAveraging + dt); for ( int i = 1; i <= 3; ++i) { U2av.component(i) = ( U2av.component(i)*(time-startAveraging) + sqr(U.component(i))*dt ) / (time-startAveraging + dt); } for ( int i = 1; i <= 3; ++i) { Iav.component(i) = sqrt( U2av.component(i) - sqr( Uav.component(i) ) ) / ( mag(Uav)+magUTinyOffset ); // avoid zero division } In Fortran, the WHERE function lets you conditionally manipulate arrays: Code:
WHERE(array<0.0) array=0.0 Best regards, Marcus |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Other] mesh airfoil NACA0012 | anand_30 | OpenFOAM Meshing & Mesh Conversion | 13 | March 7, 2022 17:22 |
2nd order boundary conditions for 2nd order discretization? | quarkz | Main CFD Forum | 30 | December 26, 2011 07:12 |
[CFX] How to avoid negative temperatures? | rogbrito | CFX | 3 | February 15, 2010 05:59 |
Turbo components order in Blade-to-Blade View | Aladdin | CFX | 0 | March 17, 2007 09:01 |
hankel negative order | sankar | Main CFD Forum | 1 | June 16, 2006 06:12 |