Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • podlesny/dune-tectonic
  • agnumpde/dune-tectonic
2 results
Show changes
Commits on Source (239)
Showing
with 221 additions and 169 deletions
*.o
*.pyc
.clang-format
.deps
.libs
/aclocal.m4
/am
/autom4te.cache
/compile
/config.guess
/config.h
/config.h.in
/config.log
/config.lt
/config.status
/config.sub
/configure
/depcomp
/dependencies.m4
/dune-tectonic.pc
/install-sh
/libtool
/ltmain.sh
/missing
/stamp-h1
/test-driver
Makefile
Makefile.in
src/one-body-sample-?D
build-cmake
cmake_minimum_required(VERSION 2.8.6)
project(dune-tectonic CXX)
if(NOT (dune-common_DIR OR dune-common_ROOT OR
"${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
string(REPLACE ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
${PROJECT_BINARY_DIR})
endif()
#find dune-common and set the module path
find_package(dune-common REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
${dune-common_MODULE_PATH})
#include the dune macros
include(DuneMacros)
# start a dune project with information from dune.module
dune_project()
find_package(HDF5 COMPONENTS C REQUIRED)
add_subdirectory("src")
add_subdirectory("dune")
add_subdirectory("doc")
add_subdirectory("cmake/modules")
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
EXTRA_DIST = dune.module
SUBDIRS = src m4 dune
include $(top_srcdir)/am/top-rules
include $(top_srcdir)/am/global-rules
set(modules "DuneTectonicMacros.cmake")
install(FILES ${modules} DESTINATION ${DUNE_INSTALL_MODULEDIR})
# File for module specific CMake tests.
/* begin dune-tectonic
put the definitions for config.h specific to
your project here. Everything above will be
overwritten
*/
/* begin private */
/* Name of package */
#define PACKAGE "@DUNE_MOD_NAME@"
/* Define to the address where bug reports for this package should be sent. */
#define PACKAGE_BUGREPORT "@DUNE_MAINTAINER@"
/* Define to the full name of this package. */
#define PACKAGE_NAME "@DUNE_MOD_NAME@"
/* Define to the full name and version of this package. */
#define PACKAGE_STRING "@DUNE_MOD_NAME@ @DUNE_MOD_VERSION@"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "@DUNE_MOD_NAME@"
/* Define to the home page for this package. */
#define PACKAGE_URL "@DUNE_MOD_URL@"
/* Define to the version of this package. */
#define PACKAGE_VERSION "@DUNE_MOD_VERSION@"
/* end private */
/* Define to the version of dune-tectonic */
#define DUNE_TECTONIC_VERSION "@DUNE_TECTONIC_VERSION@"
/* Define to the major version of dune-tectonic */
#define DUNE_TECTONIC_VERSION_MAJOR @DUNE_TECTONIC_VERSION_MAJOR@
/* Define to the minor version of dune-tectonic */
#define DUNE_TECTONIC_VERSION_MINOR @DUNE_TECTONIC_VERSION_MINOR@
/* Define to the revision of dune-tectonic */
#define DUNE_TECTONIC_VERSION_REVISION @DUNE_TECTONIC_VERSION_REVISION@
/* end dune-tectonic
Everything below here will be overwritten
*/
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ(2.50)
DUNE_AC_INIT # gets module version from dune.module file
AM_INIT_AUTOMAKE
AM_SILENT_RULES
AC_CONFIG_SRCDIR([src/one-body-sample.cc])
AC_CONFIG_HEADERS([config.h])
DUNE_CHECK_ALL
AC_CONFIG_FILES([
Makefile
src/Makefile
dune/Makefile
dune/tectonic/Makefile
m4/Makefile
dune-tectonic.pc
])
AC_OUTPUT
# finally print the summary information
DUNE_SUMMARY_ALL
add_subdirectory("doxygen")
# shortcut for creating the Doxyfile.in and Doxyfile
add_doxygen_target()
# This file contains local changes to the doxygen configuration
# please us '+=' to add file/directories to the lists
# The INPUT tag can be used to specify the files and/or directories that contain
# documented source files. You may enter file names like "myfile.cpp" or
# directories like "/usr/src/myproject". Separate the files or directories
# with spaces.
INPUT += @top_srcdir@/dune/
# see e.g. dune-grid for the examples of mainpage and modules
# INPUT += @srcdir@/mainpage \
# @srcdir@/modules
# The EXCLUDE tag can be used to specify files and/or directories that should
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
# EXCLUDE += @top_srcdir@/dune/tectonic/test
# The EXAMPLE_PATH tag can be used to specify one or more files or
# directories that contain example code fragments that are included (see
# the \include command).
# EXAMPLE_PATH += @top_srcdir@/src
# The IMAGE_PATH tag can be used to specify one or more files or
# directories that contain image that are included in the documentation (see
# the \image command).
# IMAGE_PATH += @top_srcdir@/dune/tectonic/pics
......@@ -10,6 +10,6 @@ Name: @PACKAGE_NAME@
Version: @VERSION@
Description: dune-tectonic module
URL: http://dune-project.org/
Requires: dune-common dune-fufem dune-tnnmg
#Libs: -L${libdir} -ldunetectonic
Requires: dune-common dune-fufem dune-grid dune-istl dune-solvers dune-tnnmg dune-uggrid
Libs: -L${libdir}
Cflags: -I${includedir}
......@@ -2,9 +2,7 @@
# Dune module information file #
################################
#Name of the module
Module: dune-tectonic
Version: 2.1-1
Maintainer: pipping@mi.fu-berlin.de
#depending on
Depends: dune-common dune-fufem dune-tnnmg
Version: 2.5-1
Maintainer: elias.pipping@fu-berlin.de
Depends: dune-common dune-fufem dune-grid dune-istl dune-solvers dune-tnnmg dune-uggrid
add_subdirectory(tectonic)
SUBDIRS = tectonic
include $(top_srcdir)/am/global-rules
install(FILES
body.hh
frictiondata.hh
frictionpotential.hh
globalfrictiondata.hh
globalfriction.hh
globalratestatefriction.hh
gravity.hh
localfriction.hh
minimisation.hh
myblockproblem.hh
mydirectionalconvexfunction.hh
quadraticenergy.hh
tectonic.hh
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dune/tectonic)
tectonicincludedir = $(includedir)/dune/tectonic
tectonicinclude_HEADERS = tectonic.hh
include $(top_srcdir)/am/global-rules
#ifndef BODY_HH
#define BODY_HH
#ifndef DUNE_TECTONIC_BODY_HH
#define DUNE_TECTONIC_BODY_HH
template <int dimension> struct Body {
using ScalarFunction = Dune::VirtualFunction<
Dune::FieldVector<double, dimension>, Dune::FieldVector<double, 1>>;
using ScalarFunction =
Dune::VirtualFunction<Dune::FieldVector<double, dimension>,
Dune::FieldVector<double, 1>>;
using VectorField =
Dune::VirtualFunction<Dune::FieldVector<double, dimension>,
Dune::FieldVector<double, dimension>>;
......@@ -12,11 +13,10 @@ template <int dimension> struct Body {
double virtual getYoungModulus() const = 0;
double virtual getShearViscosity() const = 0;
double virtual getBulkViscosity() const = 0;
ScalarFunction virtual const &getShearViscosityField() const = 0;
ScalarFunction virtual const &getBulkViscosityField() const = 0;
double virtual getDensity() const = 0;
double virtual getGravity() const = 0;
ScalarFunction virtual const &getDensityField() const = 0;
VectorField virtual const &getGravityField() const = 0;
};
#endif
#ifndef ELLIPTIC_ENERGY_HH
#define ELLIPTIC_ENERGY_HH
#include <dune/common/fmatrix.hh>
#include <dune/common/fvector.hh>
#include <dune/common/stdstreams.hh>
#include <dune/fufem/arithmetic.hh>
#include "localfriction.hh"
template <size_t dim> class EllipticEnergy {
public:
using LocalVector = Dune::FieldVector<double, dim>;
using LocalMatrix = Dune::FieldMatrix<double, dim, dim>;
using Nonlinearity = LocalFriction<dim>;
EllipticEnergy(LocalMatrix const &A, LocalVector const &b,
std::shared_ptr<Nonlinearity const> phi,
typename Dune::BitSetVector<dim>::const_reference ignore)
: A(A), b(b), phi(phi), ignore(ignore) {}
double operator()(LocalVector const &v) const {
return computeEnergy(A, v, b) + (*phi)(v);
}
LocalMatrix const &A;
LocalVector const &b;
std::shared_ptr<Nonlinearity const> const phi;
typename Dune::BitSetVector<dim>::const_reference const ignore;
void gradient(LocalVector const &x, LocalVector &y) const {
A.mv(x, y);
y -= b;
phi->addGradient(x, y);
for (size_t i = 0; i < dim; ++i)
if (ignore[i])
y[i] = 0;
}
};
#endif
#ifndef FRICTIONDATA_HH
#define FRICTIONDATA_HH
#ifndef DUNE_TECTONIC_FRICTIONDATA_HH
#define DUNE_TECTONIC_FRICTIONDATA_HH
#include <dune/common/parametertree.hh>
struct FrictionData {
FrictionData(Dune::ParameterTree const &parset, double normalStress)
: L(parset.get<double>("L")),
V0(parset.get<double>("V0")),
a(parset.get<double>("a")),
b(parset.get<double>("b")),
mu0(parset.get<double>("mu0")),
normalStress(normalStress) {}
explicit FrictionData(double _C, double _L, double _V0, double _a, double _b,
double _mu0)
: C(_C), L(_L), V0(_V0), a(_a), b(_b), mu0(_mu0) {}
double const C;
double const L;
double const V0;
double const a;
double const b;
double const mu0;
double const normalStress;
};
#endif
#ifndef NICE_FUNCTION_HH
#define NICE_FUNCTION_HH
#ifndef DUNE_TECTONIC_FRICTIONPOTENTIAL_HH
#define DUNE_TECTONIC_FRICTIONPOTENTIAL_HH
#include <algorithm>
#include <cassert>
......@@ -9,76 +9,113 @@
#include <dune/common/exceptions.hh>
#include <dune/common/function.hh>
#include "frictiondata.hh"
#include <dune/tectonic/frictiondata.hh>
class FrictionPotentialWrapper {
class FrictionPotential {
public:
virtual ~FrictionPotentialWrapper() {}
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 updateLogState(double) = 0;
void virtual updateAlpha(double) = 0;
};
class FrictionPotential : public FrictionPotentialWrapper {
class TruncatedRateState : public FrictionPotential {
public:
FrictionPotential(double coefficient, FrictionData const &_fd)
: fd(_fd), weightTimesNormalStress(coefficient * (-fd.normalStress)) {}
TruncatedRateState(double _weight, double _weightedNormalStress,
FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double differential(double V) const {
assert(V >= 0.0);
if (V <= V_cutoff)
double coefficientOfFriction(double V) const override {
if (V <= Vmin)
return 0.0;
return weightTimesNormalStress * fd.a * (std::log(V) - logV_m);
return fd.a * std::log(V / Vmin);
}
double second_deriv(double V) const {
assert(V >= 0);
if (V <= V_cutoff)
double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
}
double second_deriv(double V) const override {
if (V <= Vmin)
return 0;
return weightTimesNormalStress * fd.a / V;
return -weightedNormalStress * (fd.a / V);
}
double regularity(double V) const {
assert(V >= 0);
if (std::abs(V - V_cutoff) < 1e-14) // TODO
double regularity(double V) const override {
if (std::abs(V - Vmin) < 1e-14) // TODO
return std::numeric_limits<double>::infinity();
return std::abs(second_deriv(V));
}
void updateLogState(double logState) {
double const tmp =
(fd.mu0 + fd.b * (logState + std::log(fd.V0 / fd.L))) / fd.a;
logV_m = std::log(fd.V0) - tmp;
V_cutoff = fd.V0 / std::exp(tmp);
void updateAlpha(double alpha) override {
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest);
}
private:
FrictionData const &fd;
double const weightTimesNormalStress;
double logV_m;
double V_cutoff; // velocity at which mu falls short of mumin
FrictionData const fd;
double const weight;
double const weightedNormalStress;
double Vmin;
};
class TrivialFunction : public FrictionPotentialWrapper {
class RegularisedRateState : public FrictionPotential {
public:
double evaluate(double) const { return 0; }
RegularisedRateState(double _weight, double _weightedNormalStress,
FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const override {
return fd.a * std::asinh(0.5 * V / Vmin);
}
double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
}
double second_deriv(double V) const override {
return -weightedNormalStress * fd.a / std::hypot(2.0 * Vmin, V);
}
double regularity(double V) const override {
return std::abs(second_deriv(V));
}
void updateAlpha(double alpha) override {
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;
double Vmin;
};
class ZeroFunction : public FrictionPotential {
public:
double evaluate(double) const override { return 0; }
double coefficientOfFriction(double s) const override { return 0; }
double differential(double) const { return 0; }
double differential(double) const override { return 0; }
double second_deriv(double) const { return 0; }
double second_deriv(double) const override { return 0; }
double regularity(double) const { return 0; }
double regularity(double) const override { return 0; }
void updateLogState(double) {}
void updateAlpha(double) override {}
};
#endif