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