UDF for effective thermal conductivity in porous media
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; } |
"prt" in your code is not defined. You should put the turbulent Prandtl number there, somehow.
|
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?
|
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... :( |
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.
|
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)) |
I guess it would look something like this:
Code:
#include "udf.h" |
I try to interpret or compile this code. However, both of these operations were unsuccessful . Any further help of this ?
|
In what way were they unsuccessful? Warning? Error? Wrong result?
|
It shown that line 7: structure reference not implemented during interpretation.
|
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?
|
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. |
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.) |
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. |
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. |
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 ?
|
In the place where you select your thermal conductivity, you should choose the user defined function (probably named libudf::cell_keff).
|
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.
|
All times are GMT -4. The time now is 21:23. |