Define_adjust does't work
HI,guys!
I'm aiming to write a udf to achieve getting the water vaper mass fraction and store it. the codes as follows: DEFINE_ADJUST(water_fraction,d) {Thread *t; cell_t c; real watdry; real watwet; real watdryav; real watwetav; real volume; real vol_tot; real vol_tot2; thread_loop_c(t,d) {if(THREAD_ID(t)==26) /* dry gdl */ { begin_c_loop(c,t) { volume=C_VOLUME(c,t); watdry=C_YI(c,t,0); watdryav+=watdry*volume; vol_tot+=volume; } end_c_loop(c,t) } else if(THREAD_ID(t)==27) /* wet gdl */ { begin_c_loop(c,t) { volume=C_VOLUME(c,t); watwet=C_YI(c,t,0); watwetav+=watwet*volume; vol_tot2+=volume; } end_c_loop(c,t) } } watdryav/=vol_tot; watwetav/=vol_tot2; thread_loop_c(t,d) {if(THREAD_ID(t)==26) { begin_c_loop(c,t) { C_UDMI(c,t,1)=watdryav; } end_c_loop(c,t) } else if(THREAD_ID(t)==27) { begin_c_loop(c,t) { C_UDMI(c,t,2)=watwetav; } end_c_loop(c,t) } } } I get the THREAD_ID(t) number (26,27) from fluent bc pannel,and they are porous zones,but when i run through this codes,it does't work,the value of C_UDMI(c,t,2) or C_UDMI(c,t,1) is still zero when i check out the fluent results. Thanks in advance for any suggestions |
You need a text editor with indention. Add a "{" after
Code:
thread_loop_c(t,d) |
Quote:
Code:
thread_loop_c(t,d) Code:
DEFINE_ADJUST(water_fraction,d) |
Fair enough. You could use
Code:
Lookup_Thread Are you sure that both "watdry" and "watwet" are the same species "C_YI(c,t,0)"? You could print the value of watdryav, watwetav, vol_tot, vol_tot2 use Code:
Message |
hi blackmask,thank you for your advices.
i just try the code lookup_thread,but it also can't not work.the udf presented is a small part among my all udf documents,and there are many udfs i haven't present here including Code:
thread_loop_c(t,d) both "watdry" and "watwet" are the same species "C_YI(c,t,0)",i use species transport model in my case,the fluid is a mixture of watervapor and dry air.C_YI(c,t,0) represents the watervapor. and i use the syntax 'message' to print the value of some varibles,when run the case,all values equal to zero,so thread_loop_c(t,d) is not actually executed. |
Hi Luckchen,
Were you ever able to resolve this problem? Could you please share the details? |
All times are GMT -4. The time now is 13:46. |