|
[Sponsors] |
November 9, 2010, 18:32 |
UDF for decreasing pressure
|
#1 |
Member
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 17 |
Hello All,
Can someone tell me what am I doing wrong in this UDF that I have? I want to have a pressure inlet boundary condition with decreasing pressure as I march in time. /************************************************** ******************** pr_10.c UDF for specifying a pressure boundary condition ************************************************** ********************/ #include "udf.h" DEFINE_PROFILE(pr_10, thread, nv) { face_t f; /* Defines f as a face thread index */ real t = CURRENT_TIME; /*current flow time*/ real dt = RP_Get_Real("physical-time-step"); real vel = F_V(f,thread); /* v-velocity*/ real Q0 = 5.0; /*Q0=l*b*h, l=b=1 */ real Q; real newQ; real rho = 0.6679; /*density*/ real g = 9.81; real D = 0.05; /*inlet size*/ real PI=3.14159; int time_step = N_TIME; /*returns time step number*/ real P0 = rho*g*Q0; real A = PI*D*0.125; /*inlet area*/ real mem = F_UDMI(f,thread,0); if(time_step = 1){newQ = Q0} /*initializing newQ*/ else{newQ = mem} begin_f_loop(f, thread) { Q = newQ - (A*vel*dt); F_PROFILE(f, thread, nv) = Q*P0/Q0; mem = Q; } end_f_loop(f, thread) } When I try to interpret it, I get the following error messages: Error: W:\Fluent files\Slug\2D\l1\pressure10.c: line 26: parse error. Error: W:\Fluent files\Slug\2D\l1\pressure10.c: line 29: f_loop_last: undeclared variable Can someone help me out with this. Thanks, Pranab |
|
November 10, 2010, 15:07 |
|
#2 |
Member
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 17 |
Has anybody had any experience with F_UDMI macro. I am a bit stuck here. I know there are a couple of simple errors in the if loop (which I have fixed). Still not able to get it to run correctly. My aim is:
1. to calculate the value of Q at a certain time step 2. store it in memory using F_UDMI 3. pass back the value of Q to fluent 4. in the next time step, use the last value of Q from F_UDMI 5. update F_UDMI using new value of Q. Any help would be appreciated folks. |
|
December 10, 2010, 20:19 |
|
#3 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
What errors are you seeing now? I note in the if-then loop you're missing semicolons, and you equals statements should be ==...
Something like... if(time_step == 1){newQ = Q0;} /*initializing newQ*/ else{newQ = mem;} begin_f_loop(f, thread) { Q = newQ - (A*vel*dt); F_PROFILE(f, thread, nv) = Q*P0/Q0; mem = Q; } end_f_loop(f, thread) } |
|
December 10, 2010, 20:22 |
|
#4 |
Senior Member
Real Name :)
Join Date: Jan 2010
Location: United States
Posts: 192
Rep Power: 16 |
Also, I don't see anywhere in your code where you're updating F_UDMI with a new value. You update the value of mem (mem=Q), but you're never setting F_UDMI(f,thread,0)=Q;
ComputerGuy |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF to adjust pressure outlet | a.lynchy | FLUENT | 4 | February 15, 2021 01:50 |
Pressure BC for combustion chamber | Giuki | FLUENT | 1 | July 19, 2011 12:35 |
Modifying Pressure swirl atomizer model by UDF | jeff_F | FLUENT | 0 | May 22, 2010 10:22 |
calculation average pressure in a plane with UDF | Vitalij | FLUENT | 1 | April 10, 2007 04:39 |
Neumann pressure BC and velocity field | Antech | Main CFD Forum | 0 | April 25, 2006 03:15 |