Commit c00d26fd authored by Alexander Jaust's avatar Alexander Jaust
Browse files

[repository] Restructure repository and tests

- This MR removes unused test cases and separates stronger
between tests and example cases. Test cases and examples 
are classified as `monolithic` or `partitioned`.
- The tests have been adapted such that the build target
`build_tests` builds all necessary executables. This means
on can now run `make build_tests` from `build-cmake` and 
afterwards run all tests `ctest` to test the adapter.
- The CI has been adapted to make use of the new build 
process for tests.

For more information check out merge request: !18
parent 3d7ea1af
Pipeline #12583 passed with stages
in 5 minutes and 48 seconds
......@@ -19,9 +19,9 @@ check-style-clang-10:
when: on_failure
paths:
- style-patch.diff
expire_in: 7 day
expire_in: 2 days
.build_template: &build-iterative-coupling
.build_template: &build-tests
stage: build
script:
- cd ..
......@@ -29,273 +29,94 @@ check-style-clang-10:
- cd dumux-precice/
- echo $DUNE_CONTROL_PATH
- dunecontrol --only=dumux-precice --opts=./test/cmake-test.opts all
- cd build-cmake/appl/coupling-ff-pm/fvca-iterative/
- make -j2 fvca-iterative-ff fvca-iterative-pm
- cd build-cmake/
- make -j2 build_tests
artifacts:
expire_in: 3 days
expire_in: 3 hours
paths:
- build-cmake/appl/coupling-ff-pm/fvca-iterative/fvca-iterative-ff
- build-cmake/appl/coupling-ff-pm/fvca-iterative/fvca-iterative-pm
- build-cmake/CMakeFiles/CMakeError.log
- build-cmake/CMakeFiles/CMakeOutput.log
- build-cmake/appl/coupling-ff-pm/fvca-iterative/Makefile
- build-cmake/appl/coupling-ff-pm/fvca-iterative/CTestTestfile.cmake
- build-cmake/
build-iterative-coupling:3.3-2.2.1:
build-tests:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *build-iterative-coupling
build-iterative-coupling:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *build-iterative-coupling
build-iterative-coupling:master-2.2.1:
image: dumux-precice:master-2.2.1
<<: *build-tests
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
<<: *build-iterative-coupling
allow_failure: true
.build_template: &build-monolithic-coupling
stage: build
script:
- cd ..
- export DUNE_CONTROL_PATH=${PWD}/dumux-precice:${DUNE_CONTROL_PATH}
- cd dumux-precice/
- echo $DUNE_CONTROL_PATH
#- dunecontrol --only=dumux-precice --opts=/home/dumux/dumux/dumux/cmake.opts all
- dunecontrol --only=dumux-precice --opts=./test/cmake-test.opts all
- cd build-cmake/appl/coupling-ff-pm/fvca-monolithic
- make -j2 fvca-monolithic
artifacts:
expire_in: 3 days
paths:
- build-cmake/appl/coupling-ff-pm/fvca-monolithic/fvca-monolithic
- build-cmake/CMakeFiles/CMakeError.log
- build-cmake/CMakeFiles/CMakeOutput.log
- build-cmake/appl/coupling-ff-pm/fvca-monolithic/Makefile
- build-cmake/appl/coupling-ff-pm/fvca-monolithic/CTestTestfile.cmake
build-monolithic-coupling:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *build-monolithic-coupling
build-monolithic-coupling:3.4-2.2.1:
build-tests:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *build-monolithic-coupling
<<: *build-tests
build-monolithic-coupling:master-2.2.1:
build-tests:master-2.2.1:
image: dumux-precice:master-2.2.1
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
<<: *build-monolithic-coupling
<<: *build-tests
allow_failure: true
.test_template: &test-iterative-coupling
.test_template: &test-partitioned-cases
stage: test
script:
- cd build-cmake/appl/coupling-ff-pm/fvca-iterative/
- CTEST_OUTPUT_ON_FAILURE=1 ctest --verbose
- cd build-cmake/
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j1 -L ^partitioned$
artifacts:
expire_in: 2 days
when: on_failure
paths:
- build-cmake/appl/coupling-ff-pm/fvca-iterative/Testing/Temporary/LastTest.log
- build-cmake/appl/coupling-ff-pm/fvca-iterative/Testing/Temporary/LastTestsFailed.log
- build-cmake/appl/coupling-ff-pm/fvca-iterative/*.log
- build-cmake/appl/coupling-ff-pm/fvca-iterative/*.txt
- build-cmake/appl/coupling-ff-pm/fvca-iterative/CTestTestfile.cmake
- build-cmake/
test-iterative-coupling:3.3-2.2.1:
test-partitioned:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *test-iterative-coupling
needs:
- build-iterative-coupling:3.3-2.2.1
test-iterative-coupling:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *test-iterative-coupling
needs:
- build-iterative-coupling:3.4-2.2.1
test-iterative-coupling:master-2.2.1:
image: ub2004-dumux-precice:master-2.2.1
<<: *test-iterative-coupling
<<: *test-partitioned-cases
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
needs:
- build-iterative-coupling:master-2.2.1
allow_failure: true
- build-tests:3.3-2.2.1
.test_template: &test-monolithic-coupling
stage: test
script:
- cd build-cmake/appl/coupling-ff-pm/fvca-monolithic/
- - CTEST_OUTPUT_ON_FAILURE=1 ctest
artifacts:
expire_in: 5 days
paths:
- build-cmake/appl/coupling-ff-pm/fvca-monolithic/Testing/Temporary/LastTest.log
- build-cmake/appl/coupling-ff-pm/fvca-monolithic/Testing/Temporary/LastTestsFailed.log
test-monolithic-coupling:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *test-monolithic-coupling
needs:
- build-monolithic-coupling:3.3-2.2.1
test-monolithic-coupling:3.4-2.2.1:
test-partitioned:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *test-monolithic-coupling
<<: *test-partitioned-cases
needs:
- build-monolithic-coupling:3.4-2.2.1
- build-tests:3.4-2.2.1
test-monolithic-coupling:master-2.2.1:
test-partitioned:master-2.2.1:
image: ub2004-dumux-precice:master-2.2.1
<<: *test-monolithic-coupling
<<: *test-partitioned-cases
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
needs:
- build-monolithic-coupling:master-2.2.1
allow_failure: true
.build_template: &build-monolithic-flow-over-step-2d
stage: build
script:
- cd ..
- export DUNE_CONTROL_PATH=${PWD}/dumux-precice:${DUNE_CONTROL_PATH}
- cd dumux-precice/
- echo $DUNE_CONTROL_PATH
#- dunecontrol --only=dumux-precice --opts=/home/dumux/dumux/dumux/cmake.opts all
- dunecontrol --only=dumux-precice --opts=./test/cmake-test.opts all
- cd build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d
- make -j2 flow-over-step-2d
artifacts:
expire_in: 3 days
paths:
- build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d/flow-over-step-2d
- build-cmake/CMakeFiles/CMakeError.log
- build-cmake/CMakeFiles/CMakeOutput.log
- build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d/Makefile
- build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d/CTestTestfile.cmake
build-monolithic-flow-over-step-2d:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *build-monolithic-flow-over-step-2d
build-monolithic-flow-over-step-2d:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *build-monolithic-flow-over-step-2d
build-monolithic-flow-over-step-2d:master-2.2.1:
image: dumux-precice:master-2.2.1
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
<<: *build-monolithic-flow-over-step-2d
- build-tests:master-2.2.1
allow_failure: true
.test_template: &test-monolithic-flow-over-step-2d
.test_template: &test-monolithic-cases
stage: test
script:
- cd build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d/
- - CTEST_OUTPUT_ON_FAILURE=1 ctest
- cd build-cmake
- CTEST_OUTPUT_ON_FAILURE=1 ctest -j2 -L ^monolithic$
artifacts:
when: on_failure
expire_in: 2 days
when: on_failure
paths:
- build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d/Testing/Temporary/LastTest.log
- build-cmake/appl/coupling-ff-pm/monolithic/flow-over-step-2d/Testing/Temporary/LastTestsFailed.log
- build-cmake/
test-monolithic-flow-over-step-2d:3.3-2.2.1:
test-monolithic:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *test-monolithic-flow-over-step-2d
needs:
- build-monolithic-flow-over-step-2d:3.3-2.2.1
test-monolithic-flow-over-step-2d:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *test-monolithic-flow-over-step-2d
<<: *test-monolithic-cases
needs:
- build-monolithic-flow-over-step-2d:3.4-2.2.1
test-monolithic-flow-over-step-2d:master-2.2.1:
image: ub2004-dumux-precice:master-2.2.1
<<: *test-monolithic-flow-over-step-2d
- build-tests:3.3-2.2.1
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
needs:
- build-monolithic-flow-over-step-2d:master-2.2.1
allow_failure: true
.build_template: &build-monolithic-ff-pm-3d
stage: build
script:
- cd ..
- export DUNE_CONTROL_PATH=${PWD}/dumux-precice:${DUNE_CONTROL_PATH}
- cd dumux-precice/
- echo $DUNE_CONTROL_PATH
#- dunecontrol --only=dumux-precice --opts=/home/dumux/dumux/dumux/cmake.opts all
- dunecontrol --only=dumux-precice --opts=./test/cmake-test.opts all
- cd build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d
- make -j2 ff-pm-3d
artifacts:
expire_in: 3 days
paths:
- build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d/ff-pm-3d
- build-cmake/CMakeFiles/CMakeError.log
- build-cmake/CMakeFiles/CMakeOutput.log
- build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d/Makefile
- build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d/CTestTestfile.cmake
build-monolithic-ff-pm-3d:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *build-monolithic-ff-pm-3d
build-monolithic-ff-pm-3d:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *build-monolithic-ff-pm-3d
build-monolithic-ff-pm-3d:master-2.2.1:
image: dumux-precice:master-2.2.1
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
<<: *build-monolithic-ff-pm-3d
allow_failure: true
.test_template: &test-monolithic-ff-pm-3d
stage: test
script:
- cd build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d/
- - CTEST_OUTPUT_ON_FAILURE=1 ctest
artifacts:
expire_in: 2 days
when: on_failure
paths:
- build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d/Testing/Temporary/LastTest.log
- build-cmake/appl/coupling-ff-pm/monolithic/ff-pm-3d/Testing/Temporary/LastTestsFailed.log
needs:
- build:monolithic:ff-pm-3d
test-monolithic-ff-pm-3d:3.3-2.2.1:
image: ub2004-dumux-precice:3.3-2.2.1
<<: *test-monolithic-ff-pm-3d
needs:
- build-monolithic-ff-pm-3d:3.3-2.2.1
test-monolithic-ff-pm-3d:3.4-2.2.1:
test-monolithic:3.4-2.2.1:
image: ub2004-dumux-precice:3.4-2.2.1
<<: *test-monolithic-ff-pm-3d
<<: *test-monolithic-cases
needs:
- build-monolithic-ff-pm-3d:3.4-2.2.1
- build-tests:3.4-2.2.1
test-monolithic-ff-pm-3d:master-2.2.1:
test-monolithic:master-2.2.1:
image: ub2004-dumux-precice:master-2.2.1
<<: *test-monolithic-ff-pm-3d
<<: *test-monolithic-cases
rules:
- if: '$CI_NIGHTLY_BUILD == "TRUE"'
needs:
- build-monolithic-ff-pm-3d:master-2.2.1
- build-tests:master-2.2.1
allow_failure: true
project(dumux-precice CXX)
# We require version CMake version 3.1 to prevent issues
# with dune_enable_all_packages and older CMake versions.
cmake_minimum_required(VERSION 3.13)
project(dumux-precice CXX)
#if(NOT (dune-common_DIR OR dune-common_ROOT OR
# "${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
# string(REPLACE ${CMAKE_PROJECT_NAME} dune-common dune-common_DIR
# ${PROJECT_BINARY_DIR})
#endif()
if(NOT (dune-common_DIR
OR dune-common_ROOT
OR "${CMAKE_PREFIX_PATH}" MATCHES ".*dune-common.*"))
......@@ -18,11 +13,13 @@ endif()
#find dune-common and set the module path
find_package(dune-common REQUIRED)
#list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/modules"
# ${dune-common_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH ${dune-common_MODULE_PATH}
"${PROJECT_SOURCE_DIR}/cmake/modules")
# Find preCICE library
find_package(precice 2 REQUIRED CONFIG)
#include the dune macros
include(DuneMacros)
......@@ -31,12 +28,14 @@ dune_project()
dune_enable_all_packages()
# enforce C++-17
dune_require_cxx_standard(MODULE "DuMuX-preCICE" VERSION 17)
add_subdirectory(cmake/modules)
add_subdirectory(doc)
#add_subdirectory(dumux-addon)
add_subdirectory(dumux-precice)
add_subdirectory(appl)
add_subdirectory(examples)
add_subdirectory(test EXCLUDE_FROM_ALL)
# finalize the dune project, e.g. generating config.h etc.
finalize_dune_project(GENERATE_CONFIG_H_CMAKE)
# DuMuX-preCICE coupling
This repository provides a DuMuX specific adapter to couple to other codes using [preCICE](https://www.precice.org/)
This repository provides a [DuMuX](https://dumux.org/)-specific adapter to couple to other codes using [preCICE](https://www.precice.org/). You can find the source code of this adapter [on the IWS GitLab](https://git.iws.uni-stuttgart.de/dumux-appl/dumux-precice).
## Prerequisites
- DuMuX **newer** than 3.2
- Some of
- Builds using the current `master` branch of DuMuX might fail.
- preCICE >=2.0.0
- The adapter is build via the DUNE build system that is based on CMake. Thus, the CMake [link instructions for preCICE](https://precice.org/installation-linking.html#cmake) apply.
## Running partitioned coupling
## Structure of the repository
At the moment the following has to be fulfilled
- `cmake/`: Contains CMake modules for building the adapter. Under normal circumstances you do not need
- `examples/`: Contains examples on how to couple different domains. Some of the examples are taken from DuMuX or are slightly adapted from DuMuX test cases or tutorials. Please check the `README.md` file in this directory and corresponding subdirectories to find further explanations of the examples. Additional examples can be found in the `test/` directory.
- `doc/`: Additional documentation.
- `dumux-precice/`: The preCICE adapter source code and further code for some of the tests and examples.
- `scripts/`: Contains useful scripts to run simulations and for checking the code's formatting.
- `test/`: Contains test cases and reference solutions (`reference-solutions/`). Test cases as divided into `monolithic/` and `partitioned` (=preCICE) test cases. The directory also contains several DUNE configuration files (`.opts` files) for configuring the project.
1. `test_freeflow` and `test_solidenergy` have to be in the same directory
1. A preCICE configuration file named `precice-config.xml` must be present in the same directory as the two solvers.
1. Example configurations can be found in `/build-cmake/appl/conjugateheattransfer/iterative/precice-configs`. The config files have to be copied and renamed.
## Running tests
**Note**: There is no guarantee that the config file work at the moment. (2019-04-10)
1. Configure the DUNE module
## Notes regarding monolithic examples
```bash
dunecontrol --opts=OPTSFILE.opts --only=dumux-precice all
```
We provide some monolithic simulations for comparison. Most of these examples are based on a DuMuX branch that "reverse" the information exchange direction of the monolithic coupling. This means, it allows to prescribe pressure on the coupling boundary of the porous medium and the velocity/mass flux on the free flow. The *standard* approach of DuMuX is the opposite coupling direction, i.e. velocity/mass flux prescriped on the coupling boundary of the porous medium and pressure prescribed on the coupling boundary of the free flow. It is not clear whether the *non-standard* approach can/will be merged and maintained in the DuMuX main branch.
You may use one of the `opts`-file provided by the adapter that resides in `test/`, e.g.,
As a consequence, the provided monolithic examples may not work. The partitioned/iterative examples should work after all.
## Publications
```bash
dunecontrol --opts=dumux-precice/test/cmake-test.opts --only=dumux-precice all
```
2. Build all test. For this navigate in the `build-cmake/` directory and build the `build_tests` target.
```bash
cd dumux-precice/build-cmake
make -j1 build_tests
```
You may speed up the build process by using more than one build job, e.g., use `make -j4` in order to build with for processes at the same time.
3. Run the tests from the `build-cmake` directory
```bash
ctest
```
## Publications
### How to cite this code?
There is no publication related to this code available yet.
### Publications using dumux-precice
- Jaust A., Weishaupt K., Mehl M., Flemisch B. (2020) Partitioned Coupling Schemes for Free-Flow and Porous-Media Applications with Sharp Interfaces. In: Klöfkorn R., Keilegavlen E., Radu F., Fuhrmann J. (eds) Finite Volumes for Complex Applications IX - Methods, Theoretical Aspects, Examples. FVCA 2020. Springer Proceedings in Mathematics & Statistics, vol 323. Springer, Cham. https://doi.org/10.1007/978-3-030-43651-3_57
- Jaust A., Weishaupt K., Mehl M., Flemisch B. (2020) Partitioned Coupling Schemes for Free-Flow and Porous-Media Applications with Sharp Interfaces. In: Klöfkorn R., Keilegavlen E., Radu F., Fuhrmann J. (eds) Finite Volumes for Complex Applications IX - Methods, Theoretical Aspects, Examples. FVCA 2020. Springer Proceedings in Mathematics & Statistics, vol 323. Springer, Cham. <https://doi.org/10.1007/978-3-030-43651-3_57>
- Code can be found at: https://git.iws.uni-stuttgart.de/dumux-pub/jaust2020a
## Further reading
There is more documentation in `doc/mkdocs`.
add_subdirectory(conjugateheattransfer)
add_subdirectory(coupling-ff-pm)
# add a target that builds all exercise solutions
add_custom_target(test_exercises)
add_subdirectory(monolithic-to-rename)
add_subdirectory(fvca-monolithic)
add_subdirectory(iterative)
add_subdirectory(fvca-iterative)
#add_subdirectory(iterative-reversed-mono-flux)
#add_subdirectory(iterative-reversed-mono-flux-no-precice)
#add_subdirectory(interface-coupling-test)
# monolithic
add_subdirectory(monolithic)
# partitioned
add_subdirectory(partitioned)
\ No newline at end of file
This diff is collapsed.
// -*- 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 <http://www.gnu.org/licenses/>. *
*****************************************************************************/
/*!
* \file
* \ingroup PorousmediumflowModels
* \brief Velocity output for porous media models.
*/
#ifndef DUMUX_BADPOROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
#define DUMUX_BADPOROUSMEDIUMFLOW_VELOCITYOUTPUT_HH
#include <dune/common/float_cmp.hh>
#include <dune/geometry/referenceelements.hh>
#include <memory>
#include <dumux/common/deprecated.hh>
#include <dumux/common/parameters.hh>
#include <dumux/discretization/elementsolution.hh>
#include <dumux/discretization/method.hh>
#include <dumux/io/velocityoutput.hh>
//#include <dumux/porousmediumflow/velocity.hh>
#include "badporousmediavelocity.hh"
namespace Dumux
{
/*!
* \ingroup PorousmediumflowModels
* \brief Velocity output policy for implicit (porous media) models.
*/
template<class GridVariables, class FluxVariables>
class BadPorousMediumFlowVelocityOutput : public VelocityOutput<GridVariables>
{
using ParentType = VelocityOutput<GridVariables>;
using GridGeometry = typename GridVariables::GridGeometry;
using FVElementGeometry = typename GridGeometry::LocalView;
using SubControlVolume = typename GridGeometry::SubControlVolume;
using SubControlVolumeFace = typename GridGeometry::SubControlVolumeFace;
using GridView = typename GridGeometry::GridView;
using Element = typename GridView::template Codim<0>::Entity;
using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
using ElementFluxVarsCache =
typename GridVariables::GridFluxVariablesCache::LocalView;
using VolumeVariables = typename GridVariables::VolumeVariables;
using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
using FluidSystem = typename VolumeVariables::FluidSystem;
using Scalar = typename GridVariables::Scalar;
static constexpr int dim = GridView::dimension;
static constexpr int dimWorld = GridView::dimensionworld;
static constexpr bool isBox =
GridGeometry::discMethod == DiscretizationMethod::box;
static constexpr int dofCodim = isBox ? dim : 0;
using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
using ReferenceElements =
Dune::ReferenceElements<typename GridView::ctype, dim>;
using Problem = typename GridVolumeVariables::Problem;
//using BoundaryTypes = typename Problem::Traits::BoundaryTypes;
using VelocityBackend =
BadPorousMediumFlowVelocity<GridVariables, FluxVariables>;
public:
using VelocityVector = typename ParentType::VelocityVector;
/*!
* \brief Constructor initializes the static data with the initial solution.
*
* \param gridVariables The grid variables
*/
BadPorousMediumFlowVelocityOutput(const GridVariables &gridVariables)
: gridVariables_(
gridVariables) // TODO: can be removed after the deprecated calculateVelocity interface is removed
{
// check, if velocity output can be used (works only for cubes so far)
enableOutput_ = getParamFromGroup<bool>(
gridVariables.curGridVolVars().problem().paramGroup(),
"Vtk.AddVelocity");
if (enableOutput_)
velocityBackend = std::make_unique<VelocityBackend>(gridVariables);
}
//! Returns whether or not velocity output is enabled.
bool enableOutput() const override { return enableOutput_; }
//! Returns the phase name of a given phase index.
std::string phaseName(int phaseIdx) const override
{
return FluidSystem::phaseName(phaseIdx);
}
//! Returns the number of phases.
int numFluidPhases() const override
{
return VolumeVariables::numFluidPhases();
}
//! Calculate the velocities for the scvs in the element
//! We assume the local containers to be bound to the complete stencil
/*[[deprecated("Use the new interface signature with elemFluxVarsCache")]]
void calculateVelocity(VelocityVector& velocity,
const ElementVolumeVariables& elemVolVars,
const FVElementGeometry& fvGeometry,
const Element& element,
int phaseIdx) const override
{
auto elemFluxVarsCache = localView(gridVariables_.gridFluxVarsCache());
elemFluxVarsCache.bind(element, fvGeometry, elemVolVars);
calculateVelocity(velocity, element, fvGeometry, elemVolVars, elemFluxVarsCache, phaseIdx);
}
*/
//! Calculates the velocities for the scvs in the element.
//! We assume the local containers to be bound to the complete stencil.
void calculateVelocity(VelocityVector &velocity,
const Element &element,
const FVElementGeometry &fvGeometry,
const ElementVolumeVariables &elemVolVars,
const ElementFluxVarsCache &elemFluxVarsCache,
int phaseIdx) const override
{
if (enableOutput_)
//std::cout << "calculateVelocity in BadPorousMediaFlow" << std::endl;
//std::cout << "VelocityBackend: " << typeid(velocityBackend).name() << std::endl;
velocityBackend->calculateVelocity(velocity, element, fvGeometry,
elemVolVars, elemFluxVarsCache,
phaseIdx);
}
private:
const GridVariables &
gridVariables_; // TODO: can be removed after the deprecated calculateVelocity interface is removed