| 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 "granular_gouge.h" |
| 14 |
|
| 15 |
// --- project includes --- |
| 16 |
#include "BoxWithPlanes3D.h" |
| 17 |
#include "TriBox.h" |
| 18 |
#include "Plane.h" |
| 19 |
#include "MNTable3D.h" |
| 20 |
#include "SphereVol.h" |
| 21 |
#include "src/InsertGenerator3D.h" |
| 22 |
|
| 23 |
/*! |
| 24 |
\param NT |
| 25 |
\param G |
| 26 |
\param xt total x-dim |
| 27 |
\param yt total y-dim |
| 28 |
\param zt total z-dim |
| 29 |
\param y0 y-offset |
| 30 |
\param nr nr raised ridges |
| 31 |
\param yr height of ridges |
| 32 |
*/ |
| 33 |
void generate_upper_rough_block(MNTable3D* NT, |
| 34 |
AGenerator3D* G, |
| 35 |
double xt, |
| 36 |
double yt, |
| 37 |
double zt, |
| 38 |
double y0, |
| 39 |
int nr, |
| 40 |
double yr) |
| 41 |
{ |
| 42 |
Vector3 min=Vector3(0.0,y0,0.0); |
| 43 |
Vector3 min_2=Vector3(0.0,y0+yr,0.0); |
| 44 |
Vector3 max=Vector3(xt,y0+yt,zt); |
| 45 |
double xr=xt/(2.0*double(nr)); |
| 46 |
|
| 47 |
Plane top_plane=Plane(max,Vector3(0.0,-1.0,0.0)); |
| 48 |
Plane bottom_plane_1=Plane(min,Vector3(0.0,1.0,0.0)); |
| 49 |
Plane bottom_plane_2=Plane(min_2,Vector3(0.0,1.0,0.0)); |
| 50 |
Plane front_plane=Plane(min,Vector3(0.0,0.0,1.0)); |
| 51 |
Plane back_plane=Plane(max,Vector3(0.0,0.0,-1.0)); |
| 52 |
Plane left_plane=Plane(min,Vector3(1.0,0.0,0.0)); |
| 53 |
Plane right_plane=Plane(max,Vector3(-1.0,0.0,0.0)); |
| 54 |
|
| 55 |
Vector3 diff(1.0,0.0,0.0); |
| 56 |
BoxWithPlanes3D Box(min_2-diff,max+diff); |
| 57 |
|
| 58 |
Box.addPlane(top_plane); |
| 59 |
Box.addPlane(bottom_plane_2); |
| 60 |
Box.addPlane(front_plane); |
| 61 |
Box.addPlane(back_plane); |
| 62 |
Box.addPlane(left_plane); |
| 63 |
Box.addPlane(right_plane); |
| 64 |
|
| 65 |
G->generatePacking(&Box,NT,0); |
| 66 |
|
| 67 |
if(yt>0.0){ |
| 68 |
for(int i=0;i<nr;i++){ |
| 69 |
double x1=2.0*double(i)*xr; |
| 70 |
double x2=(2.0*double(i)+1.0)*xr; |
| 71 |
|
| 72 |
// ridge |
| 73 |
Vector3 lmin=Vector3(x1,y0,0.0); |
| 74 |
Vector3 lmax=Vector3(x2,y0+yt,zt); |
| 75 |
left_plane=Plane(lmin,Vector3(1.0,0.0,0.0)); |
| 76 |
right_plane=Plane(lmax,Vector3(-1.0,0.0,0.0)); |
| 77 |
|
| 78 |
BoxWithPlanes3D RBox(lmin,lmax); |
| 79 |
RBox.addPlane(bottom_plane_1); |
| 80 |
RBox.addPlane(front_plane); |
| 81 |
RBox.addPlane(back_plane); |
| 82 |
RBox.addPlane(left_plane); |
| 83 |
RBox.addPlane(right_plane); |
| 84 |
|
| 85 |
G->generatePacking(&RBox,NT,0); |
| 86 |
} |
| 87 |
} |
| 88 |
} |
| 89 |
|
| 90 |
/*! |
| 91 |
\param NT |
| 92 |
\param G |
| 93 |
\param xt total x-dim |
| 94 |
\param yt total y-dim |
| 95 |
\param zt total z-dim |
| 96 |
\param y0 y-offset |
| 97 |
\param nr nr raised ridges |
| 98 |
\param yr height of ridges |
| 99 |
*/ |
| 100 |
void generate_lower_rough_block(MNTable3D* NT, |
| 101 |
AGenerator3D* G, |
| 102 |
double xt, |
| 103 |
double yt, |
| 104 |
double zt, |
| 105 |
double y0, |
| 106 |
int nr, |
| 107 |
double yr) |
| 108 |
{ |
| 109 |
Vector3 min=Vector3(0.0,y0,0.0); |
| 110 |
Vector3 max_2=Vector3(xt,y0+(yt-yr),zt); |
| 111 |
Vector3 max=Vector3(xt,y0+yt,zt); |
| 112 |
double xr=xt/(2.0*double(nr)); |
| 113 |
|
| 114 |
Plane top_plane=Plane(max,Vector3(0.0,-1.0,0.0)); |
| 115 |
Plane top_plane_2=Plane(max_2,Vector3(0.0,-1.0,0.0)); |
| 116 |
Plane bottom_plane=Plane(min,Vector3(0.0,1.0,0.0)); |
| 117 |
Plane front_plane=Plane(min,Vector3(0.0,0.0,1.0)); |
| 118 |
Plane back_plane=Plane(max,Vector3(0.0,0.0,-1.0)); |
| 119 |
Plane left_plane=Plane(min,Vector3(1.0,0.0,0.0)); |
| 120 |
Plane right_plane=Plane(max,Vector3(-1.0,0.0,0.0)); |
| 121 |
|
| 122 |
Vector3 diff(1.0,0.0,0.0); |
| 123 |
BoxWithPlanes3D Box(min-diff,max_2+diff); |
| 124 |
|
| 125 |
Box.addPlane(top_plane_2); |
| 126 |
Box.addPlane(bottom_plane); |
| 127 |
Box.addPlane(front_plane); |
| 128 |
Box.addPlane(back_plane); |
| 129 |
Box.addPlane(left_plane); |
| 130 |
Box.addPlane(right_plane); |
| 131 |
|
| 132 |
G->generatePacking(&Box,NT,0); |
| 133 |
|
| 134 |
|
| 135 |
if(yt>0.0){ |
| 136 |
for(int i=0;i<nr;i++){ |
| 137 |
double x1=2.0*double(i)*xr; |
| 138 |
double x2=(2.0*double(i)+1.0)*xr; |
| 139 |
|
| 140 |
// ridge |
| 141 |
Vector3 lmin=Vector3(x1,y0,0.0); |
| 142 |
Vector3 lmax=Vector3(x2,y0+yt,zt); |
| 143 |
left_plane=Plane(lmin,Vector3(1.0,0.0,0.0)); |
| 144 |
right_plane=Plane(lmax,Vector3(-1.0,0.0,0.0)); |
| 145 |
|
| 146 |
BoxWithPlanes3D RBox(lmin,lmax); |
| 147 |
RBox.addPlane(top_plane); |
| 148 |
RBox.addPlane(front_plane); |
| 149 |
RBox.addPlane(back_plane); |
| 150 |
RBox.addPlane(left_plane); |
| 151 |
RBox.addPlane(right_plane); |
| 152 |
|
| 153 |
G->generatePacking(&RBox,NT,0); |
| 154 |
} |
| 155 |
} |
| 156 |
} |
| 157 |
|
| 158 |
|
| 159 |
/*! |
| 160 |
\param NT |
| 161 |
\param G |
| 162 |
\param xt total x-dim |
| 163 |
\param yt total y-dim |
| 164 |
\param zt total z-dim |
| 165 |
\param y0 y-offset |
| 166 |
\param nr nr raised ridges |
| 167 |
\param yr height of ridges |
| 168 |
*/ |
| 169 |
void generate_upper_tri_rough_block(MNTable3D* NT, |
| 170 |
AGenerator3D* G, |
| 171 |
double xt, |
| 172 |
double yt, |
| 173 |
double zt, |
| 174 |
double y0, |
| 175 |
int nr, |
| 176 |
double yr) |
| 177 |
{ |
| 178 |
Vector3 min=Vector3(0.0,y0,0.0); |
| 179 |
Vector3 min_2=Vector3(0.0,y0+yr,0.0); |
| 180 |
Vector3 max=Vector3(xt,y0+yt,zt); |
| 181 |
double xr=xt/double(nr); |
| 182 |
|
| 183 |
Plane top_plane=Plane(max,Vector3(0.0,-1.0,0.0)); |
| 184 |
Plane bottom_plane_1=Plane(min,Vector3(0.0,1.0,0.0)); |
| 185 |
Plane bottom_plane_2=Plane(min_2,Vector3(0.0,1.0,0.0)); |
| 186 |
Plane front_plane=Plane(min,Vector3(0.0,0.0,1.0)); |
| 187 |
Plane back_plane=Plane(max,Vector3(0.0,0.0,-1.0)); |
| 188 |
// Plane left_plane=Plane(min,Vector3(1.0,0.0,0.0)); |
| 189 |
// Plane right_plane=Plane(max,Vector3(-1.0,0.0,0.0)); |
| 190 |
|
| 191 |
Vector3 diff(1.0,0.0,0.0); |
| 192 |
BoxWithPlanes3D Box(min_2-diff,max+diff); |
| 193 |
|
| 194 |
Box.addPlane(top_plane); |
| 195 |
Box.addPlane(bottom_plane_2); |
| 196 |
Box.addPlane(front_plane); |
| 197 |
Box.addPlane(back_plane); |
| 198 |
// Box.addPlane(left_plane); |
| 199 |
// Box.addPlane(right_plane); |
| 200 |
|
| 201 |
G->generatePacking(&Box,NT,0); |
| 202 |
|
| 203 |
|
| 204 |
for(int i=0;i<nr;i++){ |
| 205 |
double x1=double(i)*xr; |
| 206 |
double x2=double(i+1)*xr; |
| 207 |
|
| 208 |
// ridge |
| 209 |
Vector3 lmin=Vector3(x1,y0,0.0); |
| 210 |
Vector3 lmax=Vector3(x2,y0+yr,zt); |
| 211 |
Plane left_plane=Plane(lmin+Vector3(xr/2.0,0.0,0.0),(Vector3(yr,-0.5*xr,0.0)).unit()); // top left |
| 212 |
Plane right_plane=Plane(lmax,(Vector3(-1.0*yr,-0.5*xr,0.0)).unit()); // top right |
| 213 |
|
| 214 |
TriBox RBox(lmin,lmax,true); |
| 215 |
RBox.addPlane(front_plane); |
| 216 |
RBox.addPlane(back_plane); |
| 217 |
RBox.addPlane(left_plane); |
| 218 |
RBox.addPlane(right_plane); |
| 219 |
|
| 220 |
G->generatePacking(&RBox,NT,0); |
| 221 |
} |
| 222 |
NT->tagParticlesAlongPlane(top_plane,0.5,3,0); |
| 223 |
|
| 224 |
} |
| 225 |
|
| 226 |
/*! |
| 227 |
\param NT |
| 228 |
\param G |
| 229 |
\param xt total x-dim |
| 230 |
\param yt total y-dim |
| 231 |
\param zt total z-dim |
| 232 |
\param y0 y-offset |
| 233 |
\param nr nr raised ridges |
| 234 |
\param yr height of ridges |
| 235 |
*/ |
| 236 |
void generate_lower_tri_rough_block(MNTable3D* NT, |
| 237 |
AGenerator3D* G, |
| 238 |
double xt, |
| 239 |
double yt, |
| 240 |
double zt, |
| 241 |
double y0, |
| 242 |
int nr, |
| 243 |
double yr) |
| 244 |
{ |
| 245 |
Vector3 min=Vector3(0.0,y0,0.0); |
| 246 |
Vector3 max_2=Vector3(xt,y0+(yt-yr),zt); |
| 247 |
Vector3 max=Vector3(xt,y0+yt,zt); |
| 248 |
double xr=xt/(double(nr)); |
| 249 |
|
| 250 |
Plane top_plane=Plane(max,Vector3(0.0,-1.0,0.0)); |
| 251 |
Plane top_plane_2=Plane(max_2,Vector3(0.0,-1.0,0.0)); |
| 252 |
Plane bottom_plane=Plane(min,Vector3(0.0,1.0,0.0)); |
| 253 |
Plane front_plane=Plane(min,Vector3(0.0,0.0,1.0)); |
| 254 |
Plane back_plane=Plane(max,Vector3(0.0,0.0,-1.0)); |
| 255 |
// Plane left_plane=Plane(min,Vector3(1.0,0.0,0.0)); |
| 256 |
// Plane right_plane=Plane(max,Vector3(-1.0,0.0,0.0)); |
| 257 |
|
| 258 |
Vector3 diff(1.0,0.0,0.0); |
| 259 |
BoxWithPlanes3D Box(min-diff,max_2+diff); |
| 260 |
|
| 261 |
Box.addPlane(top_plane_2); |
| 262 |
Box.addPlane(bottom_plane); |
| 263 |
Box.addPlane(front_plane); |
| 264 |
Box.addPlane(back_plane); |
| 265 |
// Box.addPlane(left_plane); |
| 266 |
// Box.addPlane(right_plane); |
| 267 |
|
| 268 |
G->generatePacking(&Box,NT,0); |
| 269 |
|
| 270 |
|
| 271 |
for(int i=0;i<nr;i++){ |
| 272 |
double x1=double(i)*xr; |
| 273 |
double x2=double(i+1)*xr; |
| 274 |
|
| 275 |
// ridge |
| 276 |
Vector3 lmin=Vector3(x1,y0+(yt-yr),0.0); |
| 277 |
Vector3 lmax=Vector3(x2,y0+yt,zt); |
| 278 |
Plane left_plane=Plane(lmin,(Vector3(yr,-0.5*xr,0.0)).unit()); // top left |
| 279 |
Plane right_plane=Plane(lmax-Vector3(xr/2.0,0.0,0.0),(Vector3(-1.0*yr,-0.5*xr,0.0)).unit()); // top right |
| 280 |
|
| 281 |
TriBox RBox(lmin,lmax); |
| 282 |
RBox.addPlane(front_plane); |
| 283 |
RBox.addPlane(back_plane); |
| 284 |
RBox.addPlane(left_plane); |
| 285 |
RBox.addPlane(right_plane); |
| 286 |
|
| 287 |
G->generatePacking(&RBox,NT,0); |
| 288 |
} |
| 289 |
|
| 290 |
NT->tagParticlesAlongPlane(bottom_plane,0.5,4,0); |
| 291 |
} |
| 292 |
|
| 293 |
/*! |
| 294 |
generate spherical grains in the middle |
| 295 |
|
| 296 |
\param NT |
| 297 |
\param G |
| 298 |
\param Pmin minimum corner of the gouge box |
| 299 |
\param Pmax maximum corner of the gouge box |
| 300 |
\param grmin minimun grain radius |
| 301 |
\param grmax maximum grain radius |
| 302 |
\param gntry nr. of tries for grain fitting |
| 303 |
*/ |
| 304 |
void generate_granular_gouge(MNTable3D* NT, |
| 305 |
AGenerator3D* G, |
| 306 |
const Vector3& Pmin, |
| 307 |
const Vector3& Pmax, |
| 308 |
double grmin, |
| 309 |
double grmax, |
| 310 |
int gntry) |
| 311 |
{ |
| 312 |
std::cout << "Granular Gouge: " << Pmin << " - " << Pmax << " " << grmin << " " << grmax << " " << gntry << std::endl; |
| 313 |
// == stage 1 - generate grains == |
| 314 |
// -- setup auxillary Table,Volume and Generator |
| 315 |
MNTable3D T_aux(Pmin,Pmax,2.1*grmax,1); |
| 316 |
InsertGenerator3D G_aux(grmin,grmax,gntry,1000,1e-5); |
| 317 |
BoxWithPlanes3D V_aux(Pmin,Pmax); |
| 318 |
|
| 319 |
// -- generate grains |
| 320 |
G_aux.generatePacking(&V_aux,&T_aux,0); |
| 321 |
|
| 322 |
// -- extract grains |
| 323 |
vector<const Sphere*> grain_sph=T_aux.getAllSpheresFromGroup(0); |
| 324 |
|
| 325 |
// == stage 2 - fill grains == |
| 326 |
// -- get nr. of grains |
| 327 |
int ngr=grain_sph.size(); |
| 328 |
std::cout << " found " << ngr << " grains" << std:: endl; |
| 329 |
// -- grow nr. of particle groups in main NTable |
| 330 |
NT->GrowNGroups(1+ngr); |
| 331 |
// -- for each grain, do filling |
| 332 |
int ggid=1; // group id |
| 333 |
for(vector<const Sphere*>::iterator iter=grain_sph.begin(); |
| 334 |
iter!=grain_sph.end(); |
| 335 |
iter++){ |
| 336 |
// -- setup sphere volume |
| 337 |
SphereVol S=SphereVol((*iter)->Center(),(*iter)->Radius()); |
| 338 |
// -- generate packing |
| 339 |
G->generatePacking(&S,NT,ggid); |
| 340 |
// -- generate bonds |
| 341 |
NT->generateBonds(ggid,1e-5,1); |
| 342 |
ggid++; |
| 343 |
} |
| 344 |
} |