CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Running, Solving & CFD (
-   -   Heat transfer, natural convection: Heat sink <-> Air (

SvenH November 11, 2013 07:18

Heat transfer, natural convection: Heat sink <-> Air
1 Attachment(s)
Hi everybody,

in the last weeks I tried to start with OpenFOAM and I would like to solve the following case:

The attached Heat sink gets a Heat Flux of 50 W on its lower surface. The natural convection of the air arround the Heat sink cools it. Seems to be a simple case. I want to solve it with the chtMultiRegionSimpleFoam solver because all i need is the steady state (right solver?).

I can't find a description how to load my heatsink.stl file and to create a air box around it. The tutorials don't give enough hints except that I could use a refinementBox (searchableBox) for this.

My Questions:
- What is the best tutorial I can build up my case with?
- How do I load my STL file into this case?
- How can I create the Airbox?
- How does OpenFOAM know what is the solid and what is the fluid?

I'm happy about every help I get.

mirx November 11, 2013 10:08

The best starting point would be the chtMultiRegionFoam tutorial snappyMultiRegionHeater.

Study the Allrun-script and the whole case structure and all files.

If you would like to get a correct solution you will also need to add a radiation model, either viewFactor (chtMultiRegionSimpleFoam/multiRegionHeaterRadiation) or fvDOM (buoyantSimpleFoam/hotRadiationRoomFvDOM). Furthermore you have to study which boundary conditions you need for natural convection.

SvenH November 11, 2013 10:36

Hi mirx,

thank you for your reply. I started with snappyMultiRegionHeater already. I tried to run the case with only two regions: heater and topAir. I commented the other regions out in every file I found.


Attempt to cast type calculated to type compressible::turbulentTemperatureCoupledBaffleMixed

    From function refCast<To>(From&)
    in file /home/opencfd/OpenFOAM/OpenFOAM-2.2.2/src/OpenFOAM/lnInclude/typeInfo.H at line 114.

FOAM aborting

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::error::abort() at ??:?
#2  Foam::compressible::turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs() at ??:?
#3  Foam::mixedFvPatchField<double>::evaluate(Foam::UPstream::commsTypes) at ??:?
#4  Foam::mixedEnergyFvPatchScalarField::updateCoeffs() at ??:?
#5  Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh>::GeometricBoundaryField::updateCoeffs() at ??:?
#6  Foam::fvMatrix<double>::fvMatrix(Foam::GeometricField<double, Foam::fvPatchField, Foam::volMesh> const&, Foam::dimensionSet const&) at ??:?
 at ??:?
 at ??:?
#9  __libc_start_main in "/lib/x86_64-linux-gnu/"
 at ??:?
Aborted (core dumped)

I tried to get closer to my own case because I only have 1 solid and 1 fluid region.

mirx November 11, 2013 11:18

splitMeshRegion created a third region: domain0.

This region is present in your boundary files:


        type            mappedWall;
        nFaces          430;
        startFace      1555;
        sampleMode      nearestPatchFace;
        sampleRegion    domain0;
        samplePatch    domain0_to_heater;
        offsetMode      uniform;
        offset          (0 0 0);

I would recommend to remove the fluid region and use domain0 as your fluid region instead. domain0 is always created by splitMeshRegions and is the remainder of your initial mesh (blockMesh) minus your solids.

SvenH November 12, 2013 08:51

That was a nice advice! Like the other regions I removed the topAir now and made domain0 fluid in constant/regionProperties. Where can I set the size of the box? I don't understand the code of blockMeshDict, but maybe I will find out by searching the Internet in the next minutes ;)

I copied the properties (g, radiationProperties, thermophysicalProperties etc.) into the constant/domain0 folder.

After running it again, I got a "new" error:

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

Create fluid mesh for region domain0 for time = 0

Create solid mesh for region heater for time = 0

*** Reading fluid mesh thermophysical properties for region domain0

    Adding to thermoFluid

Selecting thermodynamics package
    type            heRhoThermo;
    mixture        pureMixture;
    transport      const;
    thermo          hConst;
    equationOfState perfectGas;
    specie          specie;
    energy          sensibleEnthalpy;

#0  Foam::error::printStack(Foam::Ostream&) at ??:?
#1  Foam::sigFpe::sigHandler(int) at ??:?
#2  in "/lib/x86_64-linux-gnu/"
#3  Foam::heRhoThermo<Foam::rhoThermo, Foam::pureMixture<Foam::constTransport<Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy> > > >::calculate() at ??:?
#4  Foam::rhoThermo::addfvMeshConstructorToTable<Foam::heRhoThermo<Foam::rhoThermo, Foam::pureMixture<Foam::constTransport<Foam::species::thermo<Foam::hConstThermo<Foam::perfectGas<Foam::specie> >, Foam::sensibleEnthalpy> > > > >::New(Foam::fvMesh const&, Foam::word const&) at ??:?
#5  Foam::autoPtr<Foam::rhoThermo> Foam::basicThermo::New<Foam::rhoThermo>(Foam::fvMesh const&, Foam::word const&) at ??:?
#6  Foam::rhoThermo::New(Foam::fvMesh const&, Foam::word const&) at ??:?
 at ??:?
#8  __libc_start_main in "/lib/x86_64-linux-gnu/"
 at ??:?
Floating point exception (core dumped)

Seems that only the "FATAL ERROR" is gone.

The box is bigger now.

SvenH November 12, 2013 14:11

1 Attachment(s)
I learned a bit about meshing with snappyHexMesh today and my heat sink is part of the case now.

Can anybody help me with that error from my last post? And where do I define the heat source on my heat sink?


mirx November 12, 2013 15:13

Try to get a proper mesh an case structure first. You have domain(0-10) and no mesh for the heatsink.

I would recommend to use volumetric heat fluxes instead of surface heat fluxes. This is much more realistic. Either you assign a volumetric heat flux on the heatsink itself, or you create a second body, which represents the heater and is in contact with the heatsink.

A volumetric heat flux can be created by fvOptions (scalarSemiImplicitSource).

SvenH November 13, 2013 04:18

1 Attachment(s)
For me it looks like the heatsink has a mesh :confused: And why are there now 11 domains? Do the domains all need the fluid properties?

mirx November 13, 2013 05:00

1 Attachment(s)
The domains seem to be from a previous mesh run, which failed.

Run the attached Allclean script. It removes all domains except domain0. Then mesh again.

SvenH November 13, 2013 05:35

Thanks mirx!

Now I have only the heater and domain0 again. I still try to fix the error. It seems that there is something wrong with the thermophysicalProperties in domain0, right?. I started to change some of these properties but this results in other (fatal) errors.

The mesh of the heatsink is OK?

pranay347 March 11, 2020 05:40

hi i am also working on the similar case did you completed the case simulation...

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