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

Unsteady udf, velocity step

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 5, 2005, 05:02
Default Unsteady udf, velocity step
  #1
CJ
Guest
 
Posts: n/a
Is it possible to write a unsteady udf such that:

t<2 velocity=20

t>2 velocity=30

I have used this sinusoidal function previously (below), but would like to have a simple step change as above

DEFINE_PROFILE(unsteady_velocity, thread, position) {

face_t f;

begin_f_loop(f, thread)

{

real t = RP_Get_Real("flow-time");

F_PROFILE(f, thread, position) = 25. + 5.0*sin(10.*t);

}

end_f_loop(f, thread) }
  Reply With Quote

Old   April 5, 2005, 10:36
Default Re: Unsteady udf, velocity step, more help pls!
  #2
CJ
Guest
 
Posts: n/a
I have this error: cpp -IC:\FLUENT.INC\fluent6.0/src -IC:\FLUENT.INC\fluent6.0/cortex/src -IC:\FLUENT.INC\fluent6.0/client/src -IC:\FLUENT.INC\fluent6.0/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" time.cError: time.c: line 13: parse error.

with this program:

#include "udf.h"

DEFINE_PROFILE(unsteady, thread, position) {

face_t f;

begin_f_loop(f, thread)

{

real t = RP_Get_Real("flow-time");

if (t < 2)

F_PROFILE(f, thread, position) = 50

else

F_PROFILE(f, thread, position) = 20

}

end_f_loop(f, thread) }

can anyone please help and point out any obvious mistakes, or if this is even possible?
  Reply With Quote

Old   April 5, 2005, 11:23
Default Re: Unsteady udf, velocity step, more help pls!
  #3
swarup
Guest
 
Posts: n/a
CJ, Try this. This will work.

DEFINE_PROFILE(unsteady_pressure,thread,position) {

face_t f; real t=CURRENT_TIME;

begin_f_loop(f,thread)

{

if(t<2)

F_PROFILE(f,thread,position)=50.0;

else

F_PROFILE(f,thread,position)=20.0; }

end_f_loop(f,thread)

}
  Reply With Quote

Old   April 5, 2005, 17:23
Default Re: Unsteady udf, velocity step, more help pls!
  #4
CJ
Guest
 
Posts: n/a
Thankyou for your help, and it certainly seems to be closer, but i now get this error:

cpp -IC:\FLUENT.INC\fluent6.0/src -IC:\FLUENT.INC\fluent6.0/cortex/src -IC:\FLUENT.INC\fluent6.0/client/src -IC:\FLUENT.INC\fluent6.0/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" time3.cError: time3.c: line 6: CURRENT_TIME: undeclared variable

i have tried numerous ways to sort it but none seem to work. any more advice please?
  Reply With Quote

Old   April 5, 2005, 17:26
Default Re: Unsteady udf, velocity step, more help pls!
  #5
CJ
Guest
 
Posts: n/a
Sorry, this is what generated the error:

#include "udf.h"

DEFINE_PROFILE(unsteady_pressure, thread, position) {

face_t f;

real t = current_time;

begin_f_loop(f, thread)

{

if(t<2)

F_PROFILE(f, thread, position) = 50.0;

else

F_PROFILE(f, thread, position) = 20.0;

}

end_f_loop(f, thread) }
  Reply With Quote

Old   April 6, 2005, 11:14
Default Re: Unsteady udf, velocity step, more help pls!
  #6
swarup
Guest
 
Posts: n/a
CJ,

i have tried this UDF earlier in connexion with unsteady pressure. that's why the UDF name is unsteady_pressure. we have to use CURRENT_TIME and not current_time. hope this will resolve.

Swarup.
  Reply With Quote

Old   April 7, 2005, 04:51
Default Re: Unsteady udf, velocity step, more help pls!
  #7
CJ
Guest
 
Posts: n/a
It just says this instead:

cpp -IC:\FLUENT.INC\fluent6.0/src -IC:\FLUENT.INC\fluent6.0/cortex/src -IC:\FLUENT.INC\fluent6.0/client/src -IC:\FLUENT.INC\fluent6.0/multiport/src -I. -DUDFCONFIG_H="<udfconfig.h>" time3.cError: time3.c: line 6: CURRENT_TIME: undeclared variable

Im not sure of the problem if yours works but mine does not. Different versions of Fluent (I have 6.0)?
  Reply With Quote

Old   April 7, 2005, 05:44
Default Re: Unsteady udf, velocity step, more help pls!
  #8
Luca
Guest
 
Posts: n/a
CURRENT_TIME is not avaiable in Fluent 6.0. Try with RP_Get_Real("flow-time").
  Reply With Quote

Old   April 7, 2005, 12:08
Default Re: Unsteady udf, velocity step
  #9
ram
Guest
 
Posts: n/a
  Reply With Quote

Old   April 8, 2005, 04:15
Default Re: Unsteady udf, velocity step, more help pls!
  #10
CJ
Guest
 
Posts: n/a
At last, it works! Thanks everyone.
  Reply With Quote

Old   April 8, 2005, 05:20
Default Re: Unsteady udf, velocity step, more help pls!
  #11
pUl|
Guest
 
Posts: n/a
Sounds good, However, one word of caution for others who may be writing udfs to incorporate models. Just because a UDF compiles fine and fluent seems to have no problems accomodating it, one should not assume that the UDF is correct. The best way to confirm is to test and check whether the UDF is really doing what you want it to do.

For instance, if you are writing a custom drag model, start by trying to write the schiller-naumann law in a UDF (which is already implemented in fluent) so that you can compare the results and check for yourself.

All the Best!

Best Regards,

Srinath Madhavan
  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
Multiple floating objects CKH OpenFOAM Running, Solving & CFD 14 February 20, 2019 10:08
On Setring Step Size in unsteady Solver of FLUENT lzgwhy FLUENT 0 August 19, 2009 23:44
how did I see next time step of velocity cotour ? Andy Chen FLUENT 2 June 30, 2009 13:48
How to modify velocity with UDF jddmsh FLUENT 0 June 28, 2003 22:59
UDF component in Cyliderical Velocity? Hongchan Kim FLUENT 3 April 24, 2001 13:20


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