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

Applying pressure on a boundary

Register Blogs Community New Posts Updated Threads Search

 
 
LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old   March 24, 2011, 20:25
Default Applying pressure on a boundary
  #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 Everyone,

Been a regular visitor to this site. Recently started playing with UDFs. I am stuck at this one. I have to model a pressure boundary condition similar to a hydrostatic pressure at the inlet.
My problem is that I am not able to get the pressure already available at the first time step at every face of the inlet thread (I use a steady state solution as my initial condition for the unsteady case) and then compute its average. I have to store this as the initial pressure. Then I have to decrease the initially calculated volume Q0 at the inlet with the volume flux and compute pressure P1 using the new remaining volume Q1 to be stored in a user defined memory location (MEM2) and use it in the next time step.

Can anyone take a look and help me out here.

Thanks,
Pranab


#include "udf.h"

DEFINE_PROFILE(pv1, t, index)
{
face_t f;
int n = N_TIME; /*no. of time steps*/
real P1;
real P_sum=0;
real P_avg=0;
real Q0, Q1;
real vol_out;
real mass_flux=0;
real mass_flux_tot=0;
real MEM1, MEM2, MEM3;
Thread *t1;
int d;

int Zone_ID = 22; /*look up the id from the boundary conditions panel*/
d=Get_Domain(1); /*domain*/

t1=Lookup_Thread(d,Zone_ID);

/**Initialize UDM to face-pressure at the first time-step**/
if(n==1) {printf("\nFirst timestep\n");
begin_f_loop(f,t1)
{
P_sum = P_sum + F_P(f,t1);
P_avg = P_sum / 7;

F_UDMI(f,t1,0) = P_avg; /*constant for all iterations*/

Q0 = (P_avg * 10000)/(0.6679 * 9.81); /*initial volume*/

F_UDMI(f,t1,1) = Q0;

F_UDMI(f,t1,2) = Q0; /*constant for all iterations*/

}end_f_loop(f,t1)
}


/**Assign all UDM's to a variable to be used later**/
MEM1 = F_UDMI(f,t1,0);
MEM2 = F_UDMI(f,t1,1);
MEM3 = F_UDMI(f,t1,2); /

begin_f_loop(f,t1)
{
mass_flux = mass_flux + F_FLUX(f,t1);
}end_f_loop(f,t1)

mass_flux_tot = mass_flux;

vol_out = 0.0001* mass_flux_tot/0.6679;

/**Calculate remaining volume & new pressure**/
Q1 = MEM2 - vol_out; /**new volume**/

P1 = Q1 * MEM1 / MEM3; /**new pressure**/
printf("New Pressure = %f\n", P1);

begin_f_loop(f,t1)
{
/**Apply new pressure on the face**/
F_PROFILE(f,t1,index) = P1;
}end_f_loop(f,t1)

/**Update the udm with new Q1**/
F_UDMI(f,t1,1) = Q1;

}
pranab_jha is offline   Reply With Quote

 

Tags
pressure, udf, volume


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
stagnation pressure boundary problem mbgnfrx2 STAR-CD 2 November 25, 2012 23:55
Boundary Condition pressure inlet/oulet for combustion simulations Giuki FLUENT 0 May 6, 2009 10:04
Pressure Boundary Conditions kantipudi Main CFD Forum 1 August 10, 2008 04:07
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55
what the result is negatif pressure at inlet chong chee nan FLUENT 0 December 29, 2001 05:13


All times are GMT -4. The time now is 17:35.