Skip to content
Snippets Groups Projects
Commit 0fcefc81 authored by podlesny's avatar podlesny
Browse files

.

parent 7bb4bca8
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ ContactNetwork<HostGridType, VectorType>::ContactNetwork( ...@@ -26,7 +26,7 @@ ContactNetwork<HostGridType, VectorType>::ContactNetwork(
couplings_(nCouplings), couplings_(nCouplings),
frictionBoundaries_(nBodies), frictionBoundaries_(nBodies),
stateEnergyNorms_(nBodies), stateEnergyNorms_(nBodies),
nBodyAssembler_(nBodies, nCouplings) //, false, 0.0) nBodyAssembler_(nBodies, nCouplings, false, 0.0)
{} {}
template <class HostGridType, class VectorType> template <class HostGridType, class VectorType>
...@@ -324,6 +324,7 @@ void ContactNetwork<HostGridType, VectorType>::totalNodes( ...@@ -324,6 +324,7 @@ void ContactNetwork<HostGridType, VectorType>::totalNodes(
std::vector<std::shared_ptr<typename LeafBody::BoundaryCondition>> boundaryConditions; std::vector<std::shared_ptr<typename LeafBody::BoundaryCondition>> boundaryConditions;
body->boundaryConditions(tag, boundaryConditions); body->boundaryConditions(tag, boundaryConditions);
if (boundaryConditions.size()>0) {
const int idxBackup = idx; const int idxBackup = idx;
for (size_t bc = 0; bc<boundaryConditions.size(); bc++) { for (size_t bc = 0; bc<boundaryConditions.size(); bc++) {
const auto& nodes = boundaryConditions[bc]->boundaryNodes(); const auto& nodes = boundaryConditions[bc]->boundaryNodes();
...@@ -332,6 +333,9 @@ void ContactNetwork<HostGridType, VectorType>::totalNodes( ...@@ -332,6 +333,9 @@ void ContactNetwork<HostGridType, VectorType>::totalNodes(
totalNodes[idx][k] = (*nodes)[j][k]; totalNodes[idx][k] = (*nodes)[j][k];
idx = (bc==boundaryConditions.size()-1 ? idx : idxBackup); idx = (bc==boundaryConditions.size()-1 ? idx : idxBackup);
} }
} else {
idx += body->nVertices();
}
} }
} }
......
# -*- mode:conf -*- # -*- mode:conf -*-
[boundary.friction] [boundary.friction]
smallestDiameter = 0.25 # 2e-3 [m] smallestDiameter = 0.01 # 2e-3 [m]
[timeSteps] [timeSteps]
refinementTolerance = 1e-5 # 1e-5 refinementTolerance = 1e-5 # 1e-5
......
...@@ -9,12 +9,12 @@ class VelocityDirichletCondition ...@@ -9,12 +9,12 @@ class VelocityDirichletCondition
// Assumed to vanish at time zero // Assumed to vanish at time zero
double const finalVelocity = -5e-5; double const finalVelocity = -5e-5;
std::cout << "VelocityDirichletCondition::evaluate()" << std::endl; /*std::cout << "VelocityDirichletCondition::evaluate()" << std::endl;
if (relativeTime <= 0.1) if (relativeTime <= 0.1)
std::cout << "- loading phase" << std::endl; std::cout << "- loading phase" << std::endl;
else else
std::cout << "- final velocity reached" << std::endl; std::cout << "- final velocity reached" << std::endl;*/
y = (relativeTime <= 0.1) y = (relativeTime <= 0.1)
? finalVelocity * (1.0 - std::cos(relativeTime * M_PI / 0.1)) / 2.0 ? finalVelocity * (1.0 - std::cos(relativeTime * M_PI / 0.1)) / 2.0
......
...@@ -11,7 +11,7 @@ vtk.write = true ...@@ -11,7 +11,7 @@ vtk.write = true
[problem] [problem]
finalTime = 100 # [s] #1000 finalTime = 100 # [s] #1000
bodyCount = 2 bodyCount = 4
[body] [body]
bulkModulus = 0.5e5 # [Pa] bulkModulus = 0.5e5 # [Pa]
......
...@@ -57,7 +57,7 @@ ...@@ -57,7 +57,7 @@
const int dim = MY_DIM; const int dim = MY_DIM;
const int timeSteps = 1; const int timeSteps = 5;
Dune::ParameterTree parset; Dune::ParameterTree parset;
size_t bodyCount; size_t bodyCount;
...@@ -86,6 +86,11 @@ void solveProblem(const ContactNetwork& contactNetwork, ...@@ -86,6 +86,11 @@ void solveProblem(const ContactNetwork& contactNetwork,
//using LocalSolver = LocalBisectionSolver; //using LocalSolver = LocalBisectionSolver;
//using Linearization = Linearization<Functional, BitVector>; //using Linearization = Linearization<Functional, BitVector>;
/*print(ignore, "ignore:");
for (size_t i=0; i<x.size(); i++) {
std::cout << x[i] << std::endl;
}*/
// set up reference solver // set up reference solver
Vector refX = x; Vector refX = x;
using ContactFunctional = Dune::TNNMG::BoxConstrainedQuadraticFunctional<Matrix&, Vector&, Vector&, Vector&, double>; using ContactFunctional = Dune::TNNMG::BoxConstrainedQuadraticFunctional<Matrix&, Vector&, Vector&, Vector&, double>;
...@@ -438,8 +443,8 @@ void run(Updaters& updaters, ContactNetwork& contactNetwork, ...@@ -438,8 +443,8 @@ void run(Updaters& updaters, ContactNetwork& contactNetwork,
nBodyAssembler.concatenateVectors(u0, totalu0); nBodyAssembler.concatenateVectors(u0, totalu0);
nBodyAssembler.concatenateVectors(v0, totalv0); nBodyAssembler.concatenateVectors(v0, totalv0);
updaters.rate_->velocityObstacles(totalu0, lower, totalv0, vLower); //updaters.rate_->velocityObstacles(totalu0, lower, totalv0, vLower);
updaters.rate_->velocityObstacles(totalu0, upper, totalv0, vUpper); //updaters.rate_->velocityObstacles(totalu0, upper, totalv0, vUpper);
const auto& errorNorms = contactNetwork.stateEnergyNorms(); const auto& errorNorms = contactNetwork.stateEnergyNorms();
...@@ -465,7 +470,7 @@ void run(Updaters& updaters, ContactNetwork& contactNetwork, ...@@ -465,7 +470,7 @@ void run(Updaters& updaters, ContactNetwork& contactNetwork,
Vector totalVelocityIterate; Vector totalVelocityIterate;
nBodyAssembler.nodalToTransformed(velocityIterates, totalVelocityIterate); nBodyAssembler.nodalToTransformed(velocityIterates, totalVelocityIterate);
solveProblem(contactNetwork, bilinearForm, totalRhs, totalVelocityIterate, totalDirichletNodes, vLower, vUpper); solveProblem(contactNetwork, bilinearForm, totalRhs, totalVelocityIterate, totalDirichletNodes, lower, upper);
nBodyAssembler.postprocess(totalVelocityIterate, velocityIterates); nBodyAssembler.postprocess(totalVelocityIterate, velocityIterates);
...@@ -496,8 +501,8 @@ void run(Updaters& updaters, ContactNetwork& contactNetwork, ...@@ -496,8 +501,8 @@ void run(Updaters& updaters, ContactNetwork& contactNetwork,
if (alpha[i].size()==0 || newAlpha[i].size()==0) if (alpha[i].size()==0 || newAlpha[i].size()==0)
continue; continue;
print(alpha[i], "alpha i:"); //print(alpha[i], "alpha i:");
print(newAlpha[i], "new alpha i:"); //print(newAlpha[i], "new alpha i:");
if (errorNorms[i]->diff(alpha[i], newAlpha[i]) >= fixedPointTolerance) { if (errorNorms[i]->diff(alpha[i], newAlpha[i]) >= fixedPointTolerance) {
breakCriterion = false; breakCriterion = false;
std::cout << "fixedPoint error: " << errorNorms[i]->diff(alpha[i], newAlpha[i]) << std::endl; std::cout << "fixedPoint error: " << errorNorms[i]->diff(alpha[i], newAlpha[i]) << std::endl;
...@@ -674,10 +679,10 @@ int main(int argc, char *argv[]) { try { ...@@ -674,10 +679,10 @@ int main(int argc, char *argv[]) { try {
// Set up TNNMG solver // Set up TNNMG solver
// ------------------- // -------------------
BitVector totalDirichletNodes; /*BitVector totalDirichletNodes;
contactNetwork.totalNodes("dirichlet", totalDirichletNodes); contactNetwork.totalNodes("dirichlet", totalDirichletNodes);
//print(totalDirichletNodes, "totalDirichletNodes:"); print(totalDirichletNodes, "totalDirichletNodes:");*/
//using Functional = Functional<Matrix&, Vector&, ZeroNonlinearity&, Vector&, Vector&, field_type>; //using Functional = Functional<Matrix&, Vector&, ZeroNonlinearity&, Vector&, Vector&, field_type>;
//using Functional = Functional<Matrix&, Vector&, GlobalFriction<Matrix, Vector>&, Vector&, Vector&, field_type>; //using Functional = Functional<Matrix&, Vector&, GlobalFriction<Matrix, Vector>&, Vector&, Vector&, field_type>;
......
...@@ -95,20 +95,20 @@ void Newmark<Vector, Matrix, BoundaryFunctions, BoundaryNodes>::setup( ...@@ -95,20 +95,20 @@ void Newmark<Vector, Matrix, BoundaryFunctions, BoundaryNodes>::setup(
double dirichletValue; double dirichletValue;
bodyDirichletFunctions[bc]->evaluate(relativeTime, dirichletValue); bodyDirichletFunctions[bc]->evaluate(relativeTime, dirichletValue);
std::cout << "dirichletValue: " << dirichletValue << std::endl; //std::cout << "dirichletValue: " << dirichletValue << std::endl;
for (size_t k=0; k<bcDirichletNodes.size() ; ++k) { for (size_t k=0; k<bcDirichletNodes.size() ; ++k) {
for (size_t j=0; j<dim; ++j) { for (size_t j=0; j<dim; ++j) {
if (bcDirichletNodes[k][j]) { if (bcDirichletNodes[k][j]) {
std::cout << k << " " << j << std::endl; //std::cout << k << " " << j << std::endl;
bodyIterate[k][j] = dirichletValue; bodyIterate[k][j] = dirichletValue;
} }
} }
} }
} }
} }
print(iterate, "iterate:"); //sprint(iterate, "iterate:");
} }
template <class Vector, class Matrix, class BoundaryFunctions, class BoundaryNodes> template <class Vector, class Matrix, class BoundaryFunctions, class BoundaryNodes>
......
...@@ -66,7 +66,7 @@ template <class ScalarVector, class Vector> ...@@ -66,7 +66,7 @@ template <class ScalarVector, class Vector>
void AgeingLawStateUpdater<ScalarVector, Vector>::extractAlpha( void AgeingLawStateUpdater<ScalarVector, Vector>::extractAlpha(
ScalarVector& alpha) { ScalarVector& alpha) {
std::cout << "alpha size: " << alpha.size() << " nodes_.size() " << nodes_.size() << std::endl; //std::cout << "alpha size: " << alpha.size() << " nodes_.size() " << nodes_.size() << std::endl;
if (alpha.size() != nodes_.size()) { if (alpha.size() != nodes_.size()) {
alpha.resize(nodes_.size()); alpha.resize(nodes_.size());
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment