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

UDF for decreasing pressure

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   November 9, 2010, 17:32
Default UDF for decreasing pressure
  #1
Member
 
pranab_jha's Avatar
 
Pranab N Jha
Join Date: Nov 2009
Location: Houston, TX
Posts: 86
Rep Power: 16
pranab_jha is on a distinguished road
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
pranab_jha is offline   Reply With Quote

 


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
UDF to adjust pressure outlet a.lynchy FLUENT 4 February 15, 2021 00:50
Pressure BC for combustion chamber Giuki FLUENT 1 July 19, 2011 11:35
Modifying Pressure swirl atomizer model by UDF jeff_F FLUENT 0 May 22, 2010 09:22
calculation average pressure in a plane with UDF Vitalij FLUENT 1 April 10, 2007 03:39
Neumann pressure BC and velocity field Antech Main CFD Forum 0 April 25, 2006 02:15


All times are GMT -4. The time now is 23:47.