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 saving data of a transient simulation at particular locations

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

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   July 14, 2014, 04:52
Default UDF for saving data of a transient simulation at particular locations
  #1
New Member
 
Sreeraj Varma
Join Date: Jun 2014
Posts: 8
Rep Power: 11
sreerajvarma is on a distinguished road
Hi
I'm quite new to fluent and UDF programming. Could anyone suggest a method to save just pressure and temperature data at a few locations along X-Axis in a *.dat or *.txt files. I want data only at a few locations becausw otherwise the data to be stored will be very high. I also don't have much time to start learning UDF's. So kindly help

Thank you
sreerajvarma is offline   Reply With Quote

Old   July 15, 2014, 10:35
Default
  #2
Member
 
David
Join Date: Aug 2012
Posts: 48
Rep Power: 13
GM_XIII is on a distinguished road
You need a UDF that executes after every iterarion, I think that DEFINE_ADJUST (http://jullio.pe.kr/fluent6.1/help/html/udf/node55.htm) should fit your needs. In the reference given you have a sample of code that can be of your iterest, I commented in red what can fit your needs:

#include "udf.h"
DEFINE_EXECUTE_AT_END(execute_at_end)
{
Domain *d;
Thread *t;
real sum_diss=0.;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */
thread_loop_c (t,d)/*This loops over all cells in domain*/
{
if (FLUID_THREAD_P(t))
{ begin_c_loop (c,t)
/*Here you should check if the cell is one of the points you want*/
end_c_loop (c,t)
}
}
printf("Volume integral of turbulent dissipation: %g\n", sum_diss); fflush(stdout); }


To extract the variables you want, check http://aerojet.engr.ucdavis.edu/flue...udf/node90.htm. To save them into a file check http://aerojet.engr.ucdavis.edu/flue...df/node260.htm.
GM_XIII is offline   Reply With Quote

Old   July 16, 2014, 03:59
Default
  #3
New Member
 
Sreeraj Varma
Join Date: Jun 2014
Posts: 8
Rep Power: 11
sreerajvarma is on a distinguished road
Thank You very much. I will try the links you suggested.

Sreeraj Varma
sreerajvarma is offline   Reply With Quote

Old   July 16, 2014, 08:00
Default
  #4
New Member
 
Sreeraj Varma
Join Date: Jun 2014
Posts: 8
Rep Power: 11
sreerajvarma is on a distinguished road
Quote:
Originally Posted by GM_XIII View Post
You need a UDF that executes after every iterarion, I think that DEFINE_ADJUST (http://jullio.pe.kr/fluent6.1/help/html/udf/node55.htm) should fit your needs. In the reference given you have a sample of code that can be of your iterest, I commented in red what can fit your needs:

#include "udf.h"
DEFINE_EXECUTE_AT_END(execute_at_end)
{
Domain *d;
Thread *t;
real sum_diss=0.;
cell_t c;
d = Get_Domain(1); /* mixture domain if multiphase */
thread_loop_c (t,d)/*This loops over all cells in domain*/
{
if (FLUID_THREAD_P(t))
{ begin_c_loop (c,t)
/*Here you should check if the cell is one of the points you want*/
end_c_loop (c,t)
}
}
printf("Volume integral of turbulent dissipation: %g\n", sum_diss); fflush(stdout); }


To extract the variables you want, check http://aerojet.engr.ucdavis.edu/flue...udf/node90.htm. To save them into a file check http://aerojet.engr.ucdavis.edu/flue...df/node260.htm.


I'm trying to model ma shocktube through transient simulation. So it is single phase modelling only.I have divided the tube into a a mesh of 1mm longitudinal length cells and I want the pressure at the cell bounded by face at 3.2mI tried to write to write the code as you siggested but an error msg(structure reference not implemented) is coming for line 49(if(Fluid_THREAD_P(t))). Could you pls tell me why. and also pls tell me the purpose of FLUID_THREAD_P(t) and fflush(stdout)

#include "udf.h"

DEFINE_INIT(sree_shock_tube_init,d)
{
cell_t c;
Thread *t;
float xc[ND_ND];

thread_loop_c(t,d)
{
begin_c_loop_all(c,t)
{

C_CENTROID(xc,c,t);

if (xc[0] < 3.2 )
{
C_U(c,t) = 0.;
C_V(c,t) = 0.;
C_P(c,t) = 2026500.0;
C_T(c,t) = 300.0;
C_R(c,t) = 23.536;
}

else

{

C_U(c,t) = 0.;
C_V(c,t) = 0.;
C_P(c,t) = 10132.5;
C_T(c,t) = 300.0;
C_R(c,t) = 0.11768;

}

}
end_c_loop_all(c,t)
}
}
DEFINE_EXECUTE_AT_END(exec)
{
Domain *d;
Thread *t;
float xc[ND_ND];
real pres=0.0;
thread_loop_c(t,d)
{
if(FLUID_THREAD_P(t))
{
begin_c_loop_all(c,t)
{
C_CENTROID(xc,c,t);
if(xc[0]==3.1995)
{
pres=C_P(c,t);
}
} }
end_c_loop_all(c,t)
}
}
printf("Pressure at the cells are %g\n",&pres);
fflush(stdout);
}
sreerajvarma is offline   Reply With Quote

Reply

Tags
save data, udf

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Animation of Fluent transient data saisanthoshm88 CFX 22 August 14, 2017 20:06
[Commercial meshers] fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Meshing & Mesh Conversion 12 May 2, 2013 11:52
Animation of Fluent transient data saisanthoshm88 FLUENT 2 December 18, 2012 10:51
Resume Transient simulation HMR CFX 1 June 28, 2011 22:13
exporting data during a transient simulation vishwa FLUENT 0 April 20, 2009 12:54


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