|
[Sponsors] | |||||
|
|
|
#1 |
|
Guest
Posts: n/a
|
i have encountered a question about user defined function. since i had to input a unsteady UDF of both pressure and mass flow rate at the same time. with the reference of tutorial, i easily got the desired similar UDF as below.
#include "udf.h" DEFINE_PROFILE(unsteady_pressure, thread, position) { float t, pressure; face_t f; t = RP_Get_Real("flow-time"); pressure (3800*t*t*t*t*t10000*t*t*t*t*t+10000*t*t*t*t-4000*t*t*t+50*t*t+200t+100); begin_f_loop(f, thread) { F_PROFILE(f, thread, position) = pressure; } end_f_loop(f, thread) } but when i evaluate the result carefully. i forgot the pressure function only valid for the period of from t= 0 to t=1. After that,the pressure dropped to negative value, which was incorrect for my study. So what i wanted a solution was how to combined two function in a single UDF or can Fluent load two UDF at the same time and forced FLUENT to run the UDF periodically of 1 second. For the mass flow rate, say my designed function was mass = (-3*t*t*t*t+9*t*t*t-7*t*t+1*t+1); thanks in advance. |
|
|
||
|
|
|
#2 |
|
Guest
Posts: n/a
|
Dear Eric, you can use an If-else check in your UDF, i.e.,
if (t >=0 && t <=1) { ....; } else { ...; } So that you can use a single UDF. Sincerely, Saad |
|
|
||
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UDF to measure Mass Flow Rate | a.lynchy | Fluent UDF and Scheme Programming | 31 | October 4, 2018 15:10 |
| mass flow in is not equal to mass flow out | saii | CFX | 12 | March 19, 2018 06:21 |
| Droplet Evaporation | Christian | Main CFD Forum | 2 | February 27, 2007 07:27 |
| mass flow rate error | Masood | FLUENT | 0 | May 22, 2005 01:32 |
| Mass flow rate | Neser | CFX | 4 | February 14, 2004 01:27 |