# How to define unsteady term in scaler function?

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

 LinkBack Thread Tools Display Modes
 June 19, 2001, 12:04 How to define unsteady term in scaler function? #1 olivia Guest   Posts: n/a Hi: I want to define unsteady term in scaler function . But it have some error message in line 6 message is UDS:undeclared variable. Can anyone know how to solve this problem? Thanks!! #include "udf.h" DEFINE_SOURCE(usr_ensource, cell, thread, ds, eqn) { real lg,l,unst;UDS unst = DEFINE_UDS_UNSTEADY(c, t, i); l = 2440.0; lg = l * ( 1.0 + 8.31 * exp(-1.0 * 0.436 * C_UDSI(c,t,i) ) ); source = 1.0 / 0.5 * unst * lg; return source; }

 June 19, 2001, 15:38 Re: How to define unsteady term in scaler function #2 Lanre Guest   Posts: n/a First, a C error: Instead of: real lg,l,unst;UDS Try: real lg,l,unst; Second, your UDF needs to define the two parts of the unsteady term for the UDS: one for the central coefficient and the other for the source term (See Section 2.5.13 of the UDF Guide). Your UDF for the unsteady term of your UDS should be: #include "udf.h" #define rho 1000 DEFINE_UDS_UNSTEADY(uds_unsteady, cell, thread, i, apu, su) { real time_step, vol, rho, phi_old, phi_curr; time_step= RP_Get_Real("physical-time-step"); vol = C_VOLUME(cell,thread); *apu = -rho*vol/time_step; /*central coefficient part*/ phi_old = C_STORAGE_R(cell,thread,SV_UDSI_M1(i)); phi_curr = C_UDSI(cell,thread,i); *su = rho*vol*phi_old/time_step; /*source term part*/ }

 June 20, 2001, 08:26 Re: How to define unsteady term in scaler function #3 olivia Guest   Posts: n/a Thanks Lanre. I wrote the following code, but it still have some errors, Could you help me again , Thank you very much!! My error messages are : Error: test11.c: line 29: parse error. Error: test11.c: line 31: invalid lvalue in assignment. My code is as following : #include "udf.h" #include "math.h" #define rho 1000 #define l 2440.0 DEFINE_UDS_UNSTEADY(uds_unsteady, cell, thread, i, apu, su) { /* rho, */ float time_step, vol, phi_old, phi_curr; time_step= RP_Get_Real("physical-time-step"); vol = C_VOLUME(cell,thread); *apu = -rho*vol/time_step; /*central coefficient part*/ phi_old = C_STORAGE_R(cell,thread,SV_UDSI_M1(i)); phi_curr = C_UDSI(cell,thread,i); *su = rho*vol*phi_old/time_step; /*source term part*/ } DEFINE_SOURCE(usr_ensource, cell, thread, ds, eqn) { real uscl, source; void unst, lg; unst = DEFINE_UDS_UNSTEADY(uds_unsteady, cell, thread, eqn, apu, su); uscl = C_UDSI(cell,thread,eqn); lg = l * ( 1.0 + 8.31 * exp(-1.0 * 0.436 *uscl) ); source = 1.0 / 0.5 * unst * lg; return source; }

 June 20, 2001, 10:54 Re: How to define unsteady term in scaler function #4 Lanre Guest   Posts: n/a I neglected to mention you have to implement the UDF as a compiled UDF. The function takes your relation to modify the time-derivative term and applies it through the unsteady UDS term macro: #include "udf.h" #include "math.h" #define rho 1000 #define l 2440.0 DEFINE_UDS_UNSTEADY(uds_unsteady, cell, thread, i, apu, su) { float time_step, vol, phi_old, phi_curr, lg, uscl,el; float A; time_step= RP_Get_Real("physical-time-step"); vol = C_VOLUME(cell,thread); el = 1.0; uscl = C_UDSI(cell,thread,i); lg = el * ( 1.0 + 8.31 * exp(-1.0 * 0.436 *uscl) ); A = 1.0/0.5*lg; *apu = -rho*vol/time_step * A; /*central coefficient part*/ phi_old = C_STORAGE_R(cell,thread,SV_UDSI_M1(i)); /*phi_curr = C_UDSI(cell,thread,i);*/ *su = rho*vol*phi_old/time_step * A; /*source term part*/ }

 October 29, 2012, 23:15 #5 New Member   vaseem akram shaik Join Date: Oct 2012 Posts: 12 Rep Power: 7 Hi everyone, I am trying to solve the Navier-Stokes equations and Continuity equation for low reynolds number flow, so i just need to neglect the advection term in Navier stokes equation, is this possible in fluent? If yes, please tell me how.

 December 3, 2012, 15:40 source term for uds #6 New Member   fariba Join Date: Oct 2011 Posts: 9 Rep Power: 8 Hi, I want to write a source tem by udf for uds,. my scalar is concentration and my source term includes concentration(uds), but i don't know how i define variable of this equation in udf! in my udf, i wrote "user scalar 0" instead of my variable , but fluent gave me an error for example my scalar is concentratin(C), and my source term is: kC^2

 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 aleisia FLUENT 3 March 7, 2011 23:58 Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42 Ashi Fluent UDF and Scheme Programming 0 May 25, 2009 09:39 feng_w OpenFOAM Installation 1 January 25, 2009 07:59 Afungchui Main CFD Forum 0 March 14, 2005 12:50

All times are GMT -4. The time now is 22:06.

 Contact Us - CFD Online - Privacy Statement - Top