|
[Sponsors] |
How can I get a variable as output parameter from a UDF for post processing? |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
June 20, 2022, 06:56 |
How can I get a variable as output parameter from a UDF for post processing?
|
#1 |
New Member
mohammad
Join Date: Dec 2021
Posts: 10
Rep Power: 5 |
Hi, I want to get ''xpos'' variable in my UDF code (which has been attached) as an output parameter for plot xpos vs time in cfdpost.
Thanks. Code:
#include "udf.h" DEFINE_SDOF_PROPERTIES(sphere, prop, dt, time, dtime) { real xpos; prop[SDOF_MASS] = 0.786; prop[SDOF_IXX] = 0.00000786; prop[SDOF_IYY] = 0.00000786; prop[SDOF_IZZ] = 0.00000786; xpos = DT_CG(dt) [0]; } |
|
June 21, 2022, 22:46 |
|
#2 |
Senior Member
Join Date: Feb 2020
Posts: 114
Rep Power: 6 |
try to use UDM to store the variable
|
|
June 22, 2022, 07:01 |
|
#3 |
New Member
mohammad
Join Date: Dec 2021
Posts: 10
Rep Power: 5 |
Thanks for your reply. I will be grateful if tell me which macro should I use.
|
|
June 23, 2022, 02:00 |
|
#4 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
better to write to file, as xpos is same for the whole domain at specified time moment
compile code: Code:
#include "udf.h" DEFINE_SDOF_PROPERTIES(sphere, prop, dt, time, dtime) { real xpos; prop[SDOF_MASS] = 0.786; prop[SDOF_IXX] = 0.00000786; prop[SDOF_IYY] = 0.00000786; prop[SDOF_IZZ] = 0.00000786; xpos = DT_CG(dt) [0]; host_to_node_real_1(xpos); #if !RP_NODE if ((fp = fopen(out_xpos, "w"))==NULL) { Message("\n Warning: Unable to open %s for writing\n",out_xpos); exit(0); } else { fprintf(fp, "%f %f\n",time, xpos); Message("\nWriting data to %s...",out_xpos); } #endif }
__________________
best regards ****************************** press LIKE if this message was helpful |
|
Tags |
udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF error_ undeclared variable | panos_metal21 | Fluent UDF and Scheme Programming | 6 | December 19, 2019 01:44 |
Pass variable from one udf to another | Spyrost | FLUENT | 8 | September 14, 2019 13:13 |
How to set as input parameter in Fluent a variable existing outside it? | didimad | FLUENT | 1 | March 3, 2015 12:10 |
Accessing output parameter value in scheme | nnvoro | Fluent UDF and Scheme Programming | 1 | October 11, 2014 15:53 |
UDF: exporting a variable between two DEFINE function | Carlo | FLUENT | 3 | August 19, 2009 13:21 |