24#ifndef DUMUX_FVMPFAL2DVELOCITY2P_HH
25#define DUMUX_FVMPFAL2DVELOCITY2P_HH
27#include <dune/grid/common/gridenums.hh>
62 dim = GridView::dimension, dimWorld = GridView::dimensionworld
68 using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
70 using SpatialParams =
typename GET_PROP_TYPE(TypeTag, SpatialParams);
71 using MaterialLaw =
typename SpatialParams::MaterialLaw;
73 using Indices =
typename GET_PROP_TYPE(TypeTag, ModelTraits)::Indices;
75 using FluidSystem =
typename GET_PROP_TYPE(TypeTag, FluidSystem);
76 using FluidState =
typename GET_PROP_TYPE(TypeTag, FluidState);
78 using BoundaryTypes =
typename GET_PROP_TYPE(TypeTag, BoundaryTypes);
79 using SolutionTypes =
typename GET_PROP(TypeTag, SolutionTypes);
80 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
83 using Element =
typename GridView::Traits::template Codim<0>::Entity;
84 using Grid =
typename GridView::Grid;
85 using IndexSet =
typename GridView::IndexSet;
87 using Geometry =
typename Element::Geometry;
88 using JacobianTransposed =
typename Geometry::JacobianTransposed ;
90 using GridTypeIndices =
typename GET_PROP_TYPE(TypeTag, GridTypeIndices);
94 using InnerBoundaryVolumeFaces = std::vector<Dune::FieldVector<bool, 2*dim> >;
98 pw = Indices::pressureW,
99 pn = Indices::pressureNw,
100 pGlobal = Indices::pressureGlobal,
101 sw = Indices::saturationW,
102 sn = Indices::saturationNw,
103 vw = Indices::velocityW,
104 vn = Indices::velocityNw,
105 vt = Indices::velocityTotal
109 wPhaseIdx = Indices::wPhaseIdx,
110 nPhaseIdx = Indices::nPhaseIdx,
111 pressureIdx = Indices::pressureIdx,
112 saturationIdx = Indices::saturationIdx,
113 pressureEqIdx = Indices::pressureEqIdx,
114 satEqIdx = Indices::satEqIdx,
118 using LocalPosition = Dune::FieldVector<Scalar, dim>;
119 using GlobalPosition =
typename Element::Geometry::GlobalCoordinate;
120 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
121 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
122 using DimVector = Dune::FieldVector<Scalar, dim>;
143 CellData& cellData1, CellData& cellData2, CellData& cellData3, CellData& cellData4,
144 InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces);
146 CellData& cellData,
int elemIdx);
151 const auto element = *problem_.gridView().template begin<0>();
152 FluidState fluidState;
153 fluidState.setPressure(wPhaseIdx, problem_.referencePressure(element));
154 fluidState.setPressure(nPhaseIdx, problem_.referencePressure(element));
155 fluidState.setTemperature(problem_.temperature(element));
156 fluidState.setSaturation(wPhaseIdx, 1.);
157 fluidState.setSaturation(nPhaseIdx, 0.);
176 template<
class MultiWriter>
181 Dune::BlockVector < DimVector > &velocityWetting
182 = *(writer.template allocateManagedBuffer<Scalar,dim>(problem_.gridView().size(0)));
183 Dune::BlockVector < DimVector > &velocityNonwetting
184 = *(writer.template allocateManagedBuffer<Scalar,dim>(problem_.gridView().size(0)));
187 for (
const auto& element : elements(problem_.gridView()))
190 int eIdxGlobal = problem_.variables().index(element);
192 CellData & cellData = problem_.variables().cellData(eIdxGlobal);
194 Dune::FieldVector < Scalar, 2 * dim > fluxW(0);
195 Dune::FieldVector < Scalar, 2 * dim > fluxNw(0);
198 for (
const auto& intersection :
intersections(problem_.gridView(), element))
200 int isIndex = intersection.indexInInside();
202 fluxW[isIndex] += intersection.geometry().volume()
203 * (intersection.centerUnitOuterNormal() * cellData.fluxData().velocity(wPhaseIdx, isIndex));
204 fluxNw[isIndex] += intersection.geometry().volume()
205 * (intersection.centerUnitOuterNormal() * cellData.fluxData().velocity(nPhaseIdx, isIndex));
208 DimVector refVelocity(0);
209 refVelocity[0] = 0.5 * (fluxW[1] - fluxW[0]);
210 refVelocity[1] = 0.5 * (fluxW[3] - fluxW[2]);
212 const DimVector& localPos = ReferenceElements::general(element.type()).position(0, 0);
215 const JacobianTransposed jacobianT = element.geometry().jacobianTransposed(localPos);
218 DimVector elementVelocity(0);
219 jacobianT.umtv(refVelocity, elementVelocity);
220 elementVelocity /= element.geometry().integrationElement(localPos);
222 velocityWetting[eIdxGlobal] = elementVelocity;
225 refVelocity[0] = 0.5 * (fluxNw[1] - fluxNw[0]);
226 refVelocity[1] = 0.5 * (fluxNw[3] - fluxNw[2]);
230 jacobianT.umtv(refVelocity, elementVelocity);
231 elementVelocity /= element.geometry().integrationElement(localPos);
233 velocityNonwetting[eIdxGlobal] = elementVelocity;
236 writer.attachCellData(velocityWetting,
"wetting-velocity", dim);
237 writer.attachCellData(velocityNonwetting,
"non-wetting-velocity", dim);
278template<
class TypeTag>
280 CellData& cellData1, CellData& cellData2,
281 CellData& cellData3, CellData& cellData4,
282 InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces)
289 int level1 = element1.level();
290 int level2 = element2.level();
291 int level3 = element3.level();
292 int level4 = element4.level();
295 int eIdxGlobal1 = problem_.variables().index(element1);
296 int eIdxGlobal2 = problem_.variables().index(element2);
297 int eIdxGlobal3 = problem_.variables().index(element3);
298 int eIdxGlobal4 = problem_.variables().index(element4);
301 Dune::FieldVector < Scalar, 2 * dim > potW(0);
302 Dune::FieldVector < Scalar, 2 * dim > potNw(0);
304 potW[0] = cellData1.potential(wPhaseIdx);
305 potW[1] = cellData2.potential(wPhaseIdx);
306 potW[2] = cellData3.potential(wPhaseIdx);
307 potW[3] = cellData4.potential(wPhaseIdx);
309 potNw[0] = cellData1.potential(nPhaseIdx);
310 potNw[1] = cellData2.potential(nPhaseIdx);
311 potNw[2] = cellData3.potential(nPhaseIdx);
312 potNw[3] = cellData4.potential(nPhaseIdx);
315 Dune::FieldVector < Scalar, numPhases > lambda1(cellData1.mobility(wPhaseIdx));
316 lambda1[nPhaseIdx] = cellData1.mobility(nPhaseIdx);
319 Scalar lambdaTotal1 = lambda1[wPhaseIdx] + lambda1[nPhaseIdx];
322 Dune::FieldVector < Scalar, numPhases > lambda2(cellData2.mobility(wPhaseIdx));
323 lambda2[nPhaseIdx] = cellData2.mobility(nPhaseIdx);
326 Scalar lambdaTotal2 = lambda2[wPhaseIdx] + lambda2[nPhaseIdx];
329 Dune::FieldVector < Scalar, numPhases > lambda3(cellData3.mobility(wPhaseIdx));
330 lambda3[nPhaseIdx] = cellData3.mobility(nPhaseIdx);
333 Scalar lambdaTotal3 = lambda3[wPhaseIdx] + lambda3[nPhaseIdx];
336 Dune::FieldVector < Scalar, numPhases > lambda4(cellData4.mobility(wPhaseIdx));
337 lambda4[nPhaseIdx] = cellData4.mobility(nPhaseIdx);
340 Scalar lambdaTotal4 = lambda4[wPhaseIdx] + lambda4[nPhaseIdx];
343 std::vector < DimVector > lambda(2 * dim);
345 lambda[0][0] = lambdaTotal1;
346 lambda[0][1] = lambdaTotal1;
347 lambda[1][0] = lambdaTotal2;
348 lambda[1][1] = lambdaTotal2;
349 lambda[2][0] = lambdaTotal3;
350 lambda[2][1] = lambdaTotal3;
351 lambda[3][0] = lambdaTotal4;
352 lambda[3][1] = lambdaTotal4;
354 Scalar potentialDiffW12 = 0;
355 Scalar potentialDiffW14 = 0;
356 Scalar potentialDiffW32 = 0;
357 Scalar potentialDiffW34 = 0;
359 Scalar potentialDiffNw12 = 0;
360 Scalar potentialDiffNw14 = 0;
361 Scalar potentialDiffNw32 = 0;
362 Scalar potentialDiffNw34 = 0;
365 Dune::FieldVector < Scalar, 2 * dim > fluxW(0);
366 Dune::FieldVector < Scalar, 2 * dim > fluxNw(0);
368 Dune::FieldMatrix < Scalar, dim, 2 * dim - dim + 1 > T(0);
370 Dune::FieldVector<Scalar, 2 * dim - dim + 1> u(0);
372 int lType = transmissibilityCalculator_.calculateTransmissibility(T, interactionVolume, lambda, 0, 1, 2, 3);
374 if (lType == TransmissibilityCalculator::rightTriangle)
383 potentialDiffW12 = Tu[1];
392 potentialDiffNw12 = Tu[1];
403 potentialDiffW12 = Tu[1];
412 potentialDiffNw12 = Tu[1];
415 lType = transmissibilityCalculator_.calculateTransmissibility(T, interactionVolume, lambda, 1, 2, 3, 0);
417 if (lType == TransmissibilityCalculator::rightTriangle)
426 potentialDiffW32 = -Tu[1];
435 potentialDiffNw32 = -Tu[1];
446 potentialDiffW32 = -Tu[1];
455 potentialDiffNw32 = -Tu[1];
458 lType = transmissibilityCalculator_.calculateTransmissibility(T, interactionVolume, lambda, 2, 3, 0, 1);
460 if (lType == TransmissibilityCalculator::rightTriangle)
469 potentialDiffW34 = Tu[1];
478 potentialDiffNw34 = Tu[1];
489 potentialDiffW34 = Tu[1];
498 potentialDiffNw34 = Tu[1];
501 lType = transmissibilityCalculator_.calculateTransmissibility(T, interactionVolume, lambda, 3, 0, 1, 2);
503 if (lType == TransmissibilityCalculator::rightTriangle)
512 potentialDiffW14 = -Tu[1];
521 potentialDiffNw14 = -Tu[1];
532 potentialDiffW14 = -Tu[1];
541 potentialDiffNw14 = -Tu[1];
545 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(0, 0), potentialDiffW12);
546 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(0, 0), potentialDiffNw12);
547 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(0, 1), potentialDiffW14);
548 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(0, 1), potentialDiffNw14);
549 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(1, 0), -potentialDiffW32);
550 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(1, 0), -potentialDiffNw32);
551 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(1, 1), -potentialDiffW12);
552 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(1, 1), -potentialDiffNw12);
553 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(2, 0), potentialDiffW34);
554 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(2, 0), potentialDiffNw34);
555 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(2, 1), potentialDiffW32);
556 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(2, 1), potentialDiffNw32);
557 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(3, 0), -potentialDiffW14);
558 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(3, 0), -potentialDiffNw14);
559 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(3, 1), -potentialDiffW34);
560 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(3, 1), -potentialDiffNw34);
563 Dune::FieldVector < Scalar, numPhases > lambda12Upw(0.0);
564 lambda12Upw[wPhaseIdx] = (potentialDiffW12 >= 0) ? lambda1[wPhaseIdx] : lambda2[wPhaseIdx];
565 lambda12Upw[nPhaseIdx] = (potentialDiffNw12 >= 0) ? lambda1[nPhaseIdx] : lambda2[nPhaseIdx];
568 Dune::FieldVector < Scalar, numPhases > lambda14Upw(0.0);
569 lambda14Upw[wPhaseIdx] = (potentialDiffW14 >= 0) ? lambda1[wPhaseIdx] : lambda4[wPhaseIdx];
570 lambda14Upw[nPhaseIdx] = (potentialDiffNw14 >= 0) ? lambda1[nPhaseIdx] : lambda4[nPhaseIdx];
573 Dune::FieldVector < Scalar, numPhases > lambda32Upw(0.0);
574 lambda32Upw[wPhaseIdx] = (potentialDiffW32 >= 0) ? lambda3[wPhaseIdx] : lambda2[wPhaseIdx];
575 lambda32Upw[nPhaseIdx] = (potentialDiffNw32 >= 0) ? lambda3[nPhaseIdx] : lambda2[nPhaseIdx];
578 Dune::FieldVector < Scalar, numPhases > lambda34Upw(0.0);
579 lambda34Upw[wPhaseIdx] = (potentialDiffW34 >= 0) ? lambda3[wPhaseIdx] : lambda4[wPhaseIdx];
580 lambda34Upw[nPhaseIdx] = (potentialDiffNw34 >= 0) ? lambda3[nPhaseIdx] : lambda4[nPhaseIdx];
582 for (
int i = 0; i < numPhases; i++)
585 DimVector vel12 = interactionVolume.
getNormal(0, 0);
586 DimVector vel14 = interactionVolume.
getNormal(3, 0);
587 DimVector vel23 = interactionVolume.
getNormal(1, 0);
588 DimVector vel21 = interactionVolume.
getNormal(0, 0);
589 DimVector vel34 = interactionVolume.
getNormal(2, 0);
590 DimVector vel32 = interactionVolume.
getNormal(1, 0);
591 DimVector vel41 = interactionVolume.
getNormal(3, 0);
592 DimVector vel43 = interactionVolume.
getNormal(2, 0);
594 Dune::FieldVector < Scalar, 2 * dim > flux(0);
609 vel12 *= flux[0] / (2 * interactionVolume.
getFaceArea(0, 0));
610 vel14 *= flux[3] / (2 * interactionVolume.
getFaceArea(0, 1));
611 vel23 *= flux[1] / (2 * interactionVolume.
getFaceArea(1, 0));
612 vel21 *= flux[0] / (2 * interactionVolume.
getFaceArea(1, 1));
613 vel34 *= flux[2] / (2 * interactionVolume.
getFaceArea(2, 0));
614 vel32 *= flux[1] / (2 * interactionVolume.
getFaceArea(2, 1));
615 vel41 *= flux[3] / (2 * interactionVolume.
getFaceArea(3, 0));
616 vel43 *= flux[2] / (2 * interactionVolume.
getFaceArea(3, 1));
622 else if (level2 < level1)
630 else if (level3 < level2)
638 else if (level4 < level3)
646 else if (level1 < level4)
651 Scalar lambdaT12 = lambda12Upw[wPhaseIdx] + lambda12Upw[nPhaseIdx];
652 Scalar lambdaT14 = lambda14Upw[wPhaseIdx] + lambda14Upw[nPhaseIdx];
653 Scalar lambdaT32 = lambda32Upw[wPhaseIdx] + lambda32Upw[nPhaseIdx];
654 Scalar lambdaT34 = lambda34Upw[wPhaseIdx] + lambda34Upw[nPhaseIdx];
655 Scalar fracFlow12 = (lambdaT12 > threshold_) ? lambda12Upw[i] / (lambdaT12) : 0.0;
656 Scalar fracFlow14 = (lambdaT14 > threshold_) ? lambda14Upw[i] / (lambdaT14) : 0.0;
657 Scalar fracFlow32 = (lambdaT32 > threshold_) ? lambda32Upw[i] / (lambdaT32) : 0.0;
658 Scalar fracFlow34 = (lambdaT34 > threshold_) ? lambda34Upw[i] / (lambdaT34) : 0.0;
669 if (innerBoundaryVolumeFaces[eIdxGlobal1][interactionVolume.
getIndexOnElement(0, 0)])
673 if (innerBoundaryVolumeFaces[eIdxGlobal1][interactionVolume.
getIndexOnElement(0, 1)])
677 if (innerBoundaryVolumeFaces[eIdxGlobal2][interactionVolume.
getIndexOnElement(1, 0)])
681 if (innerBoundaryVolumeFaces[eIdxGlobal2][interactionVolume.
getIndexOnElement(1, 1)])
685 if (innerBoundaryVolumeFaces[eIdxGlobal3][interactionVolume.
getIndexOnElement(2, 0)])
689 if (innerBoundaryVolumeFaces[eIdxGlobal3][interactionVolume.
getIndexOnElement(2, 1)])
693 if (innerBoundaryVolumeFaces[eIdxGlobal4][interactionVolume.
getIndexOnElement(3, 0)])
697 if (innerBoundaryVolumeFaces[eIdxGlobal4][interactionVolume.
getIndexOnElement(3, 1)])
703 cellData1.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(0, 0), vel12);
704 cellData1.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(0, 1), vel14);
705 cellData2.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(1, 0), vel23);
706 cellData2.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(1, 1), vel21);
707 cellData3.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(2, 0), vel34);
708 cellData3.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(2, 1), vel32);
709 cellData4.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(3, 0), vel41);
710 cellData4.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(3, 1), vel43);
713 cellData1.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(0, 0));
714 cellData1.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(0, 1));
715 cellData2.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(1, 0));
716 cellData2.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(1, 1));
717 cellData3.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(2, 0));
718 cellData3.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(2, 1));
719 cellData4.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(3, 0));
720 cellData4.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(3, 1));
732template<
class TypeTag>
734 CellData& cellData,
int elemIdx)
739 const GlobalPosition& globalPos = element.geometry().center();
742 DimMatrix
permeability(problem_.spatialParams().intrinsicPermeability(element));
745 Dune::FieldVector < Scalar, numPhases > lambda(cellData.mobility(wPhaseIdx));
746 lambda[nPhaseIdx] = cellData.mobility(nPhaseIdx);
748 for (
int fIdx = 0; fIdx < dim; fIdx++)
758 const auto referenceElement = ReferenceElements::general(element.type());
760 const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
762 const GlobalPosition& globalPosFace = element.geometry().global(localPos);
764 DimVector distVec(globalPosFace - globalPos);
765 Scalar dist = distVec.two_norm();
766 DimVector unitDistVec(distVec);
770 Scalar satWBound = cellData.saturation(wPhaseIdx);
775 switch (saturationType_)
779 satWBound = satBound;
784 satWBound = 1 - satBound;
791 Scalar pcBound = MaterialLaw::pc(
792 problem_.spatialParams().materialLawParams(element), satWBound);
794 Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_
795 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
797 pcBound += gravityDiffBound;
799 Dune::FieldVector < Scalar, numPhases
802 problem_.spatialParams().materialLawParams(element),
804 lambdaBound[nPhaseIdx] = MaterialLaw::krn(
805 problem_.spatialParams().materialLawParams(element), satWBound);
806 lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
807 lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
809 Scalar gdeltaZ = (problem_.bBoxMax()-globalPosFace) * gravity_;
810 Scalar potentialBoundW = interactionVolume.
getDirichletValues(intVolFaceIdx)[pressureIdx] + density_[wPhaseIdx]*gdeltaZ;
811 Scalar potentialBoundNw = potentialBoundW;
814 switch (pressureType_)
818 potentialBoundNw += pcBound;
824 potentialBoundW -= pcBound;
829 Scalar potentialDiffW = (cellData.potential(wPhaseIdx) - potentialBoundW) / dist;
830 Scalar potentialDiffNw = (cellData.potential(nPhaseIdx) - potentialBoundNw) / dist;
833 cellData.fluxData().addUpwindPotential(wPhaseIdx, boundaryFaceIdx, potentialDiffW);
834 cellData.fluxData().addUpwindPotential(nPhaseIdx, boundaryFaceIdx, potentialDiffNw);
837 DimVector velocityW(0);
838 DimVector velocityNw(0);
841 DimVector pressGradient = unitDistVec;
842 pressGradient *= (cellData.potential(wPhaseIdx) - potentialBoundW) / dist;
845 pressGradient = unitDistVec;
846 pressGradient *= (cellData.potential(nPhaseIdx) - potentialBoundNw) / dist;
849 velocityW *= (potentialDiffW >= 0.) ? lambda[wPhaseIdx] : lambdaBound[wPhaseIdx];
850 velocityNw *= (potentialDiffNw >= 0.) ? lambda[nPhaseIdx] : lambdaBound[nPhaseIdx];
857 velocityW += cellData.fluxData().velocity(wPhaseIdx, boundaryFaceIdx);
858 velocityNw += cellData.fluxData().velocity(nPhaseIdx, boundaryFaceIdx);
859 cellData.fluxData().setVelocity(wPhaseIdx, boundaryFaceIdx, velocityW);
860 cellData.fluxData().setVelocity(nPhaseIdx, boundaryFaceIdx, velocityNw);
861 cellData.fluxData().setVelocityMarker(boundaryFaceIdx);
867 const auto referenceElement = ReferenceElements::general(element.type());
869 const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
871 const GlobalPosition& globalPosFace = element.geometry().global(localPos);
873 DimVector distVec(globalPosFace - globalPos);
874 Scalar dist = distVec.two_norm();
875 DimVector unitDistVec(distVec);
879 PrimaryVariables boundValues(interactionVolume.
getNeumannValues(intVolFaceIdx));
881 boundValues[wPhaseIdx] /= density_[wPhaseIdx];
882 boundValues[nPhaseIdx] /= density_[nPhaseIdx];
884 DimVector velocityW(unitDistVec);
885 DimVector velocityNw(unitDistVec);
887 velocityW *= boundValues[wPhaseIdx] / (2 * interactionVolume.
getFaceArea(elemIdx, fIdx));
888 velocityNw *= boundValues[nPhaseIdx]
889 / (2 * interactionVolume.
getFaceArea(elemIdx, fIdx));
892 cellData.fluxData().addUpwindPotential(wPhaseIdx, boundaryFaceIdx, boundValues[wPhaseIdx]);
893 cellData.fluxData().addUpwindPotential(nPhaseIdx, boundaryFaceIdx, boundValues[nPhaseIdx]);
896 velocityW += cellData.fluxData().velocity(wPhaseIdx, boundaryFaceIdx);
897 velocityNw += cellData.fluxData().velocity(nPhaseIdx, boundaryFaceIdx);
898 cellData.fluxData().setVelocity(wPhaseIdx, boundaryFaceIdx, velocityW);
899 cellData.fluxData().setVelocity(nPhaseIdx, boundaryFaceIdx, velocityNw);
900 cellData.fluxData().setVelocityMarker(boundaryFaceIdx);
904 DUNE_THROW(Dune::NotImplemented,
905 "No valid boundary condition type defined for pressure equation!");
#define GET_PROP_VALUE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:282
#define GET_PROP(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:281
#define GET_PROP_TYPE(TypeTag, PropTagName)
Definition: propertysystemmacros.hh:283
Provides methods for transmissibility calculation 2-d.
Class including the information of an interaction volume of a MPFA L-method that does not change with...
Dune::IteratorRange< typename MultiDomainGlue< DomainGridView, TargetGridView, DomainMapper, TargetMapper >::Intersections::const_iterator > intersections(const MultiDomainGlue< DomainGridView, TargetGridView, DomainMapper, TargetMapper > &glue)
Range generator to iterate with range-based for loops over all intersections as follows: for (const a...
Definition: glue.hh:62
make the local view function available whenever we use the grid geometry
Definition: adapt.hh:29
Property tag SaturationFormulation
The formulation of the saturation model.
Definition: porousmediumflow/2p/sequential/properties.hh:53
Property tag NumPhases
Number of phases in the system.
Definition: porousmediumflow/sequential/properties.hh:69
Property tag VelocityFormulation
The type of velocity reconstructed for the transport model.
Definition: porousmediumflow/2p/sequential/properties.hh:54
std::string viscosity(int phaseIdx) noexcept
I/O name of viscosity for multiphase systems.
Definition: name.hh:74
std::string permeability() noexcept
I/O name of permeability.
Definition: name.hh:143
std::string density(int phaseIdx) noexcept
I/O name of density for multiphase systems.
Definition: name.hh:65
bool isNeumann(unsigned eqIdx) const
Returns true if an equation is used to specify a Neumann condition.
Definition: common/boundarytypes.hh:269
bool isDirichlet(unsigned eqIdx) const
Returns true if an equation is used to specify a Dirichlet condition.
Definition: common/boundarytypes.hh:236
Provides methods for transmissibility calculation in 2-d.
Definition: 2dtransmissibilitycalculator.hh:44
Class for calculating 2-d velocities from cell-wise constant pressure values.
Definition: lmethod/2dvelocity.hh:58
Scalar viscosity_[numPhases]
Definition: lmethod/2dvelocity.hh:251
void addOutputVtkFields(MultiWriter &writer)
Adds velocity output to the output file.
Definition: lmethod/2dvelocity.hh:177
const GravityVector & gravity_
Definition: lmethod/2dvelocity.hh:248
int vtkOutputLevel_
Definition: lmethod/2dvelocity.hh:253
void calculateBoundaryInteractionVolumeVelocity(InteractionVolume &interactionVolume, CellData &cellData, int elemIdx)
Calculates the velocity at a boundary flux faces.
Definition: lmethod/2dvelocity.hh:733
void initialize()
Initializes the velocity model.
Definition: lmethod/2dvelocity.hh:149
static const int velocityType_
gives kind of velocity used ( , , )
Definition: lmethod/2dvelocity.hh:257
static const int saturationType_
gives kind of saturation used ( , )
Definition: lmethod/2dvelocity.hh:261
TransmissibilityCalculator transmissibilityCalculator_
Definition: lmethod/2dvelocity.hh:246
void calculateInnerInteractionVolumeVelocity(InteractionVolume &interactionVolume, CellData &cellData1, CellData &cellData2, CellData &cellData3, CellData &cellData4, InnerBoundaryVolumeFaces &innerBoundaryVolumeFaces)
Calculate velocities for flux faces of an interaction volume.
Definition: lmethod/2dvelocity.hh:279
static const int pressureType_
gives kind of pressure used ( , , )
Definition: lmethod/2dvelocity.hh:259
Scalar density_[numPhases]
Definition: lmethod/2dvelocity.hh:250
static constexpr Scalar threshold_
Definition: lmethod/2dvelocity.hh:255
FvMpfaL2dVelocity2p(Problem &problem)
Constructs a FvMpfaL2dVelocity2p object.
Definition: lmethod/2dvelocity.hh:130
Class including the information of an interaction volume of a MPFA L-method that does not change with...
Definition: linteractionvolume.hh:41
int getIndexOnElement(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering to numbering of the Dune reference element.
Definition: linteractionvolume.hh:258
DimVector & getNormal(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face normal.
Definition: linteractionvolume.hh:364
Element getSubVolumeElement(int subVolumeIdx)
Get an element of the interaction volume.
Definition: linteractionvolume.hh:281
BoundaryTypes & getBoundaryType(int subVolumeFaceIdx)
Get boundary condtion types for a flux face.
Definition: linteractionvolume.hh:292
Scalar & getFaceArea(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face area.
Definition: linteractionvolume.hh:388
PrimaryVariables & getNeumannValues(int subVolumeFaceIdx)
Get the Neumann boundary condtions for a flux face.
Definition: linteractionvolume.hh:352
bool isBoundaryFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is a boundary face.
Definition: linteractionvolume.hh:330
int getFaceIndexFromSubVolume(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering on element to numbering on interaction volume.
Definition: linteractionvolume.hh:270
PrimaryVariables & getDirichletValues(int subVolumeFaceIdx)
Get the Dirichlet boundary condtions for a flux face.
Definition: linteractionvolume.hh:341
Specifies the properties for immiscible 2p diffusion/pressure models.
Properties for a MPFA method.