|
[Sponsors] |
Request for UDF code explanation: calculation of a specific alpha expression |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
March 25, 2015, 18:36 |
Request for UDF code explanation: calculation of a specific alpha expression
|
#1 |
Member
Join Date: Mar 2015
Posts: 30
Rep Power: 11 |
Can anyone please explain the meaning of the sentence "alpha = M_PI/2. - acos(MAX(-1.,MIN(1.,NV_DOT(normal,p->state.V)/MAX(NV_MAG(p->state.V),DPM_SMALL))));".
|
|
March 25, 2015, 19:44 |
|
#2 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Where did you get this equation from and what is this equation describing?
The first term, M_PI/2., is simply . Let's now analyse the second term by expanding the brackets to make some sense of this line of code: Code:
-acos( MAX( -1., MIN( 1., NV_DOT(normal,p->state.V)/MAX(NV_MAG(p->state.V),DPM_SMALL) ) ) ); "p->state.V" is the velocity vector; could also be accessed with C_U(c,t). DPM_SMALL is a small number. |
|
March 25, 2015, 19:58 |
|
#3 |
Member
Join Date: Mar 2015
Posts: 30
Rep Power: 11 |
Quote:
|
|
March 25, 2015, 20:08 |
|
#4 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
The inverse cosine function is real only if evaluated between -1 and 1. The MIN() and MAX() functions restrict the input value to between -1 and 1 to avoid imaginary/garbage numbers as an output.
|
|
March 25, 2015, 20:32 |
|
#5 | |
Member
Join Date: Mar 2015
Posts: 30
Rep Power: 11 |
Quote:
|
||
March 25, 2015, 20:55 |
|
#6 |
Senior Member
Join Date: Mar 2015
Posts: 892
Rep Power: 18 |
Have a read of scalar projection to understand the mathematics.
The equation this code is solving: where is the normal vector of the wall and is the velocity vector of the particle. Ideally, the corresponding code: Code:
alpha = M_PI/2. - acos(NV_DOT(normal,p->state.V)/NV_MAG(p->state.V)); |
|
March 25, 2015, 21:31 |
|
#7 | |
Member
Join Date: Mar 2015
Posts: 30
Rep Power: 11 |
Quote:
|
||
Tags |
dpm fluent |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
alphaEqn.H in twoPhaseEulerFoam | cheng1988sjtu | OpenFOAM Bugs | 15 | May 1, 2016 17:12 |
Specific OpenFOAM Code | pbhuter | OpenFOAM | 13 | June 30, 2012 20:06 |
How to install CGNS under windows xp? | lzgwhy | Main CFD Forum | 1 | January 11, 2011 19:44 |
CGNS lib and Fortran compiler | manaliac | Main CFD Forum | 2 | November 29, 2010 07:25 |
Design Integration with CFD? | John C. Chien | Main CFD Forum | 19 | May 17, 2001 16:56 |