CFD Online Logo CFD Online URL
Home > Forums > Fluent UDF and Scheme Programming

How to store pressure and flux at last step?

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

LinkBack Thread Tools Display Modes
Old   May 24, 2013, 18:31
Default How to store pressure and flux at last step?
Join Date: Mar 2009
Posts: 40
Rep Power: 10
hadesmajesty is on a distinguished road
Hi, I am trying to implement a pressure outlet boundary condition by UDF in fluent.
The model is 3D and this boundary condition involves the pressure and inlet flux at last time step. I meet some problem in my implementation, especially how to store the previous pressure and flux. Below is part of the code:
DEFINE_PROFILE(pressure_wk_profile,t,i) //t means thread

sumFlow = 0;//total flux at inlet current time step
sumFlow_M1 = 0;// for previous time step
tot_vol = 0;// total volume
p_M1 = 0; //pressure at last time step

begin_f_loop(f, t)
{ //
sumFlow = sumFlow + F_FLUX(f,t); //calculate total mass flow rate.
//I am not sure what F_FLUX return is the inlet flux or previous outlet flux.
c0 = F_C0(f, t);
t0 = THREAD_T0(t);
tot_vol = tot_vol + C_VOLUME(c0,t0);
sumFlow_M1 = sumFlow_M1 + C_UDMI(c0,t0,1);//
p_M1 = p_M1 + C_UDMI(c0,t0,0)*C_VOLUME(c0,t0);
//It seems not work, and is there any simpler way to store/visit pressure at last step?
end_f_loop(f, t)
p_M1 = p_M1 / tot_vol;

begin_f_loop(f, t)
F_PROFILE(f,t,i) = somefunction(p_M1, sumFlow, sumFlow_M1);

Domain *d;
Thread *t, *t0;
cell_t c, c0;
face_t f;
real tt;
d = Get_Domain(1);
C_UDMI(c,t,0) = C_P(c,t);

c0 = F_C0(f, t);
t0 = THREAD_T0(t);
C_UDMI(c0, t0, 1) = F_FLUX(f,t); //store flux at each face
hadesmajesty is offline   Reply With Quote

Old   May 24, 2013, 20:54
Senior Member
Join Date: Aug 2011
Posts: 315
Rep Power: 14
blackmask will become famous soon enough
Not sure what you want but try C_P_M1(c,t) if you want to retrieve the pressure in previous time step for a given cell c and thread t.
blackmask is offline   Reply With Quote


Thread Tools
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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wind turbine simulation Saturn CFX 48 October 25, 2017 06:07
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 17:44
lid-driven cavity in matlab using BiCGStab Don456 Main CFD Forum 1 January 19, 2012 16:00
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05
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 01:42.