UDF-Source term
Hello everybody. I have UDF code for define face area but I don't know how can I use it in a source term which is (Ro*u*A)/L, Ro= density, u=velocity, A=area, L= length!!!
this code is for face area but I don't know how can I use it in above source term I am new in UDF!! please help me :) DEFINE_ON_DEMAND(calculate_area) { Domain *d = Get_Domain(1); Thread *ft; face_t f; real area = 0.; thread_loop_f(ft,d) { begin_f_loop(f,ft) { real NV_VEC(farea); F_AREA(farea,f,ft); area = NV_MAG(farea); } end_f_loop(f,ft) } } |
what kind of area you want to get?
Area of Single cell or all the cells? |
Quote:
I think I should get Area of each face( single face)!!! |
Quote:
the geometry data such as area is stored in mixture domain. I my opinion, you can define a Define on demand function to access the cell face area data and stored them in a udm. then defined a source term utilize the udm. If anybody have better ideas, please notice me. |
Quote:
Thanks for your suggestion. would you please help me to write a UDF as you suggest me? really how can I write a udm and then defined a source term utilize the udm.???? I am new in UDF :( but read alot! thanks regards |
Quote:
I mostly deals with cell data macros. For cell udm, you just simply need to set udm in the GUI console Define->user defined-> user defined memory Set the udm to be the number of udm utilized in the udf In the case of cell udm, for example I want to store cell volume in udm I just simply need to write: DEFINE_ON_DEMAND(name) { Domain *d=Get_Domain(1); Thread *t; cell_t c; thread_loop_c { begin_c_loop { C_UDMI(c,t,0)=C_VOLUME(c,t) } end_c_loop } DEFINE_SOURCE(name,c,t,dS,eqn) /* For example, source = 1/cell_volume */ { real source; source = 1/C_UDMI(c,t,0); /* I'm not sure if it works without Define_on _demand just use source = 1/C_VOLUME(c,t), you can have a try~ :) */ return source; } In the case of face area, you might just need to change cell related macros into face related ones.. Hope it helps. Good Luck |
Hi, Dear mingresal
Thanks for your help. I appreciate for your reply to my last post:) regards zohreh |
velocity inlet udf
hiii friends i am entirely new to using udf's in fluent. I have a cubical geometry, with two inlets on perpendicular adjacent faces. i have to implement udf to only one of the conditions.
i have two cases 1) parabolic velocity inlet ( space varient) 2) sinusodial velocity velocity inlet ( time variant) can any one pls send me the udf ( codes) ... |
All times are GMT -4. The time now is 01:34. |