CFD Online Discussion Forums

CFD Online Discussion Forums (
-   CFX (
-   -   Log-law velocity profile in CFX-Pre (

jm2011 February 29, 2012 03:57

Log-law velocity profile in CFX-Pre
Hi guys,

I would like to model wind flow over a terrain using a log-law velocity profile for my inlet. I have modelled a rectangular prism and assigned one of the faces to be my inlet. Unfortunately I'm not very good with the syntax used in expressions, so I am continuously facing error messages, which I'm not sure how to fix.

The main error is "Argument dimensions resolve to 'm'; expected '<dimensionless>" when I using the "Uz" expression for the inlet velocity:

ufric = 0.35
hz = z
kappa = 0.4
z0 = 0.0001
Uz = (ufric/kappa)*loge(hz/z0) [m s^-1]

Obviously hz is in meters and will change with the height of the inlet face, but CFX-Pre won't accept a non-dimensional value in the loge function...?

Also is it necessary to specify the min and max z values of the inlet face?

I appreciate your help!

Lance February 29, 2012 04:09

Yep, loge (or ln) wont accept an argument with dimensions, see cfx_ref.pdf at page 168 (for version 14). Just normalize it with /1[m] or make z0 = 0.0001 [m] and you should be fine. If you want your inlet expression to go all the way to the top (assuming z= 0 at the bottom) then you dont need to set any min/max values.

jm2011 February 29, 2012 04:54

Cool, thanks for that!

I tried doing that actually, but when I subsequently ran the simulation, it terminates with the following error:

"The problem was encountered in executing the expression for: |
| Uz |
| The complete expression is: |
| (Ufric/kappa)*loge(hz/z0[m]) [m s^-1] |
| The error occurs on sub-expression: |
| loge(hz/z0[m])" it must still not like this expression somehow...


Lance February 29, 2012 05:00

Yes, when z = 0 it will result in loge(0) which is undefined, thats why you get an error. One thing you could try is loge((hz+eps)/z0[m]) where eps is a very small number. But be aware that it might give you the wrong solution close to the wall.

jm2011 February 29, 2012 05:16

Awesome, thanks Lance!

I understand that there is likely to be an error, but I assume it will be pretty small if you choose the added value to be very small.
In fact, I used the same value as for z0 because then at z=0, log(1)=0, which would correspond to reality where wind velocity is zero at the ground.
Perhaps this is still an acceptable method for a large domain.


All times are GMT -4. The time now is 19:32.