|
[Sponsors] |
July 15, 2013, 10:42 |
Define_adjust does't work
|
#1 |
New Member
Chen wubin
Join Date: Jul 2013
Posts: 3
Rep Power: 13 |
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 |
|
July 15, 2013, 22:03 |
|
#3 | |
New Member
Chen wubin
Join Date: Jul 2013
Posts: 3
Rep Power: 13 |
Quote:
Code:
thread_loop_c(t,d) {if(THREAD_ID(t)==26) Code:
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_all(c,t) { volume=C_VOLUME(c,t); watwet=C_YI(c,t,0); watwetav+=watwet*volume; vol_tot2+=volume; } end_c_loop_all(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) } } } |
||
July 15, 2013, 22:42 |
|
#4 |
Senior Member
|
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 |
|
July 16, 2013, 11:15 |
|
#5 |
New Member
Chen wubin
Join Date: Jul 2013
Posts: 3
Rep Power: 13 |
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) { if(THREAD_ID(t)==26) /* dry gdl */ { begin_c_loop(c,t) { ....... } end_c_loop(c,t) } } 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. |
|
August 8, 2015, 20:19 |
|
#6 |
New Member
Achint Sanghi
Join Date: Mar 2015
Posts: 3
Rep Power: 11 |
Hi Luckchen,
Were you ever able to resolve this problem? Could you please share the details? |
|
Tags |
define_adjust, thread_id(t), udmi |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to work with constant pressure? | Martin | Siemens | 2 | February 25, 2009 14:23 |
Getting FoamX to work | shaun | OpenFOAM Installation | 12 | March 23, 2007 09:55 |
work related to brake study of a vehical | aero | Siemens | 3 | November 23, 2006 08:43 |
Why do the Plant library cases don't work? | Alumna | Phoenics | 6 | June 22, 2004 13:08 |
why my In-Form doesn't work? | green | Phoenics | 2 | May 27, 2004 22:03 |