# Convection as boundary condition.

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

 January 25, 2015, 02:56 Convection as boundary condition. #1 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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

January 25, 2015, 07:48
#2
Senior Member

Join Date: Oct 2012
Location: AUS
Posts: 137
Rep Power: 13
Quote:
 Originally Posted by sahm 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

 January 25, 2015, 09:38 #3 Senior Member   Alex Join Date: Oct 2013 Posts: 337 Rep Power: 20 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!

 January 26, 2015, 16:02 Any other form of this boundary condition? #4 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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

February 11, 2015, 19:56
First try:
#5
Senior Member

Seyyed Ali H.M.
Join Date: Nov 2009
Location: Utah
Posts: 107
Rep Power: 15
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
 ConvectionTest.zip (79.8 KB, 88 views) convectiveHeatFlux.zip (16.3 KB, 114 views) SGReactFOAM.zip (94.3 KB, 52 views)
__________________
SAHM

 February 12, 2015, 06:09 #6 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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

 February 12, 2015, 08:38 #7 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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::New(const fvPatch&, const DimensionedField&, const dictionary&) in file /home/sahm/OpenFOAM/OpenFOAM-1.7.0/src/finiteVolume/lnInclude/newFvPatchField.C at line 110. FOAM exiting __________________ SAHM

 February 12, 2015, 09:42 #8 Senior Member   Alexey Matveichev Join Date: Aug 2011 Location: Nancy, France Posts: 1,930 Rep Power: 38 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 12:03. Reason: typo

 February 12, 2015, 10:45 #9 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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

 February 12, 2015, 12:01 #10 New Member   ziad khan Join Date: Feb 2015 Posts: 9 Rep Power: 10 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 ?"

 March 26, 2015, 03:57 #11 Member   Naresh Yathuru Join Date: Feb 2015 Posts: 66 Rep Power: 10 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

 March 27, 2015, 02:28 #12 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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

March 27, 2015, 08:07
#13
Senior Member

Alex
Join Date: Oct 2013
Posts: 337
Rep Power: 20
Hi Naresh!
Quote:
 Originally Posted by Naresh yathuru 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!

March 27, 2015, 09:25
#14
Member

Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 10
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)
valueExpression        "Tout";                                       // htot=1.0/(0.04 + (thickness/lambda));lambda=0.5;thickness= 0.5;
fractionExpression     "0"
}```

March 27, 2015, 09:58
#15
Member

Naresh Yathuru
Join Date: Feb 2015
Posts: 66
Rep Power: 10
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.

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

sorry for the long text Thank you once again.

Regards
Naresh

 August 28, 2017, 14:31 #16 Senior Member     Seyyed Ali H.M. Join Date: Nov 2009 Location: Utah Posts: 107 Rep Power: 15 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

 Tags boundary condition, coefficient, convection, diffusion