26#ifndef DUMUX_FVMPFAL2PFABOUND3DPRESSURE2P_HH
27#define DUMUX_FVMPFAL2PFABOUND3DPRESSURE2P_HH
72template<
class TypeTag>
81 dim = GridView::dimension, dimWorld = GridView::dimensionworld
98 using PrimaryVariables =
typename SolutionTypes::PrimaryVariables;
99 using ScalarSolutionType =
typename SolutionTypes::ScalarSolution;
103 pw = Indices::pressureW,
104 pn = Indices::pressureNw,
105 pGlobal = Indices::pressureGlobal,
106 sw = Indices::saturationW,
107 sn = Indices::saturationNw,
108 vw = Indices::velocityW,
109 vn = Indices::velocityNw,
110 vt = Indices::velocityTotal
114 wPhaseIdx = Indices::wPhaseIdx,
115 nPhaseIdx = Indices::nPhaseIdx,
116 pressureIdx = Indices::pressureIdx,
117 saturationIdx = Indices::saturationIdx,
118 pressureEqIdx = Indices::pressureEqIdx,
119 satEqIdx = Indices::satEqIdx,
120 numPhases = getPropValue<TypeTag, Properties::NumPhases>()
127 dirichletDirichlet = 1,
128 dirichletNeumann = 2,
137 using Element =
typename GridView::Traits::template Codim<0>::Entity;
138 using Grid =
typename GridView::Grid;
139 using Geometry =
typename Element::Geometry;
140 using IntersectionIterator =
typename GridView::IntersectionIterator;
142 using GlobalPosition =
typename Geometry::GlobalCoordinate;
143 using GravityVector = Dune::FieldVector<Scalar, dimWorld>;
144 using DimMatrix = Dune::FieldMatrix<Scalar, dim, dim>;
146 using DimVector = Dune::FieldVector<Scalar, dim>;
179 const auto element = *problem_.gridView().template begin<0>();
180 FluidState fluidState;
181 fluidState.setPressure(wPhaseIdx, problem_.referencePressure(element));
182 fluidState.setPressure(nPhaseIdx, problem_.referencePressure(element));
183 fluidState.setTemperature(problem_.temperature(element));
184 fluidState.setSaturation(wPhaseIdx, 1.);
185 fluidState.setSaturation(nPhaseIdx, 0.);
208 for (
const auto& element : elements(problem_.gridView()))
221 int eIdxGlobal = problem_.variables().index(element);
222 CellData& cellData = problem_.variables().cellData(eIdxGlobal);
224 switch (pressureType_)
228 Scalar potW = this->
pressure()[eIdxGlobal];
230 Scalar gravityDiff = (problem_.bBoxMax() - element.geometry().center()) * gravity_;
231 Scalar potPc = cellData.capillaryPressure()
232 + gravityDiff * (density_[nPhaseIdx] - density_[wPhaseIdx]);
234 cellData.setPotential(wPhaseIdx, potW);
235 cellData.setPotential(nPhaseIdx, potW + potPc);
237 Scalar pressW = potW - gravityDiff * density_[wPhaseIdx];
239 cellData.setPressure(wPhaseIdx, pressW);
240 cellData.setPressure(nPhaseIdx, pressW + cellData.capillaryPressure());
246 Scalar potNw = this->
pressure()[eIdxGlobal];
248 Scalar gravityDiff = (problem_.bBoxMax() - element.geometry().center()) * gravity_;
249 Scalar potPc = cellData.capillaryPressure()
250 + gravityDiff * (density_[nPhaseIdx] - density_[wPhaseIdx]);
252 cellData.setPotential(nPhaseIdx, potNw);
253 cellData.setPotential(wPhaseIdx, potNw - potPc);
255 Scalar pressNw = potNw - gravityDiff * density_[nPhaseIdx];
257 cellData.setPressure(wPhaseIdx, pressNw - cellData.capillaryPressure());
258 cellData.setPressure(nPhaseIdx, pressNw);
263 cellData.fluxData().resetVelocity();
273 int size = problem_.gridView().size(0);
277 timeStep_ = problem_.timeManager().timeStepSize();
279 for (
int i = 0; i < size; i++)
281 CellData& cellData = problem_.variables().cellData(i);
284 switch (saturationType_)
287 sat = cellData.saturation(wPhaseIdx);
290 sat = cellData.saturation(nPhaseIdx);
295 maxError_ = max(maxError_, (sat - 1.0) / timeStep_);
299 maxError_ = max(maxError_, (-sat) / timeStep_);
302 switch (pressureType_)
305 this->
pressure()[i] = cellData.pressure(wPhaseIdx);
308 this->
pressure()[i] = cellData.pressure(nPhaseIdx);
345 switch (saturationType_)
348 sat = cellData.saturation(wPhaseIdx);
351 sat = cellData.saturation(nPhaseIdx);
355 Scalar error = (sat > 1.0) ? sat - 1.0 : 0.0;
363 Scalar errorAbs = abs(error);
365 if ((errorAbs * timeStep_ > 1e-6) && (errorAbs > ErrorTermLowerBound_ * maxError_)
366 && (!problem_.timeManager().willBeFinished()))
368 return ErrorTermFactor_ * error;
383 template<
class MultiWriter>
386 int size = problem_.gridView().size(0);
387 ScalarSolutionType *potential = writer.allocateManagedBuffer(size);
391 if (pressureType_ == pw)
393 writer.attachCellData(*potential,
"wetting potential");
396 if (pressureType_ == pn)
398 writer.attachCellData(*potential,
"nonwetting potential");
401 if (vtkOutputLevel_ > 0)
403 ScalarSolutionType *
pressure = writer.allocateManagedBuffer(size);
404 ScalarSolutionType *pressureSecond = writer.allocateManagedBuffer(size);
405 ScalarSolutionType *potentialSecond = writer.allocateManagedBuffer(size);
406 ScalarSolutionType *pc = writer.allocateManagedBuffer(size);
408 for (
const auto& element : elements(problem_.gridView()))
410 int idx = problem_.variables().index(element);
411 CellData& cellData = problem_.variables().cellData(idx);
413 (*pc)[idx] = cellData.capillaryPressure();
415 if (pressureType_ == pw)
417 (*pressure)[idx] = cellData.pressure(wPhaseIdx);
418 (*potentialSecond)[idx] = cellData.potential(nPhaseIdx);
419 (*pressureSecond)[idx] = cellData.pressure(nPhaseIdx);
422 if (pressureType_ == pn)
424 (*pressure)[idx] = cellData.pressure(nPhaseIdx);
425 (*potentialSecond)[idx] = cellData.potential(wPhaseIdx);
426 (*pressureSecond)[idx] = cellData.pressure(wPhaseIdx);
430 if (pressureType_ == pw)
432 writer.attachCellData(*
pressure,
"wetting pressure");
433 writer.attachCellData(*pressureSecond,
"nonwetting pressure");
434 writer.attachCellData(*potentialSecond,
"nonwetting potential");
437 if (pressureType_ == pn)
439 writer.attachCellData(*
pressure,
"nonwetting pressure");
440 writer.attachCellData(*pressureSecond,
"wetting pressure");
441 writer.attachCellData(*potentialSecond,
"wetting potential");
444 writer.attachCellData(*pc,
"capillary pressure");
471 gravity_(problem.gravity()),
472 maxError_(0.), timeStep_(1.)
474 if (pressureType_ != pw && pressureType_ != pn)
476 DUNE_THROW(Dune::NotImplemented,
"Pressure type not supported!");
478 if (saturationType_ != sw && saturationType_ != sn)
480 DUNE_THROW(Dune::NotImplemented,
"Saturation type not supported!");
482 if (getPropValue<TypeTag, Properties::EnableCompressibility>())
484 DUNE_THROW(Dune::NotImplemented,
"Compressibility not supported!");
488 DUNE_THROW(Dune::NotImplemented,
"Dimension not supported!");
491 ErrorTermFactor_ = getParam<Scalar>(
"Impet.ErrorTermFactor");
492 ErrorTermLowerBound_ = getParam<Scalar>(
"Impet.ErrorTermLowerBound");
493 ErrorTermUpperBound_ = getParam<Scalar>(
"Impet.ErrorTermUpperBound");
495 density_[wPhaseIdx] = 0.;
496 density_[nPhaseIdx] = 0.;
497 viscosity_[wPhaseIdx] = 0.;
498 viscosity_[nPhaseIdx] = 0.;
500 vtkOutputLevel_ = getParam<int>(
"Vtk.OutputLevel");
513 Implementation &asImp_()
514 {
return *
static_cast<Implementation *
>(
this);}
517 const Implementation &asImp_()
const
518 {
return *
static_cast<const Implementation *
>(
this);}
520 const GravityVector& gravity_;
524 Scalar ErrorTermFactor_;
525 Scalar ErrorTermLowerBound_;
526 Scalar ErrorTermUpperBound_;
528 Scalar density_[numPhases];
529 Scalar viscosity_[numPhases];
533 static constexpr Scalar threshold_ = 1e-15;
535 static const int pressureType_ = getPropValue<TypeTag, Properties::PressureFormulation>();
537 static const int saturationType_ = getPropValue<TypeTag, Properties::SaturationFormulation>();
539 static const int velocityType_ = getPropValue<TypeTag, Properties::VelocityFormulation>();
543template<
class TypeTag>
546 initializeMatrixRowSize();
547 this->A_.endrowsizes();
548 initializeMatrixIndices();
549 this->A_.endindices();
553template<
class TypeTag>
557 for (
const auto& element : elements(problem_.gridView()))
560 int eIdxGlobalI = problem_.variables().index(element);
562 std::set<int> neighborIndices;
564 int numVertices = element.geometry().corners();
566 for (
int vIdx = 0; vIdx < numVertices; vIdx++)
568 int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, vIdx, dim);
570 InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
572 for (
int subVolumeIdx = 0; subVolumeIdx < InteractionVolume::subVolumeTotalNum; subVolumeIdx++)
574 if (interactionVolume.hasSubVolumeElement(subVolumeIdx))
576 int eIdxGlobalJ = problem_.variables().index(interactionVolume.getSubVolumeElement(subVolumeIdx));
578 neighborIndices.insert(eIdxGlobalJ);
583 this->A_.setrowsize(eIdxGlobalI, neighborIndices.size());
590template<
class TypeTag>
594 for (
const auto& element : elements(problem_.gridView()))
597 int eIdxGlobalI = problem_.variables().index(element);
600 this->A_.addindex(eIdxGlobalI, eIdxGlobalI);
602 int numVertices = element.geometry().corners();
604 for (
int vIdx = 0; vIdx < numVertices; vIdx++)
606 int vIdxGlobal = problem_.variables().vertexMapper().subIndex(element, vIdx, dim);
608 InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
609 for (
int subVolumeIdx = 0; subVolumeIdx < InteractionVolume::subVolumeTotalNum; subVolumeIdx++)
611 if (interactionVolume.hasSubVolumeElement(subVolumeIdx))
613 int eIdxGlobalJ = problem_.variables().index(interactionVolume.getSubVolumeElement(subVolumeIdx));
615 this->A_.addindex(eIdxGlobalI, eIdxGlobalJ);
624template<
class TypeTag>
632 for (
const auto& vertex : vertices(problem_.gridView()))
634 int vIdxGlobal = problem_.variables().index(vertex);
636 InteractionVolume& interactionVolume = interactionVolumes_.interactionVolume(vIdxGlobal);
639 if (interactionVolume.isInnerVolume())
641 assembleInnerInteractionVolume(interactionVolume);
647 assembleBoundaryInteractionVolume(interactionVolume);
656template<
class TypeTag>
659 auto element1 = interactionVolume.getSubVolumeElement(0);
660 auto element2 = interactionVolume.getSubVolumeElement(1);
661 auto element3 = interactionVolume.getSubVolumeElement(2);
662 auto element4 = interactionVolume.getSubVolumeElement(3);
663 auto element5 = interactionVolume.getSubVolumeElement(4);
664 auto element6 = interactionVolume.getSubVolumeElement(5);
665 auto element7 = interactionVolume.getSubVolumeElement(6);
666 auto element8 = interactionVolume.getSubVolumeElement(7);
669 const GlobalPosition& globalPos1 = element1.geometry().center();
670 const GlobalPosition& globalPos2 = element2.geometry().center();
671 const GlobalPosition& globalPos3 = element3.geometry().center();
672 const GlobalPosition& globalPos4 = element4.geometry().center();
673 const GlobalPosition& globalPos5 = element5.geometry().center();
674 const GlobalPosition& globalPos6 = element6.geometry().center();
675 const GlobalPosition& globalPos7 = element7.geometry().center();
676 const GlobalPosition& globalPos8 = element8.geometry().center();
679 Scalar volume1 = element1.geometry().volume();
680 Scalar volume2 = element2.geometry().volume();
681 Scalar volume3 = element3.geometry().volume();
682 Scalar volume4 = element4.geometry().volume();
683 Scalar volume5 = element5.geometry().volume();
684 Scalar volume6 = element6.geometry().volume();
685 Scalar volume7 = element7.geometry().volume();
686 Scalar volume8 = element8.geometry().volume();
689 int eIdxGlobal1 = problem_.variables().index(element1);
690 int eIdxGlobal2 = problem_.variables().index(element2);
691 int eIdxGlobal3 = problem_.variables().index(element3);
692 int eIdxGlobal4 = problem_.variables().index(element4);
693 int eIdxGlobal5 = problem_.variables().index(element5);
694 int eIdxGlobal6 = problem_.variables().index(element6);
695 int eIdxGlobal7 = problem_.variables().index(element7);
696 int eIdxGlobal8 = problem_.variables().index(element8);
699 CellData& cellData1 = problem_.variables().cellData(eIdxGlobal1);
700 CellData& cellData2 = problem_.variables().cellData(eIdxGlobal2);
701 CellData& cellData3 = problem_.variables().cellData(eIdxGlobal3);
702 CellData& cellData4 = problem_.variables().cellData(eIdxGlobal4);
703 CellData& cellData5 = problem_.variables().cellData(eIdxGlobal5);
704 CellData& cellData6 = problem_.variables().cellData(eIdxGlobal6);
705 CellData& cellData7 = problem_.variables().cellData(eIdxGlobal7);
706 CellData& cellData8 = problem_.variables().cellData(eIdxGlobal8);
709 Dune::FieldVector<Scalar, numPhases> lambda1(cellData1.mobility(wPhaseIdx));
710 lambda1[nPhaseIdx] = cellData1.mobility(nPhaseIdx);
713 Scalar lambdaTotal1 = lambda1[wPhaseIdx] + lambda1[nPhaseIdx];
716 Dune::FieldVector<Scalar, numPhases> lambda2(cellData2.mobility(wPhaseIdx));
717 lambda2[nPhaseIdx] = cellData2.mobility(nPhaseIdx);
720 Scalar lambdaTotal2 = lambda2[wPhaseIdx] + lambda2[nPhaseIdx];
723 Dune::FieldVector<Scalar, numPhases> lambda3(cellData3.mobility(wPhaseIdx));
724 lambda3[nPhaseIdx] = cellData3.mobility(nPhaseIdx);
727 Scalar lambdaTotal3 = lambda3[wPhaseIdx] + lambda3[nPhaseIdx];
730 Dune::FieldVector<Scalar, numPhases> lambda4(cellData4.mobility(wPhaseIdx));
731 lambda4[nPhaseIdx] = cellData4.mobility(nPhaseIdx);
734 Scalar lambdaTotal4 = lambda4[wPhaseIdx] + lambda4[nPhaseIdx];
737 Dune::FieldVector<Scalar, numPhases> lambda5(cellData5.mobility(wPhaseIdx));
738 lambda5[nPhaseIdx] = cellData5.mobility(nPhaseIdx);
741 Scalar lambdaTotal5 = lambda5[wPhaseIdx] + lambda5[nPhaseIdx];
744 Dune::FieldVector<Scalar, numPhases> lambda6(cellData6.mobility(wPhaseIdx));
745 lambda6[nPhaseIdx] = cellData6.mobility(nPhaseIdx);
748 Scalar lambdaTotal6 = lambda6[wPhaseIdx] + lambda6[nPhaseIdx];
751 Dune::FieldVector<Scalar, numPhases> lambda7(cellData7.mobility(wPhaseIdx));
752 lambda7[nPhaseIdx] = cellData7.mobility(nPhaseIdx);
755 Scalar lambdaTotal7 = lambda7[wPhaseIdx] + lambda7[nPhaseIdx];
758 Dune::FieldVector<Scalar, numPhases> lambda8(cellData8.mobility(wPhaseIdx));
759 lambda8[nPhaseIdx] = cellData8.mobility(nPhaseIdx);
762 Scalar lambdaTotal8 = lambda8[wPhaseIdx] + lambda8[nPhaseIdx];
764 std::vector<DimVector> lambda(8);
765 lambda[0][0] = lambdaTotal1;
766 lambda[0][1] = lambdaTotal1;
767 lambda[0][2] = lambdaTotal1;
768 lambda[1][0] = lambdaTotal2;
769 lambda[1][1] = lambdaTotal2;
770 lambda[1][2] = lambdaTotal2;
771 lambda[2][0] = lambdaTotal3;
772 lambda[2][1] = lambdaTotal3;
773 lambda[2][2] = lambdaTotal3;
774 lambda[3][0] = lambdaTotal4;
775 lambda[3][1] = lambdaTotal4;
776 lambda[3][2] = lambdaTotal4;
777 lambda[4][0] = lambdaTotal5;
778 lambda[4][1] = lambdaTotal5;
779 lambda[4][2] = lambdaTotal5;
780 lambda[5][0] = lambdaTotal6;
781 lambda[5][1] = lambdaTotal6;
782 lambda[5][2] = lambdaTotal6;
783 lambda[6][0] = lambdaTotal7;
784 lambda[6][1] = lambdaTotal7;
785 lambda[6][2] = lambdaTotal7;
786 lambda[7][0] = lambdaTotal8;
787 lambda[7][1] = lambdaTotal8;
788 lambda[7][2] = lambdaTotal8;
792 Dune::FieldVector<Scalar, 8> pc(0);
793 pc[0] = cellData1.capillaryPressure();
794 pc[1] = cellData2.capillaryPressure();
795 pc[2] = cellData3.capillaryPressure();
796 pc[3] = cellData4.capillaryPressure();
797 pc[4] = cellData5.capillaryPressure();
798 pc[5] = cellData6.capillaryPressure();
799 pc[6] = cellData7.capillaryPressure();
800 pc[7] = cellData8.capillaryPressure();
802 Dune::FieldVector<Scalar, 8> gravityDiff(0);
804 gravityDiff[0] = (problem_.bBoxMax() - globalPos1) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
805 gravityDiff[1] = (problem_.bBoxMax() - globalPos2) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
806 gravityDiff[2] = (problem_.bBoxMax() - globalPos3) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
807 gravityDiff[3] = (problem_.bBoxMax() - globalPos4) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
808 gravityDiff[4] = (problem_.bBoxMax() - globalPos5) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
809 gravityDiff[5] = (problem_.bBoxMax() - globalPos6) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
810 gravityDiff[6] = (problem_.bBoxMax() - globalPos7) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
811 gravityDiff[7] = (problem_.bBoxMax() - globalPos8) * gravity_ * (density_[nPhaseIdx] - density_[wPhaseIdx]);
815 Dune::FieldVector<Dune::FieldVector<Scalar, 3>, 8> pcFlux(Dune::FieldVector<Scalar, 3>(0));
817 Scalar pcPotential0 = 0;
818 Scalar pcPotential1 = 0;
819 Scalar pcPotential2 = 0;
820 Scalar pcPotential3 = 0;
821 Scalar pcPotential4 = 0;
822 Scalar pcPotential5 = 0;
823 Scalar pcPotential6 = 0;
824 Scalar pcPotential7 = 0;
825 Scalar pcPotential8 = 0;
826 Scalar pcPotential9 = 0;
827 Scalar pcPotential10 = 0;
828 Scalar pcPotential11 = 0;
832 PrimaryVariables source(0.0);
833 problem_.source(source, element1);
834 this->f_[eIdxGlobal1] += volume1 / (8.0)
835 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
836 problem_.source(source, element2);
837 this->f_[eIdxGlobal2] += volume2 / (8.0)
838 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
839 problem_.source(source, element3);
840 this->f_[eIdxGlobal3] += volume3 / (8.0)
841 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
842 problem_.source(source, element4);
843 this->f_[eIdxGlobal4] += volume4 / (8.0)
844 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
845 problem_.source(source, element5);
846 this->f_[eIdxGlobal5] += volume5 / (8.0)
847 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
848 problem_.source(source, element6);
849 this->f_[eIdxGlobal6] += volume6 / (8.0)
850 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
851 problem_.source(source, element7);
852 this->f_[eIdxGlobal7] += volume7 / (8.0)
853 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
854 problem_.source(source, element8);
855 this->f_[eIdxGlobal8] += volume8 / (8.0)
856 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
858 this->f_[eIdxGlobal1] += evaluateErrorTerm(cellData1) * volume1 / (8.0);
859 this->f_[eIdxGlobal2] += evaluateErrorTerm(cellData2) * volume2 / (8.0);
860 this->f_[eIdxGlobal3] += evaluateErrorTerm(cellData3) * volume3 / (8.0);
861 this->f_[eIdxGlobal4] += evaluateErrorTerm(cellData4) * volume4 / (8.0);
862 this->f_[eIdxGlobal5] += evaluateErrorTerm(cellData5) * volume5 / (8.0);
863 this->f_[eIdxGlobal6] += evaluateErrorTerm(cellData6) * volume6 / (8.0);
864 this->f_[eIdxGlobal7] += evaluateErrorTerm(cellData7) * volume7 / (8.0);
865 this->f_[eIdxGlobal8] += evaluateErrorTerm(cellData8) * volume8 / (8.0);
868 Dune::FieldVector<Scalar, 2 * dim - dim + 1> u(0);
873 int caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 0, 1, 2, 3, 4,
877 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal1, 0, 0);
878 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal2, 1, 1);
882 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
883 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
884 this->A_[eIdxGlobal1][eIdxGlobal3] += T[0][2];
885 this->A_[eIdxGlobal1][eIdxGlobal5] += T[0][3];
887 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
888 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
889 this->A_[eIdxGlobal2][eIdxGlobal3] -= TSecond[0][2];
890 this->A_[eIdxGlobal2][eIdxGlobal5] -= TSecond[0][3];
899 pcFlux[0][0] = Tu[0];
900 pcPotential0 = Tu[0];
907 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
908 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
909 this->A_[eIdxGlobal1][eIdxGlobal4] += T[0][2];
910 this->A_[eIdxGlobal1][eIdxGlobal6] += T[0][3];
912 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
913 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
914 this->A_[eIdxGlobal2][eIdxGlobal4] -= TSecond[0][2];
915 this->A_[eIdxGlobal2][eIdxGlobal6] -= TSecond[0][3];
923 pcFlux[0][0] = Tu[0];
924 pcPotential0 = Tu[0];
931 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
932 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
933 this->A_[eIdxGlobal1][eIdxGlobal4] += T[0][2];
934 this->A_[eIdxGlobal1][eIdxGlobal5] += T[0][3];
936 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
937 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
938 this->A_[eIdxGlobal2][eIdxGlobal4] -= TSecond[0][2];
939 this->A_[eIdxGlobal2][eIdxGlobal5] -= TSecond[0][3];
947 pcFlux[0][0] = Tu[0];
948 pcPotential0 = Tu[0];
955 this->A_[eIdxGlobal1][eIdxGlobal1] += T[0][0];
956 this->A_[eIdxGlobal1][eIdxGlobal2] += T[0][1];
957 this->A_[eIdxGlobal1][eIdxGlobal3] += T[0][2];
958 this->A_[eIdxGlobal1][eIdxGlobal6] += T[0][3];
960 this->A_[eIdxGlobal2][eIdxGlobal1] -= TSecond[0][0];
961 this->A_[eIdxGlobal2][eIdxGlobal2] -= TSecond[0][1];
962 this->A_[eIdxGlobal2][eIdxGlobal3] -= TSecond[0][2];
963 this->A_[eIdxGlobal2][eIdxGlobal6] -= TSecond[0][3];
971 pcFlux[0][0] = Tu[0];
972 pcPotential0 = Tu[0];
979 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 1, 3, 0, 2, 5, 7);
982 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal2, 1, 0);
983 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal4, 3, 1);
987 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
988 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
989 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][2];
990 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][3];
992 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
993 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
994 this->A_[eIdxGlobal4][eIdxGlobal1] -= TSecond[0][2];
995 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][3];
1003 pcFlux[1][0] = Tu[0];
1004 pcPotential1 = Tu[0];
1007 pcFlux[3][1] = Tu[0];
1009 else if (caseL == 2)
1011 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1012 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
1013 this->A_[eIdxGlobal2][eIdxGlobal3] += T[0][2];
1014 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][3];
1016 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
1017 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1018 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][2];
1019 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][3];
1027 pcFlux[1][0] = Tu[0];
1028 pcPotential1 = Tu[0];
1031 pcFlux[3][1] = Tu[0];
1033 else if (caseL == 3)
1035 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1036 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
1037 this->A_[eIdxGlobal2][eIdxGlobal3] += T[0][2];
1038 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][3];
1040 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
1041 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1042 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][2];
1043 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][3];
1051 pcFlux[1][0] = Tu[0];
1052 pcPotential1 = Tu[0];
1055 pcFlux[3][1] = Tu[0];
1059 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1060 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][1];
1061 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][2];
1062 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][3];
1064 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][0];
1065 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1066 this->A_[eIdxGlobal4][eIdxGlobal1] -= TSecond[0][2];
1067 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][3];
1075 pcFlux[1][0] = Tu[0];
1076 pcPotential1 = Tu[0];
1079 pcFlux[3][1] = Tu[0];
1083 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 3, 2, 1, 0, 7, 6);
1086 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal4, 3, 0);
1087 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal3, 2, 1);
1091 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1092 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1093 this->A_[eIdxGlobal4][eIdxGlobal2] += T[0][2];
1094 this->A_[eIdxGlobal4][eIdxGlobal8] += T[0][3];
1096 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1097 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1098 this->A_[eIdxGlobal3][eIdxGlobal2] -= TSecond[0][2];
1099 this->A_[eIdxGlobal3][eIdxGlobal8] -= TSecond[0][3];
1107 pcPotential2 = Tu[0];
1108 pcFlux[3][0] = Tu[0];
1111 pcFlux[2][1] = Tu[0];
1113 else if (caseL == 2)
1115 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1116 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1117 this->A_[eIdxGlobal4][eIdxGlobal1] += T[0][2];
1118 this->A_[eIdxGlobal4][eIdxGlobal7] += T[0][3];
1120 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1121 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1122 this->A_[eIdxGlobal3][eIdxGlobal1] -= TSecond[0][2];
1123 this->A_[eIdxGlobal3][eIdxGlobal7] -= TSecond[0][3];
1131 pcPotential2 = Tu[0];
1132 pcFlux[3][0] = Tu[0];
1135 pcFlux[2][1] = Tu[0];
1137 else if (caseL == 3)
1139 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1140 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1141 this->A_[eIdxGlobal4][eIdxGlobal1] += T[0][2];
1142 this->A_[eIdxGlobal4][eIdxGlobal8] += T[0][3];
1144 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1145 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1146 this->A_[eIdxGlobal3][eIdxGlobal1] -= TSecond[0][2];
1147 this->A_[eIdxGlobal3][eIdxGlobal8] -= TSecond[0][3];
1155 pcPotential2 = Tu[0];
1156 pcFlux[3][0] = Tu[0];
1159 pcFlux[2][1] = Tu[0];
1163 this->A_[eIdxGlobal4][eIdxGlobal4] += T[0][0];
1164 this->A_[eIdxGlobal4][eIdxGlobal3] += T[0][1];
1165 this->A_[eIdxGlobal4][eIdxGlobal2] += T[0][2];
1166 this->A_[eIdxGlobal4][eIdxGlobal7] += T[0][3];
1168 this->A_[eIdxGlobal3][eIdxGlobal4] -= TSecond[0][0];
1169 this->A_[eIdxGlobal3][eIdxGlobal3] -= TSecond[0][1];
1170 this->A_[eIdxGlobal3][eIdxGlobal2] -= TSecond[0][2];
1171 this->A_[eIdxGlobal3][eIdxGlobal7] -= TSecond[0][3];
1179 pcPotential2 = Tu[0];
1180 pcFlux[3][0] = Tu[0];
1183 pcFlux[2][1] = Tu[0];
1187 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 2, 0, 3, 1, 6, 4);
1190 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal3, 2, 0);
1191 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal1, 0, 1);
1195 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1196 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1197 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][2];
1198 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][3];
1200 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1201 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1202 this->A_[eIdxGlobal1][eIdxGlobal4] -= TSecond[0][2];
1203 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][3];
1211 pcFlux[2][0] = Tu[0];
1212 pcPotential3 = Tu[0];
1215 pcFlux[0][1] = Tu[0];
1217 else if (caseL == 2)
1219 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1220 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1221 this->A_[eIdxGlobal3][eIdxGlobal2] += T[0][2];
1222 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][3];
1224 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1225 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1226 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][2];
1227 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][3];
1235 pcFlux[2][0] = Tu[0];
1236 pcPotential3 = Tu[0];
1239 pcFlux[0][1] = Tu[0];
1241 else if (caseL == 3)
1243 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1244 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1245 this->A_[eIdxGlobal3][eIdxGlobal2] += T[0][2];
1246 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][3];
1248 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1249 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1250 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][2];
1251 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][3];
1259 pcFlux[2][0] = Tu[0];
1260 pcPotential3 = Tu[0];
1263 pcFlux[0][1] = Tu[0];
1267 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
1268 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][1];
1269 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][2];
1270 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][3];
1272 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][0];
1273 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1274 this->A_[eIdxGlobal1][eIdxGlobal4] -= TSecond[0][2];
1275 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][3];
1283 pcFlux[2][0] = Tu[0];
1284 pcPotential3 = Tu[0];
1287 pcFlux[0][1] = Tu[0];
1291 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 5, 4, 7, 6, 1, 0);
1294 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal6, 5, 2);
1295 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal5, 4, 1);
1299 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1300 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1301 this->A_[eIdxGlobal6][eIdxGlobal8] += T[0][2];
1302 this->A_[eIdxGlobal6][eIdxGlobal2] += T[0][3];
1304 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1305 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1306 this->A_[eIdxGlobal5][eIdxGlobal8] -= TSecond[0][2];
1307 this->A_[eIdxGlobal5][eIdxGlobal2] -= TSecond[0][3];
1315 pcFlux[5][2] = Tu[0];
1316 pcPotential4 = Tu[0];
1319 pcFlux[4][1] = Tu[0];
1321 else if (caseL == 2)
1323 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1324 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1325 this->A_[eIdxGlobal6][eIdxGlobal7] += T[0][2];
1326 this->A_[eIdxGlobal6][eIdxGlobal1] += T[0][3];
1328 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1329 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1330 this->A_[eIdxGlobal5][eIdxGlobal7] -= TSecond[0][2];
1331 this->A_[eIdxGlobal5][eIdxGlobal1] -= TSecond[0][3];
1339 pcFlux[5][2] = Tu[0];
1340 pcPotential4 = Tu[0];
1343 pcFlux[4][1] = Tu[0];
1345 else if (caseL == 3)
1347 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1348 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1349 this->A_[eIdxGlobal6][eIdxGlobal7] += T[0][2];
1350 this->A_[eIdxGlobal6][eIdxGlobal2] += T[0][3];
1352 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1353 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1354 this->A_[eIdxGlobal5][eIdxGlobal7] -= TSecond[0][2];
1355 this->A_[eIdxGlobal5][eIdxGlobal2] -= TSecond[0][3];
1363 pcFlux[5][2] = Tu[0];
1364 pcPotential4 = Tu[0];
1367 pcFlux[4][1] = Tu[0];
1371 this->A_[eIdxGlobal6][eIdxGlobal6] += T[0][0];
1372 this->A_[eIdxGlobal6][eIdxGlobal5] += T[0][1];
1373 this->A_[eIdxGlobal6][eIdxGlobal8] += T[0][2];
1374 this->A_[eIdxGlobal6][eIdxGlobal1] += T[0][3];
1376 this->A_[eIdxGlobal5][eIdxGlobal6] -= TSecond[0][0];
1377 this->A_[eIdxGlobal5][eIdxGlobal5] -= TSecond[0][1];
1378 this->A_[eIdxGlobal5][eIdxGlobal8] -= TSecond[0][2];
1379 this->A_[eIdxGlobal5][eIdxGlobal1] -= TSecond[0][3];
1387 pcFlux[5][2] = Tu[0];
1388 pcPotential4 = Tu[0];
1391 pcFlux[4][1] = Tu[0];
1395 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 7, 5, 6, 4, 3, 1);
1398 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal8, 7, 2);
1399 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal6, 5, 1);
1404 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1405 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1406 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][2];
1407 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][3];
1409 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1410 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1411 this->A_[eIdxGlobal6][eIdxGlobal7] -= TSecond[0][2];
1412 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][3];
1420 pcFlux[7][2] = Tu[0];
1421 pcPotential5 = Tu[0];
1424 pcFlux[5][1] = Tu[0];
1426 else if (caseL == 2)
1428 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1429 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1430 this->A_[eIdxGlobal8][eIdxGlobal5] += T[0][2];
1431 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][3];
1433 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1434 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1435 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][2];
1436 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][3];
1444 pcFlux[7][2] = Tu[0];
1445 pcPotential5 = Tu[0];
1448 pcFlux[5][1] = Tu[0];
1450 else if (caseL == 3)
1452 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1453 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1454 this->A_[eIdxGlobal8][eIdxGlobal5] += T[0][2];
1455 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][3];
1457 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1458 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1459 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][2];
1460 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][3];
1468 pcFlux[7][2] = Tu[0];
1469 pcPotential5 = Tu[0];
1472 pcFlux[5][1] = Tu[0];
1476 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1477 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][1];
1478 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][2];
1479 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][3];
1481 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][0];
1482 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1483 this->A_[eIdxGlobal6][eIdxGlobal7] -= TSecond[0][2];
1484 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][3];
1492 pcFlux[7][2] = Tu[0];
1493 pcPotential5 = Tu[0];
1496 pcFlux[5][1] = Tu[0];
1500 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 6, 7, 4, 5, 2, 3);
1503 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal7, 6, 2);
1504 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal8, 7, 1);
1508 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1509 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1510 this->A_[eIdxGlobal7][eIdxGlobal5] += T[0][2];
1511 this->A_[eIdxGlobal7][eIdxGlobal3] += T[0][3];
1513 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1514 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1515 this->A_[eIdxGlobal8][eIdxGlobal5] -= TSecond[0][2];
1516 this->A_[eIdxGlobal8][eIdxGlobal3] -= TSecond[0][3];
1524 pcFlux[6][2] = Tu[0];
1525 pcPotential6 = Tu[0];
1528 pcFlux[7][1] = Tu[0];
1530 else if (caseL == 2)
1532 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1533 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1534 this->A_[eIdxGlobal7][eIdxGlobal6] += T[0][2];
1535 this->A_[eIdxGlobal7][eIdxGlobal4] += T[0][3];
1537 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1538 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1539 this->A_[eIdxGlobal8][eIdxGlobal6] -= TSecond[0][2];
1540 this->A_[eIdxGlobal8][eIdxGlobal4] -= TSecond[0][3];
1548 pcFlux[6][2] = Tu[0];
1549 pcPotential6 = Tu[0];
1552 pcFlux[7][1] = Tu[0];
1554 else if (caseL == 3)
1556 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1557 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1558 this->A_[eIdxGlobal7][eIdxGlobal6] += T[0][2];
1559 this->A_[eIdxGlobal7][eIdxGlobal3] += T[0][3];
1561 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1562 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1563 this->A_[eIdxGlobal8][eIdxGlobal6] -= TSecond[0][2];
1564 this->A_[eIdxGlobal8][eIdxGlobal3] -= TSecond[0][3];
1572 pcFlux[6][2] = Tu[0];
1573 pcPotential6 = Tu[0];
1576 pcFlux[7][1] = Tu[0];
1580 this->A_[eIdxGlobal7][eIdxGlobal7] += T[0][0];
1581 this->A_[eIdxGlobal7][eIdxGlobal8] += T[0][1];
1582 this->A_[eIdxGlobal7][eIdxGlobal5] += T[0][2];
1583 this->A_[eIdxGlobal7][eIdxGlobal4] += T[0][3];
1585 this->A_[eIdxGlobal8][eIdxGlobal7] -= TSecond[0][0];
1586 this->A_[eIdxGlobal8][eIdxGlobal8] -= TSecond[0][1];
1587 this->A_[eIdxGlobal8][eIdxGlobal5] -= TSecond[0][2];
1588 this->A_[eIdxGlobal8][eIdxGlobal4] -= TSecond[0][3];
1596 pcFlux[6][2] = Tu[0];
1597 pcPotential6 = Tu[0];
1600 pcFlux[7][1] = Tu[0];
1604 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 4, 6, 5, 7, 0, 2);
1607 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal5, 4, 2);
1608 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal7, 6, 1);
1612 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1613 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1614 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][2];
1615 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][3];
1617 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1618 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1619 this->A_[eIdxGlobal7][eIdxGlobal6] -= TSecond[0][2];
1620 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][3];
1628 pcFlux[4][2] = Tu[0];
1629 pcPotential7 = Tu[0];
1632 pcFlux[6][1] = Tu[0];
1634 else if (caseL == 2)
1636 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1637 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1638 this->A_[eIdxGlobal5][eIdxGlobal8] += T[0][2];
1639 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][3];
1641 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1642 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1643 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][2];
1644 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][3];
1652 pcFlux[4][2] = Tu[0];
1653 pcPotential7 = Tu[0];
1656 pcFlux[6][1] = Tu[0];
1658 else if (caseL == 3)
1660 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1661 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1662 this->A_[eIdxGlobal5][eIdxGlobal8] += T[0][2];
1663 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][3];
1665 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1666 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1667 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][2];
1668 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][3];
1676 pcFlux[4][2] = Tu[0];
1677 pcPotential7 = Tu[0];
1680 pcFlux[6][1] = Tu[0];
1684 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1685 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][1];
1686 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][2];
1687 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][3];
1689 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][0];
1690 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
1691 this->A_[eIdxGlobal7][eIdxGlobal6] -= TSecond[0][2];
1692 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][3];
1700 pcFlux[4][2] = Tu[0];
1701 pcPotential7 = Tu[0];
1704 pcFlux[6][1] = Tu[0];
1708 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 4, 0, 6, 2, 5, 1);
1711 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal5, 4, 0);
1712 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal1, 0, 2);
1716 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1717 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1718 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][2];
1719 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][3];
1721 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1722 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1723 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][2];
1724 this->A_[eIdxGlobal1][eIdxGlobal6] -= TSecond[0][3];
1732 pcFlux[4][0] = Tu[0];
1733 pcPotential8 = Tu[0];
1736 pcFlux[0][2] = Tu[0];
1738 else if (caseL == 2)
1740 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1741 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1742 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][2];
1743 this->A_[eIdxGlobal5][eIdxGlobal2] += T[0][3];
1745 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1746 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1747 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][2];
1748 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][3];
1756 pcFlux[4][0] = Tu[0];
1757 pcPotential8 = Tu[0];
1760 pcFlux[0][2] = Tu[0];
1762 else if (caseL == 3)
1764 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1765 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1766 this->A_[eIdxGlobal5][eIdxGlobal3] += T[0][2];
1767 this->A_[eIdxGlobal5][eIdxGlobal6] += T[0][3];
1769 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1770 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1771 this->A_[eIdxGlobal1][eIdxGlobal3] -= TSecond[0][2];
1772 this->A_[eIdxGlobal1][eIdxGlobal6] -= TSecond[0][3];
1780 pcFlux[4][0] = Tu[0];
1781 pcPotential8 = Tu[0];
1784 pcFlux[0][2] = Tu[0];
1788 this->A_[eIdxGlobal5][eIdxGlobal5] += T[0][0];
1789 this->A_[eIdxGlobal5][eIdxGlobal1] += T[0][1];
1790 this->A_[eIdxGlobal5][eIdxGlobal7] += T[0][2];
1791 this->A_[eIdxGlobal5][eIdxGlobal2] += T[0][3];
1793 this->A_[eIdxGlobal1][eIdxGlobal5] -= TSecond[0][0];
1794 this->A_[eIdxGlobal1][eIdxGlobal1] -= TSecond[0][1];
1795 this->A_[eIdxGlobal1][eIdxGlobal7] -= TSecond[0][2];
1796 this->A_[eIdxGlobal1][eIdxGlobal2] -= TSecond[0][3];
1804 pcFlux[4][0] = Tu[0];
1805 pcPotential8 = Tu[0];
1808 pcFlux[0][2] = Tu[0];
1812 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 1, 5, 3, 7, 0, 4);
1815 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal2, 1, 2);
1816 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal6, 5, 0);
1820 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1821 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1822 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][2];
1823 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][3];
1825 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1826 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1827 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][2];
1828 this->A_[eIdxGlobal6][eIdxGlobal1] -= TSecond[0][3];
1836 pcFlux[1][2] = Tu[0];
1837 pcPotential9 = Tu[0];
1840 pcFlux[5][0] = Tu[0];
1842 else if (caseL == 2)
1844 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1845 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1846 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][2];
1847 this->A_[eIdxGlobal2][eIdxGlobal5] += T[0][3];
1849 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1850 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1851 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][2];
1852 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][3];
1860 pcFlux[1][2] = Tu[0];
1861 pcPotential9 = Tu[0];
1864 pcFlux[5][0] = Tu[0];
1866 else if (caseL == 3)
1868 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1869 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1870 this->A_[eIdxGlobal2][eIdxGlobal8] += T[0][2];
1871 this->A_[eIdxGlobal2][eIdxGlobal1] += T[0][3];
1873 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1874 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1875 this->A_[eIdxGlobal6][eIdxGlobal8] -= TSecond[0][2];
1876 this->A_[eIdxGlobal6][eIdxGlobal1] -= TSecond[0][3];
1884 pcFlux[1][2] = Tu[0];
1885 pcPotential9 = Tu[0];
1888 pcFlux[5][0] = Tu[0];
1892 this->A_[eIdxGlobal2][eIdxGlobal2] += T[0][0];
1893 this->A_[eIdxGlobal2][eIdxGlobal6] += T[0][1];
1894 this->A_[eIdxGlobal2][eIdxGlobal4] += T[0][2];
1895 this->A_[eIdxGlobal2][eIdxGlobal5] += T[0][3];
1897 this->A_[eIdxGlobal6][eIdxGlobal2] -= TSecond[0][0];
1898 this->A_[eIdxGlobal6][eIdxGlobal6] -= TSecond[0][1];
1899 this->A_[eIdxGlobal6][eIdxGlobal4] -= TSecond[0][2];
1900 this->A_[eIdxGlobal6][eIdxGlobal5] -= TSecond[0][3];
1908 pcFlux[1][2] = Tu[0];
1909 pcPotential9 = Tu[0];
1912 pcFlux[5][0] = Tu[0];
1916 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 7, 3, 5, 1, 6, 2);
1919 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal8, 7, 0);
1920 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal4, 3, 2);
1924 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1925 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1926 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][2];
1927 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][3];
1929 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
1930 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1931 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][2];
1932 this->A_[eIdxGlobal4][eIdxGlobal7] -= TSecond[0][3];
1940 pcFlux[7][0] = Tu[0];
1941 pcPotential10 = Tu[0];
1944 pcFlux[3][2] = Tu[0];
1946 else if (caseL == 2)
1948 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1949 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1950 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][2];
1951 this->A_[eIdxGlobal8][eIdxGlobal3] += T[0][3];
1953 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
1954 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1955 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][2];
1956 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][3];
1964 pcFlux[7][0] = Tu[0];
1965 pcPotential10 = Tu[0];
1968 pcFlux[3][2] = Tu[0];
1970 else if (caseL == 3)
1972 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1973 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1974 this->A_[eIdxGlobal8][eIdxGlobal2] += T[0][2];
1975 this->A_[eIdxGlobal8][eIdxGlobal7] += T[0][3];
1977 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
1978 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
1979 this->A_[eIdxGlobal4][eIdxGlobal2] -= TSecond[0][2];
1980 this->A_[eIdxGlobal4][eIdxGlobal7] -= TSecond[0][3];
1988 pcFlux[7][0] = Tu[0];
1989 pcPotential10 = Tu[0];
1992 pcFlux[3][2] = Tu[0];
1996 this->A_[eIdxGlobal8][eIdxGlobal8] += T[0][0];
1997 this->A_[eIdxGlobal8][eIdxGlobal4] += T[0][1];
1998 this->A_[eIdxGlobal8][eIdxGlobal6] += T[0][2];
1999 this->A_[eIdxGlobal8][eIdxGlobal3] += T[0][3];
2001 this->A_[eIdxGlobal4][eIdxGlobal8] -= TSecond[0][0];
2002 this->A_[eIdxGlobal4][eIdxGlobal4] -= TSecond[0][1];
2003 this->A_[eIdxGlobal4][eIdxGlobal6] -= TSecond[0][2];
2004 this->A_[eIdxGlobal4][eIdxGlobal3] -= TSecond[0][3];
2012 pcFlux[7][0] = Tu[0];
2013 pcPotential10 = Tu[0];
2016 pcFlux[3][2] = Tu[0];
2020 caseL = transmissibilityCalculator_.transmissibility(T, interactionVolume, lambda, 2, 6, 0, 4, 3, 7);
2023 T *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal3, 2, 2);
2024 TSecond *= interactionVolumes_.faceAreaFactor(interactionVolume, eIdxGlobal7, 6, 0);
2028 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2029 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2030 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][2];
2031 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][3];
2033 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2034 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2035 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][2];
2036 this->A_[eIdxGlobal7][eIdxGlobal4] -= TSecond[0][3];
2044 pcFlux[2][2] = Tu[0];
2045 pcPotential11 = Tu[0];
2048 pcFlux[6][0] = Tu[0];
2050 else if (caseL == 2)
2052 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2053 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2054 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][2];
2055 this->A_[eIdxGlobal3][eIdxGlobal8] += T[0][3];
2057 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2058 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2059 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][2];
2060 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][3];
2068 pcFlux[2][2] = Tu[0];
2069 pcPotential11 = Tu[0];
2072 pcFlux[6][0] = Tu[0];
2074 else if (caseL == 3)
2076 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2077 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2078 this->A_[eIdxGlobal3][eIdxGlobal5] += T[0][2];
2079 this->A_[eIdxGlobal3][eIdxGlobal4] += T[0][3];
2081 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2082 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2083 this->A_[eIdxGlobal7][eIdxGlobal5] -= TSecond[0][2];
2084 this->A_[eIdxGlobal7][eIdxGlobal4] -= TSecond[0][3];
2092 pcFlux[2][2] = Tu[0];
2093 pcPotential11 = Tu[0];
2096 pcFlux[6][0] = Tu[0];
2100 this->A_[eIdxGlobal3][eIdxGlobal3] += T[0][0];
2101 this->A_[eIdxGlobal3][eIdxGlobal7] += T[0][1];
2102 this->A_[eIdxGlobal3][eIdxGlobal1] += T[0][2];
2103 this->A_[eIdxGlobal3][eIdxGlobal8] += T[0][3];
2105 this->A_[eIdxGlobal7][eIdxGlobal3] -= TSecond[0][0];
2106 this->A_[eIdxGlobal7][eIdxGlobal7] -= TSecond[0][1];
2107 this->A_[eIdxGlobal7][eIdxGlobal1] -= TSecond[0][2];
2108 this->A_[eIdxGlobal7][eIdxGlobal8] -= TSecond[0][3];
2116 pcFlux[2][2] = Tu[0];
2117 pcPotential11 = Tu[0];
2120 pcFlux[6][0] = Tu[0];
2123 if (pc[0] == 0 && pc[1] == 0 && pc[2] == 0 && pc[3] == 0 && pc[4] == 0 && pc[5] == 0 && pc[6] == 0
2130 Dune::FieldVector<Scalar, numPhases> lambda0Upw(0.0);
2131 lambda0Upw[wPhaseIdx] = (pcPotential0 >= 0) ? lambda1[wPhaseIdx] : lambda2[wPhaseIdx];
2132 lambda0Upw[nPhaseIdx] = (pcPotential0 >= 0) ? lambda1[nPhaseIdx] : lambda2[nPhaseIdx];
2135 Dune::FieldVector<Scalar, numPhases> lambda1Upw(0.0);
2136 lambda1Upw[wPhaseIdx] = (pcPotential1 >= 0) ? lambda2[wPhaseIdx] : lambda4[wPhaseIdx];
2137 lambda1Upw[nPhaseIdx] = (pcPotential1 >= 0) ? lambda2[nPhaseIdx] : lambda4[nPhaseIdx];
2140 Dune::FieldVector<Scalar, numPhases> lambda2Upw(0.0);
2141 lambda2Upw[wPhaseIdx] = (pcPotential2 >= 0) ? lambda4[wPhaseIdx] : lambda3[wPhaseIdx];
2142 lambda2Upw[nPhaseIdx] = (pcPotential2 >= 0) ? lambda4[nPhaseIdx] : lambda3[nPhaseIdx];
2145 Dune::FieldVector<Scalar, numPhases> lambda3Upw(0.0);
2146 lambda3Upw[wPhaseIdx] = (pcPotential3 >= 0) ? lambda3[wPhaseIdx] : lambda1[wPhaseIdx];
2147 lambda3Upw[nPhaseIdx] = (pcPotential3 >= 0) ? lambda3[nPhaseIdx] : lambda1[nPhaseIdx];
2150 Dune::FieldVector<Scalar, numPhases> lambda4Upw(0.0);
2151 lambda4Upw[wPhaseIdx] = (pcPotential4 >= 0) ? lambda6[wPhaseIdx] : lambda5[wPhaseIdx];
2152 lambda4Upw[nPhaseIdx] = (pcPotential4 >= 0) ? lambda6[nPhaseIdx] : lambda5[nPhaseIdx];
2155 Dune::FieldVector<Scalar, numPhases> lambda5Upw(0.0);
2156 lambda5Upw[wPhaseIdx] = (pcPotential5 >= 0) ? lambda8[wPhaseIdx] : lambda6[wPhaseIdx];
2157 lambda5Upw[nPhaseIdx] = (pcPotential5 >= 0) ? lambda8[nPhaseIdx] : lambda6[nPhaseIdx];
2160 Dune::FieldVector<Scalar, numPhases> lambda6Upw(0.0);
2161 lambda6Upw[wPhaseIdx] = (pcPotential6 >= 0) ? lambda7[wPhaseIdx] : lambda8[wPhaseIdx];
2162 lambda6Upw[nPhaseIdx] = (pcPotential6 >= 0) ? lambda7[nPhaseIdx] : lambda8[nPhaseIdx];
2165 Dune::FieldVector<Scalar, numPhases> lambda7Upw(0.0);
2166 lambda7Upw[wPhaseIdx] = (pcPotential7 >= 0) ? lambda5[wPhaseIdx] : lambda7[wPhaseIdx];
2167 lambda7Upw[nPhaseIdx] = (pcPotential7 >= 0) ? lambda5[nPhaseIdx] : lambda7[nPhaseIdx];
2170 Dune::FieldVector<Scalar, numPhases> lambda8Upw(0.0);
2171 lambda8Upw[wPhaseIdx] = (pcPotential8 >= 0) ? lambda5[wPhaseIdx] : lambda1[wPhaseIdx];
2172 lambda8Upw[nPhaseIdx] = (pcPotential8 >= 0) ? lambda5[nPhaseIdx] : lambda1[nPhaseIdx];
2175 Dune::FieldVector<Scalar, numPhases> lambda9Upw(0.0);
2176 lambda9Upw[wPhaseIdx] = (pcPotential9 >= 0) ? lambda2[wPhaseIdx] : lambda6[wPhaseIdx];
2177 lambda9Upw[nPhaseIdx] = (pcPotential9 >= 0) ? lambda2[nPhaseIdx] : lambda6[nPhaseIdx];
2180 Dune::FieldVector<Scalar, numPhases> lambda10Upw(0.0);
2181 lambda10Upw[wPhaseIdx] = (pcPotential10 >= 0) ? lambda8[wPhaseIdx] : lambda4[wPhaseIdx];
2182 lambda10Upw[nPhaseIdx] = (pcPotential10 >= 0) ? lambda8[nPhaseIdx] : lambda4[nPhaseIdx];
2185 Dune::FieldVector<Scalar, numPhases> lambda11Upw(0.0);
2186 lambda11Upw[wPhaseIdx] = (pcPotential11 >= 0) ? lambda3[wPhaseIdx] : lambda7[wPhaseIdx];
2187 lambda11Upw[nPhaseIdx] = (pcPotential11 >= 0) ? lambda3[nPhaseIdx] : lambda7[nPhaseIdx];
2189 for (
int i = 0; i < numPhases; i++)
2191 Scalar lambdaT0 = lambda0Upw[wPhaseIdx] + lambda0Upw[nPhaseIdx];
2192 Scalar lambdaT1 = lambda1Upw[wPhaseIdx] + lambda1Upw[nPhaseIdx];
2193 Scalar lambdaT2 = lambda2Upw[wPhaseIdx] + lambda2Upw[nPhaseIdx];
2194 Scalar lambdaT3 = lambda3Upw[wPhaseIdx] + lambda3Upw[nPhaseIdx];
2195 Scalar lambdaT4 = lambda4Upw[wPhaseIdx] + lambda4Upw[nPhaseIdx];
2196 Scalar lambdaT5 = lambda5Upw[wPhaseIdx] + lambda5Upw[nPhaseIdx];
2197 Scalar lambdaT6 = lambda6Upw[wPhaseIdx] + lambda6Upw[nPhaseIdx];
2198 Scalar lambdaT7 = lambda7Upw[wPhaseIdx] + lambda7Upw[nPhaseIdx];
2199 Scalar lambdaT8 = lambda8Upw[wPhaseIdx] + lambda8Upw[nPhaseIdx];
2200 Scalar lambdaT9 = lambda9Upw[wPhaseIdx] + lambda9Upw[nPhaseIdx];
2201 Scalar lambdaT10 = lambda10Upw[wPhaseIdx] + lambda10Upw[nPhaseIdx];
2202 Scalar lambdaT11 = lambda11Upw[wPhaseIdx] + lambda11Upw[nPhaseIdx];
2203 Scalar fracFlow0 = (lambdaT0 > threshold_) ? lambda0Upw[i] / (lambdaT0) : 0.0;
2204 Scalar fracFlow1 = (lambdaT1 > threshold_) ? lambda1Upw[i] / (lambdaT1) : 0.0;
2205 Scalar fracFlow2 = (lambdaT2 > threshold_) ? lambda2Upw[i] / (lambdaT2) : 0.0;
2206 Scalar fracFlow3 = (lambdaT3 > threshold_) ? lambda3Upw[i] / (lambdaT3) : 0.0;
2207 Scalar fracFlow4 = (lambdaT4 > threshold_) ? lambda4Upw[i] / (lambdaT4) : 0.0;
2208 Scalar fracFlow5 = (lambdaT5 > threshold_) ? lambda5Upw[i] / (lambdaT5) : 0.0;
2209 Scalar fracFlow6 = (lambdaT6 > threshold_) ? lambda6Upw[i] / (lambdaT6) : 0.0;
2210 Scalar fracFlow7 = (lambdaT7 > threshold_) ? lambda7Upw[i] / (lambdaT7) : 0.0;
2211 Scalar fracFlow8 = (lambdaT8 > threshold_) ? lambda8Upw[i] / (lambdaT8) : 0.0;
2212 Scalar fracFlow9 = (lambdaT9 > threshold_) ? lambda9Upw[i] / (lambdaT9) : 0.0;
2213 Scalar fracFlow10 = (lambdaT10 > threshold_) ? lambda10Upw[i] / (lambdaT10) : 0.0;
2214 Scalar fracFlow11 = (lambdaT11 > threshold_) ? lambda11Upw[i] / (lambdaT11) : 0.0;
2216 switch (pressureType_)
2223 this->f_[eIdxGlobal1] -= (fracFlow0 * pcFlux[0][0] - fracFlow3 * pcFlux[0][1] - fracFlow8 * pcFlux[0][2]);
2224 this->f_[eIdxGlobal2] -= (fracFlow1 * pcFlux[1][0] - fracFlow0 * pcFlux[1][1] + fracFlow9 * pcFlux[1][2]);
2225 this->f_[eIdxGlobal3] -= (fracFlow3 * pcFlux[2][0] - fracFlow2 * pcFlux[2][1] + fracFlow11 * pcFlux[2][2]);
2226 this->f_[eIdxGlobal4] -= (fracFlow2 * pcFlux[3][0] - fracFlow1 * pcFlux[3][1] - fracFlow10 * pcFlux[3][2]);
2227 this->f_[eIdxGlobal5] -= (fracFlow8 * pcFlux[4][0] - fracFlow4 * pcFlux[4][1] + fracFlow7 * pcFlux[4][2]);
2228 this->f_[eIdxGlobal6] -= (-fracFlow9 * pcFlux[5][0] - fracFlow5 * pcFlux[5][1] + fracFlow4 * pcFlux[5][2]);
2229 this->f_[eIdxGlobal7] -= (-fracFlow11 * pcFlux[6][0] - fracFlow7 * pcFlux[6][1] + fracFlow6 * pcFlux[6][2]);
2230 this->f_[eIdxGlobal8] -= (fracFlow10 * pcFlux[7][0] - fracFlow6 * pcFlux[7][1] + fracFlow5 * pcFlux[7][2]);
2239 this->f_[eIdxGlobal1] += (fracFlow0 * pcFlux[0][0] - fracFlow3 * pcFlux[0][1] - fracFlow8 * pcFlux[0][2]);
2240 this->f_[eIdxGlobal2] += (fracFlow1 * pcFlux[1][0] - fracFlow0 * pcFlux[1][1] + fracFlow9 * pcFlux[1][2]);
2241 this->f_[eIdxGlobal3] += (fracFlow3 * pcFlux[2][0] - fracFlow2 * pcFlux[2][1] + fracFlow11 * pcFlux[2][2]);
2242 this->f_[eIdxGlobal4] += (fracFlow2 * pcFlux[3][0] - fracFlow1 * pcFlux[3][1] - fracFlow10 * pcFlux[3][2]);
2243 this->f_[eIdxGlobal5] += (fracFlow8 * pcFlux[4][0] - fracFlow4 * pcFlux[4][1] + fracFlow7 * pcFlux[4][2]);
2244 this->f_[eIdxGlobal6] += (-fracFlow9 * pcFlux[5][0] - fracFlow5 * pcFlux[5][1] + fracFlow4 * pcFlux[5][2]);
2245 this->f_[eIdxGlobal7] += (-fracFlow11 * pcFlux[6][0] - fracFlow7 * pcFlux[6][1] + fracFlow6 * pcFlux[6][2]);
2246 this->f_[eIdxGlobal8] += (fracFlow10 * pcFlux[7][0] - fracFlow6 * pcFlux[7][1] + fracFlow5 * pcFlux[7][2]);
2255template<
class TypeTag>
2258 for (
int elemIdx = 0; elemIdx < 8; elemIdx++)
2260 if (!interactionVolume.hasSubVolumeElement(elemIdx))
2264 bool isOutside =
false;
2265 for (
int fIdx = 0; fIdx < dim; fIdx++)
2267 int intVolFaceIdx = interactionVolume.getFaceIndexFromSubVolume(elemIdx, fIdx);
2268 if (interactionVolume.isOutsideFace(intVolFaceIdx))
2279 auto element = interactionVolume.getSubVolumeElement(elemIdx);
2282 const GlobalPosition& globalPos = element.geometry().center();
2285 Scalar
volume = element.geometry().volume();
2288 int eIdxGlobal = problem_.variables().index(element);
2291 CellData& cellData = problem_.variables().cellData(eIdxGlobal);
2294 DimMatrix
permeability(problem_.spatialParams().intrinsicPermeability(element));
2297 PrimaryVariables source(0);
2298 problem_.source(source, element);
2299 this->f_[eIdxGlobal] +=
volume / (8.0)
2300 * (source[wPhaseIdx] / density_[wPhaseIdx] + source[nPhaseIdx] / density_[nPhaseIdx]);
2302 this->f_[eIdxGlobal] += evaluateErrorTerm(cellData) *
volume / (8.0);
2305 Dune::FieldVector<Scalar, numPhases> lambda(cellData.mobility(wPhaseIdx));
2306 lambda[nPhaseIdx] = cellData.mobility(nPhaseIdx);
2308 Scalar pc = cellData.capillaryPressure();
2310 Scalar gravityDiff = (problem_.bBoxMax() - globalPos) * gravity_
2311 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
2315 for (
int fIdx = 0; fIdx < dim; fIdx++)
2317 int intVolFaceIdx = interactionVolume.getFaceIndexFromSubVolume(elemIdx, fIdx);
2319 if (interactionVolume.isBoundaryFace(intVolFaceIdx))
2321 if (interactionVolume.getBoundaryType(intVolFaceIdx).isDirichlet(pressureEqIdx))
2323 const GlobalPosition& globalPosFace = interactionVolume.getFacePosition(elemIdx, fIdx);
2325 DimVector distVec(globalPosFace - globalPos);
2326 Scalar dist = distVec.two_norm();
2327 DimVector&
normal = interactionVolume.getNormal(elemIdx, fIdx);
2329 Scalar faceArea = interactionVolume.getFaceArea(elemIdx, fIdx);
2332 Scalar satWBound = cellData.saturation(wPhaseIdx);
2334 if (interactionVolume.getBoundaryType(intVolFaceIdx).isDirichlet(satEqIdx))
2336 Scalar satBound = interactionVolume.getDirichletValues(intVolFaceIdx)[saturationIdx];
2337 switch (saturationType_)
2341 satWBound = satBound;
2346 satWBound = 1 - satBound;
2353 const auto fluidMatrixInteraction = problem_.spatialParams().fluidMatrixInteractionAtPos(element.geometry().center());
2354 Scalar pcBound = fluidMatrixInteraction.pc(satWBound);
2356 Scalar gravityDiffBound = (problem_.bBoxMax() - globalPosFace) * gravity_
2357 * (density_[nPhaseIdx] - density_[wPhaseIdx]);
2359 pcBound += gravityDiffBound;
2361 Dune::FieldVector<Scalar, numPhases> lambdaBound(fluidMatrixInteraction.krw(satWBound));
2362 lambdaBound[nPhaseIdx] = fluidMatrixInteraction.krn(satWBound);
2363 lambdaBound[wPhaseIdx] /= viscosity_[wPhaseIdx];
2364 lambdaBound[nPhaseIdx] /= viscosity_[nPhaseIdx];
2366 Scalar potentialBound = interactionVolume.getDirichletValues(intVolFaceIdx)[pressureIdx];
2367 Scalar gdeltaZ = (problem_.bBoxMax()-globalPosFace) * gravity_;
2370 Scalar potentialDiffW = 0;
2371 Scalar potentialDiffNw = 0;
2372 switch (pressureType_)
2376 potentialBound += density_[wPhaseIdx]*gdeltaZ;
2377 potentialDiffW = (cellData.potential(wPhaseIdx) - potentialBound) / dist;
2378 potentialDiffNw = (cellData.potential(nPhaseIdx) - potentialBound - pcBound) / dist;
2383 potentialBound += density_[nPhaseIdx]*gdeltaZ;
2384 potentialDiffW = (cellData.potential(wPhaseIdx) - potentialBound + pcBound) / dist;
2385 potentialDiffNw = (cellData.potential(nPhaseIdx) - potentialBound) / dist;
2390 Scalar lambdaTotal = (potentialDiffW >= 0.) ? lambda[wPhaseIdx] : lambdaBound[wPhaseIdx];
2391 lambdaTotal += (potentialDiffNw >= 0.) ? lambda[nPhaseIdx] : lambdaBound[nPhaseIdx];
2393 DimVector permTimesNormal(0);
2395 Scalar scalarPerm = permTimesNormal.two_norm();
2398 Scalar entry = lambdaTotal * scalarPerm / dist * faceArea;
2401 this->A_[eIdxGlobal][eIdxGlobal] += entry;
2402 this->f_[eIdxGlobal] += entry * potentialBound;
2404 if (pc == 0 && pcBound == 0)
2412 switch (pressureType_)
2417 pcFlux = 0.5 * (lambda[nPhaseIdx] + lambdaBound[nPhaseIdx])
2418 * scalarPerm * (pc - pcBound) / dist * faceArea;
2425 pcFlux = 0.5 * (lambda[wPhaseIdx] + lambdaBound[wPhaseIdx])
2426 * scalarPerm * (pc - pcBound) / dist * faceArea;
2432 for (
int i = 0; i < numPhases; i++)
2434 switch (pressureType_)
2441 this->f_[eIdxGlobal] -= pcFlux;
2450 this->f_[eIdxGlobal] += pcFlux;
2457 else if (interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx))
2459 Scalar J = interactionVolume.getNeumannValues(intVolFaceIdx)[wPhaseIdx]
2460 / density_[wPhaseIdx];
2461 J += interactionVolume.getNeumannValues(intVolFaceIdx)[nPhaseIdx] / density_[nPhaseIdx];
2462 this->f_[eIdxGlobal] -= J;
2466 std::cout <<
"interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx)"
2467 << interactionVolume.getBoundaryType(intVolFaceIdx).isNeumann(pressureEqIdx) <<
"\n";
2468 DUNE_THROW(Dune::NotImplemented,
2469 "No valid boundary condition type defined for pressure equation!");
2477template<
class TypeTag>
2481 for (
const auto& element : elements(problem_.gridView()))
2483 int eIdxGlobal = problem_.variables().index(element);
2485 CellData& cellData = problem_.variables().cellData(eIdxGlobal);
2487 Scalar satW = cellData.saturation(wPhaseIdx);
2489 const auto fluidMatrixInteraction = problem_.spatialParams().fluidMatrixInteractionAtPos(element.geometry().center());
2490 const Scalar pc = fluidMatrixInteraction.pc(satW);
2492 cellData.setCapillaryPressure(pc);
2495 Scalar mobilityW = fluidMatrixInteraction.krw(satW)
2496 / viscosity_[wPhaseIdx];
2497 Scalar mobilityNw = fluidMatrixInteraction.krn(satW)
2498 / viscosity_[nPhaseIdx];
2501 cellData.setMobility(wPhaseIdx, mobilityW);
2502 cellData.setMobility(nPhaseIdx, mobilityNw);
2505 cellData.setFracFlowFunc(wPhaseIdx, mobilityW / (mobilityW + mobilityNw));
2506 cellData.setFracFlowFunc(nPhaseIdx, mobilityNw / (mobilityW + mobilityNw));
Interactionvolume container for 3-d MPFA L-method.
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: normal.hh:36
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type GetProp
get the type of a property
Definition: propertysystem.hh:141
typename Properties::Detail::GetPropImpl< TypeTag, Property >::type::type GetPropType
get the type alias defined in the property
Definition: propertysystem.hh:150
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
Scalar volume(Shape shape, Scalar inscribedRadius)
Returns the volume of a given geometry based on the inscribed radius.
Definition: poreproperties.hh:73
3-d finite volume MPFA L-method discretization of a two-phase flow pressure equation of the sequentia...
Definition: 3dpressure.hh:74
Scalar evaluateErrorTerm(CellData &cellData)
Volume correction term to correct for unphysical saturation overshoots/undershoots.
Definition: 3dpressure.hh:340
void initializeMatrixRowSize()
Initializes the row size of the sparse matrix for the pressure solution.
Definition: 3dpressure.hh:554
void assembleInnerInteractionVolume(InteractionVolume &interactionVolume)
assembles the matrix entries of one interaction volume into the global matrix
Definition: 3dpressure.hh:657
typename TransmissibilityCalculator::TransmissibilityType TransmissibilityType
Type including methods for calculation of MPFA transmissibilities.
Definition: 3dpressure.hh:152
void assemble()
function which assembles the system of equations to be solved
Definition: 3dpressure.hh:625
void update()
Pressure update.
Definition: 3dpressure.hh:271
InteractionVolumeContainer interactionVolumes_
Definition: 3dpressure.hh:507
GetPropType< TypeTag, Properties::MPFAInteractionVolume > InteractionVolume
Type for storing interaction volume information.
Definition: 3dpressure.hh:154
void assembleBoundaryInteractionVolume(InteractionVolume &interactionVolume)
Definition: 3dpressure.hh:2256
TransmissibilityCalculator transmissibilityCalculator_
The transmissibility calculator including methods for the MPFA transmissibility calculation.
Definition: 3dpressure.hh:509
void initialize(bool solveTwice=true)
Initializes the pressure model.
Definition: 3dpressure.hh:177
InteractionVolumeContainer & interactionVolumes()
Returns the global container of the stored interaction volumes.
Definition: 3dpressure.hh:449
TransmissibilityCalculator & transmissibilityCalculator()
Returns the transmissibility calculator.
Definition: 3dpressure.hh:459
void initializeMatrix()
Initializes the sparse matrix for the pressure solution.
Definition: 3dpressure.hh:544
FvMpfaL3dPressure2p(Problem &problem)
Constructs a FvMpfaL3dPressure2p object.
Definition: 3dpressure.hh:468
void storePressureSolution()
Globally stores the pressure solution.
Definition: 3dpressure.hh:205
void addOutputVtkFields(MultiWriter &writer)
Adds pressure output to the output file.
Definition: 3dpressure.hh:384
void storePressureSolution(const Element &element)
Stores the pressure solution of a cell.
Definition: 3dpressure.hh:219
void updateMaterialLaws()
constitutive functions are initialized and stored in the variables object
Definition: 3dpressure.hh:2478
void initializeMatrixIndices()
Initializes the indices of the sparse matrix for the pressure solution.
Definition: 3dpressure.hh:591
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
The finite volume base class for the solution of a pressure equation.
Definition: sequential/cellcentered/pressure.hh:49
void initialize()
Initialize pressure model.
Definition: sequential/cellcentered/pressure.hh:213
PressureSolution & pressure()
Returns the vector containing the pressure solution.
Definition: sequential/cellcentered/pressure.hh:120
void solve()
Solves the global system of equations to get the spatial distribution of the pressure.
Definition: sequential/cellcentered/pressure.hh:527
Specifies the properties for immiscible 2p diffusion/pressure models.
Finite Volume Diffusion Model.