# How to provide boundary conditions in Fluent when only total pressure drop is known?

 Pressure inlet is formulated with total pressure and pressure outlet with static pressure. You cannot directly provide total pressure drop as a boundary condition. A UDF example is provided for the case of one inlet and and two outlets. The 2 total pressure drops are known. (respectively 20 and 200 Pa) At each iteration total pressure drop is calculated and static pressure at outlets are adjusted to match expected pressure drop. #include "udf.h" #define IDINLET 8 #define IDOUT1 7 #define IDOUT2 6 #define DELTAPTOT1 20. #define DELTAPTOT2 200. real pin=DELTAPTOT1,pout1,pout2; DEFINE_PROFILE(pinlet,tf,nv) { face_t f; begin_f_loop(f,tf) { F_PROFILE(f,tf,nv)=pin; } end_f_loop(f,tf) } DEFINE_PROFILE(poutlet1,tf,nv) { face_t f; begin_f_loop(f,tf) { F_PROFILE(f,tf,nv)=pout1; } end_f_loop(f,tf) } DEFINE_PROFILE(poutlet2,tf,nv) { face_t f; begin_f_loop(f,tf) { F_PROFILE(f,tf,nv)=pout2; } end_f_loop(f,tf) } DEFINE_ADJUST(ajuste,d) { Thread *tf; face_t f; real pdyn1=0,pdyn2=0,area2,massflow1=0,massflow2=0; real A[ND_ND]; #if !PR_HOST tf=Lookup_Thread(d,IDOUT1); area2=0; begin_f_loop(f,tf) if PRINCIPAL_FACE_P(f,tf) { F_AREA(A,f,tf); pdyn1+=0.5*F_FLUX(f,tf)*F_FLUX(f,tf)/F_R(f,tf)/NV_MAG(A); massflow1+=F_FLUX(f,tf); area2+=NV_MAG(A); } end_f_loop(f,tf) PRF_GRSUM3(pdyn1,massflow1,area2); if (massflow1<0) pdyn1=0; pdyn1/=area2; pout1=pin-pdyn1-DELTAPTOT1; tf=Lookup_Thread(d,IDOUT2); area2=0; begin_f_loop(f,tf) if PRINCIPAL_FACE_P(f,tf) { F_AREA(A,f,tf); pdyn2+=0.5*F_FLUX(f,tf)*F_FLUX(f,tf)/C_R(F_C0(f,tf),THREAD_T0(tf))/NV_MAG(A); massflow2+=F_FLUX(f,tf); area2+=NV_MAG(A); } end_f_loop(f,tf) PRF_GRSUM3(pdyn2,massflow2,area2); if (massflow2<0) pdyn2=0; pdyn2/=area2; pout2=pin-pdyn2-DELTAPTOT2; /* Message0("n delta P1=%10.5e Pa, delta P2=%10.5e Pa, pdyn1= %10.5e Pa, pdyn2= %10.5e Pa n",pin-pout1-pdyn1,pin-pout2-pdyn2,pdyn1,pdyn2); Message0("mass_flow1 = %10.5e kg/s mass_flow2 = %10.5e kg/s n",massflow1,massflow2); */ #endif node_to_host_real_2(pout1,pout2); host_to_node_real_2(pout1,pout2); /* Message("n pout1 = %10.5e Pa, pout2= %10.5e Pa n",pout1,pout2);*/ } DEFINE_RW_FILE(writer,fp) { node_to_host_real_2(pout1,pout2); #if !RP_NODE Message("Writing UDF data to data file...n"); fprintf(fp,"%10.10e %10.10e",pout1,pout2); /* write out kount to data file */ #endif } DEFINE_RW_FILE(reader,fp) { #if !RP_NODE Message("Reading UDF data from data file...n"); fscanf(fp,"%f %f",&pout1,&pout2); /* read kount from data file */ #endif host_to_node_real_2(pout1,pout2); Message0("n pout1 = %10.5e Pa, pout2= %10.5e Pa n",pout1,pout2); }