CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM Native Meshers: blockMesh (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/)
-   -   Sloped Mesh | Backward Facing Step (http://www.cfd-online.com/Forums/openfoam-meshing-blockmesh/112446-sloped-mesh-backward-facing-step.html)

pythag0ra5 January 29, 2013 03:56

Sloped Mesh | Backward Facing Step
 
Dear FOAMers,

i want to build a parameterized model of a backward facing step:

http://www.cfd-online.com/Forums/peo...nwi/sloped.pnghttp://people.fh-landshut.de/%7Emehrenwi/sloped.png

As i want to have all dimensions variable, i created a blockMeshDict.m4-file which you can see below:

Code:

/*--------------------------------*- C++ -*----------------------------------*\
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  2.1.1                                |
|  \\  /    A nd          | Web:      www.OpenFOAM.org                      |
|    \\/    M anipulation  |                                                |
\*---------------------------------------------------------------------------*/
FoamFile
{
    version    2.0;
    format      ascii;
    class      dictionary;
    object      blockMeshDict;
}

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

changecom(//)changequote([,])
define(calc, [esyscmd(perl -e 'printf ($1)')])

convertToMeters 1;

// General dimensions

define(depth, 1)

define(total_height, 5)
define(step_height, 1)
define(inlet_height, 1)

define(length_before_step, calc(5*step_height))
define(length_after_step, calc(10*step_height))

define(cell_size, 0.2)

// Points

vertices
(
 
    // front
 
    (-length_after_step 0 0)                                    // 00
    (0 step_height 0)                                        // 01
   
    (-calc(length_after_step+length_before_step) step_height 0)                // 02
    (-length_after_step step_height 0)                                // 03
    (0 step_height 0)                                        // 04
   
    (-calc(length_after_step+length_before_step) calc(step_height+inlet_height) 0)        // 05
    (-length_after_step calc(step_height+inlet_height) 0)                    // 06
    (0 calc(step_height+inlet_height) 0)                            // 07
   
    (-calc(length_after_step+length_before_step) total_height 0)                // 08
    (-length_after_step total_height 0)                            // 09
    (0 total_height 0)                                        // 10
       
    // back
   
    (-length_after_step 0 -depth)                                // 11
    (0 step_height -depth)                                    // 12
   
    (-calc(length_after_step+length_before_step) step_height -depth)                // 13
    (-length_after_step step_height -depth)                            // 14
    (0 step_height -depth)                                    // 15
   
    (-calc(length_after_step+length_before_step) calc(step_height+inlet_height) -depth)    // 16
    (-length_after_step calc(step_height+inlet_height) -depth)                // 17
    (0 calc(step_height+inlet_height) -depth)                            // 18
   
    (-calc(length_after_step+length_before_step) total_height -depth)                // 19
    (-length_after_step total_height -depth)                            // 20
    (0 total_height -depth)                                    // 21
   
);

blocks
(
    hex (0 1 12 11 3 4 15 14) (calc(length_after_step/cell_size) calc(depth/cell_size) calc(step_height/cell_size)) simpleGrading (1 1 1)    // I
    hex (2 3 14 13 5 6 17 16) (calc(length_before_step/cell_size) calc(depth/cell_size) calc(inlet_height/cell_size)) simpleGrading (1 1 1) // II
    hex (3 4 15 14 6 7 18 17) (calc(length_after_step/cell_size) calc(depth/cell_size) calc(inlet_height/cell_size)) simpleGrading (1 1 1) // III
    hex (5 6 17 16 8 9 20 19) (calc(length_before_step/cell_size) calc(depth/cell_size) calc((total_height-inlet_height-step_height)/cell_size)) simpleGrading (1 1 1) // IV
    hex (6 7 18 17 9 10 21 20) (calc(length_after_step/cell_size) calc(depth/cell_size) calc((total_height-inlet_height-step_height)/cell_size)) simpleGrading (1 1 1) // V
);

edges
(
);

// Patches

boundary
(
  water_inlet
    {
        type patch;
        faces
        (
            (2 5 16 13)   
        );
    }

    air_inlet
    {
        type patch;
        faces
        (
        (5 8 19 16)
       
        );
    }

    outlet
    {
        type patch;
        faces
        (
            (1 4 15 12)   
            (4 7 18 15)
        (7 10 21 18)
        );
    }
   
    front
    {
        type empty;
        faces
        (
            (0 1 4 3)
            (2 3 6 5)
            (3 4 7 6)
            (5 6 9 8)
            (6 7 10 9)
        );
    }
   
    back
    {
        type empty;
        faces
        (
            (11 12 15 14)
            (13 14 17 16)
            (14 15 18 17)
            (16 17 20 19)
            (17 18 21 20)
        );
    }

    atmosphere
    {
        type patch;
        faces
        (
            (8 9 20 19)
            (9 10 21 20)
        );
    }
   
    ground
    {
        type wall;
        faces
        (
            (0 3 14 11)
            (2 3 14 13)
            (0 1 12 11)
        );
    }
);

// ************************************************************************* //

The resulting mesh looks like:

http://people.fh-landshut.de/%7Emehrenwi/Mesh.png

Is there any option to get better mesh results at the end of the slope at the outlet?

Thanks in advance,
Mathias

colinB January 30, 2013 05:23

1 Attachment(s)
Dear Mathias,

looks like you make some progress with your calculations

Perhaps I can also help you with this problem.
Attached you find a sketch of a proposed domain
decomposition which avoids highly skewed cells.

I hope with this decomposition it is still possible to
parametrize your domain.

good luck
Colin

Edit:
I forgot to mention an additional layer of blocks for the
separated water inlet:
Just include another line between the top and the middle line.
I know its quite self explaining, but for the sake of completeness.

pythag0ra5 January 31, 2013 03:16

Good morning Colin,

thank you very much, i think is a nice idea to get not so bad shaped elements!

pythag0ra5 January 31, 2013 09:27

Hi Colin,

i implemented your suggestions into my blockMeshDict.m4-file, below you can see the resulting mesh, it looks really nice, thank you very much (again)!

http://people.fh-landshut.de/%7Emehr...esh_better.png


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