|
[Sponsors] |
![]() |
![]() |
#21 |
Senior Member
Tanjina Afrin
Join Date: May 2013
Location: South Carolina
Posts: 169
Rep Power: 13 ![]() |
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. |
|
![]() |
![]() |
![]() |
![]() |
#22 | |
New Member
Dustin
Join Date: Sep 2011
Location: Earth
Posts: 23
Rep Power: 14 ![]() |
Quote:
![]() |
||
![]() |
![]() |
![]() |
![]() |
#23 | |
Senior Member
Astio Lamar
Join Date: May 2012
Location: Pipe
Posts: 186
Rep Power: 14 ![]() |
Quote:
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. Thanks. PS: I interpret the UDF. |
||
![]() |
![]() |
![]() |
![]() |
#24 |
New Member
wasim
Join Date: Aug 2015
Posts: 9
Rep Power: 11 ![]() |
Hello everyone i am using the similar UDF to alter the inlet boundary condition of my simulation. Basically i am also calculating the mass flow rate at the outlet of my valve and using this flow rate to calculate the pressure drop in feed line. Can someone help to find out what is problem wit this UDF..
Following UDF i am using to modify the inlet pressure...... #include "udf.h" FILE *fp; real flow_tot; DEFINE_EXECUTE_AT_END(pressure) { Domain *d; float 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) flow_tot =flow; flow=0.; } DEFINE_PROFILE(inlet_pressure, thread, position) { face_t f; float P_i=903063;/* 199625Pa steady state pressure drop in feed circuit*/ real t= CURRENT_TIME;/* steady state inlet pressure 703438Pa*/ /*float flow_t=0;*/ float Del_P=0; fp = fopen("output.txt","a"); fprintf(fp,"MASS Flow Rate: %f kg/s \n",flow_tot); fclose(fp); Del_P=(0.79215*flow_tot*flow_tot); begin_f_loop(f, thread) { F_PROFILE(f, thread, position)=P_i-Del_P; } end_f_loop(f, thread) } |
|
![]() |
![]() |
![]() |
![]() |
#25 |
New Member
wasim
Join Date: Aug 2015
Posts: 9
Rep Power: 11 ![]() |
can someone tells why i am getting Pi=9 bar at t=0 when mass flow is max. this should be 7.0 bar (Pi-Delta_p) but at t=0 i am getting initial pressure as 9.0 bar........where is the problem????can anyone tell....
Delta_P in steady state is given by Del_P=(0.79215*flow_tot*flow_tot); hence in steady state flow rate is maximum hence Pi should be minimum but surface monitor will start reading from 9.0 bar |
|
![]() |
![]() |
![]() |
![]() |
#26 |
New Member
wasim
Join Date: Aug 2015
Posts: 9
Rep Power: 11 ![]() |
Can someone find where is the mistake in following udf. It is always printing zero flow rate at all time steps while mass flow rate from surface monitor is coming total different....???
#include "udf.h" FILE *fp; real flow_tot=0.; DEFINE_EXECUTE_AT_END(fun) { Domain *d; real flow=0.; 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) printf("MASS Flow Rate is: %g kg/s \n",flow_tot); flow_tot =flow; flow=0.; } |
|
![]() |
![]() |
![]() |
![]() |
#27 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 11 ![]() |
Hi Wasim_03,
Your latest question is easy: you are printing the value of "flow_tot" *before* you copy the value of "flow" into it -- it should be after. I haven't looked in detail at your previous questions. I do know that commands involving writing to file (fopen(fp...) fprintf(fp...)) are dangerous in parallel. Much better to print to the Fluent window using Message(...), which has a similar syntax to printf(...). You are presumably trying to print out the value of "flow_tot" because you are not sure whether the value calculated by one UDF will survive when the next UDF is called. This is a valid concern -- you probably want to declare "static real flow_tot=0.;". I worry whether your intended linkage between flowrate and pressure will be stable -- you might want to apply some home-made under-relaxation. (If you do this, you should be aware that DEFINE_PROFILE is sometimes called many times per iteration, for reasons that are not clear to me.) The other stability issue is that DEFINE_PROFILE will be called before DEFINE_EXECUTE_AT_END, so the first iteration might go mad. |
|
![]() |
![]() |
![]() |
![]() |
#28 |
New Member
wasim
Join Date: Aug 2015
Posts: 9
Rep Power: 11 ![]() |
Hi OBSCUREED....Thanks for your reply...
i am able to compiled and run this UDF, your concerned regarding initial time step i have well taken care when Define_profile is called and Execute_at_end is still on hold and to be called subsequently, at this time i have implemented if else logic to define the initial value flow rate to avoid the function go made and both function are working perfectly....... Thanks and regards Wasim |
|
![]() |
![]() |
![]() |
![]() |
#29 | |
New Member
沈建琦
Join Date: May 2017
Posts: 1
Rep Power: 0 ![]() |
Quote:
i'm trying to build a circulating fluidized bed, and encourtered a problems like yours. can you plz give some suggestions? thanks a million in advance |
||
![]() |
![]() |
![]() |
![]() |
#30 | |
Member
Oula
Join Date: Apr 2015
Location: United Kingdom
Posts: 81
Rep Power: 11 ![]() |
Quote:
Is the mass flow rate that you tried to measure is an output of the simulation? |
||
![]() |
![]() |
![]() |
![]() |
#31 | |
Member
Oula
Join Date: Apr 2015
Location: United Kingdom
Posts: 81
Rep Power: 11 ![]() |
Quote:
Is the mass flow rate that you tried to measure is an output of the simulation? |
||
![]() |
![]() |
![]() |
![]() |
#32 |
Senior Member
Join Date: Sep 2017
Posts: 246
Rep Power: 11 ![]() |
Hi Oula,
You seem to be replying to the original post -- this is confusing, because that post was answered completely by coglione in 2010. If you have your own question, it is probably better to start a new thread. (The content of a.lynchy's question was good, by the way, and worth emulating -- it included descriptions of the goal, the current progress, the problem and a possible route towards a solution.) Good luck! Ed |
|
![]() |
![]() |
![]() |
Tags |
lookup_thread, mass flow rate, udf |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
mass flow rate not conserved in turbomachine, interface defined wrong? | wildli | FLUENT | 3 | September 15, 2022 12:19 |
mass flow rate (CFX post) | sanchezz | CFX | 2 | January 14, 2010 06:54 |
Mass Flow Rate | student87 | CFX | 4 | January 2, 2010 04: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 |