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-FileCopyrightInfo: 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 TwoPNCTests | ||
10 | * \brief Definition of the spatial parameters for water management in PEM fuel cells. | ||
11 | */ | ||
12 | |||
13 | #ifndef DUMUX_FUELCELL_SPATIAL_PARAMS_HH | ||
14 | #define DUMUX_FUELCELL_SPATIAL_PARAMS_HH | ||
15 | |||
16 | #include <dumux/porousmediumflow/properties.hh> | ||
17 | #include <dumux/porousmediumflow/fvspatialparamsmp.hh> | ||
18 | #include <dumux/material/fluidmatrixinteractions/2p/vangenuchten.hh> | ||
19 | |||
20 | namespace Dumux { | ||
21 | /*! | ||
22 | * \ingroup TwoPNCTests | ||
23 | * \brief Definition of the spatial parameters for water management in PEM fuel cells. | ||
24 | */ | ||
25 | template<class GridGeometry, class Scalar> | ||
26 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
3 | class FuelCellSpatialParams |
27 | : public FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, | ||
28 | FuelCellSpatialParams<GridGeometry, Scalar>> | ||
29 | { | ||
30 | using GridView = typename GridGeometry::GridView; | ||
31 | using ThisType = FuelCellSpatialParams<GridGeometry, Scalar>; | ||
32 | using ParentType = FVPorousMediumFlowSpatialParamsMP<GridGeometry, Scalar, ThisType>; | ||
33 | |||
34 | static constexpr int dimWorld = GridView::dimensionworld; | ||
35 | |||
36 | using Element = typename GridGeometry::GridView::template Codim<0>::Entity; | ||
37 | using GlobalPosition = typename Element::Geometry::GlobalCoordinate; | ||
38 | |||
39 | using DimWorldMatrix = Dune::FieldMatrix<Scalar, dimWorld, dimWorld>; | ||
40 | |||
41 | using PcKrSwCurve = FluidMatrix::VanGenuchtenDefault<Scalar>; | ||
42 | |||
43 | public: | ||
44 | using PermeabilityType = DimWorldMatrix; | ||
45 | |||
46 | 3 | FuelCellSpatialParams(std::shared_ptr<const GridGeometry> gridGeometry) | |
47 | : ParentType(gridGeometry) | ||
48 | , K_(0) | ||
49 |
7/20✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
✓ Branch 7 taken 3 times.
✗ Branch 8 not taken.
✓ Branch 10 taken 3 times.
✗ Branch 11 not taken.
✓ Branch 13 taken 3 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 3 times.
✓ Branch 18 taken 3 times.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
|
12 | , pcKrSwCurve_("SpatialParams") |
50 | { | ||
51 | // intrinsic permeabilities | ||
52 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
6 | K_[0][0] = 5e-11; |
53 |
2/4✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 4 taken 3 times.
✗ Branch 5 not taken.
|
6 | K_[1][1] = 5e-11; |
54 |
1/2✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
|
3 | temperature_ = getParam<Scalar>("Problem.InitialTemperature"); |
55 | 3 | } | |
56 | |||
57 | /*! | ||
58 | * \brief Returns the hydraulic conductivity \f$[m^2]\f$ | ||
59 | * | ||
60 | * \param globalPos The global position | ||
61 | */ | ||
62 | ✗ | DimWorldMatrix permeabilityAtPos(const GlobalPosition& globalPos) const | |
63 | 301713 | { return K_; } | |
64 | |||
65 | /*! | ||
66 | * \brief Defines the porosity \f$[-]\f$ of the spatial parameters | ||
67 | * | ||
68 | * \param globalPos The global position | ||
69 | */ | ||
70 | ✗ | Scalar porosityAtPos(const GlobalPosition& globalPos) const | |
71 | ✗ | { return 0.2; } | |
72 | |||
73 | /*! | ||
74 | * \brief Returns the fluid-matrix interaction law at a given location | ||
75 | * \param globalPos A global coordinate vector | ||
76 | */ | ||
77 | ✗ | auto fluidMatrixInteractionAtPos(const GlobalPosition &globalPos) const | |
78 | { | ||
79 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 301713 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 301713 times.
|
1206852 | return makeFluidMatrixInteraction(pcKrSwCurve_); |
80 | } | ||
81 | |||
82 | /*! | ||
83 | * \brief Function for defining which phase is to be considered as the wetting phase. | ||
84 | * | ||
85 | * \param globalPos The position of the center of the element | ||
86 | * \return The wetting phase index | ||
87 | * \note We set a hydrophobic material. | ||
88 | */ | ||
89 | template<class FluidSystem> | ||
90 | ✗ | int wettingPhaseAtPos(const GlobalPosition& globalPos) const | |
91 | ✗ | { return FluidSystem::gasPhaseIdx; } | |
92 | |||
93 | /*! | ||
94 | * \brief Returns the temperature in the domain at the given position | ||
95 | * \param globalPos The position in global coordinates where the temperature should be specified. | ||
96 | */ | ||
97 | ✗ | Scalar temperatureAtPos(const GlobalPosition& globalPos) const | |
98 | { | ||
99 | ✗ | return temperature_; | |
100 | } | ||
101 | |||
102 | private: | ||
103 | DimWorldMatrix K_; | ||
104 | static constexpr Scalar eps_ = 1e-6; | ||
105 | const PcKrSwCurve pcKrSwCurve_; | ||
106 | Scalar temperature_; | ||
107 | }; | ||
108 | |||
109 | } // end namespace Dumux | ||
110 | |||
111 | #endif | ||
112 |