3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
freeflow/navierstokes/problem.hh
Go to the documentation of this file.
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 * See the file COPYING for full copying permissions. *
5 * *
6 * This program is free software: you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation, either version 3 of the License, or *
9 * (at your option) any later version. *
10 * *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
18 *****************************************************************************/
24#ifndef DUMUX_NAVIERSTOKES_PROBLEM_HH
25#define DUMUX_NAVIERSTOKES_PROBLEM_HH
26
27#include <dune/common/exceptions.hh>
28#include <dune/common/typetraits.hh>
35
36namespace Dumux {
37
39template<class TypeTag, class DiscretizationMethod> struct NavierStokesParentProblemImpl;
40
41// compatibility with old-style Navier-Stokes models
42template<class TypeTag>
43struct NavierStokesParentProblemImpl<TypeTag, DiscretizationMethods::Staggered>
44{
46};
47
49template<class TypeTag>
52>::type;
53
54template<class TypeTag, class DiscretizationMethod>
56
57template<class TypeTag>
58class NavierStokesProblemImpl<TypeTag, DiscretizationMethods::FCStaggered>
59: public FVProblemWithSpatialParams<TypeTag>
60{
62 using Implementation = GetPropType<TypeTag, Properties::Problem>;
63
65 using GridView = typename GridGeometry::GridView;
66 using Element = typename GridView::template Codim<0>::Entity;
67
69 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
70 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
72
73 using FVElementGeometry = typename GridGeometry::LocalView;
74 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
75 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
77
78 enum {
79 dim = GridView::dimension,
80 dimWorld = GridView::dimensionworld
81 };
82
83 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
84 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
85 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
88
89 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
90
91
92public:
96 using InitialValues = Dune::FieldVector<Scalar, dimWorld>;
97 using Sources = Dune::FieldVector<Scalar, dimWorld>;
98 using DirichletValues = Dune::FieldVector<Scalar, dimWorld>;
99 using BoundaryFluxes = Dune::FieldVector<Scalar, dimWorld>;
100
101 using MomentumFluxType = Dune::FieldVector<Scalar, dimWorld>;
102
105
107 static constexpr bool isMomentumProblem() { return true; }
108
115 NavierStokesProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
116 std::shared_ptr<CouplingManager> couplingManager,
117 const std::string& paramGroup = "")
118 : ParentType(gridGeometry, paramGroup)
119 , gravity_(0.0)
120 , couplingManager_(couplingManager)
121 {
122 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
123 gravity_[dim-1] = -9.81;
124
125 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
126 }
127
133 NavierStokesProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
134 const std::string& paramGroup = "")
135 : NavierStokesProblemImpl(gridGeometry, {}, paramGroup)
136 {}
137
156 Sources source(const Element& element,
157 const FVElementGeometry& fvGeometry,
158 const ElementVolumeVariables& elemVolVars,
159 const SubControlVolume& scv) const
160 {
161 // forward to solution independent, fully-implicit specific interface
162 return asImp_().sourceAtPos(scv.dofPosition());
163 }
164
178 Sources sourceAtPos(const GlobalPosition& globalPos) const
179 {
182 return Sources(0.0);
183 }
184
192 auto boundaryTypes(const Element& element,
193 const SubControlVolumeFace& scvf) const
194 {
195 // Forward it to the method which only takes the global coordinate.
196 // We evaluate the boundary type at the center of the sub control volume face
197 // in order to avoid ambiguities at domain corners.
198 return asImp_().boundaryTypesAtPos(scvf.center());
199 }
200
209 DirichletValues dirichlet(const Element& element, const SubControlVolumeFace& scvf) const
210 {
211 return asImp_().dirichletAtPos(scvf.ipGlobal());
212 }
213
223 template<class ElementFluxVariablesCache>
224 BoundaryFluxes neumann(const Element& element,
225 const FVElementGeometry& fvGeometry,
226 const ElementVolumeVariables& elemVolVars,
227 const ElementFluxVariablesCache& elemFluxVarsCache,
228 const SubControlVolumeFace& scvf) const
229 { return asImp_().neumannAtPos(scvf.ipGlobal()); }
230
234 BoundaryFluxes neumannAtPos(const GlobalPosition& globalPos) const
235 { return BoundaryFluxes(0.0); }
236
243 const GravityVector& gravity() const
244 { return gravity_; }
245
250 { return enableInertiaTerms_; }
251
256 Scalar pressure(const Element& element,
257 const FVElementGeometry& fvGeometry,
258 const SubControlVolumeFace& scvf) const
259 {
260 if constexpr (isCoupled_)
261 return couplingManager_->pressure(element, fvGeometry, scvf);
262 else
263 return asImp_().pressureAtPos(scvf.ipGlobal());
264 }
265
269 Scalar pressureAtPos(const GlobalPosition&) const
270 {
271 DUNE_THROW(Dune::NotImplemented, "pressureAtPos not implemented");
272 }
273
280 Scalar referencePressure(const Element& element,
281 const FVElementGeometry& fvGeometry,
282 const SubControlVolumeFace& scvf) const
283 { return 0.0; }
284
289 Scalar density(const Element& element,
290 const FVElementGeometry& fvGeometry,
291 const SubControlVolumeFace& scvf) const
292 {
293 if constexpr (isCoupled_)
294 return couplingManager_->density(element, fvGeometry, scvf);
295 else
296 return asImp_().densityAtPos(scvf.ipGlobal());
297 }
298
303 Scalar density(const Element& element,
304 const SubControlVolume& scv,
305 const bool isPreviousTimeStep = false) const
306 {
307 if constexpr (isCoupled_)
308 return couplingManager_->density(element, scv, isPreviousTimeStep);
309 else
310 return asImp_().densityAtPos(scv.dofPosition());
311 }
312
313 auto insideAndOutsideDensity(const Element& element,
314 const FVElementGeometry& fvGeometry,
315 const SubControlVolumeFace& scvf,
316 const bool isPreviousTimeStep = false) const
317 {
318 if constexpr (isCoupled_)
319 return couplingManager_->insideAndOutsideDensity(element, fvGeometry, scvf, isPreviousTimeStep);
320 else
321 {
322 const auto rho = asImp_().densityAtPos(scvf.ipGlobal());
323 return std::make_pair(rho, rho);
324 }
325 }
326
330 Scalar densityAtPos(const GlobalPosition&) const
331 {
332 DUNE_THROW(Dune::NotImplemented, "densityAtPos not implemented");
333 }
334
339 Scalar effectiveViscosity(const Element& element,
340 const FVElementGeometry& fvGeometry,
341 const SubControlVolumeFace& scvf) const
342 {
343 if constexpr (isCoupled_)
344 return couplingManager_->effectiveViscosity(element, fvGeometry, scvf);
345 else
346 return asImp_().effectiveViscosityAtPos(scvf.ipGlobal());
347 }
348
352 Scalar effectiveViscosityAtPos(const GlobalPosition&) const
353 {
354 DUNE_THROW(Dune::NotImplemented, "effectiveViscosityAtPos not implemented");
355 }
356
361 template<class SolutionVector>
362 void applyInitialSolution(SolutionVector& sol) const
363 {
364 sol.resize(this->gridGeometry().numDofs());
365 std::vector<bool> dofHandled(this->gridGeometry().numDofs(), false);
366 auto fvGeometry = localView(this->gridGeometry());
367 for (const auto& element : elements(this->gridGeometry().gridView()))
368 {
369 fvGeometry.bindElement(element);
370 for (const auto& scv : scvs(fvGeometry))
371 {
372 const auto dofIdx = scv.dofIndex();
373 if (!dofHandled[dofIdx])
374 {
375 dofHandled[dofIdx] = true;
376 sol[dofIdx] = asImp_().initial(scv)[scv.dofAxis()];
377 }
378 }
379 }
380 }
381
385 InitialValues initial(const SubControlVolume& scv) const
386 {
387 return asImp_().initialAtPos(scv.dofPosition());
388 }
389
391 Scalar pseudo3DWallFriction(const Element& element,
392 const FVElementGeometry& fvGeometry,
393 const ElementVolumeVariables& elemVolVars,
394 const SubControlVolume& scv,
395 const Scalar height,
396 const Scalar factor = 8.0) const
397 {
398 const Scalar velocity = elemVolVars[scv].velocity();
399 const auto scvf = scvfs(fvGeometry, scv).begin();
400 const Scalar viscosity = effectiveViscosity(element, fvGeometry, *scvf);
401 return pseudo3DWallFriction(velocity, viscosity, height, factor);
402 }
403
417 Scalar pseudo3DWallFriction(const Scalar velocity,
418 const Scalar viscosity,
419 const Scalar height,
420 const Scalar factor = 8.0) const
421 {
422 static_assert(dim == 2, "Pseudo 3D wall friction may only be used in 2D");
423 return -factor * velocity * viscosity / (height*height);
424 }
425
431 bool onSlipBoundary(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
432 { return asImp_().onSlipBoundaryAtPos(scvf.center()); }
433
438 bool onSlipBoundaryAtPos(const GlobalPosition& pos) const
439 { return false; }
440
445 Scalar permeability(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
446 {
447 DUNE_THROW(Dune::NotImplemented,
448 "When using the Beavers-Joseph-Saffman boundary condition, "
449 "the permeability must be returned in the actual problem"
450 );
451 }
452
457 Scalar alphaBJ(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
458 {
459 DUNE_THROW(Dune::NotImplemented,
460 "When using the Beavers-Joseph-Saffman boundary condition, "
461 "the alpha value must be returned in the actual problem"
462 );
463 }
464
468 Scalar betaBJ(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf, const GlobalPosition& tangentialVector) const
469 {
470 const Scalar interfacePermeability = interfacePermeability_(fvGeometry, scvf, tangentialVector);
471 using std::sqrt;
472 return asImp_().alphaBJ(fvGeometry, scvf) / sqrt(interfacePermeability);
473 }
474
478 VelocityVector porousMediumVelocity(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
479 {
480 return VelocityVector(0.0);
481 }
482
487 const VelocityVector beaversJosephVelocity(const FVElementGeometry& fvGeometry,
488 const SubControlVolumeFace& scvf,
489 const ElementVolumeVariables& elemVolVars,
490 Scalar tangentialVelocityGradient) const
491 {
492 assert(scvf.isLateral());
493 assert(scvf.boundary());
494
495 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
496
497 // create a unit normal vector oriented in positive coordinate direction
498 GlobalPosition orientation(0.0);
499 orientation[scv.dofAxis()] = 1.0;
500
501 // du/dy + dv/dx = beta * (u_boundary-uPM)
502 // beta = alpha/sqrt(K)
503 const Scalar betaBJ = asImp_().betaBJ(fvGeometry, scvf, orientation);
504 const Scalar distanceNormalToBoundary = (scvf.ipGlobal() - scv.dofPosition()).two_norm();
505
506 static const bool onlyNormalGradient = getParamFromGroup<bool>(this->paramGroup(), "FreeFlow.EnableUnsymmetrizedVelocityGradientForBeaversJoseph", false);
507 if (onlyNormalGradient)
508 tangentialVelocityGradient = 0.0;
509
510 const Scalar scalarSlipVelocity = (tangentialVelocityGradient*distanceNormalToBoundary
511 + asImp_().porousMediumVelocity(fvGeometry, scvf) * orientation * betaBJ * distanceNormalToBoundary
512 + elemVolVars[scv].velocity()) / (betaBJ*distanceNormalToBoundary + 1.0);
513
514 orientation *= scalarSlipVelocity;
515 return orientation;
516 }
517
518 const CouplingManager& couplingManager() const
519 {
520 if constexpr (isCoupled_)
521 return *couplingManager_;
522 else
523 DUNE_THROW(Dune::InvalidStateException,
524 "Accessing coupling manager of an uncoupled problem is not possible."
525 );
526 }
527
528private:
530 template<class Scvf>
531 Scalar interfacePermeability_(const FVElementGeometry& fvGeometry, const Scvf& scvf, const GlobalPosition& tangentialVector) const
532 {
533 const auto& K = asImp_().permeability(fvGeometry, scvf);
534
535 // use t*K*t for permeability tensors
536 if constexpr (Dune::IsNumber<std::decay_t<decltype(K)>>::value)
537 return K;
538 else
539 return vtmv(tangentialVector, K, tangentialVector);
540 }
541
543 Implementation& asImp_()
544 { return *static_cast<Implementation *>(this); }
545
547 const Implementation& asImp_() const
548 { return *static_cast<const Implementation *>(this); }
549
550 GravityVector gravity_;
551 bool enableInertiaTerms_;
552 std::shared_ptr<CouplingManager> couplingManager_;
553};
554
555template<class TypeTag>
556class NavierStokesProblemImpl<TypeTag, DiscretizationMethods::CCTpfa>
557: public FVProblemWithSpatialParams<TypeTag>
558{
560 using Implementation = GetPropType<TypeTag, Properties::Problem>;
561
563 using GridView = typename GridGeometry::GridView;
564 using FVElementGeometry = typename GridGeometry::LocalView;
565 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
566 using Element = typename GridView::template Codim<0>::Entity;
567 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
568 using VelocityVector = GlobalPosition;
572
573 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
574
575public:
576
581 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
582 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
583 using DirichletValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
584 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
585
587 using BoundaryTypes = Dumux::BoundaryTypes<ModelTraits::numEq()>;
588
590 static constexpr bool isMomentumProblem() { return false; }
591
598 NavierStokesProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
599 std::shared_ptr<CouplingManager> couplingManager,
600 const std::string& paramGroup = "")
601 : ParentType(gridGeometry, paramGroup)
602 , couplingManager_(couplingManager)
603 {}
604
610 NavierStokesProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
611 const std::string& paramGroup = "")
612 : NavierStokesProblemImpl(gridGeometry, {}, paramGroup)
613 {}
614
618 VelocityVector faceVelocity(const Element& element,
619 const FVElementGeometry& fvGeometry,
620 const SubControlVolumeFace& scvf) const
621 {
622 if constexpr (isCoupled_)
623 return couplingManager_->faceVelocity(element, scvf);
624 else
625 return asImp_().velocityAtPos(scvf.ipGlobal());
626 }
627
631 VelocityVector velocityAtPos(const GlobalPosition&) const
632 {
633 DUNE_THROW(Dune::NotImplemented, "velocityAtPos not implemented");
634 }
635
645 [[deprecated("temperature should now be defined in the spatial params with temperature(globalPos)")]]
646 Scalar temperatureAtPos(const GlobalPosition& globalPos, int deprecationHelper = 0) const
647 { return asImp_().temperature(); }
648
652 [[deprecated("temperature should now be defined in the spatial params with temperature(globalPos)")]]
653 Scalar temperature(int deprecationHelper = 0) const
654 {
655 DUNE_THROW(Dune::NotImplemented, "temperature() method not implemented by the actual problem");
656 }
657
658 const CouplingManager& couplingManager() const
659 {
660 if constexpr (isCoupled_)
661 return *couplingManager_;
662 else
663 DUNE_THROW(Dune::InvalidStateException,
664 "Accessing coupling manager of an uncoupled problem is not possible."
665 );
666 }
667
668private:
670 Implementation &asImp_()
671 { return *static_cast<Implementation *>(this); }
672
674 const Implementation &asImp_() const
675 { return *static_cast<const Implementation *>(this); }
676
677 std::shared_ptr<CouplingManager> couplingManager_;
678};
679
687template<class TypeTag>
688class NavierStokesProblemImpl<TypeTag, DiscretizationMethods::Staggered>
689: public NavierStokesParentProblem<TypeTag>
690{
691 using ParentType = NavierStokesParentProblem<TypeTag>;
692 using Implementation = GetPropType<TypeTag, Properties::Problem>;
693
695 using GridView = typename GridGeometry::GridView;
696 using Element = typename GridView::template Codim<0>::Entity;
697
699 using GridFaceVariables = typename GridVariables::GridFaceVariables;
700 using ElementFaceVariables = typename GridFaceVariables::LocalView;
701 using FaceVariables = typename GridFaceVariables::FaceVariables;
702 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
703 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
705
706 using FVElementGeometry = typename GridGeometry::LocalView;
707 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
708 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
711
712 enum {
713 dim = GridView::dimension,
714 dimWorld = GridView::dimensionworld
715 };
716
717 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
718 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
719 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
720
721public:
727 NavierStokesProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry, const std::string& paramGroup = "")
728 : ParentType(gridGeometry, paramGroup)
729 , gravity_(0.0)
730 {
731 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
732 gravity_[dim-1] = -9.81;
733
734 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
735 }
736
746 [[deprecated("temperature should now be defined in the spatial params with temperature(globalPos)")]]
747 Scalar temperatureAtPos(const GlobalPosition &globalPos, int deprecationHelper = 0) const
748 { return asImp_().temperature(); }
749
755 [[deprecated("temperature should now be defined in the spatial params with temperature(globalPos)")]]
756 Scalar temperature(int deprecationHelper = 0) const
757 { DUNE_THROW(Dune::NotImplemented, "temperature() method not implemented by the actual problem"); }
758
765 const GravityVector& gravity() const
766 { return gravity_; }
767
772 { return enableInertiaTerms_; }
773
775 template <class SolutionVector, class G = GridGeometry>
776 typename std::enable_if<G::discMethod == DiscretizationMethods::staggered, void>::type
777 applyInitialFaceSolution(SolutionVector& sol,
778 const SubControlVolumeFace& scvf,
779 const PrimaryVariables& initSol) const
780 {
781 sol[GridGeometry::faceIdx()][scvf.dofIndex()][0] = initSol[Indices::velocity(scvf.directionIndex())];
782 }
783
797 Scalar pseudo3DWallFriction(const Scalar velocity,
798 const Scalar viscosity,
799 const Scalar height,
800 const Scalar factor = 8.0) const
801 {
802 static_assert(dim == 2, "Pseudo 3D wall friction may only be used in 2D");
803 return -factor * velocity * viscosity / (height*height);
804 }
805
807 template <class ElementVolumeVariables, class ElementFaceVariables, class G = GridGeometry>
808 typename std::enable_if<G::discMethod == DiscretizationMethods::staggered, Scalar>::type
809 pseudo3DWallFriction(const SubControlVolumeFace& scvf,
810 const ElementVolumeVariables& elemVolVars,
811 const ElementFaceVariables& elemFaceVars,
812 const Scalar height,
813 const Scalar factor = 8.0) const
814 {
815 const Scalar velocity = elemFaceVars[scvf].velocitySelf();
816 const Scalar viscosity = elemVolVars[scvf.insideScvIdx()].effectiveViscosity();
817 return pseudo3DWallFriction(velocity, viscosity, height, factor);
818 }
819
825 Scalar permeability(const Element& element, const SubControlVolumeFace& scvf) const
826 {
827 DUNE_THROW(Dune::NotImplemented,
828 "When using the Beavers-Joseph-Saffman boundary condition, "
829 "the permeability must be returned in the actual problem"
830 );
831 }
832
838 Scalar alphaBJ(const SubControlVolumeFace& scvf) const
839 {
840 DUNE_THROW(Dune::NotImplemented,
841 "When using the Beavers-Joseph-Saffman boundary condition, "
842 "the alpha value must be returned in the actual problem"
843 );
844 }
845
849 Scalar betaBJ(const Element& element, const SubControlVolumeFace& scvf, const GlobalPosition& tangentialVector) const
850 {
851 const Scalar interfacePermeability = interfacePermeability_(element, scvf, tangentialVector);
852 using std::sqrt;
853 return asImp_().alphaBJ(scvf) / sqrt(interfacePermeability);
854 }
855
859 VelocityVector porousMediumVelocity(const Element& element, const SubControlVolumeFace& scvf) const
860 {
861 return VelocityVector(0.0);
862 }
863
867 const Scalar beaversJosephVelocity(const Element& element,
868 const SubControlVolume& scv,
869 const SubControlVolumeFace& ownScvf,
870 const SubControlVolumeFace& faceOnPorousBoundary,
871 const Scalar velocitySelf,
872 const Scalar tangentialVelocityGradient) const
873 {
874 // create a unit normal vector oriented in positive coordinate direction
875 GlobalPosition orientation = ownScvf.unitOuterNormal();
876 orientation[ownScvf.directionIndex()] = 1.0;
877
878 // du/dy + dv/dx = alpha/sqrt(K) * (u_boundary-uPM)
879 // beta = alpha/sqrt(K)
880 const Scalar betaBJ = asImp_().betaBJ(element, faceOnPorousBoundary, orientation);
881 const Scalar distanceNormalToBoundary = (faceOnPorousBoundary.center() - scv.center()).two_norm();
882
883 return (tangentialVelocityGradient*distanceNormalToBoundary
884 + asImp_().porousMediumVelocity(element, faceOnPorousBoundary) * orientation * betaBJ * distanceNormalToBoundary
885 + velocitySelf) / (betaBJ*distanceNormalToBoundary + 1.0);
886 }
887
888private:
890 Scalar interfacePermeability_(const Element& element, const SubControlVolumeFace& scvf, const GlobalPosition& tangentialVector) const
891 {
892 const auto& K = asImp_().permeability(element, scvf);
893
894 // use t*K*t for permeability tensors
895 if constexpr (Dune::IsNumber<std::decay_t<decltype(K)>>::value)
896 return K;
897 else
898 return vtmv(tangentialVector, K, tangentialVector);
899 }
900
902 Implementation &asImp_()
903 { return *static_cast<Implementation *>(this); }
904
906 const Implementation &asImp_() const
907 { return *static_cast<const Implementation *>(this); }
908
909 GravityVector gravity_;
910 bool enableInertiaTerms_;
911};
912
913
920template<class TypeTag>
923>;
924
925} // end namespace Dumux
926
927#endif
A helper to deduce a vector with the same size as numbers of equations.
Base class for all finite volume problems that are parameterized.
Base class for all staggered fv problems.
The available discretization methods in Dumux.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:38
Dune::DenseMatrix< MAT >::value_type vtmv(const Dune::DenseVector< V1 > &v1, const Dune::DenseMatrix< MAT > &M, const Dune::DenseVector< V2 > &v2)
Evaluates the scalar product of a vector v2, projected by a matrix M, with a vector v1.
Definition: math.hh:863
Definition: adapt.hh:29
typename NavierStokesParentProblemImpl< TypeTag, typename GetPropType< TypeTag, Properties::GridGeometry >::DiscretizationMethod >::type NavierStokesParentProblem
The actual NavierStokesParentProblem.
Definition: freeflow/navierstokes/problem.hh:52
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:38
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:55
Base class for all finite-volume problems using spatial parameters.
Definition: fvproblemwithspatialparams.hh:41
Base class for all staggered finite-volume problems.
Definition: staggeredfvproblem.hh:48
Class to specify the type of a boundary condition for the Navier-Stokes model.
Definition: freeflow/navierstokes/momentum/boundarytypes.hh:37
The implementation is specialized for the different discretizations.
Definition: freeflow/navierstokes/problem.hh:39
Definition: freeflow/navierstokes/problem.hh:55
Sources source(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: freeflow/navierstokes/problem.hh:156
bool onSlipBoundary(const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns true if the scvf is located on a boundary with a slip condition.
Definition: freeflow/navierstokes/problem.hh:431
Scalar alphaBJ(const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition...
Definition: freeflow/navierstokes/problem.hh:457
bool enableInertiaTerms() const
Returns whether intertia terms should be considered.
Definition: freeflow/navierstokes/problem.hh:249
Scalar densityAtPos(const GlobalPosition &) const
Returns the density at a given position.
Definition: freeflow/navierstokes/problem.hh:330
auto boundaryTypes(const Element &element, const SubControlVolumeFace &scvf) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition: freeflow/navierstokes/problem.hh:192
Dune::FieldVector< Scalar, dimWorld > InitialValues
Definition: freeflow/navierstokes/problem.hh:96
Dune::FieldVector< Scalar, dimWorld > Sources
Definition: freeflow/navierstokes/problem.hh:97
Scalar permeability(const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boun...
Definition: freeflow/navierstokes/problem.hh:445
BoundaryFluxes neumann(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const ElementFluxVariablesCache &elemFluxVarsCache, const SubControlVolumeFace &scvf) const
Evaluates the boundary conditions for a Neumann control volume.
Definition: freeflow/navierstokes/problem.hh:224
const CouplingManager & couplingManager() const
Definition: freeflow/navierstokes/problem.hh:518
const GravityVector & gravity() const
A default, i.e. if the user's does not overload any neumann method.
Definition: freeflow/navierstokes/problem.hh:243
NavierStokesProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition: freeflow/navierstokes/problem.hh:133
Dune::FieldVector< Scalar, dimWorld > BoundaryFluxes
Definition: freeflow/navierstokes/problem.hh:99
const VelocityVector beaversJosephVelocity(const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, Scalar tangentialVelocityGradient) const
Returns the slip velocity at a porous boundary based on the Beavers-Joseph(-Saffman) condition.
Definition: freeflow/navierstokes/problem.hh:487
VelocityVector porousMediumVelocity(const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the velocity in the porous medium (which is 0 by default according to Saffmann).
Definition: freeflow/navierstokes/problem.hh:478
BoundaryFluxes neumannAtPos(const GlobalPosition &globalPos) const
Returns the neumann flux at a given position.
Definition: freeflow/navierstokes/problem.hh:234
Scalar effectiveViscosityAtPos(const GlobalPosition &) const
Returns the effective dynamic viscosity at a given position.
Definition: freeflow/navierstokes/problem.hh:352
Dune::FieldVector< Scalar, dimWorld > DirichletValues
Definition: freeflow/navierstokes/problem.hh:98
Scalar betaBJ(const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf, const GlobalPosition &tangentialVector) const
Returns the beta value which is the alpha value divided by the square root of the (scalar-valued) int...
Definition: freeflow/navierstokes/problem.hh:468
Scalar density(const Element &element, const SubControlVolume &scv, const bool isPreviousTimeStep=false) const
Returns the density at a given sub control volume.
Definition: freeflow/navierstokes/problem.hh:303
static constexpr bool isMomentumProblem()
This problem is used for the momentum balance model.
Definition: freeflow/navierstokes/problem.hh:107
auto insideAndOutsideDensity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf, const bool isPreviousTimeStep=false) const
Definition: freeflow/navierstokes/problem.hh:313
Scalar density(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the density at a given sub control volume face.
Definition: freeflow/navierstokes/problem.hh:289
Scalar pseudo3DWallFriction(const Scalar velocity, const Scalar viscosity, const Scalar height, const Scalar factor=8.0) const
An additional drag term can be included as source term for the momentum balance to mimic 3D flow beha...
Definition: freeflow/navierstokes/problem.hh:417
Scalar pressure(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the pressure at a given sub control volume face.
Definition: freeflow/navierstokes/problem.hh:256
DirichletValues dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
Evaluate the boundary conditions for a dirichlet control volume face.
Definition: freeflow/navierstokes/problem.hh:209
Scalar pressureAtPos(const GlobalPosition &) const
Returns the pressure at a given position.
Definition: freeflow/navierstokes/problem.hh:269
Dune::FieldVector< Scalar, dimWorld > MomentumFluxType
Definition: freeflow/navierstokes/problem.hh:101
Scalar effectiveViscosity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the effective dynamic viscosity at a given sub control volume face.
Definition: freeflow/navierstokes/problem.hh:339
NavierStokesProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/problem.hh:115
Sources sourceAtPos(const GlobalPosition &globalPos) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition: freeflow/navierstokes/problem.hh:178
InitialValues initial(const SubControlVolume &scv) const
Evaluate the initial value at an sub control volume.
Definition: freeflow/navierstokes/problem.hh:385
Scalar referencePressure(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns a reference pressure at a given sub control volume face. This pressure is substracted from th...
Definition: freeflow/navierstokes/problem.hh:280
Scalar pseudo3DWallFriction(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv, const Scalar height, const Scalar factor=8.0) const
Convenience function for staggered grid implementation.
Definition: freeflow/navierstokes/problem.hh:391
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: freeflow/navierstokes/problem.hh:362
bool onSlipBoundaryAtPos(const GlobalPosition &pos) const
Returns true if the scvf is located on a boundary with a slip condition.
Definition: freeflow/navierstokes/problem.hh:438
Dune::FieldVector< Scalar, ModelTraits::numEq()> DirichletValues
Definition: freeflow/navierstokes/problem.hh:583
NavierStokesProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/problem.hh:598
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition: freeflow/navierstokes/problem.hh:581
static constexpr bool isMomentumProblem()
this problem is used for the mass balance model
Definition: freeflow/navierstokes/problem.hh:590
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition: freeflow/navierstokes/problem.hh:582
const CouplingManager & couplingManager() const
Definition: freeflow/navierstokes/problem.hh:658
VelocityVector faceVelocity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf) const
Returns the normal velocity at a given sub control volume face.
Definition: freeflow/navierstokes/problem.hh:618
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition: freeflow/navierstokes/problem.hh:584
NavierStokesProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition: freeflow/navierstokes/problem.hh:610
Scalar temperatureAtPos(const GlobalPosition &globalPos, int deprecationHelper=0) const
Returns the temperature at a given global position.
Definition: freeflow/navierstokes/problem.hh:646
Scalar temperature(int deprecationHelper=0) const
Returns the temperature within the domain.
Definition: freeflow/navierstokes/problem.hh:653
VelocityVector velocityAtPos(const GlobalPosition &) const
Returns the velocity at a given position.
Definition: freeflow/navierstokes/problem.hh:631
Scalar alphaBJ(const SubControlVolumeFace &scvf) const
Returns the alpha value required as input parameter for the Beavers-Joseph-Saffman boundary condition...
Definition: freeflow/navierstokes/problem.hh:838
Scalar pseudo3DWallFriction(const Scalar velocity, const Scalar viscosity, const Scalar height, const Scalar factor=8.0) const
An additional drag term can be included as source term for the momentum balance to mimic 3D flow beha...
Definition: freeflow/navierstokes/problem.hh:797
std::enable_if< G::discMethod==DiscretizationMethods::staggered, Scalar >::type pseudo3DWallFriction(const SubControlVolumeFace &scvf, const ElementVolumeVariables &elemVolVars, const ElementFaceVariables &elemFaceVars, const Scalar height, const Scalar factor=8.0) const
Convenience function for staggered grid implementation.
Definition: freeflow/navierstokes/problem.hh:809
VelocityVector porousMediumVelocity(const Element &element, const SubControlVolumeFace &scvf) const
Returns the velocity in the porous medium (which is 0 by default according to Saffmann).
Definition: freeflow/navierstokes/problem.hh:859
const Scalar beaversJosephVelocity(const Element &element, const SubControlVolume &scv, const SubControlVolumeFace &ownScvf, const SubControlVolumeFace &faceOnPorousBoundary, const Scalar velocitySelf, const Scalar tangentialVelocityGradient) const
Returns the slip velocity at a porous boundary based on the Beavers-Joseph(-Saffman) condition.
Definition: freeflow/navierstokes/problem.hh:867
Scalar betaBJ(const Element &element, const SubControlVolumeFace &scvf, const GlobalPosition &tangentialVector) const
Returns the beta value which is the alpha value divided by the square root of the (scalar-valued) int...
Definition: freeflow/navierstokes/problem.hh:849
bool enableInertiaTerms() const
Returns whether interia terms should be considered.
Definition: freeflow/navierstokes/problem.hh:771
std::enable_if< G::discMethod==DiscretizationMethods::staggered, void >::type applyInitialFaceSolution(SolutionVector &sol, const SubControlVolumeFace &scvf, const PrimaryVariables &initSol) const
Applys the initial face solution (velocities on the faces). Specialization for staggered grid discret...
Definition: freeflow/navierstokes/problem.hh:777
Scalar permeability(const Element &element, const SubControlVolumeFace &scvf) const
Returns the intrinsic permeability of required as input parameter for the Beavers-Joseph-Saffman boun...
Definition: freeflow/navierstokes/problem.hh:825
NavierStokesProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/problem.hh:727
Scalar temperatureAtPos(const GlobalPosition &globalPos, int deprecationHelper=0) const
Returns the temperature at a given global position.
Definition: freeflow/navierstokes/problem.hh:747
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: freeflow/navierstokes/problem.hh:765
Scalar temperature(int deprecationHelper=0) const
Returns the temperature within the domain.
Definition: freeflow/navierstokes/problem.hh:756
Declares all properties used in Dumux.