24#ifndef DUMUX_FVMPFAL2PVELOCITY2P_HH
25#define DUMUX_FVMPFAL2PVELOCITY2P_HH
27#include <dune/grid/common/gridenums.hh>
61 dim = GridView::dimension, dimWorld = GridView::dimensionworld
78 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
80 using Element =
typename GridView::Traits::template Codim<0>::Entity;
81 using Grid =
typename GridView::Grid;
82 using IndexSet =
typename GridView::IndexSet;
84 using Geometry =
typename Element::Geometry;
85 using JacobianTransposed =
typename Geometry::JacobianTransposed ;
96 pw = Indices::pressureW,
97 pn = Indices::pressureNw,
98 pGlobal = Indices::pressureGlobal,
99 sw = Indices::saturationW,
100 sn = Indices::saturationNw,
101 vw = Indices::velocityW,
102 vn = Indices::velocityNw,
103 vt = Indices::velocityTotal
107 wPhaseIdx = Indices::wPhaseIdx,
108 nPhaseIdx = Indices::nPhaseIdx,
109 pressureIdx = Indices::pressureIdx,
110 saturationIdx = Indices::saturationIdx,
111 pressureEqIdx = Indices::pressureEqIdx,
112 satEqIdx = Indices::satEqIdx,
113 numPhases = getPropValue<TypeTag, Properties::NumPhases>()
120 dirichletDirichlet = 1,
121 dirichletNeumann = 2,
126 innerEdgeFace = 2, innerSideFace = 1
129 using GlobalPosition =
typename Geometry::GlobalCoordinate;
130 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
131 using DimVector = Dune::FieldVector<Scalar, dim>;
140 problem_(problem), gravity_(problem.gravity())
142 density_[wPhaseIdx] = 0.;
143 density_[nPhaseIdx] = 0.;
144 viscosity_[wPhaseIdx] = 0.;
145 viscosity_[nPhaseIdx] = 0.;
147 vtkOutputLevel_ = getParam<int>(
"Vtk.OutputLevel");
152 CellData & cellData1, CellData & cellData2, CellData & cellData3, CellData & cellData4,
153 CellData & cellData5, CellData & cellData6, CellData & cellData7, CellData & cellData8,
154 InteractionVolumeContainer& interactionVolumes,
155 TransmissibilityCalculator& transmissibilityCalculator,
int fIdx = -1);
157 CellData& cellData,
int elemIdx);
162 const auto element = *problem_.gridView().template begin<0>();
163 FluidState fluidState;
164 fluidState.setPressure(wPhaseIdx, problem_.referencePressure(element));
165 fluidState.setPressure(nPhaseIdx, problem_.referencePressure(element));
166 fluidState.setTemperature(problem_.temperature(element));
167 fluidState.setSaturation(wPhaseIdx, 1.);
168 fluidState.setSaturation(nPhaseIdx, 0.);
187 template<
class MultiWriter>
190 if (vtkOutputLevel_ > 0)
192 Dune::BlockVector < DimVector > &velocityWetting = *(writer.template allocateManagedBuffer<Scalar,
193 dim>(problem_.gridView().size(0)));
194 Dune::BlockVector < DimVector > &velocityNonwetting = *(writer.template allocateManagedBuffer<Scalar,
195 dim>(problem_.gridView().size(0)));
198 for (
const auto& element : elements(problem_.gridView()))
201 int eIdxGlobal = problem_.variables().index(element);
203 CellData & cellData = problem_.variables().cellData(eIdxGlobal);
205 Dune::FieldVector < Scalar, 2 * dim > fluxW(0);
206 Dune::FieldVector < Scalar, 2 * dim > fluxNw(0);
209 for (
const auto& intersection : intersections(problem_.gridView(), element))
211 int isIndex = intersection.indexInInside();
213 fluxW[isIndex] += intersection.geometry().volume()
214 * (intersection.centerUnitOuterNormal() * cellData.fluxData().velocity(wPhaseIdx, isIndex));
215 fluxNw[isIndex] += intersection.geometry().volume()
216 * (intersection.centerUnitOuterNormal() * cellData.fluxData().velocity(nPhaseIdx, isIndex));
219 DimVector refVelocity(0);
220 refVelocity[0] = 0.5 * (fluxW[1] - fluxW[0]);
221 refVelocity[1] = 0.5 * (fluxW[3] - fluxW[2]);
222 refVelocity[2] = 0.5 * (fluxW[5] - fluxW[4]);
224 const DimVector& localPos = referenceElement(element).position(0, 0);
227 const JacobianTransposed jacobianT = element.geometry().jacobianTransposed(localPos);
230 DimVector elementVelocity(0);
231 jacobianT.umtv(refVelocity, elementVelocity);
232 elementVelocity /= element.geometry().integrationElement(localPos);
234 velocityWetting[eIdxGlobal] = elementVelocity;
237 refVelocity[0] = 0.5 * (fluxNw[1] - fluxNw[0]);
238 refVelocity[1] = 0.5 * (fluxNw[3] - fluxNw[2]);
239 refVelocity[2] = 0.5 * (fluxNw[5] - fluxNw[4]);
243 jacobianT.umtv(refVelocity, elementVelocity);
244 elementVelocity /= element.geometry().integrationElement(localPos);
246 velocityNonwetting[eIdxGlobal] = elementVelocity;
249 writer.attachCellData(velocityWetting,
"wetting-velocity", dim);
250 writer.attachCellData(velocityNonwetting,
"nonwetting-velocity", dim);
258 const Dune::FieldVector<Scalar, dimWorld>& gravity_;
260 Scalar density_[numPhases];
261 Scalar viscosity_[numPhases];
265 static constexpr Scalar threshold_ = 1e-15;
267 static const int velocityType_ = getPropValue<TypeTag, Properties::VelocityFormulation>();
269 static const int pressureType_ = getPropValue<TypeTag, Properties::PressureFormulation>();
271 static const int saturationType_ = getPropValue<TypeTag, Properties::SaturationFormulation>();
295template<
class TypeTag>
297 CellData & cellData1, CellData & cellData2, CellData & cellData3, CellData & cellData4,
298 CellData & cellData5, CellData & cellData6, CellData & cellData7, CellData & cellData8,
301 auto element1 = interactionVolume.getSubVolumeElement(0);
302 auto element2 = interactionVolume.getSubVolumeElement(1);
303 auto element3 = interactionVolume.getSubVolumeElement(2);
304 auto element4 = interactionVolume.getSubVolumeElement(3);
305 auto element5 = interactionVolume.getSubVolumeElement(4);
306 auto element6 = interactionVolume.getSubVolumeElement(5);
307 auto element7 = interactionVolume.getSubVolumeElement(6);
308 auto element8 = interactionVolume.getSubVolumeElement(7);
311 int eIdxGlobal1 = problem_.variables().index(element1);
312 int eIdxGlobal2 = problem_.variables().index(element2);
313 int eIdxGlobal3 = problem_.variables().index(element3);
314 int eIdxGlobal4 = problem_.variables().index(element4);
315 int eIdxGlobal5 = problem_.variables().index(element5);
316 int eIdxGlobal6 = problem_.variables().index(element6);
317 int eIdxGlobal7 = problem_.variables().index(element7);
318 int eIdxGlobal8 = problem_.variables().index(element8);
321 Dune::FieldVector<Scalar, 8> potW(0);
322 Dune::FieldVector<Scalar, 8> potNw(0);
324 potW[0] = cellData1.potential(wPhaseIdx);
325 potW[1] = cellData2.potential(wPhaseIdx);
326 potW[2] = cellData3.potential(wPhaseIdx);
327 potW[3] = cellData4.potential(wPhaseIdx);
328 potW[4] = cellData5.potential(wPhaseIdx);
329 potW[5] = cellData6.potential(wPhaseIdx);
330 potW[6] = cellData7.potential(wPhaseIdx);
331 potW[7] = cellData8.potential(wPhaseIdx);
333 potNw[0] = cellData1.potential(nPhaseIdx);
334 potNw[1] = cellData2.potential(nPhaseIdx);
335 potNw[2] = cellData3.potential(nPhaseIdx);
336 potNw[3] = cellData4.potential(nPhaseIdx);
337 potNw[4] = cellData5.potential(nPhaseIdx);
338 potNw[5] = cellData6.potential(nPhaseIdx);
339 potNw[6] = cellData7.potential(nPhaseIdx);
340 potNw[7] = cellData8.potential(nPhaseIdx);
343 Dune::FieldVector<Scalar, numPhases> lambda1(cellData1.mobility(wPhaseIdx));
344 lambda1[nPhaseIdx] = cellData1.mobility(nPhaseIdx);
347 Scalar lambdaTotal1 = lambda1[wPhaseIdx] + lambda1[nPhaseIdx];
350 Dune::FieldVector<Scalar, numPhases> lambda2(cellData2.mobility(wPhaseIdx));
351 lambda2[nPhaseIdx] = cellData2.mobility(nPhaseIdx);
354 Scalar lambdaTotal2 = lambda2[wPhaseIdx] + lambda2[nPhaseIdx];
357 Dune::FieldVector<Scalar, numPhases> lambda3(cellData3.mobility(wPhaseIdx));
358 lambda3[nPhaseIdx] = cellData3.mobility(nPhaseIdx);
361 Scalar lambdaTotal3 = lambda3[wPhaseIdx] + lambda3[nPhaseIdx];
364 Dune::FieldVector<Scalar, numPhases> lambda4(cellData4.mobility(wPhaseIdx));
365 lambda4[nPhaseIdx] = cellData4.mobility(nPhaseIdx);
368 Scalar lambdaTotal4 = lambda4[wPhaseIdx] + lambda4[nPhaseIdx];
371 Dune::FieldVector<Scalar, numPhases> lambda5(cellData5.mobility(wPhaseIdx));
372 lambda5[nPhaseIdx] = cellData5.mobility(nPhaseIdx);
375 Scalar lambdaTotal5 = lambda5[wPhaseIdx] + lambda5[nPhaseIdx];
378 Dune::FieldVector<Scalar, numPhases> lambda6(cellData6.mobility(wPhaseIdx));
379 lambda6[nPhaseIdx] = cellData6.mobility(nPhaseIdx);
382 Scalar lambdaTotal6 = lambda6[wPhaseIdx] + lambda6[nPhaseIdx];
385 Dune::FieldVector<Scalar, numPhases> lambda7(cellData7.mobility(wPhaseIdx));
386 lambda7[nPhaseIdx] = cellData7.mobility(nPhaseIdx);
389 Scalar lambdaTotal7 = lambda7[wPhaseIdx] + lambda7[nPhaseIdx];
392 Dune::FieldVector<Scalar, numPhases> lambda8(cellData8.mobility(wPhaseIdx));
393 lambda8[nPhaseIdx] = cellData8.mobility(nPhaseIdx);
396 Scalar lambdaTotal8 = lambda8[wPhaseIdx] + lambda8[nPhaseIdx];
398 std::vector<DimVector> lambda(8);
399 lambda[0][0] = lambdaTotal1;
400 lambda[0][1] = lambdaTotal1;
401 lambda[0][2] = lambdaTotal1;
402 lambda[1][0] = lambdaTotal2;
403 lambda[1][1] = lambdaTotal2;
404 lambda[1][2] = lambdaTotal2;
405 lambda[2][0] = lambdaTotal3;
406 lambda[2][1] = lambdaTotal3;
407 lambda[2][2] = lambdaTotal3;
408 lambda[3][0] = lambdaTotal4;
409 lambda[3][1] = lambdaTotal4;
410 lambda[3][2] = lambdaTotal4;
411 lambda[4][0] = lambdaTotal5;
412 lambda[4][1] = lambdaTotal5;
413 lambda[4][2] = lambdaTotal5;
414 lambda[5][0] = lambdaTotal6;
415 lambda[5][1] = lambdaTotal6;
416 lambda[5][2] = lambdaTotal6;
417 lambda[6][0] = lambdaTotal7;
418 lambda[6][1] = lambdaTotal7;
419 lambda[6][2] = lambdaTotal7;
420 lambda[7][0] = lambdaTotal8;
421 lambda[7][1] = lambdaTotal8;
422 lambda[7][2] = lambdaTotal8;
424 Scalar potentialDiffW0 = 0;
425 Scalar potentialDiffW1 = 0;
426 Scalar potentialDiffW2 = 0;
427 Scalar potentialDiffW3 = 0;
428 Scalar potentialDiffW4 = 0;
429 Scalar potentialDiffW5 = 0;
430 Scalar potentialDiffW6 = 0;
431 Scalar potentialDiffW7 = 0;
432 Scalar potentialDiffW8 = 0;
433 Scalar potentialDiffW9 = 0;
434 Scalar potentialDiffW10 = 0;
435 Scalar potentialDiffW11 = 0;
437 Scalar potentialDiffNw0 = 0;
438 Scalar potentialDiffNw1 = 0;
439 Scalar potentialDiffNw2 = 0;
440 Scalar potentialDiffNw3 = 0;
441 Scalar potentialDiffNw4 = 0;
442 Scalar potentialDiffNw5 = 0;
443 Scalar potentialDiffNw6 = 0;
444 Scalar potentialDiffNw7 = 0;
445 Scalar potentialDiffNw8 = 0;
446 Scalar potentialDiffNw9 = 0;
447 Scalar potentialDiffNw10 = 0;
448 Scalar potentialDiffNw11 = 0;
451 Dune::FieldVector<Scalar, 12> fluxW(0);
452 Dune::FieldVector<Scalar, 12> fluxNw(0);
455 Dune::FieldVector<Scalar, 2 * dim - dim + 1> u(0);
456 TransmissibilityType T(0);
458 if (fIdx < 0 || fIdx == 0)
461 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 0, 1, 2, 3,
474 potentialDiffW0 = Tu[0];
484 potentialDiffNw0 = Tu[0];
496 potentialDiffW0 = Tu[0];
506 potentialDiffNw0 = Tu[0];
518 potentialDiffW0 = Tu[0];
528 potentialDiffNw0 = Tu[0];
540 potentialDiffW0 = Tu[0];
550 potentialDiffNw0 = Tu[0];
554 if (fIdx < 0 || fIdx == 1)
557 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 1, 3, 0, 2, 5,
570 potentialDiffW1 = Tu[0];
580 potentialDiffNw1 = Tu[0];
592 potentialDiffW1 = Tu[0];
602 potentialDiffNw1 = Tu[0];
614 potentialDiffW1 = Tu[0];
624 potentialDiffNw1 = Tu[0];
636 potentialDiffW1 = Tu[0];
646 potentialDiffNw1 = Tu[0];
650 if (fIdx < 0 || fIdx == 2)
653 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 3, 2, 1, 0, 7,
666 potentialDiffW2 = Tu[0];
676 potentialDiffNw2 = Tu[0];
688 potentialDiffW2 = Tu[0];
698 potentialDiffNw2 = Tu[0];
710 potentialDiffW2 = Tu[0];
720 potentialDiffNw2 = Tu[0];
732 potentialDiffW2 = Tu[0];
742 potentialDiffNw2 = Tu[0];
746 if (fIdx < 0 || fIdx == 3)
749 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 2, 0, 3, 1, 6,
762 potentialDiffW3 = Tu[0];
772 potentialDiffNw3 = Tu[0];
784 potentialDiffW3 = Tu[0];
794 potentialDiffNw3 = Tu[0];
806 potentialDiffW3 = Tu[0];
816 potentialDiffNw3 = Tu[0];
828 potentialDiffW3 = Tu[0];
838 potentialDiffNw3 = Tu[0];
842 if (fIdx < 0 || fIdx == 4)
845 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 5, 4, 7, 6, 1,
858 potentialDiffW4 = Tu[0];
868 potentialDiffNw4 = Tu[0];
880 potentialDiffW4 = Tu[0];
890 potentialDiffNw4 = Tu[0];
902 potentialDiffW4 = Tu[0];
912 potentialDiffNw4 = Tu[0];
924 potentialDiffW4 = Tu[0];
934 potentialDiffNw4 = Tu[0];
938 if (fIdx < 0 || fIdx == 5)
941 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 7, 5, 6, 4, 3,
954 potentialDiffW5 = Tu[0];
964 potentialDiffNw5 = Tu[0];
976 potentialDiffW5 = Tu[0];
986 potentialDiffNw5 = Tu[0];
998 potentialDiffW5 = Tu[0];
1008 potentialDiffNw5 = Tu[0];
1020 potentialDiffW5 = Tu[0];
1030 potentialDiffNw5 = Tu[0];
1034 if (fIdx < 0 || fIdx == 6)
1037 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 6, 7, 4, 5, 2,
1050 potentialDiffW6 = Tu[0];
1060 potentialDiffNw6 = Tu[0];
1062 else if (caseL == 2)
1072 potentialDiffW6 = Tu[0];
1082 potentialDiffNw6 = Tu[0];
1084 else if (caseL == 3)
1094 potentialDiffW6 = Tu[0];
1104 potentialDiffNw6 = Tu[0];
1116 potentialDiffW6 = Tu[0];
1126 potentialDiffNw6 = Tu[0];
1130 if (fIdx < 0 || fIdx == 7)
1133 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 4, 6, 5, 7, 0,
1146 potentialDiffW7 = Tu[0];
1156 potentialDiffNw7 = Tu[0];
1158 else if (caseL == 2)
1168 potentialDiffW7 = Tu[0];
1178 potentialDiffNw7 = Tu[0];
1180 else if (caseL == 3)
1190 potentialDiffW7 = Tu[0];
1200 potentialDiffNw7 = Tu[0];
1212 potentialDiffW7 = Tu[0];
1222 potentialDiffNw7 = Tu[0];
1226 if (fIdx < 0 || fIdx == 8)
1229 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 4, 0, 6, 2, 5,
1242 potentialDiffW8 = Tu[0];
1252 potentialDiffNw8 = Tu[0];
1254 else if (caseL == 2)
1264 potentialDiffW8 = Tu[0];
1274 potentialDiffNw8 = Tu[0];
1276 else if (caseL == 3)
1286 potentialDiffW8 = Tu[0];
1296 potentialDiffNw8 = Tu[0];
1308 potentialDiffW8 = Tu[0];
1318 potentialDiffNw8 = Tu[0];
1322 if (fIdx < 0 || fIdx == 9)
1325 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 1, 5, 3, 7, 0,
1338 potentialDiffW9 = Tu[0];
1348 potentialDiffNw9 = Tu[0];
1350 else if (caseL == 2)
1360 potentialDiffW9 = Tu[0];
1370 potentialDiffNw9 = Tu[0];
1372 else if (caseL == 3)
1382 potentialDiffW9 = Tu[0];
1392 potentialDiffNw9 = Tu[0];
1404 potentialDiffW9 = Tu[0];
1414 potentialDiffNw9 = Tu[0];
1418 if (fIdx < 0 || fIdx == 10)
1421 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 7, 3, 5, 1, 6,
1434 potentialDiffW10 = Tu[0];
1444 potentialDiffNw10 = Tu[0];
1446 else if (caseL == 2)
1456 potentialDiffW10 = Tu[0];
1466 potentialDiffNw10 = Tu[0];
1468 else if (caseL == 3)
1478 potentialDiffW10 = Tu[0];
1488 potentialDiffNw10 = Tu[0];
1500 potentialDiffW10 = Tu[0];
1510 potentialDiffNw10 = Tu[0];
1514 if (fIdx < 0 || fIdx == 11)
1517 int caseL = transmissibilityCalculator.
transmissibility(T, interactionVolume, lambda, 2, 6, 0, 4, 3,
1530 potentialDiffW11 = Tu[0];
1540 potentialDiffNw11 = Tu[0];
1542 else if (caseL == 2)
1552 potentialDiffW11 = Tu[0];
1562 potentialDiffNw11 = Tu[0];
1564 else if (caseL == 3)
1574 potentialDiffW11 = Tu[0];
1584 potentialDiffNw11 = Tu[0];
1596 potentialDiffW11 = Tu[0];
1606 potentialDiffNw11 = Tu[0];
1611 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(0, 0), potentialDiffW0);
1612 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(0, 0), potentialDiffNw0);
1613 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(0, 1), -potentialDiffW3);
1614 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(0, 1), -potentialDiffNw3);
1615 cellData1.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(0, 2), -potentialDiffW8);
1616 cellData1.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(0, 2), -potentialDiffNw8);
1618 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(1, 0), potentialDiffW1);
1619 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(1, 0), potentialDiffNw1);
1620 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(1, 1), -potentialDiffW0);
1621 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(1, 1), -potentialDiffNw0);
1622 cellData2.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(1, 2), potentialDiffW9);
1623 cellData2.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(1, 2), potentialDiffNw9);
1625 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(2, 0), potentialDiffW3);
1626 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(2, 0), potentialDiffNw3);
1627 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(2, 1), -potentialDiffW2);
1628 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(2, 1), -potentialDiffNw2);
1629 cellData3.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(2, 2), potentialDiffW11);
1630 cellData3.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(2, 2), potentialDiffNw11);
1632 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(3, 0), potentialDiffW2);
1633 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(3, 0), potentialDiffNw2);
1634 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(3, 1), -potentialDiffW1);
1635 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(3, 1), -potentialDiffNw1);
1636 cellData4.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(3, 2), -potentialDiffW10);
1637 cellData4.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(3, 2), -potentialDiffNw10);
1639 cellData5.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(4, 0), potentialDiffW8);
1640 cellData5.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(4, 0), potentialDiffNw8);
1641 cellData5.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(4, 1), -potentialDiffW4);
1642 cellData5.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(4, 1), -potentialDiffNw4);
1643 cellData5.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(4, 2), potentialDiffW7);
1644 cellData5.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(4, 2), potentialDiffNw7);
1646 cellData6.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(5, 0), -potentialDiffW9);
1647 cellData6.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(5, 0), -potentialDiffNw9);
1648 cellData6.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(5, 1), -potentialDiffW5);
1649 cellData6.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(5, 1), -potentialDiffNw5);
1650 cellData6.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(5, 2), potentialDiffW4);
1651 cellData6.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(5, 2), potentialDiffNw4);
1653 cellData7.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(6, 0), -potentialDiffW11);
1654 cellData7.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(6, 0), -potentialDiffNw11);
1655 cellData7.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(6, 1), -potentialDiffW7);
1656 cellData7.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(6, 1), -potentialDiffNw7);
1657 cellData7.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(6, 2), potentialDiffW6);
1658 cellData7.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(6, 2), potentialDiffNw6);
1660 cellData8.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(7, 0), potentialDiffW10);
1661 cellData8.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(7, 0), potentialDiffNw10);
1662 cellData8.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(7, 1), -potentialDiffW6);
1663 cellData8.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(7, 1), -potentialDiffNw6);
1664 cellData8.fluxData().addUpwindPotential(wPhaseIdx, interactionVolume.getIndexOnElement(7, 2), potentialDiffW5);
1665 cellData8.fluxData().addUpwindPotential(nPhaseIdx, interactionVolume.getIndexOnElement(7, 2), potentialDiffNw5);
1668 Dune::FieldVector<Scalar, numPhases> lambda0Upw(0.0);
1669 lambda0Upw[wPhaseIdx] = (potentialDiffW0 >= 0) ? lambda1[wPhaseIdx] : lambda2[wPhaseIdx];
1670 lambda0Upw[nPhaseIdx] = (potentialDiffNw0 >= 0) ? lambda1[nPhaseIdx] : lambda2[nPhaseIdx];
1673 Dune::FieldVector<Scalar, numPhases> lambda1Upw(0.0);
1674 lambda1Upw[wPhaseIdx] = (potentialDiffW1 >= 0) ? lambda2[wPhaseIdx] : lambda4[wPhaseIdx];
1675 lambda1Upw[nPhaseIdx] = (potentialDiffNw1 >= 0) ? lambda2[nPhaseIdx] : lambda4[nPhaseIdx];
1678 Dune::FieldVector<Scalar, numPhases> lambda2Upw(0.0);
1679 lambda2Upw[wPhaseIdx] = (potentialDiffW2 >= 0) ? lambda4[wPhaseIdx] : lambda3[wPhaseIdx];
1680 lambda2Upw[nPhaseIdx] = (potentialDiffNw2 >= 0) ? lambda4[nPhaseIdx] : lambda3[nPhaseIdx];
1683 Dune::FieldVector<Scalar, numPhases> lambda3Upw(0.0);
1684 lambda3Upw[wPhaseIdx] = (potentialDiffW3 >= 0) ? lambda3[wPhaseIdx] : lambda1[wPhaseIdx];
1685 lambda3Upw[nPhaseIdx] = (potentialDiffNw3 >= 0) ? lambda3[nPhaseIdx] : lambda1[nPhaseIdx];
1688 Dune::FieldVector<Scalar, numPhases> lambda4Upw(0.0);
1689 lambda4Upw[wPhaseIdx] = (potentialDiffW4 >= 0) ? lambda6[wPhaseIdx] : lambda5[wPhaseIdx];
1690 lambda4Upw[nPhaseIdx] = (potentialDiffNw4 >= 0) ? lambda6[nPhaseIdx] : lambda5[nPhaseIdx];
1693 Dune::FieldVector<Scalar, numPhases> lambda5Upw(0.0);
1694 lambda5Upw[wPhaseIdx] = (potentialDiffW5 >= 0) ? lambda8[wPhaseIdx] : lambda6[wPhaseIdx];
1695 lambda5Upw[nPhaseIdx] = (potentialDiffNw5 >= 0) ? lambda8[nPhaseIdx] : lambda6[nPhaseIdx];
1698 Dune::FieldVector<Scalar, numPhases> lambda6Upw(0.0);
1699 lambda6Upw[wPhaseIdx] = (potentialDiffW6 >= 0) ? lambda7[wPhaseIdx] : lambda8[wPhaseIdx];
1700 lambda6Upw[nPhaseIdx] = (potentialDiffNw6 >= 0) ? lambda7[nPhaseIdx] : lambda8[nPhaseIdx];
1703 Dune::FieldVector<Scalar, numPhases> lambda7Upw(0.0);
1704 lambda7Upw[wPhaseIdx] = (potentialDiffW7 >= 0) ? lambda5[wPhaseIdx] : lambda7[wPhaseIdx];
1705 lambda7Upw[nPhaseIdx] = (potentialDiffNw7 >= 0) ? lambda5[nPhaseIdx] : lambda7[nPhaseIdx];
1708 Dune::FieldVector<Scalar, numPhases> lambda8Upw(0.0);
1709 lambda8Upw[wPhaseIdx] = (potentialDiffW8 >= 0) ? lambda5[wPhaseIdx] : lambda1[wPhaseIdx];
1710 lambda8Upw[nPhaseIdx] = (potentialDiffNw8 >= 0) ? lambda5[nPhaseIdx] : lambda1[nPhaseIdx];
1713 Dune::FieldVector<Scalar, numPhases> lambda9Upw(0.0);
1714 lambda9Upw[wPhaseIdx] = (potentialDiffW9 >= 0) ? lambda2[wPhaseIdx] : lambda6[wPhaseIdx];
1715 lambda9Upw[nPhaseIdx] = (potentialDiffNw9 >= 0) ? lambda2[nPhaseIdx] : lambda6[nPhaseIdx];
1718 Dune::FieldVector<Scalar, numPhases> lambda10Upw(0.0);
1719 lambda10Upw[wPhaseIdx] = (potentialDiffW10 >= 0) ? lambda8[wPhaseIdx] : lambda4[wPhaseIdx];
1720 lambda10Upw[nPhaseIdx] = (potentialDiffNw10 >= 0) ? lambda8[nPhaseIdx] : lambda4[nPhaseIdx];
1723 Dune::FieldVector<Scalar, numPhases> lambda11Upw(0.0);
1724 lambda11Upw[wPhaseIdx] = (potentialDiffW11 >= 0) ? lambda3[wPhaseIdx] : lambda7[wPhaseIdx];
1725 lambda11Upw[nPhaseIdx] = (potentialDiffNw11 >= 0) ? lambda3[nPhaseIdx] : lambda7[nPhaseIdx];
1727 for (
int i = 0; i < numPhases; i++)
1730 DimVector vel12 = interactionVolume.getNormal(0, 0);
1731 DimVector vel21 = interactionVolume.getNormal(1, 1);
1732 DimVector vel24 = interactionVolume.getNormal(1, 0);
1733 DimVector vel42 = interactionVolume.getNormal(3, 1);
1734 DimVector vel43 = interactionVolume.getNormal(3, 0);
1735 DimVector vel34 = interactionVolume.getNormal(2, 1);
1736 DimVector vel31 = interactionVolume.getNormal(2, 0);
1737 DimVector vel13 = interactionVolume.getNormal(0, 1);
1738 DimVector vel65 = interactionVolume.getNormal(5, 2);
1739 DimVector vel56 = interactionVolume.getNormal(4, 1);
1740 DimVector vel86 = interactionVolume.getNormal(7, 2);
1741 DimVector vel68 = interactionVolume.getNormal(5, 1);
1742 DimVector vel78 = interactionVolume.getNormal(6, 2);
1743 DimVector vel87 = interactionVolume.getNormal(7, 1);
1744 DimVector vel57 = interactionVolume.getNormal(4, 2);
1745 DimVector vel75 = interactionVolume.getNormal(6, 1);
1746 DimVector vel51 = interactionVolume.getNormal(4, 0);
1747 DimVector vel15 = interactionVolume.getNormal(0, 2);
1748 DimVector vel26 = interactionVolume.getNormal(1, 2);
1749 DimVector vel62 = interactionVolume.getNormal(5, 0);
1750 DimVector vel84 = interactionVolume.getNormal(7, 0);
1751 DimVector vel48 = interactionVolume.getNormal(3, 2);
1752 DimVector vel37 = interactionVolume.getNormal(2, 2);
1753 DimVector vel73 = interactionVolume.getNormal(6, 0);
1767 Dune::FieldVector<Scalar, 12> flux(0);
1782 vel12 *= flux[0] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal1, 0, 0));
1783 vel21 *= flux[0] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal2, 1, 1));
1784 vel24 *= flux[1] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal2, 1, 0));
1785 vel42 *= flux[1] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal4, 3, 1));
1786 vel43 *= flux[2] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal4, 3, 0));
1787 vel34 *= flux[2] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal3, 2, 1));
1788 vel31 *= flux[3] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal3, 2, 0));
1789 vel13 *= flux[3] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal1, 0, 1));
1790 vel65 *= flux[4] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal6, 5, 2));
1791 vel56 *= flux[4] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal5, 4, 1));
1792 vel86 *= flux[5] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal8, 7, 2));
1793 vel68 *= flux[5] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal6, 5, 1));
1794 vel78 *= flux[6] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal7, 6, 2));
1795 vel87 *= flux[6] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal8, 7, 1));
1796 vel57 *= flux[7] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal5, 4, 2));
1797 vel75 *= flux[7] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal7, 6, 1));
1798 vel51 *= flux[8] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal5, 4, 0));
1799 vel15 *= flux[8] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal1, 0, 2));
1800 vel26 *= flux[9] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal2, 1, 2));
1801 vel62 *= flux[9] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal6, 5, 0));
1802 vel84 *= flux[10] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal8, 7, 0));
1803 vel48 *= flux[10] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal4, 3, 2));
1804 vel37 *= flux[11] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal3, 2, 2));
1805 vel73 *= flux[11] / (interactionVolumes.getRealFluxFaceArea(interactionVolume, eIdxGlobal7, 6, 0));
1808 Scalar lambdaT0 = lambda0Upw[wPhaseIdx] + lambda0Upw[nPhaseIdx];
1809 Scalar lambdaT1 = lambda1Upw[wPhaseIdx] + lambda1Upw[nPhaseIdx];
1810 Scalar lambdaT2 = lambda2Upw[wPhaseIdx] + lambda2Upw[nPhaseIdx];
1811 Scalar lambdaT3 = lambda3Upw[wPhaseIdx] + lambda3Upw[nPhaseIdx];
1812 Scalar lambdaT4 = lambda4Upw[wPhaseIdx] + lambda4Upw[nPhaseIdx];
1813 Scalar lambdaT5 = lambda5Upw[wPhaseIdx] + lambda5Upw[nPhaseIdx];
1814 Scalar lambdaT6 = lambda6Upw[wPhaseIdx] + lambda6Upw[nPhaseIdx];
1815 Scalar lambdaT7 = lambda7Upw[wPhaseIdx] + lambda7Upw[nPhaseIdx];
1816 Scalar lambdaT8 = lambda8Upw[wPhaseIdx] + lambda8Upw[nPhaseIdx];
1817 Scalar lambdaT9 = lambda9Upw[wPhaseIdx] + lambda9Upw[nPhaseIdx];
1818 Scalar lambdaT10 = lambda10Upw[wPhaseIdx] + lambda10Upw[nPhaseIdx];
1819 Scalar lambdaT11 = lambda11Upw[wPhaseIdx] + lambda11Upw[nPhaseIdx];
1820 Scalar fracFlow0 = (lambdaT0 > threshold_) ? lambda0Upw[i] / (lambdaT0) : 0.0;
1821 Scalar fracFlow1 = (lambdaT1 > threshold_) ? lambda1Upw[i] / (lambdaT1) : 0.0;
1822 Scalar fracFlow2 = (lambdaT2 > threshold_) ? lambda2Upw[i] / (lambdaT2) : 0.0;
1823 Scalar fracFlow3 = (lambdaT3 > threshold_) ? lambda3Upw[i] / (lambdaT3) : 0.0;
1824 Scalar fracFlow4 = (lambdaT4 > threshold_) ? lambda4Upw[i] / (lambdaT4) : 0.0;
1825 Scalar fracFlow5 = (lambdaT5 > threshold_) ? lambda5Upw[i] / (lambdaT5) : 0.0;
1826 Scalar fracFlow6 = (lambdaT6 > threshold_) ? lambda6Upw[i] / (lambdaT6) : 0.0;
1827 Scalar fracFlow7 = (lambdaT7 > threshold_) ? lambda7Upw[i] / (lambdaT7) : 0.0;
1828 Scalar fracFlow8 = (lambdaT8 > threshold_) ? lambda8Upw[i] / (lambdaT8) : 0.0;
1829 Scalar fracFlow9 = (lambdaT9 > threshold_) ? lambda9Upw[i] / (lambdaT9) : 0.0;
1830 Scalar fracFlow10 = (lambdaT10 > threshold_) ? lambda10Upw[i] / (lambdaT10) : 0.0;
1831 Scalar fracFlow11 = (lambdaT11 > threshold_) ? lambda11Upw[i] / (lambdaT11) : 0.0;
1853 vel84 *= fracFlow10;
1854 vel48 *= fracFlow10;
1855 vel37 *= fracFlow11;
1856 vel73 *= fracFlow11;
1859 cellData1.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(0, 0), vel12);
1860 cellData1.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(0, 1), vel13);
1861 cellData1.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(0, 2), vel15);
1862 cellData2.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(1, 0), vel24);
1863 cellData2.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(1, 1), vel21);
1864 cellData2.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(1, 2), vel26);
1865 cellData3.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(2, 0), vel31);
1866 cellData3.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(2, 1), vel34);
1867 cellData3.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(2, 2), vel37);
1868 cellData4.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(3, 0), vel43);
1869 cellData4.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(3, 1), vel42);
1870 cellData4.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(3, 2), vel48);
1871 cellData5.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(4, 0), vel51);
1872 cellData5.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(4, 1), vel56);
1873 cellData5.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(4, 2), vel57);
1874 cellData6.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(5, 0), vel62);
1875 cellData6.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(5, 1), vel68);
1876 cellData6.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(5, 2), vel65);
1877 cellData7.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(6, 0), vel73);
1878 cellData7.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(6, 1), vel75);
1879 cellData7.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(6, 2), vel78);
1880 cellData8.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(7, 0), vel84);
1881 cellData8.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(7, 1), vel87);
1882 cellData8.fluxData().addVelocity(i, interactionVolume.getIndexOnElement(7, 2), vel86);
1885 cellData1.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(0, 0));
1886 cellData1.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(0, 1));
1887 cellData1.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(0, 2));
1888 cellData2.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(1, 0));
1889 cellData2.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(1, 1));
1890 cellData2.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(1, 2));
1891 cellData3.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(2, 0));
1892 cellData3.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(2, 1));
1893 cellData3.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(2, 2));
1894 cellData4.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(3, 0));
1895 cellData4.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(3, 1));
1896 cellData4.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(3, 2));
1897 cellData5.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(4, 0));
1898 cellData5.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(4, 1));
1899 cellData5.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(4, 2));
1900 cellData6.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(5, 0));
1901 cellData6.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(5, 1));
1902 cellData6.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(5, 2));
1903 cellData7.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(6, 0));
1904 cellData7.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(6, 1));
1905 cellData7.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(6, 2));
1906 cellData8.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(7, 0));
1907 cellData8.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(7, 1));
1908 cellData8.fluxData().setVelocityMarker(interactionVolume.getIndexOnElement(7, 2));
1920template<
class TypeTag>
1923 auto element = interactionVolume.getSubVolumeElement(elemIdx);
1926 const GlobalPosition& globalPos = element.geometry().center();
1929 DimMatrix
permeability(problem_.spatialParams().intrinsicPermeability(element));
1932 Dune::FieldVector<Scalar, numPhases> lambda(cellData.mobility(wPhaseIdx));
1933 lambda[nPhaseIdx] = cellData.mobility(nPhaseIdx);
1935 Scalar potW = cellData.potential(wPhaseIdx);
1936 Scalar potNw = cellData.potential(nPhaseIdx);
1938 for (
int fIdx = 0; fIdx < dim; fIdx++)
1940 int intVolFaceIdx = interactionVolume.getFaceIndexFromSubVolume(elemIdx, fIdx);
1942 if (interactionVolume.isBoundaryFace(intVolFaceIdx))
1944 if (interactionVolume.getBoundaryType(intVolFaceIdx).isDirichlet(pressureEqIdx))
1946 int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
1948 const GlobalPosition& globalPosFace = interactionVolume.getFacePosition(elemIdx, fIdx);
1950 DimVector distVec(globalPosFace - globalPos);
1951 Scalar dist = distVec.two_norm();
1952 DimVector&
normal = interactionVolume.getNormal(elemIdx, fIdx);
1955 Scalar satWBound = cellData.saturation(wPhaseIdx);
1957 if (interactionVolume.getBoundaryType(intVolFaceIdx).isDirichlet(satEqIdx))
1959 Scalar satBound = interactionVolume.getDirichletValues(intVolFaceIdx)[saturationIdx];
1960 switch (saturationType_)
1964 satWBound = satBound;
1969 satWBound = 1 - satBound;
1979 const auto fluidMatrixInteraction = Deprecated::makePcKrSw(Scalar{}, problem_.spatialParams(), element);
1981 Scalar pcBound = fluidMatrixInteraction.pc(satWBound);
1983 Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_
1984 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
1986 pcBound += gravityDiffBound;
1988 Dune::FieldVector<Scalar, numPhases> lambdaBound(fluidMatrixInteraction.krw(satWBound));
1989 lambdaBound[nPhaseIdx] = fluidMatrixInteraction.krn(satWBound);
1990 lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
1991 lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
1993 Scalar gdeltaZ = (problem_.bBoxMax()-globalPosFace) * gravity_;
1994 Scalar potentialBoundW = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx] + density_[wPhaseIdx]*gdeltaZ;
1995 Scalar potentialBoundNw = potentialBoundW;
1998 switch (pressureType_)
2002 potentialBoundNw += pcBound;
2008 potentialBoundW -= pcBound;
2013 Scalar potentialDiffW = (potW - potentialBoundW) / dist;
2014 Scalar potentialDiffNw = (potNw - potentialBoundNw) / dist;
2017 cellData.fluxData().addUpwindPotential(wPhaseIdx, boundaryFaceIdx, potentialDiffW);
2018 cellData.fluxData().addUpwindPotential(nPhaseIdx, boundaryFaceIdx, potentialDiffNw);
2021 DimVector velocityW(0);
2022 DimVector velocityNw(0);
2025 DimVector potentialGradient =
normal;
2026 potentialGradient *= (potW - potentialBoundW) / dist;
2029 potentialGradient =
normal;
2030 potentialGradient *= (potNw - potentialBoundNw) / dist;
2033 velocityW *= (potentialDiffW >= 0.) ? lambda[wPhaseIdx] : lambdaBound[wPhaseIdx];
2034 velocityNw *= (potentialDiffNw >= 0.) ? lambda[nPhaseIdx] : lambdaBound[nPhaseIdx];
2041 cellData.fluxData().addVelocity(wPhaseIdx, boundaryFaceIdx, velocityW);
2042 cellData.fluxData().addVelocity(nPhaseIdx, boundaryFaceIdx, velocityNw);
2043 cellData.fluxData().setVelocityMarker(boundaryFaceIdx);
2045 else if (interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx))
2047 int boundaryFaceIdx = interactionVolume.getIndexOnElement(elemIdx, fIdx);
2049 DimVector&
normal = interactionVolume.getNormal(elemIdx, fIdx);
2052 PrimaryVariables boundValues(interactionVolume.getNeumannValues(intVolFaceIdx));
2054 boundValues[wPhaseIdx] /= density_[wPhaseIdx];
2055 boundValues[nPhaseIdx] /= density_[nPhaseIdx];
2057 DimVector velocityW(
normal);
2058 DimVector velocityNw(
normal);
2060 velocityW *= boundValues[wPhaseIdx] / (4.0*interactionVolume.getFaceArea(elemIdx, fIdx));
2061 velocityNw *= boundValues[nPhaseIdx]
2062 / (4.0*interactionVolume.getFaceArea(elemIdx, fIdx));
2065 cellData.fluxData().addUpwindPotential(wPhaseIdx, boundaryFaceIdx, boundValues[wPhaseIdx]);
2066 cellData.fluxData().addUpwindPotential(nPhaseIdx, boundaryFaceIdx, boundValues[nPhaseIdx]);
2069 cellData.fluxData().addVelocity(wPhaseIdx, boundaryFaceIdx, velocityW);
2070 cellData.fluxData().addVelocity(nPhaseIdx, boundaryFaceIdx, velocityNw);
2071 cellData.fluxData().setVelocityMarker(boundaryFaceIdx);
2075 std::cout <<
"interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx)"
2076 << interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx) <<
"\n";
2077 DUNE_THROW(Dune::NotImplemented,
2078 "No valid boundary condition type defined for pressure equation!");
Provides methods for transmissibility calculation in 3-d.
Vector normal(const Vector &v)
Create a vector normal to the given one (v is expected to be non-zero)
Definition: geometry/normal.hh:36
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
Provides methods for transmissibility calculation in 3-d.
Definition: 3dtransmissibilitycalculator.hh:51
Dune::FieldMatrix< Scalar, dim, 2 *dim - dim+1 > TransmissibilityType
Type of the transmissibility matrix.
Definition: 3dtransmissibilitycalculator.hh:78
int transmissibility(Dune::FieldMatrix< Scalar, dim, 2 *dim-dim+1 > &transmissibility, InteractionVolume &interactionVolume, std::vector< DimVector > &lambda, int idx1, int idx2, int idx3, int idx4, int idx5, int idx6)
Class for calculating 3-d velocities from cell-wise constant pressure values.
Definition: 3dvelocity.hh:57
FvMpfaL3dVelocity2p(Problem &problem)
Constructs a FvMpfaL3dVelocity2p object.
Definition: 3dvelocity.hh:139
void initialize(bool solveTwice=true)
Initializes the velocity model.
Definition: 3dvelocity.hh:160
void addOutputVtkFields(MultiWriter &writer)
Adds velocity output to the output file.
Definition: 3dvelocity.hh:188
void calculateInnerInteractionVolumeVelocity(InteractionVolume &interactionVolume, CellData &cellData1, CellData &cellData2, CellData &cellData3, CellData &cellData4, CellData &cellData5, CellData &cellData6, CellData &cellData7, CellData &cellData8, InteractionVolumeContainer &interactionVolumes, TransmissibilityCalculator &transmissibilityCalculator, int fIdx=-1)
Calculate velocities for flux faces of an interaction volume.
Definition: 3dvelocity.hh:296
void calculateBoundaryInteractionVolumeVelocity(InteractionVolume &interactionVolume, CellData &cellData, int elemIdx)
Calculates the velocity at a boundary flux faces.
Definition: 3dvelocity.hh:1921
Specifies the properties for immiscible 2p diffusion/pressure models.
Properties for a MPFA method.