/*********************************************************************
*
* Mesh for weak-scaling analysis in PETGEM (http://petgem.bsc.es/)
*
* Parameters:
*    Conductivity [Sediments, Water] --> [1.0, 1.0/0.3] S/m
*    x-dimensions --> [0.0, 1500.0] m
*    y-dimensions --> [0.0, 1500.0] m
*    z-dimensions --> [0, -1000.0] m
*
* Visit http://gmsh.info/ for details about mesh scripting with Gmsh
*
* by Octavio Castillo-Reyes, BSC-CASE (octavio.castillo@bsc.es)
* Latest update: August 10th, 2018
*********************************************************************/
// #################################################################
// #                        Parameters                             #
// #################################################################
// Dimensions
MIN_X = -0.0;
MAX_X = 1500.0;
MIN_Y = 0.0;
MAX_Y = 1500.0;
MIN_Z = -1000.0;
MAX_Z = 0.0;
DEPTH_MATERIAL1 = -500.0;
// Mesh size
dg = 80;
// #################################################################
// #                    Define main points                         #
// #################################################################
Point (1) = {MIN_X, MIN_Y, MIN_Z};
Point (2) = {MIN_X, MAX_Y, MIN_Z};
Point (3) = {MAX_X, MAX_Y, MIN_Z};
Point (4) = {MAX_X, MIN_Y, MIN_Z};
Point (5) = {MIN_X, MIN_Y, DEPTH_MATERIAL1};
Point (6) = {MIN_X, MAX_Y, DEPTH_MATERIAL1};
Point (7) = {MAX_X, MAX_Y, DEPTH_MATERIAL1};
Point (8) = {MAX_X, MIN_Y, DEPTH_MATERIAL1};
Point (9) = {MIN_X, MIN_Y, MAX_Z};
Point (10) = {MIN_X, MAX_Y, MAX_Z};
Point (11) = {MAX_X, MAX_Y, MAX_Z};
Point (12) = {MAX_X, MIN_Y, MAX_Z};

// #################################################################
// #                   Layer 1: Sediments (1.0 S/m)                #
// #################################################################
Line (1) = {1, 4};
Line (2) = {4, 3};
Line (3) = {3, 2};
Line (4) = {2, 1};
Line (5) = {1, 5};
Line (6) = {4, 8};
Line (7) = {3, 7};
Line (8) = {2, 6};
Line (9) = {5, 8};
Line (10) = {8, 7};
Line (11) = {7, 6};
Line (12) = {6, 5};
Line Loop (1) = {1, 2, 3, 4};
Plane Surface (1) = {1};
Line Loop (2) = {1, 6, -9, -5};
Plane Surface (2) = {2};
Line Loop (3) = {2, 7, -10, -6};
Plane Surface (3) = {3};
Line Loop (4) = {3, 8, -11, -7};
Plane Surface (4) = {4};
Line Loop (5) = {4, 5, -12, -8};
Plane Surface (5) = {5};
Line Loop (6) = {9, 10, 11, 12};
Plane Surface (6) = {6};
// Define Volume
Surface Loop (1) = {1, 2, 3, 4, 5, 6};
Volume (1) = {1};
Physical Volume ("Sediments", 1) = {1};

// #################################################################
// #                 Layer 2: Water (1.0/0.3 S/m)                  #
// #################################################################
Line (13) = {8, 12};
Line (14) = {7, 11};
Line (15) = {6, 10};
Line (16) = {5, 9};
Line (17) = {9, 12};
Line (18) = {12, 11};
Line (19) = {11, 10};
Line (20) = {10, 9};
Line Loop (7) = {9, 13, -17, -16};
Plane Surface (7) = {7};
Line Loop (8) = {10, 14, -18, -13};
Plane Surface (8) = {8};
Line Loop (9) = {11, 15, -19,-14};
Plane Surface (9) = {9};
Line Loop (10) = {12, 16, -20, -15};
Plane Surface (10) = {10};
Line Loop (11) = {17, 18, 19, 20};
Plane Surface (11) = {11};
// Define Volume
Surface Loop (2) = {6,7,8,9,10,11};
Volume (2) = {2};
Physical Volume ("Water", 2) = {2};

// #################################################################
// #                Mesh parameters                                #
// #################################################################
Characteristic Length {1, 2, 3, 4, 5, 6, 7, 8, 9 , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20} = dg;
