|
[Sponsors] |
UDF to adjust flow rate at outflow boundary condition |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
May 15, 2016, 04:25 |
UDF to adjust flow rate at outflow boundary condition
|
#1 |
Member
khar nab
Join Date: Sep 2009
Posts: 34
Rep Power: 16 |
Hi all,
I am simulating a multiphase flow in a domain which has one inlet and two outlets. I have gas and liquid and would like to impose a certain flow split based on the fractions of flow rate at the outlets. Using Outflow BC, one can impose a constant flow fraction at each outlet with the total equal to unity. Then, I need to adjust these fractions depending on the volume fraction of one of the phases at a given outlet. It means simply: If volume fraction of phase x at outlet 1 = value, then adjust the flow rate fraction to value can Any one advise on which UDF should be used? Thanks |
|
May 24, 2016, 06:33 |
managed to get the area averaged volume fraction
|
#2 |
Member
khar nab
Join Date: Sep 2009
Posts: 34
Rep Power: 16 |
Hi all,
I managed to get this UDF. So far it calculates the area-averaged volume fraction, at the required boundary, correctly. However, the few commands I added to adjust the outflow boundary condition through input parameter is not working. Any hints? Thank you in advance #include "udf.h" # define domain_ID 3 DEFINE_ADJUST(face_av,domain) { /* Variables used by serial, host, node versions */ int surface_thread_id=0; real total_area=0.0; real total_oilvof=0.0; real gasout_split=RP_Get_Input_Parameter("gasout_flow") ; domain = Get_Domain(domain_ID); /* "Parallelized" Sections */ #if !RP_HOST /* Compile this section for computing processes only (serial and node) since these variables are not available on the host */ Thread* thread; face_t face; real area[ND_ND]; #endif /* !RP_HOST */ /* Get the value of the thread ID from a user-defined Scheme variable */ #if !RP_NODE /* SERIAL or HOST */ surface_thread_id = RP_Get_Integer("oilvof_av/thread-id"); Message("\nCalculating on Thread # %d\n",surface_thread_id); #endif /* !RP_NODE */ /* To set up this user Scheme variable in cortex type */ /* (rp-var-define 'oilvof_av/thread-id 2 'integer #f) */ /* Once set up you can change it to another thread's ID using : */ /* (rpsetvar 'oilvof_av/thread-id 7) */ /* Send the ID value to all the nodes */ host_to_node_int_1(surface_thread_id); /* Does nothing in serial */ #if RP_NODE Message("\nNode %d is calculating on thread # %d\n",myid, surface_thread_id); #endif /* RP_NODE */ #if !RP_HOST /* SERIAL or NODE */ /* thread is only used on compute processes */ thread = Lookup_Thread(domain,surface_thread_id); begin_f_loop(face,thread) /* If this is the node to which face "officially" belongs,*/ /* get the area vector and volume fraction and increment */ /* the total area and total volume fraction values for this node */ if (PRINCIPAL_FACE_P(face,thread)) /* Always TRUE in serial version */ { F_AREA(area,face,thread); total_area += NV_MAG(area); total_oilvof += NV_MAG(area)*F_VOF(face,thread); } end_f_loop(face,thread) Message("Total Area Before Summing %f\n",total_area); Message("Total Volume fraction Before Summing %f\n",total_oilvof); # if RP_NODE /* Perform node synchronized actions here Does nothing in Serial */ total_area = PRF_GRSUM1(total_area); total_oilvof = PRF_GRSUM1(total_oilvof); if ((total_oilvof/total_area) > 0) { gasout_split = 0.75; gasout_flow = gasout_split; } # endif /* RP_NODE */ #endif /* !RP_HOST */ /* Pass the node's total area and oil volume fraction to the Host for averaging */ node_to_host_real_2(total_area,total_oilvof); /* Does nothing in SERIAL */ #if !RP_NODE /* SERIAL or HOST */ Message("Total Area After Summing: %f (m2)\n",total_area); Message("Total Oil Volume Fraction After Summing %f (N)\n",total_oilvof); Message("Average oil volume fraction on Surface %d is %f \n", surface_thread_id,(total_oilvof/total_area)); Message("Flow weighting ratio at gas outlet is: %f \n",gasout_split); #endif /* !RP_NODE */ } |
|
|
|
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 05:21 |
Out mass flow rate when using opening boundary condition | shivasluzz | CFX | 0 | September 11, 2015 09:51 |
Volume flow rate boundary condition in OpenFOAM | mayank.dce2k7 | OpenFOAM Running, Solving & CFD | 13 | August 11, 2014 20:16 |
Corrected (Referred) Mass Flow Rate Boundary Condition | ermuir | CFX | 1 | November 20, 2012 17:11 |
RPM in Wind Turbine | Pankaj | CFX | 9 | November 23, 2009 04:05 |