CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

Variable mass flow rate (Step function) dependent on Coordinates UDF

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   September 15, 2023, 03:24
Default Variable mass flow rate (Step function) dependent on Coordinates UDF
  #1
New Member
 
veda
Join Date: Jul 2022
Posts: 8
Rep Power: 4
saha.vedabit is on a distinguished road
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
saha.vedabit is offline   Reply With Quote

Old   September 15, 2023, 05:01
Default
  #2
Senior Member
 
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34
AlexanderZ will become famous soon enoughAlexanderZ will become famous soon enough
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
AlexanderZ is offline   Reply With Quote

Old   September 15, 2023, 05:09
Default
  #3
New Member
 
veda
Join Date: Jul 2022
Posts: 8
Rep Power: 4
saha.vedabit is on a distinguished road
Quote:
Originally Posted by AlexanderZ View Post
code seems to be correct,
by default fluent uses SI
so meters for x[0]
are you sure 27.65 is correct value?
Thank you for your reply. Yes, I tried initializing a velocity field at inlet with the same code just by changing inlet_mf to inlet_z_velocity and speicifying the cartesian velocity at inlet using udf. It is working fine in that case.

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?
saha.vedabit is offline   Reply With Quote

Reply

Tags
cfd, fluent, udf


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


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


All times are GMT -4. The time now is 03:12.