|
[Sponsors] |
UDF issue when implementing a downstream resistance dependent outlet pressure |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
October 26, 2017, 10:37 |
UDF issue when implementing a downstream resistance dependent outlet pressure
|
#1 |
New Member
joe
Join Date: Jun 2016
Posts: 2
Rep Power: 0 |
I am trying to implement the following udf for a simple straight tube model that has laminar flow within it. The desired objective here is to have a flow within the pipe, that is dependent on the downstream resistance. This resistance affects the outlet pressure (P2=resistance*outlet flow). The udf is expected to do this job. However, I am not achieving what I should get.
The inlet pressure is set at 95 mm Hg while the outlet pressure is dependent on this downstream resistance and so this udf is prescribed at the outlet. I am not sure where I am going wrong. Firstly I get a segmentation error during initialization. To avoid that I do initialization without the udf and while running it I reattach it. I know it is not a brilliant way but just want to see it working. Secondly, my outlet pressure and the mass flow rate always remains zero. I tried implementing lot of modifications on it but all seems to fail. Can you kindly help me with this. #include "udf.h" DEFINE_INIT(my_init_func) { Domain *domain = Get_Domain(1); Thread *thread = Lookup_Thread(domain,11); face_t f; begin_f_loop(f, thread) { F_UDMI(f,thread,0) = 0; } end_f_loop(f, thread) printf("Step Pressure Initialized!"); } DEFINE_PROFILE(transient_pressure, thread, position) { real Res = 7.0e+08; /* Resistance m^-4 s^-1 kg^1 */ face_t f; float flow, pout, pprev; real dens = 1050; /* kg m^-3 */ begin_f_loop(f, thread) { flow = F_FLUX(f,thread)/dens; pout = Res*flow; F_PROFILE(f, thread, position) = pout; } end_f_loop(f, thread) } DEFINE_EXECUTE_AT_END(pressure_save) { Domain *domain = Get_Domain(1); Thread *thread = Lookup_Thread(domain,11); face_t f; begin_f_loop(f, thread) { F_UDMI(f,thread,0) = F_P(f,thread); } end_f_loop(f, thread) printf("Step Pressure Recorded!"); } |
|
October 26, 2017, 21:11 |
|
#2 | |
Senior Member
Alexander
Join Date: Apr 2013
Posts: 2,363
Rep Power: 34 |
Quote:
Hello you may try to use this code for initialization part: Code:
DEFINE_INIT(my_init_func) { Thread *t; face_t f; Domain *d; d = Get_Domain(1); t = Lookup_Thread(domain,11); thread_loop_f(t, domain) { begin_f_loop(f,t) { F_UDMI(f,thread,0) = 0; } end_f_loop(f, t) } printf("Step Pressure Initialized!"); } In this way you may see your input data using contours. Best regards |
||
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
UDF to adjust pressure outlet | a.lynchy | FLUENT | 4 | February 15, 2021 00:50 |
static vs. total pressure | auf dem feld | FLUENT | 17 | February 26, 2016 13:04 |
Help ME For Pressure Outlet UDF PLZ!!! | Yapoo | Fluent UDF and Scheme Programming | 2 | December 26, 2011 11:45 |
pressure inlet & outlet. help ASAP Plz | engahmed | Main CFD Forum | 0 | June 13, 2010 15:34 |
Fluent 5.2, UDF and Pressure BC's | Alfonso Ferrandez | FLUENT | 0 | May 4, 2000 07:02 |