Skip to content
Snippets Groups Projects
Commit 814acbbf authored by podlesny's avatar podlesny
Browse files

for each body, start with uniform grid with same aspect ratio for all bodies;...

for each body, start with uniform grid with same aspect ratio for all bodies; fix level body gridviews
parent ddd0687b
No related branches found
No related tags found
No related merge requests found
......@@ -30,6 +30,8 @@ void StackedBlocksFactory<HostGridType, VectorType>::setBodies() {
const auto& subParset = this->parset_.sub("boundary.friction.weakening");
std::vector<double> heights(this->bodyCount_);
#if MY_DIM == 3
double const depth = 0.60;
......@@ -70,6 +72,7 @@ void StackedBlocksFactory<HostGridType, VectorType>::setBodies() {
origins[0] = {0,0};
GlobalCoords lowerWeakOrigin = {0.0, 0};
GlobalCoords upperWeakOrigin = {0.0, height};
heights[0] = height;
cuboidGeometries_[0] = std::make_shared<CuboidGeometry>(origins[0], length, height);
cuboidGeometries_[0]->addWeakeningPatch(subParset, upperWeakOrigin, weakBound(upperWeakOrigin));
......@@ -78,13 +81,13 @@ void StackedBlocksFactory<HostGridType, VectorType>::setBodies() {
origins[i] = cuboidGeometries_[i-1]->upperLeft();
double power = (i<this->bodyCount_/2.0) ? i : (this->bodyCount_-i-1);
auto height_i = height*std::pow(heightScaling, power);
heights[i] = height*std::pow(heightScaling, power);
GlobalCoords lowerWeakOrigin_i = lowerWeakOrigin + origins[i];
GlobalCoords upperWeakOrigin_i = {upperWeakOrigin[0], height_i};
GlobalCoords upperWeakOrigin_i = {upperWeakOrigin[0], heights[i]};
upperWeakOrigin_i += origins[i];
cuboidGeometries_[i] = std::make_shared<CuboidGeometry>(origins[i], length, height_i);
cuboidGeometries_[i] = std::make_shared<CuboidGeometry>(origins[i], length, heights[i]);
cuboidGeometries_[i]->addWeakeningPatch(subParset, lowerWeakOrigin_i, weakBound(lowerWeakOrigin_i));
cuboidGeometries_[i]->addWeakeningPatch(subParset, upperWeakOrigin_i, weakBound(upperWeakOrigin_i));
......@@ -93,6 +96,7 @@ void StackedBlocksFactory<HostGridType, VectorType>::setBodies() {
const size_t idx = this->bodyCount_-1;
origins[idx] = cuboidGeometries_[idx-1]->upperLeft();
lowerWeakOrigin += origins[idx];
heights[idx] = height;
cuboidGeometries_[idx] = std::make_shared<CuboidGeometry>(origins[idx], length, height);
cuboidGeometries_[idx]->addWeakeningPatch(subParset, lowerWeakOrigin, weakBound(lowerWeakOrigin));
......@@ -104,7 +108,9 @@ void StackedBlocksFactory<HostGridType, VectorType>::setBodies() {
const auto& cuboidGeometry = *cuboidGeometries_[i];
// set up reference grid
CuboidGridConstructor<HostGridType> gridConstructor(cuboidGeometry);
std::array<unsigned int, 2> initialElements = {
{ (unsigned int) length/heights[i], 1 } };
DefaultCuboidGridConstructor<HostGridType> gridConstructor(cuboidGeometry, initialElements);
// define weak patch and refine grid
const auto& weakeningRegions = cuboidGeometry.weakeningRegions();
......@@ -172,7 +178,7 @@ void StackedBlocksFactory<HostGridType, VectorType>::setLevelBodies() {
this->contactNetwork_.addLevel(maxLevels, l);
for (size_t i=0; i<nBodies; i++) {
maxLevels[i]--;
maxLevels[i] = (maxLevels[i]>0) ? maxLevels[i]-1 : 0;
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment