|
[Sponsors] |
How to define unsteady term in scaler function? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 19, 2001, 12:04 |
How to define unsteady term in scaler function?
|
#1 |
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 |
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 |
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 |
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, 22:15 |
|
#5 |
New Member
vaseem akram shaik
Join Date: Oct 2012
Posts: 12
Rep Power: 13 |
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, 14:40 |
source term for uds
|
#6 |
New Member
fariba
Join Date: Oct 2011
Posts: 9
Rep Power: 14 |
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 |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
HELP----Surface Reaction UDF | Ashi | Fluent UDF and Scheme Programming | 1 | May 19, 2020 21:13 |
How to define a transient species source term? | aleisia | FLUENT | 3 | March 7, 2011 22:58 |
ParaView for OF-1.6-ext | Chrisi1984 | OpenFOAM Installation | 0 | December 31, 2010 06:42 |
Compilation errors in ThirdPartymallochoard | feng_w | OpenFOAM Installation | 1 | January 25, 2009 06:59 |
unsteady Bernoulli equation and wagner function. | Afungchui | Main CFD Forum | 0 | March 14, 2005 11:50 |