...
 
Commits (9)
#!/usr/bin/env bash
## CALLED IN THE CI ENVIRONMENT
## Install ssh-agent if not already installed, it is required by Docker.
which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )
## Run ssh-agent (inside the build environment)
eval $(ssh-agent -s)
## Add the SSH key stored in SSH_PRIVATE_KEY variable to the agent store
## We're using tr to fix line endings which makes ed25519 keys work
## without extra base64 encoding.
## https://gitlab.com/gitlab-examples/ssh-private-key/issues/1#note_48526556
echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - > /dev/null
## Create the SSH directory and give it the right permissions
mkdir -p ~/.ssh
chmod 700 ~/.ssh
## Assuming you created the SSH_KNOWN_HOSTS variable, uncomment the
## following two lines.
echo "$SSH_KNOWN_HOSTS" > ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
## configure git
git config --global user.email "mail@lukasriedel.com"
git config --global user.name "Lukas Riedel"
\ No newline at end of file
......@@ -10,11 +10,13 @@ variables:
-j 2
before_script:
# enter DUNE directory
- cd /opt/dune
stages:
- build
- test
- deploy
build:main:
stage: build
......@@ -139,4 +141,15 @@ test:mass_conserve:
name: "$CI_JOB_NAME"
paths:
- $CI_PROJECT_DIR/build-cmake/Testing
expire_in: 1 day
\ No newline at end of file
expire_in: 1 day
deploy:code:
stage: deploy
dependencies: []
before_script:
- bash .deploy_prepare.sh
script:
- git push $DORIE_DUNE_SSH_REMOTE HEAD:$CI_COMMIT_REF_NAME
environment:
name: code/$CI_COMMIT_REF_NAME
url: https://gitlab.dune-project.org/lukas.riedel/dorie
\ No newline at end of file
......@@ -2,12 +2,12 @@ include ${CMAKE_BINARY_DIR}/doc/default_files/config.ini
__name = mc
_asset_path = "${CMAKE_CURRENT_LIST_DIR}"
_limit_cube_static = 2E-9
_limit_cube_adapt = 2E-4
_limit_simplex_static = 5E-10
_limit_simplex_adapt = 3E-6
_limit_cube_static = 4e-7
_limit_cube_adapt = 3E-7
_limit_simplex_static = 4E-7
_limit_simplex_adapt = 2E-6
_prefix = _simplex
_prefix = _simplex, _cube | expand grid
_suffix = _static, _adapt | expand adaptive
limit = {_limit{_prefix}{_suffix}}
......@@ -32,7 +32,7 @@ adaptivity.coarseningFraction = 5E-10
adaptivity.threshold = 0.0
grid.FEorder = 1
grid.gridType = simplex
grid.gridType = simplex, rectangular | expand grid
grid.initialLevel = 2
grid.cells = 20 20
grid.gridFile = {_asset_path}/meshes/square.msh
\ No newline at end of file
......@@ -32,57 +32,64 @@ using CubeAdaptive = Dune::Dorie::BaseTraits<Dune::UGGrid,
int main (int argc, char** argv)
{
// initialize MPI if needed
auto& helper = Dune::MPIHelper::instance(argc, argv);
try{
// initialize MPI if needed
auto& helper = Dune::MPIHelper::instance(argc, argv);
// Read ini file
if (argc!=2)
DUNE_THROW(Dune::IOError,
"Call this program with arguments <config>");
const std::string inifilename = argv[1];
Dune::ParameterTree inifile;
Dune::ParameterTreeParser ptreeparser;
ptreeparser.readINITree(inifilename,inifile);
// Read ini file
if (argc!=2)
DUNE_THROW(Dune::IOError,
"Call this program with arguments <config>");
const std::string inifilename = argv[1];
Dune::ParameterTree inifile;
Dune::ParameterTreeParser ptreeparser;
ptreeparser.readINITree(inifilename,inifile);
const double limit = inifile.get<double>("limit");
const double limit = inifile.get<double>("limit");
// run test
double result {0.0};
const auto adaptive = inifile.get<bool>("adaptivity.useAdaptivity");
const auto grid_type = inifile.get<std::string>("grid.gridType");
if (adaptive) {
if (grid_type == "rectangular") {
using TestSim = Dune::Dorie::TestSimulation<CubeAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
// run test
double result {0.0};
const auto adaptive = inifile.get<bool>("adaptivity.useAdaptivity");
const auto grid_type = inifile.get<std::string>("grid.gridType");
if (adaptive) {
if (grid_type == "rectangular") {
using TestSim = Dune::Dorie::TestSimulation<CubeAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<SimplexAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<SimplexAdaptive<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
else {
if (grid_type == "rectangular") {
using TestSim = Dune::Dorie::TestSimulation<Cube<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::YaspGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<Simplex<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
}
}
else {
if (grid_type == "rectangular") {
using TestSim = Dune::Dorie::TestSimulation<Cube<2, 1>>;
auto grid = Dune::Dorie::build_grid_cube<Dune::YaspGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
}
else if (grid_type == "simplex") {
using TestSim = Dune::Dorie::TestSimulation<Simplex<2, 1>>;
auto grid = Dune::Dorie::build_grid_gmsh<Dune::UGGrid<2>>(inifile, helper);
TestSim sim(helper, grid, inifile);
result = sim.run_test();
if (std::abs(result) > limit) {
std::cerr << "Mass conservation test exceeded limit!" << std::endl;
std::cerr << "Limit: " << limit << std::endl;
std::cerr << "Result: " << result << std::endl;
return 2;
}
}
if (std::abs(result) > limit) {
std::cerr << "Mass conservation test exceeded limit!" << std::endl;
std::cerr << "Limit: " << limit << std::endl;
std::cerr << "Result: " << result << std::endl;
catch(...) {
std::cerr << "Exception occurred!" << std::endl;
return 1;
}
......