- **Fluent UDF and Scheme Programming**
(*http://www.cfd-online.com/Forums/fluent-udf/*)

- - **volume flow rate error in udf**
(*http://www.cfd-online.com/Forums/fluent-udf/78065-volume-flow-rate-error-udf.html*)

volume flow rate error in udfIn order to model a specific pressure outlet condition, I wrote a UDF that compute the outlet pressure with the following equation:
p_out=k*(4e6)*Q_out+2000 (1) where p_out is the outlet pressure, Q_out the outlet volume flow rate and k a coefficient that i use to increase the resistance at the outlet. In my real model I have 19 outlets, and 8 should use this condition (for the other k=1). I tested my UDF on a cylinder of 1cm radius and 8cm length, for Re=1000 at the inlet (velocity inlet), with k=2 and 200. among the different test, I output the outlet pressure and I compared it with the expected pressure from equ. (1). I was really surprised of the difference: p_out=2009Pa instead of 2928Pa for k=2 and 5327Pa instead of 94800Pa for k=200. Could you tell me if there is any problem in my udf, especially the way to obtain the outlet volume flow rate? the code is as follow: #include "udf.h" #include "unsteady.h" DEFINE_PROFILE(resistance_S,thread,i) { real Q=0.; real t=CURRENT_TIME; real A[ND_ND]; face_t f; float u,v,w,vi,vn; float k=2.0; { begin_f_loop(f,thread) { u=F_U(f,thread); v=F_V(f,thread); w=F_W(f,thread); vi=u*u+v*v+w*w; vn=sqrt(vi); F_AREA(A,f,thread); Q=Q+NV_MAG(A)*vn; F_PROFILE(f,thread,i)=k*(4e6)*Q+2000.0; u=0.; v=0.; w=0.; vn=0.; Q=0.; } end_f_loop(f,thread) } Thank you for any help |

It seems there were some mistake in my UDF, so I re wrote it as follow:
#include "udf.h" #include "unsteady.h" DEFINE_PROFILE(resistance_S,thread,i) { real Q=0.; real t=CURRENT_TIME; real A[ND_ND]; face_t f; float u,v,w,vi,vn; float k=2.0; { begin_f_loop(f,thread) { u=F_U(f,thread); v=F_V(f,thread); w=F_W(f,thread); vi=u*u+v*v+w*w; vn=sqrt(vi); F_AREA(A,f,thread); Q=Q+NV_MAG(A)*vn; u=0.; v=0.; w=0.; vn=0.; } end_f_loop(f,thread) begin_f_loop(f,thread) { F_PROFILE(f,thread,i)=k*(4e6)*Q+2000.0; } end_f_loop(f,thread) } } This seems fine now for k=2, but if I set k to 200, I should get a pressure at the outlet of 2.012x10^6Pa, instead I have 1.229x10^6Pa. I also tried it with a Y junction mesh, and even with k=1 for both outlet, the results are not good. Any one could explain me why? |

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