diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fa26c4d643241bd3517804edbf681a9beb700fc..209023c65f8c21cf53a10e09978d88a663f2c8c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,22 +3,24 @@ Differences Between DuMux 3.3 and DuMux 3.2 ### Improvements and Enhancements -- __Dune version__: DuMux now requires Dune >=2.7 -- The DuMux install script has been translated to Python to improve portability. The old shell script will be removed after release 3.3. -- The velocity reconstruction for immiscible porous-media models has been improved, leading to slightly +- __Requirements__: DuMux now requires Dune >=2.7 and CMake >= 3.13. +- __New way to use material laws__: The usage of laws for pc-Sw and kr-Sw has been completely revised. A caller does not have to pass a `parameters` object to the laws anymore. The `spatialParams` now provide a `fluidMatrixInteraction` function which bundles an arbitrary number of + different interaction laws such as a pc-Sw and kr-Sw curve and interfacial areas. + New pre-cached spline laws were added which can help to increase efficiency. The usage of the old interface is deprecated and warnings will be raised. The old interface will be removed after the release of 3.3. +- __New example__: We have added another free-flow example dealing with lid-driven cavity flow. +- __Install script written in Python__: The DuMux install script has been translated to Python to improve portability. The old shell script will be removed after release 3.3. +- __Improved velocity reconstruction__: The velocity reconstruction for immiscible porous-media models has been improved, leading to slightly different velocity fields in the vicinity of Neumann boundaries. -- Basic support for Python bindings has been added. Python bindings are an experimental feature +- __Python bindings (experimental)__: Basic support for Python bindings has been added. Python bindings are an experimental feature and might undergo unannounced API changes until further notice. This concerns the files in the folders `python` and `dumux/python`. To activate - add `-DDUNE_ENABLE_PYTHONBINDINGS=TRUE` and `-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE` to your CMAKE_FLAGS and run dunecontrol - run `python3 dune-common/bin/setup-dunepy.py` -- We now include a basic version of the [fmt-library](https://github.com/fmtlib/fmt) which implements `std::format` (coming with C++20) with the need for C++20. + - adapt your PYTHONPATH environment variable as described [here](https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/tree/master/python) +- __fmt-library__: We now include a basic version of the [fmt-library](https://github.com/fmtlib/fmt) which implements `std::format` (coming with C++20) without the need for C++20. In order to use this, include ``. `format`, `format_to`, `format_to_n`, `formatted_size` are available in the `Dumux::Fmt` namespace. The string formatting is documented [here](https://en.cppreference.com/w/cpp/utility/format/formatter#Standard_format_specification) and follows the Python string formatting rules. - The function are documented on [cppreference](https://en.cppreference.com/w/cpp/utility/format). - - The usage of laws for pc-Sw and kr-Sw has been completely revised. A caller does not have to pass a `parameters` object to the laws anymore. The `spatialParams` now provide a `fluidMatrixInteraction` function which bundles an arbitrary number of - different interaction laws such as a pc-Sw and kr-Sw curve and interfacial areas. - New pre-cached spline laws were added which can help to increase efficiency. The usage of the old interface is deprecated and warnings will be raised. The old interface will be removed after the release of 3.3. - - The RANS models now include variable densities. Compositional or nonisothermal RANS models could produce slightly different, more accurate, results. + The functions are documented on [cppreference](https://en.cppreference.com/w/cpp/utility/format). + - __RANS__: The RANS models now include variable densities. Compositional or nonisothermal RANS models could produce slightly different, more accurate, results. ### Immediate interface changes not allowing/requiring a deprecation period: - __Flash/Constraintsolver__: The flashes depending on material laws are immediately required to use new-style material laws (fluidMatrixInteraction interface in spatialparams) @@ -42,11 +44,11 @@ The results might differ a bit when using coarse grids. However, both version ar - Everything that has been deprecated before release 3.2 has been removed. - All of the geometry headers previously saved in `dumux/common/geometry` have been relocated to `dumux/geometry`. - The headers in `dumux/common/geometry` are deprecated and will be removed in 3.3. The geometry tests have been moved from `test/common/geometry` + The headers in `dumux/common/geometry` are deprecated and will be removed after 3.3. The geometry tests have been moved from `test/common/geometry` and `test/common/boundingboxtree` to `test/geometry`. ### Other noteworthy changes: -- after release 3.2, DuMux releases earlier than 2.12 will no longer be automatically tested or supported. +- Releases earlier than 3.0 are no longer automatically tested or supported. Differences Between DuMux 3.2 and DuMux 3.1 ============================================= diff --git a/LICENSE.md b/LICENSE.md index fac87b6c11a7d3fd6bc03b662edb813da95cea28..29467318a7e61d71cbb9cd15a95aa95c81e215bc 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -12,6 +12,7 @@ Copyright holders | 2013-2020 | Beatrix Becker | | 2014 | Markus Blatt | | 2010 | Felix Bode | +| 2020 | Ivan Buntic | | 2018-2020 | Samuel Burbulla | | 2007-2011 | Yufei Cao | | 2018-2020 | Edward 'Ned' Coltman | @@ -35,6 +36,7 @@ Copyright holders | 2012-2017 | Alexander Kissinger | | 2013-2020 | Timo Koch | | 2020 | Tim Jupe | +| 2020 | Mathis Kelm | | 2017 | Kata Kurgyis | | 2018-2020 | Theresa Kurz | | 2008-2012 | Andreas Lauser | @@ -62,11 +64,13 @@ Copyright holders | 2019 | Andrea Vescovini | | 2020 | Maziar Veyskarami | | 2010-2014 | Lena Walter | +| 2020 | Yue Wang | | 2018-2020 | Felix Weinhardt | | 2015-2020 | Kilian Weishaupt | | 2010-2011 | David Werner | | 2019-2020 | Roman Winter | | 2015 | Hao Wu | +| 2020 | Hanchuan Wu | | 2008-2013 | Markus Wolff | | 2013 | Tianyuan Zheng | diff --git a/bin/installdumux.py b/bin/installdumux.py index deaff81b220fb42cf7d0e60a3f27b6f52469862b..610ac7020a9bcce65a0a76b539e726b3e0564da2 100755 --- a/bin/installdumux.py +++ b/bin/installdumux.py @@ -7,7 +7,7 @@ import os import sys import subprocess from distutils.spawn import find_executable -from pkg_resources import parse_version +from distutils.version import LooseVersion def show_message(message): print("*" * 120) @@ -18,7 +18,7 @@ def show_message(message): def check_cpp_version(): requiredversion = "7" result = subprocess.check_output(["g++", "-dumpversion"]).decode().strip() - if parse_version(result) < parse_version(requiredversion): + if LooseVersion(result) < LooseVersion(requiredversion): print("-- An error occured while checking for prerequistes.") raise Exception("g++ greater than or equal to {} is required for dumux releases >=3.2!".format(requiredversion)) @@ -81,8 +81,8 @@ show_message("(1/3) Step completed. All prerequistes found.") ################################################################# ################################################################# # make a new folder containing everything -os.makedirs("./DUMUX", exist_ok=True) -os.chdir("DUMUX") +os.makedirs("./dumux", exist_ok=True) +os.chdir("dumux") show_message("(2/3) Cloning repositories. This may take a while. Make sure to be connected to the internet...") @@ -127,7 +127,7 @@ show_message("(3/3) Step completed. Succesfully configured and built dune and du ################################################################# ################################################################# show_message("(Installation complete) To test if everything works, please run the following commands (can be copied to command line):\n\n" - " cd DUMUX/dumux/build-cmake/test/porousmediumflow/1p/implicit/isothermal\n" + " cd dumux/dumux/build-cmake/test/porousmediumflow/1p/implicit/isothermal\n" " make test_1p_tpfa\n" " ./test_1p_tpfa\n" " paraview *pvd\n") diff --git a/bin/util/extractmodulepart.py b/bin/util/extractmodulepart.py new file mode 100644 index 0000000000000000000000000000000000000000..8327b29b309cd69c9f7f7e3f2a407ef14257d6c8 --- /dev/null +++ b/bin/util/extractmodulepart.py @@ -0,0 +1,292 @@ +#!/usr/bin/env python3 +import sys, glob, os, subprocess +import argparse +import shutil +from distutils.dir_util import copy_tree +import os.path + +""" +This is a python script for extracting modules. +It was originally written to solve the problem that the bash shell script could only run in a specific environment. +So the whole design philosophy is to maximize the portability, i.e. write in a cross-platform style. +""" + +def show_helpmesseage(): + print("\n""USAGE: "+os.path.basename(__file__)+" module_dir FOLDER_1 [FOLDER_2 ...]\n\n" + "module_dir is the folder containing the DUNE module from which you\n" + "want to extract. The script has to be called one level above it.\n\n" + "The FOLDERs need to indicate subfolders of module_dir. At least one\n" + "of them has to contain a source file *.cc of an executable for which\n" + "you would like to timber a table in dumux-pub.") + exit(1) + +# check if help is needed +if (len(sys.argv) < 2): + show_helpmesseage() +if (str(sys.argv[1]) == "--help" or + str(sys.argv[1]) == "-help" or + str(sys.argv[1]) == "help"): + show_helpmesseage() +module_dir = str(sys.argv[1]) + +# if module_dir contains a slash as last character, delete it +if module_dir.endswith('/'): + module_dir = module_dir[:-1] + +# check if we are above module_dir +if not (os.path.isdir(module_dir)): + print("ERROR: you need to run the script one level above the folder "+module_dir+".") + print("Run \""+os.path.basename(__file__)+" --help\" for details.") + exit(1) + +# determine all source files in the paths passed as arguments +os.chdir(module_dir) +module_full_path=os.getcwd() +all_sources=[] +all_directories=[] +for dir_path in sys.argv[2:]: + stripped_path = dir_path.removeprefix(module_dir) + directories = " " + stripped_path + all_directories.append(stripped_path) + os.chdir( os.path.join(module_full_path + stripped_path)) + for file in glob.glob("*.cc"): + sources = os.path.join(stripped_path, file) + all_sources.append(sources) +os.chdir(module_full_path) +os.chdir("..") + +# check if sources have been obtained +for source in all_sources: + contracted = str(os.popen("echo \"" + source + "\" | tr -d \" tnr\"").read().rstrip("\n")) + if ( contracted == "" ): + print("ERROR: no source files *.cc found in the directories "+sys.argv[2]+".") + print("Be sure to provide a list of paths as arguments to this script.") + print("Run \""+os.path.basename(__file__)+" --help\" for details.") + exit(1) + +# try to find the duneproject script +dune_project = shutil.which('duneproject', path = "dune-common/bin") +if (dune_project == None): + print("ERROR: Could not find duneproject.") + print("Be sure to either have duneproject in your search path") + print("or to run this script from a directory that contains duneproject.") + exit(1) +else: + print(dune_project) + +# give explanations +print("\n""This script will\n" + "- extract the following sub-folders of "+ module_dir +":\n\n") +for dir_path in all_directories: + print(" "+ dir_path + ",") +print("\n"" and all headers in "+ module_dir + " that are required to build the\n" + " executables from the sources\n\n") +for source in all_sources: + print(" "+ source +",") +print("\n- copy the extracted files into a freshly created DUNE module, retaining the\n" + " directory structure,\n\n" + "- update/create all required files like CMakeLists.txt,\n\n" + "- store the versions of all used Dune module\n\n" + "- and extract their modifications as patches.\n\n" + "Thus, you receive a fully-working DUNE module containing the subset of\n" + + module_dir + " that is required to run your application.\n" + "duneproject will be run now. The new module should NOT depend on the\n" + "module in "+ module_dir + ".\n\n" + "Read the above and press [Enter] to proceed...",end="") + +# run duneproject +old_ls = os.listdir() +subprocess.call([dune_project], shell=True) +new_ls = os.listdir() + +# determine the new module/directory name +module_name = (set(new_ls) - set(old_ls)).pop() +if ( module_name == "" ): + print("ERROR: could not find new module. Aborting.") + exit(1) +else: + print() + print( os.path.basename(__file__) + ": Found new module " + module_name) +print("Determining required headers...",end="") +os.chdir(module_name) +module_path=os.getcwd() + +# extract all headers +import re +import threading + +all_headers = [] +all_headers_tmp = [] +def search_headers(c_file): + global all_headers + f = open(c_file,'r') + content = f.read() + f.close() + header_in_bracket = re.findall(r'(?<=#include <).+?(?=>)',content) + header_in_quotation = re.findall(r'(?<=#include ").+?(?=")',content) + for header in header_in_bracket: + if header.startswith("dumux"): + header_with_path = os.path.join(module_full_path, header) + else: + continue + if header_with_path not in all_headers: + all_headers.append(header_with_path) + thread_ = threading.Thread(target = search_headers, args = (header_with_path, )) + thread_.start() + for header in header_in_quotation: + header_dir_name = os.path.dirname(c_file) + header_with_path = os.path.join(header_dir_name, header) + if header_with_path not in all_headers: + all_headers.append(header_with_path) + thread_ = threading.Thread(target = search_headers, args = (header_with_path, )) + thread_.start() + +for source in all_sources: + source_abspath = module_full_path+source + search_headers(source_abspath) + for header in all_headers: + print(header) + dir_path = os.path.dirname(os.path.realpath(header)).replace("dumux",module_name,1) + os.makedirs(dir_path, exist_ok=True) + shutil.copy(header,dir_path) + source_dir = source_abspath.removesuffix("main.cc") + source_path = source_dir.replace("dumux",module_name,1) + copy_tree(source_dir, source_path) + +# delete all architecture-dependent files and unneeded directories +rmfilenames = ["Makefile.in", "Makefile", '*.o', '*.deps/*'] +for rmfile in rmfilenames: + for filename in glob.glob(rmfile): + os.remove(filename) + +shutil.rmtree('dune') +shutil.rmtree('src') + +# set CMake File for each directory +os.chdir(module_path) +def __generate_new_content(lines, pattern, replace_str): + index = lines.find(pattern) + if index != -1: + content = lines[0: index] + "\n" + if replace_str != "": + content += replace_str + "\n" + flag = True + while flag: + index = lines.find(")", index) + if index != -1: + lines = lines[index + 1:] + else: + break + + index = lines.find(pattern) + if index != -1: + content += lines[0: index] + "\n" + else: + content += lines + "\n" + flag = False + else: + if replace_str == "": + content = lines + else: + if pattern == "add_subdirectory(": + content = replace_str + "\n" + lines + else: + content = lines + "\n" + replace_str + return content + +def __generate_subdirectory_content(dirs): + content = "" + for name in dirs: + content += "add_subdirectory(" + name + ")" + "\n" + return content + +def __generate_install_content(header_files, destination): + if len(header_files) == 0: + return "" + content = "install(FILES" + "\n" + for header_file in header_files: + content += " " + header_file + "\n" + content += "DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}" + destination + ")" + "\n" + return content + +def __generate_content(cmake_list_txt_file, dirs, header_files, destination): + subdirectory_content = __generate_subdirectory_content(dirs) + install_content = __generate_install_content(header_files, destination) + + if os.path.exists(cmake_list_txt_file): + with open(cmake_list_txt_file, "r", encoding="utf-8") as f: + content = "".join(f.readlines()).strip() + f.close() + content = __generate_new_content(content, "add_subdirectory(", subdirectory_content) + return __generate_new_content(content, "install(FILE", install_content) + else: + if subdirectory_content == "": + return install_content + else: + return subdirectory_content + "\n" + install_content + +def __generate_cmake_lists_txt(cmake_list_txt_file, dirs, header_files, destination): + content = __generate_content(cmake_list_txt_file, dirs, header_files, destination) + + with open(cmake_list_txt_file, "w", encoding="utf-8") as f: + if content != "": + f.write(content) + f.close() + +def __check_dir(root_dir): + if not os.path.exists(root_dir): + print("root path" + str(root_dir) + "is not exist!") + return False + if not os.path.isdir(root_dir): + print("root path" + str(root_dir) + "is not dir!") + return False + return True + +def __check_str(root_dir): + if root_dir is None or root_dir.strip() == "": + print("root path is None!") + return None + root_dir = root_dir.strip() + if root_dir.endswith(os.sep): + root_dir = root_dir[:-1] + return root_dir + +def generate_cmake_lists_txt_file(root_dir): + root_dir = __check_str(root_dir) + if root_dir is None: + return + if not __check_dir(root_dir): + return + drop_len = len(root_dir) + for parent, dirs, files in os.walk(root_dir): + destination = parent[drop_len:] + header_files = [] + cmake_list_txt_file = os.path.join(parent, "CMakeLists.txt") + for name in files: + for suffix in [".h", ".hh"]: + if name.endswith(suffix): + header_files.append(name) + __generate_cmake_lists_txt(cmake_list_txt_file, dirs, header_files, destination) + +generate_cmake_lists_txt_file(module_path) + +# move patches folder into module if existing +if (os.path.isdir("patches") ): + subprocess.call(["mv","patches",module_name],shell=True) + +# output guidence for users +print("\n"+"*"*80+"\n" + "The extracted module is contained in the subfolder \""+module_name+"\".\n" + "You can build it using \"dunecontrol ... --only="+ module_name +" all\".\n" + +"*"*80+"\n" + "BEFORE building, you can add the module to dumux-pub by something like:\n" + "(Rename module name if it does not match the AuthorLastNameYearx scheme\n" + "and commit it to the Git repository dumux-pub)\n" + "git clone https://git.iws.uni-stuttgart.de/dumux-pub/AuthorLastNameYearx.git \n" + "sed -i '/Module:/c\Module: AuthorLastNameYearx' "+ module_name+"/dune.module\n" + "mv "+ module_name +"/* dumux-pub/AuthorLastNameYearx/.\n" + "cd AuthorLastNameYearx\n" + "git commit -a\n" + "git push") + +sys.exit(0) \ No newline at end of file diff --git a/cmake/modules/DumuxTestMacros.cmake b/cmake/modules/DumuxTestMacros.cmake index 195bfea19720e77814573ed0546bd33a7ac11ab0..a892127279fe953c57d35918d94e24be0e22e11d 100644 --- a/cmake/modules/DumuxTestMacros.cmake +++ b/cmake/modules/DumuxTestMacros.cmake @@ -1,29 +1,6 @@ # Dumux wrapper for the module that provides tools for testing the Dune way. # We have a wrapper to have to possibily of supporting multiple Dune versions. # -# .. cmake_function:: dumux_declare_test_label -# -# .. cmake_brief:: -# -# Declare labels for :ref:`dumux_add_test`. -# -# .. cmake_param:: LABELS -# :multi: -# -# The names of labels to declare. Label names must be nonempty and -# consist only of alphanumeric characters plus :code:`-` and :code:`_` -# to make sure it is easy to construct regular expressions from them for -# :code:`ctest -L ${label_regex}`. -# -# Labels need to be declared to ensure that the target -# :code:`build_${label}_tests` exists. They will normally be declared -# on-demand by :ref:`dumux_add_test`. But sometimes it is useful to be able to -# run :code:`make build_${label}_tests` whether or not any tests with that -# label exists in a module. For these cases :ref:`dune_declare_test_label` can -# be called explicitly. -# -# The label :code:`quick` is always predeclared. -# # .. cmake_function:: dumux_add_test # # .. cmake_brief:: @@ -203,122 +180,50 @@ # build all tests during `make all`. Note, that this may take quite some time for some modules. # If not in use, you have to build tests through the target :code:`build_tests`. # +# .. cmake_function:: dumux_evaluate_cmake_guard +# +# .. cmake_brief:: +# +# Fills the passed variable with TRUE if all guards evaluate to TRUE and FALSE otherwise +# +# .. cmake_param:: CMAKE_GUARD +# :multi: +# :argname: condition +# +# A number of conditions that CMake should evaluate. +# Uses the same mechanics that `dumux_add_test` uses to evaluate its CMAKE_GUARD argument. +# +# The passed condition can be a complex expression like +# `( A OR B ) AND ( C OR D )`. Mind the spaces around the parentheses. +# +# Example: Write CMAKE_GUARD dune-foo_FOUND if you want to set a variable +# that is only true if the module dune-foo has been found. +# + +# Note: This forwards to dune_add_test but enables another layer in case we need to support +# future Dune features with older Dune versions supported by Dumux +function(dumux_add_test) + dune_add_test(${ARGV}) +endfunction() -# Note: This is a copy of dune_declare_test_label to be backwards compatible with Dune 2.6 but enable labels -function(dumux_declare_test_label) +# Evaluate test guards like dune_add_test internally does +function(dumux_evaluate_cmake_guard GUARD_LETS_YOU_PASS) include(CMakeParseArguments) - set(OPTIONS) - set(SINGLEARGS) - set(MULTIARGS LABELS) - cmake_parse_arguments(arg "${OPTIONS}" "${SINGLEARGS}" "${MULTIARGS}" ${ARGN}) + set(MULTIARGS CMAKE_GUARD) + cmake_parse_arguments(EVALGUARD "${OPTIONS}" "${SINGLEARGS}" "${MULTIARGS}" ${ARGN}) - if( (DEFINED arg_UNPARSED_ARGUMENTS) AND NOT ( arg_UNPARSED_ARGUMENTS STREQUAL "" ) ) - message(FATAL_ERROR "Unhandled extra arguments given to dumux_declare_test_label(): " - "<${arg_UNPARSED_ARGUMENTS}>") + # Check whether the parser produced any errors + if(EVALGUARD_UNPARSED_ARGUMENTS) + message(WARNING "Unrecognized arguments ('${EVALGUARD_UNPARSED_ARGUMENTS}') for dumux_evaluate_cmake_guard!") endif() - foreach(label IN LISTS arg_LABELS) - # Make sure the label is not empty, and does not contain any funny - # characters, in particular regex characters - if(NOT (label MATCHES "[-_0-9a-zA-Z]+")) - message(FATAL_ERROR "Refusing to add label \"${label}\" since it is " - "empty or contains funny characters (characters other than " - "alphanumeric ones and \"-\" or \"_\"; the intent of this restriction " - "is to make construction of the argument to \"ctest -L\" easier") - endif() - set(target "build_${label}_tests") - if(NOT TARGET "${target}") - add_custom_target("${target}") + # determine if all condition of the guard are met + set(${GUARD_LETS_YOU_PASS} TRUE PARENT_SCOPE) + set(FAILED_CONDITION_PRINTING "") + foreach(condition ${EVALGUARD_CMAKE_GUARD}) + separate_arguments(condition) + if(NOT (${condition})) + set(${GUARD_LETS_YOU_PASS} FALSE PARENT_SCOPE) endif() endforeach() -endfunction(dumux_declare_test_label) - -# predefine "quick" test label so build_quick_tests can be built -# unconditionally -dumux_declare_test_label(LABELS quick) - -# Note: This is a copy of dune_declare_test_label to be backwards compatible with Dune 2.6 but enable labels -# After labels are available on a release branch this can simply forward to dune_add_test -function(dumux_add_test) - # for new versions just forward to dune_add_test - if(DUNE_COMMON_VERSION VERSION_GREATER 2.6.0) - dune_add_test(${ARGV}) - - # otherwise deal with labels separately (backwards-compatibilty layer with Dune 2.6.0) - else() - include(CMakeParseArguments) - set(OPTIONS EXPECT_COMPILE_FAIL EXPECT_FAIL SKIP_ON_77 COMPILE_ONLY) - set(SINGLEARGS NAME TARGET TIMEOUT) - set(MULTIARGS SOURCES COMPILE_DEFINITIONS COMPILE_FLAGS LINK_LIBRARIES CMD_ARGS MPI_RANKS COMMAND CMAKE_GUARD LABELS) - cmake_parse_arguments(ADDTEST "${OPTIONS}" "${SINGLEARGS}" "${MULTIARGS}" ${ARGN}) - - # Check whether the parser produced any errors - if(ADDTEST_UNPARSED_ARGUMENTS) - message(WARNING "Unrecognized arguments ('${ADDTEST_UNPARSED_ARGUMENTS}') for dumux_add_test!") - endif() - - # remove labels from the argument list - set(FORWARD_ARGS ${ARGV}) - if(ADDTEST_LABELS) - string(REPLACE "LABELS;${ADDTEST_LABELS}" "" FORWARD_ARGS "${FORWARD_ARGS}") - # replace head or trailing ";" - string(REGEX REPLACE ";^" "" FORWARD_ARGS "${FORWARD_ARGS}") - string(REGEX REPLACE ";$" "" FORWARD_ARGS "${FORWARD_ARGS}") - endif() - - # foward to dune function - dune_add_test(${FORWARD_ARGS}) - - # take care of labels afterwards - if(NOT ADDTEST_NAME) - # try deducing the test name from the executable name - if(ADDTEST_TARGET) - set(ADDTEST_NAME ${ADDTEST_TARGET}) - endif() - # try deducing the test name form the source name - if(ADDTEST_SOURCES) - list(LENGTH ADDTEST_SOURCES len) - get_filename_component(ADDTEST_NAME ${ADDTEST_SOURCES} NAME_WE) - endif() - endif() - - if(ADDTEST_SOURCES) - set(ADDTEST_TARGET ${ADDTEST_NAME}) - endif() - - # possibly set default for mpi ranks - if(NOT ADDTEST_MPI_RANKS) - set(ADDTEST_MPI_RANKS 1) - endif() - - # Discard all parallel tests if MPI was not found - if(NOT MPI_FOUND) - set(DUNE_MAX_TEST_CORES 1) - endif() - - # make sure each label exists and its name is acceptable - dumux_declare_test_label(LABELS ${ADDTEST_LABELS}) - - # Have build_${label}_tests depend on the given target in - # order to trigger the build correctly - if(NOT ADDTEST_EXPECT_COMPILE_FAIL) - foreach(label IN LISTS ADDTEST_LABELS) - add_dependencies(build_${label}_tests ${ADDTEST_TARGET}) - endforeach() - endif() - - # Add one test for each specified processor number - foreach(procnum ${ADDTEST_MPI_RANKS}) - if((NOT "${procnum}" GREATER "${DUNE_MAX_TEST_CORES}") AND (NOT ADDTEST_COMPILE_ONLY)) - set(ACTUAL_NAME ${ADDTEST_NAME}) - - if(NOT ${procnum} STREQUAL "1") - set(ACTUAL_NAME "${ACTUAL_NAME}-mpi-${procnum}") - endif() - - # Set the labels on the test - set_tests_properties(${ACTUAL_NAME} PROPERTIES LABELS "${ADDTEST_LABELS}") - endif() - endforeach() - endif() endfunction() diff --git a/doc/doxygen/extradoc/parameterlist.txt b/doc/doxygen/extradoc/parameterlist.txt index 57ac8ab96ca271738086758237838235464fd312..182982d2fef4ef5aad3df37cfaed2140303af3e9 100644 --- a/doc/doxygen/extradoc/parameterlist.txt +++ b/doc/doxygen/extradoc/parameterlist.txt @@ -4,199 +4,286 @@ * *\brief List of currently useable run-time parameters * - * The listed run-time parameters are in general available, + * The listed run-time parameters are available in general, * but we point out that a certain model might not be able * to use every parameter! * - * | Group | Parameter | Type | Default Value | Explanation | - * | :- | :- | :- | :- | :- | - * | - | ParameterFile | std::string| executable.input | name of the parameter file | -* | \b Adaptive | BCRefinementThreshold | Scalar | 1e-10 | | -* | | MaxLevel | std::size_t | 0 | | -* | \b Assembly | NumericDifference.BaseEpsilon | Scalar | 1e-10 | | -* | | NumericDifferenceMethod | int | | | -* | | NumericDifference.PriVarMagnitude | NumEqVector(-1) | | | -* | \b BinaryCoefficients | GasDiffCoeff | Scalar | | | -* | | LiquidDiffCoeff | Scalar | | | -* | \b Brine | Salinity | Scalar | | | -* | \b Component | GasDensity | Scalar | | | -* | | GasDiffusionCoefficient | Scalar | 1.0 | | -* | | GasKinematicViscosity | Scalar | | | -* | | HenryComponentInWater | Scalar | 1.0 | | -* | | HenryWaterInComponent | Scalar | 1.0 | | -* | | LiquidDensity | Scalar | | | -* | | LiquidDiffusionCoefficient | Scalar | 1.0 | | -* | | LiquidKinematicViscosity | Scalar | | | -* | | MolarMass | Scalar | | | -* | | Name | std::string | component | | -* | | SolidDensity | Scalar | | | -* | | SolidHeatCapacity | Scalar | | | -* | | SolidThermalConductivity | Scalar | | | -* | \b ElectroChemistry | ActivationBarrier | Scalar | | | -* | | CellVoltage | Scalar | | | -* | | MaxIterations | int | | | -* | | NumElectrons | Scalar | | | -* | | pO2Inlet | Scalar | | | -* | | RefCurrentDensity | Scalar | | | -* | | RefO2PartialPressure | Scalar | | | -* | | RefTemperature | Scalar | | | -* | | ReversibleVoltage | Scalar | | | -* | | SpecificResistance | Scalar | | | -* | | SurfaceIncreasingFactor | Scalar | | | -* | | ThermoneutralVoltage | Scalar | | | -* | | TransferCoefficient | Scalar | | | -* | | TransportNumberH20 | Scalar | | | -* | \b FacetCoupling | Xi | Scalar | 1.0 | | -* | \b Flux | DifferencingScheme | std::string | Minmod | | -* | | TvdApproach | std::string | Uniform | | -* | | UpwindWeight | Scalar | | | -* | \b FluxLimiterLET | LowerWaterDepth | Scalar | 1e-5 | | -* | | UpperWaterDepth | Scalar | 1e-3 | | -* | | UpwindFluxLimiting | bool | false | | -* | \b FluxOverSurface | Verbose | bool | false | | -* | \b Forchheimer | MaxIterations | std::size_t | 30 | | -* | | NewtonTolerance | Scalar | 1e-12 | | -* | \b FreeFlow | EnableUnsymmetrizedVelocityGradient | bool | false | | -* | | EnableUnsymmetrizedVelocityGradientForBeaversJoseph | bool | false | | -* | \b GridAdapt | AdaptionInterval | int | 1 | | -* | | CoarsenTolerance | Scalar | | | -* | | EnableInitializationIndicator | bool | | | -* | | EnableMultiPointFluxApproximation | bool | | | -* | | MaxInteractionVolumes!=1 | int | | | -* | | MaxInteractionVolumes | int | | | -* | | MaxLevel | int | | | -* | | MinLevel | int | | | -* | | RefineAtDirichletBC | bool | | | -* | | RefineAtFluxBC | bool | | | -* | | RefineAtSource | bool | | | -* | | RefineTolerance | Scalar | | | -* | \b Grid | Angularstd::to_string(i) | Scalar | | | -* | | Axialstd::to_string(i) | Scalar | | | -* | | BoundarySegments | bool | false | | -* | | Cells | CellArray | cells | | -* | | Cells | cells | | | -* | | Cells | GlobalPosition | | | -* | | Cells | int | 1 | | -* | | Cells | intdim | cells | | -* | | Cellsstd::array< | | | | -* | | Cellsstd::to_string(i) | int | cells[i] | | -* | | CellType | std::string | Cube | | -* | | ClosureType | std::string | Green | | -* | | Coordinates | std::vector | | | -* | | DomainMarkers | bool | false | | -* | | File | std::string | | | -* | | File | std::string | modelParamGroup | | -* | | GmshPhysicalEntityThreshold | std::size_t | 0 | | -* | | Gradingstd::to_string(i) | Scalar | grading[i] | | -* | | Gradingstd::to_string(i) | std::vector | grading[i] | | -* | | Image | std::string | | | -* | | KeepPhysicalOverlap | bool | true | | -* | | LeftBoundary | CoordinateType | 0.0 | | -* | | LowerLeft | GlobalPosition | GlobalPosition(0.0) | | -* | | Marker | bool | 0 | | -* | | Overlap | int | 1 | | -* | | Partitioning | intdim | | | -* | | Periodicstd::bitset | | | -* | | Radialstd::to_string(i) | Scalar | | | -* | | Refinement | int | | | -* | | RefinementType | std::string | Local | | -* | | RightBoundary | CoordinateType | | | -* | | UpperRight | GlobalPosition | | | -* | | Verbosity | bool | false | | -* | | WellRadius | Scalar | | | -* | \b Impet | CFLFactor | Scalar | | | -* | | DtVariationRestrictionFactorstd::numeric_limits | | | -* | | FacePriVarNames | std::vector | | | -* | | PriVarNames | std::vector | | | -* | \b MatrixConverter | DeletePatternEntriesBelowAbsThreshold | Scalar | -1.0 | | -* | \b MixedDimension | IntegrationOrder | int | 1 | | -* | | KernelWidth | Scalar | | | -* | | NumCircleSegments | int | | | -* | | NumCircleSegments | int | 25 | | -* | \b MPFA | CalcVelocityInTransport | bool | | | -* | | EnableComplexLStencil | bool | true | | -* | | EnableSimpleLStencil | bool | true | | -* | | EnableTPFA | bool | false | | -* | | Q | Scalar | | | -* | | TransmissibilityCriterion | int | 0 | | -* | | TransmissibilityCriterionThreshold | Scalar | 1e-8 | | -* | \b Newton | EnableAbsoluteResidualCriterion | bool | | | -* | | EnableChop | bool | | | -* | | EnableDynamicOutput | bool | true | | -* | | EnablePartialReassembly | bool | | | -* | | EnableResidualCriterion | bool | | | -* | | EnableShiftCriterion | bool | | | -* | | MaxAbsoluteResidual | Scalar | | | -* | | MaxRelativeShift | Scalar | | | -* | | MaxSteps | int | | | -* | | MaxTimeStepDivisions | std::size_t | 10 | | -* | | MinSteps | int | | | -* | | ReassemblyMaxThreshold | Scalar | 1e2*shiftTolerance_ | | -* | | ReassemblyMinThreshold | Scalar | 1e-1*shiftTolerance_ | | -* | | ReassemblyShiftWeight | Scalar | 1e-3 | | -* | | ResidualReduction | Scalar | | | -* | | RetryTimeStepReductionFactor | Scalar | 0.5 | | -* | | SatisfyResidualAndShiftCriterion | bool | | | -* | | TargetSteps | int | | | -* | | UseLineSearch | bool | | | -* | | Verbosity | int | 2 | | -* | \b PrimaryVariableSwitch | Verbosity | int | 1 | | -* | \b Problem | EnableGravity | bool | | | -* | | EnableInertiaTerms | bool | | | -* | | Name | std::string | | | -* | | UsePrimaryVariableSwitch | bool | | | -* | \b RANS | EddyViscosityModel | std::string | vanDriest | | -* | | FlowNormalAxis | int | -1 | | -* | | TurbulentPrandtlNumber | Scalar | 1.0 | | -* | | TurbulentSchmidtNumber | Scalar | 1.0 | | -* | | UseStoredEddyViscosity | bool | false | | -* | | UseStoredEddyViscosity | bool | true | | -* | | WallNormalAxis | int | -1 | | -* | \b SpatialParams | ComputeAwsFromAnsAndPcMax | bool | true | | -* | | ForchCoeff | Scalar | 0.55 | | -* | | MinBoundaryPermeability | Scalar | | | -* | | Tortuosity | Scalar | 0.5 | | -* | \b TimeLoop | Restart | double | 0.0 | | -* | \b TimeManager | double | Restart | | | -* | | DtInitial | Scalar | | | -* | | MaxTimeStepSizestd::numeric_limits | - | Relative permeability for the non-wetting phase data for spline material law. | + * | - | KrwData | std::vector | - | Relative permeability for the wetting phase data for spline material law. | + * | - | LinearPcEntry | Scalar | - | Entry capillary pressure for the linear capillary pressure and relative permeability <-> saturation relations. | + * | - | LinearPcMax | Scalar | - | Maximum capillary pressure for the linear capillary pressure and relative permeability <-> saturation relations. | + * | - | ParameterFile | std::string | executablename.input | Command line argument: overwrite parameter file if one was specified on the command line | + * | - | ParkerVanGenuchtenAlpha | Scalar | - | Shape parameter \f$\mathrm{\alpha}\f$ \f$\mathrm{[1/Pa]}\f$ in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenBetaGn | Scalar | 1.0 | Scaling parameter \f$\mathrm{betaGn}\f$ \f$\mathrm{[-]}\f$ in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenBetaGw | Scalar | 1.0 | Scaling parameter \f$\mathrm{betaGw}\f$ \f$\mathrm{[-]}\f$ in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenBetaNw | Scalar | 1.0 | Scaling parameter \f$\mathrm{betaNw}\f$ \f$\mathrm{[-]}\f$ in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenKrgLowSteThreshold | Scalar | 1e-3 | The threshold saturation below which the relative permeability of the nonwetting phase gets regularized in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenKrnLowSweThreshold | Scalar | 0.1 | The threshold saturation below which the relative permeability of the nonwetting phase gets regularized in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenKrwHighSweThreshold | Scalar | 0.9 | The threshold saturation above which the relative permeability of the wetting phase gets regularized in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenN | Scalar | - | Shape parameter \f$\mathrm{n}\f$ \f$\mathrm{[-]}\f$ in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenPcHighSweThreshold | Scalar | 0.99 | Threshold saturation above which the capillary pressure is regularized in Parker/vanGenuchten laws. | + * | - | ParkerVanGenuchtenPcLowSweThreshold | Scalar | 0.01 | Threshold saturation below which the capillary pressure is regularized in Parker/vanGenuchten laws. Most problems are very sensitive to this value (e.g. making it smaller might result in very high capillary pressures). | + * | - | ParkerVanGenuchtenRegardSnrForKrn | bool | false | In Parker/vanGenuchten laws regard the relative non-wetting saturation in the permeability of the non-wetting phase, see Helmig1997. | + * | - | PcData | std::vector | - | Capillary pressure data for spline material law. | + * | - | PcMax | Scalar | - | Maximum capillary pressure for calculating the interfacial area between the nonwetting and wetting phase as in Nuske 2014 (https://elib.uni-stuttgart.de/handle/11682/614, page 60) \cite nuske2014. | + * | - | Restart | double | - | The restart time stamp for a previously interrupted simulation | + * | - | Sgr | Scalar | 0.0 | Residual gas phase saturation. | + * | - | SmoothedLinearLawKrHighS | Scalar | - | If the saturation is higher than this value, smoothed linear material law changes to a spline for the relative permeability. | + * | - | SmoothedLinearLawKrLowS | Scalar | - | If the saturation is lower than this value, smoothed linear material law changes to a spline for the relative permeability. | + * | - | SmoothedLinearLawPcMax | Scalar | - | The maximum capillary pressure used in the smoothed linear law. | + * | - | SmoothedLinearLawPe | Scalar | - | The entry pressure used in the smoothed linear law. | + * | - | Snr | Scalar | 0.0 | Residual non-wetting phase saturation. | + * | - | SplineNumSwSamples | Scalar | 30 | Number of sample points from which the wetting saturation spline is built. | + * | - | SplineSweInterval | std::array | std::array default{{ 0.01, 1.0 }} | Effective wetting saturation interval for spline material law. | + * | - | SwData | std::vector | - | Wetting saturation pressure data for spline material law. | + * | - | Swr | Scalar | 0.0 | Residual wetting phase saturation. | + * | - | ThreePNAPLAdsorptionKdNAPL | Scalar | - | kd parameter for the adsportion of NAPL in a 3 phase simulation. | + * | - | ThreePNAPLAdsorptionRhoBulk | Scalar | - | bulk density for calculating the adsorption of NAPL in a 3 phase simulation. | + * | - | VanGenuchtenAlpha | Scalar | - | Shape parameter \f$\mathrm{\alpha}\f$ \f$\mathrm{[1/Pa]}\f$ in vanGenuchten laws. | + * | - | VanGenuchtenConstantRegularization | bool | false | If specified, a constant value is used for regularization in Parker/vanGenuchten. | + * | - | VanGenuchtenKrnLowSweThreshold | Scalar | 0.1 | The threshold saturation below which the relative permeability of the nonwetting phase gets regularized in vanGenuchten laws. | + * | - | VanGenuchtenKrwHighSweThreshold | Scalar | 0.9 | The threshold saturation above which the relative permeability of the wetting phase gets regularized in vanGenuchten laws. | + * | - | VanGenuchtenL | Scalar | 0.5 | Shape parameter \f$\mathrm{m}\f$ \f$\mathrm{[-]}\f$ in vanGenuchten laws. | + * | - | VanGenuchtenN | Scalar | - | Shape parameter \f$\mathrm{n}\f$ \f$\mathrm{[-]}\f$ in vanGenuchten laws. | + * | - | VanGenuchtenPcHighSweThreshold | Scalar | 0.99 | Threshold saturation above which the capillary pressure is regularized in vanGenuchten laws. | + * | - | VanGenuchtenPcLowSweThreshold | Scalar | 0.01 | Threshold saturation below which the capillary pressure is regularized in vanGenuchten laws. | + * | \b Adaptive | BCRefinementThreshold | Scalar | 1e-10 | The threshold above which fluxes are treated as non-zero | + * | Adaptive | MaxLevel | int | - | The maximum refinement level | + * | Adaptive | MinLevel | int | - | The minimum refinement level | + * | Adaptive | RefineAtDirichletBC | bool | true | Whether to refine at Dirichlet boundaries | + * | Adaptive | RefineAtFluxBC | bool | true | Whether to refine at Neumann/Robin boundaries | + * | Adaptive | RefineAtSource | bool | true | Whether to refine where source terms are specified | + * | \b Assembly | NumericDifference.BaseEpsilon | Scalar | 1e-10 | The basic numeric epsilon used in the differentiation for deflecting primary variables | + * | Assembly | NumericDifference.PriVarMagnitude | NumEqVector | NumEqVector(-1) | The magnitude of the primary variables used for finding a good numeric epsilon for deflecting primary variables. | + * | Assembly | NumericDifferenceMethod | int | 1 | The numeric difference method (1: foward differences (default), 0: central differences, -1: backward differences) | + * | \b BinaryCoefficients | GasDiffCoeff | Scalar | - | The binary diffusion coefficient in gas | + * | BinaryCoefficients | LiquidDiffCoeff | Scalar | - | The binary diffusion coefficient in liquid | + * | \b Brine | Salinity | Scalar | - | The salinity | + * | \b Component | GasDensity | Scalar | - | The density of the gas | + * | Component | GasDiffusionCoefficient | Scalar | 1.0 | Binary diffusion coefficient for molecular water and the constant component | + * | Component | GasKinematicViscosity | Scalar | - | The gas kinematic viscosity | + * | Component | HenryComponentInWater | Scalar | 1.0 | Henry coefficient for the constant component in liquid water | + * | Component | HenryWaterInComponent | Scalar | 1.0 | Henry coefficient for water in the constant component | + * | Component | LiquidDensity | Scalar | - | The density of the liquid | + * | Component | LiquidDiffusionCoefficient | Scalar | 1.0 | Diffusion coefficient for the constant component in liquid water | + * | Component | LiquidKinematicViscosity | Scalar | - | The liquid kinematic viscosity | + * | Component | MolarMass | Scalar | - | The mass in one mole of the component | + * | Component | Name | std::string | component | A human readable name for the component | + * | Component | SolidDensity | Scalar | - | The density of the component in solid state | + * | Component | SolidHeatCapacity | Scalar | - | Specific isobaric heat capacity of the component as a solid | + * | Component | SolidThermalConductivity | Scalar | - | Thermal conductivity of the component as a solid | + * | \b ElectroChemistry | ActivationBarrier | Scalar | - | The activation barrier to calculate the exchange current density. | + * | ElectroChemistry | CellVoltage | Scalar | - | The voltage of the fuel cell. | + * | ElectroChemistry | MaxIterations | int | - | The maximum number of iterations in iteatively (Newton solver) calculating the current density. | + * | ElectroChemistry | NumElectrons | Scalar | - | The number of electrons for the calculation of activation and concentration losses. | + * | ElectroChemistry | RefCurrentDensity | Scalar | - | The reference current density to calculate the exchange current density. | + * | ElectroChemistry | RefO2PartialPressure | Scalar | - | The reference oxygen partial pressure. | + * | ElectroChemistry | RefTemperature | Scalar | - | The reference temperature to calculate the exchange current density. | + * | ElectroChemistry | ReversibleVoltage | Scalar | - | The reversible voltage. | + * | ElectroChemistry | SpecificResistance | Scalar | - | The specific resistance, see \cite A3:acosta:2006. | + * | ElectroChemistry | SurfaceIncreasingFactor | Scalar | - | The surface-increasing factor to calculate the exchange current density. | + * | ElectroChemistry | ThermoneutralVoltage | Scalar | - | Thermoneutral voltage for the non-isothermal electrochemistry model. | + * | ElectroChemistry | TransferCoefficient | Scalar | - | The transport coefficient. | + * | ElectroChemistry | TransportNumberH20 | Scalar | - | The water transport number to calculate the osmotic term in the membrane. | + * | ElectroChemistry | pO2Inlet | Scalar | - | The oxygen pressure at the inlet. | + * | \b FacetCoupling | Xi | Scalar | 1.0 | The xi factor for coupling conditions | + * | \b Flux | DifferencingScheme | std::string | Minmod | Choice of a staggered TVD method | + * | Flux | TvdApproach | std::string | Uniform | If you use a staggered grid with a TVD approach: For a uniform grid "Uniform" is fine. For a nonuniform grid decide between "Li" and "Hou" (two literature-based methods). | + * | Flux | UpwindWeight | Scalar | - | Upwind weight in staggered upwind method | + * | \b FluxLimiterLET | LowerWaterDepth | Scalar | 1e-5 | The lower water depth | + * | FluxLimiterLET | UpperWaterDepth | Scalar | 1e-3 | The upper water depth | + * | FluxLimiterLET | UpwindFluxLimiting | bool | false | If this is set true, the upwind water depth from the flux direction is used. This can improve stability. | + * | \b FluxOverSurface | Verbose | bool | false | For enabling or disabling the console output | + * | \b Forchheimer | MaxIterations | std::size_t | 30 | The maximum number of Newton iterations for solving the Forchheimer equation | + * | Forchheimer | NewtonTolerance | Scalar | 1e-12 | The error tolerance in the Newton method for solving the Forchheimer equation | + * | \b FreeFlow | EnableUnsymmetrizedVelocityGradient | bool | false | For enabling unsymmetrized velocity gradient. If false consider the shear stress caused by the gradient of the velocities normal to our face of interest. | + * | Freeflow | EnableUnsymmetrizedVelocityGradientForBeaversJoseph | bool | false | For enabling unsymmetrized velocity gradient for the Beavers Joseph coupling condition. If true and if the current scvf is on a boundary and if a Dirichlet BC for the pressure or a BJ condition for the slip velocity is set there, assume a tangential velocity gradient of zero along the lateral face. | + * | \b Grid | Angular0/1/2 | std::vector | - | min/max value for angular coordinate. Cake grids can be created by either specifying Radial,Angular or Axial in all coordinate directions. | + * | Grid | Axial0/1/2 | std::vector | - | min/max value for axial coordinate. Cake grids can be created by either specifying Radial,Angular or Axial in all coordinate directions. | + * | Grid | BoundarySegments | bool | false | For the dune gmsh reader: Whether to insert boundary segments into the grid | + * | Grid | CellType | std::string | Cube | "Cube" or "Simplex" to be used for structured grids | + * | Grid | Cells | std::array | - | The number of elements in a structured uniform grid in x, y and z direction | + * | Grid | Cells0 | std::vector | - | For a grid with zones, number of cells of the leftmost zone, number of cells of the second-leftmost zone, ..., number of cells of the rightmost zone, spaceseparated. (assuming x-axis points to the right) | + * | Grid | Cells1 | std::vector | - | Spaceseparated list of the number of cells per zone in y-direction (see more details for x-direction in Cells1). | + * | Grid | Cells2 | std::vector | - | Spaceseparated list of the number of cells per zone in z-direction (see more details for x-direction in Cells1). | + * | Grid | ClosureType | std::string | Green | Decide whether to add a green closure to locally refined grid sections or not: "Green" (Standard red/green refinement) or "None" (No closure, results in nonconforming meshes) | + * | Grid | Coordinates | std::vector | - | To construct a 1D grid with just a coordinates vector | + * | Grid | DomainMarkers | bool | false | Whether the grid managers work with domain markers. | + * | Grid | File | std::string | - | A DGF or gmsh file to load from | + * | Grid | GmshPhysicalEntityThreshold | std::size_t | 0 | | + * | Grid | Grading0 | std::vector | - | For a grid with zones, grading factors for the x-zones. 1.0 means all cells within this zone have equal extension in x-direction. Negative factors are possible. | + * | Grid | Grading1 | std::vector | - | For a grid with zones, grading factors for the y-zones. | + * | Grid | Grading2 | std::vector | - | For a grid with zones, grading factors for the z-zones. | + * | Grid | Image | std::string | - | The image file if the sub grid is constructed from a raster image | + * | Grid | KeepPhysicalOverlap | bool | true | Whether to keep the physical overlap in physical size or in number of cells upon refinement | + * | Grid | LeftBoundary | Scalar | 0.0 | The start coordinate of a 1D grid | + * | Grid | LowerLeft | GlobalPosition | - | The lowerLeft corner of a structured grid | + * | Grid | Marker | bool | 0 | To customize the subgrid generation. | + * | Grid | Overlap | int | 1 | The overlap size in cells | + * | Grid | Partitioning | std::array | - | A non-standard load-balancing, number of processors per direction | + * | Grid | Periodic | std::bitset | std::bitset() | True or false for each direction | + * | Grid | Positions0 | std::vector | - | For a grid with zones, x-positions of the left of the leftmost zone followed by the right of all zones (from left to right). (assuming x-axis points to the right) | + * | Grid | Positions1 | std::vector | - | For a grid with zones, y-positions for zoning in y (more details in Positions0 for x). | + * | Grid | Positions2 | std::vector | - | For a grid with zones, z-positions for zoning in z (more details in Positions0 for x).| + * | Grid | Radial0/1/2 | std::vector | - | min/max value for radial coordinate. Cake grids can be created by either specifying Radial,Angular or Axial in all coordinate directions. | + * | Grid | Refinement | int | 0 | The number of global refines to perform | + * | Grid | RefinementType | std::string | Local | e.g. UGGrid "Local" (New level consists only of the refined elements and the closure) or "Copy" (New level consists of the refined elements and the unrefined ones, too) | + * | Grid | RightBoundary | Scalar | - | The end coordinate of a 1D grid | + * | Grid | UpperRight | GlobalPosition | - | The upperright corner of a structured grid | + * | Grid | Verbosity | bool | false | Whether the grid construction should output to standard out | + * | \b GridAdapt | AdaptionInterval | int | 1 | The time step interval for adaption | + * | GridAdapt | CoarsenTolerance | Scalar | 0.001 | Coarsening threshold to decide whether a cell should be marked for coarsening | + * | GridAdapt | EnableInitializationIndicator | bool | false | Whether to use initial grid adaption | + * | GridAdapt | EnableMultiPointFluxApproximation | bool | true | Whether to enable mpfa on hanging nodes | + * | GridAdapt | MaxInteractionVolumes | int | 4 | The maximum number of interaction volumes considered | + * | GridAdapt | MaxLevel | int | 1 | The maximum allowed level | + * | GridAdapt | MinLevel | int | 0 | The minimum allowed level | + * | GridAdapt | RefineAtDirichletBC | bool | false | To switch for refinement at Dirichlet BCs | + * | GridAdapt | RefineAtFluxBC | bool | false | To switch for refinement at Neumann BCs | + * | GridAdapt | RefineAtSource | bool | false | To switch for refinement at sources | + * | GridAdapt | RefineTolerance | Scalar | 0.05 | Coarsening threshold to decide whether a cell should be marked for refinement | + * | \b Impet | CFLFactor | Scalar | 1.0 | Scalar factor for additional scaling of the time step | + * | Impet | DtVariationRestrictionFactor | Scalar | std::numeric_limits::max() | | + * | Impet | EnableVolumeIntegral | bool | true | Whether to regard volume integral in pressure equation | + * | Impet | ErrorTermFactor | Scalar | 0.5 | Scaling factor for the error term | + * | Impet | ErrorTermLowerBound | Scalar | 0.1 | Lower threshold used for the error term evaluation | + * | Impet | ErrorTermUpperBound | Scalar | 0.9 | Upper threshold used for the error term evaluation | + * | Impet | IterationFlag | int | 0 | The flag to switch the iteration type of the IMPET scheme | + * | Impet | IterationNumber | int | 2 | The number of iterations if IMPET iterations are enabled by IterationFlag | + * | Impet | MaximumDefect | Scalar | 1e-5 | The maximum defect if IMPET iterations are enabled by IterationFlag | + * | Impet | PorosityThreshold | Scalar | 1e-6 | The threshold for the porosity | + * | Impet | RelaxationFactor | Scalar | 1.0 | 1 = new solution is new solution, 0 = old solution is new solution | + * | Impet | RestrictFluxInTransport | int | 0 | Restriction of flux on new pressure field if direction reverses from the pressure equation | + * | Impet | SubCFLFactor | Scalar | 1.0 | Scalar factor for scaling of local sub-time-step | + * | Impet | SwitchNormals | bool | false | Whether to switch direction of face normal vectors | + * | \b KEpsilon | EnableZeroEqScaling | bool | true | Whether to match the potential zeroeq eddy viscosities for two-layer model at the matching point | + * | KEpsilon | YPlusThreshold | Scalar | 30 | yPlus below this value is considered as near-wall region | + * | \b KOmega | EnableDissipationLimiter | bool | true | Whether to enable the dissipation limiter | + * | KOmega | EnableProductionLimiter | bool | false | Whether to enable the production limiter | + * | \b LinearSolver | GMResRestart | int | 10 | cycles before restarting | + * | LinearSolver | MaxIterations | int | 250 | The maximum iterations of the linear solver | + * | LinearSolver | MaxOrthogonalizationVectors | int | 10 | Maximal number of previous vectors which are orthogonalized against the new search direction | + * | LinearSolver | Preconditioner.AmgAccumulationMode | std::string | - | If and how data is agglomerated on coarser level to fewer processors. ("atOnce": do agglomeration once and to one process; "successive": Multiple agglomerations to fewer proceses until all data is on one process; "none": Do no agglomeration at all and solve coarse level iteratively). | + * | LinearSolver | Preconditioner.AmgAdditive | bool | - | Whether to use additive multigrid. | + * | LinearSolver | Preconditioner.AmgAlpha | double | - | Scaling value for marking connections as strong. | + * | LinearSolver | Preconditioner.AmgBeta | double | - | Threshold for marking nodes as isolated. | + * | LinearSolver | Preconditioner.AmgCoarsenTarget | int | - | Maximum number of unknowns on the coarsest level. | + * | LinearSolver | Preconditioner.AmgCriterionSymmetric | bool | true | If true use SymmetricCriterion (default), else UnSymmetricCriterion | + * | LinearSolver | Preconditioner.AmgDefaultAggregationDimension| std::size_t | std::to_string(dimension) | Dimension of the problem (used for setting default aggregate size). | + * | LinearSolver | Preconditioner.AmgDefaultAggregationSizeMode | std::string | isotropic | Whether to set default values depending on isotropy of problem uses parameters "defaultAggregationDimension" and "maxAggregateDistance" (isotropic: For and isotropic problem; anisotropic: for an anisotropic problem). | + * | LinearSolver | Preconditioner.AmgDiagonalRowIndex | int | 0 | The index to use for the diagonal strength (default 0) if this is i and strengthMeasure is "diagonal", then block[i][i] will be used when determining strength of connection. | + * | LinearSolver | Preconditioner.AmgGamma | std::size_t | - | 1 for V-cycle, 2 for W-cycle. | + * | LinearSolver | Preconditioner.AmgMaxAggregateDistance | std::size_t | 2 | Maximum distance in an aggregte (in term of minimum edges needed to travel. one vertex to another within the aggregate). | + * | LinearSolver | Preconditioner.AmgMaxAggregateSize | std::size_t | - | Maximum number of vertices an aggregate should consist of. | + * | LinearSolver | Preconditioner.AmgMaxLevel | int | 100 | Maximum number of levels allowed in the hierarchy. | + * | LinearSolver | Preconditioner.AmgMinAggregateSize | std::size_t | - | Minimum number of vertices an aggregate should consist of. | + * | LinearSolver | Preconditioner.AmgMinCoarseningRate | int | - | Coarsening will stop if the rate is below this threshold. | + * | LinearSolver | Preconditioner.AmgPostSmoothingSteps | std::size_t | - | Number of postsmoothing steps. | + * | LinearSolver | Preconditioner.AmgPreSmoothingSteps | std::size_t | - | Number of presmoothing steps. | + * | LinearSolver | Preconditioner.AmgProlongationDampingFactor | double | - | Damping factor for the prolongation. | + * | LinearSolver | Preconditioner.AmgSmootherIterations | int | - | The number of iterations to perform.| + * | LinearSolver | Preconditioner.AmgSmootherRelaxation | typename SmootherArgs::RelaxationFactor| - | The relaxation factor | + * | LinearSolver | Preconditioner.AmgStrengthMeasure | std::string | diagonal | What conversion to use to convert a matrix block to a scalar when determining strength of connection: diagonal (use a diagonal of row diagonalRowIndex, class Diagonal, default); rowSum (rowSum norm), frobenius (Frobenius norm); one (use always one and neglect the actual entries). | + * | LinearSolver | Preconditioner.DetermineRelaxationFactor | bool | true | Whether within the Uzawa algorithm the parameter omega is the relaxation factor is estimated by use of AMG | + * | LinearSolver | Preconditioner.DirectSolverForA | bool | false | Whether within the Uzawa algorithm a direct solver is used for inverting the 00 matrix block. | + * | LinearSolver | Preconditioner.ILUOrder | int | 0 | The order of the ILU decomposition. | + * | LinearSolver | Preconditioner.ILUResort | bool | false | true if a resort of the computed ILU for improved performance should be done. | + * | LinearSolver | Preconditioner.Iterations | int | 1 | Usually specifies the number of times the preconditioner is applied | + * | LinearSolver | Preconditioner.PowerLawIterations | std::size_t | 5 | Number of iterations done to estimate the relaxation factor within the Uzawa algorithm. | + * | LinearSolver | Preconditioner.Relaxation | double | 1 | The relaxation parameter for the preconditioner | + * | LinearSolver | Preconditioner.Type | std::string | - | The preconditioner type. | + * | LinearSolver | Preconditioner.Verbosity | int | 0 | The preconditioner verbosity level | + * | LinearSolver | ResidualReduction | double |1e-13(linear solver),1e-6(nonlinear)| The residual reduction threshold, i.e. stopping criterion | + * | LinearSolver | Restart | int | 10 | cycles before restarting | + * | LinearSolver | Type | std::string | - | The type of linear solver, e.g. restartedflexiblegmressolver or uzawa | + * | LinearSolver | Verbosity | int | 0 | The verbosity level of the linear solver | + * | \b LoadSolution | CellCenterPriVarNames | std::vector | - | Names of cell-centered primary variables of a model with staggered grid discretization | + * | LoadSolution | FacePriVarNames | std::vector | - | Names of primary variables on the cell faces of a model with staggered grid discretization | + * | LoadSolution | PriVarNames | std::vector | - | Primary variable names | + * | LoadSolution | PriVarNamesState1 | std::vector | - | Primary variable names state, e.g. p_liq x^N2_liq | + * | LoadSolution | PriVarNamesState2 | std::vector | - | Primary variable names state, e.g. p_liq x^H2O_gas | + * | LoadSolution | PriVarNamesState... | std::vector | - | Primary variable names state, e.g. p_liq S_gas | + * | \b MPFA | CalcVelocityInTransport | bool | - | Indicates if velocity is reconstructed in the pressure step or in the transport step | + * | MPFA | EnableComplexLStencil | bool | true | Whether to enable the two non-centered flux stencils | + * | MPFA | EnableSimpleLStencil | bool | true | Whether to enable the two centered flux stencils | + * | MPFA | EnableTPFA | bool | false | Whether to enable the use of TPFA if neighboring cells are of the same grid level | + * | MPFA | Q | CoordScalar | - | The quadrature point parameterizaion to be used on scvfs | + * | MPFA | TransmissibilityCriterion | int | 0 | | + * | MPFA | TransmissibilityCriterionThreshold | Scalar | 1e-8 | | + * | \b MatrixConverter | DeletePatternEntriesBelowAbsThreshold | Scalar | -1.0 | Only set non-zero value if original matrix entry is larger than this. | + * | \b MixedDimension | IntegrationOrder | int | 1 | The integration order for coupling source | + * | MixedDimension | KernelIntegrationCRL | double | 0.1 | The characteristic relative length | + * | MixedDimension | KernelWidthFactor | Scalar | - | The kernel width factor | + * | MixedDimension | NumCircleSegments | int | - | The number of circle segements in the context of integration points. | + * | MixedDimension | UseCircleAverage | bool | true | if we use the circle average as the 3D values or a point evaluation | + * | MixedDimension | WriteIntegrationPointsToFile | bool | false | Whether to write integration points to a file | + * | \b Newton | EnableAbsoluteResidualCriterion | bool | - | For Newton iterations to stop the absolute residual is demanded to be below a threshold value. At least two iterations. | + * | Newton | EnableChop | bool | - | chop the Newton update at the beginning of the non-linear solver | + * | Newton | EnableDynamicOutput | bool | true | Prints current information about assembly and solution process in the coarse of the simulation. | + * | Newton | EnablePartialReassembly | bool | - | Every entity where the primary variables exhibit a relative shift summed up since the last linearization above 'eps' will be reassembled. | + * | Newton | EnableResidualCriterion | bool | - | declare convergence if the initial residual is reduced by the factor ResidualReduction | + * | Newton | EnableShiftCriterion | bool | - | For Newton iterations to stop the maximum relative shift abs(uLastIter - uNew)/scalarmax(1.0, abs(uLastIter + uNew)*0.5) is demanded to be below a threshold value. At least two iterations. | + * | Newton | MaxAbsoluteResidual | Scalar | - | The maximum acceptable absolute residual for declaring convergence | + * | Newton | MaxRelativeShift | Scalar | - | Set the maximum acceptable difference of any primary variable between two iterations for declaring convergence | + * | Newton | MaxSteps | int | - | The number of iterations after we give up | + * | Newton | MaxTimeStepDivisions | std::size_t | 10 | The maximum number of time-step divisions | + * | Newton | MinSteps | int | - | The minimum number of iterations | + * | Newton | ReassemblyMaxThreshold | Scalar | 1e2*shiftTolerance_ | 'maxEps' in reassembly threshold max( minEps, min(maxEps, omega*(currently achieved maximum relative shift)) ). Increasing/decreasing 'maxEps' leads to less/more reassembly if 'omega*shift' is large, i.e., for the first Newton iterations. | + * | Newton | ReassemblyMinThreshold | Scalar | 1e-1*shiftTolerance_ | 'minEps' in reassembly threshold max( minEps, min(maxEps, omega*(currently achieved maximum relative shift)) ). Increasing/decreasing 'minEps' leads to less/more reassembly if 'omega*shift' is small, i.e., for the last Newton iterations. | + * | Newton | ReassemblyShiftWeight | Scalar | 1e-3 | 'omega' in reassembly threshold max( minEps, min(maxEps, omega*(currently achieved maximum relative shift)) ). Increasing/decreasing 'maxEps' leads to less/more reassembly if 'omega*shift' is large, i.e., for the first Newton iterations. | + * | Newton | ResidualReduction | Scalar | - | The maximum acceptable residual norm reduction | + * | Newton | RetryTimeStepReductionFactor | Scalar | 0.5 | Factor for reducing the current time-step | + * | Newton | SatisfyResidualAndShiftCriterion | bool | - | declare convergence only if both criteria are met | + * | Newton | TargetSteps | int | - | The number of iterations which are considered "optimal" | + * | Newton | UseLineSearch | bool | - | Whether to use line search | + * | Newton | Verbosity | int | 2 | The verbosity level of the Newton solver | + * | \b PointSource | EnableBoxLumping | bool | true | For a DOF-index to point source map distribute source using a check if point sources are inside a subcontrolvolume instead of using basis function weights. | + * | \b PrimaryVariableSwitch | Verbosity | int | 1 | Verbosity level of the primary variable switch. | + * | \b Problem | EnableGravity | bool | - | Whether to enable the gravity term | + * | Problem | EnableInertiaTerms | bool | - | Whether to enable the inertia terms | + * | Problem | Name | std::string | - | Set a name for a problem | + * | Problem | SandGrainRoughness | Scalar | - | The sand grain roughness | + * | Problem | UsePrimaryVariableSwitch | bool | - | Whether to perform variable switch at a degree of freedom location | + * | \b RANS | EddyViscosityModel | std::string | vanDriest | Choose the eddy viscosity model | + * | RANS | FlowDirectionAxis | int | 0 | The flow direction axis | + * | RANS | IsFlatWallBounded | bool | false | Set to true, if geometry consists of flat walls | + * | RANS | TurbulentPrandtlNumber | Scalar | 1.0 | The turbulent Prandtl number | + * | RANS | TurbulentSchmidtNumber | Scalar | 1.0 | The turbulent Schmidt number | + * | RANS | UseStoredEddyViscosity | bool | true for lowrekepsilon, false else | Whether to use the stored eddy viscosity | + * | RANS | WallNormalAxis | int | 1 | The normal wall axis of a flat wall bounded flow | + * | RANS | WriteFlatWallBoundedFields | bool | isFlatWallBounded | Whether to write output fields for flat wall geometries | + * | \b SpatialParams | ComputeAwsFromAnsAndPcMax | bool | true | Compute volume-specific interfacial area between the wetting and solid phase from interfacial area between nonwetting and solid phase and maximum capillary pressure. | + * | SpatialParams | ForchCoeff | Scalar | 0.55 | The Forchheimer coefficient | + * | SpatialParams | MinBoundaryPermeability | Scalar | - | The minimum permeability | + * | SpatialParams | Permeability | Scalar | - | The permeability | + * | SpatialParams | Porosity | Scalar | - | The porosity | + * | SpatialParams | Tortuosity | Scalar | 0.5 | The tortuosity | + * | \b TimeLoop | Restart | double | 0.0 | The restart time stamp for a previously interrupted simulation | + * | \b TimeManager | DtInitial | Scalar | - | The initial time step size | + * | TimeManager | MaxTimeStepSize | Scalar | std::numeric_limits::max() | The maximum allowed time step size | + * | TimeManager | Restart | Scalar | - | The restart time stamp for a previously interrupted simulation | + * | TimeManager | SubTimestepVerbosity | int | - | The verbosity level in local sub-time-steps | + * | TimeManager | TEnd | Scalar | - | The end time | + * | \b Vtk | AddProcessRank | bool | - | Whether to add a process rank | + * | Vtk | AddVelocity | bool | true | Whether to enable velocity output | + * | Vtk | CoordPrecision | std::string | value set to Vtk.Precision before | The output precision of coordinates. | + * | Vtk | OutputLevel | int | - | in sequential models: indicates which values the VTK output contains, e.g. if the OutputLevel is zero, only primary variables are written | + * | Vtk | Precision | std::string | Float32 | Precision of the vtk output | + * | Vtk | WriteFaceData | bool | false | For the staggered grid approach, write face-related data into vtp files. | */ diff --git a/doc/handbook/0_dumux-handbook.tex b/doc/handbook/0_dumux-handbook.tex index a434d9ea2c8a5ff7083c5567af34e5e1ee96b47b..c0518644e82d49b5054eeb7b3de13a7917682a88 100644 --- a/doc/handbook/0_dumux-handbook.tex +++ b/doc/handbook/0_dumux-handbook.tex @@ -42,7 +42,7 @@ % Dune and Dumux logo \newcommand{\Dune}{{DUNE}\xspace} \newcommand{\Dumux}{\texorpdfstring{Du\-Mu$^\text{x}$\xspace}{DuMuX\xspace}} -\newcommand{\DumuxVersion}{3.3-git} +\newcommand{\DumuxVersion}{3.3} \definecolor{dumuxYellow}{HTML}{E19417} \definecolor{dumuxBlue}{HTML}{0C73CF} diff --git a/doc/handbook/1_introduction.tex b/doc/handbook/1_introduction.tex index e661e5a06248d165cb5b96e970c41b68a0ee70bc..0c5c773bb01e02571c551509bd8a142e9f730d1c 100644 --- a/doc/handbook/1_introduction.tex +++ b/doc/handbook/1_introduction.tex @@ -74,11 +74,11 @@ spatial and temporal discretization schemes as well as nonlinear solvers, to general concepts for model coupling. Moreover, \Dumux includes ready to use numerical models and a few example applications. -This is the handbook to a new minor version update of \Dumux: version 3.2. -The release contains improvements and new features compared to the 3.1 version. -The update is backwards compatible with the last release 3.1. +This is the handbook to a new minor version update of \Dumux: version \DumuxVersion. +The release contains improvements and new features compared to the 3.2 version. +The update is backwards compatible with the last release 3.2. To facilitate the transition for our users, we have created a changelog -helping to update programs from version 3.1 to version 3.2, and giving an overview over new capabilities. +helping to update programs from version 3.2 to version \DumuxVersion, and giving an overview over new capabilities. It is available online: \url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/blob/master/CHANGELOG.md}. We highly recommend all our users to transition with us to the most recent version of \Dumux diff --git a/doc/handbook/2_quickinstall.tex b/doc/handbook/2_quickinstall.tex index 50e21b9e50b272667e1832ec12f35a45c44cc18b..db53fb76fcf8cd294e0ce3adf2121e5f34f266a6 100644 --- a/doc/handbook/2_quickinstall.tex +++ b/doc/handbook/2_quickinstall.tex @@ -11,22 +11,22 @@ e.g. GCC 4.9 or newer and Clang 3.8 or newer}), e.g. GCC 7 or newer and Clang 5 \end{itemize} \section{Obtaining code and configuring all modules with a script} -To easily install Dumux, we've provided a shell-script \texttt{installdumux.sh} that facilitates +To easily install Dumux, we've provided a python-script \texttt{installdumux.py} that facilitates setting up a {\Dune}/{\Dumux} directory tree and configures all modules with CMake. First, you will have to download this script. To do this, first navigate to the directory where you want to install \Dumux and \Dune (a single root folder \texttt{DUMUX} will be produced, so you do not need to provide one). Then use \texttt{wget} to download the script with the following command: -\begin{lstlisting}[style=Bash] -$ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/releases/3.2/bin/installdumux.sh +\begin{lstlisting}[style=Bash,escapechar=\%] +$ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/releases/%\DumuxVersion%/bin/installdumux.py \end{lstlisting} After the download is complete, execute the script. This can be done with \begin{lstlisting}[style=Bash] -$ sh installdumux.sh +$ python installdumux.py \end{lstlisting} This script will download each of the \Dune-modules that \Dumux depends on at their 2.7 release, -as well as \Dumux's 3.2 release. After these individual modules are downloaded, \Dune and \Dumux +as well as \Dumux's \DumuxVersion release. After these individual modules are downloaded, \Dune and \Dumux are automatically configured using the command-line script \texttt{dunecontrol}, located in \texttt{dune-common/bin/dunecontrol}, optimized using configure options defined in the \texttt{cmake.opts} file located in \texttt{dumux/cmake.opts}. The commands beneath the \texttt{\# run dunecontrol} in @@ -62,8 +62,8 @@ paraview *pvd These commands are compiled into \texttt{test\_dumux.sh}, which you can download and run from the same directory from which you ran \texttt{installDumux.sh}. -\begin{lstlisting}[style=Bash] -$ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/releases/3.2/bin/util/test_dumux.sh +\begin{lstlisting}[style=Bash,escapechar=\%] +$ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/raw/releases/%\DumuxVersion%/bin/util/test_dumux.sh $ wget sh test_dumux.sh \end{lstlisting} diff --git a/doc/handbook/3_detailedinstall.tex b/doc/handbook/3_detailedinstall.tex index d14c3b04165a0f09c3c29aca135e8bf3bd3bec25..1d1c29ff63f02d91c2bc0e0c284e619948c47359 100644 --- a/doc/handbook/3_detailedinstall.tex +++ b/doc/handbook/3_detailedinstall.tex @@ -4,7 +4,7 @@ In a second step of the installation, all modules are configured with CMake (section \ref{buildIt}). After successful installation of \Dumux, we guide you to start a test application, described in section \ref{quick-start-guide}. -In section \ref{sec:build-doc} we explain how to build the \Dumux documentation. +In section \ref{sec:build-doc}, we explain how to build the \Dumux documentation. Lastly, section \ref{sec:external-modules-libraries} provides details on optional libraries and modules. In a technical sense \Dumux is a module of \Dune. @@ -16,7 +16,7 @@ Details regarding the installation of \Dune are provided on the \Dune website \c \label{sc:ObtainingSourceCode} The \Dumux release and trunk (developer tree) are based on the most recent \Dune release 2.7, comprising the core modules \texttt{dune-common}, \texttt{dune-geometry}, -\texttt{dune-grid}, \texttt{dune-istl} and \texttt{dune-localfunctions}. We also support the previous \Dune release 2.6. +\texttt{dune-grid}, \texttt{dune-istl} and \texttt{dune-localfunctions}. For working with \Dumux, these modules are required. All \Dune modules, including the \Dumux module, get extracted into a common root directory, as it is done in an ordinary \Dune installation. @@ -27,7 +27,7 @@ the modules were obtained, a version number is added to the module name). The name of each \Dune module is defined in the file \texttt{dune.module}, which is in the root directory of the respective module. This should not be changed by the user. -In section \ref{sec:prerequisites} we list some prerequisites for running \Dune and \Dumux. +In section \ref{sec:prerequisites}, we list some prerequisites for running \Dune and \Dumux. Please check in said paragraph whether you can fulfill them before continuing. \paragraph{Obtaining \Dune and \Dumux from software repositories} @@ -47,7 +47,7 @@ Then, enter the previously created directory and check out the desired modules. As you see below, the check-out uses two different servers for getting the sources, one for \Dune and one for \Dumux. -\begin{lstlisting}[style=Bash] +\begin{lstlisting}[style=Bash,escapechar=\%] $ mkdir DUMUX $ cd DUMUX $ git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-common.git @@ -55,14 +55,14 @@ $ git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-geometry.g $ git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-grid.git $ git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-istl.git $ git clone -b releases/2.7 https://gitlab.dune-project.org/core/dune-localfunctions.git -$ git clone -b releases/3.2 https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git +$ git clone -b releases/%\DumuxVersion% https://git.iws.uni-stuttgart.de/dumux-repositories/dumux.git \end{lstlisting} The newest and maybe unstable developments of \Dune and \Dumux are also provided in these repositories and can be found in the \emph{master} branch. Please check the \Dune website \cite{DUNE-HP} for further information on the \Dune development. We always try to keep up with the latest developments of \Dune. However, the current \Dumux release is based on the stable 2.7 release and it might not compile without further adaptations using the newest versions of \Dune. -Furthermore, if you wish to install the optional \Dune Grid-Howto which provides a tutorial +Furthermore, if you wish to install the optional \Dune Grid-Howto, which provides a tutorial on the Dune grid interface, act similar. %TODO:currently, no DUNE patches necessary! Uncomment this section in case this changes again in the future. @@ -180,8 +180,8 @@ This should also work for other \Dune modules. \subsection{Handbook} To build the \Dumux handbook go into the \texttt{build-}directory and -run \texttt{make doc} or \texttt{make 0\_dumux-handbook\_pdf}. The pdf can then be found -in \texttt{MODULE\_BUILD\_DIRECTORY/doc/handbook/0\_dumux-handbook.pdf}. +run \texttt{make doc} or \texttt{make doc\_handbook\_0\_\\dumux-handbook\_pdf}. The pdf can then be found +in \texttt{MODULE\_BUILD\_DIRECTORY/doc/handbook/0\_dumux\\-handbook.pdf}. \section{External Libraries and Modules} \label{sec:external-modules-libraries} The libraries described below provide additional functionality but are not generally required to run \Dumux. @@ -224,7 +224,7 @@ and some more libraries and tools which are prerequisites for their use. Download: \url{https://gitlab.dune-project.org/extensions/dune-foamgrid} \item \textbf{opm-grid}: opm-grid is a DUNE module supporting grids in a corner-point format. - Download: \url{https://github.com/OPM/opm-grid.git} + Download: \url{https://github.com/OPM/opm-grid.git} and \url{https://github.com/OPM/opm-common.git} \item \textbf{dune-subgrid}: The dune-subgrid module is a meta-grid implementation that allows to mark elements of another hierarchical dune grid and use this sub-grid just like a regular grid. @@ -279,4 +279,4 @@ Maintaining backwards compatibility means for all changes made to the dumux mast Despite the goal of maintaining backwards compatibility across minor releases, for more complicated changes, this is to be decided upon on a case-by-case basis, due to limited developer resources. -In the case that implementing full backwards compatibility for an update is not feasible, or would require unreasonable resources, the degree of backwards compatibility be decided by a vote in one of the monthly core developer meetings. +In the case that implementing full backwards compatibility for an update is not feasible, or would require unreasonable resources, the degree of backwards compatibility will be decided by a vote in one of the monthly core developer meetings. diff --git a/doc/handbook/4_course.tex b/doc/handbook/4_course.tex index bb083fd8a9eb91776cf5d58de5685797d46b3566..b59617dca4ae68e659837ea99e4b131ea68ec1df 100644 --- a/doc/handbook/4_course.tex +++ b/doc/handbook/4_course.tex @@ -20,8 +20,8 @@ The \Dumux course material is available online: \url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course}. \par In order to download this repository, which acts as an additional module to the \Dumux base, you can download an installation script with the following command: -\begin{lstlisting}[style=Bash] -$ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/releases/3.2/scripts/install.sh +\begin{lstlisting}[style=Bash,escapechar=\%] +$ wget https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/raw/releases/%\DumuxVersion%/scripts/install.sh \end{lstlisting} This script will install \texttt{dumux}, it's Dune dependencies, and the \texttt{dumux-course} repository. Within the directory \texttt{dumux-course} there are a series of exercises @@ -29,5 +29,5 @@ and slides describing the previously described examples. The course can also be dumux installation using the \texttt{installExternal.sh} script and the argument \texttt{course}.\par % The \Dumux course will be updated with each \Dumux release. -The above script will download the correct version (\textbf{releases/3.2}) of both +The above script will download the correct version (\textbf{releases/\DumuxVersion}) of both the \texttt{dumux} and \texttt{dumux-course} module. diff --git a/doc/handbook/4_examples.tex b/doc/handbook/4_examples.tex index 9ebb322b9b6c7c089e460ad38f489dadf542e7fa..4b32383d95899e2190c921f1d8b7e9c7d48d8e89 100644 --- a/doc/handbook/4_examples.tex +++ b/doc/handbook/4_examples.tex @@ -1,6 +1,6 @@ \section{Experience \Dumux by reading -- the \Dumux examples} As an alternative to going through exercises, you can have a look at our well-documented \Dumux examples in \Dumux's \texttt{examples} directory. They show how to apply \Dumux models to typical physical problems. In the \texttt{README.md} files, the setup is explained, the used code is presented and documented and images resulting from the simulation are included. The \texttt{README.md} files are located directly in the subfolders of \texttt{examples} and can be displayed by web browsers. The number of examples is continuously growing. -You can find a list of current examples under: \url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/tree/releases/3.2/examples}. +You can find a list of current examples under: \url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux/-/tree/releases/\DumuxVersion/examples}. %We currently have the following examples: %\begin{itemize} % \item \texttt{1ptracer}: one-phase groundwater flow including a tracer diff --git a/doc/handbook/4_furtherpractice.tex b/doc/handbook/4_furtherpractice.tex index 194781c9b6c5768864cc01c27efa2450dee9f0e5..6fd423eff81efc7de29e26abb8fcdd8effdf6c1a 100644 --- a/doc/handbook/4_furtherpractice.tex +++ b/doc/handbook/4_furtherpractice.tex @@ -3,8 +3,8 @@ If there is a need for further practice, we refer here to the test problems that are already implemented in \Dumux. Several examples for all models -can be found in the \texttt{test}-directory. An overview over the available test -cases can be found in the class documentation \url{http://www.dumux.org/documentation.php}. +can be found in the \texttt{test}-directory. %An overview over the available test +%cases can be found in the class documentation \url{http://www.dumux.org/documentation.php}. Another possibility to gain more experience with \Dumux is the \texttt{dumux-lecture} module that contains different application examples that are used in the lectures at the diff --git a/doc/handbook/5_developingdumux.tex b/doc/handbook/5_developingdumux.tex index 29b85c69f3b42cd42a7ee9a749f9f8d16b0a77ed..7feaa8f83809966cfabd6e5ecc5746f8d4a05275 100644 --- a/doc/handbook/5_developingdumux.tex +++ b/doc/handbook/5_developingdumux.tex @@ -81,7 +81,7 @@ std::cout << "# This was written from "<< __FILE__ << ", line " << __LINE__ << s \paragraph{Using \Dune Debug Streams} \Dune provides a helpful feature, for keeping your debug-output organized. It uses simple streams like \texttt{std::cout}, but they can be switched on and off -for the whole project. You can chose five different levels of severity: +for the whole project. You can choose five different levels of severity: \begin{verbatim} 5 - grave (dgrave) 4 - warning (dwarn) diff --git a/doc/handbook/5_newfoldersetup.tex b/doc/handbook/5_newfoldersetup.tex index 50ffc8ade1075bfa3820fd3fe41c48cb07cf1820..5537c0925b9ec9fc34d7dc65ee89166f2c8ed3df 100644 --- a/doc/handbook/5_newfoldersetup.tex +++ b/doc/handbook/5_newfoldersetup.tex @@ -24,4 +24,4 @@ dune_add_test(NAME my_test Here, we create an executable called \texttt{my\_test} from a source file \texttt{main.cc}. The name of the test will also be \texttt{my\_test} (has to be unique). The last argument specifies a command - here, we just run the executable \texttt{my\_test} with an input file \texttt{params.input}. For more advanced uses of -the \texttt{add\_dune\_test} macro, have a look at the \texttt{test} directory. A complete documentation is given under \url{https://www.dune-project.org/sphinx/core-2.6/}. +the \texttt{add\_dune\_test} macro, have a look at the \texttt{test} directory. A complete documentation is given under \url{https://www.dune-project.org/sphinx/core-2.7/}. diff --git a/doc/handbook/5_restartsimulations.tex b/doc/handbook/5_restartsimulations.tex index 3eda5d62448b3f0625c25fdb40d94cc81efbb173..ff4fc2f66550ef128d0a86f59d8ff0fdc1bbf210 100644 --- a/doc/handbook/5_restartsimulations.tex +++ b/doc/handbook/5_restartsimulations.tex @@ -11,8 +11,7 @@ a restart using \texttt{BackupRestoreFacility} with plain Dune. For VTK files the output can be read with the free function \texttt{loadSolution}. Grids can be read with the \texttt{Dumux::VTKReader} or you can simply recreate the grid as you did in the first simulation run. -Writing double-precision floating point numbers to VTK files is available with the newest \Dune release 2.7. If you are using that version, it is now possible to specify output precision in the input file using \texttt{Vtk.Precision} followed by either \texttt{Float32}, \texttt{Float64}, \texttt{UInt32}, \texttt{UInt8} or \texttt{Int32}. \texttt{Float32} is set as the default. We especially advice the use of \texttt{Float64} when working with restart files. If you are working with the \Dune release 2.6 we only support single precision restart, meaning some information will be lost if you are computing -in double precision. +Writing double-precision floating point numbers to VTK files is available with the newest \Dune release 2.7. If you are using that version, it is now possible to specify output precision in the input file using \texttt{Vtk.Precision} followed by either \texttt{Float32}, \texttt{Float64}, \texttt{UInt32}, \texttt{UInt8} or \texttt{Int32}. \texttt{Float32} is set as the default. We especially advice the use of \texttt{Float64} when working with restart files. The restart capabilities will hopefully be improved in future versions of \Dumux-3. We are happy about any contributions (especially HDF5 / XDMF support, improvement of VTK support). diff --git a/doc/handbook/5_structure.tex b/doc/handbook/5_structure.tex index c97c67b375cf6fce62c5ab70a84c54aba5a21342..903ca3acc34d3bf0f06b21a97bae414ee98d61b1 100644 --- a/doc/handbook/5_structure.tex +++ b/doc/handbook/5_structure.tex @@ -7,7 +7,7 @@ \item \texttt{cmake}: the configuration options for building \Dumux \item \texttt{doc}: files necessary for the Doxygen documentation and this handbook, and various logos \item \texttt{dumux}: the main folder, containing the source files. See Fig. \ref{fig:dumux-structure} - for a visualized structure. For more information on the models have a look at the + for a visualized structure. For more information on the models, have a look at the Doxygen documentation. \item \texttt{examples}: well-documented examples of applying \Dumux to typical physical problems. In the \texttt{README.md} files, the setup is explained, the used code is presented and documented and images resulting from the simulation are included. The \texttt{README.md} files are located directly in the subfolders of \texttt{examples} and can be displayed by web browsers. \item \texttt{test}: tests for each numerical model and some functionality. diff --git a/doc/handbook/6_basics.tex b/doc/handbook/6_basics.tex index 9820c770e5dd611dd5fad31cde3e006e0386686e..d5a36c5b3c4c73d33cd19a477d331d4a5b8d0c21 100644 --- a/doc/handbook/6_basics.tex +++ b/doc/handbook/6_basics.tex @@ -390,5 +390,5 @@ Using the assumption of ideal gases and either Dalton's law or Amagat's law lead \subsection{Available Models} A list of all available models can be found in the Doxygen documentation at -\url{http://www.dumux.org/doxygen-stable/html-\DumuxVersion/modules.php}. +\url{https://dumux.org/docs/doxygen/releases/\DumuxVersion/modules.html}. The documentation includes a detailed description for every model. diff --git a/doc/handbook/6_stepsofasimulation.tex b/doc/handbook/6_stepsofasimulation.tex index a820e5f73d8dcaf8273bcfa64719341228386b20..a2d7c0292ba817b9df3e3a5243e63e0a19c2ea22 100644 --- a/doc/handbook/6_stepsofasimulation.tex +++ b/doc/handbook/6_stepsofasimulation.tex @@ -61,4 +61,4 @@ solution scheme is illustrated down to the element level. \subsection{Structure -- by Implementation} A possible starting point to understand how the above mentioned algorithm is implemented within \Dumux, is the example main file -\url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/releases/3.2/exercises/exercise-mainfile/exercise_1p_a.cc} +\url{https://git.iws.uni-stuttgart.de/dumux-repositories/dumux-course/-/blob/releases/\DumuxVersion/exercises/exercise-mainfile/exercise1pamain.cc} diff --git a/dumux/common/deprecated.hh b/dumux/common/deprecated.hh index 9164b15ce1c0fcf98e0a82bb7ba063a85e8f84c8..f846e730f5410ad21e445fdee69626e67d364be2 100644 --- a/dumux/common/deprecated.hh +++ b/dumux/common/deprecated.hh @@ -237,7 +237,7 @@ auto makePcKrSw(const Scalar& scalar, { using GlobalPosition = typename Element::Geometry::GlobalCoordinate; constexpr bool hasNew = decltype(isValid(HasNewFIAIF()).template check())::value; - constexpr bool hasNewAtPos = decltype(isValid(HasNewFIAIFAtPos()).template check())::value; + [[maybe_unused]] constexpr bool hasNewAtPos = decltype(isValid(HasNewFIAIFAtPos()).template check())::value; if constexpr (hasNew) return sp.fluidMatrixInteraction(element, scv, elemSol); else if constexpr (hasNewAtPos) diff --git a/dumux/common/timeloop.hh b/dumux/common/timeloop.hh index 9086c67689d6e91b41012f98a532f0c1433c7c96..3ef05bbbc37980a9f5b4c294a25a0f8078260ca3 100644 --- a/dumux/common/timeloop.hh +++ b/dumux/common/timeloop.hh @@ -348,7 +348,8 @@ public: if (verbose_) { const auto cpuTime = wallClockTime(); - const auto percent = std::round( time_ / endTime_ * 100 ); + using std::round; + const auto percent = round( time_ / endTime_ * 100 ); std::cout << Fmt::format("[{:3.0f}%] ", percent) << Fmt::format("Time step {} done in {:.2g} seconds. ", timeStepIdx_, timeStepWallClockTime_) << Fmt::format("Wall clock time: {:.2g}, time: {:.5g}, time step size: {:.5g}\n", cpuTime, time_, previousTimeStepSize_); diff --git a/dumux/io/grid/cakegridmanager.hh b/dumux/io/grid/cakegridmanager.hh index e0184eec39d77ce9b1751416b97d58866d5b097f..5bfa0a41b2ea695e26cc220c3ca6c73c1c60abf3 100644 --- a/dumux/io/grid/cakegridmanager.hh +++ b/dumux/io/grid/cakegridmanager.hh @@ -83,7 +83,7 @@ public: * - Axial : min/max value for axial coordinate * Adding 0, 1 (or 2 in 3D) specifies in which direction (x, y and z, respectively) * the radial, angular and axial direction are oriented - * - Cells : number of cells array for x-coordinate (Again, an added 0, 1 or 3 specifies x, y or z + * - Cells : number of cells array for x-coordinate (Again, an added 0, 1 or 2 specifies x, y or z) * - Grading : grading factor array for x-coordinate (Same here) * - Verbosity : whether the grid construction should output to standard out * diff --git a/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh b/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh index 95726acdda4208d74a52f69617933c3c727619e7..cdb7793cc4cd551ae6e65d7f0c6910099d14da1c 100644 --- a/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh +++ b/dumux/material/fluidmatrixinteractions/3p/regularizedparkervangen3p.hh @@ -375,7 +375,7 @@ public: } // For very low gas saturations: - // We use a scaling factor that decreases the gas phase permeability quite fast a very low gas phase + // We use a scaling factor that decreases the gas phase permeability quite fast at very low gas phase // saturations, thus making that phase virtually immobile. // This prevents numerical issues related to the degeneration of the gas phase mass balance for the 3p3c model // at very low gas phase saturations. diff --git a/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh b/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh index 586d42ee7fa6200b76efc62e09caadf957b93f73..9c8e331be207a8f746c3ae216a37613d3365ddef 100644 --- a/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh +++ b/dumux/material/fluidmatrixinteractions/diffusivitymillingtonquirk.hh @@ -72,7 +72,7 @@ public: using std::max; const Scalar diffCoeff = volVars.diffusionCoefficient(phaseIdx, compIdxI, compIdxJ); const Scalar porosity = volVars.porosity(); - const Scalar sat = max(volVars.saturation(phaseIdx), 0.0); + const Scalar sat = max(volVars.saturation(phaseIdx), 0.0); return porosity * (sat*sat*sat) * cbrt(porosity * sat) * diffCoeff; } diff --git a/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh b/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh index 74abc3f422d8b2d12f60b8ccac5f3b241e6f223e..067b24a8df2404d83719ada86ac04097695660ec 100644 --- a/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh +++ b/dumux/material/fluidmatrixinteractions/fluidmatrixinteraction.hh @@ -50,7 +50,7 @@ struct FluidMatrixInteraction : public Laws... template auto makeFluidMatrixInteraction(Laws&&... laws) { - return FluidMatrixInteraction(wrap(std::forward(laws))...); + return FluidMatrixInteraction(wrap(std::forward(laws))...); } } // end namespace Dumux @@ -79,7 +79,7 @@ class PcKrSw public: using Scalar = typename std::decay_t::Scalar; - using PcKrSwType = const T; + using PcKrSwType = T; PcKrSw(T&& impl) : impl_(std::forward(impl)) {} @@ -97,7 +97,7 @@ public: const T& krSwCurve() const { return impl_; } private: - const T impl_; + T impl_; }; /*! @@ -129,7 +129,7 @@ public: const T& multiPhasePcKrS() const { return impl_; } private: - const T impl_; + T impl_; }; /*! @@ -149,9 +149,9 @@ template struct ThreePhasePcKrSw { using Scalar = typename std::decay_t::Scalar; - using value_type = const T; + using value_type = T; - using PcKrSwType = const T; + using PcKrSwType = T; ThreePhasePcKrSw(T&& impl) : impl_(std::forward(impl)) {} @@ -168,7 +168,7 @@ struct ThreePhasePcKrSw const T& pcSwCurve() const { return impl_; } const T& krSwCurve() const { return impl_; } private: - const T impl_; + T impl_; }; /*! @@ -191,7 +191,7 @@ public: WettingNonwettingInterfacialAreaPcSw(T&& impl) : impl_(std::forward(impl)) {} const T& wettingNonwettingInterface() const { return impl_; } private: - const T impl_; + T impl_; }; /*! @@ -214,7 +214,7 @@ public: WettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward(impl)) {} const T& wettingSolidInterface() const { return impl_; } private: - const T impl_; + T impl_; }; /*! @@ -237,7 +237,7 @@ public: NonwettingSolidInterfacialAreaPcSw(T&& impl) : impl_(std::forward(impl)) {} const T& nonwettingSolidInterface() const { return impl_; } private: - const T impl_; + T impl_; }; /*! @@ -263,7 +263,7 @@ public: Adsorption(T&& impl) : impl_(std::forward(impl)) {} const T& adsorptionModel() const { return impl_; } private: - const T impl_; + T impl_; }; /*! diff --git a/dumux/multidomain/subdomainboxlocalassembler.hh b/dumux/multidomain/subdomainboxlocalassembler.hh index e70259f712fa839bda287c2923c1d11470e8e1cf..2cab40adc1046a2f88d0f06d62e911f69e179c00 100644 --- a/dumux/multidomain/subdomainboxlocalassembler.hh +++ b/dumux/multidomain/subdomainboxlocalassembler.hh @@ -118,21 +118,55 @@ public: this->asImp_().bindLocalViews(); this->elemBcTypes().update(problem(), this->element(), this->fvGeometry()); - // for the diagonal jacobian block - // forward to the internal implementation - const auto residual = this->asImp_().assembleJacobianAndResidualImpl(jacRow[domainId], *std::get(gridVariables)); + if (!this->elementIsGhost()) + { + // for the diagonal jacobian block + // forward to the internal implementation + const auto residual = this->asImp_().assembleJacobianAndResidualImpl(jacRow[domainId], *std::get(gridVariables)); - // update the residual vector - for (const auto& scv : scvs(this->fvGeometry())) - res[scv.dofIndex()] += residual[scv.localDofIndex()]; + // update the residual vector + for (const auto& scv : scvs(this->fvGeometry())) + res[scv.dofIndex()] += residual[scv.localDofIndex()]; - // assemble the coupling blocks - using namespace Dune::Hybrid; - forEach(integralRange(Dune::Hybrid::size(jacRow)), [&](auto&& i) + // assemble the coupling blocks + using namespace Dune::Hybrid; + forEach(integralRange(Dune::Hybrid::size(jacRow)), [&](auto&& i) + { + if (i != id) + this->assembleJacobianCoupling(i, jacRow, residual, gridVariables); + }); + } + else { - if (i != id) - this->assembleJacobianCoupling(i, jacRow, residual, gridVariables); - }); + using GridGeometry = typename GridVariables::GridGeometry; + using GridView = typename GridGeometry::GridView; + static constexpr auto dim = GridView::dimension; + + int numVerticesLocal = this->element().subEntities(dim); + + for (int i = 0; i < numVerticesLocal; ++i) + { + const auto vertex = this->element().template subEntity(i); + + if (vertex.partitionType() == Dune::InteriorEntity || + vertex.partitionType() == Dune::BorderEntity) + { + // do not change the non-ghost vertices + continue; + } + + // set main diagonal entries for the vertex + const auto vIdx = this->assembler().gridGeometry(domainId).vertexMapper().index(vertex); + + typedef typename JacobianMatrix::block_type BlockType; + BlockType &J = jacRow[domainId][vIdx][vIdx]; + for (int j = 0; j < BlockType::rows; ++j) + J[j][j] = 1.0; + + // set residual for the vertex + res[vIdx] = 0; + } + } // lambda for the incorporation of Dirichlet Bcs auto applyDirichlet = [&] (const auto& scvI, diff --git a/dumux/multidomain/subdomaincclocalassembler.hh b/dumux/multidomain/subdomaincclocalassembler.hh index 12bd85cde509f826da298afd5c710cb876421fec..54c1a9768265be5db918f1c692a2387f9c9afa8b 100644 --- a/dumux/multidomain/subdomaincclocalassembler.hh +++ b/dumux/multidomain/subdomaincclocalassembler.hh @@ -337,6 +337,17 @@ public: Residuals origResiduals(numNeighbors + 1); origResiduals = 0.0; origResiduals[0] = this->evalLocalResidual()[0]; + // lambda for convenient evaluation of the fluxes across scvfs in the neighbors + // if the neighbor is a ghost we don't want to add anything to their residual + // so we return 0 and omit computing the flux + const auto evalNeighborFlux = [&] (const auto& neighbor, const auto& scvf) + { + if (neighbor.partitionType() == Dune::GhostEntity) + return LocalResidualValues(0.0); + else + return this->evalFluxResidual(neighbor, scvf); + }; + // get the elements in which we need to evaluate the fluxes // and calculate these in the undeflected state unsigned int j = 1; @@ -344,7 +355,7 @@ public: { neighborElements[j-1] = gridGeometry.element(dataJ.globalJ); for (const auto scvfIdx : dataJ.scvfsJ) - origResiduals[j] += this->evalFluxResidual(neighborElements[j-1], fvGeometry.scvf(scvfIdx)); + origResiduals[j] += evalNeighborFlux(neighborElements[j-1], fvGeometry.scvf(scvfIdx)); ++j; } @@ -368,12 +379,7 @@ public: for (int pvIdx = 0; pvIdx < numEq; ++pvIdx) { - // for ghost elements we assemble a 1.0 where the primary variable and zero everywhere else - // as we always solve for a delta of the solution with repect to the initial solution this - // results in a delta of zero for ghosts, we still need to do the neighbor derivatives though - // so we are not done yet here. partialDerivs = 0.0; - if (this->elementIsGhost()) partialDerivs[0][pvIdx] = 1.0; auto evalResiduals = [&](Scalar priVar) { @@ -388,12 +394,12 @@ public: gridVariables.gridFluxVarsCache().updateElement(element, fvGeometry, curElemVolVars); // calculate the residual with the deflected primary variables - if (!this->elementIsGhost()) partialDerivsTmp[0] = this->evalLocalResidual()[0]; + partialDerivsTmp[0] = this->evalLocalResidual()[0]; // calculate the fluxes in the neighbors with the deflected primary variables for (std::size_t k = 0; k < connectivityMap[globalI].size(); ++k) for (auto scvfIdx : connectivityMap[globalI][k].scvfsJ) - partialDerivsTmp[k+1] += this->evalFluxResidual(neighborElements[k], fvGeometry.scvf(scvfIdx)); + partialDerivsTmp[k+1] += evalNeighborFlux(neighborElements[k], fvGeometry.scvf(scvfIdx)); return partialDerivsTmp; }; @@ -404,6 +410,15 @@ public: NumericDifferentiation::partialDerivative(evalResiduals, elemSol[0][pvIdx], partialDerivs, origResiduals, eps_(elemSol[0][pvIdx], pvIdx), numDiffMethod); + // Correct derivative for ghost elements, i.e. set a 1 for the derivative w.r.t. the + // current primary variable and a 0 elsewhere. As we always solve for a delta of the + // solution with repect to the initial one, this results in a delta of 0 for ghosts. + if (this->elementIsGhost()) + { + partialDerivs[0] = 0.0; + partialDerivs[0][pvIdx] = 1.0; + } + // add the current partial derivatives to the global jacobian matrix if constexpr (Problem::enableInternalDirichletConstraints()) { @@ -788,6 +803,17 @@ public: template LocalResidualValues assembleJacobianAndResidualImpl(JacobianMatrixDiagBlock& A, GridVariables& gridVariables) { + // treat ghost separately, we always want zero update for ghosts + if (this->elementIsGhost()) + { + const auto globalI = this->assembler().gridGeometry(domainI).elementMapper().index(this->element()); + for (int pvIdx = 0; pvIdx < numEq; ++pvIdx) + A[globalI][globalI][pvIdx][pvIdx] = 1.0; + + // return zero residual + return LocalResidualValues(0.0); + } + // get some aliases for convenience const auto& problem = this->problem(); const auto& element = this->element(); diff --git a/dumux/nonlinear/newtonsolver.hh b/dumux/nonlinear/newtonsolver.hh index b33f113a46d5ad5f16f7c117120f02b620dfeda5..647a0c6ba28ff9b7ad92e0d969a1002bab4d9b8f 100644 --- a/dumux/nonlinear/newtonsolver.hh +++ b/dumux/nonlinear/newtonsolver.hh @@ -444,12 +444,18 @@ public: { if (numSteps_ == 0) { - Scalar norm2 = b.two_norm2(); - if (comm_.size() > 1) - norm2 = comm_.sum(norm2); + if constexpr (Detail::hasNorm()) + initialResidual_ = this->linearSolver().norm(b); - using std::sqrt; - initialResidual_ = sqrt(norm2); + else + { + Scalar norm2 = b.two_norm2(); + if (comm_.size() > 1) + norm2 = comm_.sum(norm2); + + using std::sqrt; + initialResidual_ = sqrt(norm2); + } } // solve by calling the appropriate implementation depending on whether the linear solver @@ -789,7 +795,10 @@ protected: void computeResidualReduction_(const SolutionVector &uCurrentIter) { if constexpr (Detail::hasNorm()) - residualNorm_ = this->linearSolver().norm(uCurrentIter); + { + this->assembler().assembleResidual(uCurrentIter); + residualNorm_ = this->linearSolver().norm(this->assembler().residual()); + } else residualNorm_ = this->assembler().residualNorm(uCurrentIter); diff --git a/dumux/porousmediumflow/velocity.hh b/dumux/porousmediumflow/velocity.hh index 577afc490ea19f0f22b9849dea110e4163086867..f56891f728fefaaca523929cf3adacefe10a849c 100644 --- a/dumux/porousmediumflow/velocity.hh +++ b/dumux/porousmediumflow/velocity.hh @@ -170,7 +170,7 @@ public: } // get the transposed Jacobian of the element mapping - const auto refElement = referenceElement(geometry); + const auto refElement = Dune::referenceElement(geometry); const auto& localPos = refElement.position(0, 0); const auto jacobianT2 = geometry.jacobianTransposed(localPos); diff --git a/dune.module b/dune.module index a7f10f50c633622a25a23bf0bb13a9f4dadf584f..c29acf28c5bc9ce7f61171b011fa4f73ed3758bb 100644 --- a/dune.module +++ b/dune.module @@ -1,5 +1,5 @@ Module: dumux -Version: 3.3-git +Version: 3.3.0 Maintainer: dumux@listserv.uni-stuttgart.de Depends: dune-common (>= 2.7) dune-grid (>= 2.7) dune-localfunctions (>= 2.7) dune-istl (>= 2.7) Suggests: dune-alugrid (>=2.7) dune-foamgrid (>=2.7) dune-uggrid (>=2.7) dune-functions (>=2.7) opm-common opm-grid dune-subgrid dune-spgrid (>= 2.7) dune-mmesh (>= 1.1) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index d839bb9070763a61d4c6ef60ba1f444230753da6..a18c2908e8c99485bbc83ac3e64d75d350c90408 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -4,3 +4,4 @@ add_subdirectory(biomineralization) add_subdirectory(shallowwaterfriction) add_subdirectory(freeflowchannel) add_subdirectory(1protationsymmetry) +add_subdirectory(liddrivencavity) diff --git a/examples/README.md b/examples/README.md index 8f3fc62a4fea95e70068e964ea73a469b73475a6..4c5b8d7762e4fea7c0ebcfc3b66325d80e98f022 100644 --- a/examples/README.md +++ b/examples/README.md @@ -112,3 +112,20 @@ You learn how to
biomin result
+ +### [:open_file_folder: Example 7: Lid-driven cavity](liddrivencavity/README.md) + + + + +
+ +In this example, we simulate laminar incompressible flow in a cavity with the Navier-Stokes equations. +You learn how to + +* solve a single-phase Navier-Stokes flow problem +* compare the results of Stokes flow (Re = 1) and Navier-Stokes flow (Re = 1000) +* compare the numerical results with the reference data using the plotting library `matplotlib` + + +
liddriven result
diff --git a/examples/liddrivencavity/.doc_config b/examples/liddrivencavity/.doc_config new file mode 100644 index 0000000000000000000000000000000000000000..530d73c8ed3017f8164fb5880aa86ec3b075b29b --- /dev/null +++ b/examples/liddrivencavity/.doc_config @@ -0,0 +1,28 @@ +{ + "README.md" : [ + "doc/_intro.md" + ], + + "doc/problem.md" : [ + "doc/problem_intro.md", + "properties.hh", + "problem.hh", + "main.cc" + ], + + "doc/postprocessing.md" : [ + "doc/postprocessing_text.md" + ], + + "navigation" : { + "mainpage" : "README.md", + "subpages" : [ + "doc/problem.md", + "doc/postprocessing.md" + ], + "subtitles" : [ + "Implementation", + "Post-processing" + ] + } +} diff --git a/examples/liddrivencavity/CMakeLists.txt b/examples/liddrivencavity/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..008e2b11786a8fc0d477dee3061c740827d2f7ec --- /dev/null +++ b/examples/liddrivencavity/CMakeLists.txt @@ -0,0 +1,41 @@ +add_subdirectory(reference_data) +dune_symlink_to_source_files(FILES "params_re1.input" "params_re1000.input" "run_and_plot.py") + +# set the test guard for the following tests (only enable test if UMFPack is available) +set(DUMUX_EXAMPLE_LDC_CMAKE_GUARD "( HAVE_UMFPACK )") + +dumux_add_test(NAME example_ff_liddrivencavity + SOURCES main.cc + LABELS freeflow navierstokes example + CMAKE_GUARD ${DUMUX_EXAMPLE_LDC_CMAKE_GUARD} + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/test_ff_navierstokes_closedsystem_ldc_re1-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/example_ff_liddrivencavity_re1-00002.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/example_ff_liddrivencavity params_re1.input + -Grid.Cells \"64 64\"") + +dumux_add_test(NAME example_ff_liddrivencavity_re1000 + TARGET example_ff_liddrivencavity + LABELS freeflow navierstokes example + COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py + CMD_ARGS --script fuzzy + --files ${CMAKE_SOURCE_DIR}/test/references/test_ff_navierstokes_closedsystem_ldc_re1000-reference.vtu + ${CMAKE_CURRENT_BINARY_DIR}/example_ff_liddrivencavity_re1000-00009.vtu + --command "${CMAKE_CURRENT_BINARY_DIR}/example_ff_liddrivencavity params_re1000.input + -Grid.Cells \"64 64\" -TimeLoop.TEnd 50") + +# test plot script (only if the guard enables to TRUE, i.e. all preconditions for the above tests are met) +dumux_evaluate_cmake_guard(DUMUX_ENABLE_LDC_PLOT_TEST + CMAKE_GUARD ${DUMUX_EXAMPLE_LDC_CMAKE_GUARD}) + +if (DUMUX_ENABLE_LDC_PLOT_TEST) + dumux_add_test(NAME example_ff_liddrivencavity_plot + TARGET example_ff_liddrivencavity + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/run_and_plot.py + CMD_ARGS -s -n) + + set_tests_properties(example_ff_liddrivencavity_plot + PROPERTIES LABELS example + DEPENDS "example_ff_liddrivencavity;example_ff_liddrivencavity_re1000") +endif() diff --git a/examples/liddrivencavity/README.md b/examples/liddrivencavity/README.md new file mode 100644 index 0000000000000000000000000000000000000000..fc695a9400f8627cb25c4e02d8ba555741f4ca6f --- /dev/null +++ b/examples/liddrivencavity/README.md @@ -0,0 +1,76 @@ + + +# Shear-driven cavity flow + +We use the Navier-Stokes equations to simulate laminar incompressible flow in a +cavity whose lid moves with a constant velocity u = 1 m/s. +We will verify the numerical model by comparing the simulation results with reference data published in [Ghia et al. (1982)](https://doi.org/10.1016/0021-9991(82)90058-4) and [Jurjević (1999)](https://doi.org/10.1002/(SICI)1097-0363(19991015)31:3<601::AID-FLD892>3.0.CO;2-Z). + +__Results__. After simulating a few time steps, we will obtain the following velocity field for Reynolds number Re = 1 and Re = 1000: +
+
+ Numerical results +
Fig.1 - Steady velocity field for Stokes (left) and Navier-Stokes flow for the lid-driven cavity problem.
+
+
+Our numerical results agree well with the reference data: +
+
+ Lid-driven cavity verification +
+
Fig.2 - Horizontal and vertical velocity profiles at x = 0.5 m and y = 0.5 m for Re = 1 (left) and Re = 1000 (right). exp: experimental data; num: numerical data.
+
+ +__In this example, you will__ + +* solve a single-phase Navier-Stokes flow problem +* see the differences between Stokes flow (Re = 1) and Navier-Stokes flow (Re = 1000) +* compare the numerical results with the reference data using the plotting library `matplotlib` + +__Table of contents__. This description is structured as follows: + +[[_TOC_]] + +## Problem setup + +Flow in a cavity with the dimensions 1 m × 1 m is considered, where the top lid is +moving at a constant speed of 1 m/s to the right. + +The following figure illustrates the setup: + +
+
+ Lid-driven cavity setup +
Fig.3 - Setup for the lid-driven cavity problem.
+
+
+ +Two different flow regimes at Re = 1 ($`\nu = 1`$ $`\text{m}^2/\text{s}`$) and Re = 1000 ($`\nu = 1000`$ $`\text{m}^2/\text{s}`$) are simulated, where the Reynolds number is defined with respect to the cavity’s side length. + +## Mathematical & numerical models + +Mass and momentum balance are given by + +```math +\nabla \cdot \bold{v} =0, +``` +```math + \frac{(\partial\rho\bold{v})}{\partial t} + \nabla \cdot (\rho\bold{v}\bold{v}^{\text{T}}) =\nabla\cdot\left[\mu\left(\nabla\bold{v}+\nabla\bold{v}^{\text{T}}\right)\right]- \nabla p, +``` + +where $`\bold{v}`$ and p are the velocity and pressure of the fluid (primary variables). $`\rho`$ and $`\mu=\rho\nu`$ are the mass density and dynamic viscosity (fluid properties). + +All equations are discretized with the staggered-grid finite-volume scheme as spatial discretization with pressures and velocity components as primary variables. For details on the discretization scheme, we refer to the DuMux [handbook](https://dumux.org/docs/handbook/master/dumux-handbook.pdf). + +# Implementation & Postprocessing + +## Part 1: Implementation + +| [:arrow_right: Click to continue with part 1 of the documentation](doc/problem.md) | +|---:| + + +## Part 2: Post-processing + +| [:arrow_right: Click to continue with part 2 of the documentation](doc/postprocessing.md) | +|---:| diff --git a/examples/liddrivencavity/doc/_intro.md b/examples/liddrivencavity/doc/_intro.md new file mode 100644 index 0000000000000000000000000000000000000000..c0de3615e964b6b90bd13adecc4d677e4c4bdcdc --- /dev/null +++ b/examples/liddrivencavity/doc/_intro.md @@ -0,0 +1,63 @@ +# Shear-driven cavity flow + +We use the Navier-Stokes equations to simulate laminar incompressible flow in a +cavity whose lid moves with a constant velocity u = 1 m/s. +We will verify the numerical model by comparing the simulation results with reference data published in [Ghia et al. (1982)](https://doi.org/10.1016/0021-9991(82)90058-4) and [Jurjević (1999)](https://doi.org/10.1002/(SICI)1097-0363(19991015)31:3<601::AID-FLD892>3.0.CO;2-Z). + +__Results__. After simulating a few time steps, we will obtain the following velocity field for Reynolds number Re = 1 and Re = 1000: +
+
+ Numerical results +
Fig.1 - Steady velocity field for Stokes (left) and Navier-Stokes flow for the lid-driven cavity problem.
+
+
+Our numerical results agree well with the reference data: +
+
+ Lid-driven cavity verification +
+
Fig.2 - Horizontal and vertical velocity profiles at x = 0.5 m and y = 0.5 m for Re = 1 (left) and Re = 1000 (right). exp: experimental data; num: numerical data.
+
+ +__In this example, you will__ + +* solve a single-phase Navier-Stokes flow problem +* see the differences between Stokes flow (Re = 1) and Navier-Stokes flow (Re = 1000) +* compare the numerical results with the reference data using the plotting library `matplotlib` + +__Table of contents__. This description is structured as follows: + +[[_TOC_]] + +## Problem setup + +Flow in a cavity with the dimensions 1 m × 1 m is considered, where the top lid is +moving at a constant speed of 1 m/s to the right. + +The following figure illustrates the setup: + +
+
+ Lid-driven cavity setup +
Fig.3 - Setup for the lid-driven cavity problem.
+
+
+ +Two different flow regimes at Re = 1 ($`\nu = 1`$ $`\text{m}^2/\text{s}`$) and Re = 1000 ($`\nu = 1000`$ $`\text{m}^2/\text{s}`$) are simulated, where the Reynolds number is defined with respect to the cavity’s side length. + +## Mathematical & numerical models + +Mass and momentum balance are given by + +```math +\nabla \cdot \bold{v} =0, +``` +```math + \frac{(\partial\rho\bold{v})}{\partial t} + \nabla \cdot (\rho\bold{v}\bold{v}^{\text{T}}) =\nabla\cdot\left[\mu\left(\nabla\bold{v}+\nabla\bold{v}^{\text{T}}\right)\right]- \nabla p, +``` + +where $`\bold{v}`$ and p are the velocity and pressure of the fluid (primary variables). $`\rho`$ and $`\mu=\rho\nu`$ are the mass density and dynamic viscosity (fluid properties). + +All equations are discretized with the staggered-grid finite-volume scheme as spatial discretization with pressures and velocity components as primary variables. For details on the discretization scheme, we refer to the DuMux [handbook](https://dumux.org/docs/handbook/master/dumux-handbook.pdf). + +# Implementation & Postprocessing diff --git a/examples/liddrivencavity/doc/postprocessing.md b/examples/liddrivencavity/doc/postprocessing.md new file mode 100644 index 0000000000000000000000000000000000000000..600b0d57ec667c5085dac6e9ad9353c48cb88672 --- /dev/null +++ b/examples/liddrivencavity/doc/postprocessing.md @@ -0,0 +1,49 @@ + + + +| [:arrow_left: Back to the main documentation](../README.md) | [:arrow_left: Go back to part 1](problem.md) | +|---|---:| + +# Part 2: Post processing +In this part we first visualize our simulation result and then a verification and validation of the Navier-Stokes model implemented in DuMux is conducted. + +## Step 1. Visualize results with Paraview + +After building the executable, run it with `./example_ff_liddrivencavity params_re1.input` for the low Reynolds number case and +`./example_ff_liddrivencavity params_re1000.input` for the high Reynolds number case, respectively. + +The result files (`.vtu` and `.pvd` files) can be opened with [ParaView](https://www.paraview.org/). +To obtain a visualization as shown in the introduction of this documented example, after loading the result file(s), choose `Filters`>`Common`>`Stream Tracer`. +For Re = 1 and Re = 1000, the result should look like this: + +
+
+ Lid-driven cavity setup +
Fig.1 - Steady velocity field for Stokes (left) and Navier-Stokes flow for the lid-driven cavity problem.
+
+
+ + +## Step 2. Compare our data with reference + +The verification and validation are essential to guarantee the accuracy and credibility of the numerical models. +The velocity components for the velocity components at x = 0.5m and y = 0.5m are obtained as we run the test cases. + +We compare our results with the reference data reconstructed from [Ghia et al.](https://doi.org/10.1016/0021-9991(82)90058-4) and [Jurjević](https://doi.org/10.1002/(SICI)1097-0363(19991015)31:3<601::AID-FLD892>3.0.CO;2-Z). +For convenience, we placed the reference data in the folder named `reference_data`. For instance, the files `ghia_x.csv` and `ghia_y.csv` represent the reference vertical velocity component $`v_x`$ at x = 0.5 m and $`v_y`$ at y = 0.5 m for the scenario Re = 1000, respectively. + +The other files in the folder `reference_data` represent the numerical and experimental data for the scenario Re = 1. +Assuming that you have `python3` with `matplotlib` installed on your device, this comparison process can be done via the script `run_and_plot.py`. Type `python3 run_and_plot.py` in the command and you should see the following plot: + +
+
+ Lid-driven cavity verification +
+
Fig.2 - Horizontal and vertical velocity profiles at x = 0.5 m and y = 0.5 m for Re = 1 (left) and Re = 1000 (right).
+
+ +It can be seen that the numerical results calculated by DuMux are in good agreement with the reference data. + +| [:arrow_left: Back to the main documentation](../README.md) | [:arrow_left: Go back to part 1](problem.md) | +|---|---:| + diff --git a/examples/liddrivencavity/doc/postprocessing_text.md b/examples/liddrivencavity/doc/postprocessing_text.md new file mode 100644 index 0000000000000000000000000000000000000000..02cc22c670fd90865dd64eeab15b85c743bd356c --- /dev/null +++ b/examples/liddrivencavity/doc/postprocessing_text.md @@ -0,0 +1,39 @@ +# Part 2: Post processing +In this part we first visualize our simulation result and then a verification and validation of the Navier-Stokes model implemented in DuMux is conducted. + +## Step 1. Visualize results with Paraview + +After building the executable, run it with `./example_ff_liddrivencavity params_re1.input` for the low Reynolds number case and +`./example_ff_liddrivencavity params_re1000.input` for the high Reynolds number case, respectively. + +The result files (`.vtu` and `.pvd` files) can be opened with [ParaView](https://www.paraview.org/). +To obtain a visualization as shown in the introduction of this documented example, after loading the result file(s), choose `Filters`>`Common`>`Stream Tracer`. +For Re = 1 and Re = 1000, the result should look like this: + +
+
+ Lid-driven cavity setup +
Fig.1 - Steady velocity field for Stokes (left) and Navier-Stokes flow for the lid-driven cavity problem.
+
+
+ + +## Step 2. Compare our data with reference + +The verification and validation are essential to guarantee the accuracy and credibility of the numerical models. +The velocity components for the velocity components at x = 0.5m and y = 0.5m are obtained as we run the test cases. + +We compare our results with the reference data reconstructed from [Ghia et al.](https://doi.org/10.1016/0021-9991(82)90058-4) and [Jurjević](https://doi.org/10.1002/(SICI)1097-0363(19991015)31:3<601::AID-FLD892>3.0.CO;2-Z). +For convenience, we placed the reference data in the folder named `reference_data`. For instance, the files `ghia_x.csv` and `ghia_y.csv` represent the reference vertical velocity component $`v_x`$ at x = 0.5 m and $`v_y`$ at y = 0.5 m for the scenario Re = 1000, respectively. + +The other files in the folder `reference_data` represent the numerical and experimental data for the scenario Re = 1. +Assuming that you have `python3` with `matplotlib` installed on your device, this comparison process can be done via the script `run_and_plot.py`. Type `python3 run_and_plot.py` in the command and you should see the following plot: + +
+
+ Lid-driven cavity verification +
+
Fig.2 - Horizontal and vertical velocity profiles at x = 0.5 m and y = 0.5 m for Re = 1 (left) and Re = 1000 (right).
+
+ +It can be seen that the numerical results calculated by DuMux are in good agreement with the reference data. diff --git a/examples/liddrivencavity/doc/problem.md b/examples/liddrivencavity/doc/problem.md new file mode 100644 index 0000000000000000000000000000000000000000..db1433f327cf4407d41ad2d7ccc85e93c815f370 --- /dev/null +++ b/examples/liddrivencavity/doc/problem.md @@ -0,0 +1,556 @@ + + + +| [:arrow_left: Back to the main documentation](../README.md) | [:arrow_right: Continue with part 2](postprocessing.md) | +|---|---:| + +# Part 1: Implementation + +The implementation of simulation setup and main flow is structured as follows: + +[[_TOC_]] + + +## Compile-time settings (`properties.hh`) + +In this file, the type tag used for this simulation is defined, +for which we then specialize properties (compile time options) to the needs of the desired setup. + + +
+Click to hide/show the file documentation (or inspect the [source code](../properties.hh)) + + +### Includes +
Click to show includes + +The `NavierStokes` type tag specializes most of the properties required for Navier- +Stokes single-phase flow simulations in DuMuX. We will use this in the following to inherit the +respective properties and subsequently specialize those properties for our +type tag, which we want to modify or for which no meaningful default can be set. + +```cpp +#include +``` + +We want to use `YaspGrid`, an implementation of the dune grid interface for structured grids: + +```cpp +#include +``` + +In this example, we want to discretize the equations with the staggered-grid +scheme which is so far the only available option for free-flow models in DuMux: + +```cpp +#include +``` + +The fluid properties are specified in the following headers (we use a liquid with constant properties as the fluid phase): + +```cpp +#include +#include +``` + +We include the problem header used for this simulation. + +```cpp +#include "problem.hh" +``` + +
+ +### Type tag definition + +We define a type tag for our simulation with the name `LidDrivenCavityExample` +and inherit the properties specialized for the type tags `NavierStokes` and `StaggeredFreeFlowModel`. + +```cpp + +namespace Dumux::Properties { + +// We define the `LidDrivenCavityExample` type tag and let it inherit from the single-phase `NavierStokes` +// tag (model) and the `StaggeredFreeFlowModel` (discretization scheme). +namespace TTag { +struct LidDrivenCavityExample { using InheritsFrom = std::tuple; }; +} // end namespace TTag +``` + +### Property specializations + +In the following piece of code, mandatory properties for which no meaningful +default exist are specialized for our type tag `LidDrivenCavityExample`. + +```cpp +// This sets the fluid system to be used. Here, we use a liquid with constant properties as fluid phase. +template +struct FluidSystem +{ + using Scalar = GetPropType; + using type = FluidSystems::OnePLiquid >; +}; + +// This sets the grid type used for the simulation. Here, we use a structured 2D grid. +template +struct Grid { using type = Dune::YaspGrid<2>; }; + +// This sets our problem class (see problem.hh) containing initial and boundary conditions. +template +struct Problem { using type = Dumux::LidDrivenCavityExampleProblem ; }; +``` + +We also set some properties related to memory management +throughout the simulation. +
Click to show caching properties + +In Dumux, one has the option to activate/deactivate the grid-wide caching of +geometries and variables. If active, the CPU time can be significantly reduced +as less dynamic memory allocation procedures are necessary. Per default, grid-wide +caching is disabled to ensure minimal memory requirements, however, in this example we +want to active all available caches, which significantly increases the memory +demand but makes the simulation faster. + + +```cpp +// This enables grid-wide caching of the volume variables. +template +struct EnableGridGeometryCache { static constexpr bool value = true; }; +//This enables grid wide caching for the flux variables. +template +struct EnableGridFluxVariablesCache { static constexpr bool value = true; }; +// This enables grid-wide caching for the finite volume grid geometry +template +struct EnableGridVolumeVariablesCache { static constexpr bool value = true; }; +} // end namespace Dumux::Properties +``` + +
+ +
+ + + +## Initial and boundary conditions (`problem.hh`) + +This file contains the __problem class__ which defines the initial and boundary +conditions for the Navier-Stokes single-phase flow simulation. + + +
+Click to hide/show the file documentation (or inspect the [source code](../problem.hh)) + + +### Include files + + +```cpp +#include +#include +``` + +Include the `NavierStokesProblem` class, the base +class from which we will derive. + +```cpp +#include +``` + +Include the `NavierStokesBoundaryTypes` class which specifies the boundary types set in this problem. + +```cpp +#include +``` + +### The problem class +As we are solving a problem related to free flow, we create a new class called `LidDrivenCavityExampleProblem` +and let it inherit from the class `NavierStokesProblem`. + +```cpp +namespace Dumux { +template +class LidDrivenCavityExampleProblem : public NavierStokesProblem +{ + using ParentType = NavierStokesProblem; + + using BoundaryTypes = Dumux::NavierStokesBoundaryTypes::numEq()>; + using GridGeometry = GetPropType; + using FVElementGeometry = typename GridGeometry::LocalView; + using SubControlVolume = typename GridGeometry::SubControlVolume; + using Indices = typename GetPropType::Indices; + using NumEqVector = GetPropType; + using PrimaryVariables = GetPropType; + using Scalar = GetPropType; + + using Element = typename GridGeometry::GridView::template Codim<0>::Entity; + using GlobalPosition = typename Element::Geometry::GlobalCoordinate; + +public: + // Within the constructor, we set the lid velocity to a run-time specified value. + LidDrivenCavityExampleProblem(std::shared_ptr gridGeometry) + : ParentType(gridGeometry) + { + lidVelocity_ = getParam("Problem.LidVelocity"); + } +``` + +#### Temperature distribution +We need to specify a constant temperature for our isothermal problem. +Fluid properties that depend on temperature will be calculated with this value. +This would be important if another fluidsystem was used. + +```cpp + Scalar temperature() const + { return 273.15 + 10; } // 10°C +``` + +#### Boundary conditions +With the following function we define the __type of boundary conditions__ depending on the location. +Three types of boundary conditions can be specified: Dirichlet, Neumann or outflow boundary conditions. On +Dirichlet boundaries, the values of the primary variables need to be fixed. On a Neumann boundaries, +values for derivatives need to be fixed. Outflow conditions set a gradient of zero in normal direction towards the boundary +for the respective primary variables (excluding pressure). +When Dirichlet conditions are set for the pressure, the velocity gradient +with respect to the direction normal to the boundary is automatically set to zero. + +```cpp + BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const + { + BoundaryTypes values; + + // We set Dirichlet values for the velocity at each boundary + values.setDirichlet(Indices::velocityXIdx); + values.setDirichlet(Indices::velocityYIdx); + + return values; + } +``` + +We define a function for setting a fixed Dirichlet pressure value at a given internal cell. +This is required for having a defined pressure level in our closed system domain. + +```cpp + bool isDirichletCell(const Element& element, + const FVElementGeometry& fvGeometry, + const SubControlVolume& scv, + int pvIdx) const + { + auto isLowerLeftCell = [&](const SubControlVolume& scv) + { return scv.dofIndex() == 0; }; +``` + +We set a fixed pressure in one cell + +```cpp + return (isLowerLeftCell(scv) && pvIdx == Indices::pressureIdx); + } +``` + +The following function specifies the __values on Dirichlet boundaries__. +We need to define values for the primary variables (velocity and pressure). + +```cpp + PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const + { + PrimaryVariables values; + values[Indices::pressureIdx] = 1.1e+5; + values[Indices::velocityXIdx] = 0.0; + values[Indices::velocityYIdx] = 0.0; + + // We set the no slip-condition at the top, that means the fluid has the same velocity as the lid + if (globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_) + values[Indices::velocityXIdx] = lidVelocity_; + + return values; + } +``` + +The following function defines the initial conditions. + +```cpp + PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const + { + PrimaryVariables values; + values[Indices::pressureIdx] = 1.0e+5; + values[Indices::velocityXIdx] = 0.0; + values[Indices::velocityYIdx] = 0.0; + + return values; + } +``` + +the data members of the problem class + +```cpp +private: + static constexpr Scalar eps_ = 1e-6; + Scalar lidVelocity_; +}; + +} // end namespace Dumux +``` + + +
+ + + +## The main file (`main.cc`) + +
+Click to hide/show the file documentation (or inspect the [source code](../main.cc)) + + +### Included header files +
Click to show includes +These is DUNE helper class related to parallel computation + +```cpp +#include +``` + +The following headers include functionality related to property definition or retrieval, as well as +the retrieval of input parameters specified in the input file or via the command line. + +```cpp +#include +#include +``` + +The following files contain the non-linear Newton solver, the available linear solver backends and the assembler for the linear +systems arising from the staggered-grid discretization. + +```cpp +#include +#include +#include +``` + +The gridmanager constructs a grid from the information in the input or grid file. +Many different Dune grid implementations are supported, of which a list can be found +in `gridmanager.hh`. + +```cpp +#include +``` + +This class contains functionality for VTK output for models using the staggered finite volume scheme. + +```cpp +#include +``` + +We include the problem header used for this simulation. + +```cpp +#include "properties.hh" +``` + +
+ +The following function writes the velocities and coordinates at x = 0.5 and y = 0.5 into a log file. + +```cpp +template +void writeSteadyVelocityAndCoordinates(const Problem& problem, const SolutionVector &sol, const GridGeometry gridGeometry) +{ + std::ofstream logFilevx(problem->name() + "_vx.log"), logFilevy(problem->name() + "_vy.log"); + logFilevx << "y vx\n"; + logFilevy << "x vy\n"; + + static constexpr double eps_ = 1.0e-7; + for (const auto& element : elements(gridGeometry->gridView())) + { + auto fvGeometry = localView(*gridGeometry); + fvGeometry.bind(element); + for (const auto& scvf : scvfs(fvGeometry)) + { + if (!scvf.boundary() && scvf.insideScvIdx() > scvf.outsideScvIdx()) + { + const auto& globalPos = scvf.ipGlobal(); + const auto velocity = sol[gridGeometry->faceIdx()][scvf.dofIndex()][0]; + + if (std::abs(globalPos[0]-0.5) < eps_) + logFilevx << globalPos[1] << " " << velocity << "\n"; + else if (std::abs(globalPos[1]-0.5) < eps_) + logFilevy << globalPos[0] << " " << velocity << "\n"; + } + } + } +} +``` + +### The main function +We will now discuss the main program flow implemented within the `main` function. +At the beginning of each program using Dune, an instance of `Dune::MPIHelper` has to +be created. Moreover, we parse the run-time arguments from the command line and the +input file: + +```cpp +int main(int argc, char** argv) +{ + using namespace Dumux; + + // The Dune MPIHelper must be instantiated for each program using Dune, it is finalized automatically on exit + const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); + + // parse command line arguments and input file + Parameters::init(argc, argv); +``` + +We define a convenience alias for the type tag of the problem. The type +tag contains all the properties that are needed to define the model and the problem +setup. Throughout the main file, we will obtain types defined for this type tag +using the property system, i.e. with `GetPropType`. + +```cpp + using TypeTag = Properties::TTag::LidDrivenCavityExample; +``` + +#### Step 1: Create the grid +The `GridManager` class creates the grid from information given in the input file. +This can either be a grid file, or in the case of structured grids, one can specify the coordinates +of the corners of the grid and the number of cells to be used to discretize each spatial direction. + +```cpp + GridManager> gridManager; + gridManager.init(); + + // We compute on the leaf grid view. + const auto& leafGridView = gridManager.grid().leafGridView(); +``` + +#### Step 2: Setting up and solving the problem +First, a finite volume grid geometry is constructed from the grid that was created above. +This builds the sub-control volumes (scv) and sub-control volume faces (scvf) for each element +of the grid partition. + +```cpp + using GridGeometry = GetPropType; + auto gridGeometry = std::make_shared(leafGridView); + gridGeometry->update(); +``` + +We now instantiate the problem, in which we define the boundary and initial conditions. + +```cpp + using Problem = GetPropType; + auto problem = std::make_shared(gridGeometry); +``` + +We set a solution vector which consist of two parts: one part (indexed by `cellCenterIdx`) +is for the pressure degrees of freedom (`dofs`) living in grid cell centers. Another part +(indexed by `faceIdx`) is for degrees of freedom defining the normal velocities on grid cell faces. +We initialize the solution vector by what was defined as the initial solution of the the problem. + +```cpp + using SolutionVector = GetPropType; + SolutionVector x; + x[GridGeometry::cellCenterIdx()].resize(gridGeometry->numCellCenterDofs()); + x[GridGeometry::faceIdx()].resize(gridGeometry->numFaceDofs()); + problem->applyInitialSolution(x); + auto xOld = x; +``` + +We use the initial solution vector to intialize the `gridVariables`. +The grid variables are used store variables (primary and secondary variables) on sub-control volumes and faces (volume and flux variables). + +```cpp + using GridVariables = GetPropType; + auto gridVariables = std::make_shared(problem, gridGeometry); + gridVariables->init(x); +``` + +We get some time loop parameters from the input file +and instantiate the time loop + +```cpp + using Scalar = GetPropType; + const auto tEnd = getParam("TimeLoop.TEnd"); + const auto maxDt = getParam("TimeLoop.MaxTimeStepSize"); + const auto dt = getParam("TimeLoop.DtInitial"); + + auto timeLoop = std::make_shared>(0, dt, tEnd); + timeLoop->setMaxTimeStepSize(maxDt); +``` + +We then initialize the predefined model-specific output vtk output. + +```cpp + using IOFields = GetPropType; + StaggeredVtkOutputModule vtkWriter(*gridVariables, x, problem->name()); + IOFields::initOutputModule(vtkWriter); // Add model specific output fields + vtkWriter.write(0.0); +``` + +To solve the non-linear problem at hand, we use the `NewtonSolver`, +which we have to tell how to assemble and solve the system in each +iteration. Here, we use the direct linear solver UMFPack. + +```cpp + using Assembler = StaggeredFVAssembler; + auto assembler = std::make_shared(problem, gridGeometry, gridVariables, timeLoop, xOld); + + using LinearSolver = Dumux::UMFPackBackend; + auto linearSolver = std::make_shared(); + + using NewtonSolver = Dumux::NewtonSolver; + NewtonSolver nonLinearSolver(assembler, linearSolver); +``` + +##### The time loop +In each time step, we solve the non-linear system of equations, write +the current solution into .vtk files and prepare for the next time step. + +```cpp + timeLoop->start(); do + { + // We solve the non-linear system with time step control. + nonLinearSolver.solve(x, *timeLoop); + + // We make the new solution the old solution. + xOld = x; + gridVariables->advanceTimeStep(); + + // We advance to the time loop to the next step. + timeLoop->advanceTimeStep(); + + // We write vtk output for each time step. + vtkWriter.write(timeLoop->time()); + + // We report statistics of this time step. + timeLoop->reportTimeStep(); + + // We set a new dt as suggested by the newton solver for the next time step. + timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); + + } while (!timeLoop->finished()); +``` + +We write the velocities and coordinates at x = 0.5 and y = 0.5 into a file + +```cpp + writeSteadyVelocityAndCoordinates(problem, x, gridGeometry); +``` + +The following piece of code prints a final status report of the time loop +before the program is terminated. + +```cpp + timeLoop->finalize(leafGridView.comm()); + + // print used and unused parameters + if (mpiHelper.rank() == 0) + Parameters::print(); + + return 0; +} // end main +``` + + +
+ + +| [:arrow_left: Back to the main documentation](../README.md) | [:arrow_right: Continue with part 2](postprocessing.md) | +|---|---:| + diff --git a/examples/liddrivencavity/doc/problem_intro.md b/examples/liddrivencavity/doc/problem_intro.md new file mode 100644 index 0000000000000000000000000000000000000000..6ff6d9b269baf68ba6cd3aa4f6e5909f5d5d2ae4 --- /dev/null +++ b/examples/liddrivencavity/doc/problem_intro.md @@ -0,0 +1,5 @@ +# Part 1: Implementation + +The implementation of simulation setup and main flow is structured as follows: + +[[_TOC_]] diff --git a/examples/liddrivencavity/img/lidverification.png b/examples/liddrivencavity/img/lidverification.png new file mode 100644 index 0000000000000000000000000000000000000000..1293cf14dc10fcaaee46a172b3c986f03498dfbe Binary files /dev/null and b/examples/liddrivencavity/img/lidverification.png differ diff --git a/examples/liddrivencavity/img/result.svg b/examples/liddrivencavity/img/result.svg new file mode 100644 index 0000000000000000000000000000000000000000..3640f745a4e57539a42c93343506f282e615851b --- /dev/null +++ b/examples/liddrivencavity/img/result.svg @@ -0,0 +1,367 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/liddrivencavity/img/setup.png b/examples/liddrivencavity/img/setup.png new file mode 100644 index 0000000000000000000000000000000000000000..220b9ee0877bea3ca48f0f4c77e93c36fb0feddb Binary files /dev/null and b/examples/liddrivencavity/img/setup.png differ diff --git a/examples/liddrivencavity/main.cc b/examples/liddrivencavity/main.cc new file mode 100644 index 0000000000000000000000000000000000000000..d8c88134d8293980af9fce9ff33c91e1a519e09b --- /dev/null +++ b/examples/liddrivencavity/main.cc @@ -0,0 +1,223 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *****************************************************************************/ + + // ## The main file (`main.cc`) + // [[content]] + // + // ### Included header files + // [[details]] includes + // [[exclude]] + // Some generic includes. +#include +#include +// [[/exclude]] + +// These is DUNE helper class related to parallel computation +#include + +// The following headers include functionality related to property definition or retrieval, as well as +// the retrieval of input parameters specified in the input file or via the command line. +#include +#include + +// The following files contain the non-linear Newton solver, the available linear solver backends and the assembler for the linear +// systems arising from the staggered-grid discretization. +#include +#include +#include + +// The gridmanager constructs a grid from the information in the input or grid file. +// Many different Dune grid implementations are supported, of which a list can be found +// in `gridmanager.hh`. +#include + +// This class contains functionality for VTK output for models using the staggered finite volume scheme. +#include + +// We include the problem header used for this simulation. +#include "properties.hh" +// [[/details]] +// +// The following function writes the velocities and coordinates at x = 0.5 and y = 0.5 into a log file. +// [[codeblock]] +template +void writeSteadyVelocityAndCoordinates(const Problem& problem, const SolutionVector &sol, const GridGeometry gridGeometry) +{ + std::ofstream logFilevx(problem->name() + "_vx.log"), logFilevy(problem->name() + "_vy.log"); + logFilevx << "y vx\n"; + logFilevy << "x vy\n"; + + static constexpr double eps_ = 1.0e-7; + for (const auto& element : elements(gridGeometry->gridView())) + { + auto fvGeometry = localView(*gridGeometry); + fvGeometry.bind(element); + for (const auto& scvf : scvfs(fvGeometry)) + { + if (!scvf.boundary() && scvf.insideScvIdx() > scvf.outsideScvIdx()) + { + const auto& globalPos = scvf.ipGlobal(); + const auto velocity = sol[gridGeometry->faceIdx()][scvf.dofIndex()][0]; + + if (std::abs(globalPos[0]-0.5) < eps_) + logFilevx << globalPos[1] << " " << velocity << "\n"; + else if (std::abs(globalPos[1]-0.5) < eps_) + logFilevy << globalPos[0] << " " << velocity << "\n"; + } + } + } +} +// [[/codeblock]] + +// ### The main function +// We will now discuss the main program flow implemented within the `main` function. +// At the beginning of each program using Dune, an instance of `Dune::MPIHelper` has to +// be created. Moreover, we parse the run-time arguments from the command line and the +// input file: +// [[codeblock]] +int main(int argc, char** argv) +{ + using namespace Dumux; + + // The Dune MPIHelper must be instantiated for each program using Dune, it is finalized automatically on exit + const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); + + // parse command line arguments and input file + Parameters::init(argc, argv); + // [[/codeblock]] + + // We define a convenience alias for the type tag of the problem. The type + // tag contains all the properties that are needed to define the model and the problem + // setup. Throughout the main file, we will obtain types defined for this type tag + // using the property system, i.e. with `GetPropType`. + using TypeTag = Properties::TTag::LidDrivenCavityExample; + + // #### Step 1: Create the grid + // The `GridManager` class creates the grid from information given in the input file. + // This can either be a grid file, or in the case of structured grids, one can specify the coordinates + // of the corners of the grid and the number of cells to be used to discretize each spatial direction. + // [[codeblock]] + GridManager> gridManager; + gridManager.init(); + + // We compute on the leaf grid view. + const auto& leafGridView = gridManager.grid().leafGridView(); + // [[/codeblock]] + + // #### Step 2: Setting up and solving the problem + // First, a finite volume grid geometry is constructed from the grid that was created above. + // This builds the sub-control volumes (scv) and sub-control volume faces (scvf) for each element + // of the grid partition. + using GridGeometry = GetPropType; + auto gridGeometry = std::make_shared(leafGridView); + gridGeometry->update(); + + // We now instantiate the problem, in which we define the boundary and initial conditions. + using Problem = GetPropType; + auto problem = std::make_shared(gridGeometry); + + // We set a solution vector which consist of two parts: one part (indexed by `cellCenterIdx`) + // is for the pressure degrees of freedom (`dofs`) living in grid cell centers. Another part + // (indexed by `faceIdx`) is for degrees of freedom defining the normal velocities on grid cell faces. + // We initialize the solution vector by what was defined as the initial solution of the the problem. + using SolutionVector = GetPropType; + SolutionVector x; + x[GridGeometry::cellCenterIdx()].resize(gridGeometry->numCellCenterDofs()); + x[GridGeometry::faceIdx()].resize(gridGeometry->numFaceDofs()); + problem->applyInitialSolution(x); + auto xOld = x; + + // We use the initial solution vector to intialize the `gridVariables`. + // The grid variables are used store variables (primary and secondary variables) on sub-control volumes and faces (volume and flux variables). + using GridVariables = GetPropType; + auto gridVariables = std::make_shared(problem, gridGeometry); + gridVariables->init(x); + + // We get some time loop parameters from the input file + // and instantiate the time loop + using Scalar = GetPropType; + const auto tEnd = getParam("TimeLoop.TEnd"); + const auto maxDt = getParam("TimeLoop.MaxTimeStepSize"); + const auto dt = getParam("TimeLoop.DtInitial"); + + auto timeLoop = std::make_shared>(0, dt, tEnd); + timeLoop->setMaxTimeStepSize(maxDt); + + // We then initialize the predefined model-specific output vtk output. + using IOFields = GetPropType; + StaggeredVtkOutputModule vtkWriter(*gridVariables, x, problem->name()); + IOFields::initOutputModule(vtkWriter); // Add model specific output fields + vtkWriter.write(0.0); + + // To solve the non-linear problem at hand, we use the `NewtonSolver`, + // which we have to tell how to assemble and solve the system in each + // iteration. Here, we use the direct linear solver UMFPack. + using Assembler = StaggeredFVAssembler; + auto assembler = std::make_shared(problem, gridGeometry, gridVariables, timeLoop, xOld); + + using LinearSolver = Dumux::UMFPackBackend; + auto linearSolver = std::make_shared(); + + using NewtonSolver = Dumux::NewtonSolver; + NewtonSolver nonLinearSolver(assembler, linearSolver); + + // ##### The time loop + // In each time step, we solve the non-linear system of equations, write + // the current solution into .vtk files and prepare for the next time step. + // [[codeblock]] + timeLoop->start(); do + { + // We solve the non-linear system with time step control. + nonLinearSolver.solve(x, *timeLoop); + + // We make the new solution the old solution. + xOld = x; + gridVariables->advanceTimeStep(); + + // We advance to the time loop to the next step. + timeLoop->advanceTimeStep(); + + // We write vtk output for each time step. + vtkWriter.write(timeLoop->time()); + + // We report statistics of this time step. + timeLoop->reportTimeStep(); + + // We set a new dt as suggested by the newton solver for the next time step. + timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); + + } while (!timeLoop->finished()); + // [[/codeblock]] + + // We write the velocities and coordinates at x = 0.5 and y = 0.5 into a file + writeSteadyVelocityAndCoordinates(problem, x, gridGeometry); + + // The following piece of code prints a final status report of the time loop + // before the program is terminated. + // [[codeblock]] + timeLoop->finalize(leafGridView.comm()); + + // print used and unused parameters + if (mpiHelper.rank() == 0) + Parameters::print(); + + return 0; +} // end main +// [[/codeblock]] +// [[/content]] diff --git a/test/freeflow/navierstokes/closedsystem/params_re1.input b/examples/liddrivencavity/params_re1.input similarity index 68% rename from test/freeflow/navierstokes/closedsystem/params_re1.input rename to examples/liddrivencavity/params_re1.input index 286d9c374e40237b2e67f79d3cde4ad00d40d5e8..3dc7e70ec11dfa4de89dc4cfebf077afd3ad940e 100644 --- a/test/freeflow/navierstokes/closedsystem/params_re1.input +++ b/examples/liddrivencavity/params_re1.input @@ -4,10 +4,10 @@ TEnd = 2 # [s] [Grid] UpperRight = 1 1 -Cells = 64 64 +Cells = 128 128 [Problem] -Name = test_liddrivencavity_re1 # name passed to the output routines +Name = example_ff_liddrivencavity_re1 LidVelocity = 1 EnableGravity = false @@ -15,7 +15,10 @@ EnableGravity = false LiquidDensity = 1 LiquidKinematicViscosity = 1 -[ Newton ] +[Assembly] +NumericDifference.BaseEpsilon = 1e-8 + +[Newton] MaxSteps = 10 MaxRelativeShift = 1e-5 diff --git a/test/freeflow/navierstokes/closedsystem/params_re1000.input b/examples/liddrivencavity/params_re1000.input similarity index 53% rename from test/freeflow/navierstokes/closedsystem/params_re1000.input rename to examples/liddrivencavity/params_re1000.input index e7f2090e6735df3f6c811ad383c8e455e16a13be..db3ae0533e7add8d4d6635098bedbedeb6a0f27e 100644 --- a/test/freeflow/navierstokes/closedsystem/params_re1000.input +++ b/examples/liddrivencavity/params_re1000.input @@ -1,15 +1,13 @@ -# Increase the number of cells and the time to reach equilibrium -# to match the results of Ghia et al. (1982) for Re = 1000 [TimeLoop] DtInitial = 2 # [s] -TEnd = 50 # [s] set to 200 for reproducing Ghia et al. (1982) +TEnd = 200 # [s] [Grid] UpperRight = 1 1 -Cells = 64 64 # set to 128 128 for reproducing Ghia et al. (1982) +Cells = 128 128 [Problem] -Name = test_liddrivencavity_re1000 # name passed to the output routines +Name = example_ff_liddrivencavity_re1000 LidVelocity = 1 EnableGravity = false diff --git a/test/freeflow/navierstokes/closedsystem/problem.hh b/examples/liddrivencavity/problem.hh similarity index 51% rename from test/freeflow/navierstokes/closedsystem/problem.hh rename to examples/liddrivencavity/problem.hh index c470cfa91ece200a819477fc2797eb98ed97e654..8967dfc47ac0285c8a7cda8bde3594c086a6312e 100644 --- a/test/freeflow/navierstokes/closedsystem/problem.hh +++ b/examples/liddrivencavity/problem.hh @@ -16,74 +16,36 @@ * You should have received a copy of the GNU General Public License * * along with this program. If not, see . * *****************************************************************************/ -/*! - * \file - * \ingroup NavierStokesTests - * \brief A test problem for the staggered (Navier-) Stokes model. - */ -#ifndef DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH -#define DUMUX_CLOSEDSYSTEM_TEST_PROBLEM_HH - -#include - -#include - -#include -#include +#ifndef DUMUX_LIDDRIVENCAVITY_EXAMPLE_PROBLEM_HH +#define DUMUX_LIDDRIVENCAVITY_EXAMPLE_PROBLEM_HH + +// ## Initial and boundary conditions (`problem.hh`) +// +// This file contains the __problem class__ which defines the initial and boundary +// conditions for the Navier-Stokes single-phase flow simulation. +// +// [[content]] +// +// ### Include files +// +#include +#include + +// Include the `NavierStokesProblem` class, the base +// class from which we will derive. #include -#include -#include - -#include "../l2error.hh" +// Include the `NavierStokesBoundaryTypes` class which specifies the boundary types set in this problem. +#include +// ### The problem class +// As we are solving a problem related to free flow, we create a new class called `LidDrivenCavityExampleProblem` +// and let it inherit from the class `NavierStokesProblem`. +// [[codeblock]] namespace Dumux { template -class ClosedSystemTestProblem; - -namespace Properties { -// Create new type tags -namespace TTag { -struct ClosedSystemTest { using InheritsFrom = std::tuple; }; -} // end namespace TTag - -// the fluid system -template -struct FluidSystem -{ - using Scalar = GetPropType; - using type = FluidSystems::OnePLiquid >; -}; - -// Set the grid type -template -struct Grid { using type = Dune::YaspGrid<2>; }; - -// Set the problem property -template -struct Problem { using type = Dumux::ClosedSystemTestProblem ; }; - -template -struct EnableGridGeometryCache { static constexpr bool value = true; }; - -template -struct EnableGridFluxVariablesCache { static constexpr bool value = true; }; -template -struct EnableGridVolumeVariablesCache { static constexpr bool value = true; }; -} // end namespace Properties - -/*! - * \ingroup NavierStokesTests - * \brief Test problem for the one-phase (Navier-) Stokes model. - * - * Here, a quadratic two-dimensional domain with closed walls at all sides is considered. - * If all walls are immobile and gravity is switched on, a hydrostatic pressure - * gradient will develop. When assigning a fixed velocity to the top wall (without gravity), - * this test corresponds to a lid-driven cavity problem. - */ -template -class ClosedSystemTestProblem : public NavierStokesProblem +class LidDrivenCavityExampleProblem : public NavierStokesProblem { using ParentType = NavierStokesProblem; @@ -96,61 +58,48 @@ class ClosedSystemTestProblem : public NavierStokesProblem using PrimaryVariables = GetPropType; using Scalar = GetPropType; - static constexpr auto dimWorld = GridGeometry::GridView::dimensionworld; using Element = typename GridGeometry::GridView::template Codim<0>::Entity; using GlobalPosition = typename Element::Geometry::GlobalCoordinate; public: - ClosedSystemTestProblem(std::shared_ptr gridGeometry) + // Within the constructor, we set the lid velocity to a run-time specified value. + LidDrivenCavityExampleProblem(std::shared_ptr gridGeometry) : ParentType(gridGeometry) { lidVelocity_ = getParam("Problem.LidVelocity"); } + // [[/codeblock]] - /*! - * \name Problem parameters - */ - // \{ - - /*! - * \brief Returns the temperature within the domain in [K]. - * - * This problem assumes a temperature of 10 degrees Celsius. - */ + // #### Temperature distribution + // We need to specify a constant temperature for our isothermal problem. + // Fluid properties that depend on temperature will be calculated with this value. + // This would be important if another fluidsystem was used. Scalar temperature() const - { return 273.15 + 10; } // 10C - - // \} - /*! - * \name Boundary conditions - */ - // \{ - - /*! - * \brief Specifies which kind of boundary condition should be - * used for which equation on a given boundary control volume. - * - * \param globalPos The position of the center of the finite volume - */ + { return 273.15 + 10; } // 10°C + + // #### Boundary conditions + // With the following function we define the __type of boundary conditions__ depending on the location. + // Three types of boundary conditions can be specified: Dirichlet, Neumann or outflow boundary conditions. On + // Dirichlet boundaries, the values of the primary variables need to be fixed. On a Neumann boundaries, + // values for derivatives need to be fixed. Outflow conditions set a gradient of zero in normal direction towards the boundary + // for the respective primary variables (excluding pressure). + // When Dirichlet conditions are set for the pressure, the velocity gradient + // with respect to the direction normal to the boundary is automatically set to zero. + // [[codeblock]] BoundaryTypes boundaryTypesAtPos(const GlobalPosition &globalPos) const { BoundaryTypes values; - // set Dirichlet values for the velocity everywhere + // We set Dirichlet values for the velocity at each boundary values.setDirichlet(Indices::velocityXIdx); values.setDirichlet(Indices::velocityYIdx); return values; } + // [[/codeblock]] - /*! - * \brief Returns whether a fixed Dirichlet value shall be used at a given cell. - * - * \param element The finite element - * \param fvGeometry The finite-volume geometry - * \param scv The sub control volume - * \param pvIdx The primary variable index in the solution vector - */ + // We define a function for setting a fixed Dirichlet pressure value at a given internal cell. + // This is required for having a defined pressure level in our closed system domain. bool isDirichletCell(const Element& element, const FVElementGeometry& fvGeometry, const SubControlVolume& scv, @@ -159,15 +108,13 @@ public: auto isLowerLeftCell = [&](const SubControlVolume& scv) { return scv.dofIndex() == 0; }; - // set a fixed pressure in one cell + // We set a fixed pressure in one cell return (isLowerLeftCell(scv) && pvIdx == Indices::pressureIdx); } - /*! - * \brief Returns Dirichlet boundary values at a given position. - * - * \param globalPos The global position - */ + // The following function specifies the __values on Dirichlet boundaries__. + // We need to define values for the primary variables (velocity and pressure). + // [[codeblock]] PrimaryVariables dirichletAtPos(const GlobalPosition &globalPos) const { PrimaryVariables values; @@ -175,17 +122,16 @@ public: values[Indices::velocityXIdx] = 0.0; values[Indices::velocityYIdx] = 0.0; - if(globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_) + // We set the no slip-condition at the top, that means the fluid has the same velocity as the lid + if (globalPos[1] > this->gridGeometry().bBoxMax()[1] - eps_) values[Indices::velocityXIdx] = lidVelocity_; return values; } + // [[/codeblock]] - /*! - * \brief Evaluates the initial value for a control volume. - * - * \param globalPos The global position - */ + // The following function defines the initial conditions. + // [[codeblock]] PrimaryVariables initialAtPos(const GlobalPosition &globalPos) const { PrimaryVariables values; @@ -195,14 +141,15 @@ public: return values; } - - // \} - + // [[/codeblock]] + // the data members of the problem class + // [[codeblock]] private: - - static constexpr Scalar eps_=1e-6; + static constexpr Scalar eps_ = 1e-6; Scalar lidVelocity_; }; -} // end namespace Dumux +} // end namespace Dumux +// [[/codeblock]] +// [[/content]] #endif diff --git a/examples/liddrivencavity/properties.hh b/examples/liddrivencavity/properties.hh new file mode 100644 index 0000000000000000000000000000000000000000..49956773decf8b725615519a94a4af7e80e59170 --- /dev/null +++ b/examples/liddrivencavity/properties.hh @@ -0,0 +1,116 @@ +// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- +// vi: set et ts=4 sw=4 sts=4: +/***************************************************************************** + * See the file COPYING for full copying permissions. * + * * + * This program is free software: you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation, either version 3 of the License, or * + * (at your option) any later version. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * + * GNU General Public License for more details. * + * * + * You should have received a copy of the GNU General Public License * + * along with this program. If not, see . * + *****************************************************************************/ + +#ifndef DUMUX_LIDDRIVENCAVITY_EXAMPLE_PROPERTIES_HH +#define DUMUX_LIDDRIVENCAVITY_EXAMPLE_PROPERTIES_HH + +// ## Compile-time settings (`properties.hh`) +// +// In this file, the type tag used for this simulation is defined, +// for which we then specialize properties (compile time options) to the needs of the desired setup. +// +// [[content]] +// +// ### Includes +// [[details]] includes +// +// The `NavierStokes` type tag specializes most of the properties required for Navier- +// Stokes single-phase flow simulations in DuMuX. We will use this in the following to inherit the +// respective properties and subsequently specialize those properties for our +// type tag, which we want to modify or for which no meaningful default can be set. +#include + +// We want to use `YaspGrid`, an implementation of the dune grid interface for structured grids: +#include + +// In this example, we want to discretize the equations with the staggered-grid +// scheme which is so far the only available option for free-flow models in DuMux: +#include + +// The fluid properties are specified in the following headers (we use a liquid with constant properties as the fluid phase): +#include +#include + +// We include the problem header used for this simulation. +#include "problem.hh" +// [[/details]] +// +// ### Type tag definition +// +// We define a type tag for our simulation with the name `LidDrivenCavityExample` +// and inherit the properties specialized for the type tags `NavierStokes` and `StaggeredFreeFlowModel`. +// [[codeblock]] + +namespace Dumux::Properties { + +// We define the `LidDrivenCavityExample` type tag and let it inherit from the single-phase `NavierStokes` +// tag (model) and the `StaggeredFreeFlowModel` (discretization scheme). +namespace TTag { +struct LidDrivenCavityExample { using InheritsFrom = std::tuple; }; +} // end namespace TTag +// [[/codeblock]] + +// ### Property specializations +// +// In the following piece of code, mandatory properties for which no meaningful +// default exist are specialized for our type tag `LidDrivenCavityExample`. +// [[codeblock]] +// This sets the fluid system to be used. Here, we use a liquid with constant properties as fluid phase. +template +struct FluidSystem +{ + using Scalar = GetPropType; + using type = FluidSystems::OnePLiquid >; +}; + +// This sets the grid type used for the simulation. Here, we use a structured 2D grid. +template +struct Grid { using type = Dune::YaspGrid<2>; }; + +// This sets our problem class (see problem.hh) containing initial and boundary conditions. +template +struct Problem { using type = Dumux::LidDrivenCavityExampleProblem ; }; +// [[/codeblock]] + +// We also set some properties related to memory management +// throughout the simulation. +// [[details]] caching properties +// +// In Dumux, one has the option to activate/deactivate the grid-wide caching of +// geometries and variables. If active, the CPU time can be significantly reduced +// as less dynamic memory allocation procedures are necessary. Per default, grid-wide +// caching is disabled to ensure minimal memory requirements, however, in this example we +// want to active all available caches, which significantly increases the memory +// demand but makes the simulation faster. +// +// [[codeblock]] +// This enables grid-wide caching of the volume variables. +template +struct EnableGridGeometryCache { static constexpr bool value = true; }; +//This enables grid wide caching for the flux variables. +template +struct EnableGridFluxVariablesCache { static constexpr bool value = true; }; +// This enables grid-wide caching for the finite volume grid geometry +template +struct EnableGridVolumeVariablesCache { static constexpr bool value = true; }; +} // end namespace Dumux::Properties +// [[/codeblock]] +// [[/details]] +// [[/content]] +#endif diff --git a/examples/liddrivencavity/reference_data/CMakeLists.txt b/examples/liddrivencavity/reference_data/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..17622e6865167abb74c2933b5f9686fc0109f812 --- /dev/null +++ b/examples/liddrivencavity/reference_data/CMakeLists.txt @@ -0,0 +1 @@ +dune_symlink_to_source_files(FILES "ghia_x.csv" "ghia_y.csv" "v_x_exp.csv" "v_y_exp.csv" "v_x_num.csv" "v_y_num.csv") diff --git a/examples/liddrivencavity/reference_data/ghia_x.csv b/examples/liddrivencavity/reference_data/ghia_x.csv new file mode 100644 index 0000000000000000000000000000000000000000..3a3c3e65bb8e04bbde4425f1bb1cf4b21b126db1 --- /dev/null +++ b/examples/liddrivencavity/reference_data/ghia_x.csv @@ -0,0 +1,17 @@ +-0.00010938446379027411; 0 +-0.1820862600457428; 0.054771784232365395 +-0.20279065983239786; 0.061410788381742965 +-0.2224084470118155; 0.0705394190871369 +-0.29760438984261306; 0.10041493775933619 +-0.38373787504859047; 0.1709543568464733 +-0.278192715537114; 0.28049792531120354 +-0.10626655457019163; 0.4522821576763487 +-0.06165486941664644; 0.4987551867219918 +0.0547744962438641; 0.6165975103734441 +0.18645440656668377; 0.7344398340248964 +0.33120802032200647; 0.8506224066390042 +0.4650837559551253; 0.9526970954356848 +0.50973792928882; 0.9601659751037346 +0.5729106211410337; 0.9676348547717843 +0.6567795767454052; 0.9759336099585064 +0.9998906155362097; 1.0000000000000002 diff --git a/examples/liddrivencavity/reference_data/ghia_y.csv b/examples/liddrivencavity/reference_data/ghia_y.csv new file mode 100644 index 0000000000000000000000000000000000000000..a49bab824920c55ad8a5c33ccc719a1aec3319fe --- /dev/null +++ b/examples/liddrivencavity/reference_data/ghia_y.csv @@ -0,0 +1,17 @@ +-0.0007610350076103778; 0.00008363723657478506 +0.061643835616438325; 0.27446484937635995 +0.0700152207001522; 0.2895725434913631 +0.0776255707762557; 0.303840672979682 +0.0928462709284627; 0.32566552256034653 +0.15601217656012173; 0.37018160134023886 +0.22602739726027393; 0.3308108087401551 +0.23363774733637738; 0.3224279315170646 +0.4992389649923897; 0.025670885558722545 +0.8036529680365299; -0.3197113174588577 +0.8592085235920852; -0.42536940843574067 +0.9056316590563165; -0.5150955635234384 +0.9444444444444444; -0.39174085481086474 +0.9528158295281584; -0.33636470432002263 +0.9604261796042619; -0.27595563523438815 +0.9687975646879756; -0.21302914917307625 +1; 0.0009232018632591155 diff --git a/examples/liddrivencavity/reference_data/v_x_exp.csv b/examples/liddrivencavity/reference_data/v_x_exp.csv new file mode 100644 index 0000000000000000000000000000000000000000..eda24b0ef1349d6e0d116c1624c71cc6afb8acb6 --- /dev/null +++ b/examples/liddrivencavity/reference_data/v_x_exp.csv @@ -0,0 +1,9 @@ +-0.05433195591586759; -0.7961987748537152 +-0.10867000809787353; -0.5959658974872208 +-0.1366864151821412; -0.39298868431400247 +-0.1711069498450024; -0.19141259630830443 +-0.19699880817996995; 0.007269797370273778 +-0.17096165550203257; 0.2100153524302254 +-0.10084037028720527; 0.4068576897793047 +0.10299844850026774; 0.6059840948416441 +0.424193438588755; 0.8060361163126933 diff --git a/examples/liddrivencavity/reference_data/v_x_num.csv b/examples/liddrivencavity/reference_data/v_x_num.csv new file mode 100644 index 0000000000000000000000000000000000000000..6472932dfe9edc7be74f99abdd314eada190b614 --- /dev/null +++ b/examples/liddrivencavity/reference_data/v_x_num.csv @@ -0,0 +1,150 @@ +0.000003048133069394332; -0.9978602105853533 +-0.014384354985946701; -0.9567564723641944 +-0.022910883359123946; -0.9293894365932442 +-0.03003193382254743; -0.9041810130436394 +-0.03643147827341542; -0.8809749197578971 +-0.04228686793150649; -0.8590675395165053 +-0.04617432002078148; -0.8405423075789797 +-0.054668571411153555; -0.8126259036444496 +-0.06540654068394003; -0.7611541694904234 +-0.0704226882253216; -0.7370923542549286 +-0.07586582840749378; -0.7127033122255766 +-0.08053411094594753; -0.689608765617872 +-0.08510097798785066; -0.6675767488861051 +-0.08953649885339388; -0.6447278982411258 +-0.09404179193646878; -0.6242085898421983 +-0.0990253363809086; -0.5963003410382768 +-0.11053272976427919; -0.5356281184759975 +-0.11505720792591367; -0.5180261428212913 +-0.11915270841863879; -0.4937470033747351 +-0.12392111228407787; -0.46898339275499445 +-0.12749427001785185; -0.4489366506504211 +-0.14000338839906679; -0.3802101319798077 +-0.14477008214492837; -0.3516080082809876 +-0.14949500450502762; -0.3307623617883333 +-0.15390475571172968; -0.3079842791811209 +-0.15786341965984863; -0.28274478286624105 +-0.16258862555760878; -0.2543960421879039 +-0.16938288928310086; -0.20457935021864926 +-0.17910550067545172; -0.14387627598841912 +-0.18181151090198655; -0.12117243390377475 +-0.18505528224768752; -0.10034057284290543 +-0.18654639410938112; -0.08069880821383824 +-0.18940478699138086; -0.05366560557767741 +-0.1906368586347006; -0.02976318241349163 +-0.19435258224156104; 0.011775379478889514 +-0.1932842963232403; 0.04147102089088772 +-0.1948612947046816; 0.0677177794553796 +-0.1948294496166747; 0.09479065884944693 +-0.19236234399626717; 0.13341119665075607 +-0.18887308510918133; 0.16515497284282743 +-0.18386429711575492; 0.19231064946571275 +-0.17932297597069602; 0.21210506421182573 +-0.16902331042830665; 0.25978641031641736 +-0.16104336646653972; 0.28238681373118424 +-0.15352829598862294; 0.3057831777148504 +-0.1441548525493338; 0.32547033626172683 +-0.13448705399267524; 0.3485478239182622 +-0.12301670252738772; 0.36792035025081016 +-0.11323687402315408; 0.38369627219791325 +-0.09826108515938814; 0.4050159863495362 +-0.07766703505971884; 0.4354274663945634 +-0.0673740091604712; 0.44875893784200827 +-0.05708316461608898; 0.4610680809757791 +-0.046794319647000315; 0.47244008982201546 +-0.03650511111876731; 0.4839824867205308 +-0.026217720386255694; 0.4946729433576512 +-0.0159296025354555; 0.5057041760993295 +-0.005005465927851227; 0.5120469687606217 +0.0031463821200578; 0.5243823179832735 +0.013052484140702147; 0.5313087983252629 +0.02333714817963184; 0.540721344570291 +0.033618903745407436; 0.548770786397087 +0.043904840241342; 0.5587796908250915 +0.05418586868882902; 0.5664883565473294 +0.06446744247503233; 0.574452604347986 +0.0747488344816637; 0.582331658122503 +0.10299235223412906; 0.6031269781113561 +0.131442232290093; 0.6210818754507986 +0.142036724461425; 0.6299227619706417 +0.15231593511319053; 0.6367794874314848 +0.16259623644238907; 0.6441473770491648 +0.1728741746371497; 0.6504077443270315 +0.18315156749319417; 0.6564125295264795 +0.19342859679009428; 0.6622469266736486 +0.20370526252785026; 0.6679109357685388 +0.2139842914000435; 0.6746824672032424 +0.22426041179908307; 0.6800908942197141 +0.23453925889170446; 0.6867772316282781 +0.24481628818860457; 0.6926116287754472 +0.2550949535016537; 0.6992127721578718 +0.26536980144368816; 0.704024840991367 +0.2756461036222998; 0.7095184620339782 +0.2859202244460458; 0.7139897547629154 +0.29619634484508495; 0.7193981817793871 +0.30647046566883096; 0.7238694745083243 +0.3167489492023082; 0.7303854238646093 +0.327023978923915; 0.735282686724244 +0.3372997357638098; 0.7405207256884366 +0.347575492603705; 0.7457587646526292 +0.35785015876616744; 0.750485639459985 +0.3681251884877742; 0.7553829023196197 +0.3784000364298087; 0.7601949711531149 +0.38867361191483807; 0.7644106818036336 +0.3989493687547333; 0.7696487207678262 +0.4092247620354842; 0.7747163716797398 +0.4203723417824198; 0.7803709686323396 +0.4325764082444056; 0.7855212282609224 +0.45592750911461055; 0.7960705027636865 +0.4662027206157894; 0.8010529596494607 +0.47647647788039105; 0.8053538643261189 +0.48674968980627653; 0.8093991869243585 +0.4970238106300223; 0.8138704796532957 +0.5072979314537683; 0.8183417723822329 +0.5175731429549472; 0.8233242292680072 +0.5278467184399768; 0.8275399399185257 +0.5381188396884292; 0.8310740983599285 +0.5483925969530307; 0.8353750030365867 +0.5586667177767767; 0.8398462957655239 +0.5689381119069407; 0.8430396781023686 +0.5792118691715425; 0.8473405827790269 +0.5894850810974276; 0.8513859053772665 +0.5997579294641687; 0.8552608399232273 +0.6100335045244917; 0.8604136848612804 +0.6203072617890936; 0.8647145895379387 +0.6305799283762622; 0.8685043300577598 +0.6408533220817197; 0.8726348466821391 +0.6511254433301722; 0.8761690051235419 +0.661397928137769; 0.8798735516172236 +0.6716716854023709; 0.8841744562938818 +0.6819438066508231; 0.8877086147352845 +0.6922166550175642; 0.8915835492812452 +0.7024902305025938; 0.8957992599317639 +0.7127625335306186; 0.8994186123993062 +0.7230379268113692; 0.9044862633112198 +0.7333107751781104; 0.9083611978571806 +0.7435838053244236; 0.9123213264292808 +0.7538551994545876; 0.9155147087661255 +0.7641278660417562; 0.9193044492859468 +0.7744008961880694; 0.9232645778580469 +0.7846724720978057; 0.9265431542210312 +0.7949447751258302; 0.9301625066885735 +0.8052170781538547; 0.9337818591561157 +0.8154882905044466; 0.9368900474668209 +0.825760229973327; 0.9403390118820841 +0.8360347143562173; 0.9449806926633003 +0.846308471620819; 0.9492815973399585 +0.8565809564284156; 0.9529861438336403 +0.8668521687790075; 0.9560943321443456 +0.8771251989253207; 0.9600544607164457 +0.887396956614629; 0.9634182311055695 +0.8976676236265043; 0.9662708373378562 +0.9079406537728175; 0.9702309659099565 +0.9182125932416979; 0.9736799303252197 +0.9284848962697226; 0.977299282792762 +0.9387562903998864; 0.9804926651296066 +0.9490293205461996; 0.9844527937017069 +0.9593025324720849; 0.9884981162999467 +0.9695755626183981; 0.9924582448720469 +0.979851137678721; 0.9976110898101 +0.9901208957927358; 1.0000377259116893 diff --git a/examples/liddrivencavity/reference_data/v_y_exp.csv b/examples/liddrivencavity/reference_data/v_y_exp.csv new file mode 100644 index 0000000000000000000000000000000000000000..c9176d098314708af09fb886b3fba8530fa95e4e --- /dev/null +++ b/examples/liddrivencavity/reference_data/v_y_exp.csv @@ -0,0 +1,9 @@ +-0.796927278657277;0.115652264915277 +-0.595790121813558;0.183649001380804 +-0.394150023013405;0.134292614678386 +-0.191148424775632;0.100586359198097 +0.007854022875222;0.00001524066535 +0.209664817127256;-0.089170084809223 +0.407058866561878;-0.147781619554383 +0.604361472004421;-0.185056222814463 +0.801283060813303;-0.133426944886706 diff --git a/examples/liddrivencavity/reference_data/v_y_num.csv b/examples/liddrivencavity/reference_data/v_y_num.csv new file mode 100644 index 0000000000000000000000000000000000000000..2c080030ab4bef26dbc70926195e3335a9c84fa6 --- /dev/null +++ b/examples/liddrivencavity/reference_data/v_y_num.csv @@ -0,0 +1,78 @@ +-0.999288768950497;0 +-0.972673334072891;0.021974286134163 +-0.958025854264694;0.033319906645845 +-0.945328838968885;0.042561792169235 +-0.933152137401711;0.051452638616391 +-0.913395863905107;0.065958519712046 +-0.897678959725757;0.076256635439313 +-0.882573713510037;0.085153730559261 +-0.861303897850965;0.096863410109032 +-0.84687170396622;0.106536688853689 +-0.832326719223254;0.114188396976658 +-0.79444876443926;0.131998947378047 +-0.760650776410295;0.145135073952788 +-0.739011539215756;0.15264639522703 +-0.705705168990191;0.162048898150698 +-0.683077752794376;0.166762896905027 +-0.654030850880541;0.171723878914801 +-0.629699090335488;0.175741656497756 +-0.600042267445228;0.175816315437067 +-0.554576157435396;0.176835090920729 +-0.533638826712619;0.175013477828388 +-0.506686218069536;0.172738127775706 +-0.486291549863901;0.169982213127496 +-0.45237653113651;0.164922287847398 +-0.433147282064413;0.16076417102465 +-0.394376405824373;0.152448603904252 +-0.351546236216088;0.140875695304554 +-0.331447486110311;0.135319718242191 +-0.304299538004631;0.126512779297893 +-0.28401703116129;0.119557478814628 +-0.252883982394564;0.109359327425084 +-0.230884101021042;0.101941119490603 +-0.196804743707892;0.087060776725269 +-0.151233763212024;0.06945104197526 +-0.132479426256378;0.061092765311581 +-0.101730030105395;0.048560936142628 +-0.08032337684374;0.039275175089844 +-0.057569498619366;0.029059144958032 +-0.041087591942136;0.022095735086078 +-0.020434645261096;0.013741509510006 +0.012645727463325;-0.000309480685698 +0.029064722635131;-0.009948036646688 +0.04754687324687;-0.017840322242822 +0.067591291169771;-0.026195846244409 +0.09524214544601;-0.037334571306409 +0.116378177399312;-0.047087481622298 +0.145590429907236;-0.059622590614102 +0.162862718973081;-0.06705088587214 +0.182851258624946;-0.075873100936895 +0.232543087901045;-0.094099932026633 +0.267075602844517;-0.108353418836853 +0.294846728112191;-0.118092171770137 +0.315971680360122;-0.125512246551969 +0.349075862048722;-0.134228714632766 +0.384195836453436;-0.146407927584487 +0.427101357536864;-0.157696180384451 +0.463252901771879;-0.165323168554647 +0.486983394787082;-0.170171538768697 +0.508315197280252;-0.172925453841613 +0.545582281812094;-0.176578511271488 +0.612254263648705;-0.17680284457584 +0.652886734423278;-0.174284120547567 +0.695616652850882;-0.166693658417209 +0.714201467371259;-0.161055141743268 +0.744511196300785;-0.153991891966036 +0.769900498776174;-0.144162469556771 +0.822911468452884;-0.121631151698286 +0.843143656017629;-0.111323401653695 +0.860905216824327;-0.101020923216697 +0.87977096734535;-0.089938469031137 +0.895150428045632;-0.080418693036281 +0.910356168068146;-0.070121667986447 +0.926030475234426;-0.059823643148965 +0.938382215381267;-0.049532707714797 +0.952821209168525;-0.039237318681112 +0.966660512147318;-0.028165589490308 +0.979882451303688;-0.018820079511937 +0.996274493790708;-0.005551429738106 diff --git a/examples/liddrivencavity/run_and_plot.py b/examples/liddrivencavity/run_and_plot.py new file mode 100755 index 0000000000000000000000000000000000000000..d6697a23d84f92aaaf4cf698eb79a8b3b966dff1 --- /dev/null +++ b/examples/liddrivencavity/run_and_plot.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python3 +import sys +if sys.version_info[0] < 3: + sys.exit("Python 3 required to run this script. Exit.") + +##################################################### +##### simulation #################################### +##################################################### +import subprocess +import numpy as np +import argparse + +parser = argparse.ArgumentParser(description='plot script for the lid-driven cavity example') +parser.add_argument('-s', '--skipsim', required=False, action='store_true', + help='use this flag to skip the simulation run and directly plot already existing data') +parser.add_argument('-n', '--noplotwindow', required=False, action='store_true', + help='use this flag to suppress the plot window popping up') +args = vars(parser.parse_args()) + +reynolds = [1, 1000] +x = {} +y = {} +vx = {} +vy = {} +for re in reynolds: + if not args['skipsim']: + subprocess.run(['make', 'example_ff_liddrivencavity'], check=True) + subprocess.run(['./example_ff_liddrivencavity', 'params_re' + str(re) + '.input'], check=True) + + y[str(re)], vx[str(re)] = np.genfromtxt('example_ff_liddrivencavity_re' + str(re) + '_vx' + '.log', skip_header= True).T + x[str(re)], vy[str(re)] = np.genfromtxt('example_ff_liddrivencavity_re' + str(re) + '_vy' + '.log', skip_header= True).T + +#################################################### +#### reference ##################################### +#################################################### +ghiavx, ghiay = np.genfromtxt("./reference_data/ghia_x.csv", delimiter=';').T +ghiax, ghiavy = np.genfromtxt("./reference_data/ghia_y.csv", delimiter=';').T + +jurjevicnumvx, jurjevicnumy = np.genfromtxt("./reference_data/v_x_num.csv", delimiter=';').T +jurjevicnumy = jurjevicnumy/2.0 + 0.5 +jurjevicnumx, jurjevicnumvy = np.genfromtxt("./reference_data/v_y_num.csv", delimiter=';').T +jurjevicnumx = jurjevicnumx/2.0 + 0.5 +jurjevicexpvx, jurjevicexpy = np.genfromtxt("./reference_data/v_x_exp.csv", delimiter=';').T +jurjevicexpy = jurjevicexpy/2.0 + 0.5 +jurjevicexpx, jurjevicexpvy = np.genfromtxt("./reference_data/v_y_exp.csv", delimiter=';').T +jurjevicexpx = jurjevicexpx/2.0 + 0.5 + +#################################################### +#### plotting ###################################### +#################################################### +try: + import matplotlib + import matplotlib.pyplot as plt + + fig, (ax1, ax2, ax3, ax4) = plt.subplots(1, 4, figsize = (9,4)) + ax1.plot(vx['1'], y['1'] , color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2) + ax1.plot(jurjevicnumvx, jurjevicnumy, '--', markerfacecolor='white', color='black', label=u"R.Jurjevic et al., num") + ax1.plot(jurjevicexpvx, jurjevicexpy, 'o', markerfacecolor='white', color='black', label=u"R.Jurjevic et al., exp") + ax1.set_xlabel(r"$v_x$[m/s]") + ax1.set_ylabel(u"y [m]") + + ax2.plot(x['1'], vy['1'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2) + ax2.plot(jurjevicnumx, jurjevicnumvy, '--', markerfacecolor='white', color='black', label=u"R.Jurjevic, num") + ax2.plot(jurjevicexpx, jurjevicexpvy, 'o', markerfacecolor='white', color='black', label=u"R.Jurjevic, exp") + ax2.set_xlabel(u"x [m]") + ax2.set_ylabel(r"$v_y$[m/s]",labelpad=1) + ax2.set_xlabel(u"x [m]") + ax2.set_ylabel(r"$v_y$[m/s]",labelpad=1) + + handles, labels = ax2.get_legend_handles_labels() + fig.legend(handles, labels, bbox_to_anchor=(0.51, 1.0), ncol=3, labelspacing=0.) + + ax3.plot(vx['1000'], y['1000'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2) + ax3.plot(ghiavx, ghiay, 'o', markerfacecolor='white', color='black', label=u"Ghia et al.") + ax3.set_xlabel(r"$v_x$[m/s]") + ax3.set_ylabel(u"y [m]") + + ax4.plot(x['1000'], vy['1000'], color='black', label=u"DuMu$^\mathrm{x}$",linewidth=2) + ax4.plot(ghiax, ghiavy, 'o', markerfacecolor='white', color='black', label=u"Ghia et al.") + ax4.set_xlabel(u"x [m]") + ax4.set_ylabel(r"$v_y$[m/s]",labelpad=1) + + handles, labels = ax4.get_legend_handles_labels() + fig.legend(handles, labels, bbox_to_anchor=(0.92, 1.0), ncol =2, labelspacing=0.) + fig.tight_layout(rect=[0.03, 0.07, 1, 0.9], pad=0.4, w_pad=2.0, h_pad=1.0) + + plt.savefig("lidverification.png", dpi= 300) + if not args['noplotwindow']: plt.show() + +except ImportError: + print("Skipping plot: matplotlib has not been found.") diff --git a/test/freeflow/navierstokes/CMakeLists.txt b/test/freeflow/navierstokes/CMakeLists.txt index 70806b5004121dcbfa60ec263f6f4d3cc65ef422..ad8cb9cb700d8441d28a8658c532c590ad893440 100644 --- a/test/freeflow/navierstokes/CMakeLists.txt +++ b/test/freeflow/navierstokes/CMakeLists.txt @@ -1,7 +1,6 @@ add_subdirectory(donea) add_subdirectory(angeli) add_subdirectory(kovasznay) -add_subdirectory(closedsystem) add_subdirectory(channel) add_subdirectory(sincos) diff --git a/test/freeflow/navierstokes/closedsystem/CMakeLists.txt b/test/freeflow/navierstokes/closedsystem/CMakeLists.txt deleted file mode 100644 index 9365dec7d0edfaf2dd7528a5bc90cb544efef735..0000000000000000000000000000000000000000 --- a/test/freeflow/navierstokes/closedsystem/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -add_executable(test_ff_navierstokes_closedsystem EXCLUDE_FROM_ALL main.cc) - -dumux_add_test(NAME test_ff_navierstokes_closedsystem_ldc_re1 - TARGET test_ff_navierstokes_closedsystem - LABELS freeflow navierstokes - CMAKE_GUARD HAVE_UMFPACK - COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - CMD_ARGS --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/test_ff_navierstokes_closedsystem_ldc_re1-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/test_ff_navierstokes_closedsystem_ldc_re1-00002.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_ff_navierstokes_closedsystem params_re1.input - -Problem.Name test_ff_navierstokes_closedsystem_ldc_re1") - -dumux_add_test(NAME test_ff_navierstokes_closedsystem_ldc_re1000 - TARGET test_ff_navierstokes_closedsystem - LABELS freeflow navierstokes - CMAKE_GUARD HAVE_UMFPACK - COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - CMD_ARGS --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/test_ff_navierstokes_closedsystem_ldc_re1000-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/test_ff_navierstokes_closedsystem_ldc_re1000-00009.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_ff_navierstokes_closedsystem params_re1000.input - -Problem.Name test_ff_navierstokes_closedsystem_ldc_re1000") - -dumux_add_test(NAME test_ff_navierstokes_closedsystem_hydrostaticpressure - TARGET test_ff_navierstokes_closedsystem - LABELS freeflow navierstokes - CMAKE_GUARD HAVE_UMFPACK - COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py - CMD_ARGS --script fuzzy - --files ${CMAKE_SOURCE_DIR}/test/references/test_ff_navierstokes_closedsystem_hydrostaticpressure-reference.vtu - ${CMAKE_CURRENT_BINARY_DIR}/test_ff_navierstokes_closedsystem_hydrostaticpressure-00002.vtu - --command "${CMAKE_CURRENT_BINARY_DIR}/test_ff_navierstokes_closedsystem params_hydrostaticpressure.input - -Problem.Name test_ff_navierstokes_closedsystem_hydrostaticpressure" - --zeroThreshold {"velocity_liq \(m/s\)":1e-16}) - -dune_symlink_to_source_files(FILES "params_re1.input" "params_re1000.input" "params_hydrostaticpressure.input") diff --git a/test/freeflow/navierstokes/closedsystem/main.cc b/test/freeflow/navierstokes/closedsystem/main.cc deleted file mode 100644 index f55d39fab726a6d867cbbfd72807d65bc87e0929..0000000000000000000000000000000000000000 --- a/test/freeflow/navierstokes/closedsystem/main.cc +++ /dev/null @@ -1,163 +0,0 @@ -// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- -// vi: set et ts=4 sw=4 sts=4: -/***************************************************************************** - * See the file COPYING for full copying permissions. * - * * - * This program is free software: you can redistribute it and/or modify * - * it under the terms of the GNU General Public License as published by * - * the Free Software Foundation, either version 3 of the License, or * - * (at your option) any later version. * - * * - * This program is distributed in the hope that it will be useful, * - * but WITHOUT ANY WARRANTY; without even the implied warranty of * - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * - * GNU General Public License for more details. * - * * - * You should have received a copy of the GNU General Public License * - * along with this program. If not, see . * - *****************************************************************************/ -/*! - * \file - * \ingroup NavierStokesTests - * \brief Test for the staggered grid Stokes model in a closed domain. - */ - -#include - -#include -#include - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "problem.hh" - -int main(int argc, char** argv) -{ - using namespace Dumux; - - // define the type tag for this problem - using TypeTag = Properties::TTag::ClosedSystemTest; - - // initialize MPI, finalize is done automatically on exit - const auto& mpiHelper = Dune::MPIHelper::instance(argc, argv); - - // print dumux start message - if (mpiHelper.rank() == 0) - DumuxMessage::print(/*firstCall=*/true); - - // parse command line arguments and input file - Parameters::init(argc, argv); - - // try to create a grid (from the given grid file or the input file) - GridManager> gridManager; - gridManager.init(); - - //////////////////////////////////////////////////////////// - // run instationary non-linear problem on this grid - //////////////////////////////////////////////////////////// - - // we compute on the leaf grid view - const auto& leafGridView = gridManager.grid().leafGridView(); - - // create the finite volume grid geometry - using GridGeometry = GetPropType; - auto gridGeometry = std::make_shared(leafGridView); - gridGeometry->update(); - - // the problem (initial and boundary conditions) - using Problem = GetPropType; - auto problem = std::make_shared(gridGeometry); - - // the solution vector - using SolutionVector = GetPropType; - SolutionVector x; - x[GridGeometry::cellCenterIdx()].resize(gridGeometry->numCellCenterDofs()); - x[GridGeometry::faceIdx()].resize(gridGeometry->numFaceDofs()); - problem->applyInitialSolution(x); - auto xOld = x; - - // the grid variables - using GridVariables = GetPropType; - auto gridVariables = std::make_shared(problem, gridGeometry); - gridVariables->init(x); - - // get some time loop parameters - using Scalar = GetPropType; - const auto tEnd = getParam("TimeLoop.TEnd"); - const auto maxDt = getParam("TimeLoop.MaxTimeStepSize"); - auto dt = getParam("TimeLoop.DtInitial"); - - // intialize the vtk output module - using IOFields = GetPropType; - StaggeredVtkOutputModule vtkWriter(*gridVariables, x, problem->name()); - IOFields::initOutputModule(vtkWriter); // Add model specific output fields - vtkWriter.write(0.0); - - // instantiate time loop - auto timeLoop = std::make_shared>(0, dt, tEnd); - timeLoop->setMaxTimeStepSize(maxDt); - - // the assembler with time loop for instationary problem - using Assembler = StaggeredFVAssembler; - auto assembler = std::make_shared(problem, gridGeometry, gridVariables, timeLoop, xOld); - - // the linear solver - using LinearSolver = Dumux::UMFPackBackend; - auto linearSolver = std::make_shared(); - - // the non-linear solver - using NewtonSolver = Dumux::NewtonSolver; - NewtonSolver nonLinearSolver(assembler, linearSolver); - - // time loop - timeLoop->start(); do - { - // solve the non-linear system with time step control - nonLinearSolver.solve(x, *timeLoop); - - // make the new solution the old solution - xOld = x; - gridVariables->advanceTimeStep(); - - // advance to the time loop to the next step - timeLoop->advanceTimeStep(); - - // write vtk output - vtkWriter.write(timeLoop->time()); - - // report statistics of this time step - timeLoop->reportTimeStep(); - - // set new dt as suggested by newton solver - timeLoop->setTimeStepSize(nonLinearSolver.suggestTimeStepSize(timeLoop->timeStepSize())); - - } while (!timeLoop->finished()); - - timeLoop->finalize(leafGridView.comm()); - - //////////////////////////////////////////////////////////// - // finalize, print dumux message to say goodbye - //////////////////////////////////////////////////////////// - - // print dumux end message - if (mpiHelper.rank() == 0) - { - Parameters::print(); - DumuxMessage::print(/*firstCall=*/false); - } - - return 0; -} // end main diff --git a/test/freeflow/navierstokes/closedsystem/params_hydrostaticpressure.input b/test/freeflow/navierstokes/closedsystem/params_hydrostaticpressure.input deleted file mode 100644 index d7a46b45297e753c477793588c1b10d4f2a6894c..0000000000000000000000000000000000000000 --- a/test/freeflow/navierstokes/closedsystem/params_hydrostaticpressure.input +++ /dev/null @@ -1,23 +0,0 @@ -[TimeLoop] -DtInitial = 1 # [s] -TEnd = 2 # [s] - -[Grid] -UpperRight = 1 1 -Cells = 64 64 - -[Problem] -Name = test_hydrostaticpressure # name passed to the output routines -LidVelocity = 0 -EnableGravity = true - -[Component] -LiquidDensity = 1000 -LiquidKinematicViscosity = 1.0 - -[ Newton ] -MaxSteps = 10 -MaxRelativeShift = 1e-5 - -[Vtk] -WriteFaceData = false diff --git a/test/freeflow/shallowwater/bowl/CMakeLists.txt b/test/freeflow/shallowwater/bowl/CMakeLists.txt index 4746e6dbc1e74aeec358190d20f7214f9274e15b..b27caaa6bac20cb4d1cc4f29260965d615ab88bc 100644 --- a/test/freeflow/shallowwater/bowl/CMakeLists.txt +++ b/test/freeflow/shallowwater/bowl/CMakeLists.txt @@ -13,6 +13,7 @@ dumux_add_test(NAME test_shallowwater_bowl dumux_add_test(NAME test_shallowwater_bowl_parallel TARGET test_shallowwater_bowl LABELS shallowwater + TIMEOUT 1500 CMAKE_GUARD MPI_FOUND COMMAND ${CMAKE_SOURCE_DIR}/bin/testing/runtest.py CMD_ARGS --script fuzzy diff --git a/test/material/compositionalflash/test_compositionalflash.cc b/test/material/compositionalflash/test_compositionalflash.cc index 50f24900c96e5904e187de040babb117d53f007c..3d889bd87bd0a4ccbe45e5becb1e65d7e6e2b2d3 100644 --- a/test/material/compositionalflash/test_compositionalflash.cc +++ b/test/material/compositionalflash/test_compositionalflash.cc @@ -113,7 +113,7 @@ void checkCompositionalFlash(const FluidState &fsRef) // call flash for testing FluidState fsFlash; - flash.concentrationFlash2p2c(fsFlash, Z0, phasePressures, 0/*dummy*/, fsRef.temperature(0)); + flash.concentrationFlash2p2c(fsFlash, Z0, phasePressures, fsRef.temperature(0)); // compare the "flashed" fluid state with the reference one checkSame(fsRef, fsFlash); @@ -142,7 +142,7 @@ void checkCompositionalFlashSequential(const FluidState &fsRef, int refPhaseIdx) // call flash for testing Dumux::CompositionalFluidState fsFlash; - flash.concentrationFlash2p2c(fsFlash, Z0, phasePressures, 0/*dummy*/, fsRef.temperature(0)); + flash.concentrationFlash2p2c(fsFlash, Z0, phasePressures, fsRef.temperature(0)); // compare the "flashed" fluid state with the reference one checkSame(fsRef, fsFlash); @@ -349,7 +349,7 @@ int main() pressures[liquidPhaseIdx] = fsRef.pressure(liquidPhaseIdx); pressures[gasPhaseIdx] = fsRef.pressure(gasPhaseIdx); Dumux::CompositionalFlash::saturationFlash2p2c(fsRef, fsRef.saturation(liquidPhaseIdx), - pressures, 0/*dummy*/, fsRef.temperature(0)); + pressures, fsRef.temperature(0)); // check the flash calculation checkCompositionalFlash(fsRef); diff --git a/test/multidomain/embedded/1d3d/1p_1p/convergence.py b/test/multidomain/embedded/1d3d/1p_1p/convergence.py index e0172e0b114e0d87cbde393917c1000504b3d980..6ea55319caf7ca3973362c38d0c63984baf65c0d 100755 --- a/test/multidomain/embedded/1d3d/1p_1p/convergence.py +++ b/test/multidomain/embedded/1d3d/1p_1p/convergence.py @@ -59,31 +59,22 @@ table1 = [["", "", "", "", "", "", ""] for i in range(len(cells)+1)] table2 = [["", "", "", "", "", "", ""] for i in range(len(cells)+1)] table3 = [["", "", "", "", "", "", ""] for i in range(len(cells)+1)] -dpi = 300.0 -fig, axes = plt.subplots(1, 3, dpi=dpi, figsize=(8, 4)) -for exec, result in res.items(): - p3d = [] - p1d = [] - q = [] - h = [] +def get_errors(result): + p3d, p1d, q, h = [], [], [], [] for cells, norms in sorted(result.items()): h.append(norms[1]) p3d.append(norms[2]) p1d.append(norms[3]) q.append(norms[4]) + return (p3d, p1d, q, h) + +for exec, result in res.items(): + p3d, p1d, q, h = get_errors(result=result) rates3d = [(np.log10(p3d[i+1])-np.log10(p3d[i]))/(np.log10(h[i+1])-np.log10(h[i])) for i in range(len(p3d)-1)] rates1d = [(np.log10(p1d[i+1])-np.log10(p1d[i]))/(np.log10(h[i+1])-np.log10(h[i])) for i in range(len(p1d)-1)] ratesq = [(np.log10(q[i+1])-np.log10(q[i]))/(np.log10(h[i+1])-np.log10(h[i])) for i in range(len(q)-1)] - hR = np.array(h)/radius - axes[0].plot(hR, p3d, "--" + marker[exec], label=label[exec]) - axes[0].set_title(r"$\vert\vert p^\mathbb{M}_{t,e} -p^\mathbb{M}_t \vert\vert_2$") - axes[1].plot(hR, p1d, "--" + marker[exec], label=label[exec]) - axes[1].set_title(r"$\vert\vert p_{v,e} - p_v \vert\vert_2$") - axes[2].plot(hR, q, "--" + marker[exec], label=label[exec]) - axes[2].set_title(r"$\vert\vert q_e - q \vert\vert_2$") - ofs = method[exec] for i in range(len(h)): table1[i][0] = "{:.4f}".format(h[i]) @@ -140,10 +131,24 @@ for exec, result in res.items(): try: import matplotlib import matplotlib.pyplot as plt + plt.style.use('ggplot') font = {'family': 'sans-serif', 'weight': 'normal', 'size': 8} matplotlib.rc('font', **font) + dpi = 300.0 + fig, axes = plt.subplots(1, 3, dpi=dpi, figsize=(8, 4)) + + for exec, result in res.items(): + p3d, p1d, q, h = get_errors(result=result) + hR = np.array(h)/radius + axes[0].plot(hR, p3d, "--" + marker[exec], label=label[exec]) + axes[0].set_title(r"$\vert\vert p^\mathbb{M}_{t,e} -p^\mathbb{M}_t \vert\vert_2$") + axes[1].plot(hR, p1d, "--" + marker[exec], label=label[exec]) + axes[1].set_title(r"$\vert\vert p_{v,e} - p_v \vert\vert_2$") + axes[2].plot(hR, q, "--" + marker[exec], label=label[exec]) + axes[2].set_title(r"$\vert\vert q_e - q \vert\vert_2$") + x = np.linspace(np.min(hR), np.max(hR), 10) axes[0].plot(x, np.power(x*radius*0.4, 1.5), "--k", label=r"$\Delta$ 1.5") axes[0].plot(x, np.power(x*radius*0.3, 2), "-.k", label=r"$\Delta$ 2") diff --git a/test/porousmediumflow/2p/implicit/cornerpoint/params.input b/test/porousmediumflow/2p/implicit/cornerpoint/params.input index b9ecbd3a1723834bd4d4c61aede3aa72393c3600..ccd3e3a18f5df358c67586a4163a0d9d20724901 100644 --- a/test/porousmediumflow/2p/implicit/cornerpoint/params.input +++ b/test/porousmediumflow/2p/implicit/cornerpoint/params.input @@ -15,4 +15,4 @@ InjectionRate = 0.1 # injection rate in kg/s Swr = 0.0 Snr = 0.0 VanGenuchtenAlpha = 0.00045 -VanGenuchtenN = 7.3; +VanGenuchtenN = 7.3 diff --git a/test/python/CMakeLists.txt b/test/python/CMakeLists.txt index 4f50f615d14a2a9c8f0c589cceb456fd5070786b..a2c3ddce128819017825d8a13d6c319561992ee1 100644 --- a/test/python/CMakeLists.txt +++ b/test/python/CMakeLists.txt @@ -1,10 +1,10 @@ -dune_symlink_to_source_files(test_py_gridgeometry.py) +dune_symlink_to_source_files(FILES test_py_gridgeometry.py) dune_python_add_test(NAME test_py_gridgeometry COMMAND ${PYTHON_EXECUTABLE} test_py_gridgeometry.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} LABELS python unit) -dune_symlink_to_source_files(test_py_fvproblem.py) +dune_symlink_to_source_files(FILES test_py_fvproblem.py) dune_python_add_test(NAME test_py_fvproblem COMMAND ${PYTHON_EXECUTABLE} test_py_fvproblem.py WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}