CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > OpenFOAM Native Meshers: blockMesh

Sloped Mesh | Backward Facing Step

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

Like Tree1Likes
  • 1 Post By colinB

Reply
 
LinkBack Thread Tools Display Modes
Old   January 29, 2013, 03:56
Default Sloped Mesh | Backward Facing Step
  #1
Member
 
Join Date: Oct 2012
Posts: 30
Rep Power: 4
pythag0ra5 is on a distinguished road
Dear FOAMers,

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



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:



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

Thanks in advance,
Mathias
pythag0ra5 is offline   Reply With Quote

Old   January 30, 2013, 05:23
Default
  #2
Senior Member
 
Join Date: Aug 2010
Location: Groningen, The Netherlands
Posts: 216
Rep Power: 9
colinB is on a distinguished road
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.
Attached Files
File Type: pdf mesh_sketch.pdf (67.2 KB, 76 views)
pythag0ra5 likes this.

Last edited by colinB; January 30, 2013 at 05:50. Reason: forgot the separated water inlet
colinB is offline   Reply With Quote

Old   January 31, 2013, 03:16
Default
  #3
Member
 
Join Date: Oct 2012
Posts: 30
Rep Power: 4
pythag0ra5 is on a distinguished road
Good morning Colin,

thank you very much, i think is a nice idea to get not so bad shaped elements!
pythag0ra5 is offline   Reply With Quote

Old   January 31, 2013, 09:27
Default
  #4
Member
 
Join Date: Oct 2012
Posts: 30
Rep Power: 4
pythag0ra5 is on a distinguished road
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)!

pythag0ra5 is offline   Reply With Quote

Reply

Thread Tools
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 On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Velocity drop over backward facing step warlocklw CFX 2 February 9, 2012 22:24
How to do analysis at backward facing step warlocklw CFX 5 December 21, 2011 07:50
Upgraded from Karmic Koala 9.10 to Lucid Lynx10.04.3 bookie56 OpenFOAM Installation 8 August 13, 2011 04:03
Backward FAcing Step - Frequency CFDtoy Main CFD Forum 8 October 29, 2006 21:51
backward facing step problem Yung-Ming Chen Main CFD Forum 3 May 11, 1999 22:04


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