24#ifndef DUMUX_FVMPFAO2DVELOCITY2P_HH
25#define DUMUX_FVMPFAO2DVELOCITY2P_HH
27#include <dune/grid/common/gridenums.hh>
60 dim = GridView::dimension, dimWorld = GridView::dimensionworld
66 using ReferenceElements = Dune::ReferenceElements<Scalar, dim>;
69 using MaterialLaw =
typename SpatialParams::MaterialLaw;
78 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
81 using Element =
typename GridView::Traits::template Codim<0>::Entity;
82 using Grid =
typename GridView::Grid;
83 using IndexSet =
typename GridView::IndexSet;
85 using Geometry =
typename Element::Geometry;
86 using JacobianTransposed =
typename Geometry::JacobianTransposed ;
91 using InnerBoundaryVolumeFaces = std::vector<Dune::FieldVector<bool, 2*dim> >;
95 pw = Indices::pressureW,
96 pn = Indices::pressureNw,
97 pGlobal = Indices::pressureGlobal,
98 sw = Indices::saturationW,
99 sn = Indices::saturationNw,
100 vw = Indices::velocityW,
101 vn = Indices::velocityNw,
102 vt = Indices::velocityTotal
106 wPhaseIdx = Indices::wPhaseIdx,
107 nPhaseIdx = Indices::nPhaseIdx,
108 pressureIdx = Indices::pressureIdx,
109 saturationIdx = Indices::saturationIdx,
110 pressureEqIdx = Indices::pressureEqIdx,
111 satEqIdx = Indices::satEqIdx,
112 numPhases = getPropValue<TypeTag, Properties::NumPhases>()
115 using LocalPosition = Dune::FieldVector<Scalar, dim>;
116 using GlobalPosition =
typename Geometry::GlobalCoordinate;
117 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
118 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
119 using DimVector = Dune::FieldVector<Scalar, dim>;
128 problem_(problem), gravity_(problem.gravity())
130 density_[wPhaseIdx] = 0.;
131 density_[nPhaseIdx] = 0.;
132 viscosity_[wPhaseIdx] = 0.;
133 viscosity_[nPhaseIdx] = 0.;
135 vtkOutputLevel_ = getParam<int>(
"Vtk.OutputLevel");
140 CellData& cellData2, CellData& cellData3, CellData& cellData4,
141 InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces);
143 CellData& cellData,
int elemIdx);
148 const auto element = *problem_.gridView().template begin<0>();
149 FluidState fluidState;
150 fluidState.setPressure(wPhaseIdx, problem_.referencePressure(element));
151 fluidState.setPressure(nPhaseIdx, problem_.referencePressure(element));
152 fluidState.setTemperature(problem_.temperature(element));
153 fluidState.setSaturation(wPhaseIdx, 1.);
154 fluidState.setSaturation(nPhaseIdx, 0.);
173 template<
class MultiWriter>
176 if (vtkOutputLevel_ > 0)
178 Dune::BlockVector < DimVector > &velocityWetting = *(writer.template allocateManagedBuffer<Scalar,
179 dim>(problem_.gridView().size(0)));
180 Dune::BlockVector < DimVector > &velocityNonwetting = *(writer.template allocateManagedBuffer<Scalar,
181 dim>(problem_.gridView().size(0)));
184 for (
const auto& element : elements(problem_.gridView()))
187 int eIdxGlobal = problem_.variables().index(element);
189 CellData & cellData = problem_.variables().cellData(eIdxGlobal);
191 Dune::FieldVector < Scalar, 2 * dim > fluxW(0);
192 Dune::FieldVector < Scalar, 2 * dim > fluxNw(0);
195 for (
const auto& intersection : intersections(problem_.gridView(), element))
197 int isIndex = intersection.indexInInside();
199 fluxW[isIndex] += intersection.geometry().volume()
200 * (intersection.centerUnitOuterNormal() * cellData.fluxData().velocity(wPhaseIdx, isIndex));
201 fluxNw[isIndex] += intersection.geometry().volume()
202 * (intersection.centerUnitOuterNormal() * cellData.fluxData().velocity(nPhaseIdx, isIndex));
205 DimVector refVelocity(0);
206 refVelocity[0] = 0.5 * (fluxW[1] - fluxW[0]);
207 refVelocity[1] = 0.5 * (fluxW[3] - fluxW[2]);
209 const DimVector& localPos = ReferenceElements::general(element.type()).position(0, 0);
212 const JacobianTransposed jacobianT = element.geometry().jacobianTransposed(localPos);
215 DimVector elementVelocity(0);
216 jacobianT.umtv(refVelocity, elementVelocity);
217 elementVelocity /= element.geometry().integrationElement(localPos);
219 velocityWetting[eIdxGlobal] = elementVelocity;
222 refVelocity[0] = 0.5 * (fluxNw[1] - fluxNw[0]);
223 refVelocity[1] = 0.5 * (fluxNw[3] - fluxNw[2]);
227 jacobianT.umtv(refVelocity, elementVelocity);
228 elementVelocity /= element.geometry().integrationElement(localPos);
230 velocityNonwetting[eIdxGlobal] = elementVelocity;
233 writer.attachCellData(velocityWetting,
"wetting-velocity", dim);
234 writer.attachCellData(velocityNonwetting,
"non-wetting-velocity", dim);
242 const GravityVector& gravity_;
244 Scalar density_[numPhases];
245 Scalar viscosity_[numPhases];
249 static constexpr Scalar threshold_ = 1e-15;
251 static const int velocityType_ = getPropValue<TypeTag, Properties::VelocityFormulation>();
253 static const int pressureType_ = getPropValue<TypeTag, Properties::PressureFormulation>();
255 static const int saturationType_ = getPropValue<TypeTag, Properties::SaturationFormulation>();
274template<
class TypeTag>
276 CellData& cellData1, CellData& cellData2,
277 CellData& cellData3, CellData& cellData4,
278 InnerBoundaryVolumeFaces& innerBoundaryVolumeFaces)
287 Dune::FieldVector < Scalar, 2 * dim > potW(0);
288 Dune::FieldVector < Scalar, 2 * dim > potNw(0);
290 potW[0] = cellData1.potential(wPhaseIdx);
291 potW[1] = cellData2.potential(wPhaseIdx);
292 potW[2] = cellData3.potential(wPhaseIdx);
293 potW[3] = cellData4.potential(wPhaseIdx);
295 potNw[0] = cellData1.potential(nPhaseIdx);
296 potNw[1] = cellData2.potential(nPhaseIdx);
297 potNw[2] = cellData3.potential(nPhaseIdx);
298 potNw[3] = cellData4.potential(nPhaseIdx);
301 Dune::FieldVector < Scalar, numPhases > lambda1(cellData1.mobility(wPhaseIdx));
302 lambda1[nPhaseIdx] = cellData1.mobility(nPhaseIdx);
305 Scalar lambdaTotal1 = lambda1[wPhaseIdx] + lambda1[nPhaseIdx];
308 Dune::FieldVector < Scalar, numPhases > lambda2(cellData2.mobility(wPhaseIdx));
309 lambda2[nPhaseIdx] = cellData2.mobility(nPhaseIdx);
312 Scalar lambdaTotal2 = lambda2[wPhaseIdx] + lambda2[nPhaseIdx];
315 Dune::FieldVector < Scalar, numPhases > lambda3(cellData3.mobility(wPhaseIdx));
316 lambda3[nPhaseIdx] = cellData3.mobility(nPhaseIdx);
319 Scalar lambdaTotal3 = lambda3[wPhaseIdx] + lambda3[nPhaseIdx];
322 Dune::FieldVector < Scalar, numPhases > lambda4(cellData4.mobility(wPhaseIdx));
323 lambda4[nPhaseIdx] = cellData4.mobility(nPhaseIdx);
326 Scalar lambdaTotal4 = lambda4[wPhaseIdx] + lambda4[nPhaseIdx];
328 Scalar gn12nu14 = interactionVolume.
getNtkrkNu_df(lambdaTotal1, 0, 0, 1);
329 Scalar gn12nu12 = interactionVolume.
getNtkrkNu_df(lambdaTotal1, 0, 0, 0);
330 Scalar gn14nu14 = interactionVolume.
getNtkrkNu_df(lambdaTotal1, 0, 1, 1);
331 Scalar gn14nu12 = interactionVolume.
getNtkrkNu_df(lambdaTotal1, 0, 1, 0);
332 Scalar gn12nu23 = interactionVolume.
getNtkrkNu_df(lambdaTotal2, 1, 1, 0);
333 Scalar gn12nu21 = interactionVolume.
getNtkrkNu_df(lambdaTotal2, 1, 1, 1);
334 Scalar gn23nu23 = interactionVolume.
getNtkrkNu_df(lambdaTotal2, 1, 0, 0);
335 Scalar gn23nu21 = interactionVolume.
getNtkrkNu_df(lambdaTotal2, 1, 0, 1);
336 Scalar gn43nu32 = interactionVolume.
getNtkrkNu_df(lambdaTotal3, 2, 0, 1);
337 Scalar gn43nu34 = interactionVolume.
getNtkrkNu_df(lambdaTotal3, 2, 0, 0);
338 Scalar gn23nu32 = interactionVolume.
getNtkrkNu_df(lambdaTotal3, 2, 1, 1);
339 Scalar gn23nu34 = interactionVolume.
getNtkrkNu_df(lambdaTotal3, 2, 1, 0);
340 Scalar gn43nu41 = interactionVolume.
getNtkrkNu_df(lambdaTotal4, 3, 1, 0);
341 Scalar gn43nu43 = interactionVolume.
getNtkrkNu_df(lambdaTotal4, 3, 1, 1);
342 Scalar gn14nu41 = interactionVolume.
getNtkrkNu_df(lambdaTotal4, 3, 0, 0);
343 Scalar gn14nu43 = interactionVolume.
getNtkrkNu_df(lambdaTotal4, 3, 0, 1);
346 Dune::FieldMatrix < Scalar, 2 * dim, 2 * dim > C(0), F(0), A(0), B(0);
358 F[0][0] = gn12nu12 + gn12nu14;
359 F[1][1] = -gn23nu21 + gn23nu23;
360 F[2][2] = -gn43nu34 - gn43nu32;
361 F[3][3] = gn14nu43 - gn14nu41;
363 A[0][0] = gn12nu12 + gn12nu21;
367 A[1][1] = gn23nu23 + gn23nu32;
370 A[2][2] = -gn43nu34 - gn43nu43;
374 A[3][3] = -gn14nu41 - gn14nu14;
378 B[0][0] = gn12nu12 + gn12nu14;
379 B[0][1] = gn12nu21 - gn12nu23;
380 B[1][1] = -gn23nu21 + gn23nu23;
381 B[1][2] = gn23nu34 + gn23nu32;
382 B[2][2] = -gn43nu34 - gn43nu32;
383 B[2][3] = -gn43nu43 + gn43nu41;
384 B[3][0] = -gn14nu12 - gn14nu14;
385 B[3][3] = gn14nu43 - gn14nu41;
388 Dune::FieldVector < Scalar, 2 * dim > fluxW(0);
389 Dune::FieldVector < Scalar, 2 * dim > fluxNw(0);
393 F += C.rightmultiply(B.leftmultiply(A));
394 Dune::FieldMatrix < Scalar, 2 * dim, 2 * dim > T(F);
399 Scalar potentialDiffW12 = fluxW[0];
400 Scalar potentialDiffW14 = fluxW[3];
401 Scalar potentialDiffW32 = -fluxW[1];
402 Scalar potentialDiffW34 = -fluxW[2];
404 Scalar potentialDiffNw12 = fluxNw[0];
405 Scalar potentialDiffNw14 = fluxNw[3];
406 Scalar potentialDiffNw32 = -fluxNw[1];
407 Scalar potentialDiffNw34 = -fluxNw[2];
410 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(0, 0), fluxW[0]);
411 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(0, 0), fluxNw[0]);
412 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(0, 1), fluxW[3]);
413 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(0, 1), fluxNw[3]);
414 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(1, 0), fluxW[1]);
415 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(1, 0), fluxNw[1]);
416 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(1, 1), -fluxW[0]);
417 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(1, 1), -fluxNw[0]);
418 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(2, 0), -fluxW[2]);
419 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(2, 0), -fluxNw[2]);
420 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(2, 1), -fluxW[1]);
421 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(2, 1), -fluxNw[1]);
422 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(3, 0), -fluxW[3]);
423 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(3, 0), -fluxNw[3]);
424 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.
getIndexOnElement(3, 1), fluxW[2]);
425 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.
getIndexOnElement(3, 1), fluxNw[2]);
428 Dune::FieldVector < Scalar, numPhases > lambda12Upw(0.0);
429 lambda12Upw[wPhaseIdx] = (potentialDiffW12 >= 0) ? lambda1[wPhaseIdx] : lambda2[wPhaseIdx];
430 lambda12Upw[nPhaseIdx] = (potentialDiffNw12 >= 0) ? lambda1[nPhaseIdx] : lambda2[nPhaseIdx];
433 Dune::FieldVector < Scalar, numPhases > lambda14Upw(0.0);
434 lambda14Upw[wPhaseIdx] = (potentialDiffW14 >= 0) ? lambda1[wPhaseIdx] : lambda4[wPhaseIdx];
435 lambda14Upw[nPhaseIdx] = (potentialDiffNw14 >= 0) ? lambda1[nPhaseIdx] : lambda4[nPhaseIdx];
438 Dune::FieldVector < Scalar, numPhases > lambda32Upw(0.0);
439 lambda32Upw[wPhaseIdx] = (potentialDiffW32 >= 0) ? lambda3[wPhaseIdx] : lambda2[wPhaseIdx];
440 lambda32Upw[nPhaseIdx] = (potentialDiffNw32 >= 0) ? lambda3[nPhaseIdx] : lambda2[nPhaseIdx];
443 Dune::FieldVector < Scalar, numPhases > lambda34Upw(0.0);
444 lambda34Upw[wPhaseIdx] = (potentialDiffW34 >= 0) ? lambda3[wPhaseIdx] : lambda4[wPhaseIdx];
445 lambda34Upw[nPhaseIdx] = (potentialDiffNw34 >= 0) ? lambda3[nPhaseIdx] : lambda4[nPhaseIdx];
447 for (
int i = 0; i < numPhases; i++)
450 DimVector vel12 = interactionVolume.
getNormal(0, 0);
451 DimVector vel14 = interactionVolume.
getNormal(0, 1);
452 DimVector vel23 = interactionVolume.
getNormal(1, 0);
453 DimVector vel21 = interactionVolume.
getNormal(1, 1);
454 DimVector vel34 = interactionVolume.
getNormal(2, 0);
455 DimVector vel32 = interactionVolume.
getNormal(2, 1);
456 DimVector vel41 = interactionVolume.
getNormal(3, 0);
457 DimVector vel43 = interactionVolume.
getNormal(3, 1);
459 Dune::FieldVector < Scalar, 2 * dim > flux(0);
474 vel12 *= flux[0] / (2 * interactionVolume.
getFaceArea(0, 0));
475 vel14 *= flux[3] / (2 * interactionVolume.
getFaceArea(0, 1));
476 vel23 *= flux[1] / (2 * interactionVolume.
getFaceArea(1, 0));
477 vel21 *= flux[0] / (2 * interactionVolume.
getFaceArea(1, 1));
478 vel34 *= flux[2] / (2 * interactionVolume.
getFaceArea(2, 0));
479 vel32 *= flux[1] / (2 * interactionVolume.
getFaceArea(2, 1));
480 vel41 *= flux[3] / (2 * interactionVolume.
getFaceArea(3, 0));
481 vel43 *= flux[2] / (2 * interactionVolume.
getFaceArea(3, 1));
483 Scalar lambdaT12 = lambda12Upw[wPhaseIdx] + lambda12Upw[nPhaseIdx];
484 Scalar lambdaT14 = lambda14Upw[wPhaseIdx] + lambda14Upw[nPhaseIdx];
485 Scalar lambdaT32 = lambda32Upw[wPhaseIdx] + lambda32Upw[nPhaseIdx];
486 Scalar lambdaT34 = lambda34Upw[wPhaseIdx] + lambda34Upw[nPhaseIdx];
487 Scalar fracFlow12 = (lambdaT12 > threshold_) ? lambda12Upw[i] / (lambdaT12) : 0.0;
488 Scalar fracFlow14 = (lambdaT14 > threshold_) ? lambda14Upw[i] / (lambdaT14) : 0.0;
489 Scalar fracFlow32 = (lambdaT32 > threshold_) ? lambda32Upw[i] / (lambdaT32) : 0.0;
490 Scalar fracFlow34 = (lambdaT34 > threshold_) ? lambda34Upw[i] / (lambdaT34) : 0.0;
501 if (innerBoundaryVolumeFaces[eIdxGlobal1][interactionVolume.
getIndexOnElement(0, 0)])
505 if (innerBoundaryVolumeFaces[eIdxGlobal1][interactionVolume.
getIndexOnElement(0, 1)])
509 if (innerBoundaryVolumeFaces[eIdxGlobal2][interactionVolume.
getIndexOnElement(1, 0)])
513 if (innerBoundaryVolumeFaces[eIdxGlobal2][interactionVolume.
getIndexOnElement(1, 1)])
517 if (innerBoundaryVolumeFaces[eIdxGlobal3][interactionVolume.
getIndexOnElement(2, 0)])
521 if (innerBoundaryVolumeFaces[eIdxGlobal3][interactionVolume.
getIndexOnElement(2, 1)])
525 if (innerBoundaryVolumeFaces[eIdxGlobal4][interactionVolume.
getIndexOnElement(3, 0)])
529 if (innerBoundaryVolumeFaces[eIdxGlobal4][interactionVolume.
getIndexOnElement(3, 1)])
535 cellData1.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(0, 0), vel12);
536 cellData1.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(0, 1), vel14);
537 cellData2.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(1, 0), vel23);
538 cellData2.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(1, 1), vel21);
539 cellData3.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(2, 0), vel34);
540 cellData3.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(2, 1), vel32);
541 cellData4.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(3, 0), vel41);
542 cellData4.fluxData().addVelocity(i, interactionVolume.
getIndexOnElement(3, 1), vel43);
545 cellData1.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(0, 0));
546 cellData1.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(0, 1));
547 cellData2.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(1, 0));
548 cellData2.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(1, 1));
549 cellData3.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(2, 0));
550 cellData3.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(2, 1));
551 cellData4.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(3, 0));
552 cellData4.fluxData().setVelocityMarker(interactionVolume.
getIndexOnElement(3, 1));
564template<
class TypeTag>
566 CellData& cellData,
int elemIdx)
571 const GlobalPosition& globalPos = element.geometry().center();
574 DimMatrix
permeability(problem_.spatialParams().intrinsicPermeability(element));
577 Dune::FieldVector < Scalar, numPhases > lambda(cellData.mobility(wPhaseIdx));
578 lambda[nPhaseIdx] = cellData.mobility(nPhaseIdx);
580 for (
int fIdx = 0; fIdx < dim; fIdx++)
590 const auto referenceElement = ReferenceElements::general(element.type());
592 const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
594 const GlobalPosition& globalPosFace = element.geometry().global(localPos);
596 DimVector distVec(globalPosFace - globalPos);
597 Scalar dist = distVec.two_norm();
598 DimVector unitDistVec(distVec);
602 Scalar satWBound = cellData.saturation(wPhaseIdx);
607 switch (saturationType_)
611 satWBound = satBound;
616 satWBound = 1 - satBound;
623 Scalar pcBound = MaterialLaw::pc(
624 problem_.spatialParams().materialLawParams(element), satWBound);
626 Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_
627 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
629 pcBound += gravityDiffBound;
631 Dune::FieldVector < Scalar, numPhases
634 problem_.spatialParams().materialLawParams(element),
636 lambdaBound[nPhaseIdx] = MaterialLaw::krn(
637 problem_.spatialParams().materialLawParams(element), satWBound);
638 lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
639 lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
641 Scalar gdeltaZ = (problem_.bBoxMax()-globalPosFace) * gravity_;
642 Scalar potentialBoundW = interactionVolume.
getDirichletValues(intVolFaceIdx)[pressureIdx] + density_[wPhaseIdx]*gdeltaZ;
643 Scalar potentialBoundNw = potentialBoundW;
646 switch (pressureType_)
650 potentialBoundNw += pcBound;
656 potentialBoundW -= pcBound;
661 Scalar potentialDiffW = (cellData.potential(wPhaseIdx) - potentialBoundW) / dist;
662 Scalar potentialDiffNw = (cellData.potential(nPhaseIdx) - potentialBoundNw) / dist;
665 cellData.fluxData().addUpwindPotential(wPhaseIdx, boundaryFaceIdx, potentialDiffW);
666 cellData.fluxData().addUpwindPotential(nPhaseIdx, boundaryFaceIdx, potentialDiffNw);
669 DimVector velocityW(0);
670 DimVector velocityNw(0);
673 DimVector pressGradient = unitDistVec;
674 pressGradient *= (cellData.potential(wPhaseIdx) - potentialBoundW) / dist;
677 pressGradient = unitDistVec;
678 pressGradient *= (cellData.potential(nPhaseIdx) - potentialBoundNw) / dist;
681 velocityW *= (potentialDiffW >= 0.) ? lambda[wPhaseIdx] : lambdaBound[wPhaseIdx];
682 velocityNw *= (potentialDiffNw >= 0.) ? lambda[nPhaseIdx] : lambdaBound[nPhaseIdx];
689 velocityW += cellData.fluxData().velocity(wPhaseIdx, boundaryFaceIdx);
690 velocityNw += cellData.fluxData().velocity(nPhaseIdx, boundaryFaceIdx);
691 cellData.fluxData().setVelocity(wPhaseIdx, boundaryFaceIdx, velocityW);
692 cellData.fluxData().setVelocity(nPhaseIdx, boundaryFaceIdx, velocityNw);
693 cellData.fluxData().setVelocityMarker(boundaryFaceIdx);
699 const auto referenceElement = ReferenceElements::general(element.type());
701 const LocalPosition& localPos = referenceElement.position(boundaryFaceIdx, 1);
703 const GlobalPosition& globalPosFace = element.geometry().global(localPos);
705 DimVector distVec(globalPosFace - globalPos);
706 Scalar dist = distVec.two_norm();
707 DimVector unitDistVec(distVec);
711 PrimaryVariables boundValues(interactionVolume.
getNeumannValues(intVolFaceIdx));
713 boundValues[wPhaseIdx] /= density_[wPhaseIdx];
714 boundValues[nPhaseIdx] /= density_[nPhaseIdx];
716 DimVector velocityW(unitDistVec);
717 DimVector velocityNw(unitDistVec);
719 velocityW *= boundValues[wPhaseIdx] / (2 * interactionVolume.
getFaceArea(elemIdx, fIdx));
720 velocityNw *= boundValues[nPhaseIdx]
721 / (2 * interactionVolume.
getFaceArea(elemIdx, fIdx));
724 cellData.fluxData().addUpwindPotential(wPhaseIdx, boundaryFaceIdx, boundValues[wPhaseIdx]);
725 cellData.fluxData().addUpwindPotential(nPhaseIdx, boundaryFaceIdx, boundValues[nPhaseIdx]);
728 velocityW += cellData.fluxData().velocity(wPhaseIdx, boundaryFaceIdx);
729 velocityNw += cellData.fluxData().velocity(nPhaseIdx, boundaryFaceIdx);
730 cellData.fluxData().setVelocity(wPhaseIdx, boundaryFaceIdx, velocityW);
731 cellData.fluxData().setVelocity(nPhaseIdx, boundaryFaceIdx, velocityNw);
732 cellData.fluxData().setVelocityMarker(boundaryFaceIdx);
736 DUNE_THROW(Dune::NotImplemented,
737 "No valid boundary condition type defined for pressure equation!");
Class including the information of an interaction volume of a MPFA O-method that does not change with...
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property (equivalent to old macro GET_PROP(...))
Definition: propertysystem.hh:140
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property (equivalent to old macro GET_PROP_TYPE(....
Definition: propertysystem.hh:149
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:273
bool isDirichlet(unsigned eqIdx) const
Returns true if an equation is used to specify a Dirichlet condition.
Definition: common/boundarytypes.hh:236
Class for calculating velocities from cell-wise constant pressure values.
Definition: omethod/2dvelocity.hh:56
void addOutputVtkFields(MultiWriter &writer)
Adds velocity output to the output file.
Definition: omethod/2dvelocity.hh:174
FvMpfaO2dVelocity2P(Problem &problem)
Definition: omethod/2dvelocity.hh:127
void calculateInnerInteractionVolumeVelocity(InteractionVolume &interactionVolume, CellData &cellData1, CellData &cellData2, CellData &cellData3, CellData &cellData4, InnerBoundaryVolumeFaces &innerBoundaryVolumeFaces)
Calculates velocities for all flux faces of an interaction volume.
Definition: omethod/2dvelocity.hh:275
void initialize()
Initializes the velocity model.
Definition: omethod/2dvelocity.hh:146
void calculateBoundaryInteractionVolumeVelocity(InteractionVolume &interactionVolume, CellData &cellData, int elemIdx)
Calculates the velocity at a boundary flux faces.
Definition: omethod/2dvelocity.hh:565
Class including the information of an interaction volume of a MPFA O-method that does not change with...
Definition: ointeractionvolume.hh:38
BoundaryTypes & getBoundaryType(int subVolumeFaceIdx)
Get boundary condtion types for a flux face.
Definition: ointeractionvolume.hh:267
bool isBoundaryFace(int subVolumeFaceIdx)
Returns true if an interaction volume flux face is a boundary face.
Definition: ointeractionvolume.hh:305
PrimaryVariables & getDirichletValues(int subVolumeFaceIdx)
Get the Dirichlet boundary condtions for a flux face.
Definition: ointeractionvolume.hh:316
Scalar & getFaceArea(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face area.
Definition: ointeractionvolume.hh:351
Scalar getNtkrkNu_df(Scalar &relPerm, int subVolumeIdx, int subVolumeFaceIdxInInsideN, int subVolumeFaceIdxInInsideNu) const
Definition: ointeractionvolume.hh:434
PrimaryVariables & getNeumannValues(int subVolumeFaceIdx)
Get the Neumann boundary condtions for a flux face.
Definition: ointeractionvolume.hh:327
DimVector & getNormal(int subVolumeIdx, int subVolumeFaceIdxInInside)
Get a flux face normal.
Definition: ointeractionvolume.hh:339
int getFaceIndexFromSubVolume(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering on element to numbering on interaction volume.
Definition: ointeractionvolume.hh:245
Element getSubVolumeElement(int subVolumeIdx)
Get an element of the interaction volume.
Definition: ointeractionvolume.hh:256
int getIndexOnElement(int subVolumeIdx, int subVolumeFaceIdx)
Map from local interaction volume numbering to numbering of the Dune reference element.
Definition: ointeractionvolume.hh:233
Specifies the properties for immiscible 2p diffusion/pressure models.
Properties for a MPFA method.