|
[Sponsors] |
Variable mass flow rate (Step function) dependent on Coordinates UDF |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
September 15, 2023, 03:24 |
Variable mass flow rate (Step function) dependent on Coordinates UDF
|
#1 |
New Member
veda
Join Date: Jul 2022
Posts: 8
Rep Power: 4 |
Hello. I am trying to use a UDF to model a step function for mass flow rate at inlet of my simulation.
It is a simple case of: If the x-coordinate of the face is less than 'certain value', mass flow rate = A, otherwise, mass flow rate = B. I am using the following UDF, but when I initialize and check my case, the entire inlet is initialized with the 94.0 Kg/s. I checked the coordinates and it seems fine. (I can initialize a velocity step function using the same coordinates without any issues, using the same code below (changing inlet_mf to inlet_z_velocity)). I know I can simply divide the face into multiple faces for a step function inlet like this, and specify the mass flow rates separately, but I am practising writing UDFs, so I was hoping if someone would kindly guide me with what I am doing wrong? Thank you. UDF: #include "udf.h" DEFINE_PROFILE(inlet_mf, thread, position) { real x[ND_ND]; real x0; face_t f; begin_f_loop(f, thread) { F_CENTROID(x,f,thread); x0 = x[0]; if (x0 < 27.65) F_PROFILE(f, thread, position) = 212.0; else F_PROFILE(f, thread, position) = 94.0; } end_f_loop(f, thread) } Last edited by saha.vedabit; September 15, 2023 at 05:03. Reason: additional information |
|
September 15, 2023, 05:01 |
|
#2 |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
code seems to be correct,
by default fluent uses SI so meters for x[0] are you sure 27.65 is correct value?
__________________
best regards ****************************** press LIKE if this message was helpful |
|
September 15, 2023, 05:09 |
|
#3 | |
New Member
veda
Join Date: Jul 2022
Posts: 8
Rep Power: 4 |
Quote:
I wonder why mass flow rate can't be initialized. Does it have a different associated macro or variable that I am supposed to use? |
||
Tags |
cfd, fluent, udf |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
mass flow in is not equal to mass flow out | saii | CFX | 12 | March 19, 2018 06:21 |
Please help (an UDF for regulating the mass flow rate) | swidi | Fluent UDF and Scheme Programming | 2 | July 30, 2015 13:32 |
Please help me ( udf for regulation the mass flow rate at the inlet ) | swidi | Fluent UDF and Scheme Programming | 0 | July 7, 2015 10:17 |
Star cd es-ice solver error | ernarasimman | STAR-CD | 2 | September 12, 2014 01:01 |
Could anybody help me see this error and give help | liugx212 | OpenFOAM Running, Solving & CFD | 3 | January 4, 2006 19:07 |