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

UDF for effective thermal conductivity in porous media

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   February 24, 2014, 01:22
Unhappy UDF for effective thermal conductivity in porous media
  #1
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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 06:45.
dotapro is offline   Reply With Quote

Old   February 24, 2014, 05:37
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
"prt" in your code is not defined. You should put the turbulent Prandtl number there, somehow.
pakk is offline   Reply With Quote

Old   February 24, 2014, 06:50
Default
  #3
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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?
dotapro is offline   Reply With Quote

Old   February 24, 2014, 07:43
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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...
pakk is offline   Reply With Quote

Old   February 24, 2014, 07:54
Default
  #5
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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.
dotapro is offline   Reply With Quote

Old   February 24, 2014, 08:03
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   February 24, 2014, 08:07
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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...
pakk is offline   Reply With Quote

Old   February 24, 2014, 09:00
Default
  #8
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
I try to interpret or compile this code. However, both of these operations were unsuccessful . Any further help of this ?
dotapro is offline   Reply With Quote

Old   February 24, 2014, 09:15
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
In what way were they unsuccessful? Warning? Error? Wrong result?
pakk is offline   Reply With Quote

Old   February 24, 2014, 09:40
Default
  #10
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
It shown that line 7: structure reference not implemented during interpretation.
dotapro is offline   Reply With Quote

Old   February 24, 2014, 09:45
Default
  #11
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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?
pakk is offline   Reply With Quote

Old   February 24, 2014, 09:57
Default
  #12
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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.
dotapro is offline   Reply With Quote

Old   February 24, 2014, 10:09
Default
  #13
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.)
pakk is offline   Reply With Quote

Old   February 24, 2014, 10:11
Default
  #14
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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.
dotapro is offline   Reply With Quote

Old   February 24, 2014, 10:23
Default
  #15
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
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.
pakk is offline   Reply With Quote

Old   February 24, 2014, 10:41
Default
  #16
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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 ?
dotapro is offline   Reply With Quote

Old   February 24, 2014, 10:43
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 1,965
Rep Power: 26
pakk will become famous soon enough
In the place where you select your thermal conductivity, you should choose the user defined function (probably named libudf::cell_keff).
pakk is offline   Reply With Quote

Old   February 24, 2014, 10:56
Default
  #18
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 12
dotapro is on a distinguished road
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.
dotapro 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Porous media setup issues in Fluent Bernard Van FLUENT 29 January 26, 2017 04:09
Source Term UDF VS Porous Media Model pchoopanya Fluent UDF and Scheme Programming 1 August 28, 2013 06:12
Porous media boundary conditions aggie FLUENT 3 June 17, 2012 09:51
Lack of local thermal equilibrium in porous medium Chander CFX 4 March 4, 2012 04:07
UDF for effective thermal conductivity Rashmi FLUENT 1 November 6, 2007 20:08


All times are GMT -4. The time now is 09:10.