Calling zone name, zone id and total pressure from Fluent scheme to UDF
Hello,
I am calling zone id, zone name and total pressure from fluent scheme language to fluent UDF. I got appropriate zone id and zone name, but total pressure is not correct. Following is the Scheme which I used; (rp-var-define 'a () 'list #f) (rpsetvar 'a ()) (for-each (lambda (t) (rpsetvar 'a (list-add (rpgetvar 'a) (thread-id t)))) (get-all-threads)) (rpgetvar 'a) (rp-var-define 'b () 'list #f) (rpsetvar 'b ()) (for-each (lambda (t) (rpsetvar 'b (list-add (rpgetvar 'b) (thread-name t)))) (get-all-threads)) (rpgetvar 'b) (rp-var-define 'p() 'total-pressure #f) (rpsetvar 'p()) (for-each ( lambda (t) (rpsetvar 'p (list-add (rpgetvar 'p) (thread-id t)))) (get-all-threads)) (rpgetvar 'p) and following is the UDF; #include "udf.h" #include "var.h" #ifdef STRUCT_REF #define PRINT printf #define thread-id-list a #define thread-name-list b #define total-pressure p #else #define PRINT CX_Message #endif DEFINE_ON_DEMAND(zoneid_zonename) { int i; int a = RP_Get_List_Length("a"); int b = RP_Get_List_Length("b"); int p = RP_Get_List_Length("p"); PRINT("length of ID list: %dn", a); PRINT("length of NAME list: %dn", b); PRINT("length of PRESSURE list : %dn", p); for (i = 0; i < a; i++) { PRINT("Zone ID: %d ...has the name %s... has the pressure = %d\n", RP_Get_List_Ref_Int("a", i), RP_Get_List_Ref_String("b", i), RP_Get_List_Ref_Int("p",i)); } } Could anybody help me, what is wrong in UDF/scheme? |
UDF for calculating volume-integral absolute pressure in all zones
As I understand, the problem was that you added (thread-id t) again to p.
I don't know about methods of obtaining total-pressure for ZONE in FLUENT, becuse it is quantity determined in each CELL. However, we can calculate volume-integral of total-pressure in the zone directly in the UDF code. Below is the code to calculate ABSOLUTE pressure in fluent (TOTAL+OPERATING) because it is more informative, then total pressure. To calculate total pressure (relative), just exclude adding p_operating to the abs_pressure variable in the code, it would be: Code:
abs_pressure+=C_P(c,c_thread)*C_VOLUME(c,c_thread); Code:
rp-var-define 'a () 'list #f) Code:
#include "udf.h" You can compare the values with Code:
report/volume-integrals/vol-avg |
Thank you very much for your reply
:):) |
All times are GMT -4. The time now is 01:46. |