CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > ANSYS > FLUENT > Fluent UDF and Scheme Programming

DEFINE_PROPERTY and then C_K_L

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   August 9, 2016, 05:03
Default DEFINE_PROPERTY and then C_K_L
  #1
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
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
gaza is offline   Reply With Quote

Old   August 11, 2016, 08:17
Default
  #2
Senior Member
 
Aurelien Thinat
Join Date: Jul 2010
Posts: 165
Rep Power: 16
Aurelien Thinat is on a distinguished road
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);
}
Aurelien Thinat is offline   Reply With Quote

Old   August 11, 2016, 09:28
Default
  #3
Senior Member
 
Przemek
Join Date: Jun 2011
Posts: 249
Rep Power: 16
gaza is on a distinguished road
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
gaza is offline   Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 23:39.