|
[Sponsors] |
UDF for effective thermal conductivity in porous media |
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
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: 13 |
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,965
Rep Power: 27 |
"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: 13 |
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,965
Rep Power: 27 |
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: 13 |
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,965
Rep Power: 27 |
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)) |
|
February 24, 2014, 09:07 |
|
#7 |
Senior Member
Join Date: Nov 2013
Posts: 1,965
Rep Power: 27 |
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; } |
|
February 24, 2014, 10:00 |
|
#8 |
Member
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 13 |
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,965
Rep Power: 27 |
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: 13 |
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,965
Rep Power: 27 |
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: 13 |
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="<udfconfig-host.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/udfconfig-node0.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/udfconfig-node1.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/udfconfig-node2.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/udfconfig-node3.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,965
Rep Power: 27 |
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: 13 |
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,965
Rep Power: 27 |
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: 13 |
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,965
Rep Power: 27 |
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: 13 |
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.
|
|
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Porous media setup issues in Fluent | Bernard Van | FLUENT | 29 | January 26, 2017 05:09 |
Source Term UDF VS Porous Media Model | pchoopanya | Fluent UDF and Scheme Programming | 1 | August 28, 2013 07:12 |
Porous media boundary conditions | aggie | FLUENT | 3 | June 17, 2012 10:51 |
Lack of local thermal equilibrium in porous medium | Chander | CFX | 4 | March 4, 2012 05:07 |
UDF for effective thermal conductivity | Rashmi | FLUENT | 1 | November 6, 2007 21:08 |