version 3.11-dev
Loading...
Searching...
No Matches
freeflow/navierstokes/momentum/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// SPDX-FileCopyrightText: Copyright © DuMux Project contributors, see AUTHORS.md in root folder
5// SPDX-License-Identifier: GPL-3.0-or-later
6//
12#ifndef DUMUX_NAVIERSTOKES_MOMENTUM_PROBLEM_HH
13#define DUMUX_NAVIERSTOKES_MOMENTUM_PROBLEM_HH
14
15#include <dune/common/exceptions.hh>
16#include <dune/common/fvector.hh>
17#include <dune/common/typetraits.hh>
18#include <dumux/common/boundarytypes_.hh>
21#include <dumux/common/concepts/variables_.hh>
27
28namespace Dumux {
29
30template<class TypeTag, class DiscretizationMethod>
32
33template<class TypeTag>
35: public FVProblemWithSpatialParams<TypeTag>
36{
37 using ParentType = FVProblemWithSpatialParams<TypeTag>;
38 using Implementation = GetPropType<TypeTag, Properties::Problem>;
39
41 using GridView = typename GridGeometry::GridView;
42 using Element = typename GridView::template Codim<0>::Entity;
43
45 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
46 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
48
49 using FVElementGeometry = typename GridGeometry::LocalView;
50 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
51 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
53
54 enum {
55 dim = GridView::dimension,
56 dimWorld = GridView::dimensionworld
57 };
58
59 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
60 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
61 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
64
65 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
66
67
68public:
72 using InitialValues = Dune::FieldVector<Scalar, dimWorld>;
73 using Sources = Dune::FieldVector<Scalar, dimWorld>;
74 using DirichletValues = Dune::FieldVector<Scalar, dimWorld>;
75 using BoundaryFluxes = Dune::FieldVector<Scalar, dimWorld>;
76
77 using MomentumFluxType = Dune::FieldVector<Scalar, dimWorld>;
78
81
83 static constexpr bool isMomentumProblem() { return true; }
84
91 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
92 std::shared_ptr<CouplingManager> couplingManager,
93 const std::string& paramGroup = "")
94 : ParentType(gridGeometry, paramGroup)
95 , gravity_(0.0)
96 , couplingManager_(couplingManager)
97 {
98 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
99 gravity_[dim-1] = -9.81;
100
101 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
102 }
103
109 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
110 const std::string& paramGroup = "")
112 {}
113
132 Sources source(const Element& element,
133 const FVElementGeometry& fvGeometry,
134 const ElementVolumeVariables& elemVolVars,
135 const SubControlVolume& scv) const
136 {
137 // forward to solution independent, fully-implicit specific interface
138 return asImp_().sourceAtPos(scv.dofPosition());
139 }
140
154 Sources sourceAtPos(const GlobalPosition& globalPos) const
155 {
158 return Sources(0.0);
159 }
160
167 Sources scvPointSources(const Element& element,
168 const FVElementGeometry& fvGeometry,
169 const ElementVolumeVariables& elemVolVars,
170 const SubControlVolume& scv) const
171 {
172 if (!this->pointSourceMap().empty())
173 DUNE_THROW(Dune::NotImplemented, "scvPointSources not implemented");
174
175 return Sources(0.0);
176 }
177
185 auto boundaryTypes(const Element& element,
186 const SubControlVolumeFace& scvf) const
187 {
188 // Forward it to the method which only takes the global coordinate.
189 // We evaluate the boundary type at the center of the sub control volume face
190 // in order to avoid ambiguities at domain corners.
191 return asImp_().boundaryTypesAtPos(scvf.center());
192 }
193
202 DirichletValues dirichlet(const Element& element, const SubControlVolumeFace& scvf) const
203 {
204 return asImp_().dirichletAtPos(scvf.ipGlobal());
205 }
206
216 template<class ElementFluxVariablesCache>
217 BoundaryFluxes neumann(const Element& element,
218 const FVElementGeometry& fvGeometry,
219 const ElementVolumeVariables& elemVolVars,
220 const ElementFluxVariablesCache& elemFluxVarsCache,
221 const SubControlVolumeFace& scvf) const
222 { return asImp_().neumannAtPos(scvf.ipGlobal()); }
223
227 BoundaryFluxes neumannAtPos(const GlobalPosition& globalPos) const
228 { return BoundaryFluxes(0.0); }
229
236 const GravityVector& gravity() const
237 { return gravity_; }
238
243 { return enableInertiaTerms_; }
244
249 Scalar pressure(const Element& element,
250 const FVElementGeometry& fvGeometry,
251 const SubControlVolumeFace& scvf) const
252 {
253 if constexpr (isCoupled_)
254 return couplingManager_->pressure(element, fvGeometry, scvf);
255 else
256 return asImp_().pressureAtPos(scvf.ipGlobal());
257 }
258
262 Scalar pressureAtPos(const GlobalPosition&) const
263 {
264 DUNE_THROW(Dune::NotImplemented, "pressureAtPos not implemented");
265 }
266
273 Scalar referencePressure(const Element& element,
274 const FVElementGeometry& fvGeometry,
275 const SubControlVolumeFace& scvf) const
276 { return 0.0; }
277
282 Scalar density(const Element& element,
283 const FVElementGeometry& fvGeometry,
284 const SubControlVolumeFace& scvf) const
285 {
286 if constexpr (isCoupled_)
287 return couplingManager_->density(element, fvGeometry, scvf);
288 else
289 return asImp_().densityAtPos(scvf.ipGlobal());
290 }
291
296 Scalar density(const Element& element,
297 const SubControlVolume& scv,
298 const bool isPreviousTimeStep = false) const
299 {
300 if constexpr (isCoupled_)
301 return couplingManager_->density(element, scv, isPreviousTimeStep);
302 else
303 return asImp_().densityAtPos(scv.dofPosition());
304 }
305
306 auto insideAndOutsideDensity(const Element& element,
307 const FVElementGeometry& fvGeometry,
308 const SubControlVolumeFace& scvf,
309 const bool isPreviousTimeStep = false) const
310 {
311 if constexpr (isCoupled_)
312 return couplingManager_->insideAndOutsideDensity(element, fvGeometry, scvf, isPreviousTimeStep);
313 else
314 {
315 const auto rho = asImp_().densityAtPos(scvf.ipGlobal());
316 return std::make_pair(rho, rho);
317 }
318 }
319
323 Scalar densityAtPos(const GlobalPosition&) const
324 {
325 DUNE_THROW(Dune::NotImplemented, "densityAtPos not implemented");
326 }
327
332 Scalar effectiveViscosity(const Element& element,
333 const FVElementGeometry& fvGeometry,
334 const SubControlVolumeFace& scvf) const
335 {
336 if constexpr (isCoupled_)
337 return couplingManager_->effectiveViscosity(element, fvGeometry, scvf);
338 else
339 return asImp_().effectiveViscosityAtPos(scvf.ipGlobal());
340 }
341
346 Scalar effectiveViscosity(const Element& element,
347 const FVElementGeometry& fvGeometry,
348 const SubControlVolume& scv) const
349 {
350 if constexpr (isCoupled_)
351 return couplingManager_->effectiveViscosity(element, fvGeometry, scv);
352 else
353 return asImp_().effectiveViscosityAtPos(scv.dofPosition());
354 }
355
359 Scalar effectiveViscosityAtPos(const GlobalPosition&) const
360 {
361 DUNE_THROW(Dune::NotImplemented, "effectiveViscosityAtPos not implemented");
362 }
363
368 template<class SolutionVector>
369 void applyInitialSolution(SolutionVector& sol) const
370 {
371 sol.resize(this->gridGeometry().numDofs());
372 std::vector<bool> dofHandled(this->gridGeometry().numDofs(), false);
373 auto fvGeometry = localView(this->gridGeometry());
374 for (const auto& element : elements(this->gridGeometry().gridView()))
375 {
376 fvGeometry.bindElement(element);
377 for (const auto& scv : scvs(fvGeometry))
378 {
379 const auto dofIdx = scv.dofIndex();
380 if (!dofHandled[dofIdx])
381 {
382 dofHandled[dofIdx] = true;
383 sol[dofIdx] = asImp_().initial(scv)[scv.dofAxis()];
384 }
385 }
386 }
387 }
388
392 InitialValues initial(const SubControlVolume& scv) const
393 {
394 return asImp_().initialAtPos(scv.dofPosition());
395 }
396
398 Scalar pseudo3DWallFriction(const Element& element,
399 const FVElementGeometry& fvGeometry,
400 const ElementVolumeVariables& elemVolVars,
401 const SubControlVolume& scv,
402 const Scalar height,
403 const Scalar factor = 8.0) const
404 {
405 const Scalar velocity = elemVolVars[scv].velocity();
406 const auto scvf = scvfs(fvGeometry, scv).begin();
407 const Scalar viscosity = effectiveViscosity(element, fvGeometry, *scvf);
408 return pseudo3DWallFriction(velocity, viscosity, height, factor);
409 }
410
424 Scalar pseudo3DWallFriction(const Scalar velocity,
425 const Scalar viscosity,
426 const Scalar height,
427 const Scalar factor = 8.0) const
428 {
429 static_assert(dim == 2, "Pseudo 3D wall friction may only be used in 2D");
430 return -factor * velocity * viscosity / (height*height);
431 }
432
438 bool onSlipBoundary(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
439 { return asImp_().onSlipBoundaryAtPos(scvf.center()); }
440
445 bool onSlipBoundaryAtPos(const GlobalPosition& pos) const
446 { return false; }
447
448 const CouplingManager& couplingManager() const
449 {
450 if constexpr (isCoupled_)
451 return *couplingManager_;
452 else
453 DUNE_THROW(Dune::InvalidStateException,
454 "Accessing coupling manager of an uncoupled problem is not possible."
455 );
456 }
457
458private:
460 Implementation& asImp_()
461 { return *static_cast<Implementation *>(this); }
462
464 const Implementation& asImp_() const
465 { return *static_cast<const Implementation *>(this); }
466
467 GravityVector gravity_;
468 bool enableInertiaTerms_;
469 std::shared_ptr<CouplingManager> couplingManager_;
470};
471
475template<class TypeTag, class DM>
477: public FVProblemWithSpatialParams<TypeTag>
478{
479 using ParentType = FVProblemWithSpatialParams<TypeTag>;
480 using Implementation = GetPropType<TypeTag, Properties::Problem>;
481
483 using GridView = typename GridGeometry::GridView;
484 using Element = typename GridView::template Codim<0>::Entity;
485
487 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
488 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
490
491 using FVElementGeometry = typename GridGeometry::LocalView;
492 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
493 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
495
496 static constexpr int dim = GridView::dimension;
497 static constexpr int dimWorld = GridView::dimensionworld;
498
499 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
500 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
501 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
504
505public:
509 using InitialValues = Dune::FieldVector<Scalar, dimWorld>;
510 using Sources = Dune::FieldVector<Scalar, dimWorld>;
511 using DirichletValues = Dune::FieldVector<Scalar, dimWorld>;
512 using BoundaryFluxes = Dune::FieldVector<Scalar, dimWorld>;
513
516
518 static constexpr bool isMomentumProblem() { return true; }
519
526 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
527 std::shared_ptr<CouplingManager> couplingManager,
528 const std::string& paramGroup = "")
529 : ParentType(gridGeometry, paramGroup)
530 , gravity_(0.0)
531 , couplingManager_(couplingManager)
532 {
533 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
534 gravity_[dim-1] = -9.81;
535
536 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
537 }
538
544 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
545 const std::string& paramGroup = "")
547 {}
548
567 template<class ElementVolumeVariables>
568 Sources source(const Element &element,
569 const FVElementGeometry& fvGeometry,
570 const ElementVolumeVariables& elemVolVars,
571 const SubControlVolume &scv) const
572 {
573 // forward to solution independent, fully-implicit specific interface
574 return asImp_().sourceAtPos(scv.center());
575 }
576
589 Sources sourceAtPos(const GlobalPosition &globalPos) const
590 {
593 return Sources(0.0);
594 }
595
603 BoundaryTypes boundaryTypes(const Element& element,
604 const SubControlVolume& scv) const
605 {
606 // forward it to the method which only takes the global coordinate
607 return asImp_().boundaryTypesAtPos(scv.dofPosition());
608 }
609
617 BoundaryTypes boundaryTypes(const Element& element,
618 const SubControlVolumeFace& scvf) const
619 {
620 DUNE_THROW(Dune::InvalidStateException, "boundaryTypes(..., scvf) called for a CVFE method.");
621 }
622
630 DirichletValues dirichlet(const Element& element, const SubControlVolume& scv) const
631 {
632 // forward it to the method which only takes the global coordinate
633 return asImp_().dirichletAtPos(scv.dofPosition());
634 }
635
643 DirichletValues dirichlet(const Element& element, const SubControlVolumeFace& scvf) const
644 {
645 // forward it to the method which only takes the global coordinate
646 DUNE_THROW(Dune::InvalidStateException, "dirichlet(scvf) called for CVFE method.");
647 }
648
655 const GravityVector& gravity() const
656 { return gravity_; }
657
662 { return enableInertiaTerms_; }
663
670 Scalar referencePressure() const
671 { return 0.0; }
672
677 Scalar pressure(const Element& element,
678 const FVElementGeometry& fvGeometry,
679 const SubControlVolumeFace& scvf) const
680 {
681 if constexpr (std::is_empty_v<CouplingManager>)
682 return asImp_().pressureAtPos(scvf.ipGlobal());
683 else
684 return couplingManager_->pressure(element, fvGeometry, scvf);
685 }
686
691 Scalar pressure(const Element& element,
692 const FVElementGeometry& fvGeometry,
693 const SubControlVolume& scv,
694 const bool isPreviousTimeStep = false) const
695 {
696 if constexpr (std::is_empty_v<CouplingManager>)
697 return asImp_().pressureAtPos(scv.dofPosition());
698 else
699 return couplingManager_->pressure(element, fvGeometry, scv, isPreviousTimeStep);
700 }
701
706 template<class IpData>
707 Scalar pressure(const Element& element,
708 const FVElementGeometry& fvGeometry,
709 const IpData& ipData,
710 const bool isPreviousTimeStep = false) const
711 {
712 if constexpr (std::is_empty_v<CouplingManager>)
713 return asImp_().pressureAtPos(ipData.global());
714 else
715 return couplingManager_->pressure(element, fvGeometry, ipData, isPreviousTimeStep);
716 }
717
721 Scalar pressureAtPos(const GlobalPosition&) const
722 {
723 DUNE_THROW(Dune::NotImplemented, "pressureAtPos not implemented");
724 }
725
730 Scalar density(const Element& element,
731 const FVElementGeometry& fvGeometry,
732 const SubControlVolumeFace& scvf) const
733 {
734 if constexpr (std::is_empty_v<CouplingManager>)
735 return asImp_().densityAtPos(scvf.ipGlobal());
736 else
737 return couplingManager_->density(element, fvGeometry, scvf);
738 }
739
744 Scalar density(const Element& element,
745 const FVElementGeometry& fvGeometry,
746 const SubControlVolume& scv,
747 const bool isPreviousTimeStep = false) const
748 {
749 if constexpr (std::is_empty_v<CouplingManager>)
750 return asImp_().densityAtPos(scv.dofPosition());
751 else
752 return couplingManager_->density(element, fvGeometry, scv, isPreviousTimeStep);
753 }
754
759 template<class IpData>
760 Scalar density(const Element& element,
761 const FVElementGeometry& fvGeometry,
762 const IpData& ipData,
763 const bool isPreviousTimeStep = false) const
764 {
765 if constexpr (std::is_empty_v<CouplingManager>)
766 return asImp_().densityAtPos(ipData.global());
767 else
768 return couplingManager_->density(element, fvGeometry, ipData, isPreviousTimeStep);
769 }
770
774 Scalar densityAtPos(const GlobalPosition&) const
775 {
776 DUNE_THROW(Dune::NotImplemented, "densityAtPos not implemented");
777 }
778
783 Scalar effectiveViscosity(const Element& element,
784 const FVElementGeometry& fvGeometry,
785 const SubControlVolumeFace& scvf) const
786 {
787 if constexpr (std::is_empty_v<CouplingManager>)
788 return asImp_().effectiveViscosityAtPos(scvf.ipGlobal());
789 else
790 return couplingManager_->effectiveViscosity(element, fvGeometry, scvf);
791 }
792
797 Scalar effectiveViscosity(const Element& element,
798 const FVElementGeometry& fvGeometry,
799 const SubControlVolume& scv,
800 const bool isPreviousTimeStep = false) const
801 {
802 if constexpr (std::is_empty_v<CouplingManager>)
803 return asImp_().effectiveViscosityAtPos(scv.dofPosition());
804 else
805 return couplingManager_->effectiveViscosity(element, fvGeometry, scv, isPreviousTimeStep);
806 }
807
812 template<class IpData>
813 Scalar effectiveViscosity(const Element& element,
814 const FVElementGeometry& fvGeometry,
815 const IpData& ipData,
816 const bool isPreviousTimeStep = false) const
817 {
818 if constexpr (std::is_empty_v<CouplingManager>)
819 return asImp_().effectiveViscosityAtPos(ipData.global());
820 else
821 return couplingManager_->effectiveViscosity(element, fvGeometry, ipData, isPreviousTimeStep);
822 }
823
827 Scalar effectiveViscosityAtPos(const GlobalPosition&) const
828 {
829 DUNE_THROW(Dune::NotImplemented, "effectiveViscosityAtPos not implemented");
830 }
831
836 template<class SolutionVector>
837 void applyInitialSolution(SolutionVector& sol) const
838 {
839 static_assert(GridGeometry::discMethod == DiscretizationMethods::CVFE<DM>{});
840 sol.resize(this->gridGeometry().numDofs());
841 std::vector<bool> dofHandled(this->gridGeometry().numDofs(), false);
842 auto fvGeometry = localView(this->gridGeometry());
843 for (const auto& element : elements(this->gridGeometry().gridView()))
844 {
845 fvGeometry.bindElement(element);
846 for (const auto& scv : scvs(fvGeometry))
847 {
848 const auto dofIdx = scv.dofIndex();
849 if (!dofHandled[dofIdx])
850 {
851 dofHandled[dofIdx] = true;
852 sol[dofIdx] = asImp_().initial(scv);
853 }
854 }
855 }
856 }
857
861 InitialValues initial(const SubControlVolume& scv) const
862 {
863 static_assert(GridGeometry::discMethod == DiscretizationMethods::CVFE<DM>{});
864 return asImp_().initialAtPos(scv.dofPosition());
865 }
866
867private:
869 Implementation &asImp_()
870 { return *static_cast<Implementation *>(this); }
871
873 const Implementation &asImp_() const
874 { return *static_cast<const Implementation *>(this); }
875
876 GravityVector gravity_;
877 bool enableInertiaTerms_;
878 std::shared_ptr<CouplingManager> couplingManager_ = {};
879};
880
881
885template<class TypeTag>
888{
890 using Implementation = GetPropType<TypeTag, Properties::Problem>;
891
893 using GridView = typename GridGeometry::GridView;
894 using Element = typename GridView::template Codim<0>::Entity;
895
897 using GridVariablesCache = Concept::GridVariablesCache_t<GridVariables>;
898 using ElementVariables = typename GridVariablesCache::LocalView;
900
901 using FVElementGeometry = typename GridGeometry::LocalView;
902 using GlobalPosition = typename Element::Geometry::GlobalCoordinate;
903 using LocalPosition = typename Element::Geometry::LocalCoordinate;
904
905 static constexpr int dim = GridView::dimension;
906 static constexpr int dimWorld = GridView::dimensionworld;
907
908 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
911
912public:
913 using InitialValues = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
914 using Sources = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
915 using DirichletValues = Dune::FieldVector<Scalar, dimWorld>;
916 using BoundaryFluxes = Dune::FieldVector<Scalar, ModelTraits::numEq()>;
917
919 using BoundaryTypes = typename Dumux::Experimental::BoundaryTypes<ModelTraits::numEq()>;
920
922 static constexpr bool isMomentumProblem() { return true; }
923
930 CVFENavierStokesMomentumProblem(std::shared_ptr<const GridGeometry> gridGeometry,
931 std::shared_ptr<CouplingManager> couplingManager,
932 const std::string& paramGroup = "")
933 : ParentType(gridGeometry, paramGroup)
934 , gravity_(0.0)
935 , couplingManager_(couplingManager)
936 {
937 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
938 gravity_[dim-1] = -9.81;
939
940 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
941 }
942
948 CVFENavierStokesMomentumProblem(std::shared_ptr<const GridGeometry> gridGeometry,
949 const std::string& paramGroup = "")
951 {}
952
959 const GravityVector& gravity() const
960 { return gravity_; }
961
966 { return enableInertiaTerms_; }
967
974 Scalar referencePressure() const
975 { return 0.0; }
976
981 template<class IpData>
982 Scalar pressure(const Element& element,
983 const FVElementGeometry& fvGeometry,
984 const IpData& ipData,
985 const bool isPreviousTimeStep = false) const
986 {
987 if constexpr (std::is_empty_v<CouplingManager>)
988 return asImp_().pressureAtPos(ipData.global());
989 else
990 return couplingManager_->pressure(element, fvGeometry, ipData, isPreviousTimeStep);
991 }
992
996 Scalar pressureAtPos(const GlobalPosition&) const
997 {
998 DUNE_THROW(Dune::NotImplemented, "pressureAtPos not implemented");
999 }
1000
1005 template<class IpData>
1006 Scalar density(const Element& element,
1007 const FVElementGeometry& fvGeometry,
1008 const IpData& ipData,
1009 const bool isPreviousTimeStep = false) const
1010 {
1011 if constexpr (std::is_empty_v<CouplingManager>)
1012 return asImp_().densityAtPos(ipData.global());
1013 else
1014 return couplingManager_->density(element, fvGeometry, ipData, isPreviousTimeStep);
1015 }
1016
1020 Scalar densityAtPos(const GlobalPosition&) const
1021 {
1022 DUNE_THROW(Dune::NotImplemented, "densityAtPos not implemented");
1023 }
1024
1029 template<class IpData>
1030 Scalar effectiveViscosity(const Element& element,
1031 const FVElementGeometry& fvGeometry,
1032 const IpData& ipData,
1033 const bool isPreviousTimeStep = false) const
1034 {
1035 if constexpr (std::is_empty_v<CouplingManager>)
1036 return asImp_().effectiveViscosityAtPos(ipData.global());
1037 else
1038 return couplingManager_->effectiveViscosity(element, fvGeometry, ipData, isPreviousTimeStep);
1039 }
1040
1044 Scalar effectiveViscosityAtPos(const GlobalPosition&) const
1045 {
1046 DUNE_THROW(Dune::NotImplemented, "effectiveViscosityAtPos not implemented");
1047 }
1048
1049private:
1051 Implementation &asImp_()
1052 { return *static_cast<Implementation *>(this); }
1053
1055 const Implementation &asImp_() const
1056 { return *static_cast<const Implementation *>(this); }
1057
1058 GravityVector gravity_;
1059 bool enableInertiaTerms_;
1060 std::shared_ptr<CouplingManager> couplingManager_ = {};
1061};
1062
1069template<class TypeTag>
1072>;
1073
1074} // end namespace Dumux
1075
1076#endif
typename Dumux::Experimental::BoundaryTypes< ModelTraits::numEq()> BoundaryTypes
Export the boundary types.
Definition freeflow/navierstokes/momentum/problem.hh:919
Scalar densityAtPos(const GlobalPosition &) const
Returns the density at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:1020
CVFENavierStokesMomentumProblem(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition freeflow/navierstokes/momentum/problem.hh:930
Dune::FieldVector< Scalar, ModelTraits::numEq()> BoundaryFluxes
Definition freeflow/navierstokes/momentum/problem.hh:916
bool enableInertiaTerms() const
Returns whether inertia terms should be considered.
Definition freeflow/navierstokes/momentum/problem.hh:965
Scalar effectiveViscosity(const Element &element, const FVElementGeometry &fvGeometry, const IpData &ipData, const bool isPreviousTimeStep=false) const
Returns the effective dynamic viscosity at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:1030
Scalar pressureAtPos(const GlobalPosition &) const
Returns the pressure at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:996
Scalar referencePressure() const
Returns a reference pressure This pressure is subtracted from the actual pressure for the momentum ba...
Definition freeflow/navierstokes/momentum/problem.hh:974
Scalar pressure(const Element &element, const FVElementGeometry &fvGeometry, const IpData &ipData, const bool isPreviousTimeStep=false) const
Returns the pressure at given interpolation point data.
Definition freeflow/navierstokes/momentum/problem.hh:982
CVFENavierStokesMomentumProblem(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition freeflow/navierstokes/momentum/problem.hh:948
Scalar density(const Element &element, const FVElementGeometry &fvGeometry, const IpData &ipData, const bool isPreviousTimeStep=false) const
Returns the density at given interpolation point data.
Definition freeflow/navierstokes/momentum/problem.hh:1006
Dune::FieldVector< Scalar, ModelTraits::numEq()> InitialValues
Definition freeflow/navierstokes/momentum/problem.hh:913
Dune::FieldVector< Scalar, ModelTraits::numEq()> Sources
Definition freeflow/navierstokes/momentum/problem.hh:914
static constexpr bool isMomentumProblem()
This problem is used for the momentum balance model.
Definition freeflow/navierstokes/momentum/problem.hh:922
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition freeflow/navierstokes/momentum/problem.hh:959
Scalar effectiveViscosityAtPos(const GlobalPosition &) const
Returns the effective dynamic viscosity at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:1044
Dune::FieldVector< Scalar, dimWorld > DirichletValues
Definition freeflow/navierstokes/momentum/problem.hh:915
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition common/problem.hh:304
Implementation & asImp_()
Returns the implementation of the problem (i.e. static polymorphism).
Definition common/problem.hh:309
const GridDiscretization & gridGeometry() const
The grid discretization.
Definition common/problem.hh:296
Base class for all problems using spatial parameters.
Definition problemwithspatialparams.hh:29
const std::string & paramGroup() const
The parameter group in which to retrieve runtime parameters.
Definition common/fvproblem.hh:524
const PointSourceMap & pointSourceMap() const
Get the point source map. It stores the point sources per scv.
Definition common/fvproblem.hh:481
const GridGeometry & gridGeometry() const
The finite volume grid geometry.
Definition common/fvproblem.hh:520
FVProblemWithSpatialParams(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
Constructor.
Definition fvproblemwithspatialparams.hh:42
Class to specify the type of a boundary condition for the Navier-Stokes model.
Definition freeflow/navierstokes/momentum/boundarytypes.hh:25
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/momentum/problem.hh:783
Scalar density(const Element &element, const FVElementGeometry &fvGeometry, const IpData &ipData, const bool isPreviousTimeStep=false) const
Returns the density at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:760
Dune::FieldVector< Scalar, dimWorld > Sources
Definition freeflow/navierstokes/momentum/problem.hh:510
NavierStokesMomentumProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition freeflow/navierstokes/momentum/problem.hh:526
Scalar pressure(const Element &element, const FVElementGeometry &fvGeometry, const IpData &ipData, const bool isPreviousTimeStep=false) const
Returns the pressure at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:707
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition freeflow/navierstokes/momentum/problem.hh:837
Scalar pressureAtPos(const GlobalPosition &) const
Returns the pressure at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:721
Scalar effectiveViscosity(const Element &element, const FVElementGeometry &fvGeometry, const IpData &ipData, const bool isPreviousTimeStep=false) const
Returns the effective dynamic viscosity at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:813
Scalar pressure(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, const bool isPreviousTimeStep=false) const
Returns the pressure at a given sub control volume.
Definition freeflow/navierstokes/momentum/problem.hh:691
static constexpr bool isMomentumProblem()
This problem is used for the momentum balance model.
Definition freeflow/navierstokes/momentum/problem.hh:518
Scalar densityAtPos(const GlobalPosition &) const
Returns the density at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:774
InitialValues initial(const SubControlVolume &scv) const
Evaluate the initial value at an sub control volume.
Definition freeflow/navierstokes/momentum/problem.hh:861
Sources sourceAtPos(const GlobalPosition &globalPos) const
Evaluate the source term for all phases at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:589
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/momentum/problem.hh:568
Scalar effectiveViscosityAtPos(const GlobalPosition &) const
Returns the effective dynamic viscosity at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:827
Dune::FieldVector< Scalar, dimWorld > InitialValues
Definition freeflow/navierstokes/momentum/problem.hh:509
BoundaryTypes 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/momentum/problem.hh:617
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition freeflow/navierstokes/momentum/problem.hh:655
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/momentum/problem.hh:730
Dune::FieldVector< Scalar, dimWorld > DirichletValues
Definition freeflow/navierstokes/momentum/problem.hh:511
DirichletValues dirichlet(const Element &element, const SubControlVolume &scv) const
Evaluate the boundary conditions for a Dirichlet control volume.
Definition freeflow/navierstokes/momentum/problem.hh:630
NavierStokesMomentumBoundaryTypes< ModelTraits::dim()> BoundaryTypes
Export the boundary types.
Definition freeflow/navierstokes/momentum/problem.hh:515
bool enableInertiaTerms() const
Returns whether inertia terms should be considered.
Definition freeflow/navierstokes/momentum/problem.hh:661
NavierStokesMomentumProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition freeflow/navierstokes/momentum/problem.hh:544
BoundaryTypes boundaryTypes(const Element &element, const SubControlVolume &scv) const
Specifies which kind of boundary condition should be used for which equation on a given boundary segm...
Definition freeflow/navierstokes/momentum/problem.hh:603
Scalar density(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, const bool isPreviousTimeStep=false) const
Returns the density at a given sub control volume.
Definition freeflow/navierstokes/momentum/problem.hh:744
Dune::FieldVector< Scalar, dimWorld > BoundaryFluxes
Definition freeflow/navierstokes/momentum/problem.hh:512
Scalar referencePressure() const
Returns a reference pressure This pressure is subtracted from the actual pressure for the momentum ba...
Definition freeflow/navierstokes/momentum/problem.hh:670
Scalar effectiveViscosity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv, const bool isPreviousTimeStep=false) const
Returns the effective dynamic viscosity at a given sub control volume.
Definition freeflow/navierstokes/momentum/problem.hh:797
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/momentum/problem.hh:677
DirichletValues dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
Evaluate the boundary conditions for a Dirichlet control volume face.
Definition freeflow/navierstokes/momentum/problem.hh:643
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/momentum/problem.hh:132
NavierStokesMomentumProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, const std::string &paramGroup="")
The constructor for usage without a coupling manager.
Definition freeflow/navierstokes/momentum/problem.hh:109
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/momentum/problem.hh:249
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/momentum/problem.hh:185
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/momentum/problem.hh:424
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/momentum/problem.hh:332
bool enableInertiaTerms() const
Returns whether inertia terms should be considered.
Definition freeflow/navierstokes/momentum/problem.hh:242
NavierStokesMomentumProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition freeflow/navierstokes/momentum/problem.hh:91
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/momentum/problem.hh:398
auto insideAndOutsideDensity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf, const bool isPreviousTimeStep=false) const
Definition freeflow/navierstokes/momentum/problem.hh:306
Scalar effectiveViscosityAtPos(const GlobalPosition &) const
Returns the effective dynamic viscosity at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:359
const CouplingManager & couplingManager() const
Definition freeflow/navierstokes/momentum/problem.hh:448
Dune::FieldVector< Scalar, dimWorld > MomentumFluxType
Definition freeflow/navierstokes/momentum/problem.hh:77
static constexpr bool isMomentumProblem()
This problem is used for the momentum balance model.
Definition freeflow/navierstokes/momentum/problem.hh:83
NavierStokesMomentumBoundaryTypes< ModelTraits::dim()> BoundaryTypes
Export the boundary types.
Definition freeflow/navierstokes/momentum/problem.hh:80
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 subtracted from the...
Definition freeflow/navierstokes/momentum/problem.hh:273
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition freeflow/navierstokes/momentum/problem.hh:369
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/momentum/problem.hh:282
const GravityVector & gravity() const
A default, i.e. if the user's does not overload any neumann method.
Definition freeflow/navierstokes/momentum/problem.hh:236
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/momentum/problem.hh:438
Dune::FieldVector< Scalar, dimWorld > InitialValues
Definition freeflow/navierstokes/momentum/problem.hh:72
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/momentum/problem.hh:296
BoundaryFluxes neumannAtPos(const GlobalPosition &globalPos) const
Returns the neumann flux at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:227
InitialValues initial(const SubControlVolume &scv) const
Evaluate the initial value at a sub control volume.
Definition freeflow/navierstokes/momentum/problem.hh:392
Sources scvPointSources(const Element &element, const FVElementGeometry &fvGeometry, const ElementVolumeVariables &elemVolVars, const SubControlVolume &scv) const
Adds contribution of point sources for a specific sub control volume to the values....
Definition freeflow/navierstokes/momentum/problem.hh:167
Scalar effectiveViscosity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolume &scv) const
Returns the effective dynamic viscosity at a given sub control volume.
Definition freeflow/navierstokes/momentum/problem.hh:346
Scalar densityAtPos(const GlobalPosition &) const
Returns the density at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:323
Dune::FieldVector< Scalar, dimWorld > BoundaryFluxes
Definition freeflow/navierstokes/momentum/problem.hh:75
DirichletValues dirichlet(const Element &element, const SubControlVolumeFace &scvf) const
Evaluate the boundary conditions for a dirichlet control volume face.
Definition freeflow/navierstokes/momentum/problem.hh:202
Dune::FieldVector< Scalar, dimWorld > DirichletValues
Definition freeflow/navierstokes/momentum/problem.hh:74
Dune::FieldVector< Scalar, dimWorld > Sources
Definition freeflow/navierstokes/momentum/problem.hh:73
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/momentum/problem.hh:217
bool onSlipBoundaryAtPos(const GlobalPosition &pos) const
Returns true if the scvf is located on a boundary with a slip condition.
Definition freeflow/navierstokes/momentum/problem.hh:445
Scalar pressureAtPos(const GlobalPosition &) const
Returns the pressure at a given position.
Definition freeflow/navierstokes/momentum/problem.hh:262
Sources sourceAtPos(const GlobalPosition &globalPos) const
Evaluate the source term for all phases within a given sub-control-volume.
Definition freeflow/navierstokes/momentum/problem.hh:154
Definition freeflow/navierstokes/momentum/problem.hh:31
Defines all properties used in Dumux.
Class to specify the type of a boundary condition for the Navier-Stokes model.
Base class for all finite volume problems that are parameterized.
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition localview.hh:26
NavierStokesMomentumProblemImpl< TypeTag, typename GetPropType< TypeTag, Properties::GridGeometry >::DiscretizationMethod > NavierStokesMomentumProblem
Navier-Stokes momentum problem class.
Definition freeflow/navierstokes/momentum/problem.hh:1070
T getParamFromGroup(Args &&... args)
A free function to get a parameter from the parameter tree singleton with a model group.
Definition parameters.hh:149
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition propertysystem.hh:296
The available discretization methods in Dumux.
Definition interpolate.hh:27
Definition method.hh:20
Definition adapt.hh:17
std::ranges::range auto scvs(const FVElementGeometry &fvGeometry, const LocalDof &localDof)
Definition localdof.hh:82
A helper to deduce a vector with the same size as numbers of equations.
Base class for all problems using spatial parameters.
Quadrature rules over sub-control volumes and sub-control volume faces.
Definition method.hh:46