Skip to content
Snippets Groups Projects
Commit 2ed3a742 authored by Elias Pipping's avatar Elias Pipping Committed by Elias Pipping
Browse files

Use parametertree

parent 2cce2c73
No related branches found
No related tags found
No related merge requests found
......@@ -13,6 +13,8 @@
#include <dune/common/exceptions.hh>
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/parametertree.hh>
#include <dune/common/parametertreeparser.hh>
#include <dune/common/shared_ptr.hh>
#include <dune/common/stdstreams.hh>
#include <dune/grid/common/mcmgmapper.hh>
......@@ -126,21 +128,26 @@ void assemble_frictional(
true); // whether to resize the output vector and zero all of its entries
}
int main() {
int main(int argc, char *argv[]) {
try {
Dune::ParameterTree parset;
Dune::ParameterTreeParser::readINITree("../../src/one-body-sample.parset",
parset);
Dune::ParameterTreeParser::readOptions(argc, argv, parset);
typedef Dune::FieldVector<double, dim> SmallVector;
typedef Dune::FieldMatrix<double, dim, dim> SmallMatrix;
typedef Dune::BCRSMatrix<SmallMatrix> OperatorType;
typedef Dune::BlockVector<SmallVector> VectorType;
typedef Dune::BlockVector<Dune::FieldVector<double, 1>> CellVectorType;
// FIXME: Random values
size_t const runs = 1000;
double const E = 1e4;
double const nu = 0.3;
int const refinements = 5;
size_t const solver_maxIterations = 100000;
double const solver_tolerance = 1e-6;
auto const runs = parset.get<size_t>("timesteps");
auto const E = parset.get<double>("body.E");
auto const nu = parset.get<double>("body.nu");
auto const refinements = parset.get<int>("grid.refinements");
auto const solver_maxIterations =
parset.get<size_t>("solver.maxiterations");
auto const solver_tolerance = parset.get<double>("solver.tolerance");
// {{{ Set up grid
typedef Dune::YaspGrid<dim> GridType;
......@@ -211,16 +218,15 @@ int main() {
stiffnessMatrix.umv(u3, b3);
// {{{ Assemble terms for the nonlinearity
// TODO: Random value
std::vector<double> normalStress;
normalStress.resize(grid.size(grid.maxLevel(), dim));
std::fill(normalStress.begin(), normalStress.end(), 0.1);
std::fill(normalStress.begin(), normalStress.end(),
parset.get<double>("boundary.normalstress"));
// TODO: Random value
std::vector<double> coefficientOfFriction;
coefficientOfFriction.resize(grid.size(grid.maxLevel(), dim));
std::fill(coefficientOfFriction.begin(), coefficientOfFriction.end(),
0.75);
parset.get<double>("boundary.mu"));
Dune::GlobalNonlinearity<dim, Dune::LinearFunction> myGlobalNonlinearity(
coefficientOfFriction, normalStress, nodalIntegrals);
......
timesteps = 1000
[grid]
refinements = 5
[body]
E = 1e4
nu = 0.3
[solver]
maxiterations = 100000
tolerance = 1e-6
[boundary]
normalstress = 0.1
mu = 0.75
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment