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/)
-   -   SAving variables using UDF (https://www.cfd-online.com/Forums/fluent-udf/162640-saving-variables-using-udf.html)

A.Jalal November 14, 2015 18:49

SAving variables using UDF
 
Hello Guys,

I have a question regarding saving certain values into a text file or excel file. Can I save the values that I am asking my UDF to display? In my case DT_CG and Spring Force as shown in the UDF below?
The reason is I want to plot a graph of DT_CG/Spring Force with respect to time.
Any help would be appreciated. I am aware it is a DEFINE AT END Function but I just need help on how to set it up.

Thank You




#include
"udf.h"
#define spring_constant 300 /*N/m*/
#define original_valve_cg_y 0.029972
DEFINE_SDOF_PROPERTIES(spring_check_valve, prop, dt, time, dtime)
{
real valve_movement_y;
prop[SDOF_MASS] = 0.00297817;
prop[SDOF_IXY] = 3.33709e-12;
prop[SDOF_IXX] = 2.27698e-06;
prop[SDOF_IYY] = 2.53895e-07;
prop[SDOF_IZZ] = 2.53088e-06;
prop[SDOF_ZERO_TRANS_X] = TRUE;
prop[SDOF_ZERO_TRANS_Z] = TRUE;
prop[SDOF_ZERO_ROT_X] = TRUE;
prop[SDOF_ZERO_ROT_Y] = TRUE;
prop[SDOF_ZERO_ROT_Z] = TRUE;
valve_movement_y = (DT_CG(dt)[1] - original_valve_cg_y);
Message(
"DT_CG = %e, %e, %e\n",DT_CG(dt)[0], DT_CG(dt)[1], DT_CG(dt)[2]);
prop[SDOF_LOAD_F_Y] = - spring_constant * valve_movement_y;
Message(
"spring force = %e\n",prop[SDOF_LOAD_F_Y]);
}


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