# UDF Problem

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 March 4, 2004, 13:51 UDF Problem #1 ozgur Guest   Posts: n/a Hi all, I have written an UDF (attached below) in order to calculate the volume weighted falling velocity of my free falling droplet, and use this velocity as the velocity inlet boundary condition. With this UDF, I hope to fix my falling drop in the calculation domain, so I can use a smaller domain, which is refined at the 2-phase interface on the drop. The UDF is interpreted succesfully, but the problem is, when I try to hook it at the velocity inlet BC panel, the program hangs like it gets into an infinite loop. So I have to kill the fluent session. Does any one have a suggestion about that? Thanks in advance, here is the UDF: #include "udf.h" #include "sg_mphase.h" DEFINE_PROFILE(fall_velocity,thread,nv) { real fall_vel_drop; real fall_vel_volweighted; real vol_tot; face_t f; cell_t c; Thread *t_phase2=THREAD_SUB_THREAD(thread,1); begin_c_loop(c, t_phase2) { fall_vel_volweighted += C_V(c,t_phase2)*C_VOLUME(c,t_phase2); vol_tot += C_VOLUME(c,t_phase2); } end_c_loop(c, t_phase2) fall_vel_drop=fall_vel_volweighted/vol_tot; printf("Volume average y_velocity of drop: %g\n",fall_vel_drop); begin_f_loop(f,thread) { F_PROFILE(f,thread,nv)=fall_vel_volweighted/vol_tot; } end_f_loop(f,thread) }

 March 5, 2004, 06:28 Re: UDF Problem #4 ozgur Guest   Posts: n/a Thanks Thomas, I've tried your suggestion. But the problem still exist. When I hook it after I initilize and patch my drop, I get the following output (at least something): Volume average y_velocity of drop:0 Volume average y_velocity of drop:0 which is correct for the beginning, but then the fluent hanged again. When I hook the UDF before I initialize and patch the drop, then I am able to hook it at velocity inlet BC without any failure, but then, when I try to initialize the solution, the same problem comes again, and fluent is hanged. Program seems to get into an endless loop, and I don't understand why! here is the corrected UDF once again: #include "udf.h" #include "sg_mphase.h" DEFINE_PROFILE(fall_velocity,thread,nv) { real fall_vel_drop; real fall_vel_volweighted; real vol_tot; face_t f; cell_t c; Thread *t_phase2=THREAD_SUB_THREAD(THREAD_T0(thread),1); begin_c_loop(c, t_phase2) { fall_vel_volweighted += C_V(c,t_phase2)*C_VOLUME(c,t_phase2); vol_tot += C_VOLUME(c,t_phase2); } end_c_loop(c, t_phase2) fall_vel_drop=fall_vel_volweighted/vol_tot; printf("Volume average y_velocity of drop: %g\n",fall_vel_drop); begin_f_loop(f,thread) { F_PROFILE(f,thread,nv)=fall_vel_volweighted/vol_tot; } end_f_loop(f,thread) }

 March 5, 2004, 07:40 Re: UDF Problem #5 thomas Guest   Posts: n/a which model are you using ?

 March 5, 2004, 08:03 Re: UDF Problem #6 ozgur Guest   Posts: n/a hi, My model is: 2D dp, segregated, VOF, laminar, unsteady.

 March 5, 2004, 09:04 Re: UDF Problem #7 ozgur Guest   Posts: n/a I have tried it on 3D case, and it did not work either.

 March 5, 2004, 10:58 Re: UDF Problem #9 ozgur Guest   Posts: n/a I really appreciate that you give your time and help me. I have almost 1 month left to deadline of my ms. thesis, and still fighting with fluent! I've tried your suggestions. I've recognised that I was hooking it to "velocity magnitude" in the velocity inlet panel. Since I am intersted only with the velocity component in the direction of the falling drop (-y direction), I try to hook it to "y-velocity" using the velocity specification method of "components". Now it is not hanged, but it causes SEGMENTATION VIOLATION error. I feel that it tries to get or access a parameter, that it should not or not allowed to. But, I feel that I am getting closer to the solution, with your support

 March 5, 2004, 11:21 Re: UDF Problem #10 thomas Guest   Posts: n/a SEGMENTATION VIOLATION error CAN be due to UDMI undeclared. Go to DEFINE > UDF > memory and declare your UDMI number. I confirm that depending on your number of cells and your number of iteration per time step, the way you programm your UDF will be very demanding in computation time. Do not hesitate to ask if you want a better way asking for less computation time. thomas

 March 5, 2004, 11:58 Re: UDF Problem #11 ozgur Guest   Posts: n/a But I did not use User Defined Memory macros in my UDF. Why should I initialize UDMI? Do you mean that there is a more efficient way to do the same task, that is, to calculate the falling velocity of my drop, and to use it in a way to fix the drop in the calculation domain? I have thought of directing my UDF to "moving ref. frame", in the fluid zone BC panel, but unfortunately it is not possibble. I can't think of any other way. Do you have an idea?

 March 5, 2004, 12:13 Re: UDF Problem #12 thomas Guest   Posts: n/a My idea would be to update your inlet BC not each iteration but every 2 or 3 time step (less at the beginning). This is possible using the macro DEFINE_EXECUTE_END and an euclidian division. thomas

 March 5, 2004, 13:01 Re: UDF Problem #13 ozgur Guest   Posts: n/a well, if I can fix my UDF problem, a mesh having not more than 20k cells would be enough for my single drop problem. But the overall calculation time may anyway increase, just because that with the much more refined cells at the interphase, then I would probably need much smaller time steps in VOF algorithm. According to my experience, it is not easy to deal with VOF when you have cells on the order of microns!

 March 11, 2004, 13:52 Re: UDF Problem #16 ozgur Guest   Posts: n/a Hi Thomas, Thanks for giving your time for my problem. I implemented a similar IF caluse to my UDF, as I posted as a new thread yesterday, but a "not a number" error appears this time. Anyway, I am still not sure about how to implement DEFINE_EXECUTE_END into my existing UDF, and how to hook it. Even apart from all those, I have strong doubts about the method I am using to fix my drop in the domain. I am actually trying to do a kind of coordinate transformation(from non-inertial to inertial-ref. frame moving with the same velocity of my drop) artificially, since it is not possible to define UDF in the Moving Ref. Frame Panel. But when I change the cell values in the fluid domain (with 2nd loop), then in those cells, the momentum equations are not solved anymore, but just the value I've given is assumed. Therefore, I am not sure that this way will work. What the most of the people are doing is, they are solving for modified N-S equations defined w.r.t. a non-inertial ref. frame. Thanks again for your contribution to my problem. Regards, Özgür

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Rizwan Fluent UDF and Scheme Programming 32 May 8, 2015 06:05 july Fluent UDF and Scheme Programming 3 June 20, 2010 06:56 mansha goraya FLUENT 0 October 29, 2007 01:31 akr FLUENT 3 August 22, 2007 07:14 chiseung FLUENT 4 January 10, 2002 10:58

All times are GMT -4. The time now is 14:27.

 Contact Us - CFD Online - Top