|
[Sponsors] |
March 25, 2009, 12:06 |
Defining species mass fraction using a UDF
|
#1 |
New Member
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
Hi there,
I'd like to know how to define species mass fraction with a UDF. I found the macro C_YI(c,t,i), for defining the species mass fraction. But how to hook this in fluent? Probably under inlet at the boundary conditions panel, but which is the appropriate general-purpose macro for this? I tried the following but the mass fraction doesn't change. Code:
DEFINE_PROFILE(species_profile, t, position) { cell_t c; begin_c_loop(c, t) { if (temp_avg > 700) { C_YI(c,t,0) = 0.2; } else { C_YI(c,t,0) = 0.8; } } end_c_loop(c, t) } Last edited by T81; March 25, 2009 at 13:55. |
|
March 26, 2009, 03:57 |
|
#2 |
Senior Member
Max
Join Date: Mar 2009
Posts: 133
Rep Power: 17 |
Hello,
DEFINE_PROFILE has to return a value using C_PROFILE(c,t,i): DEFINE_PROFILE(species_profile, t, i) { cell_t c; begin_c_loop(c, t) { if (temp_avg > 700) { C_PROFILE(c,t,i) = 0.2; } else { C_PROFILE(c,t,i) = 0.8; } } end_c_loop(c, t) }Hook it in the boundary condition panel for your fluid zone(s) and make sure that Sum[C_YI(i)] = 1 is still valid after executing this UDF ! cheers |
|
March 26, 2009, 04:59 |
|
#3 |
New Member
Join Date: Mar 2009
Posts: 15
Rep Power: 17 |
coglione thank you very much for the quick response.
It works!!! Thanks again |
|
April 19, 2018, 08:02 |
|
#4 |
New Member
pornthep sittisak
Join Date: Apr 2018
Posts: 4
Rep Power: 8 |
I need co mass fraction from back surface of the fan (ID=5) to use as CO species of outlet at front of the fan.
I also try to find the cause of this error when in try to put below UDF in my problem. Error: received a fatal signal (Segmentation fault). Error: received a fatal signal (Segmentation fault). Error Object: #f Here my UDF, aim to bring the CO (species mass fraction) variable data from back to front of the long cylinder tube. #include "udf.h" //Global variable declaration real co; //Execute every timestep DEFINE_EXECUTE_AT_END(Fanback) { //Specific the domain ** 1 = mixture domain Domain *mix_domain = Get_Domain(1); Thread *mix_thread; Thread **pt; //Initialize the variable co = 0; #if !RP_HOST mp_thread_loop_f(mix_thread, mix_domain, pt) { face_t c; // pt[0] ** number [0] is co phase index (co in this case) begin_f_loop(c, pt[0]) { // Check if it is a outlet thread (thread id = 5) (Lookup from region list) if (THREAD_ID(mix_thread)==5){ // Loop and sum up the flux for each face co =F_YI(c,pt[0],1); } } end_f_loop(c, pt[0]) } #endif /* !RP_HOST */ node_to_host_real_1(co); #if RP_HOST Message("CO Concentration at FAN BACK = %f\n",co); #endif /* !RP_NODE */ } // Creating profile for returning inlet DEFINE_PROFILE(co_outlet,t,i) { face_t f; begin_f_loop(f,t) { //Apply flowout variable to the face F_PROFILE(f,t,i) = co; } end_f_loop(f,t) } I can pass the complied and Hook the run the simulation using these UDF but the error is shown when first the time step is finished. |
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
On the damBreak4phaseFine cases | paean | OpenFOAM Running, Solving & CFD | 0 | November 14, 2008 22:14 |
I need UDF help. | S.Whitney | FLUENT | 0 | October 15, 2007 12:29 |
UDF for Species mass fraction | daniel | FLUENT | 3 | June 22, 2005 09:40 |
UDF for Species mass fraction | Rahul | FLUENT | 0 | September 20, 2002 05:22 |
Species Mass Fraction inside UDF using PDF? | Daniel Schneider | FLUENT | 0 | September 20, 2000 07:34 |