Commit ca04523c authored by Timo Koch's avatar Timo Koch

[course] Make this a dune module. Add install script.

parent 2b684c96
# We require version CMake version 3.1 to prevent issues
# with dune_enable_all_packages and older CMake versions.
cmake_minimum_required(VERSION 3.1)
project(dumux-course 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()
dune_enable_all_packages()
add_subdirectory(exercises)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
Licensing Information
=====================
Copyright holders
-----------------
| Year | Name |
|------------|----------------------------|
| 2018 | LH2, IWS, University of Stuttgart |
For educational use only. Please [contact us](http://www.hydrosys.uni-stuttgart.de/index.en.php) for license information.
GXX_RELEASE_WARNING_OPTS=" \
-Wall \
-Wno-deprecated \
-Wno-deprecated-declarations \
-Wno-sign-compare"
GXX_RELEASE_OPTS=" \
-fno-strict-aliasing \
-fstrict-overflow \
-fno-finite-math-only \
-O3 \
-march=native \
-funroll-loops \
-g0"
CMAKE_FLAGS="
-DCMAKE_C_COMPILER=/usr/bin/gcc
-DCMAKE_CXX_COMPILER=/usr/bin/g++
-DCMAKE_CXX_FLAGS_RELEASE='$GXX_RELEASE_OPTS $GXX_RELEASE_WARNING_OPTS'
-DCMAKE_CXX_FLAGS_DEBUG='-O0 -ggdb -Wall'
-DCMAKE_BUILD_TYPE=Release
"
/* begin dumux-course
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 dumux-course */
#define DUMUX_COURSE_VERSION "@DUMUX_COURSE_VERSION@"
/* Define to the major version of dumux-course */
#define DUMUX_COURSE_VERSION_MAJOR @DUMUX_COURSE_VERSION_MAJOR@
/* Define to the minor version of dumux-course */
#define DUMUX_COURSE_VERSION_MINOR @DUMUX_COURSE_VERSION_MINOR@
/* Define to the revision of dumux-course */
#define DUMUX_COURSE_VERSION_REVISION @DUMUX_COURSE_VERSION_REVISION@
/* end dumux-course
Everything below here will be overwritten
*/
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
CXX=@CXX@
CC=@CC@
DEPENDENCIES=@REQUIRES@
Name: @PACKAGE_NAME@
Version: @VERSION@
Description: dumux-course module
URL: http://dune-project.org/
Requires: dumux
Libs: -L${libdir}
Cflags: -I${includedir}
################################
# Dune module information file #
################################
#Name of the module
Module: dumux-course
Version: 2018
Maintainer: timo.koch@iws.uni-stuttgart.de
#depending on
Depends: dumux
......@@ -3,4 +3,34 @@
The install script is a shell script that will setup DuMu<sup>x</sup> on your computer
in the version that is required to complete the current course's exercises.
Installation guide dumux
-------------------------
You can set up dumux using the attached script install.sh.
You need to have the following REQUIREMENTS installed:
* gcc >= 4.9
* cmake >= 3.1
* git
* pkg-config
* paraview (to visualize the results)
On debian-based system you can use this:
apt-get install build-essential pkg-config cmake git paraview
Then, you can the execute the script and it will download the dune repositories and dumux
and configure all modules with CMake
./install.sh
This will clone the necessary repositories (in a subfolder 'dune'),
build all libaries.
The dune core modules are also available as debian packages
(see http://www.dune-project.org/download.html#binary) where
the version 2.4 is required.
Run the script test_dumux.sh in the same folder you ran this script
to test your installation of dumux.
./test_dumux.sh
It will compile and run a simple one-phase ground water flow example
and visualizes the result using paraview.
* Click [here](./install.sh) to view and download the install script
GXX_RELEASE_WARNING_OPTS=" \
-Wall \
-Wno-deprecated \
-Wno-deprecated-declarations \
-Wno-sign-compare"
GXX_RELEASE_OPTS=" \
-fno-strict-aliasing \
-fstrict-overflow \
-fno-finite-math-only \
-O3 \
-march=native \
-funroll-loops \
-g0"
CMAKE_FLAGS="
-DCMAKE_C_COMPILER=/usr/bin/gcc
-DCMAKE_CXX_COMPILER=/usr/bin/g++
-DCMAKE_CXX_FLAGS_RELEASE='$GXX_RELEASE_OPTS $GXX_RELEASE_WARNING_OPTS'
-DCMAKE_CXX_FLAGS_DEBUG='-O0 -ggdb -Wall'
-DCMAKE_BUILD_TYPE=Release
"
#!/bin/bash
# One click install script dumux
DUNE_VERSION=2.6
echo "TODO Install script for the dumux course 2018"
# check some prerequistes
for PRGRM in git cmake gcc g++ wget paraview pkg-config; do
if ! [ -x "$(command -v $PRGRM)" ]; then
echo "Error: $PRGRM is not installed." >&2
exit 1
fi
done
currentver="$(gcc -dumpversion)"
requiredver="4.9.0"
if [ "$(printf '%s\n' "$requiredver" "$currentver" | sort -V | head -n1)" != "$requiredver" ]; then
echo "gcc greater than or equal to $requiredver is required!" >&2
exit 1
fi
# make a new folder containing everything
mkdir $(pwd)/dumux
cd dumux
echo "*********************************************************************************************"
echo "Sucessfully created a folder dumux."
echo "*********************************************************************************************"
echo "*********************************************************************************************"
echo "(0/2) Downloading supplementary files. Make sure to be connected to the internet."
echo "*********************************************************************************************"
# download the install.opts and the test script
wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/scripts/test_dumux.sh
chmod +x test_dumux.sh
wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/master/cmake.opts
# get the testing script
echo "*********************************************************************************************"
echo "(1/2) Cloning repositories. This may take a while. Make sure to be connected to the internet."
echo "*********************************************************************************************"
# the core modules
for MOD in common geometry grid localfunctions istl; do
if [ ! -d "dune-$MOD" ]; then
git clone -b releases/$DUNE_VERSION https://gitlab.dune-project.org/core/dune-$MOD.git
else
echo "Skip cloning dune-$MOD because the folder already exists."
cd dune-$MOD
git checkout releases/$DUNE_VERSION
cd ..
fi
done
# extension modules
for MOD in dune-foamgrid dune-alugrid; do
if [ ! -d "$MOD" ]; then
git clone -b releases/$DUNE_VERSION https://gitlab.dune-project.org/extensions/$MOD.git
else
echo "Skip cloning $MOD because the folder already exists."
cd $MOD
git checkout releases/$DUNE_VERSION
cd ..
fi
done
# dune-subgrid
if [ ! -d "dune-subgrid" ]; then
git clone -b releases/$DUNE_VERSION https://git.imp.fu-berlin.de/agnumpde/dune-subgrid.git
else
echo "Skip cloning dune-subgrid because the folder already exists."
cd dune-subgrid
git checkout releases/$DUNE_VERSION
cd ..
fi
# dumux
if [ ! -d "dumux" ]; then
git clone -b master https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git
else
echo "Skip cloning dumux because the folder already exists."
cd dumux
git checkout master
git reset --hard origin/master
cd ..
fi
# dumux-course
if [ ! -d "dumux-course" ]; then
git clone https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course.git
else
echo "Skip cloning dumux-course because the folder already exists."
fi
if [ $? -ne 0 ]; then
echo "*********************************************************************************************"
echo "Failed to clone the repositories."
echo "*********************************************************************************************"
exit $?
fi
echo "*********************************************************************************************"
echo "(2/2) Configure dune modules and dumux. Build the dune libaries. This may take several minutes."
echo "*********************************************************************************************"
# run build
./dune-common/bin/dunecontrol --opts=cmake.opts all
#
if [ $? -ne 0 ]; then
echo "*********************************************************************************************"
echo "Failed to build the dune libaries."
echo "*********************************************************************************************"
exit $?
fi
# echo result
echo "*********************************************************************************************"
echo "Succesfully configured and built dune and dumux."
echo "Please change to the dumux folder and run the test_dumux.sh script to confirm everything works."
echo "*********************************************************************************************"
# Compile and runs a simple
# one-phase ground water flow example
# and visualizes the result using paraview.
cd dumux/build-cmake/test/porousmediumflow/1p/implicit
make -B test_cc1p
./test_cc1p test_cc1p.input
paraview *pvd
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment