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

How to define unsteady term in scaler function?

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   June 19, 2001, 13:04
Default 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; }

  Reply With Quote

Old   June 19, 2001, 16:38
Default 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*/

}

  Reply With Quote

Old   June 20, 2001, 09:26
Default 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;
}
  Reply With Quote

Old   June 20, 2001, 11:54
Default 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*/

}

  Reply With Quote

Old   October 29, 2012, 23:15
Default
  #5
New Member
 
vaseem akram shaik
Join Date: Oct 2012
Posts: 12
Rep Power: 13
vsmkrm298 is on a distinguished road
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.
vsmkrm298 is offline   Reply With Quote

Old   December 3, 2012, 15:40
Default source term for uds
  #6
New Member
 
fariba
Join Date: Oct 2011
Posts: 9
Rep Power: 14
fariba.j is on a distinguished road
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
fariba.j is offline   Reply With Quote

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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
HELP----Surface Reaction UDF Ashi Fluent UDF and Scheme Programming 1 May 19, 2020 22:13
How to define a transient species source term? aleisia FLUENT 3 March 7, 2011 23:58
ParaView for OF-1.6-ext Chrisi1984 OpenFOAM Installation 0 December 31, 2010 07:42
Compilation errors in ThirdPartymallochoard feng_w OpenFOAM Installation 1 January 25, 2009 07:59
unsteady Bernoulli equation and wagner function. Afungchui Main CFD Forum 0 March 14, 2005 12:50


All times are GMT -4. The time now is 12:59.