CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT

problem with UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 21, 2008, 15:57
Default problem with UDF
  #1
Nina
Guest
 
Posts: n/a
Hi All, I've problem with an UDF. I have to define a pressure profile that respond to the following equation: ((Ql*Ri)+(vol/C)) where Ql is the flow rate at the current time, Ri and C are costant and vol derive to the following expression ((Ql*(current time-previous time))+volume at the previous time). I've made different UDF where I've used the variables F_U, F_V, F_W e F_U_M1, F_V_M1, F_W_M1 but I'm not an expert so maybe I've missed something because UDF doesn't run well. I've tried also with some external variables but I don't understand how I've to use them…I'm really hopeless!! This is the UDF: DEFINE_PROFILE(press_insp,thread,position)

{

face_t f;

real NV_VEC(psi);

real NV_VEC(A);

real NV_VEC(psit);

real intervallo =0.0;

real ora = 0.0;

real prima = 0.0;

real Q=0;

real Ql=0;

real vol=0;

real Qtl=0;

real volprec=0;

real Qt=0;

ora=CURRENT_TIME;

prima=PREVIOUS_TIME;

intervallo=ora-prima;

begin_f_loop(f,thread)

{

F_AREA(A,f,thread);

NV_D(psi,=,F_U(f,thread),F_V(f,thread),F_W(f,threa d));

Q=NV_DOT(psi,A);

Ql= Q*1000;

NV_D(psit,=,F_U_M1(f,thread),F_V_M1(f,thread),F_W_ M1(f,thread));

Qt=NV_DOT(psit,A);

Qtl=Qt*1000;

volprec=Qtl*intervallo;

vol=((Ql*intervallo)+volprec);

intervallo = istante - precedente;

F_PROFILE(f,thread,position)=((Q/C)+(((Q-Qt)/intervallo)*Ri));

}

end_f_loop(f,thread)

}

  Reply With Quote

Old   April 30, 2008, 05:09
Default Re: problem with UDF
  #2
Paolo Lampitella
Guest
 
Posts: n/a
Hi,

if the UDF is running, that is it's correctly compiled (even if not running as expected), it could be nearly impossible to find the error without knowing about the case you're trying to solve, the b.c. and so on.

At first sight it seems to be a b.c. problem (maybe the pressure b.c. does not works properly due to it's coupling with other b.c. on the other sides of the domain).

The UDF seems to be written in the right formal way, to be sure of this you could try the "copy & paste" approach from the UDF manual. Also you could try to remove the f_profile sentence and print on the screen the informations you are trying to use in your profile.

Finally it seems that you have defined a couple of variables not used in your profile, Qtl and vol, and maybe there is a simple distraction error.

Hope this helps
  Reply With Quote

Reply


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 Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
VOF diffuse problem on two fluids problem Fang Jin FLUENT 5 February 17, 2011 05:38
Problem in Modelling Heat Transfer Problem Deepak R FLUENT 1 December 6, 2007 09:37
Problem in cavity flow problem saad Main CFD Forum 4 November 1, 2007 07:45
natural convection problem for a CHT problem Se-Hee CFX 2 June 10, 2007 06:29
problem in solving "wave generation" problem san FLUENT 2 April 3, 2006 23:37


All times are GMT -4. The time now is 21:10.