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 (389)
Showing
with 232 additions and 190 deletions
*.o
*.pyc
.deps
.libs
/aclocal.m4
/am
/autom4te.cache
/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 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 VectorField =
Dune::VirtualFunction<Dune::FieldVector<double, dimension>,
Dune::FieldVector<double, dimension>>;
double virtual getPoissonRatio() const = 0;
double virtual getYoungModulus() const = 0;
ScalarFunction virtual const &getShearViscosityField() const = 0;
ScalarFunction virtual const &getBulkViscosityField() 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/interval.hh>
#include <dune/fufem/arithmetic.hh>
#include "localfriction.hh"
namespace Dune {
template <int dim> class EllipticEnergy {
public:
using SmallVector = FieldVector<double, dim>;
using SmallMatrix = FieldMatrix<double, dim, dim>;
using NonlinearityType = LocalFriction<dim>;
EllipticEnergy(SmallMatrix const &A, SmallVector const &b,
shared_ptr<NonlinearityType const> phi, int ignore = dim)
: A(A), b(b), phi(phi), ignore(ignore) {}
double operator()(SmallVector const &v) const {
SmallVector y(0);
Arithmetic::addProduct(y, 0.5, A, v);
y -= b;
return y * v + (*phi)(v);
}
SmallMatrix const &A;
SmallVector const &b;
shared_ptr<NonlinearityType const> const phi;
int const ignore; // Dimension that should be ignored; goes from 0
// to dim-1; the special value dim means that no
// dimension should be ignored
void gradient(SmallVector const &x, SmallVector &y) const {
A.mv(x, y);
y -= b;
phi->addGradient(x, y);
if (ignore != dim)
y[ignore] = 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,104 +9,113 @@
#include <dune/common/exceptions.hh>
#include <dune/common/function.hh>
#include "frictiondata.hh"
#include <dune/tectonic/frictiondata.hh>
namespace Dune {
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(NotImplemented, "evaluation not implemented");
DUNE_THROW(Dune::NotImplemented, "evaluation not implemented");
}
// Between 0 and this point, the function is constantly zero (and
// thus so are all derivatives)
double virtual smallestPositivePoint() const = 0;
void virtual updateState(double) = 0;
void virtual updateAlpha(double) = 0;
};
// phi(V) = V log(V/V_m) - V + V_m if V >= V_m
// = 0 otherwise
class FrictionPotential : public FrictionPotentialWrapper {
class TruncatedRateState : public FrictionPotential {
public:
FrictionPotential(double coefficient, FrictionData const &fd)
: fd(fd), coefficientProduct(coefficient * fd.a * fd.normalStress) {}
TruncatedRateState(double _weight, double _weightedNormalStress,
FrictionData _fd)
: fd(_fd), weight(_weight), weightedNormalStress(_weightedNormalStress) {}
double evaluate(double V) const {
assert(V >= 0);
if (V <= V_m)
return 0;
double coefficientOfFriction(double V) const override {
if (V <= Vmin)
return 0.0;
// V log(V/V_m) - V + V_m
return coefficientProduct * (V * std::log(V / V_m) - V + V_m);
return fd.a * std::log(V / Vmin);
}
// log(V/V_m) if V >= V_0
// 0 otherwise
double differential(double V) const {
assert(V >= 0);
if (V <= V_m)
return 0;
return coefficientProduct * std::log(V / V_m);
double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
}
// 1/V if V > V_0
// undefined if V == V_0
// 0 if V < V_0
double second_deriv(double V) const {
assert(V >= 0);
if (V <= V_m)
double second_deriv(double V) const override {
if (V <= Vmin)
return 0;
return coefficientProduct / V;
return -weightedNormalStress * (fd.a / V);
}
double regularity(double V) const {
assert(V >= 0);
// TODO: Make this controllable
if (std::abs(V - V_m) < 1e-14)
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));
}
double smallestPositivePoint() const { return V_m; }
// V_m = V_0 exp(-K/a),
// with K = -a log(V_m / V_0) = mu_0 + b [ alpha + log(V_0 / L) ]
void updateState(double state) {
// state is assumed to be logarithmic
V_m = fd.V0 *
std::exp(-(fd.mu0 + fd.b * (state + std::log(fd.V0 / fd.L))) / fd.a);
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 coefficientProduct;
double V_m;
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) const { return 0; }
double differential(double V) const override {
return weight * fd.C - weightedNormalStress * coefficientOfFriction(V);
}
double second_deriv(double) const { return 0; }
double second_deriv(double V) const override {
return -weightedNormalStress * fd.a / std::hypot(2.0 * Vmin, V);
}
double regularity(double) const { return 0; }
double regularity(double V) const override {
return std::abs(second_deriv(V));
}
double smallestPositivePoint() const {
return std::numeric_limits<double>::infinity();
void updateAlpha(double alpha) override {
double const logrest = (fd.mu0 + fd.b * alpha) / fd.a;
Vmin = fd.V0 / std::exp(logrest);
}
void updateState(double) {}
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 override { return 0; }
double second_deriv(double) const override { return 0; }
double regularity(double) const override { return 0; }
void updateAlpha(double) override {}
};
}
#endif