Commit 62f0290f authored by Santiago Ospina De Los Ríos's avatar Santiago Ospina De Los Ríos

Merge branch 'master' into feature/nonconforming-output

parents b0b0b6d1 23baa49b
......@@ -2,6 +2,12 @@ image: dorie/dune-env:2.5.1
variables:
DUNE_CONTROL_PATH: /opt/dune:$CI_PROJECT_DIR
DUNECONTROL: ./dune-common/bin/dunecontrol
CMAKE_FLAGS:
-DDUNE_PYTHON_VIRTUALENV_SETUP=True
-DDUNE_PYTHON_ALLOW_GET_PIP=True
MAKE_FLAGS:
-j 2
before_script:
- cd /opt/dune
......@@ -9,88 +15,128 @@ before_script:
stages:
- build
- test
- deploy
build:main:
stage: build
tags:
- demeter
script:
- CMAKE_FLAGS="-DDUNE_PYTHON_VIRTUALENV_SETUP=True -DDUNE_PYTHON_ALLOW_GET_PIP=True" MAKE_FLAGS="-j 2" ./dune-common/bin/dunecontrol --only=dorie all
- CMAKE_FLAGS="$CMAKE_FLAGS"
MAKE_FLAGS="$MAKE_FLAGS"
$DUNECONTROL --only=dorie all
- MAKE_FLAGS="$MAKE_FLAGS"
$DUNECONTROL --only=dorie make build_tests
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake
expire_in: 3 days
expire_in: 1 day
build:update_dune:
stage: build
tags:
- demeter
only:
- master
script:
- ./dune-common/bin/dunecontrol update
- ./dune-common/bin/dunecontrol exec "rm -rf build-cmake"
- CMAKE_FLAGS="-DDUNE_PYTHON_VIRTUALENV_SETUP=True -DDUNE_PYTHON_ALLOW_GET_PIP=True" MAKE_FLAGS="-j 2" ./dune-common/bin/dunecontrol --module=dorie all
- $DUNECONTROL update
- $DUNECONTROL exec "rm -rf build-cmake"
- CMAKE_FLAGS="$CMAKE_FLAGS"
MAKE_FLAGS="$MAKE_FLAGS"
$DUNECONTROL --module=dorie all
- MAKE_FLAGS="$MAKE_FLAGS"
$DUNECONTROL --only=dorie make build_tests
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake
expire_in: 3 days
expire_in: 1 day
build:debug:
stage: build
tags:
- demeter
allow_failure: true
script:
- CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Debug -DDUNE_PYTHON_VIRTUALENV_SETUP=True -DDUNE_PYTHON_ALLOW_GET_PIP=True" MAKE_FLAGS="-j 2" ./dune-common/bin/dunecontrol --only=dorie all
- CMAKE_FLAGS="
$CMAKE_FLAGS
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_CXX_FLAGS_DEBUG='-Werror'"
MAKE_FLAGS="$MAKE_FLAGS"
$DUNECONTROL --only=dorie all
- MAKE_FLAGS="$MAKE_FLAGS"
$DUNECONTROL --only=dorie make build_tests
test:main:
test:exec_cmds:
stage: test
dependencies:
- build:main
script:
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_dorie_exec
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
test:ode:
stage: test
tags:
- demeter
dependencies:
- build:main
allow_failure: true
script:
- ./dune-common/bin/dunecontrol --only=dorie configure
- ARGS="--output-on-failure -j 2" ./dune-common/bin/dunecontrol --only=dorie make test
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_run_ode
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 week
expire_in: 1 day
test:update_dune:
test:ode-update_dune:
stage: test
tags:
- demeter
dependencies:
- build:update_dune
only:
- master
allow_failure: true
script:
- ./dune-common/bin/dunecontrol --only=dorie configure
- ARGS="--output-on-failure -j 2" ./dune-common/bin/dunecontrol --only=dorie make test
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_run_ode
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
test:parallel:
stage: test
dependencies:
- build:main
script:
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_run_parallel
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
test:reference:
stage: test
dependencies:
- build:main
script:
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_run_ref
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 week
expire_in: 1 day
deploy:build_docs:
stage: deploy
tags:
- demeter
test:mass_conserve:
stage: test
dependencies:
- build:main
script:
- ./dune-common/bin/dunecontrol --only=dorie configure
- ./dune-common/bin/dunecontrol --only=dorie make doc
- $DUNECONTROL --only=dorie configure
- $DUNECONTROL --only=dorie make test_mass_conservation
artifacts:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/doc
expire_in: 1 week
\ No newline at end of file
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
\ No newline at end of file
# DORiE Changelog
## 1.0.0 (2018-03-28)
First stable version
\ No newline at end of file
......@@ -10,7 +10,15 @@ string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
set(CMAKE_VERBOSE_MAKEFILE ON)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Werror")
# add extra flags to debug compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
# option to change DG scheme via config file
option(EXPERIMENTAL_DG_FEATURES
"Enable experimental DG settings through the config file"
OFF
)
#
if(NOT (dune-common_DIR OR dune-common_ROOT OR
......@@ -32,12 +40,10 @@ dune_project()
dune_enable_all_packages()
dune_require_cxx_standard(MODULE "dorie" VERSION 14)
# avoid the executables from being 'excluded from all'
set(DUNE_BUILD_TESTS_ON_MAKE_ALL TRUE)
# add subdirectories
add_subdirectory("bin")
add_subdirectory("m4")
add_subdirectory("cmake/modules")
add_subdirectory("dune")
add_subdirectory("lib")
add_subdirectory("python")
......@@ -45,7 +51,6 @@ add_subdirectory("doc")
if(dune-testtools_FOUND)
add_subdirectory("testing")
endif()
add_subdirectory("cmake/modules")
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
......
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at
[dorieteam@iup.uni-heidelberg.de](mailto:dorieteam@iup.uni-heidelberg.de). All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
# Contribution Guide
We encourage everyone to contribute to the development and improvement of DORIE.
Please notice our included [Code of Conduct](CODE_OF_CONDUCT.md).
### Restricted Access to Repository
Free access to the [GitLab instance](https://ts-gitlab.iup.uni-heidelberg.de) of
the [TS-CCEES group](http://ts.iup.uni-heidelberg.de/) at the
[Institute of Environmental Physics](http://www.iup.uni-heidelberg.de/) is
restricted to members of said group.
Non-members are left with read-only access to public repositories.
### How to Contribute
If you would like to _actively contribute_ to DORiE, and you are affiliated
with [Heidelberg University](http://www.uni-heidelberg.de/) or an associated
research institute, you can become a member of the DORiE development team.
Otherwise, we encourage you to contribute bug reports, feature requests, or
improvement suggestions by contacting the development team
[via mail](mailto:dorieteam@iup.uni-heidelberg.de).
Notice, however, that resources for development and support are streched thin:
_Your mileage may vary._
\ No newline at end of file
FROM dorie/dune-env:2.5.1
MAINTAINER Dion Häfner
FROM dorie/dune-env:2.5.1 as builder
WORKDIR /opt/dune
ADD . /opt/dune/dorie/
RUN CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release -DDUNE_PYTHON_VIRTUALENV_SETUP=True -DDUNE_PYTHON_ALLOW_GET_PIP=True" ./dune-common/bin/dunecontrol --only=dorie all
RUN CMAKE_FLAGS="-DCMAKE_BUILD_TYPE=Release -DDUNE_PYTHON_VIRTUALENV_SETUP=True -DDUNE_PYTHON_ALLOW_GET_PIP=True" \
./dune-common/bin/dunecontrol --only=dorie all \
&& ./dune-common/bin/dunecontrol --only=dorie exec \
"rm build-cmake/dune/dorie/impl/libdorie-impl.a build-cmake/dune/dorie/impl/CMakeFiles/dorie-impl.dir/*.cc.o"
ENV PATH="/opt/dune/dorie/build-cmake/bin:${PATH}"
WORKDIR /sim
ENTRYPOINT ["/opt/dune/dorie/build-cmake/bin/dorie"]
\ No newline at end of file
MIT License
Copyright (c) 2018 Lukas Riedel, Dion Häfner, Ole Klein, Felix Riexinger
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
\ No newline at end of file
# Welcome to DORiE!
(__D__UNE-__O__perated __Ri__chards equation solving __E__nvironment)
[![build status](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/badges/master/build.svg)](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/commits/master)
| Current Release | Current `master` |
| :-------------: | :--------------: |
| N/A | [![pipeline status](https://ts-gitlab.iup.uni-heidelberg.de/dorie/dorie/badges/master/pipeline.svg)](https://ts-gitlab.iup.uni-heidelberg.de/dorie/dorie/commits/master) |
DORiE is a software suite for solving Richard's Equation. The core feature is a C++ PDE-solver powered by [DUNE](https://dune-project.org/) and the [DUNE-PDELab](https://dune-project.org/modules/dune-pdelab/) module. It implements a Discontinous Galerkin (DG) discretization scheme on structured rectangular / cubic and unstructured simplex grids in two and three spatial dimensions, and makes use of advanced features like adaptive grid refinement.
......@@ -143,6 +145,15 @@ If you installed [Anaconda](https://conda.io/docs/user-guide/install/download.ht
**Installing DUNE and DORiE via `make install` into your usual work environment is strongly discouraged!**
### Experimental Features
The local operator implementing Richards equation's discretization supports
multiple scheme settings. Setting these via the config file is disabled by
default. You can enable this feature by reconfiguring DORiE with the CMake flag
`-DEXPERIMENTAL_DG_FEATURES=On`, and rebuilding it.
The configuration settings in the section `[dg.experimental]` will then override
the default settings.
## Recommended Third-Party Software
......@@ -211,7 +222,7 @@ or
## Troubleshooting
CMake heavily caches the results of its configuration process. In case you encounter errors or strange behavior, especially after an update, you should delete the DORiE build folder (called `build-cmake` by default) and re-install DORiE using `dunecontrol`.
If the problem persists, take a look at the [List of Known Bugs](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/issues), or create an issue yourself. For problems related to the installation, refer to the sections below.
If the problem persists, take a look at the [List of Known Bugs](https://ts-gitlab.iup.uni-heidelberg.de/dorie/dorie/issues), or create an issue yourself. For problems related to the installation, refer to the sections below.
### Debugging
DORiE can be built with debugging flags via CMake. To do so, run
......@@ -233,12 +244,19 @@ A debugger needs special security privileges usually not provided by the Docker
The debugger `gdb` is pre-installed in the Docker container.
### DORiE is running, but I suspect that something is wrong
You can execute system tests in order to ensure that DORiE is running correctly and producing the expected results:
### Running System Tests
DORiE includes system tests for comparing its results the ones of ODE solvers or
former versions of itself. They ensure that DORiE is running correctly and
producing the expected results. If you installed DORiE, you have to make sure
that all test executables are built by calling
dunecontrol --only=dorie make build_tests
You then execute the system tests with
ARGS="--output-on-failure" dunecontrol --only=dorie make test
You will be informed whether each test has been passed or failed, and you may find additional output in the DORiE build directory.
### Further Help
[Open an issue](https://zwackelmann.iup.uni-heidelberg.de:10443/dorie/dorie/issues/new), or write to the [DORiE developer mailing list](mailto:dorieteam@iup.uni-heidelberg.de).
[Open an issue](https://ts-gitlab.iup.uni-heidelberg.de/dorie/dorie/issues/new), or write to the [DORiE developer mailing list](mailto:dorieteam@iup.uni-heidelberg.de).
1.1.0-pre
\ No newline at end of file
......@@ -277,6 +277,31 @@ adding an empty line, make text **bold** or ``monospaced``.
</category>
<category name="NewtonParameters">
<parameter name="ForceIteration" hidden="true">
<definition> Force the Newton solver to calculate at least one iteration,
even if the initial defect is below ``AbsoluteLimit``. This ensures
that dynamics cannot be 'skipped' at very small time steps.
</definition>
<values> true, false </values>
<suggestion> false </suggestion>
</parameter>
<parameter name="AbsoluteLimit" hidden="true">
<definition> Absolute error tolerance of the Newton solver.
Reduce this value to increase precision.
</definition>
<values> 1E-11 &lt; float &lt; 1E-8 </values>
<suggestion> 1E-10 </suggestion>
</parameter>
<parameter name="Reduction" hidden="true">
<definition> Relative error tolerance of the Newton solver.
Reduce this value to increase precision.
</definition>
<values> float </values>
<suggestion> 1E-4 </suggestion>
</parameter>
<parameter name="ReassembleThreshold" hidden="true">
<definition> If the ratio between last and current calculation defect exceeds this value,
the linear operator matrix is reassembled to ensure convergence. </definition>
......@@ -291,18 +316,6 @@ adding an empty line, make text **bold** or ``monospaced``.
<suggestion> 10 </suggestion>
</parameter>
<parameter name="AbsoluteLimit" hidden="true">
<definition> Absolute error tolerance of the Newton solver. </definition>
<values> float </values>
<suggestion> 1E-10 </suggestion>
</parameter>
<parameter name="Reduction" hidden="true">
<definition> Relative error tolerance of the Newton solver. </definition>
<values> float </values>
<suggestion> 1E-10 </suggestion>
</parameter>
<parameter name="MinLinearReduction" hidden="true">
<definition> Required defect reduction of the linear solver. The Newton solver calculates
the required linear reduction for second order Newton convergence automatically and
......@@ -399,4 +412,41 @@ adding an empty line, make text **bold** or ``monospaced``.
</parameter>
</category>
<category name="dg.experimental">
<parameter name="method">
<definition> DG discretization method for skeleton terms.
**SIPG:** Symmetric Interior Penalty
**NIPG:** Non-Symmetric Interior Penalty
**OOB:** Oden, Babuska, Baumann: no penalty term
**IIP:** Incomplete Interior Penalty: no symmetry term
</definition>
<values> SIPG, NIPG, OOB, IIP </values>
<suggestion> SIPG </suggestion>
<comment> Experimental settings are enabled by the appropriate CMake flag.
</comment>
</parameter>
<parameter name="upwinding">
<definition> Upwinding method for skeleton terms.
**semiUpwind:** Apply upwinding to conductivity factor (only).
**fullUpwind:** Apply upwinding on numeric flux and conductivity.
</definition>
<values> none, semiUpwind, fullUpwind </values>
<suggestion> none </suggestion>
</parameter>
<parameter name="weights">
<definition> Apply harmonic weighting to skeleton term contributions.
</definition>
<values> true, false </values>
<suggestion> true </suggestion>
</parameter>
</category>
</dorie>
add_subdirectory(interface)
add_subdirectory(solver)
add_subdirectory(impl)
add_subdirectory(test)
add_executable("dorie" dorie.cc)
dune_target_link_libraries(dorie dorie-impl ${DUNE_LIBS})
\ No newline at end of file
dune_target_link_libraries(dorie dorie-impl ${DUNE_LIBS})
# enable setting operator scheme from config file
if(EXPERIMENTAL_DG_FEATURES)
target_compile_definitions("dorie" PUBLIC -DEXPERIMENTAL_DG_FEATURES)
endif()
\ No newline at end of file
......@@ -5,12 +5,13 @@ namespace Dune{
namespace Dorie{
/// Adaptivity base class. Does nothing.
template<typename Traits, typename GFS, typename Param, typename U>
template<typename Traits, typename GFS, typename Param, typename Boundary, typename U>
class AdaptivityHandlerBase
{
private:
using Grid = typename Traits::Grid;
using GV = typename Traits::GV;
using RF = typename Traits::RF;
public:
AdaptivityHandlerBase () = default;
......@@ -19,12 +20,16 @@ public:
/// Do nothing.
/** \return Boolean if operators have to be updated
*/
virtual bool adapt_grid (Grid& grid, GV& gv, GFS& gfs, Param& param, U& uold, U& unew) { return false; }
virtual bool adapt_grid (Grid& grid, GV& gv, GFS& gfs, const Param& param, const Boundary& boundary, const RF time, U& uold, U& unew) { return false; }
};
/// Specialized SimulationBase class providing functions and members for adaptive grid refinement
template<typename Traits, typename GFS, typename Param, typename U>
class AdaptivityHandler : public AdaptivityHandlerBase<Traits,GFS,Param,U>
template<typename Traits,
typename GFS,
typename Param,
typename Boundary,
typename U>
class AdaptivityHandler : public AdaptivityHandlerBase<Traits,GFS,Param,Boundary,U>
{
private:
static constexpr int order = Traits::fem_order;
......@@ -37,7 +42,7 @@ private:
/// Adaptivity GFS
using AGFS = typename AGFSHelper::Type;
/// Error estimator local operator
using ESTLOP = Dune::Dorie::FluxErrorEstimator<Traits,Param,typename AGFSHelper::FEM>;
using ESTLOP = Dune::Dorie::Operator::FluxErrorEstimator<Traits,Param,Boundary>;
/// Empty constraints container
using NoTrafo = Dune::PDELab::EmptyTransformation;
/// Solution vector type
......@@ -66,7 +71,7 @@ public:
* \param grid Grid to adapt (reference is not saved)
*/
AdaptivityHandler (Dune::ParameterTree& _inifile, Grid& grid)
: AdaptivityHandlerBase<Traits,GFS,Param,U>(),
: AdaptivityHandlerBase<Traits,GFS,Param,Boundary,U>(),
inifile(_inifile),
maxLevel(inifile.get<int>("adaptivity.maxLevel")),
minLevel(inifile.get<int>("adaptivity.minLevel")),
......@@ -95,7 +100,15 @@ public:
* \param unew Solution vector
* \return Boolean if grid operators have to be set up again (true if grid changed)
*/
bool adapt_grid (Grid& grid, GV& gv, GFS& gfs, Param& param, U& uold, U& unew) override
bool adapt_grid (
Grid& grid,
GV& gv,
GFS& gfs,
const Param& param,
const Boundary& boundary,
const RF time,
U& uold,
U& unew) override
{
Dune::Timer timer2;
float t2;
......@@ -108,7 +121,7 @@ public:
do { // Loop for multiple refinements
Dune::Timer timer3;
float t_setup,t_est,t_sqrt,t_strtgy,t_mark,t_adapt;
float t_setup, t_sqrt, t_est, t_strtgy, t_mark, t_adapt;
if(verbose>1)
std::cout << " Refinement Step " << multiRefinementCounter << ": ";
......@@ -116,9 +129,10 @@ public:
double eta_alpha(0.0);
double eta_beta(0.0);
// Compute error estimate eta
// set up helper GFS
AGFS p0gfs = AGFSHelper::create(gv);
ESTLOP estlop(inifile,param);
ESTLOP estlop(inifile, param, boundary);
estlop.setTime(time);
MBE mbe(0);
ESTGO estgo(gfs,p0gfs,estlop,mbe);
U0 eta(p0gfs,0.0);
......@@ -126,17 +140,21 @@ public:
t_setup = timer3.elapsed();
timer3.reset();
// Compute error estimate eta
estgo.residual(uold,eta);
t_est = timer3.elapsed();
timer3.reset();
// unsquare errors
using Dune::PDELab::Backend::native;
maxeta = native(eta)[0];
for (unsigned int i=0; i<eta.flatsize(); i++) {
native(eta)[i] = sqrt(native(eta)[i]); // eta contains squares
if (native(eta)[i] > maxeta) maxeta = native(eta)[i];
}
auto& eta_nat = native(eta);
std::transform(eta_nat.begin(), eta_nat.end(), eta_nat.begin(),
[](const auto val) { return std::sqrt(val); }
);
// compute largest error
maxeta = eta.infinity_norm();
if (verbose>1)
std::cout << "Largest Local Error: " << maxeta << " " << std::endl;
......@@ -186,7 +204,7 @@ public:
std::cout << std::setprecision(4) << std::scientific;
std::cout << "::: setup time" << std::setw(12) << t_setup << std::endl;
std::cout << "::: error estimation time" << std::setw(12) << t_est << std::endl;
std::cout << "::: unsquaring errors time" << std::setw(12) << t_sqrt << std::endl;
std::cout << "::: unsquaring time" << std::setw(12) << t_sqrt << std::endl;
std::cout << "::: strategy application time" << std::setw(12) << t_strtgy << std::endl;
std::cout << "::: grid marking time" << std::setw(12) << t_mark << std::endl;
std::cout << "::: grid adaptation time" << std::setw(12) << t_adapt << std::endl;
......@@ -211,14 +229,14 @@ public:
* The constexpr boolean adapt_grid in Dune::Dorie::BaseTraits will
* define which create() function is enabled at compile time.
*/
template<typename Traits, typename GFS, typename Param, typename U>
template<typename Traits, typename GFS, typename Param, typename Boundary, typename U>
struct AdaptivityHandlerFactory
{
private:
static constexpr bool enabled = Traits::adapt_grid;
using Grid = typename Traits::Grid;
using AHB = AdaptivityHandlerBase<Traits,GFS,Param,U>;
using AHB = AdaptivityHandlerBase<Traits,GFS,Param,Boundary,U>;
Dune::ParameterTree& inifile;
Grid& grid;
......@@ -252,7 +270,7 @@ public:
std::is_same<Grid,Dune::UGGrid<3>>::value,
"Adaptivity is only implemented for UGGrid!");
std::unique_ptr<AHB> p;
p = std::make_unique<AdaptivityHandler<Traits,GFS,Param,U>>(inifile,grid);
p = std::make_unique<AdaptivityHandler<Traits,GFS,Param,Boundary,U>>(inifile,grid);
return p;
}
};
......
......@@ -31,7 +31,20 @@ Simulation<Traits>::Simulation (Dune::MPIHelper& _helper, std::shared_ptr<Grid>
finitial = std::make_unique<FlowInitial>(inifile,*param,gv);
// --- Local Operators ---
#ifdef EXPERIMENTAL_DG_FEATURES
// read experimental settings from inifile
namespace OP = Dune::Dorie::Operator;
const auto settings = OP::read_experimental_operator_settings(inifile);
const auto method = std::get<OP::RichardsDGMethod::Type>(settings);
const auto upwinding = std::get<OP::RichardsDGUpwinding::Type>(settings);
const auto weights = std::get<OP::RichardsDGWeights::Type>(settings);
slop = std::make_unique<SLOP>(inifile, *param, gv, *fboundary, *fsource,
method, upwinding, weights);
#else
slop = std::make_unique<SLOP>(inifile,*param,gv,*fboundary,*fsource);
#endif // EXPERIMENTAL_DG_FEATURES
tlop = std::make_unique<TLOP>(inifile,*param,gv);
controller = std::make_unique<CalculationController>(inifile,*fboundary,helper);
......@@ -128,6 +141,7 @@ bool Simulation<Traits>::compute_time_step ()
const RF t = controller->getTime();
const RF dt = controller->getDT();
bool exception = false;
try
{
// solve in parallel
......@@ -140,7 +154,7 @@ bool Simulation<Traits>::compute_time_step ()
// solve sequentially
else {
pdesolver_seq->setMaxIterations(controller->getIterations());
osm_seq->apply(t,dt,*uold,*unew);
osm_seq->apply(t, dt, *uold, *unew);
}
*uold = *unew;
......@@ -165,12 +179,15 @@ bool Simulation<Traits>::compute_time_step ()
template<typename Traits>
void Simulation<Traits>::run ()
{
output->write_vtk_output(controller->getTime());
const auto t_start = controller->getTime();
output->write_vtk_output(t_start);
while(controller->doStep()) {
const auto time = controller->getTime();
const auto dt = controller->getDT();