|
[Sponsors] |
January 2, 2019, 13:19 |
error in UDF
|
#1 |
New Member
iran
Join Date: Aug 2016
Posts: 20
Rep Power: 10 |
Hello
I want to define a velocity profile with UDF in ANSYS Fluent. velocity profile is according to law Logarithm. and I should use of the if expression in UDF code. but when I interpreted this UDF code I received parse error. I do not know why and I need to help me. Thanks a lot. my Code : #include "udf.h" /*define constant parameter*/ #define zmin 5.0; #define ustar 0.086; #define z0 0.3; #define uuniform 25.0; DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; real Uz, Z; face_t f; begin_f_loop(f, thread) { F_CENTROID(x, f, thread); Z= x[2]; if(Z< zmin) Uz= zmin; if(Z>zmin) Uz= (ustar / 0.4)*(double log (double (Z / z0))*uuniform; F_PROFILE(f, thread, position)=Uz; } end_f_loop(f, thread) } Last edited by soleimanian; January 4, 2019 at 07:12. |
|
January 2, 2019, 22:02 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
you forgot } at the end
next time put your error message here, so people may understand what is the problem best regards |
|
January 4, 2019, 07:18 |
|
#3 | |
New Member
iran
Join Date: Aug 2016
Posts: 20
Rep Power: 10 |
Quote:
Best regards |
||
January 6, 2019, 22:48 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Code:
#include "udf.h" /*define constant parameter*/ #define zmin 5.0 #define ustar 0.086 #define z0 0.3 #define uuniform 25.0 DEFINE_PROFILE(inlet_x_velocity, thread, position) { real x[ND_ND]; /* this will hold the position vector */ real Uz, Z; face_t f; begin_f_loop(f,thread) { F_CENTROID(x, f, thread); Z= x[2]; if (Z <= zmin) Uz = zmin; if (Z > zmin) Uz= (ustar / 0.4)*((double)log((double) (Z / z0))*uuniform); F_PROFILE(f, thread, position) = Uz; } end_f_loop(f, thread) } |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
udf for one dimensional linear motion based on force | maccheese | Fluent UDF and Scheme Programming | 2 | September 1, 2019 03:18 |
Save output of udf in another udf! | JuanJoMex | FLUENT | 0 | February 8, 2018 13:43 |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 01:53 |
UDF parallel error: chip-exec: function not found????? | shankara.2 | Fluent UDF and Scheme Programming | 1 | January 16, 2012 23:14 |
UDF, UDF, UDF, UDF | Luc SEMINEL | Main CFD Forum | 0 | November 25, 2002 05:01 |