CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

Mixed BC - heat transfer - laplacianFoam

Register Blogs Community New Posts Updated Threads Search

Like Tree60Likes

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 4, 2010, 01:46
Default Mixed BC - heat transfer - laplacianFoam
  #1
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
I am working with heat transfer in solid material and using laplacianFoam. I have the possibility to impose
1) fixed temperature and
2) fixed temperature gradient (fixed heat flux (dT/dn)_w = q_w/k; q_w is given, k is the conductivity of the solid material) on the walls.
Often it is needed to set the heat flux on a boundary given by the heat transfer coefficient (h) and the outside temperature(T_inf)
3) (dT/dn)_w=h/k (T_w -T_inf). h and T_inf are given, k is the conductivity of the solid material and T_w is the wall temperature (Varies during the computations and along BC patch).

How can I get access to the mixed conditon ( 3) above)?
regards
Bjorn
alishafiee likes this.
bhh is offline   Reply With Quote

Old   April 11, 2010, 04:40
Default
  #2
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Often it is needed to set the heat flux on a boundary given by the heat transfer coefficient (h) and the outside temperature(T_inf)
3) (dT/dn)_w=h/k (T_w -T_inf). h and T_inf are given, k is the conductivity of the solid material and T_w is the wall temperature (Varies during the computations and along BC patch).

Can anybody give some hints on how to do this in laplacianFoam?

rgds
Bjorn
bhh is offline   Reply With Quote

Old   April 11, 2010, 07:02
Default
  #3
Member
 
MSR CHANDRA MURTHY
Join Date: Mar 2009
Posts: 33
Rep Power: 17
chandramurthy is on a distinguished road
did u try groovyBC ?. http://openfoamwiki.net/index.php/Contrib_groovyBC
chandramurthy is offline   Reply With Quote

Old   July 21, 2010, 04:17
Default
  #4
Member
 
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 16
val46 is on a distinguished road
Hi Bjorn,

did you succeed implementing your BC in laplacianFoam?


Regards,

Toni
val46 is offline   Reply With Quote

Old   July 21, 2010, 04:24
Default
  #5
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi Toni,

No, unfortunately I did not manage to find a solution. The use of groovyBC for this problem seems to unclear for my level of understanding.

rgds
Bjorn
bhh is offline   Reply With Quote

Old   July 21, 2010, 08:51
Default
  #6
Member
 
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 16
val46 is on a distinguished road
Hi bhh,

i found these 2 threads:

http://www.cfd-online.com/Forums/ope...roperties.html

http://www.cfd-online.com/Forums/ope...fficients.html


I will try it out and let you know about it.
val46 is offline   Reply With Quote

Old   July 22, 2010, 03:54
Default
  #7
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi,

I finally got around to use groovyBC for my problem. The following seemed to work after installation of the groovyBC ( http://openfoamwiki.net/index.php/Contrib_groovyBC )and using it in laplacianFoam:

rightWall
{
type groovyBC;
gradientExpression "gradT";
fractionExpression "0";
variables
"htot=100.0;Tinf=20.0;rho=800.0;cp=385.0;gradT=hto t/(DT*rho*cp)*(Tinf-T);";
timelines (
);
}

This seemed to work OK. However, when I raised the heat transfer coefficient, htot, to large values the solution diverged for a steady state heat conduction problem. For large values of htot I should find that the wall temperature should approach Tinf. My guess is that the BC should be handled through a source term addition to the CV close to the boundary to handel large values of htot.

Any comments to this?

rgds
Bjorn
bhh is offline   Reply With Quote

Old   July 22, 2010, 04:21
Default
  #8
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
Hi Bjorn,

I have had the same problem with diverging results. You can formulate different (and more implicit) to get a stable and faster converging solution.
Code:
rightWall
{
    type                   groovyBC;
    variables              "htot=1000.0;Tinf=20.0;rho=800.0;cp=385.0;k=DT*rho*cp;";
    valueExpression     "Tinf";
    fractionExpression  "1.0/(1.0 + k/(mag(delta())*htot))";
}
The Syntax is derived from wallHeatFlux-BC inside the thermophysicalModels.

Regards,
Stefan
bhh, nimasam, armyou and 6 others like this.

Last edited by herbert; July 22, 2010 at 05:27. Reason: Syntax error
herbert is offline   Reply With Quote

Old   July 22, 2010, 04:53
Default
  #9
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi Stefan,

This is probably what is needed. However when I used your expression I got this error:
Time = 1



--> FOAM FATAL ERROR:
Parser Error at "1.33" :"invalid character"
"1.0/(1.0 + k/(mag(delta())*htot));"
" ^"

From function parsingValue
in file PatchValueExpressionDriver.C at line 188.

FOAM exiting

Any idea what went wrong?

rgds
Bjorn
bhh is offline   Reply With Quote

Old   July 22, 2010, 04:57
Default
  #10
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi Stefan,

It was the ; that should be changed:
fractionExpression "1.0/(1.0 + k/(mag(delta())*htot))";

Now it runs! Thank you very much for your help!

rgds
Bjorn
bhh is offline   Reply With Quote

Old   July 22, 2010, 05:27
Default
  #11
Senior Member
 
Stefan Herbert
Join Date: Dec 2009
Location: Darmstadt, Germany
Posts: 129
Rep Power: 17
herbert is on a distinguished road
Hi Bjorn,

sorry, such mistakes are my personal special when writing code to posts. I'll edit it.

Regards,
Stefan
herbert is offline   Reply With Quote

Old   August 13, 2010, 03:36
Default
  #12
Member
 
Join Date: Nov 2009
Location: Germany
Posts: 96
Rep Power: 16
val46 is on a distinguished road
Hi Bjorn,

i also managed to solve a problem with laplacianFoam and groovyBC.

Did you realize you set your Tinf to -253 °C ?

Code:
"htot=100.0;Tinf=20.0;rho=800.0;cp=385.0;gradT=hto  t/(DT*rho*cp)*(Tinf-T);";
I for myself used the code posted by Stefan with the following settings.

Code:
  type                   groovyBC;
    variables              "htot=100.0;Tinf=298.15;rho=2700.0;cp=900.0;k=DT*rho*cp;";
    valueExpression     "Tinf";
    fractionExpression  "1.0/(1.0 + k/(mag(delta())*htot))";
(These settings are for aluminium)

Regards,
Toni
val46 is offline   Reply With Quote

Old   August 13, 2010, 05:59
Default
  #13
bhh
Member
 
Bjorn H. Hjertager
Join Date: Mar 2009
Posts: 72
Rep Power: 17
bhh is on a distinguished road
Hi,

I now only use the proposal from Stefan and abandoned my own proposal. Stefans code is much more stable and can accomodate the Tinf= -252. value

rgds
Bjorn
bhh is offline   Reply With Quote

Old   December 6, 2010, 16:00
Default
  #14
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Hi, I'm trying to set exactly the same boundary condition: dT/dx = h/k (T_w -T_inf)

I've installed groovyBC but when I try the following:

Quote:
rightWall
{
type groovyBC;
variables "htot=100.0;Tinf=298.15;rho=2700.0;cp=900.0;k=DT*r ho*cp;";
valueExpression "Tinf";
fractionExpression "1.0/(1.0 + k/(mag(delta())*htot))";
}
I first get an error message saying:

Quote:
Cannot find 'value' entry on patch rightWall of field T in file "/Users/ben/OpenFOAM/ben-1.6-ext/run/poc/domain/0/T"
which is required to set the values of the generic patch field.
(Actual type groovyBC)

Please add the 'value' entry to the write function of the user-defined boundary-condition
or link the boundary-condition into libfoamUtil.so
and then when I try to add a value field to my BC:

Quote:
rightWall
{
type groovyBC;
variables "htot=100.0;Tinf=298.15;rho=2700.0;cp=900.0;k=DT*r ho*cp;";
valueExpression "Tinf";
value uniform 298.0;
fractionExpression "1.0/(1.0 + k/(mag(delta())*htot))";
}
I get an error saying:

Quote:
--> FOAM FATAL ERROR:

gradientInternalCoeffs cannot be called for a genericFvPatchField (actual type groovyBC)
on patch rightWall of field T in file "/Users/ben/OpenFOAM/ben-1.6-ext/run/poc/domain/0/T"
You are probably trying to solve for a field with a generic boundary condition.

From function genericFvPatchField<Type>::gradientInternalCoeffs( ) const
in file fields/fvPatchFields/basic/generic/genericFvPatchField.C at line 782.
Does anybody know how I can fix this?
benk is offline   Reply With Quote

Old   December 6, 2010, 19:42
Default
  #15
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Whoops, I forgot to add libs ( "libgroovyBC.so" ) ; to my system/controlDict file...it seems to be working now.

But...can anybody explain how dT/dx = h/k (T_w -T_inf) becomes 1.0/(1.0 + k/(mag(delta())*h))?
benk is offline   Reply With Quote

Old   February 3, 2011, 16:34
Default
  #16
Member
 
Join Date: Nov 2010
Posts: 54
Rep Power: 15
usergk is on a distinguished road
Hello,

Can someone reply what does DT refer to in the code above?

I got the following error:

--> FOAM FATAL ERROR:
Parser Error at "1.1-2" :"field DT not existing or of wrong type"
"DT*rho*cp"
" ^^ "

From function parsingValue
in file PatchValueExpressionDriver.C at line 192.

FOAM aborting (FOAM_ABORT set)


Thanks
gk
usergk is offline   Reply With Quote

Old   February 3, 2011, 16:58
Default
  #17
Senior Member
 
Ben K
Join Date: Feb 2010
Location: Ottawa, Canada
Posts: 140
Rep Power: 19
benk is on a distinguished road
Quote:
Originally Posted by usergk View Post
Hello,

Can someone reply what does DT refer to in the code above?
DT is a volumeScalarField in this case. You got an error because in your solver the field DT must not exist. You may not need this field, you just have to make sure that your thermal conductivity (k) is defined properly in your solver.
benk is offline   Reply With Quote

Old   February 15, 2011, 10:55
Default Robin BC, groovyBC, value in the cell center
  #18
New Member
 
Raimonds Vilums
Join Date: Oct 2010
Posts: 17
Rep Power: 16
argonaut is on a distinguished road
I have two questions which bothers me last few days concerning implementation of Robin boundary conditions by groovyBC:

1) I also cannot fully understand how the equality was obtained which was mentioned before:

Quote:
Originally Posted by benk View Post
But...can anybody explain how dT/dx = h/k (T_w -T_inf) becomes 1.0/(1.0 + k/(mag(delta())*h))?
As I can see from other threads, others try to use this formula, but no explanation I have found. If I take the formula and try to go back, I obtain that derivative dT/dx is substituted in the original boundary condition by Tinf/delta (environment temperature divided by the distance from the cell-center to the face-center).

If I linearize the derivative, I could use (T_center - T_face) instead of Tinf

2) Is it possible to get this T_center, i.e., cell-center-value in groovyBC? I saw "this->patchInternalField()" in the source code of the original mixedFixedValue. Can I access it somehow similar in groovyBC?
argonaut is offline   Reply With Quote

Old   February 17, 2011, 07:18
Default
  #19
New Member
 
Raimonds Vilums
Join Date: Oct 2010
Posts: 17
Rep Power: 16
argonaut is on a distinguished road
At last, I've got it. It seems that I am not so stupid as I thought

groovyBC is based on mixed BC. Algorithm in the function "evaluate" of the file mixedFvPatchField.C (src » finiteVolume » fields » fvPatchFields » basic » mixed) states that

Tface = f*refValue + (1-f)*(Tcenter + refGrad * delta)

where f is valueFraction, delta is distance between Tcenter and Tface (OpenFOAM's 1/deltaCoeffs() or groovyBC's mag(delta())). If we take boundary condition

k*dT/dn + h*(Tface-Tinf) = 0

linearize derivative

k*(Tface-Tcenter)/delta + h*(Tface-Tinf) = 0

divide by h and isolate Tface, we obtain

Tface = (1/(1+C))*Tinf + (1 - 1/(1+C))*Tcenter

where C=k/(h*delta). As you can see, comparison of this equation to the first one gives

f = 1/(1+C)
refValue = Tinf
refGrad = 0

Concerning approximation, it is the first order approximation if I understand it correctly. Does anybody knows if there are any 2nd order approximations in OpenFOAM for derivatives on the boundary. I know that it is possible to implement 2nd order approximation, but it would use values from previous timestep. Not sure if this possible with groovyBC, isn't it?
novyno, mirko, bhh and 46 others like this.
argonaut is offline   Reply With Quote

Old   March 20, 2011, 23:40
Default 2nd Order?
  #20
New Member
 
Brent Craven
Join Date: Mar 2009
Location: University Park, PA, USA
Posts: 21
Rep Power: 17
brent_craven is on a distinguished road
I agree that this implementation of the mixed BC is first order. Has anyone come up with a way to implement 2nd order?
brent_craven 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
Heat transfer coefficient - what is waht Stan FLUENT 28 December 29, 2021 16:29
Convective / Conductive Heat Transfer in Hypersonic flows enigma Main CFD Forum 2 November 1, 2009 22:53
How can I increase Heat Transfer at Domain Interf? B.Simon CFX 3 October 28, 2008 18:53
CFX Heat Transfer RJamison CFX 0 July 24, 2008 12:11
Convective Heat Transfer - Heat Exchanger Mark CFX 6 November 15, 2004 15:55


All times are GMT -4. The time now is 13:17.