CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Running, Solving & CFD

Convection as boundary condition.

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

Like Tree2Likes
  • 1 Post By sahm
  • 1 Post By Naresh yathuru

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   January 25, 2015, 03:56
Default Convection as boundary condition.
  #1
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hello

I am trying to solve heat diffusion in a solid with convection as one of the boundary conditions. Can someone tell me which boundary condition does the convective cooling? h*(T_s - T_inf) where h and T_inf are defined as the boundary condition. I know this not fixed gradient, but don't know which other boundary conditions can define this equation.

Thanks.
Mehdi04 likes this.
__________________
SAHM
sahm is offline   Reply With Quote

Old   January 25, 2015, 08:48
Default
  #2
Senior Member
 
Mohammad Shakil Ahmmed
Join Date: Oct 2012
Location: AUS
Posts: 137
Rep Power: 15
ahmmedshakil is on a distinguished road
Quote:
Originally Posted by sahm View Post
Hello

I am trying to solve heat diffusion in a solid with convection as one of the boundary conditions. Can someone tell me which boundary condition does the convective cooling? h*(T_s - T_inf) where h and T_inf are defined as the boundary condition. I know this not fixed gradient, but don't know which other boundary conditions can define this equation.

Thanks.
Hi Sahm,
The boundary condition you explained is the Robin Boundary condition. You can easily impose that boundary condition using groovyBC (https://openfoamwiki.net/index.php/Contrib/groovyBC). The pdf file here, http://www.modlab.lv/docs/2011/OpenF...Vilums_pdf.pdf, explains how to use it. I guess, now you can solve your problem easily.

Cheers
shakil
ahmmedshakil is offline   Reply With Quote

Old   January 25, 2015, 10:38
Wink
  #3
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Hello,

Even though what Mohammad says is true, OF actually has a BC for convective heat flux defined out of the box. This BC is called externalWallHeatFluxTemperature. You can find more info about this BC HERE.

Regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   January 26, 2015, 17:02
Talking Any other form of this boundary condition?
  #4
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi

I checked the externalWallHeatFluxTemperature boundary condition and it is what I want, but there's a problem with my case:

I defined a solver that models solid-gas reaction inside a solid porous medium. I defined temperature and pressure fields independent of OpenFOAM's thermophysical models, therefore I can not use externalWallHeatFluxTemperature and I need a simpler solution. I have groovyBC installed, so maybe that would help with my solver, or I have to define a simple external convection boundary condition for my own solver.

Thanks for help.
__________________
SAHM
sahm is offline   Reply With Quote

Old   February 11, 2015, 20:56
Unhappy First try:
  #5
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
HeLlO FOAMers.

I checked the solution Mohammed mentioned and unfortunately there's a problem with my case and that solution. In his solution we have to define K (thermal conductivity) within the groovyBC boundary condition that we define. However in my code K is variable and changes with reaction progress. Therefore I couldn't use groovyBC. But I tried to make a boundary condition based on this solution.

I defined a convectiveHeatFlux boundary condition as a separate library and it compiles, but when I try to run the case (even though I included the library in my controlDict file) I get this error:
Code:
--> FOAM FATAL IO ERROR: 
Unknown patchField type convectiveHeatFlux for patch type patch

Valid patchField types are : ...
I have attached my solver and boundary condition and a case file test that I am using to check and validate my boundary condition.

I would appreciate if anyone could help me to resolve the error with this boundary condition. This might be the last step I have to solve to use this solver for my Solid-Gas Reactor solver.

Ali.
Attached Files
File Type: zip ConvectionTest.zip (79.8 KB, 96 views)
File Type: zip convectiveHeatFlux.zip (16.3 KB, 117 views)
File Type: zip SGReactFOAM.zip (94.3 KB, 53 views)
__________________
SAHM
sahm is offline   Reply With Quote

Old   February 12, 2015, 07:09
Default
  #6
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
I forgot to mention, I tried using this boundary condition as static next to my solver and still got the same error message. I also tried to use generic patch fields lib in the controlDict file, but that gave another error message.
__________________
SAHM
sahm is offline   Reply With Quote

Old   February 12, 2015, 09:38
Default
  #7
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
This is the full error message:

/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.7.0 |
| \\ / A nd | Web: www.OpenFOAM.com |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Build : 1.7.0-5773603db906
Exec : SGReactFOAM
Date : Feb 12 2015
Time : 06:54:00
Host : cmtl.mie.uic.edu
PID : 21801
Case : /home/sahm/My/ConvectionTest
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Create mesh for time = 0

Reading Reactor Properties

Reading field P

Reading field T



--> FOAM FATAL IO ERROR:
Unknown patchField type convectiveHeatFlux for patch type patch

Valid patchField types are :

41
(
advective
buoyantPressure
calculated
cyclic
directMapped
directionMixed
empty
fan
fixedFluxPressure
fixedGradient
fixedInternalValue
fixedPressureCompressibleDensity
fixedValue
freestream
freestreamPressure
inletOutlet
inletOutletTotalTemperature
mixed
oscillatingFixedValue
outletInlet
partialSlip
processor
rotatingTotalPressure
sliced
slip
symmetryPlane
syringePressure
timeVaryingMappedFixedValue
timeVaryingMappedTotalPressure
timeVaryingTotalPressure
timeVaryingUniformFixedValue
timeVaryingUniformInletOutlet
totalPressure
totalTemperature
turbulentInlet
turbulentIntensityKineticEnergyInlet
uniformDensityHydrostaticPressure
uniformFixedValue
waveTransmissive
wedge
zeroGradient
)


file: /home/sahm/My/ConvectionTest/0/T::boundaryField::ConvectionWall from line 38 to line 41.

From function fvPatchField<Type>::New(const fvPatch&, const DimensionedField<Type, volMesh>&, const dictionary&)
in file /home/sahm/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/newFvPatchField.C at line 110.

FOAM exiting
__________________
SAHM
sahm is offline   Reply With Quote

Old   February 12, 2015, 10:42
Default
  #8
Senior Member
 
Alexey Matveichev
Join Date: Aug 2011
Location: Nancy, France
Posts: 1,938
Rep Power: 39
alexeym has a spectacular aura aboutalexeym has a spectacular aura about
Send a message via Skype™ to alexeym
Hi,

You do not need template class cause your BC is only applicable to scalars. If you try to:

1. Uncomment

Code:
#ifdef NoRepository
#   include "convectiveHeatFluxFvPatchField.C"
#endif
2. Change in Make/files convectiveHeatFluxFvPatchField.C to convectiveHeatFluxFvPatchFields.C

You'll see that compiler is VERY unhappy about your desire to divide by tensor.

So make simple convectiveHeatFluxScalarFvPatchField instead of template. Also if you look at makePatchFields macro, you'll see why patch classes end with FvPatchField.

Last edited by alexeym; February 12, 2015 at 13:03. Reason: typo
alexeym is offline   Reply With Quote

Old   February 12, 2015, 11:45
Default
  #9
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Thanks Alexey.
1- What is that section for? Can you give a short description or a link to a page that describes it. (I'm not good at programming)

2- I tried to make this BC again from inletoutletTotalTemperatureFvPatchScalarField (because it was only scalar) and it worked. Then I changed the constructors and subroutines from my old files. It is working now, but I have to verify and make sure it works properly.

When I wasn't addressing convectiveHeatFluxFvPatchFields.C file in my Make/files, is the #include "addToRunTimeSelectionTable.H" the reason that it wasn't recognizing my BC?

Thanks for telling me about the makePatchFields macro. I don't know about it, but surely I will take a look at it.
__________________
SAHM
sahm is offline   Reply With Quote

Old   February 12, 2015, 13:01
Default
  #10
New Member
 
ziad khan
Join Date: Feb 2015
Posts: 9
Rep Power: 11
ziadkhan is on a distinguished road
hifi talk is on...
....
this reminds me of my fluid mechanics instructor raising his brows on me and giving a strange embarrasing look on his face at me when during his lecture i suddenly stopped and asked him " sir what does CONTINUITY mean ?"
ziadkhan is offline   Reply With Quote

Old   March 26, 2015, 04:57
Default
  #11
Member
 
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11
Naresh yathuru is on a distinguished road
Hi Foamers,

thanks every one for the explanation. and sorry for restarting the thread again. I have read some threads regarding convection boundary conditions. but still could not catch it exactly. i have some basic question i might sound silly .I have a room assume one side of the room(right wall) is expossed to environment t= 260k .so in this case can I had to use a boundary condition that is similaar to convective boundary condition in fluent. that is it considers the wall thickness and temperature of outside and thermal conductivity of the solid.

so my question
1. should i to use chtmultiregionFoam solver as i have thermal conductivity?
2. can i use the groovyBC suggested in any heat transfer solver?

I really appriciate any tipps on this. Thank you

Regards,
Naresh Yathuru
Naresh yathuru is offline   Reply With Quote

Old   March 27, 2015, 03:28
Default
  #12
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Hi Naresh

I think you can use groovyBC. If you combine the conduction resistance with the convection resistance and get a total heat transfer coefficient (U) for each wall, the boundary condition will be in the form of q"=U(Ts-To)which is similar to pure convection and you can define it in groovyBC as ahmmedshakil mentioned it.

SAHM.
__________________
SAHM
sahm is offline   Reply With Quote

Old   March 27, 2015, 09:07
Default
  #13
Senior Member
 
Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 22
zfaraday will become famous soon enough
Hi Naresh!
Quote:
Originally Posted by Naresh yathuru View Post
Hi Foamers,

thanks every one for the explanation. and sorry for restarting the thread again. I have read some threads regarding convection boundary conditions. but still could not catch it exactly. i have some basic question i might sound silly .I have a room assume one side of the room(right wall) is expossed to environment t= 260k .so in this case can I had to use a boundary condition that is similaar to convective boundary condition in fluent. that is it considers the wall thickness and temperature of outside and thermal conductivity of the solid.

so my question
1. should i to use chtmultiregionFoam solver as i have thermal conductivity?
2. can i use the groovyBC suggested in any heat transfer solver?

I really appriciate any tipps on this. Thank you

Regards,
Naresh Yathuru
You don't need to use chtMultiRegionFoam because as Sahm pointed out you can use groovyBC in order to create a BC that takes into account a solid wall that releases heat to the environment by convection. However, it already exists a BC implemented in OF that does exactly the same, this is the BC, called externalWallHeatFluxTemperature, that allows you to define a convective heat transfer coeff. and an environment temperature and, also, a thickness and a thermal conductivity for an external layer.

Hope it helps.

Best regards,

Alex
__________________
Web site where I present my Master's Thesis: foamingtime.wordpress.com

The case I talk about in this site was solved with chtMultiRegionSimpleFoam solver and involves radiation. Some basic tutorials are also resolved step by step in the web. If you are interested in these matters, you are invited to come in!
zfaraday is offline   Reply With Quote

Old   March 27, 2015, 10:25
Default
  #14
Member
 
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11
Naresh yathuru is on a distinguished road
Quote:
I think you can use groovyBC. If you combine the conduction resistance with the convection resistance and get a total heat transfer coefficient (U) for each wall, the boundary condition will be in the form of q"=U(Ts-To)which is similar to pure convection and you can define it in groovyBC as ahmmedshakil mentioned it.
Thanks for the reply sahm and alex.

I tried with the groovey boundary condition. i m a newbie so i m not sure if i specified every thing correct. could someone please have a loook at it.

Code:
{
        type                   groovyBC;
        variables              "htot=1.5625;Tout=273;heatflux=htot*(Tout - T);"; // lambda(thermal conductivity of a brick) 
        gradientExpression     "heatflux";                                  // 1/hout =1/25=0.04 
        valueExpression        "Tout";                                       // htot=1.0/(0.04 + (thickness/lambda));lambda=0.5;thickness= 0.5;  
        fractionExpression     "0"
    }
seungook likes this.
Naresh yathuru is offline   Reply With Quote

Old   March 27, 2015, 10:58
Default
  #15
Member
 
Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 11
Naresh yathuru is on a distinguished road
Hi Alex,

Quote:
You don't need to use chtMultiRegionFoam because as Sahm pointed out you can use groovyBC in order to create a BC that takes into account a solid wall that releases heat to the environment by convection. However, it already exists a BC implemented in OF that does exactly the same, this is the BC, called externalWallHeatFluxTemperature, that allows you to define a convective heat transfer coeff. and an environment temperature and, also, a thickness and a thermal conductivity for an external layer.
Thanks a lot for the suggestion. you are exactly correct. I m using buoyantboussinesqsimpleFoam. I read in some threads that externalwallheatFluxtemperature B.C works for compressible solver as mine is a incompressible case, i didnt use it. or can i use it for incompressible?

if so could you please help me what are the changes is should to implement it for incompressible case.
But one small clarification, i have a room with one wall(assume right wall) exposed to environment. and i m interested in the convection inside the room. I want to simulate the room taking into accout the environment temperature(Toutside), convective heat transfer coeff of the environment, and thermal condictivity and thickness of the wall.

so i impose a heatflux B.C on the right wall. q=(1/(1/hout)+(d/lambda))*(Tout-Tsurface)
hout- heat transfer coeffiecient of the environment fluid
lambda- thermal conductivity of the wall
d- thickness of the wall

according to this i have set my groovyB.C. i m a newbie to groovyB.C .
i have posted my groovyB.C above.

i followed this thread.
http://www.cfd-online.com/Forums/ope...acianfoam.html

sorry for the long text Thank you once again.

Regards
Naresh
Naresh yathuru is offline   Reply With Quote

Old   August 28, 2017, 15:31
Default
  #16
Senior Member
 
sahm's Avatar
 
Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 17
sahm is on a distinguished road
Salam Mohammed,

I have a question regarding defining convection as a boundary condition.

Thanks to you guys, I have been able to make a convective boundary condition for my solver and it has been working properly since. However my problem became more complicated.

I have to change the thermal diffusion equation in my problem to become anisotropic (orthotropic) and because of that, I need to change the way boundary condition works. Now the boundary condition equation is more like:

(K.n).T + h(T-T_inf) = 0.
Or probably it's like:
(K.T).n + h(T-T_inf) = 0.
(To be honest I'm not sure yet.)

K is thermal conductivity tensor,
n is vector normal to boundary,
h is convective heat transfer coefficient.

Now, how can I make this in OpenFOAM Using mixedFVPatchField, since the fraction constant can't be derived like before. Can I define the gradient of T in mixedFVPatchField? Reminder, I can't use GroovyBC because my K and h change over time.

Thanks.
__________________
SAHM
sahm is offline   Reply With Quote

Reply

Tags
boundary condition, coefficient, convection, diffusion

Thread Tools Search this Thread
Search this Thread:

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
An error has occurred in cfx5solve: volo87 CFX 5 June 14, 2013 18:44
Low Mixing time Problem Mavier CFX 5 April 29, 2013 01:00
Convection Boundary condition tomcatbobby FLUENT 2 April 30, 2012 14:50
asking for Boundary condition in FLUENT Destry FLUENT 0 July 27, 2010 01:55
RPM in Wind Turbine Pankaj CFX 9 November 23, 2009 05:05


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