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

UDF for effective thermal conductivity in porous media

Register Blogs Members List Search Today's Posts Mark Forums Read

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

Old   February 24, 2014, 06:37
Default
  #2
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
"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, 07:50
Default
  #3
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 08:43
Default
  #4
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 08:54
Default
  #5
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 09:03
Default
  #6
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 09:07
Default
  #7
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 10:00
Default
  #8
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 10:15
Default
  #9
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
In what way were they unsuccessful? Warning? Error? Wrong result?
pakk is offline   Reply With Quote

Old   February 24, 2014, 10:40
Default
  #10
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 10:45
Default
  #11
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 10:57
Default
  #12
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 11:09
Default
  #13
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 11:11
Default
  #14
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 11:23
Default
  #15
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 11:41
Default
  #16
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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, 11:43
Default
  #17
Senior Member
 
Join Date: Nov 2013
Posts: 670
Rep Power: 9
pakk is on a distinguished road
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, 11:56
Default
  #18
Member
 
Join Date: Oct 2013
Location: Malaysia
Posts: 39
Rep Power: 3
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

Thread Tools
Display Modes

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Porous media setup issues in Fluent Bernard Van FLUENT 22 June 6, 2014 05:52
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 05:07
UDF for effective thermal conductivity Rashmi FLUENT 1 November 6, 2007 21:08


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