|
[Sponsors] |
January 30, 2020, 09:31 |
output as input
|
#1 |
New Member
Federico
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
Hello everybody,
I would like to setup a sort of feedback system with my simulation using udf. I would like to get the mass flow rate in my simulation, apply an equation and give it as an input. How could I do that using UDF? Thanks |
|
January 30, 2020, 10:24 |
Tried?
|
#2 |
Senior Member
|
Have you written a UDF to do that? May be one that is not working.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
January 30, 2020, 10:37 |
|
#3 |
New Member
Federico
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
Hi vinerm and thanks for your answer.
At the moment I have written a udf to change rotational speed and head of my pump (they are two separate compiled udf), so my output is the flow rate. I would like to take that flow rate, apply some pipe losses and use them to change the rotational speed input accordingly. Is is possible to do that with UDF? Is there any particular macro or procedure I should follow? |
|
January 30, 2020, 11:00 |
Multiple Ways
|
#4 |
Senior Member
|
This can be done in multiple ways. One is to create a parameter based on flow rate and then use an expression that uses this parameter to define speed. But that requires latest Fluent. If you do not have that, then you can make use of Scheme and C based UDF. You can define an rp variable that stores flow-rate, access it in UDF that changes the speed. Another alternative is to define a global variable to store the flow rate. One UDF will fill it other will use it. But it all depends on which DEFINE_ macros you are using.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
January 30, 2020, 11:20 |
|
#5 |
New Member
Federico
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
Thanks a lot for your advice. I am using Fluent 19.2, so I need to go back to the literature to understand all the information you've given me. My boundary conditions are pressure inlet-pressure outlet.
I am using these two UDF: For rotational speed: Code:
#include "udf.h" DEFINE_ZONE_MOTION(fmotion,omega,axis,origin,velocity,time,dtime) { real ts = N_TIME; real rate= 0.10472; if (ts<5400) { *omega = (1475.0+0.05467*(ts-2401))*rate; } else { *omega = 1639*rate; } N3V_D (velocity,=,0.0,0.0,0.0); N3V_S(origin,=,0.0); /* default values, line could be omitted */ N3V_D(axis,=,0.0,-1.0,0.0); /* default values, line could be omitted */ return; } Code:
/********************************************************************** unsteady.c UDF for specifying a transient pressure profile boundary condition ***********************************************************************/ #include "udf.h" DEFINE_PROFILE(unsteady_pressure, thread, position) { face_t f; real ts = N_TIME; begin_f_loop(f, thread) { if (ts<5400) F_PROFILE(f, thread, position) = 70000.0 + 2.5926*(ts-2401); else F_PROFILE(f, thread, position) = 77777.78; } end_f_loop(f, thread) } |
|
January 30, 2020, 11:26 |
Suggestions
|
#6 |
Senior Member
|
Look for RP_Get_Real in C UDF manual. Look for rpvar in Scheme manual. I am not sure if 19.2 allows expressions. Assuming it does not, create an rpvar, which is a scheme variable, to store flow rate at the outlet. You can also do this calculation within C based UDF. Then you would not require an rpvar. All of it can be done in DEFINE_ZONE_MOTION. Just setup a face loop, i.e., begin_f_loop within DEFINE_ZONE_MOTION and calculate the flow rate. Use that to calculate your speed. Second argument of begin_f_loop can be determined using Lookup_Thread where domain can be fetched using Get_Domain(1) and zone ID is the Boundary ID given in Boundary Conditions panel for the outlet.
__________________
Regards, Vinerm PM to be used if and only if you do not want something to be shared publicly. PM is considered to be of the least priority. |
|
January 30, 2020, 12:05 |
|
#7 |
New Member
Federico
Join Date: Jan 2017
Posts: 11
Rep Power: 9 |
Thanks again vinerm.
I think I need to go back to the udf manual to better understand the expressions you are talking about. I will write down the functions and get back to you to see if they're set correctly. Sorry for that, but I am not very confident with udf approach |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Parameter set output from first block as input to another | Qbz | ANSYS | 1 | May 1, 2024 06:21 |
Scheme - output temperature as an input + increment | rydol | Fluent UDF and Scheme Programming | 4 | January 9, 2020 07:47 |
Output pressure not what I input | williambwright | SU2 | 3 | January 27, 2016 20:33 |
Questions about data output | aki_yafuji | OpenFOAM Running, Solving & CFD | 3 | September 9, 2010 02:59 |
lift and drag on ship superstructures | vaina74 | OpenFOAM Running, Solving & CFD | 3 | June 8, 2010 13:30 |