version 3.9
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-FileCopyrightInfo: 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/typetraits.hh>
22
23namespace Dumux {
24
25template<class TypeTag, class DiscretizationMethod>
27
28template<class TypeTag>
29class NavierStokesMomentumProblemImpl<TypeTag, DiscretizationMethods::FCStaggered>
30: public FVProblemWithSpatialParams<TypeTag>
31{
33 using Implementation = GetPropType<TypeTag, Properties::Problem>;
34
36 using GridView = typename GridGeometry::GridView;
37 using Element = typename GridView::template Codim<0>::Entity;
38
40 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
41 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
43
44 using FVElementGeometry = typename GridGeometry::LocalView;
45 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
46 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
48
49 enum {
50 dim = GridView::dimension,
51 dimWorld = GridView::dimensionworld
52 };
53
54 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
55 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
56 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
59
60 static constexpr bool isCoupled_ = !std::is_empty_v<CouplingManager>;
61
62
63public:
67 using InitialValues = Dune::FieldVector<Scalar, dimWorld>;
68 using Sources = Dune::FieldVector<Scalar, dimWorld>;
69 using DirichletValues = Dune::FieldVector<Scalar, dimWorld>;
70 using BoundaryFluxes = Dune::FieldVector<Scalar, dimWorld>;
71
72 using MomentumFluxType = Dune::FieldVector<Scalar, dimWorld>;
73
76
78 static constexpr bool isMomentumProblem() { return true; }
79
86 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
87 std::shared_ptr<CouplingManager> couplingManager,
88 const std::string& paramGroup = "")
89 : ParentType(gridGeometry, paramGroup)
90 , gravity_(0.0)
91 , couplingManager_(couplingManager)
92 {
93 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
94 gravity_[dim-1] = -9.81;
95
96 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
97 }
98
104 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
105 const std::string& paramGroup = "")
106 : NavierStokesMomentumProblemImpl(gridGeometry, {}, paramGroup)
107 {}
108
127 Sources source(const Element& element,
128 const FVElementGeometry& fvGeometry,
129 const ElementVolumeVariables& elemVolVars,
130 const SubControlVolume& scv) const
131 {
132 // forward to solution independent, fully-implicit specific interface
133 return asImp_().sourceAtPos(scv.dofPosition());
134 }
135
149 Sources sourceAtPos(const GlobalPosition& globalPos) const
150 {
153 return Sources(0.0);
154 }
155
163 auto boundaryTypes(const Element& element,
164 const SubControlVolumeFace& scvf) const
165 {
166 // Forward it to the method which only takes the global coordinate.
167 // We evaluate the boundary type at the center of the sub control volume face
168 // in order to avoid ambiguities at domain corners.
169 return asImp_().boundaryTypesAtPos(scvf.center());
170 }
171
180 DirichletValues dirichlet(const Element& element, const SubControlVolumeFace& scvf) const
181 {
182 return asImp_().dirichletAtPos(scvf.ipGlobal());
183 }
184
194 template<class ElementFluxVariablesCache>
195 BoundaryFluxes neumann(const Element& element,
196 const FVElementGeometry& fvGeometry,
197 const ElementVolumeVariables& elemVolVars,
198 const ElementFluxVariablesCache& elemFluxVarsCache,
199 const SubControlVolumeFace& scvf) const
200 { return asImp_().neumannAtPos(scvf.ipGlobal()); }
201
205 BoundaryFluxes neumannAtPos(const GlobalPosition& globalPos) const
206 { return BoundaryFluxes(0.0); }
207
214 const GravityVector& gravity() const
215 { return gravity_; }
216
221 { return enableInertiaTerms_; }
222
227 Scalar pressure(const Element& element,
228 const FVElementGeometry& fvGeometry,
229 const SubControlVolumeFace& scvf) const
230 {
231 if constexpr (isCoupled_)
232 return couplingManager_->pressure(element, fvGeometry, scvf);
233 else
234 return asImp_().pressureAtPos(scvf.ipGlobal());
235 }
236
240 Scalar pressureAtPos(const GlobalPosition&) const
241 {
242 DUNE_THROW(Dune::NotImplemented, "pressureAtPos not implemented");
243 }
244
251 Scalar referencePressure(const Element& element,
252 const FVElementGeometry& fvGeometry,
253 const SubControlVolumeFace& scvf) const
254 { return 0.0; }
255
260 Scalar density(const Element& element,
261 const FVElementGeometry& fvGeometry,
262 const SubControlVolumeFace& scvf) const
263 {
264 if constexpr (isCoupled_)
265 return couplingManager_->density(element, fvGeometry, scvf);
266 else
267 return asImp_().densityAtPos(scvf.ipGlobal());
268 }
269
274 Scalar density(const Element& element,
275 const SubControlVolume& scv,
276 const bool isPreviousTimeStep = false) const
277 {
278 if constexpr (isCoupled_)
279 return couplingManager_->density(element, scv, isPreviousTimeStep);
280 else
281 return asImp_().densityAtPos(scv.dofPosition());
282 }
283
284 auto insideAndOutsideDensity(const Element& element,
285 const FVElementGeometry& fvGeometry,
286 const SubControlVolumeFace& scvf,
287 const bool isPreviousTimeStep = false) const
288 {
289 if constexpr (isCoupled_)
290 return couplingManager_->insideAndOutsideDensity(element, fvGeometry, scvf, isPreviousTimeStep);
291 else
292 {
293 const auto rho = asImp_().densityAtPos(scvf.ipGlobal());
294 return std::make_pair(rho, rho);
295 }
296 }
297
301 Scalar densityAtPos(const GlobalPosition&) const
302 {
303 DUNE_THROW(Dune::NotImplemented, "densityAtPos not implemented");
304 }
305
310 Scalar effectiveViscosity(const Element& element,
311 const FVElementGeometry& fvGeometry,
312 const SubControlVolumeFace& scvf) const
313 {
314 if constexpr (isCoupled_)
315 return couplingManager_->effectiveViscosity(element, fvGeometry, scvf);
316 else
317 return asImp_().effectiveViscosityAtPos(scvf.ipGlobal());
318 }
319
324 Scalar effectiveViscosity(const Element& element,
325 const FVElementGeometry& fvGeometry,
326 const SubControlVolume& scv) const
327 {
328 if constexpr (isCoupled_)
329 return couplingManager_->effectiveViscosity(element, fvGeometry, scv);
330 else
331 return asImp_().effectiveViscosityAtPos(scv.dofPosition());
332 }
333
337 Scalar effectiveViscosityAtPos(const GlobalPosition&) const
338 {
339 DUNE_THROW(Dune::NotImplemented, "effectiveViscosityAtPos not implemented");
340 }
341
346 template<class SolutionVector>
347 void applyInitialSolution(SolutionVector& sol) const
348 {
349 sol.resize(this->gridGeometry().numDofs());
350 std::vector<bool> dofHandled(this->gridGeometry().numDofs(), false);
351 auto fvGeometry = localView(this->gridGeometry());
352 for (const auto& element : elements(this->gridGeometry().gridView()))
353 {
354 fvGeometry.bindElement(element);
355 for (const auto& scv : scvs(fvGeometry))
356 {
357 const auto dofIdx = scv.dofIndex();
358 if (!dofHandled[dofIdx])
359 {
360 dofHandled[dofIdx] = true;
361 sol[dofIdx] = asImp_().initial(scv)[scv.dofAxis()];
362 }
363 }
364 }
365 }
366
370 InitialValues initial(const SubControlVolume& scv) const
371 {
372 return asImp_().initialAtPos(scv.dofPosition());
373 }
374
376 Scalar pseudo3DWallFriction(const Element& element,
377 const FVElementGeometry& fvGeometry,
378 const ElementVolumeVariables& elemVolVars,
379 const SubControlVolume& scv,
380 const Scalar height,
381 const Scalar factor = 8.0) const
382 {
383 const Scalar velocity = elemVolVars[scv].velocity();
384 const auto scvf = scvfs(fvGeometry, scv).begin();
385 const Scalar viscosity = effectiveViscosity(element, fvGeometry, *scvf);
386 return pseudo3DWallFriction(velocity, viscosity, height, factor);
387 }
388
402 Scalar pseudo3DWallFriction(const Scalar velocity,
403 const Scalar viscosity,
404 const Scalar height,
405 const Scalar factor = 8.0) const
406 {
407 static_assert(dim == 2, "Pseudo 3D wall friction may only be used in 2D");
408 return -factor * velocity * viscosity / (height*height);
409 }
410
416 bool onSlipBoundary(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
417 { return asImp_().onSlipBoundaryAtPos(scvf.center()); }
418
423 bool onSlipBoundaryAtPos(const GlobalPosition& pos) const
424 { return false; }
425
430 [[deprecated("Will be removed after release 3.9.")]]
431 Scalar permeability(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
432 {
433 DUNE_THROW(Dune::NotImplemented,
434 "When using the Beavers-Joseph-Saffman boundary condition, "
435 "the permeability must be returned in the actual problem"
436 );
437 }
438
443 [[deprecated("Will be removed after release 3.9. Implement betaBJ instead. ")]]
444 Scalar alphaBJ(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
445 {
446 DUNE_THROW(Dune::NotImplemented,
447 "When using the Beavers-Joseph-Saffman boundary condition, "
448 "the alpha value must be returned in the actual problem"
449 );
450 }
451
455 [[deprecated("Needs to be implemented in test problem. Will be removed after release 3.9.")]]
456 Scalar betaBJ(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf, const GlobalPosition& tangentialVector) const
457 {
458 const auto& K = asImp_().permeability(fvGeometry, scvf);
459 const auto interfacePermeability = vtmv(tangentialVector, K, tangentialVector);
460 using std::sqrt;
461 return asImp_().alphaBJ(fvGeometry, scvf) / sqrt(interfacePermeability);
462 }
463
467 [[deprecated("Needs to be implemented in test problem. Will be removed after release 3.9.")]]
468 VelocityVector porousMediumVelocity(const FVElementGeometry& fvGeometry, const SubControlVolumeFace& scvf) const
469 {
470 return VelocityVector(0.0);
471 }
472
477 [[deprecated("Will be removed after release 3.9.")]]
478 const VelocityVector beaversJosephVelocity(const FVElementGeometry& fvGeometry,
479 const SubControlVolumeFace& scvf,
480 const ElementVolumeVariables& elemVolVars,
481 Scalar tangentialVelocityGradient) const
482 {
483 assert(scvf.isLateral());
484 assert(scvf.boundary());
485
486 const auto& scv = fvGeometry.scv(scvf.insideScvIdx());
487
488 // create a unit normal vector oriented in positive coordinate direction
489 GlobalPosition orientation(0.0);
490 orientation[scv.dofAxis()] = 1.0;
491
492 // du/dy + dv/dx = beta * (u_boundary-uPM)
493 // beta = alpha/sqrt(K)
494 const Scalar betaBJ = asImp_().betaBJ(fvGeometry, scvf, orientation);
495 const Scalar distanceNormalToBoundary = (scvf.ipGlobal() - scv.dofPosition()).two_norm();
496
497 static const bool onlyNormalGradient = getParamFromGroup<bool>(this->paramGroup(), "FreeFlow.EnableUnsymmetrizedVelocityGradientForBeaversJoseph", false);
498 if (onlyNormalGradient)
499 tangentialVelocityGradient = 0.0;
500
501 const Scalar scalarSlipVelocity = (tangentialVelocityGradient*distanceNormalToBoundary
502 + asImp_().porousMediumVelocity(fvGeometry, scvf) * orientation * betaBJ * distanceNormalToBoundary
503 + elemVolVars[scv].velocity()) / (betaBJ*distanceNormalToBoundary + 1.0);
504
505 orientation *= scalarSlipVelocity;
506 return orientation;
507 }
508
509 const CouplingManager& couplingManager() const
510 {
511 if constexpr (isCoupled_)
512 return *couplingManager_;
513 else
514 DUNE_THROW(Dune::InvalidStateException,
515 "Accessing coupling manager of an uncoupled problem is not possible."
516 );
517 }
518
519private:
521 Implementation& asImp_()
522 { return *static_cast<Implementation *>(this); }
523
525 const Implementation& asImp_() const
526 { return *static_cast<const Implementation *>(this); }
527
528 GravityVector gravity_;
529 bool enableInertiaTerms_;
530 std::shared_ptr<CouplingManager> couplingManager_;
531};
532
536template<class TypeTag, class DM>
537class NavierStokesMomentumProblemImpl<TypeTag, DiscretizationMethods::CVFE<DM>>
538: public FVProblemWithSpatialParams<TypeTag>
539{
541 using Implementation = GetPropType<TypeTag, Properties::Problem>;
542
544 using GridView = typename GridGeometry::GridView;
545 using Element = typename GridView::template Codim<0>::Entity;
546
548 using GridVolumeVariables = typename GridVariables::GridVolumeVariables;
549 using ElementVolumeVariables = typename GridVolumeVariables::LocalView;
551
552 using FVElementGeometry = typename GridGeometry::LocalView;
553 using SubControlVolume = typename FVElementGeometry::SubControlVolume;
554 using SubControlVolumeFace = typename FVElementGeometry::SubControlVolumeFace;
556
557 static constexpr int dim = GridView::dimension;
558 static constexpr int dimWorld = GridView::dimensionworld;
559
560 using GlobalPosition = typename SubControlVolumeFace::GlobalPosition;
561 using VelocityVector = Dune::FieldVector<Scalar, dimWorld>;
562 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
565
566 static constexpr bool isCVFE = DiscretizationMethods::isCVFE<
567 typename GridGeometry::DiscretizationMethod
568 >;
569
570public:
574 using InitialValues = Dune::FieldVector<Scalar, dimWorld>;
575 using Sources = Dune::FieldVector<Scalar, dimWorld>;
576 using DirichletValues = Dune::FieldVector<Scalar, dimWorld>;
577 using BoundaryFluxes = Dune::FieldVector<Scalar, dimWorld>;
578
581
583 static constexpr bool isMomentumProblem() { return true; }
584
591 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
592 std::shared_ptr<CouplingManager> couplingManager,
593 const std::string& paramGroup = "")
594 : ParentType(gridGeometry, paramGroup)
595 , gravity_(0.0)
596 , couplingManager_(couplingManager)
597 {
598 if (getParamFromGroup<bool>(paramGroup, "Problem.EnableGravity"))
599 gravity_[dim-1] = -9.81;
600
601 enableInertiaTerms_ = getParamFromGroup<bool>(paramGroup, "Problem.EnableInertiaTerms");
602 }
603
609 NavierStokesMomentumProblemImpl(std::shared_ptr<const GridGeometry> gridGeometry,
610 const std::string& paramGroup = "")
611 : NavierStokesMomentumProblemImpl(gridGeometry, {}, paramGroup)
612 {}
613
632 template<class ElementVolumeVariables>
633 Sources source(const Element &element,
634 const FVElementGeometry& fvGeometry,
635 const ElementVolumeVariables& elemVolVars,
636 const SubControlVolume &scv) const
637 {
638 // forward to solution independent, fully-implicit specific interface
639 return asImp_().sourceAtPos(scv.center());
640 }
641
654 Sources sourceAtPos(const GlobalPosition &globalPos) const
655 {
658 return Sources(0.0);
659 }
660
668 BoundaryTypes boundaryTypes(const Element& element,
669 const SubControlVolume& scv) const
670 {
671 if (!isCVFE)
672 DUNE_THROW(Dune::InvalidStateException,
673 "boundaryTypes(..., scv) called for for a non CVFE method.");
674
675 // forward it to the method which only takes the global coordinate
676 return asImp_().boundaryTypesAtPos(scv.dofPosition());
677 }
678
686 BoundaryTypes boundaryTypes(const Element& element,
687 const SubControlVolumeFace& scvf) const
688 {
689 if (isCVFE)
690 DUNE_THROW(Dune::InvalidStateException,
691 "boundaryTypes(..., scvf) called for a CVFE method.");
692
693 // forward it to the method which only takes the global coordinate
694 return asImp_().boundaryTypesAtPos(scvf.ipGlobal());
695 }
696
704 DirichletValues dirichlet(const Element& element, const SubControlVolume& scv) const
705 {
706 // forward it to the method which only takes the global coordinate
707 if (!isCVFE)
708 DUNE_THROW(Dune::InvalidStateException, "dirichlet(scv) called for a non CVFE method.");
709 else
710 return asImp_().dirichletAtPos(scv.dofPosition());
711 }
712
720 DirichletValues dirichlet(const Element& element, const SubControlVolumeFace& scvf) const
721 {
722 // forward it to the method which only takes the global coordinate
723 if (isCVFE)
724 DUNE_THROW(Dune::InvalidStateException, "dirichlet(scvf) called for CVFE method.");
725 else
726 return asImp_().dirichletAtPos(scvf.ipGlobal());
727 }
728
735 const GravityVector& gravity() const
736 { return gravity_; }
737
742 { return enableInertiaTerms_; }
743
750 Scalar referencePressure() const
751 { return 0.0; }
752
757 Scalar pressure(const Element& element,
758 const FVElementGeometry& fvGeometry,
759 const SubControlVolumeFace& scvf) const
760 {
761 if constexpr (std::is_empty_v<CouplingManager>)
762 return asImp_().pressureAtPos(scvf.ipGlobal());
763 else
764 return couplingManager_->pressure(element, fvGeometry, scvf);
765 }
766
771 Scalar pressure(const Element& element,
772 const FVElementGeometry& fvGeometry,
773 const SubControlVolume& scv,
774 const bool isPreviousTimeStep = false) const
775 {
776 if constexpr (std::is_empty_v<CouplingManager>)
777 return asImp_().pressureAtPos(scv.dofPosition());
778 else
779 return couplingManager_->pressure(element, fvGeometry, scv, isPreviousTimeStep);
780 }
781
785 Scalar pressureAtPos(const GlobalPosition&) const
786 {
787 DUNE_THROW(Dune::NotImplemented, "pressureAtPos not implemented");
788 }
789
794 Scalar density(const Element& element,
795 const FVElementGeometry& fvGeometry,
796 const SubControlVolumeFace& scvf) const
797 {
798 if constexpr (std::is_empty_v<CouplingManager>)
799 return asImp_().densityAtPos(scvf.ipGlobal());
800 else
801 return couplingManager_->density(element, fvGeometry, scvf);
802 }
803
808 Scalar density(const Element& element,
809 const FVElementGeometry& fvGeometry,
810 const SubControlVolume& scv,
811 const bool isPreviousTimeStep = false) const
812 {
813 if constexpr (std::is_empty_v<CouplingManager>)
814 return asImp_().densityAtPos(scv.dofPosition());
815 else
816 return couplingManager_->density(element, fvGeometry, scv, isPreviousTimeStep);
817 }
818
819
823 Scalar densityAtPos(const GlobalPosition&) const
824 {
825 DUNE_THROW(Dune::NotImplemented, "densityAtPos not implemented");
826 }
827
832 Scalar effectiveViscosity(const Element& element,
833 const FVElementGeometry& fvGeometry,
834 const SubControlVolumeFace& scvf) const
835 {
836 if constexpr (std::is_empty_v<CouplingManager>)
837 return asImp_().effectiveViscosityAtPos(scvf.ipGlobal());
838 else
839 return couplingManager_->effectiveViscosity(element, fvGeometry, scvf);
840 }
841
846 Scalar effectiveViscosity(const Element& element,
847 const FVElementGeometry& fvGeometry,
848 const SubControlVolume& scv,
849 const bool isPreviousTimeStep = false) const
850 {
851 if constexpr (std::is_empty_v<CouplingManager>)
852 return asImp_().effectiveViscosityAtPos(scv.dofPosition());
853 else
854 return couplingManager_->effectiveViscosity(element, fvGeometry, scv, isPreviousTimeStep);
855 }
856
860 Scalar effectiveViscosityAtPos(const GlobalPosition&) const
861 {
862 DUNE_THROW(Dune::NotImplemented, "effectiveViscosityAtPos not implemented");
863 }
864
869 template<class SolutionVector>
870 void applyInitialSolution(SolutionVector& sol) const
871 {
872 static_assert(GridGeometry::discMethod == DiscretizationMethods::CVFE<DM>{});
873 sol.resize(this->gridGeometry().numDofs());
874 std::vector<bool> dofHandled(this->gridGeometry().numDofs(), false);
875 auto fvGeometry = localView(this->gridGeometry());
876 for (const auto& element : elements(this->gridGeometry().gridView()))
877 {
878 fvGeometry.bindElement(element);
879 for (const auto& scv : scvs(fvGeometry))
880 {
881 const auto dofIdx = scv.dofIndex();
882 if (!dofHandled[dofIdx])
883 {
884 dofHandled[dofIdx] = true;
885 sol[dofIdx] = asImp_().initial(scv);
886 }
887 }
888 }
889 }
890
894 InitialValues initial(const SubControlVolume& scv) const
895 {
896 static_assert(GridGeometry::discMethod == DiscretizationMethods::CVFE<DM>{});
897 return asImp_().initialAtPos(scv.dofPosition());
898 }
899
900private:
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 std::shared_ptr<CouplingManager> couplingManager_ = {};
912};
913
920template<class TypeTag>
923>;
924
925} // end namespace Dumux
926
927#endif
Class to specify the type of a boundary.
Definition: common/boundarytypes.hh:26
Base class for all finite-volume problems.
Definition: common/fvproblem.hh:43
Base class for all finite-volume problems using spatial parameters.
Definition: fvproblemwithspatialparams.hh:29
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:832
Dune::FieldVector< Scalar, dimWorld > Sources
Definition: freeflow/navierstokes/momentum/problem.hh:575
NavierStokesMomentumProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/momentum/problem.hh:591
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: freeflow/navierstokes/momentum/problem.hh:870
Scalar pressureAtPos(const GlobalPosition &) const
Returns the pressure at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:785
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:771
static constexpr bool isMomentumProblem()
This problem is used for the momentum balance model.
Definition: freeflow/navierstokes/momentum/problem.hh:583
Scalar densityAtPos(const GlobalPosition &) const
Returns the density at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:823
InitialValues initial(const SubControlVolume &scv) const
Evaluate the initial value at an sub control volume.
Definition: freeflow/navierstokes/momentum/problem.hh:894
Sources sourceAtPos(const GlobalPosition &globalPos) const
Evaluate the source term for all phases at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:654
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:633
Scalar effectiveViscosityAtPos(const GlobalPosition &) const
Returns the effective dynamic viscosity at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:860
Dune::FieldVector< Scalar, dimWorld > InitialValues
Definition: freeflow/navierstokes/momentum/problem.hh:574
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:686
const GravityVector & gravity() const
Returns the acceleration due to gravity.
Definition: freeflow/navierstokes/momentum/problem.hh:735
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:794
Dune::FieldVector< Scalar, dimWorld > DirichletValues
Definition: freeflow/navierstokes/momentum/problem.hh:576
DirichletValues dirichlet(const Element &element, const SubControlVolume &scv) const
Evaluate the boundary conditions for a Dirichlet control volume.
Definition: freeflow/navierstokes/momentum/problem.hh:704
bool enableInertiaTerms() const
Returns whether inertia terms should be considered.
Definition: freeflow/navierstokes/momentum/problem.hh:741
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:609
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:668
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:808
Dune::FieldVector< Scalar, dimWorld > BoundaryFluxes
Definition: freeflow/navierstokes/momentum/problem.hh:577
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:750
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:846
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:757
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:720
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:127
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:104
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:227
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:163
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:402
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/momentum/problem.hh:478
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:310
bool enableInertiaTerms() const
Returns whether inertia terms should be considered.
Definition: freeflow/navierstokes/momentum/problem.hh:220
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/momentum/problem.hh:431
NavierStokesMomentumProblemImpl(std::shared_ptr< const GridGeometry > gridGeometry, std::shared_ptr< CouplingManager > couplingManager, const std::string &paramGroup="")
The constructor.
Definition: freeflow/navierstokes/momentum/problem.hh:86
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/momentum/problem.hh:456
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/momentum/problem.hh:468
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:376
auto insideAndOutsideDensity(const Element &element, const FVElementGeometry &fvGeometry, const SubControlVolumeFace &scvf, const bool isPreviousTimeStep=false) const
Definition: freeflow/navierstokes/momentum/problem.hh:284
Scalar effectiveViscosityAtPos(const GlobalPosition &) const
Returns the effective dynamic viscosity at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:337
const CouplingManager & couplingManager() const
Definition: freeflow/navierstokes/momentum/problem.hh:509
Dune::FieldVector< Scalar, dimWorld > MomentumFluxType
Definition: freeflow/navierstokes/momentum/problem.hh:72
static constexpr bool isMomentumProblem()
This problem is used for the momentum balance model.
Definition: freeflow/navierstokes/momentum/problem.hh:78
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:251
void applyInitialSolution(SolutionVector &sol) const
Applies the initial solution for all degrees of freedom of the grid.
Definition: freeflow/navierstokes/momentum/problem.hh:347
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:260
const GravityVector & gravity() const
A default, i.e. if the user's does not overload any neumann method.
Definition: freeflow/navierstokes/momentum/problem.hh:214
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:416
Dune::FieldVector< Scalar, dimWorld > InitialValues
Definition: freeflow/navierstokes/momentum/problem.hh:67
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:274
BoundaryFluxes neumannAtPos(const GlobalPosition &globalPos) const
Returns the neumann flux at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:205
InitialValues initial(const SubControlVolume &scv) const
Evaluate the initial value at a sub control volume.
Definition: freeflow/navierstokes/momentum/problem.hh:370
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:324
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/momentum/problem.hh:444
Scalar densityAtPos(const GlobalPosition &) const
Returns the density at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:301
Dune::FieldVector< Scalar, dimWorld > BoundaryFluxes
Definition: freeflow/navierstokes/momentum/problem.hh:70
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:180
Dune::FieldVector< Scalar, dimWorld > DirichletValues
Definition: freeflow/navierstokes/momentum/problem.hh:69
Dune::FieldVector< Scalar, dimWorld > Sources
Definition: freeflow/navierstokes/momentum/problem.hh:68
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:195
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:423
Scalar pressureAtPos(const GlobalPosition &) const
Returns the pressure at a given position.
Definition: freeflow/navierstokes/momentum/problem.hh:240
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:149
Definition: freeflow/navierstokes/momentum/problem.hh:26
Defines all properties used in Dumux.
Base class for all finite volume problems that are parameterized.
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:880
GridCache::LocalView localView(const GridCache &gridCache)
Free function to get the local view of a grid cache object.
Definition: localview.hh:26
typename GetProp< TypeTag, Property >::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:296
The available discretization methods in Dumux.
constexpr bool isCVFE
Definition: method.hh:67
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:62
Definition: adapt.hh:17
A helper to deduce a vector with the same size as numbers of equations.
Definition: method.hh:46