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

Use enum parser for model as well

parent 6e555ec6
No related branches found
No related tags found
No related merge requests found
......@@ -12,6 +12,10 @@
#include "assemblers.hh"
#include "enums.hh"
#include "enum_parser.cc"
#include "enum_model.cc"
// Assembles Neumann boundary term in f
template <class GridType, class GridView, class LocalVectorType, class FEBasis>
void assemble_neumann(GridView const &gridView, FEBasis const &feBasis,
......@@ -67,34 +71,32 @@ assemble_nonlinearity(
auto normalStress = Dune::make_shared<SingletonVectorType>(size);
*normalStress = parset.get<double>("normalstress");
std::string const friction_model = parset.get<std::string>("model");
if (friction_model == std::string("Ruina")) {
auto a = Dune::make_shared<SingletonVectorType>(size);
*a = parset.get<double>("ruina.a");
auto eta = Dune::make_shared<SingletonVectorType>(size);
*eta = parset.get<double>("eta");
auto b = Dune::make_shared<SingletonVectorType>(size);
*b = parset.get<double>("ruina.b");
auto L = Dune::make_shared<SingletonVectorType>(size);
*L = parset.get<double>("ruina.L");
return Dune::make_shared<
Dune::GlobalRuinaNonlinearity<VectorType, MatrixType> const>(
nodalIntegrals, a, mu, eta, normalStress, b, state, L, h);
} else if (friction_model == std::string("Laursen")) {
return
// TODO: take state and h into account
// FIXME: We should be using a quadratic rather than a linear function
// here!
Dune::make_shared<
Dune::GlobalLaursenNonlinearity<Dune::LinearFunction, VectorType,
MatrixType> const>(mu, normalStress,
nodalIntegrals);
} else {
assert(false);
switch (parset.get<Config::model>("model")) {
case Config::Exponential: {
auto a = Dune::make_shared<SingletonVectorType>(size);
*a = parset.get<double>("ruina.a");
auto eta = Dune::make_shared<SingletonVectorType>(size);
*eta = parset.get<double>("eta");
auto b = Dune::make_shared<SingletonVectorType>(size);
*b = parset.get<double>("ruina.b");
auto L = Dune::make_shared<SingletonVectorType>(size);
*L = parset.get<double>("ruina.L");
return Dune::make_shared<
Dune::GlobalRuinaNonlinearity<VectorType, MatrixType> const>(
nodalIntegrals, a, mu, eta, normalStress, b, state, L, h);
}
case Config::Laursen:
return
// TODO: take state and h into account
// FIXME: We should be using a quadratic rather than a linear function
// here!
Dune::make_shared<Dune::GlobalLaursenNonlinearity<
Dune::LinearFunction, VectorType,
MatrixType> const>(mu, normalStress, nodalIntegrals);
}
}
......
#include <dune/common/exceptions.hh>
template <> struct StringToEnum<Config::model> {
static Config::model convert(std::string const &s) {
if (s == "Laursen")
return Config::Laursen;
if (s == "Exponential")
return Config::Exponential;
DUNE_THROW(Dune::Exception, "failed to parse enum");
}
};
struct Config {
enum model {
Laursen,
Exponential
};
enum state_model {
Dieterich,
Ruina
......
......@@ -68,7 +68,7 @@ normalstress = 0.1 # laursen depends a lot more on this
# http://earthquake.usgs.gov/research/physics/lab/prediction.pdf
mu = 0.5
eta = 1
model = Ruina
model = Exponential
[boundary.friction.state]
evolve = true
......
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