From 2fb89998d16a55e0b8af672d6111b21983c7d301 Mon Sep 17 00:00:00 2001 From: Simon Praetorius <simon.praetorius@tu-dresden.de> Date: Tue, 17 May 2016 18:23:34 +0200 Subject: [PATCH] demos use neumann-boundary --- CMakeLists.txt | 6 ++---- dune/amdis/CMakeLists.txt | 8 +++++--- init/ellipt.json.2d | 2 +- src/CMakeLists.txt | 2 +- src/ellipt.cc | 16 +++++++++++++++- src/heat.cc | 36 ++++++++++++++++++------------------ 6 files changed, 42 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9969a12f..859fe6b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,14 +1,12 @@ cmake_minimum_required(VERSION 3.0) project(dune-amdis CXX) -set(ALBERTA_ROOT /opt/software/alberta) -set(ALBERTA_INCLUDE_DIR /opt/software/alberta/include) +# set(ALBERTA_ROOT /opt/software/alberta) +# set(ALBERTA_INCLUDE_DIR /opt/software/alberta/include) # set(CMAKE_PREFIX_PATH /opt/software/dune/lib/cmake) # set(UG_DIR /opt/software/dune/lib/cmake/ug) # set(Vc_DIR /opt/software/dune/lib/cmake/Vc) -set(MTL_DIR ${CMAKE_SOURCE_DIR}/install/MTL/share/mtl) - 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 diff --git a/dune/amdis/CMakeLists.txt b/dune/amdis/CMakeLists.txt index 1271b2a4..3d0ec69a 100644 --- a/dune/amdis/CMakeLists.txt +++ b/dune/amdis/CMakeLists.txt @@ -39,7 +39,9 @@ if (Boost_FOUND) endif (Boost_FOUND) -find_package(MTL REQUIRED) +find_package(MTL REQUIRED + PATHS ${CMAKE_SOURCE_DIR}/install/MTL/share/mtl + /iwr/modules/mtl4/share/mtl) if (MTL_FOUND) target_include_directories("duneamdis" PUBLIC ${MTL_INCLUDE_DIRS}) # target_link_libraries("duneamdis" PUBLIC ${MTL_LIBRARIES}) @@ -49,14 +51,14 @@ if (MTL_FOUND) foreach (feature ${CXX_ELEVEN_FEATURE_LIST}) target_compile_definitions("duneamdis" PUBLIC MTL_WITH_${feature}) endforeach () - + if (HAVE_UMFPACK OR ENABLE_SUITESPARSE OR SuiteSparse_FOUND) target_compile_definitions("duneamdis" PUBLIC MTL_HAS_UMFPACK) endif () endif (MTL_FOUND) -install(FILES +install(FILES AdaptBase.hpp AdaptInfo.hpp AdaptInstationary.hpp diff --git a/init/ellipt.json.2d b/init/ellipt.json.2d index e927c98f..a8ea6cce 100644 --- a/init/ellipt.json.2d +++ b/init/ellipt.json.2d @@ -19,7 +19,7 @@ }, "output": { - "filename": "output/ellipt.2d", + "filename": "ellipt.2d", "output directory": "output" } } diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c2572635..1d020f49 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,5 +1,5 @@ -set(projects2d "heat" "pfc" "stokes" "navier_stokes") +set(projects2d "ellipt" "heat" "pfc" "stokes" "navier_stokes") foreach(project ${projects2d}) add_executable(${project}2d ${project}.cc) diff --git a/src/ellipt.cc b/src/ellipt.cc index 4260dc27..1f5fce69 100644 --- a/src/ellipt.cc +++ b/src/ellipt.cc @@ -9,11 +9,12 @@ #include <dune/amdis/ProblemStat.hpp> #include <dune/amdis/Terms.hpp> #include <dune/amdis/common/Literals.hpp> +#include <dune/amdis/BoundaryElementIterator.hpp> using namespace AMDiS; // 1 component with polynomial degree 1 -using ElliptParam = ProblemStatTraits<AMDIS_DIM, AMDIS_DOW, 1>; +using ElliptParam = DefaultTraitsMesh<Dune::AlbertaGrid<AMDIS_DIM, AMDIS_DOW>, AMDIS_DIM, AMDIS_DOW, 1>; using ElliptProblem = ProblemStat<ElliptParam>; using ElliptProblemInstat = ProblemInstat<ElliptParam>; @@ -57,6 +58,19 @@ int main(int argc, char** argv) prob.solve(adaptInfo); prob.writeFiles(adaptInfo, true); + + AMDIS_MSG("----------------------------"); + for (auto const& b : boundary_elements(*prob.getMeshView())) + AMDIS_MSG("b = " << b.geometry().center()); + + AMDIS_MSG("----------------------------"); + size_t i = 0; + for (auto const& f : boundary_facets(*prob.getMeshView())) { + AMDIS_MSG("f = " << f.geometry().center()/* << ", id = " << f.boundaryId()*/); + if (i++ >= 10) + break; + } + AMDiS::finalize(); return 0; } \ No newline at end of file diff --git a/src/heat.cc b/src/heat.cc index 5f251aca..ccb619f3 100644 --- a/src/heat.cc +++ b/src/heat.cc @@ -13,27 +13,27 @@ using namespace AMDiS; -class HeatParam -{ - template <class... Bs> - using FeSpaceTuple = std::tuple<Bs...>; - - template <class Mesh, int deg> - using Lagrange = Dune::Functions::PQkNodalBasis<typename Mesh::LeafGridView, deg>; - -public: - static constexpr int dim = AMDIS_DIM; - static constexpr int dimworld = AMDIS_DOW; - static constexpr int nComponents = 1; - - // default values - using Mesh = Dune::UGGrid<dim>; - using FeSpaces = FeSpaceTuple<Lagrange<Mesh, 2>>; -}; +// class HeatParam +// { +// template <class... Bs> +// using FeSpaceTuple = std::tuple<Bs...>; +// +// template <class Mesh, int deg> +// using Lagrange = Dune::Functions::PQkNodalBasis<typename Mesh::LeafGridView, deg>; +// +// public: +// static constexpr int dim = AMDIS_DIM; +// static constexpr int dimworld = AMDIS_DOW; +// static constexpr int nComponents = 1; +// +// // default values +// using Mesh = Dune::UGGrid<dim>; +// using FeSpaces = FeSpaceTuple<Lagrange<Mesh, 2>>; +// }; // 1 component with polynomial degree 1 -// using HeatParam = ProblemStatTraits<AMDIS_DIM, AMDIS_DOW, 1>; +using HeatParam = DefaultTraitsMesh<Dune::AlbertaGrid<AMDIS_DIM, AMDIS_DOW>, AMDIS_DIM, AMDIS_DOW, 2>; using HeatProblem = ProblemStat<HeatParam>; using HeatProblemInstat = ProblemInstat<HeatParam>; -- GitLab