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

UDF to measure Mass Flow Rate

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree13Likes

Reply
 
LinkBack Thread Tools Display Modes
Old   August 14, 2013, 11:42
Default UDF for keep water height constant at inlet for a VOF model
  #21
Senior Member
 
Tanjina Afrin
Join Date: May 2013
Location: South Carolina
Posts: 168
Rep Power: 6
Tanjina is on a distinguished road
Hi, does anybody have UDF for keeping the water height constant at inlet for VOF ( 2 phase) model? Or can anyone can give an idea from where I can learn how to write UDF ?


I badly need of it. It will be very great if anyone can help me . Thanks a ton in advance.
Tanjina is offline   Reply With Quote

Old   February 15, 2014, 03:18
Default
  #22
New Member
 
DungPham's Avatar
 
Dung A.Pham
Join Date: Sep 2011
Location: Anseong, Korea
Posts: 20
Rep Power: 8
DungPham is on a distinguished road
Quote:
Originally Posted by Tanjina View Post
Hi, does anybody have UDF for keeping the water height constant at inlet for VOF ( 2 phase) model? Or can anyone can give an idea from where I can learn how to write UDF ?


I badly need of it. It will be very great if anyone can help me . Thanks a ton in advance.
If you show a specific picture, Maybe I can help you
DungPham is offline   Reply With Quote

Old   September 26, 2017, 12:50
Default
  #23
Senior Member
 
Astio Lamar
Join Date: May 2012
Location: Pipe
Posts: 186
Rep Power: 7
asal is on a distinguished road
Quote:
Originally Posted by a.lynchy View Post
Hi Kartn
The problem with the previous code that I posted was in getting the value for the variable “flow” from the DEFINE_EXECUTE_AT_END section and using it in the DEFINE_PROFILE. The way it was set as a global variable was okay but what was happening was it was been set to zero after the DEFINE_EXECTUE_AT_END loop so the DEFINE_PROFILE function was seeing a value of flow=0. Sorry if what I am saying is hard to follow, but I have attached the working code below and maybe from comparing the two you will be able to understand.
The only real different is in introducing the flow_tot variable as the global variable instead of using the flow variable.

#include"udf.h"
real flow_tot;
real p ;

DEFINE_EXECUTE_AT_END(funny)
{
Domain *d;

real flow;
cell_t c;
Thread *t;
face_t f;
d = Get_Domain(1);
t= Lookup_Thread(d, 12);

begin_f_loop(f,t)
{
flow+=F_FLUX(f,t);
}
end_f_loop(f,t)
p = C_P(c,t);
printf(
"static pressure = %g\n", p);
printf(
"MASS Flow Rate: %g\n",flow);
flow_tot =flow;
flow=0.;
}

DEFINE_PROFILE(pressure_out,t,i)
{
real set_point = 1;
real pressure;
face_t f;




printf(
"MASS Flow Rate: %g\n",flow_tot);
if (flow_tot < set_point)

pressure = p - 1;

elseif (flow_tot > set_point)

pressure = p + 1;

else
pressure = p;



begin_f_loop(f,t)
{
F_PROFILE(f,t,i) = pressure;
}
end_f_loop(f,t)
printf(
"Adjusted pressure = %g\n", pressure);
}

Hope this helps!
I tried to use this UDF initially and modify according to my case. Prior to any modification, I got the following error after the first iteration on "DEFINE_EXECUTE_AT_END".

Code:
==============================================================================

Node 0: Process 13808: Received signal SIGSEGV.

==============================================================================

==============================================================================

Node 1: Process 17288: Received signal SIGSEGV.

==============================================================================

==============================================================================

Node 3: Process 17844: Received signal SIGSEGV.

==============================================================================

==============================================================================

Node 999999: Process 16332: Received signal SIGSEGV.

==============================================================================

==============================================================================

Node 5: Process 12176: Received signal SIGSEGV.

==============================================================================

==============================================================================

Node 6: Process 17444: Received signal SIGSEGV.

==============================================================================
MPI Application rank 0 exited before MPI_Finalize() with status 2
 The fl process could not be started.
How can I fix this error?!!
Thanks.
PS: I interpret the UDF.
asal is offline   Reply With Quote

Reply

Tags
lookup_thread, mass flow rate, udf

Thread Tools
Display Modes

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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
mass flow rate not conserved in turbomachine, interface defined wrong? wildli FLUENT 2 July 8, 2015 11:38
mass flow rate (CFX post) sanchezz CFX 2 January 14, 2010 07:54
Mass Flow Rate student87 CFX 4 January 2, 2010 05:45
mass flow rate entering and exiting a cell samir bensaid FLUENT 0 July 4, 2007 05:37
User defined function of mass flow rate Eric FLUENT 1 April 22, 2005 18:15


All times are GMT -4. The time now is 22:30.