Newer
Older
#ifndef DUNE_TECTONIC_FRICTIONPOTENTIAL_HH
#define DUNE_TECTONIC_FRICTIONPOTENTIAL_HH
class FrictionPotential {
virtual ~FrictionPotential() {}
double virtual differential(double s) const = 0;
double virtual second_deriv(double x) const = 0;
double virtual regularity(double s) const = 0;
double virtual coefficientOfFriction(double s) const = 0;
double virtual evaluate(double x) const {
DUNE_THROW(Dune::NotImplemented, "evaluation not implemented");
void virtual updateAlpha(double) = 0;
class TruncatedRateState : public FrictionPotential {
TruncatedRateState(double _weight, double _weightedNormalStress,
FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const override {
//std::cout << "V: " << V << " Vmin: " << Vmin << std::endl;
auto res = fd.a * std::log(V / Vmin);
if (std::isinf(res)) {
//std::cout << "V: " << V << " Vmin: " << Vmin << std::endl;
//std::cout << "differential: " << weight * fd.C - weightedNormalStress * coefficientOfFriction(V) << std::endl;
//if (V <= Vmin or regularity(V)>10e8)
// return 0.0;
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
double second_deriv(double V) const override {
//std::cout << "second deriv: " << ((V<=Vmin) ? 0.0 : -weightedNormalStress * (fd.a / V)) << std::endl;
//std::cout << "regularity: " << ((std::abs(V - Vmin) < 1e-14) ? std::numeric_limits<double>::infinity() : std::abs(second_deriv(V))) << std::endl;
if (std::abs(V - Vmin) < 1e-14) // TODO
return 0.0;
return weight * fd.C * V - weightedNormalStress * fd.a * V * (std::log(V / Vmin) - 1);
}
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
double const weightedNormalStress;
class RegularisedRateState : public FrictionPotential {
public:
RegularisedRateState(double _weight, double _weightedNormalStress,
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const override {
return fd.a * std::asinh(0.5 * V / Vmin);
}
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
return -weightedNormalStress * fd.a / std::hypot(2.0 * Vmin, V);
double regularity(double V) const override {
return std::abs(second_deriv(V));
}
double evaluate(double V) const override {
return weight * fd.C * V - weightedNormalStress * 4 * fd.a * Vmin * std::pow(std::asinh(0.25 * V / Vmin), 2.0);
}
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest);
}
private:
FrictionData const fd;
double const weight;
double const weightedNormalStress;
class Tresca : public FrictionPotential {
public:
Tresca(double _weight, double _weightedNormalStress, FrictionData _fd)
: fd(_fd), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const override {
return fd.mu0;
}
double differential(double V) const override {
return - weightedNormalStress * coefficientOfFriction(V);
}
double second_deriv(double V) const override {
return 0;
}
double regularity(double V) const override {
return std::abs(second_deriv(V));
}
double evaluate(double V) const override {
}
void updateAlpha(double alpha) override {}
private:
FrictionData const fd;
double const weightedNormalStress;
};
class ZeroFunction : public FrictionPotential {
double evaluate(double) const override { return 0; }
double coefficientOfFriction(double s) const override { return 0; }
double differential(double) const override { return 0; }
double second_deriv(double) const override { return 0; }
double regularity(double) const override { return 0; }