|
[Sponsors] |
March 1, 2016, 10:47 |
Flow past a cylinder
|
#1 |
New Member
VISHNU
Join Date: Jan 2016
Posts: 13
Rep Power: 10 |
Following is my UDF for imparting a particular velocity along the cylinder surface.Though the UDF got compiled but the mathematical functions and (execute at end) is not executed...
What might be the reason...Pls help #include <udf.h> #include <math.h> static real k; DEFINE_EXECUTE_AT_END(execute_at_end) { real time; time = RP_Get_Real("flow-time"); if(time>190) { k=10; } else { k=0; } } DEFINE_PROFILE(cylinder_x_velocity, t, i) /* cylinder x velocity = name of the x velocity */ { real y,x; /* variable declarations */ real z[ND_ND]; face_t f; begin_f_loop(f, t) /* thread = given boundary zone, defined automatically when the UDF is hooked to cylinder boundary, the macro begin_f_loop is applied to all the cell faces*/ { F_CENTROID(z,f,t); /* the coordinates of the face centroid accessed by F_CENTROID */ x = z[0]; y = z[1]; /* this will hold the position vector */ if(((x*x)+(y*y)==.25)&&(y>=0)) { F_PROFILE(f,t,i)=k*y/sqrt((x*x)+(y*y)); /* return velocity is assigned through F_PROFILE */ } if(((x*x)+(y*y)==.25)&&(y<0)) { F_PROFILE(f,t,i)=-k*y/sqrt((x*x)+(y*y)); /* return velocity is assigned through F_PROFILE */ } } end_f_loop(f, t) } DEFINE_PROFILE(cylinder_y_velocity, t, i) /* cylinder y velocity = name of the y velocity */ { real y,x; /* variable declarations */ real z[ND_ND]; face_t f; { begin_f_loop(f, t) /* thread = given boundary zone, defined automatically when the UDF is hooked to cylinder boundary, the macro begin_f_loop is applied to all the cell faces*/ { F_CENTROID(z,f,t); /* the coordinates of the face centroid accessed by F_CENTROID */ x = z[0]; y = z[1]; /* this will hold the position vector */ if(((x*x)+(y*y)==.25)&&(x>=0)) { F_PROFILE(f,t,i)=k*x/sqrt((x*x)+(y*y)); /* return velocity is assigned through F_PROFILE */ } if(((x*x)+(y*y)==.25)&&(x<0)) { F_PROFILE(f,t,i)=-k*x/sqrt((x*x)+(y*y)); /* return velocity is assigned through F_PROFILE */ } } end_f_loop(f, t) } } |
|
March 20, 2016, 05:40 |
|
#2 |
Member
Kuldeep
Join Date: Mar 2016
Posts: 33
Rep Power: 10 |
Hi!!
You can write to me on ksingh[at]tserc[dot]in |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
2D modelling of flow past a rotating cylinder | pds24 | Main CFD Forum | 1 | August 21, 2015 10:50 |
Flow past an oscillating cylinder (Strouhal number) | o_mars_2010 | Main CFD Forum | 8 | May 23, 2014 04:25 |
Flow past rotating cylinder | sam.ho | OpenFOAM Running, Solving & CFD | 4 | October 10, 2013 07:49 |
CFD help: flow past cylinder | harsha00711 | Main CFD Forum | 1 | December 24, 2010 21:19 |
meshing for flow past a cylinder | karthik | FLUENT | 1 | July 15, 2005 06:17 |