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 (100)
Showing
with 194 additions and 125 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/sand-wedge-?D
src/sliding-block-?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([dune-tectonic.pc.in])
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
......@@ -2,8 +2,9 @@
#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>>;
......
......@@ -29,35 +29,36 @@ class FrictionPotential {
class TruncatedRateState : public FrictionPotential {
public:
TruncatedRateState(double coefficient, double _normalStress, FrictionData _fd)
: fd(_fd), weight(coefficient), normalStress(_normalStress) {}
TruncatedRateState(double _weight, double _weightedNormalStress,
FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const {
double coefficientOfFriction(double V) const override {
if (V <= Vmin)
return 0.0;
return fd.a * std::log(V / Vmin);
}
double differential(double V) const {
return weight * (fd.C - normalStress * coefficientOfFriction(V));
double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
}
double second_deriv(double V) const {
double second_deriv(double V) const override {
if (V <= Vmin)
return 0;
return weight * (-normalStress) * (fd.a / V);
return -weightedNormalStress * (fd.a / V);
}
double regularity(double V) const {
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 updateAlpha(double alpha) {
void updateAlpha(double alpha) override {
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest);
}
......@@ -65,31 +66,33 @@ class TruncatedRateState : public FrictionPotential {
private:
FrictionData const fd;
double const weight;
double const normalStress;
double const weightedNormalStress;
double Vmin;
};
class RegularisedRateState : public FrictionPotential {
public:
RegularisedRateState(double coefficient, double _normalStress,
RegularisedRateState(double _weight, double _weightedNormalStress,
FrictionData _fd)
: fd(_fd), weight(coefficient), normalStress(_normalStress) {}
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double coefficientOfFriction(double V) const {
double coefficientOfFriction(double V) const override {
return fd.a * std::asinh(0.5 * V / Vmin);
}
double differential(double V) const {
return weight * (fd.C - normalStress * coefficientOfFriction(V));
double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
}
double second_deriv(double V) const {
return weight * (-normalStress) * fd.a / std::hypot(2.0 * Vmin, V);
double second_deriv(double V) const override {
return -weightedNormalStress * fd.a / std::hypot(2.0 * Vmin, V);
}
double regularity(double V) const { return std::abs(second_deriv(V)); }
double regularity(double V) const override {
return std::abs(second_deriv(V));
}
void updateAlpha(double alpha) {
void updateAlpha(double alpha) override {
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest);
}
......@@ -97,22 +100,22 @@ class RegularisedRateState : public FrictionPotential {
private:
FrictionData const fd;
double const weight;
double const normalStress;
double const weightedNormalStress;
double Vmin;
};
class TrivialFunction : public FrictionPotential {
class ZeroFunction : public FrictionPotential {
public:
double evaluate(double) const { return 0; }
double evaluate(double) const override { return 0; }
double coefficientOfFriction(double s) const { 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 updateAlpha(double) {}
void updateAlpha(double) override {}
};
#endif
#ifndef DUNE_TECTONIC_GEOCOORDINATE_HH
#define DUNE_TECTONIC_GEOCOORDINATE_HH
// tiny helper to make a common piece of code pleasanter to read
template <class Geometry>
typename Geometry::GlobalCoordinate geoToPoint(Geometry geo) {
assert(geo.corners() == 1);
return geo.corner(0);
}
#endif
......@@ -22,13 +22,12 @@ template <class Matrix, class Vector> class GlobalFriction {
using LocalMatrix = typename Matrix::block_type;
using LocalVectorType = typename Vector::block_type;
size_t static const block_size = LocalVectorType::dimension;
using Friction = LocalFriction<block_size>;
using LocalNonlinearity = LocalFriction<block_size>;
double operator()(Vector const &x) const {
double tmp = 0;
for (size_t i = 0; i < x.size(); ++i) {
auto const res = restriction(i);
tmp += (*res)(x[i]);
tmp += restriction(i)(x[i]);
}
return tmp;
}
......@@ -36,14 +35,11 @@ template <class Matrix, class Vector> class GlobalFriction {
/*
Return a restriction of the outer function to the i'th node.
*/
std::shared_ptr<LocalFriction<block_size>> virtual restriction(size_t i)
const = 0;
LocalNonlinearity const virtual &restriction(size_t i) const = 0;
void addHessian(Vector const &v, Matrix &hessian) const {
for (size_t i = 0; i < v.size(); ++i) {
auto const res = restriction(i);
res->addHessian(v[i], hessian[i][i]);
}
for (size_t i = 0; i < v.size(); ++i)
restriction(i).addHessian(v[i], hessian[i][i]);
}
void directionalDomain(Vector const &, Vector const &,
......@@ -52,14 +48,13 @@ template <class Matrix, class Vector> class GlobalFriction {
dom[1] = std::numeric_limits<double>::max();
}
void directionalSubDiff(Vector const &u, Vector const &v,
Dune::Solvers::Interval<double> &subdifferential)
const {
void directionalSubDiff(
Vector const &u, Vector const &v,
Dune::Solvers::Interval<double> &subdifferential) const {
subdifferential[0] = subdifferential[1] = 0;
for (size_t i = 0; i < u.size(); ++i) {
Dune::Solvers::Interval<double> D;
auto const res = restriction(i);
res->directionalSubDiff(u[i], v[i], D);
restriction(i).directionalSubDiff(u[i], v[i], D);
subdifferential[0] += D[0];
subdifferential[1] += D[1];
}
......@@ -71,21 +66,19 @@ template <class Matrix, class Vector> class GlobalFriction {
}
void addGradient(Vector const &v, Vector &gradient) const {
for (size_t i = 0; i < v.size(); ++i) {
auto const res = restriction(i);
res->addGradient(v[i], gradient[i]);
}
for (size_t i = 0; i < v.size(); ++i)
restriction(i).addGradient(v[i], gradient[i]);
}
double regularity(size_t i, typename Vector::block_type const &x) const {
auto const res = restriction(i);
return res->regularity(x);
return restriction(i).regularity(x);
}
void coefficientOfFriction(Vector const &x, ScalarVector &coefficient) {
coefficient.resize(x.size());
ScalarVector coefficientOfFriction(Vector const &x) const {
ScalarVector ret(x.size());
for (size_t i = 0; i < x.size(); ++i)
coefficient[i] = restriction(i)->coefficientOfFriction(x[i]);
ret[i] = restriction(i).coefficientOfFriction(x[i]);
return ret;
}
void virtual updateAlpha(ScalarVector const &alpha) = 0;
......