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 NavierStokesModel |
10 |
|
|
* |
11 |
|
|
* \brief A single-phase, isothermal Navier-Stokes model |
12 |
|
|
* |
13 |
|
|
* This model implements a single-phase, isothermal Navier-Stokes model, solving the <B> momentum balance equation </B> |
14 |
|
|
* \f[ |
15 |
|
|
\frac{\partial (\varrho \textbf{v})}{\partial t} + \nabla \cdot (\varrho \textbf{v} \textbf{v}^{\text{T}}) = \nabla \cdot (\mu (\nabla \textbf{v} + \nabla \textbf{v}^{\text{T}})) |
16 |
|
|
- \nabla p + \varrho \textbf{g} - \textbf{f} |
17 |
|
|
* \f] |
18 |
|
|
* By setting the runtime parameter <code>Problem.EnableInertiaTerms</code> to <code>false</code> the Stokes |
19 |
|
|
* equation can be solved. In this case the term |
20 |
|
|
* \f[ |
21 |
|
|
* \nabla \cdot (\varrho \textbf{v} \textbf{v}^{\text{T}}) |
22 |
|
|
* \f] |
23 |
|
|
* is neglected. |
24 |
|
|
* |
25 |
|
|
* The <B> mass balance equation </B> |
26 |
|
|
* \f[ |
27 |
|
|
\frac{\partial \varrho}{\partial t} + \nabla \cdot (\varrho \textbf{v}) - q = 0 |
28 |
|
|
* \f] |
29 |
|
|
* |
30 |
|
|
* closes the system. |
31 |
|
|
* |
32 |
|
|
*/ |
33 |
|
|
|
34 |
|
|
#ifndef DUMUX_FREEFLOW_NAVIERSTOKES_1P_MODEL_HH |
35 |
|
|
#define DUMUX_FREEFLOW_NAVIERSTOKES_1P_MODEL_HH |
36 |
|
|
|
37 |
|
|
#include <dumux/common/properties.hh> |
38 |
|
|
#include <dumux/common/properties/model.hh> |
39 |
|
|
|
40 |
|
|
#include <dumux/material/fluidstates/immiscible.hh> |
41 |
|
|
|
42 |
|
|
#include <dumux/freeflow/spatialparams.hh> |
43 |
|
|
#include <dumux/freeflow/navierstokes/iofields.hh> |
44 |
|
|
#include <dumux/freeflow/turbulencemodel.hh> |
45 |
|
|
#include <dumux/freeflow/navierstokes/energy/model.hh> |
46 |
|
|
#include <dumux/freeflow/navierstokes/scalarfluxvariablescachefiller.hh> |
47 |
|
|
|
48 |
|
|
#include <dumux/flux/fourierslaw.hh> |
49 |
|
|
|
50 |
|
|
#include "localresidual.hh" |
51 |
|
|
#include "volumevariables.hh" |
52 |
|
|
#include "fluxvariables.hh" |
53 |
|
|
#include "indices.hh" |
54 |
|
|
|
55 |
|
|
namespace Dumux { |
56 |
|
|
|
57 |
|
|
/*! |
58 |
|
|
* \ingroup NavierStokesModel |
59 |
|
|
* \brief Traits for the single-phase flow Navier-Stokes mass model |
60 |
|
|
*/ |
61 |
|
|
struct NavierStokesMassOnePModelTraits |
62 |
|
|
{ |
63 |
|
|
//! There are as many momentum balance equations as dimensions |
64 |
|
|
//! and one mass balance equation. |
65 |
|
|
static constexpr int numEq() { return 1; } |
66 |
|
|
|
67 |
|
|
//! The number of phases is 1 |
68 |
|
|
static constexpr int numFluidPhases() { return 1; } |
69 |
|
|
|
70 |
|
|
//! The number of components is 1 |
71 |
|
|
static constexpr int numFluidComponents() { return 1; } |
72 |
|
|
|
73 |
|
|
//! Enable advection |
74 |
|
|
static constexpr bool enableAdvection() { return true; } |
75 |
|
|
|
76 |
|
|
//! The one-phase one-component model has no molecular diffusion |
77 |
|
|
static constexpr bool enableMolecularDiffusion() { return false; } |
78 |
|
|
|
79 |
|
|
//! The model is isothermal |
80 |
|
|
static constexpr bool enableEnergyBalance() { return false; } |
81 |
|
|
|
82 |
|
|
//! The model does not include a turbulence model |
83 |
|
|
static constexpr bool usesTurbulenceModel() { return false; } |
84 |
|
|
|
85 |
|
|
//! return the type of turbulence model used |
86 |
|
|
static constexpr auto turbulenceModel() |
87 |
|
|
{ return TurbulenceModel::none; } |
88 |
|
|
|
89 |
|
|
//! the indices |
90 |
|
|
using Indices = NavierStokesMassOnePIndices; |
91 |
|
|
}; |
92 |
|
|
|
93 |
|
|
/*! |
94 |
|
|
* \ingroup NavierStokesModel |
95 |
|
|
* \brief Traits class for the volume variables of the Navier-Stokes model. |
96 |
|
|
* |
97 |
|
|
* \tparam PV The type used for primary variables |
98 |
|
|
* \tparam FSY The fluid system type |
99 |
|
|
* \tparam FST The fluid state type |
100 |
|
|
* \tparam MT The model traits |
101 |
|
|
*/ |
102 |
|
|
template<class PV, |
103 |
|
|
class FSY, |
104 |
|
|
class FST, |
105 |
|
|
class MT> |
106 |
|
|
struct NavierStokesMassOnePVolumeVariablesTraits |
107 |
|
|
{ |
108 |
|
|
using PrimaryVariables = PV; |
109 |
|
|
using FluidSystem = FSY; |
110 |
|
|
using FluidState = FST; |
111 |
|
|
using ModelTraits = MT; |
112 |
|
|
}; |
113 |
|
|
|
114 |
|
|
// \{ |
115 |
|
|
/////////////////////////////////////////////////////////////////////////// |
116 |
|
|
// properties for the single-phase Navier-Stokes model |
117 |
|
|
/////////////////////////////////////////////////////////////////////////// |
118 |
|
|
namespace Properties { |
119 |
|
|
|
120 |
|
|
////////////////////////////////////////////////////////////////// |
121 |
|
|
// Type tags |
122 |
|
|
////////////////////////////////////////////////////////////////// |
123 |
|
|
|
124 |
|
|
// Create new type tags |
125 |
|
|
namespace TTag { |
126 |
|
|
//! The type tag for the single-phase, isothermal Navier-Stokes model |
127 |
|
|
struct NavierStokesMassOneP{ using InheritsFrom = std::tuple<ModelProperties>; }; |
128 |
|
|
struct NavierStokesMassOnePNI{ using InheritsFrom = std::tuple<NavierStokesMassOneP>; }; |
129 |
|
|
} // end namespace TTag |
130 |
|
|
|
131 |
|
|
|
132 |
|
|
template<class TypeTag> |
133 |
|
|
struct ModelTraits<TypeTag, TTag::NavierStokesMassOneP> |
134 |
|
|
{ using type = NavierStokesMassOnePModelTraits; }; |
135 |
|
|
|
136 |
|
|
/*! |
137 |
|
|
* \brief The fluid state which is used by the volume variables to |
138 |
|
|
* store the thermodynamic state. This should be chosen |
139 |
|
|
* appropriately for the model ((non-)isothermal, equilibrium, ...). |
140 |
|
|
* This can be done in the problem. |
141 |
|
|
*/ |
142 |
|
|
template<class TypeTag> |
143 |
|
|
struct FluidState<TypeTag, TTag::NavierStokesMassOneP> |
144 |
|
|
{ |
145 |
|
|
private: |
146 |
|
|
using Scalar = GetPropType<TypeTag, Properties::Scalar>; |
147 |
|
|
using FluidSystem = GetPropType<TypeTag, Properties::FluidSystem>; |
148 |
|
|
public: |
149 |
|
|
using type = Dumux::ImmiscibleFluidState<Scalar, FluidSystem>; |
150 |
|
|
}; |
151 |
|
|
|
152 |
|
|
//! The local residual |
153 |
|
|
template<class TypeTag> |
154 |
|
|
struct LocalResidual<TypeTag, TTag::NavierStokesMassOneP> |
155 |
|
|
{ using type = NavierStokesMassOnePLocalResidual<TypeTag>; }; |
156 |
|
|
|
157 |
|
|
//! Set the volume variables property |
158 |
|
|
template<class TypeTag> |
159 |
|
|
struct VolumeVariables<TypeTag, TTag::NavierStokesMassOneP> |
160 |
|
|
{ |
161 |
|
|
private: |
162 |
|
|
using PV = GetPropType<TypeTag, Properties::PrimaryVariables>; |
163 |
|
|
using FSY = GetPropType<TypeTag, Properties::FluidSystem>; |
164 |
|
|
using FST = GetPropType<TypeTag, Properties::FluidState>; |
165 |
|
|
using MT = GetPropType<TypeTag, Properties::ModelTraits>; |
166 |
|
|
|
167 |
|
|
static_assert(FSY::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid system"); |
168 |
|
|
static_assert(FST::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid state"); |
169 |
|
|
static_assert(!FSY::isMiscible(), "The Navier-Stokes model only works with immiscible fluid systems."); |
170 |
|
|
|
171 |
|
|
using Traits = NavierStokesMassOnePVolumeVariablesTraits<PV, FSY, FST, MT>; |
172 |
|
|
public: |
173 |
|
|
using type = NavierStokesMassOnePVolumeVariables<Traits>; |
174 |
|
|
}; |
175 |
|
|
|
176 |
|
|
//! The flux variables |
177 |
|
|
template<class TypeTag> |
178 |
|
|
struct FluxVariables<TypeTag, TTag::NavierStokesMassOneP> |
179 |
|
|
{ |
180 |
|
|
private: |
181 |
|
|
using Problem = GetPropType<TypeTag, Properties::Problem>; |
182 |
|
|
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; |
183 |
|
|
struct DiffusiveFluxTypes {}; // no diffusion |
184 |
|
|
using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; |
185 |
|
|
using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; |
186 |
|
|
public: |
187 |
|
|
using type = NavierStokesMassOnePFluxVariables< |
188 |
|
|
Problem, ModelTraits, DiffusiveFluxTypes, ElementVolumeVariables, ElementFluxVariablesCache |
189 |
|
|
>; |
190 |
|
|
}; |
191 |
|
|
|
192 |
|
|
// ! The specific I/O fields |
193 |
|
|
template<class TypeTag> |
194 |
|
|
struct IOFields<TypeTag, TTag::NavierStokesMassOneP> { using type = NavierStokesIOFields; }; |
195 |
|
|
|
196 |
|
|
template<class TypeTag> |
197 |
|
|
struct CouplingManager<TypeTag, TTag::NavierStokesMassOneP> |
198 |
|
|
{ |
199 |
|
|
public: |
200 |
|
|
using type = struct EmptyCouplingManager {}; |
201 |
|
|
}; |
202 |
|
|
|
203 |
|
|
// Set the default spatial parameters |
204 |
|
|
template<class TypeTag> |
205 |
|
|
struct SpatialParams<TypeTag, TTag::NavierStokesMassOneP> |
206 |
|
|
{ |
207 |
|
|
using GridGeometry = GetPropType<TypeTag, Properties::GridGeometry>; |
208 |
|
|
using Scalar = GetPropType<TypeTag, Properties::Scalar>; |
209 |
|
|
using type = FreeFlowDefaultSpatialParams<GridGeometry, Scalar>; |
210 |
|
|
}; |
211 |
|
|
/////////////////////////////////////////////////////////////////////////// |
212 |
|
|
// Properties for the non-isothermal single phase model |
213 |
|
|
/////////////////////////////////////////////////////////////////////////// |
214 |
|
|
|
215 |
|
|
//! Add temperature to the output |
216 |
|
|
template<class TypeTag> |
217 |
|
|
struct IOFields<TypeTag, TTag::NavierStokesMassOnePNI> |
218 |
|
|
{ using type = NavierStokesEnergyIOFields<NavierStokesIOFields>; }; |
219 |
|
|
|
220 |
|
|
//! The model traits of the non-isothermal model |
221 |
|
|
template<class TypeTag> |
222 |
|
|
struct ModelTraits<TypeTag, TTag::NavierStokesMassOnePNI> |
223 |
|
|
{ using type = NavierStokesEnergyModelTraits<NavierStokesMassOnePModelTraits>; }; |
224 |
|
|
|
225 |
|
|
//! Set the volume variables property |
226 |
|
|
template<class TypeTag> |
227 |
|
|
struct VolumeVariables<TypeTag, TTag::NavierStokesMassOnePNI> |
228 |
|
|
{ |
229 |
|
|
private: |
230 |
|
|
using PV = GetPropType<TypeTag, Properties::PrimaryVariables>; |
231 |
|
|
using FSY = GetPropType<TypeTag, Properties::FluidSystem>; |
232 |
|
|
using FST = GetPropType<TypeTag, Properties::FluidState>; |
233 |
|
|
using MT = GetPropType<TypeTag, Properties::ModelTraits>; |
234 |
|
|
|
235 |
|
|
static_assert(FSY::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid system"); |
236 |
|
|
static_assert(FST::numPhases == MT::numFluidPhases(), "Number of phases mismatch between model and fluid state"); |
237 |
|
|
static_assert(!FSY::isMiscible(), "The Navier-Stokes model only works with immiscible fluid systems."); |
238 |
|
|
|
239 |
|
|
using BaseTraits = NavierStokesMassOnePVolumeVariablesTraits<PV, FSY, FST, MT>; |
240 |
|
|
using ETCM = GetPropType<TypeTag, Properties::ThermalConductivityModel>; |
241 |
|
|
using HCT = GetPropType<TypeTag, Properties::HeatConductionType>; |
242 |
|
|
struct NITraits : public BaseTraits |
243 |
|
|
{ |
244 |
|
|
using EffectiveThermalConductivityModel = ETCM; |
245 |
|
|
using HeatConductionType = HCT; |
246 |
|
|
}; |
247 |
|
|
public: |
248 |
|
|
using type = NavierStokesMassOnePVolumeVariables<NITraits>; |
249 |
|
|
}; |
250 |
|
|
|
251 |
|
|
//! Use the average for effective conductivities |
252 |
|
|
template<class TypeTag> |
253 |
|
|
struct ThermalConductivityModel<TypeTag, TTag::NavierStokesMassOnePNI> |
254 |
|
|
{ |
255 |
|
|
struct type |
256 |
|
|
{ |
257 |
|
|
template<class VolVars> |
258 |
|
✗ |
static auto effectiveThermalConductivity(const VolVars& volVars) |
259 |
|
|
{ |
260 |
|
328800 |
return volVars.fluidThermalConductivity(); |
261 |
|
|
} |
262 |
|
|
}; |
263 |
|
|
}; |
264 |
|
|
|
265 |
|
|
template<class TypeTag> |
266 |
|
|
struct HeatConductionType<TypeTag, TTag::NavierStokesMassOnePNI> |
267 |
|
|
{ using type = FouriersLaw<TypeTag>; }; |
268 |
|
|
|
269 |
|
|
//! The flux variables |
270 |
|
|
template<class TypeTag> |
271 |
|
|
struct FluxVariables<TypeTag, TTag::NavierStokesMassOnePNI> |
272 |
|
|
{ |
273 |
|
|
private: |
274 |
|
|
using Problem = GetPropType<TypeTag, Properties::Problem>; |
275 |
|
|
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; |
276 |
|
|
|
277 |
|
|
struct DiffusiveFluxTypes |
278 |
|
|
{ |
279 |
|
|
using HeatConductionType = GetPropType<TypeTag, Properties::HeatConductionType>; |
280 |
|
|
}; |
281 |
|
|
|
282 |
|
|
using ElementVolumeVariables = typename GetPropType<TypeTag, Properties::GridVolumeVariables>::LocalView; |
283 |
|
|
using ElementFluxVariablesCache = typename GetPropType<TypeTag, Properties::GridFluxVariablesCache>::LocalView; |
284 |
|
|
|
285 |
|
|
public: |
286 |
|
|
using type = NavierStokesMassOnePFluxVariables< |
287 |
|
|
Problem, ModelTraits, DiffusiveFluxTypes, ElementVolumeVariables, ElementFluxVariablesCache |
288 |
|
|
>; |
289 |
|
|
}; |
290 |
|
|
|
291 |
|
|
template<class TypeTag> |
292 |
|
|
struct FluxVariablesCache<TypeTag, TTag::NavierStokesMassOnePNI> |
293 |
|
|
{ |
294 |
|
|
struct type : public GetPropType<TypeTag, Properties::HeatConductionType>::Cache |
295 |
|
|
{}; |
296 |
|
|
}; |
297 |
|
|
|
298 |
|
|
template<class TypeTag> |
299 |
|
|
struct FluxVariablesCacheFiller<TypeTag, TTag::NavierStokesMassOnePNI> |
300 |
|
|
{ |
301 |
|
|
using Problem = GetPropType<TypeTag, Properties::Problem>; |
302 |
|
|
using ModelTraits = GetPropType<TypeTag, Properties::ModelTraits>; |
303 |
|
|
static constexpr bool diffusionIsSolDependent = false; // no diffusion; |
304 |
|
|
static constexpr bool heatConductionIsSolDependent |
305 |
|
|
= getPropValue<TypeTag, Properties::SolutionDependentHeatConduction>(); |
306 |
|
|
|
307 |
|
|
using type = FreeFlowScalarFluxVariablesCacheFiller< |
308 |
|
|
Problem, ModelTraits, diffusionIsSolDependent, heatConductionIsSolDependent |
309 |
|
|
>; |
310 |
|
|
}; |
311 |
|
|
|
312 |
|
|
template<class TypeTag> |
313 |
|
|
struct SolutionDependentHeatConduction<TypeTag, TTag::NavierStokesMassOnePNI> |
314 |
|
|
{ static constexpr bool value = true; }; |
315 |
|
|
|
316 |
|
|
} // end namespace Properties |
317 |
|
|
} // end namespace Dumux |
318 |
|
|
|
319 |
|
|
#endif |
320 |
|
|
|