| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | // -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- | ||
| 2 | // vi: set et ts=4 sw=4 sts=4: | ||
| 3 | // | ||
| 4 | // SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder | ||
| 5 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 6 | // | ||
| 7 | /*! | ||
| 8 | * \file | ||
| 9 | * \ingroup TwoPTests | ||
| 10 | * \brief Soil contamination problem where DNAPL infiltrates a fully | ||
| 11 | * water saturated medium. | ||
| 12 | */ | ||
| 13 | |||
| 14 | #ifndef DUMUX_LENSPROBLEM_ADAPTIVE_HH | ||
| 15 | #define DUMUX_LENSPROBLEM_ADAPTIVE_HH | ||
| 16 | |||
| 17 | #include <dumux/io/container.hh> | ||
| 18 | #include "../incompressible/problem.hh" | ||
| 19 | |||
| 20 | namespace Dumux { | ||
| 21 | |||
| 22 | /*! | ||
| 23 | * \ingroup TwoPTests | ||
| 24 | * \brief Soil contamination problem where DNAPL infiltrates a fully | ||
| 25 | * water saturated medium. | ||
| 26 | */ | ||
| 27 | template <class TypeTag > | ||
| 28 | class TwoPTestProblemAdaptive : public TwoPTestProblem<TypeTag> | ||
| 29 | { | ||
| 30 | using ParentType = TwoPTestProblem<TypeTag>; | ||
| 31 | using GridView = typename GetPropType<TypeTag, Properties::GridGeometry>::GridView; | ||
| 32 | using Element = typename GridView::template Codim<0>::Entity; | ||
| 33 | using Vertex = typename GridView::template Codim<GridView::dimensionworld>::Entity; | ||
| 34 | using Scalar = GetPropType<TypeTag, Properties::Scalar>; | ||
| 35 | using PrimaryVariables = GetPropType<TypeTag, Properties::PrimaryVariables>; | ||
| 36 | using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; | ||
| 37 | |||
| 38 | static constexpr bool isBox = GridGeometry::discMethod == DiscretizationMethods::box; | ||
| 39 | |||
| 40 | public: | ||
| 41 | 4 | TwoPTestProblemAdaptive(std::shared_ptr<const GridGeometry> gridGeometry) | |
| 42 |
2/4✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
|
8 | : ParentType(gridGeometry) |
| 43 | { | ||
| 44 | if(!isBox) | ||
| 45 |
3/6✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 3 times.
|
3 | initialValues_ = readFileToContainer<std::vector<PrimaryVariables>>("initialsolutioncc.txt"); |
| 46 | else | ||
| 47 |
3/6✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
|
1 | initialValues_ = readFileToContainer<std::vector<PrimaryVariables>>("initialsolutionbox.txt"); |
| 48 | 4 | } | |
| 49 | |||
| 50 | /*! | ||
| 51 | * \brief Evaluates the initial value for an element for cell-centered models. | ||
| 52 | */ | ||
| 53 | 18432 | PrimaryVariables initial(const Element& element) const | |
| 54 | { | ||
| 55 | 18432 | const auto delta = 0.0625; | |
| 56 |
1/2✓ Branch 1 taken 18432 times.
✗ Branch 2 not taken.
|
18432 | unsigned int cellsX = this->gridGeometry().bBoxMax()[0]/delta; |
| 57 |
1/2✓ Branch 1 taken 18432 times.
✗ Branch 2 not taken.
|
18432 | const auto globalPos = element.geometry().center(); |
| 58 | |||
| 59 | // the input data corresponds to a uniform grid with discretization length deltaX_ | ||
| 60 | 18432 | unsigned int dataIdx = std::trunc(globalPos[1]/delta) * cellsX + std::trunc(globalPos[0]/delta); | |
| 61 | 18432 | return initialValues_[dataIdx]; | |
| 62 | } | ||
| 63 | |||
| 64 | /*! | ||
| 65 | * \brief Evaluates the initial value for a vertex for vertex-centered models. | ||
| 66 | */ | ||
| 67 | 6305 | PrimaryVariables initial(const Vertex& vertex) const | |
| 68 | { | ||
| 69 | 6305 | const auto delta = 0.0625; | |
| 70 | 6305 | unsigned int verticesX = this->gridGeometry().bBoxMax()[0]/delta + 1; | |
| 71 | 6305 | const auto globalPos = vertex.geometry().center(); | |
| 72 | |||
| 73 | // the input data corresponds to a uniform grid with discretization length deltaX_ | ||
| 74 | 6305 | unsigned int dataIdx = std::trunc(globalPos[1]/delta) * verticesX + std::trunc(globalPos[0]/delta); | |
| 75 | 6305 | return initialValues_[dataIdx]; | |
| 76 | } | ||
| 77 | |||
| 78 | private: | ||
| 79 | std::vector<PrimaryVariables> initialValues_; | ||
| 80 | }; | ||
| 81 | |||
| 82 | } // end namespace Dumux | ||
| 83 | |||
| 84 | #endif | ||
| 85 |