# UDF for effective thermal conductivity in porous media

 User Name Remember Me Password
 Register Blogs Members List Search Today's Posts Mark Forums Read

 February 24, 2014, 02:22 UDF for effective thermal conductivity in porous media #1 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 Hi all, I am trying to modify effective thermal conductivity in porous media as default keff used by fluent is not suitable for porosity of material larger than 0.9. My modified formula is where keff (effective thermal conductivity) = 1/3*(1-e(porosity)*ks (solid thermal conductivity) Can you give some hints of writing this code in UDF fluent? Please help me out...... My code is incorrect when loading in fluent: #include "udf.h" #include "mem.h" DEFINE_PROPERTY (cell_keff,c,t) { real porosity=0.9; real k_s=400; real my_keff=C_K_EFF(c,t,prt); my_keff=k_s/3*(1-porosity); return my_keff; } Last edited by dotapro; February 24, 2014 at 07:45.

 February 24, 2014, 06:37 #2 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 "prt" in your code is not defined. You should put the turbulent Prandtl number there, somehow.

 February 24, 2014, 07:50 #3 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 I'm actually using laminar flow. Can I ignore the term prt by putting it as C_K_EFF(c,t)? Another thing is I notice C_K_EFF(c,t) is a variable for macros. Is it the right way to define?

 February 24, 2014, 08:43 #4 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 Ah, I see you want the thermal conductivity of the solid. I don't think you should use C_K_EFF(c,t,prt), that has to do with turbulent calculations. If you wanted to have the thermal conductivity of the fluid, you should have used C_K_L(c,t). But for the solid, I can not find it... The Fluent manual says (6.2.3.3.1): " The fluid thermal conductivity k_f and the solid thermal conductivity k_s can be computed via user-defined functions. " But I can not find which user-defined function you need for solid thermal conductivity...

 February 24, 2014, 08:54 #5 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 Yes, you are right. I having trouble to define macro for solid thermal conductivity where I can't find it in Fluent UDF manual. Plus , I'm not sure that C_K_EFF(c,t) can be set equal to something (my_keff) . Hoping some help will come soon.

 February 24, 2014, 09:03 #6 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 Forget about the C_K_EFF(c,t,prt), it is not related to what you need. That is about averaging out turbulent effects, you want to average out porosity effects. Those are different things. I found somewhere in mem.h that Fluent uses Code: `MATERIAL_PROP(THREAD_SOLID_MATERIAL(t),PROP_ktc))` to obtain the thermal conductivity of the solid. You could try that. I never used it, so doublecheck any results you get.

 February 24, 2014, 09:07 #7 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 I guess it would look something like this: Code: ```#include "udf.h" DEFINE_PROPERTY (cell_keff,c,t) { real porosity=0.9; real my_keff; my_keff=MATERIAL_PROP(THREAD_SOLID_MATERIAL(t),PROP_ktc))/3.0*(1-porosity); return my_keff; }``` I don't know if Fluent will complain about PROP_ktc, and what to do if it complains...

 February 24, 2014, 10:00 #8 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 I try to interpret or compile this code. However, both of these operations were unsuccessful . Any further help of this ?

 February 24, 2014, 10:15 #9 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 In what way were they unsuccessful? Warning? Error? Wrong result?

 February 24, 2014, 10:40 #10 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 It shown that line 7: structure reference not implemented during interpretation.

 February 24, 2014, 10:45 #11 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 That implies that one of the macros is not implemented for interpreting, and you need to compile it. What is the error message when you compile?

 February 24, 2014, 10:57 #12 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 cpp -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/multiport/src" -I. -DUDF ONFIG_H="" "C:\Users\kedy1lkw\Desktop\New folder\cell_keff.c" Error: C:\\Users\\kedy1lkw\\Desktop\\New folder\\cell_keff.c: line 9: structure reference not implemented cpp -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/multiport/src" -I. -DUDF ONFIG_H="" "C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.0.c" Error: C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.0.c: line 9: structure reference not implemented cpp -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/multiport/src" -I. -DUDF ONFIG_H="" "C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.1.c" Error: C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.1.c: line 9: structure reference not implemented cpp -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/multiport/src" -I. -DUDF ONFIG_H="" "C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.2.c" Error: C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.2.c: line 9: structure reference not implemented cpp -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/cortex/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/client/src" -I"C:\PROGRA~1\ANSYSI~1\v140\fluent\fluent14.0.0/multiport/src" -I. -DUDF ONFIG_H="" "C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.3.c" Error: C:/Users/kedy1lkw/AppData/Local/Temp/cell_keff.c.3.c: line 9: structure reference not implemented Sorry for spamming.

 February 24, 2014, 11:09 #13 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 This is not spamming However, it looks like this is the result of interpreting the udf. You should compile it. (The output in that case starts with "Copied C:\\users\...", I think.)

 February 24, 2014, 11:11 #14 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 Deleted old libudf\ntx86\3ddp_host\libudf.dll libudf\ntx86\3ddp_node\libudf.dll 1 file(s) copied. Copied C:\Users\kedy1lkw\Desktop\New folder/C:\Users\kedy1lkw\Desktop\New folder\cell_keff.c to libudf\src (system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\ntx86\3ddp_host\makefile" ") 1 file(s) copied. (chdir "libudf")() (chdir "ntx86\3ddp_host")() # Generating ud_io1.h cell_keff.c # Generating udf_names.c because of makefile cell_keff.obj udf_names.c udf_names.c(7) : error C2059: syntax error : '}' udf_names.c(8) : warning C4034: sizeof returns 0 (system "copy "C:\PROGRA~1\ANSYSI~1\v140\fluent"\fluent14.0.0\sr c\makefile_nt.udf "libudf\ntx86\3ddp_node\makefile" ") 1 file(s) copied. (chdir "libudf")() (chdir "ntx86\3ddp_node")() # Generating ud_io1.h cell_keff.c # Generating udf_names.c because of makefile cell_keff.obj udf_names.c udf_names.c(7) : error C2059: syntax error : '}' udf_names.c(8) : warning C4034: sizeof returns 0 Done. This is the result I get when compiling.

 February 24, 2014, 11:23 #15 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 I see that I made a mistake: "PROP_ktc))" should be "PROP_ktc)". Does that help? The error message you get could be related to line endings. There is a windows way of ending lines, and a linux way of ending lines. You might have to tell your editing program to use the other one.

 February 24, 2014, 11:41 #16 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 Thank you very much for your help. It was successful compiled. So, will default keff in fluent directly replaced by this new keff or I need to hook DEFINE_PROPERTY? If yes,where should I hook it in ?

 February 24, 2014, 11:43 #17 Senior Member   Join Date: Nov 2013 Posts: 1,086 Rep Power: 14 In the place where you select your thermal conductivity, you should choose the user defined function (probably named libudf::cell_keff).

 February 24, 2014, 11:56 #18 Member   Join Date: Oct 2013 Location: Malaysia Posts: 39 Rep Power: 5 I guess it is the solid thermal conductivity material that I should hook in the udf. Once again, I really appreciate for your time being to help me out. Thank you very much.

 Thread Tools Display Modes Linear Mode

 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 OffTrackbacks are On Pingbacks are On Refbacks are On Forum Rules

 Similar Threads Thread Thread Starter Forum Replies Last Post Bernard Van FLUENT 29 January 26, 2017 05:09 pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12 aggie FLUENT 3 June 17, 2012 09:51 Chander CFX 4 March 4, 2012 05:07 Rashmi FLUENT 1 November 6, 2007 21:08

All times are GMT -4. The time now is 01:54.

 Contact Us - CFD Online - Privacy Statement - Top