| 1 |
///////////////////////////////////////////////////////////// |
| 2 |
// // |
| 3 |
// Copyright (c) 2007-2017 by The University of Queensland // |
| 4 |
// Centre for Geoscience Computing // |
| 5 |
// http://earth.uq.edu.au/centre-geoscience-computing // |
| 6 |
// // |
| 7 |
// Primary Business: Brisbane, Queensland, Australia // |
| 8 |
// Licensed under the Open Software License version 3.0 // |
| 9 |
// http://www.apache.org/licenses/LICENSE-2.0 // |
| 10 |
// // |
| 11 |
///////////////////////////////////////////////////////////// |
| 12 |
|
| 13 |
#include "geometry/Sphere.h" |
| 14 |
#include "util/vector3.h" |
| 15 |
#include "InsertGenerator2D.h" |
| 16 |
#include "HexAggregateInsertGenerator2D.h" |
| 17 |
#include "CircMNTable2D.h" |
| 18 |
#include "BoxWithLines2D.h" |
| 19 |
|
| 20 |
// --- IO includes --- |
| 21 |
#include <iostream> |
| 22 |
|
| 23 |
using std::cout; |
| 24 |
using std::cout; |
| 25 |
using std::endl; |
| 26 |
|
| 27 |
// -- System includes -- |
| 28 |
#include <cstdlib> |
| 29 |
#include <sys/time.h> |
| 30 |
using std::atoi; |
| 31 |
using std::atof; |
| 32 |
|
| 33 |
int main(int argc, char** argv) |
| 34 |
{ |
| 35 |
int ret=0; |
| 36 |
|
| 37 |
double size=atof(argv[1]); |
| 38 |
int ntry=atoi(argv[2]); |
| 39 |
double rmin_sand=atof(argv[3]); |
| 40 |
double rmin_clay=atof(argv[4]); |
| 41 |
double rmax_clay=atof(argv[5]); |
| 42 |
int outputstyle=atoi(argv[6]); |
| 43 |
|
| 44 |
double sand_layer_thickness=0.425*size; |
| 45 |
double clay_layer_thickness=0.15*size; |
| 46 |
double center_box_dim=0.05*size; |
| 47 |
|
| 48 |
CircMNTable2D* T=new CircMNTable2D(Vector3(0.0,0.0,0.0),Vector3(size,size,0.0),2.5,1); |
| 49 |
HexAggregateInsertGenerator2D *G_sand=new HexAggregateInsertGenerator2D(rmin_sand,1.0,ntry,1000,1e-6); |
| 50 |
InsertGenerator2D *G_clay=new InsertGenerator2D(rmin_clay,rmax_clay,ntry,1000,1e-6); |
| 51 |
|
| 52 |
// seed RNG |
| 53 |
struct timeval tv; |
| 54 |
gettimeofday(&tv,NULL); |
| 55 |
int random_seed=tv.tv_usec; |
| 56 |
srand(random_seed); |
| 57 |
|
| 58 |
CircMNTable2D::SetOutputStyle(outputstyle); |
| 59 |
|
| 60 |
// clay layer |
| 61 |
double clay_layer_min=sand_layer_thickness; |
| 62 |
double clay_layer_max=clay_layer_min+clay_layer_thickness; |
| 63 |
double clay_box_min= clay_layer_min-rmax_clay; |
| 64 |
double clay_box_max= clay_layer_max+rmax_clay; |
| 65 |
|
| 66 |
BoxWithLines2D ClayBox(Vector3(clay_layer_min,0.0,0.0),Vector3(clay_layer_max,size,0.0)); |
| 67 |
|
| 68 |
ClayBox.addLine(Line2D(Vector3(clay_layer_min,0.0,0.0),Vector3(clay_layer_max,0.0,0.0))); // left |
| 69 |
ClayBox.addLine(Line2D(Vector3(clay_layer_max,size,0.0),Vector3(clay_layer_min,size,0.0))); // right |
| 70 |
ClayBox.addLine(Line2D(Vector3(clay_layer_max,size,0.0),Vector3(clay_layer_max,0.0,0.0))); // top |
| 71 |
ClayBox.addLine(Line2D(Vector3(clay_layer_min,size,0.0),Vector3(clay_layer_max,size,0.0))); // right |
| 72 |
|
| 73 |
G_clay->generatePacking(&ClayBox,T,0,2); |
| 74 |
|
| 75 |
// little center box |
| 76 |
double cbox_layer_minx=sand_layer_thickness-center_box_dim; |
| 77 |
double cbox_layer_maxx=sand_layer_thickness+clay_layer_thickness+center_box_dim; |
| 78 |
double cbox_layer_miny=0.5*size-center_box_dim; |
| 79 |
double cbox_layer_maxy=0.5*size+center_box_dim; |
| 80 |
|
| 81 |
BoxWithLines2D CenterBox(Vector3(cbox_layer_minx,cbox_layer_miny,0.0), |
| 82 |
Vector3(cbox_layer_maxx,cbox_layer_maxy,0.0)); |
| 83 |
|
| 84 |
CenterBox.addLine(Line2D(Vector3(cbox_layer_minx,cbox_layer_miny,0.0), |
| 85 |
Vector3(cbox_layer_maxx,cbox_layer_miny,0.0))); // left |
| 86 |
CenterBox.addLine(Line2D(Vector3(cbox_layer_maxx,cbox_layer_maxy,0.0), |
| 87 |
Vector3(cbox_layer_minx,cbox_layer_maxy,0.0))); // right |
| 88 |
CenterBox.addLine(Line2D(Vector3(cbox_layer_maxx,cbox_layer_maxy,0.0), |
| 89 |
Vector3(cbox_layer_maxx,cbox_layer_miny,0.0))); // top |
| 90 |
CenterBox.addLine(Line2D(Vector3(cbox_layer_minx,cbox_layer_maxy,0.0), |
| 91 |
Vector3(cbox_layer_maxx,cbox_layer_maxy,0.0))); // right |
| 92 |
|
| 93 |
G_clay->generatePacking(&CenterBox,T,0,2); |
| 94 |
|
| 95 |
|
| 96 |
// --- sand layers |
| 97 |
// layer 1 |
| 98 |
double sand_layer_min1=0; |
| 99 |
double sand_layer_max1=sand_layer_thickness; |
| 100 |
double sand_box_min1=sand_layer_min1-rmin_sand; |
| 101 |
double sand_box_max1=sand_layer_max1+rmin_sand; |
| 102 |
|
| 103 |
BoxWithLines2D SandBox1(Vector3(sand_box_min1,0.0,0.0),Vector3(sand_box_max1,size,0.0)); |
| 104 |
|
| 105 |
SandBox1.addLine(Line2D(Vector3(sand_layer_min1,size,0.0),Vector3(sand_layer_min1,0.0,0.0))); // bottom |
| 106 |
SandBox1.addLine(Line2D(Vector3(sand_layer_min1,0.0,0.0),Vector3(sand_layer_max1,0.0,0.0))); // left |
| 107 |
SandBox1.addLine(Line2D(Vector3(sand_layer_max1,size,0.0),Vector3(sand_layer_max1,0.0,0.0))); // top |
| 108 |
SandBox1.addLine(Line2D(Vector3(sand_layer_min1,size,0.0),Vector3(sand_layer_max1,size,0.0))); // right |
| 109 |
|
| 110 |
SandBox1.addLine(Line2D(Vector3(0.0,size/2.0,0.0),Vector3(size,size/2.0,0.0))); // middle |
| 111 |
|
| 112 |
G_sand->generatePacking(&SandBox1,T,0,1); |
| 113 |
|
| 114 |
// layer 2 |
| 115 |
double sand_layer_min2=sand_layer_thickness+clay_layer_thickness; |
| 116 |
double sand_layer_max2=size; |
| 117 |
double sand_box_min2=sand_layer_min2-rmin_sand; |
| 118 |
double sand_box_max2=sand_layer_max2+rmin_sand; |
| 119 |
|
| 120 |
BoxWithLines2D SandBox2(Vector3(sand_box_min2,0.0,0.0),Vector3(sand_box_max2,size,0.0)); |
| 121 |
|
| 122 |
SandBox2.addLine(Line2D(Vector3(sand_layer_min2,size,0.0),Vector3(sand_layer_min2,0.0,0.0))); // bottom |
| 123 |
SandBox2.addLine(Line2D(Vector3(sand_layer_min2,0.0,0.0),Vector3(sand_layer_max2,0.0,0.0))); // left |
| 124 |
SandBox2.addLine(Line2D(Vector3(sand_layer_max2,size,0.0),Vector3(sand_layer_max2,0.0,0.0))); // top |
| 125 |
SandBox2.addLine(Line2D(Vector3(sand_layer_min2,size,0.0),Vector3(sand_layer_max2,size,0.0))); // right |
| 126 |
|
| 127 |
SandBox2.addLine(Line2D(Vector3(0.0,size/2.0,0.0),Vector3(size,size/2.0,0.0))); // middle |
| 128 |
|
| 129 |
G_sand->generatePacking(&SandBox2,T,0,1); |
| 130 |
|
| 131 |
T->generateBonds(0,1e-6,0,1,1); |
| 132 |
|
| 133 |
|
| 134 |
Line2D top_line(Vector3(0.0,size,0.0),Vector3(size,size,0.0)); |
| 135 |
Line2D bottom_line(Vector3(0.0,0.0,0.0),Vector3(size,0.0,0.0)); |
| 136 |
|
| 137 |
T->tagParticlesAlongLine(top_line,0.5,4,4,0); |
| 138 |
T->tagParticlesAlongLine(bottom_line,0.5,8,8,0); |
| 139 |
|
| 140 |
cout << *T << endl; |
| 141 |
|
| 142 |
delete T; |
| 143 |
delete G_sand; |
| 144 |
delete G_clay; |
| 145 |
return ret; |
| 146 |
} |