msbGrid  1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Example

We demonstrate here how to use msbGrid to create a 3-blocks quadrilateral hybrid (structured-unstructured) grid. This same grid is used in the Two phases fluid flow in fractured porous media section.

Input Parameters
The input parameters for the test example test1.cc are
Parameter description
xMin bounding box minimum x value (yMin = xMin)
xMax bounding box maximum x value (yMax = xMax)
bnCx block number in the x direction
bnCy block number in the y direction
dr blocks elements (square in 2D) side length
rafC rafinement coefficient in the inter blocks area
bCId randomly generated block centers identifier
bAId randomly generated block angles identifier
bCPC block centers perturbation coefficient, the perturbation magnitude = bCPC * dr
d2bC distance to the boundary coefficien, the distance to the boundary = d2bC * dr
intbC inter-blocks coefficient, the inter-blocks distance = intbC * dr
Runing test1
$ cd tests/test1/
  • in the case of using command line options
    $ ./test1 --outputPath="./output/" --outputDirName="ctest_1" --xMin="0" --xMax="1" --bnCx="1" --bnCy="3" --dr="0.02" --rafC="1" --bCId="0" --bAId="0" --bCPC="0" --d2bC="1" --intbC="1"
  • in the case of using the default input parameter file ${executableName}.input (= test1.input)
    $ ./test1
    where
    #########################################################################################################
    ## File: test1.input (default input parameter file for test1.cc)
    ## Everything behind a '#' is a comment.
    ## Type "./test1 --help" for more information.
    ## Type "./test1" to run the program if test1.input exist
    ## or specify another parameter file "./test1 --parameterFile="path/to/parameterfile.input"
    ## Remark:
    ## If BCDistType="predefined" the following parameters are not considered: xMin, xMax, BnCx and BnCy
    ## xMin and xMax are in fact defined by the method predefinedDist() of the class Test1InitialDistribution
    #########################################################################################################
    OutputPath="./output/" ## default value OutputPath="../../output/"
    OutputDirName="ctest_1" ## default value OutputDirName="outputDirectory"
    XMin="0" ## default value XMin="0"
    XMax="1" ## default value XMax="1"
    BnCx="1" ## default value BnCx="1"
    BnCy="3" ## default value BnCy="1"
    Dr="0.02" ## default value Dr="0.1"
    RafC="1" ## default value RafC="1"
    BCDistType="random" ## default value BCDistType="random"
    BADistType="random" ## default value BADistType="random"
    BCId="0" ## default value BCId="0"
    BAId="0" ## default value BAId="0"
    BCPC="0" ## default value BCPC="0"
    D2bC="1" ## default value D2bC="1"
    IntbC="1" ## default value IntbC="1"
Note
in input parameter files, parameters names must begin with big letter, otherwise they are not recongnized (unlike in the command line options where they can be either in big or small letters).
  • in the case of using an input parameter file other than the default
    $ ./test1 --parameterFile="path/to/otherParameterfile"
Attention
command line options have priority over the options from the input parameter file
Making the .msh file
$ gmsh -2 msbGrid_ctest_1.geo
msbGrid_ctest_1.png
msbGrid_ctest_1 (2644 Quadrangles, 2745 Nodes)
Outlines of the resulting .geo files
Note
the msbGrid_${outputDirName}.geo (= msbGrid_ctest_1.geo) is the (principal) file that include all the other .geo files created by test1.
/// file: msbGrid_ctest_1.geo

Include "blPtExtBound_.geo";
Include "vBlPtI_.geo";
Include "vEdExtBound_.geo";
Include "vBlEd_.geo";
Include "vBlQd_.geo";
Include "blockBoundary_.geo";

Mesh.RecombineAll = 1;
/// file: blPtExtBound_.geo

//////////////////////////////
// external boundary points //
//////////////////////////////
Point(1) = {0.000000, 0.000000, 0.000000, 0.020000};
Point(2) = {0.000000, 1.000000, 0.000000, 0.020000};
Point(3) = {1.000000, 1.000000, 0.000000, 0.020000};
Point(4) = {1.000000, 0.000000, 0.000000, 0.020000};
/// file: vBlPtI_.geo

/// Block 1
Point(5) = {0.487513, 0.160027, 0.000000, 1.000000};
Point(6) = {0.506639, 0.154180, 0.000000, 1.000000};
...

/// Block 2
Point(767) = {0.487631, 0.506856, 0.000000, 1.000000};
Point(768) = {0.493144, 0.487631, 0.000000, 1.000000};
...

/// Block 3
Point(1542) = {0.486550, 0.837703, 0.000000, 1.000000};
Point(1543) = {0.495630, 0.819883, 0.000000, 1.000000};
...
Point(2256) = {0.020511, 0.959389, 0.000000, 1.000000};
/// file: vEdExtBound_.geo

//////////////////////////////
// external boundary lines  //
//////////////////////////////
Line(1) = {1, 2};
Line(2) = {2, 3};
Line(3) = {3, 4};
Line(4) = {4, 1};
/// file: vBlEd_.geo

/// Block 1
Line(5) = {5, 6};
Line(6) = {5, 7};
...

/// Block 2
Line(1450) = {767, 768};
Line(1451) = {767, 769};
...

/// Block 3
Line(2921) = {1542, 1543};
Line(2922) = {1542, 1544};
...
Line(4269) = {2254, 2255};
/// file: vBlQd_.geo

/// Block 1
Line Loop(1) = {+5, +7, -8, -6};
Plane Surface(1) = {1};
Transfinite Line{5, 7, 8, 6} = 2 Using Progression 1;
Transfinite Surface{1} = {5, 6, 8, 7};
...

/// Block 2
Line Loop(685) = {+1450, +1452, -1453, -1451};
Plane Surface(685) = {685};
Transfinite Line{1450, 1452, 1453, 1451} = 2 Using Progression 1;
Transfinite Surface{685} = {767, 768, 770, 769};
...

/// Block 3
Line Loop(1382) = {+2921, +2923, -2924, -2922};
Plane Surface(1382) = {1382};
Transfinite Line{2921, 2923, 2924, 2922} = 2 Using Progression 1;
Transfinite Surface{1382} = {1542, 1543, 1545, 1544};
...
Line Loop(2016) = {+4256, +4268, -4269, -4262};
Plane Surface(2016) = {2016};
Transfinite Line{4256, 4268, 4269, 4262} = 2 Using Progression 1;
Transfinite Surface{2016} = {2233, 2234, 2255, 2254};

Physical Surface(2017) = {1:2016};
Color White {Surface {1:2016};}
/// file: blockBoundary_.geo

///////////////////////
// Block line Loops  //
///////////////////////

/// Boundary of Block 1, Line Loop 2017
Line Loop(2017) = {+237, -313, +314, +312, -310, +308, -481,..., -318, +319, +238};

/// Boundary of Block 2, Line Loop 2018
Line Loop(2018) = {+1706, -1792, -1794, -1798, -1802, -1894, -1895,..., -1881, +1782, -1787};

/// Boundary of Block 3, Line Loop 2019
Line Loop(2019) = {+3169, -3255, -3256, +3177, -3261, -3263, -3337,..., +3243, -3246, +3247};

//////////////////////////////////
// external boundary line Loop  //
//////////////////////////////////

/// Line Loop 2020
Line Loop(2020) = {+1, +4, +3, +2};

/////////////////////////////////
// inter-blocks plane surface  //
/////////////////////////////////

/// Plan Surface 2018
Plane Surface(2018) = {2017,2018,2019,2020};
Physical Surface(2018) = {2018};

Color Red {Surface {2018};}