CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   Fluent UDF and Scheme Programming (https://www.cfd-online.com/Forums/fluent-udf/)
-   -   Write data in UDF similar to XY-plot (https://www.cfd-online.com/Forums/fluent-udf/103354-write-data-udf-similar-xy-plot.html)

Seppl June 18, 2012 09:08

Write data in UDF similar to XY-plot
 
Hello,

I am trying to write an UDF for the following problem:

* I have an instationary simulation where I want to save the velocity components across a straight line
* When doining it only once, I would define a line and use in the GUI the XY-plot function with th option write.
* However I want to save the data of approx. 1000 time steps for later post processing (e.g. in MATLAB).
* How does Fluent interpolate the points in the XY-Plot and are there some UDF macros available?

Thanks in advance
Seppl

chittipo June 18, 2012 09:39

journal
 
I think, you just need to write a journal.
For e.g the following journal commands writes the temperature data along the center.

;
; Data of Axial Temperature Profile (simDataTempAxial.dat)
;
/plot/plot
;node values? [yes]
yes
;filename [""]
"simDataTempAxial.dat"
;order points? [no]
no
;Y Axis direction vector? [no]
no
;Y Axis curve length? [no]
no
;cell function
temperature
;X Axis direction vector? [no]
yes
;ix [1]
1
;iy [0]
0
;surface id/name(1) [()] 3. 3 represents "Axis" in this case and data file. This will be changed base on our requirement. eg for pressureOutlet 4 here
3
;surface id/name(2) [()]. below space is required

;
;
;

Seppl Huber June 19, 2012 10:35

Hi,

somewhere on this forum I found the following code which identifies the closest cell centroid to a given point:

PHP Code:

real pos[ND_ND] = {0.05,0.2,0.3};/*the position of the monitoring point*/
static cell_t c0 = -1;/*index of the cell containing the monitoring point*/
cell_t c;
static 
Thread *t0 NULL;/*thread of the cell containing the monitoring point*/
Thread *t;
real x[ND_ND], d2 1.0e9d20 1.0e9;
FILE *pf;
 
if(
NULL == t0)
thread_loop_c(t,d)
{
begin_c_loop(c,t)
{
C_CENTROID(x,c,t);
NV_V(x,-=,pos);
d2 NV_MAG2(x);
if(
d2 d20)
{
d20 d2;
t0 t;
c0 c;
}
}
end_c_loop(c,t)


In princeple the only thing to do is to define the line from a number of point and to calculate the value of the quantity in this point from the value in the cell centroid, the gradient there and the distance to the point on the line.


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