|
[Sponsors] |
August 9, 2016, 05:03 |
DEFINE_PROPERTY and then C_K_L
|
#1 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
Hi Friends,
Is it possible to define thermal conductivity using DEFINE_PROPERTY macro and then retrieve this value in another UDF function using C_K_L macro? I did something like that but it does not work (message function returns 0 instead of 1111): Code:
#include "udf.h" DEFINE_PROPERTY(helCond, c, t) { real k = 1111; return k; } DEFINE_ON_DEMAND(ilehelCond) { Domain *domain; domain = Get_Domain(1); cell_t c; Thread *c_thread; // c_thread = Lookup_Thread(domain, 12); thread_loop_c(c_thread, domain) /*loops over all cell threads in domain*/ { begin_c_loop(c, c_thread) /* loops over cells in a cell thread */ { Message("k = %f%s", C_K_L(c, c_thread), "\n"); } end_c_loop(c, c_thread) } }
__________________
best regards pblasiak |
|
August 11, 2016, 08:17 |
|
#2 |
Senior Member
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 16 |
Well, I guess it should work. Here is something working close to your own UDF :
Code:
DEFINE_ON_DEMAND(report) {Domain *d = Get_Domain(1);Thread *t = Lookup_Thread(d,2);real lambda = 0.; real volume = 0.; begin_c_loop(c,t) { lambda += C_K_L(c,t); volume += C_VOLUME(c,t); } lambda = lambda / volume; Message("lambda = %f \n; lambda);} |
|
August 11, 2016, 09:28 |
|
#3 |
Senior Member
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16 |
Hi Aurelien Thinat
No my UDF does not work. In the code I wrote, the message function should return 1111 value, while it returns 0.
__________________
best regards pblasiak |
|
|
|