1

Previous: Test case geometry dimensions Up: Test case: roomWithRadiator Next: Test case setup parameters

This is an automatically generated documentation by LaTeX2HTML utility. In case of any issue, please, contact us at info@cfdsupport.com.

Mesh generation

  • Mesh for this tutorial is pre-set in directory meshFactory inside test case directory roomWithRadiator
  • In meshFactory, there is the script makeMesh.sh which generates meshes for all five regions and then transfers them to their subdirectories inside constant directory. Besides the makeMesh.sh script there are five folders with all the important data for mesh generation
  • Folders have the OpenFOAM structure as usual; they are used for mesh generation only
  • Important parts of makeMesh.sh script are explained below:

     

    if [[ "$1" -eq "" ]] ; then
        numProcs=6
    else
        numProcs=$1
    fi
    

     

  • There are two ways for choosing a number of processors to be used for mesh generation. The first option is to modify the line 16 in makeMesh.sh before running the script. The if condition at lines 15-19 gives us the second option which is defining the number of processors as a script parameter:

    # ./makeMesh.sh 6

     

    for region in co1-walls co2-room co3-window co4-pipe co5-radiator
    do
        cd $region
        echo
        echo "   Meshing $region region..."
        sed -i "s/numberOfSubdomains \+[0-9]\+;/numberOfSubdomains $numProcs;/g" system/decomposeParDict
        ./Allclean.sh > /dev/null 2>&1 
    
        echo "     * blockMesh"
        blockMesh > log.blockMesh
        echo "     * surfaceFeatureExtract"
        surfaceFeatureExtract > log.surfaceFeatureExtract
        echo "     * decomposePar"
        decomposePar > log.decomposePar
        echo "     * snappyHexMesh"
        mpiexec -np $numProcs snappyHexMesh -parallel > log.snappyHexMesh
        echo "     * reconstructParMesh"
        reconstructParMesh -latestTime > log.reconstructParMesh
        echo "     * changeDictionary"
        changeDictionary > log.changeDictionary
        echo "     * checking mesh"
        checkMesh -latestTime > log.checkMesh
        grep "cells:" log.checkMesh
        rm -rf processor*
        paraFoam -touch
        cd ..
    done
    

     

  • The part of the script at lines 37-53 defines the mesh generation procedure for each region
  • The first utility is blockMesh. Boundary coordinates of each blockMesh define a node to node correspondence on the boundaries between the regions. Size of the background mesh is not the same for all regions. Regions windowpipe and radiator use finer mesh
  • SnappyHexMesh utility uses STL files from constant/trisurface directory to define the regions boundaries and refine areas close to them. Refinement levels on the boundaries in region room are adjusted so the final mesh is identical to the mesh in adjacent regions with finer background mesh. This approach increases the quality of the results and do not increase the overall mesh size significantly
  • STLs used for mesh generation of individual regions are listed below:
    1. Region walls is created from room-outer-wall.stl, room-inner-wall.stl and window-side.stl. Room-outer-wall will use external wall boundary condition, room-inner-wall will use boundary condition for heat transfer and window-side will use standard wall boundary condition
    2. Region room is created from room-inner-wall.stl, window-inner-part.stl, radiator-ribs.stl and radiator-pipe-outer-wall.stl. On all of these walls there will use heat transfer boundary condition
    3. Region window is created from window-outer-part.stl, window-inner-part.stl and window-side.stl. Window-outer-part will use external wall boundary condition, window-inner-part will use boundary condition for heat transfer and window-side will use standard wall boundary condition
    4. Region pipe is created from radiator-pipe-inner-wall.stl, radiator-pipe-inlet.stl and radiator-pipe-outlet.stl. Radiator-pipe-inner-wall will use heat transfer boundary condition while radiator-pipe-inlet and radiator-pipe-outlet will use standard inlet and outlet boundary conditions
    5. Region radiator is created from radiator-pipe-inner-wall.stl, radiator-pipe-outer-wall.stl, radiator-ribs.stl and radiator-pipe-side-walls.stl where radiator-pipe-inner-wall, radiator-pipe-outer-wall, radiator-ribs will use heat transfer boundary condition and radiator-pipe-side-walls will use standard wall boundary condition
  • The changeDictionary utility modifies types of boundaries for which the heat transfer boundary condition is imposed, i.e., from wall type to mappedWall type and adds lines where the neighbouring region and the patch is specified. The example of changeDictionaryDict for region walls is listed below:
    /*--------------------------------*- C++ -*----------------------------------*\
    | =========                 |                                                 |
    | \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox           |
    |  \\    /   O peration     | Version:  dev                                   |
    |   \\  /    A nd           | Web:      www.OpenFOAM.org                      |
    |    \\/     M anipulation  |                                                 |
    |*---------------------------------------------------------------------------*|
    |  File created by CFD support s.r.o.  on   Wed Aug  9 14:33:52 2017          |
    |                    http://www.cdfsupport.com                                |
    \*---------------------------------------------------------------------------*/
    FoamFile
    {
        version 2.0;
        format ascii;
        class dictionary;
        location "system";
        object changeDictionaryDict;
    }
    
    // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
    
    boundary
    {
        room-inner-wall
        {
            type            mappedWall;
            sampleMode      nearestPatchFace;
            sampleRegion    room;
            samplePatch     room-inner-wall;
        }
    }
    
    // ************************************************************************* //
    

     

  • A group of previously used utilities is the same for all five regions
  • The last part of the script deletes previous meshes from test case and copies the new ones

     

    for region in walls room window pipe radiator
    do
        rm -rfv "../constant/$region/polyMesh"
    done
    
    i=1
    for region in walls room window pipe radiator
    do
        cp -rv "co$i-$region/2/polyMesh" "../constant/$region"
        ((i++))
    done