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

How to store pressure and flux at last step?

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   May 24, 2013, 19:31
Default How to store pressure and flux at last step?
  #1
Member
 
Edison
Join Date: Mar 2009
Posts: 40
Rep Power: 17
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);
}
end_f_loop(f,t)
}

DEFINE_EXECUTE_AT_END(execute_at_end)
{
Domain *d;
Thread *t, *t0;
cell_t c, c0;
face_t f;
real tt;
d = Get_Domain(1);
thread_loop_c(t,d)
{
begin_c_loop(c,t)
C_UDMI(c,t,0) = C_P(c,t);
end_c_loop(c,t)
}

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

Old   May 24, 2013, 21:54
Default
  #2
Senior Member
 
Join Date: Aug 2011
Posts: 421
Blog Entries: 1
Rep Power: 22
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

Reply


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
Wind turbine simulation Saturn CFX 60 July 17, 2024 06:45
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18: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 03:15


All times are GMT -4. The time now is 20:58.