|
[Sponsors] |
June 9, 2017, 04:06 |
Vibrating membrane UDF doubt
|
#1 |
Member
Ravi
Join Date: May 2017
Posts: 31
Rep Power: 8 |
Hello everyone!
I am currently working on a project which involves the simulation of Colgate toothpaste on a vibrating membrane in ANSYS Fluent. I would require the input of the vibrating membrane as its velocity, which is a sinusoidal function of space and time. For this, I have written a UDF, which isn't working due to errors in the code. Could someone please help me in this regard? This is really urgent. The UDF is as follows: #include "udf.h" #include "dynamesh_tools.h" #define pi 3.1416 DEFINE_GEOM(plane,domain,dt,position) { position[1]=0.001; } DEFINE_GRID_MOTION(inlet_y_velocity,d,dt,time,dtim e) { Thread *t; real y[ND_ND]; real x_c; face_t f; real v; Node *w; int n; real sign; SET_DEFORMING_THREAD_FLAG(THREAD_TO(t)); sign=.015*cos((pi*x_c)/.08); begin_f_loop(f,t) { f_node_loop(f,t,n) { w = F_NODE(f,t,n); if (NODE_X(v)>0 && NODE_X(v)<0.08 && NODE_Y(v)==0 && NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); v=sign*sin(2*pi*120*time); } end_f_loop(f,t) } } } |
|
June 12, 2017, 19:44 |
Errors, typo, simplify?
|
#2 |
Senior Member
Svetlana Tkachenko
Join Date: Oct 2013
Location: Australia, Sydney
Posts: 407
Rep Power: 14 |
Hi,
I've not done mesh movement before, but here is a few uneducated suggestions: 1. What errors do you get? They usually help to identify the problem. 2. You seem to have a typo as I highlighted below. 3. Try to simplify your problem - reduce it to something meaningless but functional. For example, specify a zero mesh motion value and observe that the mesh is not moving; specify a constant non-zero value and observe how the mesh moves. #include "udf.h" #include "dynamesh_tools.h" #define pi 3.1416 DEFINE_GEOM(plane,domain,dt,position) { position[1]=0.001; } DEFINE_GRID_MOTION(inlet_y_velocity,d,dt,time,dtim e) // remove the space, it should be 'dtime' ? { Thread *t; real y[ND_ND]; real x_c; face_t f; real v; Node *w; int n; real sign; SET_DEFORMING_THREAD_FLAG(THREAD_TO(t)); sign=0.015*cos((pi*x_c)/.08); // I added '0' just in case '0.015' is better than .015 begin_f_loop(f,t) { f_node_loop(f,t,n) { w = F_NODE(f,t,n); if (NODE_X(v)>0 && NODE_X(v)<0.08 && NODE_Y(v)==0 && NODE_POS_NEED_UPDATE(v)) { NODE_POS_UPDATED(v); v=sign*sin(2*pi*120*time); // The example from documentation has this stuff, maybe you should add it? // NV_VV (rvec, =, NODE_COORD (v), -, origin); //NV_CROSS (dx, omega, rvec); //NV_S (dx, *=, dtime); //NV_V (NODE_COORD (v), +=, dx} end_f_loop(f,t) } } } |
|
June 20, 2017, 07:12 |
|
#3 |
Member
Ravi
Join Date: May 2017
Posts: 31
Rep Power: 8 |
Dear Svetlana,
Thank you for your reply. I have already made the necessary changes to the code in order to obtain the desired motion of the vibrating membrane. Thank you for your help. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF Compilation Error - Loading Library - COMMON Problem! Help! | robtheslob | Fluent UDF and Scheme Programming | 8 | July 24, 2015 00:53 |
Hooking UDF for membrane simulation | ehkhor | FLUENT | 0 | April 28, 2010 04:49 |
UDF for vibrating membrane | Sherif | FLUENT | 0 | November 9, 2004 10:17 |
Vibrating / Deforming Wall UDF | Qureshi | FLUENT | 2 | January 16, 2004 04:48 |
UDF...UDF...UDF...UDF | Luc SEMINEL | FLUENT | 0 | November 25, 2002 04:03 |