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 | #ifndef DUMUX_NETWORK_TISSUE_TRANSPORT_PROPERTIES_HH | ||
8 | #define DUMUX_NETWORK_TISSUE_TRANSPORT_PROPERTIES_HH | ||
9 | |||
10 | // # Model (`TypeTag`) and property specializations (`properties.hh`) | ||
11 | // | ||
12 | // This file contains the __property definitions__ which configure | ||
13 | // the model and discretization method (at compile time). This file | ||
14 | // implements three models: a common base model `NetworkTissueModel`, | ||
15 | // and the sub-domain models `NetworkTransportModel` and `TissueTransportModel` | ||
16 | // that inherit some of the basic properties from the common ancestor `NetworkTissueModel`. | ||
17 | // By specializing properties for a model tag, every class that knows | ||
18 | // the model tag can extract these properties at compile time. (In C++ speak, the | ||
19 | // template structs that are specialized for different types are called "traits".) | ||
20 | // | ||
21 | // [[content]] | ||
22 | // | ||
23 | // ### Include headers | ||
24 | // [[codeblock]] | ||
25 | // 3d Cartesian grid implementation | ||
26 | #include <dune/grid/yaspgrid.hh> | ||
27 | // 1d in 3d embedded network grid implementation | ||
28 | #include <dune/foamgrid/foamgrid.hh> | ||
29 | // properties | ||
30 | #include <dumux/common/properties.hh> | ||
31 | // dof mapper that reorders dofs for optimal matrix pattern | ||
32 | #include <dumux/common/reorderingdofmapper.hh> | ||
33 | // discretization method | ||
34 | #include <dumux/discretization/cctpfa.hh> | ||
35 | // model equations | ||
36 | #include <dumux/porousmediumflow/tracer/model.hh> | ||
37 | // effective diffusion coefficient model | ||
38 | #include <dumux/material/fluidmatrixinteractions/diffusivityconstanttortuosity.hh> | ||
39 | // general multidomain traits | ||
40 | #include <dumux/multidomain/traits.hh> | ||
41 | // 1d-3d coupling manager with surface average operator | ||
42 | #include <dumux/multidomain/embedded/couplingmanager1d3d_average.hh> | ||
43 | |||
44 | #include "spatialparams.hh" | ||
45 | #include "problem.hh" | ||
46 | #include "tracerfluidsystem.hh" | ||
47 | // [[/codeblock]] | ||
48 | // | ||
49 | // ## Common properties of both models | ||
50 | // [[codeblock]] | ||
51 | namespace Dumux::Properties { | ||
52 | |||
53 | // inheriting all properties from the tracer model (advection-diffusion equation) | ||
54 | // and inheriting all properties from the cell-centered finite volume discretization with two-point flux approximation | ||
55 | namespace TTag { struct NetworkTissueModel { using InheritsFrom = std::tuple<Tracer, CCTpfaModel>; }; } | ||
56 | |||
57 | // caching options, enabling caching uses more memory but is faster in terms of runtime | ||
58 | template<class TypeTag> struct EnableGridGeometryCache<TypeTag, TTag::NetworkTissueModel> { static constexpr bool value = true; }; | ||
59 | template<class TypeTag> struct EnableGridVolumeVariablesCache<TypeTag, TTag::NetworkTissueModel> { static constexpr bool value = true; }; | ||
60 | template<class TypeTag> struct EnableGridFluxVariablesCache<TypeTag, TTag::NetworkTissueModel> { static constexpr bool value = true; }; | ||
61 | template<class TypeTag> struct SolutionDependentAdvection<TypeTag, TTag::NetworkTissueModel> { static constexpr bool value = false; }; | ||
62 | template<class TypeTag> struct SolutionDependentMolecularDiffusion<TypeTag, TTag::NetworkTissueModel> { static constexpr bool value = false; }; | ||
63 | template<class TypeTag> struct SolutionDependentHeatConduction<TypeTag, TTag::NetworkTissueModel> { static constexpr bool value = false; }; | ||
64 | |||
65 | // Set the fluid system (see `tracerfluidsystem.hh`) | ||
66 | template<class TypeTag> | ||
67 | struct FluidSystem<TypeTag, TTag::NetworkTissueModel> | ||
68 | { using type = TracerFluidSystem<double>; }; | ||
69 | |||
70 | // Use molar balances and a mole fraction as primary variable | ||
71 | template<class TypeTag> | ||
72 | struct UseMoles<TypeTag, TTag::NetworkTissueModel> | ||
73 | { static constexpr bool value = true; }; | ||
74 | |||
75 | } // end namespace Dumux::Properties | ||
76 | // [[/codeblock]] | ||
77 | // | ||
78 | // ## Network transport model | ||
79 | // [[codeblock]] | ||
80 | namespace Dumux::Properties { | ||
81 | |||
82 | namespace TTag { struct NetworkTransportModel { using InheritsFrom = std::tuple<NetworkTissueModel>; }; } | ||
83 | |||
84 | // Set the grid type | ||
85 | template<class TypeTag> | ||
86 | struct Grid<TypeTag, TTag::NetworkTransportModel> | ||
87 | { using type = Dune::FoamGrid<1, 3>; }; | ||
88 | |||
89 | // Set the problem property | ||
90 | template<class TypeTag> | ||
91 | struct Problem<TypeTag, TTag::NetworkTransportModel> | ||
92 | { using type = NetworkTransportProblem<TypeTag>; }; | ||
93 | |||
94 | // Set the spatial parameters | ||
95 | template<class TypeTag> | ||
96 | struct SpatialParams<TypeTag, TTag::NetworkTransportModel> | ||
97 | { using type = NetworkSpatialParams<GetPropType<TypeTag, Properties::GridGeometry>, double>; }; | ||
98 | |||
99 | // if we have pt scotch use the reordering dof mapper to optimally sort the dofs (cc) | ||
100 | template<class TypeTag> | ||
101 | struct GridGeometry<TypeTag, TTag::NetworkTransportModel> | ||
102 | { | ||
103 | private: | ||
104 | static constexpr bool enableCache = getPropValue<TypeTag, Properties::EnableGridGeometryCache>(); | ||
105 | using GridView = typename GetPropType<TypeTag, Properties::Grid>::LeafGridView; | ||
106 | using ElementMapper = ReorderingDofMapper<GridView>; | ||
107 | using VertexMapper = Dune::MultipleCodimMultipleGeomTypeMapper<GridView>; | ||
108 | using MapperTraits = DefaultMapperTraits<GridView, ElementMapper, VertexMapper>; | ||
109 | public: | ||
110 | using type = CCTpfaFVGridGeometry<GridView, enableCache, CCTpfaDefaultGridGeometryTraits<GridView, MapperTraits>>; | ||
111 | }; | ||
112 | |||
113 | template<class Scalar> | ||
114 | class EffectiveDiffusionTissuePVS | ||
115 | { | ||
116 | public: | ||
117 | template<class VolumeVariables> | ||
118 | static Scalar effectiveDiffusionCoefficient(const VolumeVariables& volVars, | ||
119 | const int phaseIdx, | ||
120 | const int compIdxI, | ||
121 | const int compIdxJ) | ||
122 | { | ||
123 | 348735 | const Scalar diffCoeff = volVars.diffusionCoefficient(phaseIdx, compIdxI, compIdxJ); | |
124 | 697470 | return volVars.porosity() * diffCoeff; | |
125 | } | ||
126 | }; | ||
127 | |||
128 | template<class TypeTag> | ||
129 | struct EffectiveDiffusivityModel<TypeTag, TTag::NetworkTransportModel> | ||
130 | { using type = EffectiveDiffusionTissuePVS<double>; }; | ||
131 | |||
132 | } // end namespace Dumux::Properties | ||
133 | // [[/codeblock]] | ||
134 | // | ||
135 | // ## Tissue transport model | ||
136 | // [[codeblock]] | ||
137 | namespace Dumux::Properties { | ||
138 | |||
139 | namespace TTag { struct TissueTransportModel { using InheritsFrom = std::tuple<NetworkTissueModel>; }; } | ||
140 | |||
141 | // Set the grid type | ||
142 | template<class TypeTag> | ||
143 | struct Grid<TypeTag, TTag::TissueTransportModel> | ||
144 | { using type = Dune::YaspGrid<3, Dune::EquidistantOffsetCoordinates<double, 3>>; }; | ||
145 | |||
146 | // Set the problem property | ||
147 | template<class TypeTag> | ||
148 | struct Problem<TypeTag, TTag::TissueTransportModel> | ||
149 | { using type = TissueTransportProblem<TypeTag>; }; | ||
150 | |||
151 | // Set the spatial parameters | ||
152 | template<class TypeTag> | ||
153 | struct SpatialParams<TypeTag, TTag::TissueTransportModel> | ||
154 | { using type = TissueSpatialParams<GetPropType<TypeTag, Properties::GridGeometry>, double>; }; | ||
155 | |||
156 | template<class Scalar> | ||
157 | class EffectiveDiffusionTissue | ||
158 | { | ||
159 | public: | ||
160 | template<class VolumeVariables> | ||
161 | 1608000 | static Scalar effectiveDiffusionCoefficient(const VolumeVariables& volVars, | |
162 | const int phaseIdx, | ||
163 | const int compIdxI, | ||
164 | const int compIdxJ) | ||
165 | { | ||
166 |
5/6✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1607993 times.
✓ Branch 3 taken 1 times.
✓ Branch 4 taken 6 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
|
1608000 | static const Scalar tau = getParam<Scalar>("Tissue.SpatialParams.Tortuosity"); |
167 | 1608000 | const Scalar diffCoeff = volVars.diffusionCoefficient(phaseIdx, compIdxI, compIdxJ); | |
168 | 3216000 | return tau * volVars.porosity() * diffCoeff; | |
169 | } | ||
170 | }; | ||
171 | |||
172 | // effective diffusivity model | ||
173 | template<class TypeTag> | ||
174 | struct EffectiveDiffusivityModel<TypeTag, TTag::TissueTransportModel> | ||
175 | { using type = EffectiveDiffusionTissue<double>; }; | ||
176 | |||
177 | } // end namespace Dumux::Properties | ||
178 | // [[/codeblock]] | ||
179 | // | ||
180 | // ## Multi-domain coupling | ||
181 | // [[codeblock]] | ||
182 | namespace Dumux::Properties { | ||
183 | |||
184 | using CouplingTransport = Embedded1d3dCouplingManager<MultiDomainTraits< | ||
185 | Properties::TTag::TissueTransportModel, Properties::TTag::NetworkTransportModel>, | ||
186 | Embedded1d3dCouplingMode::Average | ||
187 | >; | ||
188 | |||
189 | // tell the tissue sub-model about the coupling | ||
190 | template<class TypeTag> struct CouplingManager<TypeTag, TTag::TissueTransportModel> { using type = CouplingTransport; }; | ||
191 | template<class TypeTag> struct PointSource<TypeTag, TTag::TissueTransportModel> { using type = CouplingTransport::PointSourceTraits::template PointSource<0>; }; | ||
192 | template<class TypeTag> struct PointSourceHelper<TypeTag, TTag::TissueTransportModel> { using type = CouplingTransport::PointSourceTraits::template PointSourceHelper<0>; }; | ||
193 | |||
194 | // tell the network sub-model about the coupling | ||
195 | template<class TypeTag> struct CouplingManager<TypeTag, TTag::NetworkTransportModel> { using type = CouplingTransport; }; | ||
196 | template<class TypeTag> struct PointSource<TypeTag, TTag::NetworkTransportModel> { using type = CouplingTransport::PointSourceTraits::template PointSource<1>; }; | ||
197 | template<class TypeTag> struct PointSourceHelper<TypeTag, TTag::NetworkTransportModel> { using type = CouplingTransport::PointSourceTraits::template PointSourceHelper<1>; }; | ||
198 | |||
199 | } // end namespace Dumux::Properties | ||
200 | // [[/codeblock]] | ||
201 | // [[/content]] | ||
202 | #endif | ||
203 |