|
[Sponsors] |
UDF for saving data of a transient simulation at particular locations |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
July 14, 2014, 04:52 |
UDF for saving data of a transient simulation at particular locations
|
#1 |
New Member
Sreeraj Varma
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
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 |
|
July 15, 2014, 10:35 |
|
#2 |
Member
David
Join Date: Aug 2012
Posts: 48
Rep Power: 14 |
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. |
|
July 16, 2014, 03:59 |
|
#3 |
New Member
Sreeraj Varma
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
Thank You very much. I will try the links you suggested.
Sreeraj Varma |
|
July 16, 2014, 08:00 |
|
#4 | |
New Member
Sreeraj Varma
Join Date: Jun 2014
Posts: 8
Rep Power: 12 |
Quote:
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); } |
||
Tags |
save data, udf |
|
|
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 |