19 static LoggerPtr logger(Logger::getLogger(
"pz.multiphase"));
23 static LoggerPtr logdata(Logger::getLogger(
"pz.material.multiphase.data"));
78 out <<
"name of material : " <<
Name() <<
"\n";
79 out <<
"Coeficient which multiplies the gradient operator "<<
"my var" << std::endl;
80 out <<
"Base Class properties :";
95 REAL lamelambda = 1.0;
105 REAL lamelambdaU = 1.0;
143 REAL PsiToPa = 6894.76;
144 REAL Pct = 1.0, Pcs = 0.5, Swi = 0.0;
149 pc = (Pct - Pcs *
log ((0.000000001 + Sw - Swi)/(1.0 - Swi)))*PsiToPa/this->
fPref;
150 DpcDSo = -(Pcs/(0.000000001 + Sw - Swi))*PsiToPa/this->
fPref;
200 REAL waterdensity,oildensity;
201 REAL dwaterdensitydp,doildensitydp;
202 REAL waterviscosity, oilviscosity;
203 REAL dwaterviscositydp, doilviscositydp;
206 RhoWater(Po,waterdensity,dwaterdensitydp);
207 RhoOil(Po,oildensity,doildensitydp);
215 Swstar = (waterviscosity*oildensity)/(oilviscosity*waterdensity+waterviscosity*oildensity);
235 const REAL comp = (0.0e-10)*(
fPref);
236 const REAL pref = (1.0e6)/(
fPref);
237 const REAL porosRef = 0.1;
238 poros = porosRef*
exp(comp*(po-pref));
239 dPorosDpo = comp*porosRef*
exp(comp*(po-pref));
245 const REAL Oilcomp = (0.0e-8)*(
fPref);
246 const REAL pref = (1.0e6)/(
fPref);
253 const REAL Watercomp = (0.0e-9)*(
fPref);
254 const REAL pref = (1.0e6)/(
fPref);
262 const REAL OilViscRef = (1.0e-3)/(
fEtaref);
263 OilViscosity = OilViscRef;
264 dOilViscosityDpo = 0;
269 const REAL WaterViscRef = (1.0e-3)/(
fEtaref);
270 WaterViscosity = WaterViscRef;
271 dWaterViscosityDpo = 0;
277 REAL krOil,Oilviscosity,OilDensity;
278 REAL dKroDSw,DOilviscosityDp,DOilDensityDp;
280 Kro(Sw, krOil, dKroDSw);
282 RhoOil(Po, OilDensity,DOilDensityDp);
284 OilLabmda = ((krOil)/(Oilviscosity))*(OilDensity);
285 dOilLabmdaDPo = (DOilDensityDp/Oilviscosity)*(krOil);
286 dOilLabmdaDSw = (OilDensity/Oilviscosity)*(dKroDSw);
293 REAL krWater,Waterviscosity,WaterDensity;
294 REAL dKrwDSw,DWaterviscosityDp,DWaterDensityDp;
296 Krw(Sw, krWater, dKrwDSw);
298 RhoWater(Pw, WaterDensity,DWaterDensityDp);
300 WaterLabmda = ((krWater)/(Waterviscosity))*(WaterDensity);
301 dWaterLabmdaDPw = (DWaterDensityDp/Waterviscosity)*(krWater);
302 dWaterLabmdaDSw = (WaterDensity/Waterviscosity)*(dKrwDSw);
311 REAL dOilLabmdaDpo,dOilLabmdaDSw;
314 REAL dWaterLabmdaDpo,dWaterLabmdaDSw;
316 OilLabmda(OilLabmdav, Pw, Sw, dOilLabmdaDpo, dOilLabmdaDSw);
317 WaterLabmda(WaterLabmdav, Pw, Sw, dWaterLabmdaDpo, dWaterLabmdaDSw);
319 Labmda = OilLabmdav + WaterLabmdav;
320 dLabmdaDPw = dOilLabmdaDpo+dWaterLabmdaDpo;
321 dLabmdaDSw = dOilLabmdaDSw+dWaterLabmdaDSw;
328 REAL dOilLabmdaDpo,dOilLabmdaDSw;
334 REAL dLabmdaDPw, dLabmdaDSw;
336 OilLabmda(OilLabmdab, Pw, Sw, dOilLabmdaDpo, dOilLabmdaDSw);
338 Labmda(Lambdab,Pw,Sw,dLabmdaDPw,dLabmdaDSw);
340 fOil = ((OilLabmdab)/(Lambdab));
341 dfOilDPw = ((dOilLabmdaDpo)/(Lambdab))-((OilLabmdab)/(Lambdab*Lambdab))*dLabmdaDPw;
342 dfOilDSw = ((dOilLabmdaDSw)/(Lambdab))-((OilLabmdab)/(Lambdab*Lambdab))*dLabmdaDSw;
354 REAL dWaterLabmdaDpo,dWaterLabmdaDSw;
357 REAL dLabmdaDPw, dLabmdaDSw;
360 WaterLabmda(WaterLabmdab, Pw, Sw, dWaterLabmdaDpo, dWaterLabmdaDSw);
361 Labmda(Lambdab,Pw,Sw,dLabmdaDPw,dLabmdaDSw);
363 fWater = ((WaterLabmdab)/(Lambdab));
364 dfWaterDPw = ((dWaterLabmdaDpo)/(Lambdab))-((WaterLabmdab)/(Lambdab*Lambdab))*dLabmdaDPw;
365 dfWaterDSw = ((dWaterLabmdaDSw)/(Lambdab))-((WaterLabmdab)/(Lambdab*Lambdab))*dLabmdaDSw;
376 REAL dfwaterdP, dfoildP;
377 REAL dfwaterdSw, dfoildSw;
384 fOil(foil,Pw,Sw,dfoildP,dfoildSw);
385 fWater(fwater,Pw,Sw,dfwaterdP,dfwaterdSw);
386 fWstar = foil*fwater;
387 dfWstarDPw = (dfoildP)*fwater + (dfwaterdP)*foil;
388 dfWstarDSw = (dfoildSw)*fwater + (dfwaterdSw)*foil;
392 fOil(foil,Pw,Swcutoff,dfoildP,dfoildSw);
393 fWater(fwater,Pw,Swcutoff,dfwaterdP,dfwaterdSw);
394 fWstar = foil*fwater;
395 dfWstarDPw = 0.0*((dfoildP)*fwater + (dfwaterdP)*foil);
396 dfWstarDSw = 0.0*((dfoildSw)*fwater + (dfwaterdSw)*foil);
409 REAL dfwaterdP, dfoildP;
410 REAL dfwaterdSw, dfoildSw;
417 fOil(foil,Pw,Sw,dfoildP,dfoildSw);
418 fWater(fwater,Pw,Sw,dfwaterdP,dfwaterdSw);
419 fOstar = foil*fwater;
420 dfOstarDPw = (dfoildP)*fwater + (dfwaterdP)*foil;
421 dfOstarDSw = (dfoildSw)*fwater + (dfwaterdSw)*foil;
425 fOil(foil,Pw,Swcutoff,dfoildP,dfoildSw);
426 fWater(fwater,Pw,Swcutoff,dfwaterdP,dfwaterdSw);
427 fOstar = foil*fwater;
428 dfOstarDPw = 0.0*((dfoildP)*fwater + (dfwaterdP)*foil);
429 dfOstarDSw = 0.0*((dfoildSw)*fwater + (dfwaterdSw)*foil);
439 REAL fwaterStar, foilStar;
440 REAL dfwaterStardP, dfoilStardP;
441 REAL dfwaterStardSw, dfoilStardSw;
445 fWaterstar(fwaterStar,Pw,Sw,dfwaterStardP,dfwaterStardSw);
447 dfstarDPw = dfwaterStardP;
448 dfstarDSw = dfwaterStardSw;
452 fOilstar(foilStar,Pw,Sw,dfoilStardP,dfoilStardSw);
454 dfstarDPw = dfoilStardP;
455 dfstarDSw = dfoilStardSw;
491 const REAL comp = 1.0e-10;
492 const REAL pref = 1.0e6;
493 const REAL porosRef = 0.3;
494 poros = porosRef*
exp(comp*((po.val())-pref));
500 const REAL Oilcomp = 0.0e-8;
501 const REAL pref = 1.0e6;
502 RhoOil =
RhoOilSC()*
exp(Oilcomp*((po.val())-pref));
507 const REAL Watercomp = 0.0e-9;
508 const REAL pref = 1.0e6;
515 const REAL OilViscRef = 1.0e-3;
516 OilViscosity = OilViscRef;
521 const REAL WaterViscRef = 1.0e-3;
522 WaterViscosity = WaterViscRef;
528 BFadREAL krOil,Oilviscosity,OilDensity;
534 OilLabmda = ((krOil)/(Oilviscosity))*(OilDensity);
542 BFadREAL krWater,Waterviscosity,WaterDensity;
548 WaterLabmda = ((krWater)/(Waterviscosity))*(WaterDensity);
556 BFadREAL OilLabmdaf, WaterLabmdaf;
561 Labmda = OilLabmdaf + WaterLabmdaf;
620 REAL Constant = (-1.0*Kab(0,1)*Kab(1,0)+Kab(0,0)*Kab(1,1));
622 Kinverse(0,0) = 1.0*Kab(1,1)/(Constant);
623 Kinverse(0,1) = - 1.0*Kab(0,1)/(Constant);
624 Kinverse(1,0) = - 1.0*Kab(1,0)/(Constant);
625 Kinverse(1,1) = 1.0*Kab(0,0)/(Constant);
634 std::string FileName;
635 std::string stringTemp;
636 FileName = MaptoRead;
639 int64_t numelements=0;
643 int64_t NumEntitiestoRead;
648 std::ifstream
read (FileName.c_str());
649 std::string FlagString;
654 read.getline(buf, 1024);
655 std::string str(buf);
656 if(str ==
"KABSOLUTE" || str ==
"KABSOLUTE\r")
663 FlagString =
"EndReading";
667 NumEntitiestoRead = SentinelString.
size();
674 std::ifstream
read (FileName.c_str());
675 std::string FlagString;
681 read.getline(buf, 1024);
682 std::string str(buf);
685 if(str == SentinelString[cont])
689 if(SentinelString[cont] ==
"" || SentinelString[cont] ==
"\r")
694 if(SentinelString[cont] ==
"EndReading")
699 if( (str !=
"" || str !=
"\r") && FlagString == SentinelString[cont])
704 read.getline(buftemp, 1024);
705 std::string strtemp(buftemp);
707 if(strtemp ==
"" || strtemp ==
"\r")
723 for (int64_t i = 0 ; i < NumEntitiestoRead; i++ )
726 if(SentinelString[i] ==
"KABSOLUTE" || SentinelString[i] ==
"KABSOLUTE\r")
728 numKData=GeneralData[i];
733 numelements=numKData;
740 int64_t elementId = 0;
741 int64_t ContOfKs = 0;
752 std::ifstream
read (FileName.c_str());
753 std::string FlagString;
760 read.getline(buf, 1024);
761 std::string str(buf);
762 std::string strtemp=
"InitialState";
765 if(str == SentinelString[cont])
770 if(SentinelString[cont] ==
"" || SentinelString[cont] ==
"\r")
775 if(SentinelString[cont] ==
"EndReading")
780 if( (str !=
"" || str !=
"\r" )&& FlagString == SentinelString[cont])
786 switch (DataToProcess[cont])
791 if (GeneralData[cont] != 0)
804 Kabsolute(0,0)=(1.0/
fKref)*kxx;
805 Kabsolute(0,1)=(1.0/
fKref)*kxy;
806 Kabsolute(0,2)=(1.0/
fKref)*kxz;
807 Kabsolute(1,0)=(1.0/
fKref)*kyx;
808 Kabsolute(1,1)=(1.0/
fKref)*kyy;
809 Kabsolute(1,2)=(1.0/
fKref)*kyz;
810 Kabsolute(2,0)=(1.0/
fKref)*kzx;
811 Kabsolute(2,1)=(1.0/
fKref)*kzy;
812 Kabsolute(2,2)=(1.0/
fKref)*kzz;
814 KabsoluteMap[elementId]=Kabsolute;
818 if(ContOfKs == numKData)
831 if(strtemp ==
"" || strtemp ==
"\r")
863 int nref = datavec.
size();
866 std::cout <<
" Error. datavec size is different from 5 \n";
885 int phrU, phrQ, phrP, phrS, phrQG;
887 phrQ = datavec[1].fVecShapeIndex.
NElements();
890 phrQG = datavec[4].fVecShapeIndex.
NElements();
895 int FirstQ = phrU * UStateVar + FirstU;
896 int FirstP = phrQ + FirstQ;
897 int FirstS = phrP + FirstP;
902 REAL Theta = this->
fTheta;
903 REAL Gamma = this->
fGamma;
904 int GeoID = datavec[1].gelElId;
917 Kinverse=this->
Kinv(Kabsolute);
931 REAL LambdaL, LambdaLU, MuL;
934 REAL rockporosity, oildensity, waterdensity;
935 REAL drockporositydp, doildensitydp, dwaterdensitydp;
937 REAL oilviscosity, waterviscosity;
938 REAL doilviscositydp, dwaterviscositydp;
940 REAL bulklambda, oillambda, waterlambda;
941 REAL dbulklambdadp, doillambdadp, dwaterlambdadp;
942 REAL dbulklambdads, doillambdads, dwaterlambdads;
944 REAL bulkfoil, bulkfwater;
945 REAL dbulkfoildp, dbulkfwaterdp;
946 REAL dbulkfoilds, dbulkfwaterds;
955 REAL Pressure = sol_p[0];
958 this->
Porosity(sol_p[VecPos], rockporosity, drockporositydp);
959 this->
RhoOil(sol_p[VecPos], oildensity, doildensitydp);
960 this->
RhoWater(sol_p[VecPos], waterdensity, dwaterdensitydp);
961 this->
OilViscosity(sol_p[VecPos], oilviscosity, doilviscositydp);
962 this->
WaterViscosity(sol_p[VecPos], waterviscosity, dwaterviscositydp);
963 this->
OilLabmda(oillambda, sol_p[VecPos], sol_s[VecPos], doillambdadp, doillambdads);
964 this->
WaterLabmda(waterlambda, sol_p[VecPos], sol_s[VecPos], dwaterlambdadp, dwaterlambdads);
965 this->
Labmda(bulklambda, sol_p[VecPos], sol_s[VecPos], dbulklambdadp, dbulklambdads);
966 this->
fOil(bulkfoil, sol_p[VecPos], sol_s[VecPos], dbulkfoildp, dbulkfoilds);
967 this->
fWater(bulkfwater, sol_p[VecPos], sol_s[VecPos], dbulkfwaterdp, dbulkfwaterds);
980 for(
int iu = 0; iu < phrU; iu++ )
983 du(0,0) = dphiU(0,iu)*datavec[0].axes(0,0)+dphiU(1,iu)*datavec[0].axes(1,0);
985 du(1,0) = dphiU(0,iu)*datavec[0].axes(0,1)+dphiU(1,iu)*datavec[0].axes(1,1);
987 for(
int ju = 0; ju < phrU; ju++)
990 du(0,1) = dphiU(0,ju)*datavec[0].axes(0,0)+dphiU(1,ju)*datavec[0].axes(1,0);
992 du(1,1) = dphiU(0,ju)*datavec[0].axes(0,1)+dphiU(1,ju)*datavec[0].axes(1,1);
997 ek(2*iu + FirstU, 2*ju + FirstU) += weight*((4*(MuL)*(LambdaL+MuL)/(LambdaL+2*MuL))*du(0,0)*du(0,1) + (2*MuL)*du(1,0)*du(1,1));
999 ek(2*iu + FirstU, 2*ju+1 + FirstU) += weight*((2*(MuL)*(LambdaL)/(LambdaL+2*MuL))*du(0,0)*du(1,1) + (2*MuL)*du(1,0)*du(0,1));
1001 ek(2*iu+1 + FirstU, 2*ju + FirstU) += weight*((2*(MuL)*(LambdaL)/(LambdaL+2*MuL))*du(1,0)*du(0,1) + (2*MuL)*du(0,0)*du(1,1));
1003 ek(2*iu+1 + FirstU, 2*ju+1 + FirstU) += weight*((4*(MuL)*(LambdaL+MuL)/(LambdaL+2*MuL))*du(1,0)*du(1,1) + (2*MuL)*du(0,0)*du(0,1));
1008 ek(2*iu + FirstU,2*ju + FirstU) += weight* ((LambdaL + 2*MuL)*du(0,0)*du(0,1) + (MuL)*du(1,0)*du(1,1));
1010 ek(2*iu + FirstU,2*ju+1 + FirstU) += weight* (LambdaL*du(0,0)*du(1,1) + (MuL)*du(1,0)*du(0,1));
1012 ek(2*iu+1 + FirstU,2*ju + FirstU) += weight* (LambdaL*du(1,0)*du(0,1) + (MuL)*du(0,0)*du(1,1));
1014 ek(2*iu+1 + FirstU,2*ju+1 + FirstU) += weight* ((LambdaL + 2*MuL)*du(1,0)*du(1,1) + (MuL)*du(0,0)*du(0,1));
1022 for(
int in = 0; in < phrU; in++ )
1024 du(0,0) = dphiU(0,in)*datavec[0].axes(0,0)+dphiU(1,in)*datavec[0].axes(1,0);
1025 du(1,0) = dphiU(0,in)*datavec[0].axes(0,1)+dphiU(1,in)*datavec[0].axes(1,1);
1027 for(
int jp = 0; jp < phrP; jp++)
1029 ek(2*in + FirstU,jp + FirstP) += (-1.0)*Balpha*weight*(phiP(jp,0)*du(0,0));
1030 ek(2*in+1 + FirstU,jp + FirstP) += (-1.0)*Balpha*weight*(phiP(jp,0)*du(1,0));
1035 REAL SaturationAtnplusOne = sol_s[0];
1038 REAL OneOverLambda = 1.0/bulklambda;
1039 for(
int iq=0; iq<phrQ; iq++)
1042 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1043 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1044 for (
int jq=0; jq<phrQ; jq++)
1047 int jvectorindex = datavec[1].fVecShapeIndex[jq].first;
1048 int jshapeindex = datavec[1].fVecShapeIndex[jq].second;
1052 REAL vec1 = (Kinverse(0,0)*datavec[1].fNormalVec(0,ivectorindex)+Kinverse(0,1)*datavec[1].fNormalVec(1,ivectorindex));
1053 REAL vec2 = (Kinverse(1,0)*datavec[1].fNormalVec(0,ivectorindex)+Kinverse(1,1)*datavec[1].fNormalVec(1,ivectorindex));
1056 (phiQ(ishapeindex,0)*vec1) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(0,jvectorindex)) +
1057 (phiQ(ishapeindex,0)*vec2) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(1,jvectorindex)) ;
1059 ek(iq + FirstQ,jq + FirstQ) += weight * OneOverLambda * dotprod;
1064 (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(0,jvectorindex)) +
1065 (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex)) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(1,jvectorindex)) ;
1067 ek(iq + FirstQ,jq + FirstQ) += weight * OneOverLambda * dotprod;
1078 for(
int iq=0; iq<phrQ; iq++)
1081 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1082 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1083 for (
int jsat=0; jsat<phrS; jsat++)
1088 (Kinverse(0,0)*sol_q[0]+Kinverse(0,1)*sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) +
1089 (Kinverse(1,0)*sol_q[0]+Kinverse(1,1)*sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1091 ek(iq + FirstQ,jsat + FirstS) -= weight * dbulklambdads * OneOverLambda * OneOverLambda * phiS(jsat,0) * dotprod;
1096 (sol_q[0]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) +
1097 (sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex)) ;
1099 ek(iq + FirstQ,jsat + FirstS) -= weight * dbulklambdads * OneOverLambda * OneOverLambda * phiS(jsat,0) * dotprod;
1109 for(
int iq=0; iq<phrQ; iq++)
1112 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1113 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1114 for (
int jp=0; jp<phrP; jp++)
1120 (Kinverse(0,0)*sol_q[0]+Kinverse(0,1)*sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) +
1121 (Kinverse(1,0)*sol_q[0]+Kinverse(1,1)*sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex)) ;
1123 ek(iq + FirstQ,jp + FirstP) -= weight * dbulklambdadp * OneOverLambda * OneOverLambda * phiP(jp,0) * dotprod;
1128 (sol_q[0]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) +
1129 (sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex)) ;
1131 ek(iq + FirstQ,jp + FirstP) -= weight * dbulklambdadp * OneOverLambda * OneOverLambda * phiP(jp,0) * dotprod;
1140 for(
int iq=0; iq<phrQ; iq++)
1143 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1144 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1146 for (
int jp=0; jp<phrP; jp++)
1152 dsolp[0] = dphiP(0,jp)*datavec[1].axes(0,0)+dphiP(1,jp)*datavec[1].axes(1,0);
1153 dsolp[1] = dphiP(0,jp)*datavec[1].axes(0,1)+dphiP(1,jp)*datavec[1].axes(1,1);
1158 REAL e1e1 = (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex))*(dsolp[0]);
1159 REAL e2e2 = (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex))*(dsolp[1]);
1161 ek(iq + FirstQ,jp + FirstP) += weight * ( e1e1 + e2e2 );
1166 REAL e1e1 = (Kabsolute(0,0)*(dsolp[0])+
1167 Kabsolute(0,1)*(dsolp[1]))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1169 REAL e2e2 = (Kabsolute(1,0)*(dsolp[0])+
1170 Kabsolute(1,1)*(dsolp[1]))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1172 ek(iq + FirstQ,jp + FirstP) += weight * ( e1e1 + e2e2 );
1182 for(
int iq=0; iq<phrQ; iq++)
1185 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1186 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1191 REAL e1e1 = (Gfield(0,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1192 REAL e2e2 = (Gfield(1,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1194 for (
int jp=0; jp<phrP; jp++)
1196 ek(iq + FirstQ,jp + FirstP) -= weight * ( ( bulkfwater * dwaterdensitydp + bulkfoil * doildensitydp ) * phiP(jp,0) * (e1e1 + e2e2));
1202 REAL e1e1 = (Kabsolute(0,0)*(Gfield(0,0))+
1203 Kabsolute(0,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1205 REAL e2e2 = (Kabsolute(1,0)*(Gfield(0,0))+
1206 Kabsolute(1,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1208 for (
int jp=0; jp<phrP; jp++)
1210 ek(iq + FirstQ,jp + FirstP) -= weight * ( ( bulkfwater * dwaterdensitydp + bulkfoil * doildensitydp ) * phiP(jp,0) * (e1e1 + e2e2));
1220 for(
int iq=0; iq<phrQ; iq++)
1223 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1224 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1229 REAL e1e1 = (Gfield(0,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1230 REAL e2e2 = (Gfield(1,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1232 for (
int jp=0; jp<phrP; jp++)
1234 ek(iq + FirstQ,jp + FirstP) -= weight * ( ( dbulkfwaterdp * waterdensity + dbulkfoildp * oildensity ) * phiP(jp,0) * (e1e1 + e2e2));
1240 REAL e1e1 = (Kabsolute(0,0)*(Gfield(0,0))+
1241 Kabsolute(0,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1243 REAL e2e2 = (Kabsolute(1,0)*(Gfield(0,0))+
1244 Kabsolute(1,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1246 for (
int jp=0; jp<phrP; jp++)
1248 ek(iq + FirstQ,jp + FirstP) -= weight * ( ( dbulkfwaterdp * waterdensity + dbulkfoildp * oildensity ) * phiP(jp,0) * (e1e1 + e2e2));
1258 for(
int iq=0; iq < phrQ; iq++)
1261 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1262 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1267 REAL e1e1 = (Gfield(0,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1268 REAL e2e2 = (Gfield(1,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1270 for (
int jsat=0; jsat < phrS; jsat++)
1272 ek(iq+ FirstQ,jsat + FirstS) -= weight * ( ( dbulkfwaterds * waterdensity + dbulkfoilds * oildensity ) * phiS(jsat,0) * (e1e1 + e2e2));
1277 REAL e1e1 = (Kabsolute(0,0)*(Gfield(0,0))+
1278 Kabsolute(0,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1280 REAL e2e2 = (Kabsolute(1,0)*(Gfield(0,0))+
1281 Kabsolute(1,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1283 for (
int jsat=0; jsat<phrS; jsat++)
1285 ek(iq + FirstQ,jsat + FirstS) -= weight * ( ( dbulkfwaterds * waterdensity + dbulkfoilds * oildensity ) * phiS(jsat,0) * (e1e1 + e2e2));
1292 REAL divphiU, divU, dsolU[2][2];
1294 dsolU[0][0] = dsol_u(0,0)*datavec[0].axes(0,0)+dsol_u(1,0)*datavec[0].axes(1,0);
1295 dsolU[1][0] = dsol_u(0,0)*datavec[0].axes(0,1)+dsol_u(1,0)*datavec[0].axes(1,1);
1297 dsolU[0][1] = dsol_u(0,1)*datavec[0].axes(0,0)+dsol_u(1,1)*datavec[0].axes(1,0);
1298 dsolU[1][1] = dsol_u(0,1)*datavec[0].axes(0,1)+dsol_u(1,1)*datavec[0].axes(1,1);
1299 divU = dsolU[0][0]+dsolU[1][1]+0.0;
1301 REAL PhiStar = Balpha * divU + Sestr * Pressure;
1306 for(
int ip=0; ip < phrP; ip++)
1308 for (
int ju = 0; ju < phrU; ju++)
1312 du(0,0) = dphiU(0,ju)*datavec[0].axes(0,0);
1313 du(1,0) = dphiU(0,ju)*datavec[0].axes(0,1);
1315 du(0,1) = dphiU(1,ju)*datavec[0].axes(1,0);
1316 du(1,1) = dphiU(1,ju)*datavec[0].axes(1,1);
1318 divphiU = du(0,0)+du(1,0)+0.0;
1320 REAL dPhiStardUx = Balpha * (du(0,0)+du(1,0));
1321 REAL dPhiStardUy = Balpha * (du(0,1)+du(1,1));
1323 REAL Integratingx = phiP(ip,0) * dPhiStardUx * (waterdensity * (SaturationAtnplusOne) + oildensity * (1 - SaturationAtnplusOne));
1324 REAL Integratingy = phiP(ip,0) * dPhiStardUy * (waterdensity * (SaturationAtnplusOne) + oildensity * (1 - SaturationAtnplusOne));
1326 ek(ip + FirstP,2*ju + FirstU) += (-1.0) * weight * Integratingx;
1327 ek(ip + FirstP,2*ju + 1 + FirstU) += (-1.0) * weight * Integratingy;
1334 for(
int ip=0; ip < phrP; ip++)
1336 for (
int jp=0; jp < phrP; jp++)
1338 REAL dPhiStardP = Sestr * phiP(jp,0);
1339 REAL Integrating = phiP(ip,0) * dPhiStardP * (waterdensity * (SaturationAtnplusOne) + oildensity * (1 - SaturationAtnplusOne));
1340 ek(ip + FirstP,jp + FirstP) += (-1.0) * weight * Integrating;
1347 for(
int ip=0; ip < phrP; ip++)
1349 for (
int jp=0; jp < phrP; jp++)
1351 REAL Integrating = phiP(ip,0) * PhiStar * (dwaterdensitydp * (SaturationAtnplusOne) + doildensitydp * (1 - SaturationAtnplusOne)) * phiP(jp,0);
1352 ek(ip + FirstP,jp + FirstP) -= weight * Integrating;
1359 for(
int ip=0; ip < phrP; ip++)
1361 for (
int jp=0; jp < phrP; jp++)
1363 REAL Integrating = phiP(ip,0) * drockporositydp * phiP(jp,0) * (waterdensity * (SaturationAtnplusOne) + oildensity * (1 - SaturationAtnplusOne));
1364 ek(ip + FirstP,jp + FirstP) += (-1.0) * weight * Integrating;
1372 for(
int ip=0; ip < phrP; ip++)
1374 for (
int jp=0; jp < phrP; jp++)
1376 REAL Integrating = phiP(ip,0) * rockporosity * (dwaterdensitydp * (SaturationAtnplusOne) + doildensitydp * (1 - SaturationAtnplusOne)) * phiP(jp,0);
1377 ek(ip + FirstP,jp + FirstP) -= weight * Integrating;
1385 for(
int ip=0; ip<phrP; ip++)
1387 for (
int jsat=0; jsat<phrS; jsat++)
1389 REAL Integrating = phiP(ip,0) * PhiStar * (waterdensity - oildensity) * phiS(jsat,0);
1390 ek(ip + FirstP,jsat + FirstS) -= weight * Integrating;
1398 for(
int ip=0; ip<phrP; ip++)
1400 for (
int jsat=0; jsat<phrS; jsat++)
1402 REAL Integrating = phiP(ip,0) * rockporosity * (waterdensity - oildensity) * phiS(jsat,0);
1403 ek(ip + FirstP,jsat + FirstS) -= weight * Integrating;
1410 for(
int ip=0; ip<phrP; ip++)
1414 dsolp[0] = dphiP(0,ip)*datavec[2].axes(0,0)+dphiP(1,ip)*datavec[2].axes(1,0);
1415 dsolp[1] = dphiP(0,ip)*datavec[2].axes(0,1)+dphiP(1,ip)*datavec[2].axes(1,1);
1417 for (
int jq=0; jq<phrQ; jq++)
1420 int jvectorindex = datavec[1].fVecShapeIndex[jq].first;
1421 int jshapeindex = datavec[1].fVecShapeIndex[jq].second;
1424 (dsolp[0]) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(0,jvectorindex)) +
1425 (dsolp[1]) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(1,jvectorindex)) ;
1427 ek(ip + FirstP,jq + FirstQ) += (Gamma) * (TimeStep) * weight * dotprod;
1434 for(
int isat=0; isat<phrS; isat++)
1437 for (
int jsat=0; jsat<phrS; jsat++)
1439 ek(isat + FirstS,jsat+ FirstS) += (PhiStar * waterdensity) * weight * phiS(isat,0) * phiS(jsat,0);
1446 for(
int isat=0; isat<phrS; isat++)
1449 for (
int jsat=0; jsat<phrS; jsat++)
1451 ek(isat + FirstS,jsat+ FirstS) += (rockporosity * waterdensity) * weight * phiS(isat,0) * phiS(jsat,0);
1459 for(
int isat=0; isat<phrS; isat++)
1461 for (
int ju=0; ju<phrU; ju++)
1465 du(0,0) = dphiU(0,ju)*datavec[0].axes(0,0);
1466 du(1,0) = dphiU(0,ju)*datavec[0].axes(0,1);
1468 du(0,1) = dphiU(1,ju)*datavec[0].axes(1,0);
1469 du(1,1) = dphiU(1,ju)*datavec[0].axes(1,1);
1471 divphiU = du(0,0)+du(1,0)+0.0;
1473 REAL dPhiStardUx = Balpha * (du(0,0)+du(1,0));
1474 REAL dPhiStardUy = Balpha * (du(0,1)+du(1,1));
1476 ek(isat + FirstS,2*ju + FirstU) += weight * (dPhiStardUx * waterdensity) * SaturationAtnplusOne * phiS(isat,0);
1477 ek(isat + FirstS,2*ju + 1 + FirstU) += weight * (dPhiStardUy * waterdensity) * SaturationAtnplusOne * phiS(isat,0);
1484 for(
int isat=0; isat<phrS; isat++)
1486 for (
int jp=0; jp<phrP; jp++)
1488 REAL dPhiStardP = Sestr * phiP(jp,0);
1489 ek(isat + FirstS,jp + FirstP) += weight * (dPhiStardP * waterdensity + PhiStar * dwaterdensitydp * phiP(jp,0)) * SaturationAtnplusOne * phiS(isat,0);
1495 for(
int isat=0; isat<phrS; isat++)
1498 for (
int jp=0; jp<phrP; jp++)
1500 ek(isat + FirstS,jp + FirstP) += weight * (drockporositydp * waterdensity + rockporosity * dwaterdensitydp) * SaturationAtnplusOne * phiS(isat,0) * phiP(jp,0);
1507 for(
int isat=0; isat<phrS; isat++)
1512 Gradphis[0] = dphiS(0,isat)*datavec[3].axes(0,0)+dphiS(1,isat)*datavec[3].axes(1,0);
1513 Gradphis[1] = dphiS(0,isat)*datavec[3].axes(0,1)+dphiS(1,isat)*datavec[3].axes(1,1);
1517 (Gradphis[0]) * (sol_q[0]) +
1518 (Gradphis[1]) * (sol_q[1]);
1520 for (
int jsat=0; jsat<phrS; jsat++)
1522 ek(isat + FirstS,jsat + FirstS) -= (Theta) * (TimeStep) * weight * dbulkfwaterds * phiS(jsat,0) * dotprod;
1528 for(
int isat=0; isat<phrS; isat++)
1532 Gradphis[0] = dphiS(0,isat)*datavec[3].axes(0,0)+dphiS(1,isat)*datavec[3].axes(1,0);
1533 Gradphis[1] = dphiS(0,isat)*datavec[3].axes(0,1)+dphiS(1,isat)*datavec[3].axes(1,1);
1535 for (
int jq=0; jq<phrQ; jq++)
1538 int jvectorindex = datavec[1].fVecShapeIndex[jq].first;
1539 int jshapeindex = datavec[1].fVecShapeIndex[jq].second;
1541 (Gradphis[0]) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(0,jvectorindex)) +
1542 (Gradphis[1]) * (phiQ(jshapeindex,0)*datavec[1].fNormalVec(1,jvectorindex));
1544 ek(isat + FirstS,jq + FirstQ) -= (Theta) * (TimeStep) * weight * bulkfwater * dotprod;
1588 int phrU, phrQ, phrP, phrS, phrQG;
1590 phrQ = datavec[1].fVecShapeIndex.
NElements();
1593 phrQG = datavec[4].fVecShapeIndex.
NElements();
1599 int FirstQ = phrU * UStateVar + FirstU;
1600 int FirstP = phrQ + FirstQ;
1601 int FirstS = phrP + FirstP;
1604 REAL TimeStep = this->
fDeltaT;
1605 REAL Theta = this->
fTheta;
1606 REAL Gamma = this->
fGamma;
1607 int GeoID = datavec[1].gelElId;
1620 Kinverse=this->
Kinv(Kabsolute);
1634 axesQ=datavec[1].axes;
1636 REAL Pressure = sol_p[0];
1638 REAL LambdaL, LambdaLU, MuL;
1641 REAL rockporosity, oildensity, waterdensity;
1642 REAL drockporositydp, doildensitydp, dwaterdensitydp;
1644 REAL oilviscosity, waterviscosity;
1645 REAL doilviscositydp, dwaterviscositydp;
1647 REAL bulklambda, oillambda, waterlambda;
1648 REAL dbulklambdadp, doillambdadp, dwaterlambdadp;
1649 REAL dbulklambdads, doillambdads, dwaterlambdads;
1651 REAL bulkfoil, bulkfwater;
1652 REAL dbulkfoildp, dbulkfwaterdp;
1653 REAL dbulkfoilds, dbulkfwaterds;
1664 this->
Porosity(sol_p[VecPos], rockporosity, drockporositydp);
1665 this->
RhoOil(sol_p[VecPos], oildensity, doildensitydp);
1666 this->
RhoWater(sol_p[VecPos], waterdensity, dwaterdensitydp);
1667 this->
OilViscosity(sol_p[VecPos], oilviscosity, doilviscositydp);
1668 this->
WaterViscosity(sol_p[VecPos], waterviscosity, dwaterviscositydp);
1669 this->
OilLabmda(oillambda, sol_p[VecPos], sol_s[VecPos], doillambdadp, doillambdads);
1670 this->
WaterLabmda(waterlambda, sol_p[VecPos], sol_s[VecPos], dwaterlambdadp, dwaterlambdads);
1671 this->
Labmda(bulklambda, sol_p[VecPos], sol_s[VecPos], dbulklambdadp, dbulklambdads);
1672 this->
fOil(bulkfoil, sol_p[VecPos], sol_s[VecPos], dbulkfoildp, dbulkfoilds);
1673 this->
fWater(bulkfwater, sol_p[VecPos], sol_s[VecPos], dbulkfwaterdp, dbulkfwaterds);
1689 dux(0,1) = dsol_u(0,0)*datavec[0].axes(0,0)+dsol_u(1,0)*datavec[0].axes(1,0);
1690 dux(1,1) = dsol_u(0,0)*datavec[0].axes(0,1)+dsol_u(1,0)*datavec[0].axes(1,1);
1693 duy(0,1) = dsol_u(0,1)*datavec[0].axes(0,0)+dsol_u(1,1)*datavec[0].axes(1,0);
1694 duy(1,1) = dsol_u(0,1)*datavec[0].axes(0,1)+dsol_u(1,1)*datavec[0].axes(1,1);
1696 for(
int iu = 0; iu < phrU; iu++ )
1699 du(0,0) = dphiU(0,iu)*datavec[0].axes(0,0)+dphiU(1,iu)*datavec[0].axes(1,0);
1701 du(1,0) = dphiU(0,iu)*datavec[0].axes(0,1)+dphiU(1,iu)*datavec[0].axes(1,1);
1710 ef(2*iu + FirstU) += weight*((4*(MuL)*(LambdaL+MuL)/(LambdaL+2*MuL))*du(0,0)*dux(0,1) + (2*MuL)*du(1,0)*dux(1,1));
1712 ef(2*iu + FirstU) += weight*((2*(MuL)*(LambdaL)/(LambdaL+2*MuL))*du(0,0)*duy(1,1) + (2*MuL)*du(1,0)*duy(0,1));
1714 ef(2*iu+1 + FirstU) += weight*((2*(MuL)*(LambdaL)/(LambdaL+2*MuL))*du(1,0)*dux(0,1) + (2*MuL)*du(0,0)*dux(1,1));
1716 ef(2*iu+1 + FirstU) += weight*((4*(MuL)*(LambdaL+MuL)/(LambdaL+2*MuL))*du(1,0)*duy(1,1) + (2*MuL)*du(0,0)*duy(0,1));
1731 ef(2*iu + FirstU) += weight* ((LambdaL + 2*MuL)*du(0,0)*dux(0,1) + (MuL)*du(1,0)*(dux(1,1)));
1733 ef(2*iu + FirstU) += weight* (LambdaL*du(0,0)*duy(1,1) + (MuL)*du(1,0)*(duy(0,1)));
1735 ef(2*iu+1 + FirstU) += weight* (LambdaL*du(1,0)*dux(0,1) + (MuL)*du(0,0)*(dux(1,1)));
1737 ef(2*iu+1 + FirstU) += weight* ((LambdaL + 2*MuL)*du(1,0)*duy(1,1) + (MuL)*du(0,0)*(duy(0,1)));
1743 for(
int in = 0; in < phrU; in++ )
1745 du(0,0) = dphiU(0,in)*datavec[0].axes(0,0)+dphiU(1,in)*datavec[0].axes(1,0);
1746 du(1,0) = dphiU(0,in)*datavec[0].axes(0,1)+dphiU(1,in)*datavec[0].axes(1,1);
1748 ef(2*in + FirstU) += (-1.0)*Balpha*weight*(Pressure*du(0,0));
1749 ef(2*in+1 + FirstU) += (-1.0)*Balpha*weight*(Pressure*du(1,0));
1753 REAL SaturationAtnplusOne = sol_s[0];
1757 REAL OneOverLambda = 1.0/bulklambda;
1758 for(
int iq=0; iq<phrQ; iq++)
1761 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1762 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1767 (Kinverse(0,0)*sol_q[0]+Kinverse(0,1)*sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) +
1768 (Kinverse(1,0)*sol_q[0]+Kinverse(1,1)*sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex)) ;
1770 ef(iq + FirstQ) += OneOverLambda * weight * dotprod;
1775 (sol_q[0]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex)) +
1776 (sol_q[1]) * (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex)) ;
1778 ef(iq + FirstQ) += OneOverLambda * weight * dotprod;
1789 dsolp[0] = dsol_p(0,0)*datavec[2].axes(0,0)+dsol_p(1,0)*datavec[2].axes(1,0);
1790 dsolp[1] = dsol_p(0,0)*datavec[2].axes(0,1)+dsol_p(1,0)*datavec[2].axes(1,1);
1792 for(
int iq=0; iq<phrQ; iq++)
1795 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1796 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1800 REAL e1e1 = (phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex))*(dsolp[0]);
1801 REAL e2e2 = (phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex))*(dsolp[1]);
1803 ef(iq + FirstQ) += weight * (e1e1 + e2e2);
1807 REAL e1e1 = (Kabsolute(0,0)*(dsolp[0])+
1808 Kabsolute(0,1)*(dsolp[1]))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1810 REAL e2e2 = (Kabsolute(1,0)*(dsolp[0])+
1811 Kabsolute(1,1)*(dsolp[1]))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1813 ef(iq + FirstQ) += weight * (e1e1 + e2e2);
1822 for(
int iq=0; iq<phrQ; iq++)
1825 int ivectorindex = datavec[1].fVecShapeIndex[iq].first;
1826 int ishapeindex = datavec[1].fVecShapeIndex[iq].second;
1831 REAL e1e1 = (Gfield(0,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1832 REAL e2e2 = (Gfield(1,0))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1834 ef(iq + FirstQ) -= weight * ( ( bulkfwater * waterdensity + bulkfoil * oildensity )* (e1e1 + e2e2));
1838 REAL e1e1 = (Kabsolute(0,0)*(Gfield(0,0))+
1839 Kabsolute(0,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(0,ivectorindex));
1841 REAL e2e2 = (Kabsolute(1,0)*(Gfield(0,0))+
1842 Kabsolute(1,1)*(Gfield(1,0)))*(phiQ(ishapeindex,0)*datavec[1].fNormalVec(1,ivectorindex));
1844 ef(iq + FirstQ) -= weight * ((bulkfwater * waterdensity + bulkfoil * oildensity)* (e1e1 + e2e2));
1850 REAL divU, dsolU[2][2];
1851 dsolU[0][0] = dsol_u(0,0)*datavec[0].axes(0,0)+dsol_u(1,0)*datavec[0].axes(1,0);
1852 dsolU[1][0] = dsol_u(0,0)*datavec[0].axes(0,1)+dsol_u(1,0)*datavec[0].axes(1,1);
1854 dsolU[0][1] = dsol_u(0,1)*datavec[0].axes(0,0)+dsol_u(1,1)*datavec[0].axes(1,0);
1855 dsolU[1][1] = dsol_u(0,1)*datavec[0].axes(0,1)+dsol_u(1,1)*datavec[0].axes(1,1);
1857 divU = dsolU[0][0]+dsolU[1][1]+0.0;
1858 REAL PhiStar = Balpha * divU + Sestr * Pressure;
1862 for(
int ip=0; ip<phrP; ip++)
1865 REAL Integrating = phiP(ip,0) * PhiStar * (waterdensity * SaturationAtnplusOne + oildensity * (1 - SaturationAtnplusOne));
1866 ef(ip + FirstP) += (-1.0) * weight * Integrating;
1871 for(
int ip=0; ip<phrP; ip++)
1874 REAL Integrating = phiP(ip,0) * rockporosity * (waterdensity * SaturationAtnplusOne + oildensity * (1 - SaturationAtnplusOne));
1875 ef(ip + FirstP) += (-1.0) * weight * Integrating;
1881 for(
int ip=0; ip<phrP; ip++)
1885 dsolp[0] = dphiP(0,ip)*datavec[2].axes(0,0)+dphiP(1,ip)*datavec[2].axes(1,0);
1886 dsolp[1] = dphiP(0,ip)*datavec[2].axes(0,1)+dphiP(1,ip)*datavec[2].axes(1,1);
1889 (dsolp[0]) * (sol_q[0]) +
1890 (dsolp[1]) * (sol_q[1]);
1892 ef(ip + FirstP) += (Gamma) * (TimeStep) * weight * dotprod;
1898 for(
int isat=0; isat<phrS; isat++)
1901 ef(isat + FirstS) += weight * (PhiStar * waterdensity) * phiS(isat,0) * SaturationAtnplusOne;
1908 for(
int isat=0; isat<phrS; isat++)
1911 ef(isat + FirstS) += weight * (rockporosity * waterdensity) * phiS(isat,0) * SaturationAtnplusOne;
1918 for(
int isat=0; isat<phrS; isat++)
1922 Gradphis[0] = dphiS(0,isat)*datavec[3].axes(0,0)+dphiS(1,isat)*datavec[3].axes(1,0);
1923 Gradphis[1] = dphiS(0,isat)*datavec[3].axes(0,1)+dphiS(1,isat)*datavec[3].axes(1,1);
1926 (Gradphis[0]) * (sol_q[0]) +
1927 (Gradphis[1]) * (sol_q[1]);
1929 ef(isat + FirstS) -= (Theta) * (TimeStep) * weight * bulkfwater * dotprod;
1938 REAL SaturationAtnTimeStep = sol_s[0];
1941 REAL divU, dsolU[2][2];
1942 dsolU[0][0] = dsol_u(0,0)*datavec[0].axes(0,0)+dsol_u(1,0)*datavec[0].axes(1,0);
1943 dsolU[1][0] = dsol_u(0,0)*datavec[0].axes(0,1)+dsol_u(1,0)*datavec[0].axes(1,1);
1945 dsolU[0][1] = dsol_u(0,1)*datavec[0].axes(0,0)+dsol_u(1,1)*datavec[0].axes(1,0);
1946 dsolU[1][1] = dsol_u(0,1)*datavec[0].axes(0,1)+dsol_u(1,1)*datavec[0].axes(1,1);
1948 divU = dsolU[0][0]+dsolU[1][1]+0.0;
1949 REAL PhiStar = Balpha * divU + Sestr * Pressure;
1953 for(
int ip = 0; ip < phrP; ip++)
1956 REAL Integrating = phiP(ip,0) * PhiStar * (waterdensity * SaturationAtnTimeStep + oildensity * (1 - SaturationAtnTimeStep));
1957 ef(ip + FirstP) += weight * Integrating;
1962 for(
int ip = 0; ip < phrP; ip++)
1965 REAL Integrating = phiP(ip,0) * rockporosity * (waterdensity * SaturationAtnTimeStep + oildensity * (1 - SaturationAtnTimeStep));
1966 ef(ip + FirstP) += weight * Integrating;
1972 for(
int ip=0; ip<phrP; ip++)
1976 dsolp[0] = dphiP(0,ip)*datavec[2].axes(0,0)+dphiP(1,ip)*datavec[2].axes(1,0);
1977 dsolp[1] = dphiP(0,ip)*datavec[2].axes(0,1)+dphiP(1,ip)*datavec[2].axes(1,1);
1980 (dsolp[0]) * (sol_q[0]) +
1981 (dsolp[1]) * (sol_q[1]);
1983 ef(ip + FirstP) += (1-Gamma) * (TimeStep) * weight * dotprod;
1990 for(
int isat=0; isat<phrS; isat++)
1993 ef(isat + FirstS) += (-1.0) * weight * (PhiStar * waterdensity) * phiS(isat,0) * SaturationAtnTimeStep;
1998 for(
int isat=0; isat<phrS; isat++)
2001 ef(isat + FirstS) += (-1.0) * weight * (rockporosity * waterdensity) * phiS(isat,0) * SaturationAtnTimeStep;
2006 for(
int isat=0; isat<phrS; isat++)
2010 Gradphis[0] = dphiS(0,isat)*datavec[3].axes(0,0)+dphiS(1,isat)*datavec[3].axes(1,0);
2011 Gradphis[1] = dphiS(0,isat)*datavec[3].axes(0,1)+dphiS(1,isat)*datavec[3].axes(1,1);
2014 (Gradphis[0]) * (sol_q[0]) +
2015 (Gradphis[1]) * (sol_q[1]) ;
2017 ef(isat + FirstS) -= (1-Theta) * (TimeStep) * weight * bulkfwater * dotprod;
2059 REAL n1 = normal[0];
2060 REAL n2 = normal[1];
2076 REAL qxL = sol_qL[0];
2077 REAL qyL = sol_qL[1];
2078 REAL qxR = sol_qR[0];
2079 REAL qyR = sol_qR[1];
2080 REAL dotqnL = (qxL*n1) + (qyL*n2);
2081 REAL dotqnR = (qxR*n1) + (qyR*n2);
2092 REAL SaturationL = sol_sL[0];
2093 REAL SaturationR = sol_sR[0];
2096 REAL TimeStep = this->
fDeltaT;
2097 REAL Theta = this->
fTheta;
2098 REAL Gamma = this->
fGamma;
2107 int GeoIDLeft = dataleft[1].gelElId;
2108 int GeoIDRight = dataright[1].gelElId;
2110 REAL rockporosityl, oildensityl, waterdensityl;
2111 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
2112 REAL rockporosityr, oildensityr, waterdensityr;
2113 REAL drockporositydpr, doildensitydpr, dwaterdensitydpr;
2115 REAL oilviscosityl, waterviscosityl;
2116 REAL doilviscositydpl, dwaterviscositydpl;
2117 REAL oilviscosityr, waterviscosityr;
2118 REAL doilviscositydpr, dwaterviscositydpr;
2120 REAL bulklambdal, oillambdal, waterlambdal;
2121 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
2122 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
2123 REAL bulklambdar, oillambdar, waterlambdar;
2124 REAL dbulklambdadpr, doillambdadpr, dwaterlambdadpr;
2125 REAL dbulklambdadsr, doillambdadsr, dwaterlambdadsr;
2127 REAL bulkfoill, bulkfwaterl;
2128 REAL dbulkfoildpl, dbulkfwaterdpl;
2129 REAL dbulkfoildsl, dbulkfwaterdsl;
2131 REAL bulkfoilr, bulkfwaterr;
2132 REAL dbulkfoildpr, dbulkfwaterdpr;
2133 REAL dbulkfoildsr, dbulkfwaterdsr;
2152 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
2153 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
2154 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
2155 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
2156 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
2157 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
2158 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
2159 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
2160 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
2161 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
2164 this->
Porosity(sol_pR[VecPos], rockporosityr, drockporositydpr);
2165 this->
RhoOil(sol_pR[VecPos], oildensityr, doildensitydpr);
2166 this->
RhoWater(sol_pR[VecPos], waterdensityr, dwaterdensitydpr);
2167 this->
OilViscosity(sol_pR[VecPos], oilviscosityr, doilviscositydpr);
2168 this->
WaterViscosity(sol_pR[VecPos], waterviscosityr, dwaterviscositydpr);
2169 this->
OilLabmda(oillambdar, sol_pR[VecPos], sol_sR[VecPos], doillambdadpr, doillambdadsr);
2170 this->
WaterLabmda(waterlambdar, sol_pR[VecPos], sol_sR[VecPos], dwaterlambdadpr, dwaterlambdadsr);
2171 this->
Labmda(bulklambdar, sol_pR[VecPos], sol_sR[VecPos], dbulklambdadpr, dbulklambdadsr);
2172 this->
fOil(bulkfoilr, sol_pR[VecPos], sol_sR[VecPos], dbulkfoildpr, dbulkfoildsr);
2173 this->
fWater(bulkfwaterr, sol_pR[VecPos], sol_sR[VecPos], dbulkfwaterdpr, dbulkfwaterdsr);
2185 this->
K(KabsoluteLeft);
2186 this->
K(KabsoluteRight);
2190 REAL Gravitydotnl = Gfield(0,0)*(n1) + Gfield(1,0)*(n2);
2191 REAL Gravitydotnr = Gfield(0,0)*(n1) + Gfield(1,0)*(n2);
2192 this->
fstar(bulkfStarl,sol_pL[VecPos], sol_sL[VecPos],1.0*Gravitydotnl,dbulkfStardpl,dbulkfStardsl);
2193 this->
fstar(bulkfStarr,sol_pR[VecPos], sol_sR[VecPos],-1.0*Gravitydotnr,dbulkfStardpr,dbulkfStardsr);
2196 REAL bulkfstar = 0.0;
2197 REAL dbulkfstardp = 0.0;
2198 REAL dbulkfstards = 0.0;
2199 if(
fabs(bulkfStarl) >=
fabs(bulkfStarr))
2201 bulkfstar = bulkfStarr;
2202 dbulkfstardp = dbulkfStardpr;
2203 dbulkfstards = dbulkfStardsr;
2207 bulkfstar = bulkfStarl;
2208 dbulkfstardp = dbulkfStardpl;
2209 dbulkfstards = dbulkfStardsl;
2213 for (
int in=0; in < 3; in++) {
2214 for (
int jn=0; jn < 3; jn++) {
2215 if (KabsoluteLeft(in,jn)+KabsoluteRight(in,jn)==0) {
2220 Kmean(in,jn)= (2.0*KabsoluteLeft(in,jn)*KabsoluteRight(in,jn))/(KabsoluteLeft(in,jn)+KabsoluteRight(in,jn));
2227 KGL(0,0) = KabsoluteLeft(0,0)*Gfield(0,0)+KabsoluteLeft(0,1)*Gfield(1,0);
2228 KGL(1,0) = KabsoluteLeft(1,0)*Gfield(0,0)+KabsoluteLeft(1,1)*Gfield(1,0);
2229 KGR(0,0) = KabsoluteRight(0,0)*Gfield(0,0)+KabsoluteRight(0,1)*Gfield(1,0);
2230 KGR(1,0) = KabsoluteRight(1,0)*Gfield(0,0)+KabsoluteRight(1,1)*Gfield(1,0);
2232 KG(0,0) = Kmean(0,0)*Gfield(0,0)+Kmean(0,1)*Gfield(1,0);
2233 KG(1,0) = Kmean(1,0)*Gfield(0,0)+Kmean(1,1)*Gfield(1,0);
2242 int URowsleft = phiUL.
Rows();
2243 int URowsRight = phiUR.
Rows();
2245 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
2246 int QRowsRight = dataright[1].fVecShapeIndex.
NElements();
2248 int PRowsleft = phiPL.
Rows();
2249 int PRowsRight = phiPR.
Rows();
2251 int SRowsleft = phiSL.
Rows();
2252 int SRowsRight = phiSR.
Rows();
2254 int QGRowsleft = dataleft[4].fVecShapeIndex.
NElements();
2259 int iRightInterfaceBlock = URowsleft * UStateVar + QRowsleft + PRowsleft + SRowsleft + QGRowsleft;
2260 int jRightInterfaceBlock = URowsleft * UStateVar + QRowsleft + PRowsleft + SRowsleft + QGRowsleft;
2263 int FirstQL = URowsleft * UStateVar + FirstUL;
2264 int FirstPL = QRowsleft + FirstQL;
2265 int FirstSL = PRowsleft + FirstPL;
2266 int FirstQGL = SRowsleft + FirstSL;
2269 int FirstQR = URowsRight * UStateVar + FirstUR;
2270 int FirstPR = QRowsRight + FirstQR;
2271 int FirstSR = PRowsRight + FirstPR;
2284 for (
int iq=0; iq < QRowsleft; iq++)
2287 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
2288 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
2290 for (
int jp=0; jp < PRowsleft; jp++)
2295 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
2296 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
2297 ek(iq + FirstQL, jp + FirstPL) += (-1.0) * weight * (e1e1 + e2e2 ) * phiPL(jp,0);
2301 REAL e1e1 = (Kmean(0,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
2302 Kmean(0,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n1);
2304 REAL e2e2 = (Kmean(1,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
2305 Kmean(1,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n2);
2306 ek(iq + FirstQL, jp + FirstPL) += (-1.0) * weight * (e1e1 + e2e2 ) * phiPL(jp,0);
2315 for (
int iq=0; iq < QRowsRight; iq++)
2317 int iRvectorindex = dataright[1].fVecShapeIndex[iq].first;
2318 int iRshapeindex = dataright[1].fVecShapeIndex[iq].second;
2320 for (
int jp=0; jp < PRowsRight; jp++)
2326 REAL e1e1 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))*(n1);
2327 REAL e2e2 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex))*(n2);
2329 ek(iq + FirstQR + iRightInterfaceBlock,jp + FirstPR + jRightInterfaceBlock) += (1.0) * weight * (e1e1 + e2e2 ) * phiPR(jp,0) ;
2333 REAL e1e1 = (Kmean(0,0)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))+
2334 Kmean(0,1)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex)))*(n1);
2336 REAL e2e2 = (Kmean(1,0)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))+
2337 Kmean(1,1)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex)))*(n2);
2339 ek(iq + FirstQR + iRightInterfaceBlock,jp + FirstPR + jRightInterfaceBlock) += (1.0) * weight * (e1e1 + e2e2 ) * phiPR(jp,0) ;
2348 REAL dSwPcdSL = SaturationL * dPcdSl + Pcl;
2349 REAL dSwPcdSR = SaturationR * dPcdSr + Pcr;
2354 for (
int iq=0; iq < QRowsleft; iq++)
2356 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
2357 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
2358 for (
int jsat=0; jsat < SRowsleft; jsat++)
2360 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
2361 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
2362 ek(iq + FirstQL, jsat + FirstSL) += (-1.0) * (-1.0) * weight * dSwPcdSL * (e1e1 + e2e2 ) * phiSL(jsat,0);
2369 for (
int iq=0; iq < QRowsRight; iq++)
2371 int iRvectorindex = dataright[1].fVecShapeIndex[iq].first;
2372 int iRshapeindex = dataright[1].fVecShapeIndex[iq].second;
2374 for (
int jsat=0; jsat < SRowsleft; jsat++)
2376 REAL e1e1 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))*(n1);
2377 REAL e2e2 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex))*(n2);
2378 ek(iq + FirstQR + iRightInterfaceBlock,jsat + FirstSR + jRightInterfaceBlock) += (-1.0) * (1.0) * weight * dSwPcdSR * (e1e1 + e2e2 ) * phiSR(jsat,0) ;
2385 for (
int ip=0; ip < PRowsleft; ip++)
2388 for (
int jq=0; jq<QRowsleft; jq++)
2391 int jvectorindex = dataleft[1].fVecShapeIndex[jq].first;
2392 int jshapeindex = dataleft[1].fVecShapeIndex[jq].second;
2395 (n1) * (phiQL(jshapeindex,0)*dataleft[1].fNormalVec(0,jvectorindex)) +
2396 (n2) * (phiQL(jshapeindex,0)*dataleft[1].fNormalVec(1,jvectorindex)) ;
2398 ek(ip + FirstPL,jq + FirstQL) += (-1.0) * (Gamma) * (TimeStep) * weight * dotprod * phiPL(ip,0);
2407 for (
int ip=0; ip < PRowsRight; ip++)
2410 for (
int jq=0; jq<QRowsRight; jq++)
2413 int jvectorindex = dataright[1].fVecShapeIndex[jq].first;
2414 int jshapeindex = dataright[1].fVecShapeIndex[jq].second;
2417 (n1) * (phiQR(jshapeindex,0)*dataright[1].fNormalVec(0,jvectorindex)) +
2418 (n2) * (phiQR(jshapeindex,0)*dataright[1].fNormalVec(1,jvectorindex)) ;
2420 ek(ip + FirstPR + iRightInterfaceBlock,jq + FirstQR + jRightInterfaceBlock) += (1.0) * (Gamma) * (TimeStep) * weight * dotprod * phiPR(ip,0);
2431 REAL UpwindSaturation = 0.0;
2435 UpwindSaturation = bulkfwaterl;
2438 for(
int isat=0; isat<SRowsleft; isat++)
2440 for(
int jsat=0; jsat<SRowsleft; jsat++)
2442 ek(isat + FirstSL ,jsat + FirstSL)
2443 += weight * (Theta) * (TimeStep) * phiSL(isat,0) * dbulkfwaterdsl * phiSL(jsat,0) * dotqnL;
2448 for(
int isat=0; isat<SRowsRight; isat++)
2451 for(
int jsat=0; jsat<SRowsleft; jsat++)
2453 ek(isat + FirstSR + iRightInterfaceBlock,jsat + FirstSL)
2454 -= weight * (Theta) * (TimeStep) * phiSR(isat,0) * dbulkfwaterdsl * phiSL(jsat,0) * dotqnL;
2463 UpwindSaturation = bulkfwaterr;
2466 for(
int isat=0; isat<SRowsleft; isat++)
2468 for(
int jsat=0; jsat<SRowsRight; jsat++)
2470 ek(isat + FirstSL,jsat + FirstSR + jRightInterfaceBlock)
2471 += weight * (Theta) * (TimeStep) * phiSL(isat,0) * dbulkfwaterdsr * phiSR(jsat,0) * dotqnR;
2475 for(
int isat=0; isat<SRowsRight; isat++)
2478 for(
int jsat=0; jsat<SRowsRight; jsat++)
2480 ek(isat + FirstSR + iRightInterfaceBlock,jsat + FirstSR + jRightInterfaceBlock)
2481 -= weight * (Theta) * (TimeStep) * phiSR(isat,0) * dbulkfwaterdsr * phiSR(jsat,0) * dotqnR;
2490 for (
int isat=0; isat < SRowsleft; isat++) {
2492 for (
int jq=0; jq < QRowsleft; jq++)
2494 int jLvectorindex = dataleft[1].fVecShapeIndex[jq].first;
2495 int jLshapeindex = dataleft[1].fVecShapeIndex[jq].second;
2498 (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(0,jLvectorindex)) * (n1) +
2499 (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(1,jLvectorindex)) * (n2) ;
2502 ek(isat + FirstSL ,jq + FirstQL) += weight * (Theta) * (TimeStep) * phiSL(isat,0) * UpwindSaturation * dotprodL;
2508 for (
int isat=0; isat < SRowsRight; isat++)
2510 for (
int jq=0; jq < QRowsleft; jq++)
2512 int jLvectorindex = dataleft[1].fVecShapeIndex[jq].first;
2513 int jLshapeindex = dataleft[1].fVecShapeIndex[jq].second;
2516 (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(0,jLvectorindex)) * (n1) +
2517 (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(1,jLvectorindex)) * (n2) ;
2520 ek(isat+ FirstSR + iRightInterfaceBlock,jq + FirstQL) -= weight * (Theta) * (TimeStep) * phiSR(isat,0) * UpwindSaturation * dotprodL;
2525 REAL QGgstarL = bulklambdal * (waterdensityl - oildensityl) * (KGL(0,0)*n1 + KGL(1,0)*n2);
2526 REAL QGgstarR = bulklambdar * (waterdensityr - oildensityr) * (KGR(0,0)*n1 + KGR(1,0)*n2);
2529 REAL dQGgstarLdP = ((bulklambdal * (dwaterdensitydpl - doildensitydpl)) +
2530 (dbulklambdadpl * (waterdensityl - oildensityl))) * (KGL(0,0)*n1 + KGL(1,0)*n2);
2532 REAL dQGgstarRdP = ((bulklambdar * (dwaterdensitydpr - doildensitydpr)) +
2533 (dbulklambdadpr * (waterdensityr - oildensityr))) * (KGR(0,0)*n1 + KGR(1,0)*n2);
2535 REAL dQGgstarLdS = (dbulklambdadsl) * (waterdensityl - oildensityl) * (KGL(0,0)*n1 + KGL(1,0)*n2);
2536 REAL dQGgstarRdS = (dbulklambdadsr) * (waterdensityr - oildensityr) * (KGR(0,0)*n1 + KGR(1,0)*n2);
2539 REAL dQGstardP = 0.0;
2540 REAL dQGstardS = 0.0;
2544 if(
fabs(1.0*bulkfStarl*QGgstarL) <
fabs(1.0*bulkfStarr*QGgstarR))
2546 QGstar = 1.0 * bulkfStarl * QGgstarL;
2547 dQGstardS = 1.0*(dbulkfStardsl * QGgstarL + bulkfStarl * dQGgstarLdS);
2548 dQGstardP = 1.0*(dbulkfStardpl * QGgstarL + bulkfStarl * dQGgstarLdP);
2553 for (
int iqg=0; iqg < QGRowsleft; iqg++)
2555 int iLvectorindex = dataleft[4].fVecShapeIndex[iqg].first;
2556 int iLshapeindex = dataleft[4].fVecShapeIndex[iqg].second;
2557 REAL e1e1i = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(0,iLvectorindex))*(n1);
2558 REAL e2e2i = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(1,iLvectorindex))*(n2);
2560 for(
int jsat=0; jsat<SRowsleft; jsat++)
2563 ek(iqg + FirstQGL, jsat + FirstSL)
2564 -= weight * (dQGstardS * phiSL(jsat,0)) * (e1e1i + e2e2i);
2567 for(
int jp=0; jp<PRowsleft; jp++)
2570 ek(iqg + FirstQGL, jp + FirstPL)
2571 -= weight * (dQGstardP * phiPL(jp,0)) * (e1e1i + e2e2i);
2579 QGstar = 1.0 *bulkfStarr*QGgstarR;
2580 dQGstardS = 1.0*(dbulkfStardsr * QGgstarR + bulkfStarr * dQGgstarRdS);
2581 dQGstardP = 1.0*(dbulkfStardpr * QGgstarR + bulkfStarr * dQGgstarRdP);
2586 for (
int iqg=0; iqg < QGRowsleft; iqg++)
2588 int iLvectorindex = dataleft[4].fVecShapeIndex[iqg].first;
2589 int iLshapeindex = dataleft[4].fVecShapeIndex[iqg].second;
2590 REAL e1e1i = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(0,iLvectorindex))*(n1);
2591 REAL e2e2i = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(1,iLvectorindex))*(n2);
2593 for(
int jsat=0; jsat<SRowsRight; jsat++)
2596 ek(iqg + FirstQGL, jRightInterfaceBlock + jsat + FirstSR)
2597 -= weight * (dQGstardS * phiSR(jsat,0)) * (e1e1i + e2e2i);
2600 for(
int jp=0; jp<PRowsRight; jp++)
2603 ek(iqg + FirstQGL, jRightInterfaceBlock + jp + FirstPR )
2604 -= weight * (dQGstardP * phiPR(jp,0)) * (e1e1i + e2e2i);
2615 for (
int iqg=0; iqg < QGRowsleft; iqg++)
2617 int iLvectorindex = dataleft[4].fVecShapeIndex[iqg].first;
2618 int iLshapeindex = dataleft[4].fVecShapeIndex[iqg].second;
2619 REAL e1e1i = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(0,iLvectorindex))*(n1);
2620 REAL e2e2i = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(1,iLvectorindex))*(n2);
2622 for (
int jqg=0; jqg < QGRowsleft; jqg++)
2624 int jLvectorindex = dataleft[4].fVecShapeIndex[jqg].first;
2625 int jLshapeindex = dataleft[4].fVecShapeIndex[jqg].second;
2626 REAL e1e1j = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(0,jLvectorindex))*(n1);
2627 REAL e2e2j = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(1,jLvectorindex))*(n2);
2630 ek(iqg + FirstQGL, jqg + FirstQGL)
2631 += weight * (e1e1j + e2e2j) * (e1e1i + e2e2i);
2639 for(
int isat=0; isat < SRowsleft; isat++)
2641 for (
int jqg=0; jqg < QGRowsleft; jqg++)
2643 int jLvectorindex = dataleft[4].fVecShapeIndex[jqg].first;
2644 int jLshapeindex = dataleft[4].fVecShapeIndex[jqg].second;
2645 REAL e1e1j = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(0,jLvectorindex))*(n1);
2646 REAL e2e2j = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(1,jLvectorindex))*(n2);
2648 REAL ResidualPart = (Theta) * (TimeStep) * ( e1e1j + e2e2j );
2649 ek(isat + FirstSL,jqg + FirstQGL)
2650 += weight * phiSL(isat,0) * ResidualPart;
2655 for(
int isat=0; isat < SRowsRight; isat++)
2657 for (
int jqg=0; jqg < QGRowsleft; jqg++)
2659 int jLvectorindex = dataleft[4].fVecShapeIndex[jqg].first;
2660 int jLshapeindex = dataleft[4].fVecShapeIndex[jqg].second;
2661 REAL e1e1j = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(0,jLvectorindex))*(n1);
2662 REAL e2e2j = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(1,jLvectorindex))*(n2);
2664 REAL ResidualPart = (Theta) * (TimeStep) * ( e1e1j + e2e2j );
2665 ek(isat + FirstSR + iRightInterfaceBlock,jqg + FirstQGL)
2666 -= weight * phiSR(isat,0) * ResidualPart;
2717 REAL n1 = normal[0];
2718 REAL n2 = normal[1];
2734 REAL qxL = sol_qL[0];
2735 REAL qyL = sol_qL[1];
2736 REAL qxR = sol_qR[0];
2737 REAL qyR = sol_qR[1];
2741 REAL qgxL = sol_qgL[0];
2742 REAL qgyL = sol_qgL[1];
2743 REAL qgxR = sol_qgR[0];
2744 REAL qgyR = sol_qgR[1];
2747 REAL PseudoPressureL = sol_pL[0];
2748 REAL PseudoPressureR = sol_pR[0];
2751 REAL SaturationL = sol_sL[0];
2752 REAL SaturationR = sol_sR[0];
2754 REAL dotqnL = (qxL*n1) + (qyL*n2);
2755 REAL dotqnR = (qxR*n1) + (qyR*n2);
2757 REAL dotqgnL = (qgxL*n1) + (qgyL*n2);
2758 REAL dotqgnR = (qgxR*n1) + (qgyR*n2);
2761 REAL TimeStep = this->
fDeltaT;
2762 REAL Theta = this->
fTheta;
2763 REAL Gamma = this->
fGamma;
2772 int GeoIDLeft = dataleft[1].gelElId;
2773 int GeoIDRight = dataright[1].gelElId;
2775 REAL rockporosityl, oildensityl, waterdensityl;
2776 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
2777 REAL rockporosityr, oildensityr, waterdensityr;
2778 REAL drockporositydpr, doildensitydpr, dwaterdensitydpr;
2780 REAL oilviscosityl, waterviscosityl;
2781 REAL doilviscositydpl, dwaterviscositydpl;
2782 REAL oilviscosityr, waterviscosityr;
2783 REAL doilviscositydpr, dwaterviscositydpr;
2785 REAL bulklambdal, oillambdal, waterlambdal;
2786 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
2787 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
2788 REAL bulklambdar, oillambdar, waterlambdar;
2789 REAL dbulklambdadpr, doillambdadpr, dwaterlambdadpr;
2790 REAL dbulklambdadsr, doillambdadsr, dwaterlambdadsr;
2793 REAL bulkfoill, bulkfwaterl;
2794 REAL dbulkfoildpl, dbulkfwaterdpl;
2795 REAL dbulkfoildsl, dbulkfwaterdsl;
2797 REAL bulkfoilr, bulkfwaterr;
2798 REAL dbulkfoildpr, dbulkfwaterdpr;
2799 REAL dbulkfoildsr, dbulkfwaterdsr;
2818 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
2819 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
2820 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
2821 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
2822 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
2823 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
2824 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
2825 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
2826 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
2827 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
2830 this->
Porosity(sol_pR[VecPos], rockporosityr, drockporositydpr);
2831 this->
RhoOil(sol_pR[VecPos], oildensityr, doildensitydpr);
2832 this->
RhoWater(sol_pR[VecPos], waterdensityr, dwaterdensitydpr);
2833 this->
OilViscosity(sol_pR[VecPos], oilviscosityr, doilviscositydpr);
2834 this->
WaterViscosity(sol_pR[VecPos], waterviscosityr, dwaterviscositydpr);
2835 this->
OilLabmda(oillambdar, sol_pR[VecPos], sol_sR[VecPos], doillambdadpr, doillambdadsr);
2836 this->
WaterLabmda(waterlambdar, sol_pR[VecPos], sol_sR[VecPos], dwaterlambdadpr, dwaterlambdadsr);
2837 this->
Labmda(bulklambdar, sol_pR[VecPos], sol_sR[VecPos], dbulklambdadpr, dbulklambdadsr);
2838 this->
fOil(bulkfoilr, sol_pR[VecPos], sol_sR[VecPos], dbulkfoildpr, dbulkfoildsr);
2839 this->
fWater(bulkfwaterr, sol_pR[VecPos], sol_sR[VecPos], dbulkfwaterdpr, dbulkfwaterdsr);
2851 this->
K(KabsoluteLeft);
2852 this->
K(KabsoluteRight);
2856 REAL Gravitydotnl = Gfield(0,0)*(n1) + Gfield(1,0)*(n2);
2857 REAL Gravitydotnr = Gfield(0,0)*(n1) + Gfield(1,0)*(n2);
2858 this->
fstar(bulkfStarl,sol_pL[VecPos], sol_sL[VecPos],1.0*Gravitydotnl,dbulkfStardpl,dbulkfStardsl);
2859 this->
fstar(bulkfStarr,sol_pR[VecPos], sol_sR[VecPos],-1.0*Gravitydotnr,dbulkfStardpr,dbulkfStardsr);
2862 REAL bulkfstar = 0.0;
2863 REAL dbulkfstardp = 0.0;
2864 REAL dbulkfstards = 0.0;
2865 if(
fabs(bulkfStarl) >=
fabs(bulkfStarr))
2867 bulkfstar = bulkfStarr;
2868 dbulkfstardp = dbulkfStardpr;
2869 dbulkfstards = dbulkfStardsr;
2873 bulkfstar = bulkfStarl;
2874 dbulkfstardp = dbulkfStardpl;
2875 dbulkfstards = dbulkfStardsl;
2879 for (
int in=0; in < 3; in++) {
2880 for (
int jn=0; jn < 3; jn++) {
2881 if (KabsoluteLeft(in,jn)+KabsoluteRight(in,jn)<=0) {
2886 Kmean(in,jn)= (2.0*KabsoluteLeft(in,jn)*KabsoluteRight(in,jn))/(KabsoluteLeft(in,jn)+KabsoluteRight(in,jn));
2893 KGL(0,0) = KabsoluteLeft(0,0)*Gfield(0,0)+KabsoluteLeft(0,1)*Gfield(1,0);
2894 KGL(1,0) = KabsoluteLeft(1,0)*Gfield(0,0)+KabsoluteLeft(1,1)*Gfield(1,0);
2895 KGR(0,0) = KabsoluteRight(0,0)*Gfield(0,0)+KabsoluteRight(0,1)*Gfield(1,0);
2896 KGR(1,0) = KabsoluteRight(1,0)*Gfield(0,0)+KabsoluteRight(1,1)*Gfield(1,0);
2898 KG(0,0) = Kmean(0,0)*Gfield(0,0)+Kmean(0,1)*Gfield(1,0);
2899 KG(1,0) = Kmean(1,0)*Gfield(0,0)+Kmean(1,1)*Gfield(1,0);
2907 int URowsleft = phiUL.
Rows();
2908 int URowsRight = phiUR.
Rows();
2909 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
2910 int QRowsRight = dataright[1].fVecShapeIndex.
NElements();
2911 int PRowsleft = phiPL.
Rows();
2912 int PRowsRight = phiPR.
Rows();
2913 int SRowsleft = phiSL.
Rows();
2914 int SRowsRight = phiSR.
Rows();
2916 int QGRowsleft = dataleft[4].fVecShapeIndex.
NElements();
2921 int iRightInterfaceBlock = URowsleft * UStateVar + QRowsleft + PRowsleft + SRowsleft + QGRowsleft;
2925 int FirstQL = URowsleft * UStateVar + FirstUL;
2926 int FirstPL = QRowsleft + FirstQL;
2927 int FirstSL = PRowsleft + FirstPL;
2928 int FirstQGL = SRowsleft + FirstSL;
2931 int FirstQR = URowsRight * UStateVar + FirstUR;
2932 int FirstPR = QRowsRight + FirstQR;
2933 int FirstSR = PRowsRight + FirstPR;
2948 for (
int iq=0; iq < QRowsleft; iq++)
2951 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
2952 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
2957 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
2958 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
2960 ef(iq + FirstQL) += (-1.0) * weight * (e1e1 + e2e2 ) * PseudoPressureL;
2964 REAL e1e1 = (Kmean(0,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
2965 Kmean(0,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n1);
2967 REAL e2e2 = (Kmean(1,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
2968 Kmean(1,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n2);
2970 ef(iq + FirstQL) += (-1.0) * weight * (e1e1 + e2e2 ) * PseudoPressureL;
2981 for (
int iq=0; iq < QRowsRight; iq++)
2984 int iRvectorindex = dataright[1].fVecShapeIndex[iq].first;
2985 int iRshapeindex = dataright[1].fVecShapeIndex[iq].second;
2990 REAL e1e1 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))*(n1);
2991 REAL e2e2 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex))*(n2);
2994 ef(iq + iRightInterfaceBlock + FirstQR) += (1.0) * weight * (e1e1 + e2e2 ) * PseudoPressureR;
2998 REAL e1e1 = (Kmean(0,0)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))+
2999 Kmean(0,1)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex)))*(n1);
3001 REAL e2e2 = (Kmean(1,0)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))+
3002 Kmean(1,1)*(phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex)))*(n2);
3004 ef(iq + iRightInterfaceBlock + FirstQR) += (1.0) * weight * (e1e1 + e2e2 ) * PseudoPressureR;
3010 REAL SwPcL = SaturationL * Pcl;
3011 REAL SwPcR = SaturationR * Pcr;
3016 for (
int iq=0; iq < QRowsleft; iq++)
3018 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
3019 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
3020 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
3021 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
3022 ef(iq + FirstQL) += (-1.0) * (-1.0) * weight * (e1e1 + e2e2 ) * SwPcL;
3029 for (
int iq=0; iq < QRowsRight; iq++)
3031 int iRvectorindex = dataright[1].fVecShapeIndex[iq].first;
3032 int iRshapeindex = dataright[1].fVecShapeIndex[iq].second;
3033 REAL e1e1 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(0,iRvectorindex))*(n1);
3034 REAL e2e2 = (phiQR(iRshapeindex,0)*dataright[1].fNormalVec(1,iRvectorindex))*(n2);
3036 ef(iq + iRightInterfaceBlock + FirstQR) += (-1.0) * (1.0) * weight * (e1e1 + e2e2 ) * SwPcR;
3041 for (
int ip=0; ip < PRowsleft; ip++)
3043 ef(ip + FirstPL) += (-1.0) * (Gamma) * (TimeStep) * weight * dotqnL * phiPL(ip,0);
3048 for (
int ip=0; ip < PRowsRight; ip++)
3050 ef(ip + FirstPR + iRightInterfaceBlock) += (1.0) * (Gamma) * (TimeStep) * weight * dotqnR * phiPR(ip,0);
3054 REAL UpwindSaturation = 0.0;
3058 UpwindSaturation = bulkfwaterl;
3063 UpwindSaturation = bulkfwaterr;
3069 for(
int isat=0; isat < SRowsleft; isat++)
3071 REAL ResidualPart = (Theta) * (TimeStep) * ( UpwindSaturation * dotqnL );
3072 ef(isat + FirstSL) += weight * phiSL(isat,0) * ResidualPart;
3076 for(
int isat=0; isat < SRowsRight; isat++)
3078 REAL ResidualPart = (Theta) * (TimeStep) * ( UpwindSaturation * dotqnR );
3079 ef(isat + iRightInterfaceBlock + FirstSR) -= weight * phiSR(isat,0) * ResidualPart;
3082 REAL QGgstarL = bulklambdal * (waterdensityl - oildensityl) * (KGL(0,0)*n1 + KGL(1,0)*n2);
3083 REAL QGgstarR = bulklambdar * (waterdensityr - oildensityr) * (KGR(0,0)*n1 + KGR(1,0)*n2);
3088 if(
fabs(1.0*bulkfStarl*QGgstarL) <
fabs(1.0*bulkfStarr*QGgstarR))
3090 QGstar = 1.0*bulkfStarl*QGgstarL;
3094 QGstar = 1.0*bulkfStarr*QGgstarR;
3113 for (
int iqg=0; iqg < QGRowsleft; iqg++)
3115 int iLvectorindex = dataleft[4].fVecShapeIndex[iqg].first;
3116 int iLshapeindex = dataleft[4].fVecShapeIndex[iqg].second;
3117 REAL e1e1 = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(0,iLvectorindex))*(n1);
3118 REAL e2e2 = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(1,iLvectorindex))*(n2);
3120 ef(iqg + FirstQGL) += weight * (dotqgnL-QGstar) * (e1e1 + e2e2);
3126 for(
int isat=0; isat < SRowsleft; isat++)
3128 REAL ResidualPart = (Theta) * (TimeStep) * ( dotqgnL );
3129 ef(isat + FirstSL) += weight * phiSL(isat,0) * ResidualPart;
3133 for(
int isat=0; isat < SRowsRight; isat++)
3135 REAL ResidualPart = (Theta) * (TimeStep) * ( dotqgnL );
3136 ef(isat + iRightInterfaceBlock + FirstSR) -= weight * phiSR(isat,0) * ResidualPart;
3210 for (
int ip=0; ip < PRowsleft; ip++)
3212 ef(ip + FirstPL) -= (1-Gamma) * (TimeStep) * weight * dotqnL * phiPL(ip,0);
3217 for (
int ip=0; ip < PRowsRight; ip++)
3219 ef(ip + iRightInterfaceBlock + FirstPR) += (1-Gamma) * (TimeStep) * weight * dotqnR * phiPR(ip,0);
3222 REAL dotqnL = (qxL*n1) + (qyL*n2);
3224 REAL UpwindSaturation = 0.0;
3228 UpwindSaturation = bulkfwaterl;
3233 UpwindSaturation = bulkfwaterr;
3240 for(
int isat=0; isat<SRowsleft; isat++)
3242 REAL ResidualPart = (1-Theta) * (TimeStep) * ( UpwindSaturation * dotqnL );
3243 ef(isat + FirstSL) += weight * phiSL(isat,0) * ResidualPart;
3247 for(
int isat=0; isat<SRowsRight; isat++)
3249 REAL ResidualPart = (1-Theta) * (TimeStep) * ( UpwindSaturation * dotqnL );
3250 ef(isat + iRightInterfaceBlock + FirstSR) -= weight * phiSR(isat,0) * ResidualPart;
3255 for(
int isat=0; isat<SRowsleft; isat++)
3257 REAL ResidualPart = (1-Theta) * (TimeStep) * ( dotqgnL );
3258 ef(isat + FirstSL) += weight * phiSL(isat,0) * ResidualPart;
3262 for(
int isat=0; isat<SRowsRight; isat++)
3264 REAL ResidualPart = (1-Theta) * (TimeStep) * ( dotqgnR);
3265 ef(isat + iRightInterfaceBlock + FirstSR) -= weight * phiSR(isat,0) * ResidualPart;
3292 int nref = datavec.
size();
3294 std::cout <<
" Error.!! datavec size not equal to 4 \n";
3316 int nref = dataleft.
size();
3318 std::cout <<
" Error:: datavec size must to be equal to 4 \n" << std::endl;
3323 std::cout <<
" Error:: This material need boundary conditions for qx, qy, p (pore pressure) and s (Saturation) .\n" << std::endl;
3324 std::cout <<
" give me one matrix with this form Val2(3,1).\n" << std::endl;
3329 std::cout <<
" Error:: This material need boundary conditions for ux, uy, qx, qy, p (pore pressure) and s (Saturation) .\n" << std::endl;
3339 int URowsleft = phiUL.
Rows();
3340 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
3342 int PRowsleft = phiPL.
Rows();
3343 int SRowsleft = phiSL.
Rows();
3344 int QGRowsleft = dataleft[4].fVecShapeIndex.
NElements();
3352 int FirstQL = URowsleft * UStateVar + FirstUL;
3353 int FirstPL = QRowsleft + FirstQL;
3354 int FirstSL = PRowsleft + FirstPL;
3355 int FirstQGL = SRowsleft + FirstSL;
3358 REAL n1 = normal[0];
3359 REAL n2 = normal[1];
3369 REAL qxL = sol_qL[0];
3370 REAL qyL = sol_qL[1];
3371 REAL dotqnL = (qxL*n1) + (qyL*n2);
3374 REAL PseudoPressureL = sol_pL[0];
3381 REAL TimeStep = this->
fDeltaT;
3382 REAL Theta = this->
fTheta;
3383 REAL Gamma = this->
fGamma;
3387 int GeoIDLeft = dataleft[1].gelElId;
3401 Kinverse = this->
Kinv(Kabsolute);
3404 REAL GravityFluxL = (Kabsolute(0,0)*Gfield(0,0) + Kabsolute(0,1)*Gfield(1,0))*(n1)+
3405 (Kabsolute(1,0)*Gfield(0,0) + Kabsolute(1,1)*Gfield(1,0))*(n2);
3407 REAL rockporosityl, oildensityl, waterdensityl;
3408 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
3410 REAL oilviscosityl, waterviscosityl;
3411 REAL doilviscositydpl, dwaterviscositydpl;
3413 REAL bulklambdal, oillambdal, waterlambdal;
3414 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
3415 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
3417 REAL bulkfoill, bulkfwaterl;
3418 REAL dbulkfoildpl, dbulkfwaterdpl;
3419 REAL dbulkfoildsl, dbulkfwaterdsl;
3425 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
3426 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
3427 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
3428 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
3429 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
3430 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
3431 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
3432 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
3433 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
3434 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
3445 for (
int iq=0; iq < QRowsleft; iq++)
3448 for (
int jp=0; jp < PRowsleft; jp++)
3450 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
3451 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
3455 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
3456 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
3458 ek(iq + FirstQL, jp + FirstPL) += (-1.0) * weight * (e1e1 + e2e2 ) * phiPL(jp,0);
3463 REAL e1e1 = (Kabsolute(0,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
3464 Kabsolute(0,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n1);
3466 REAL e2e2 = (Kabsolute(1,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
3467 Kabsolute(1,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n2);
3469 ek(iq + FirstQL, jp + FirstPL) += (-1.0) * weight * (e1e1 + e2e2 ) * phiPL(jp,0);
3477 for (
int ip=0; ip < PRowsleft; ip++)
3480 for (
int jq=0; jq< QRowsleft; jq++)
3483 int jvectorindex = dataleft[1].fVecShapeIndex[jq].first;
3484 int jshapeindex = dataleft[1].fVecShapeIndex[jq].second;
3487 (n1) * (phiQL(jshapeindex,0)*dataleft[1].fNormalVec(0,jvectorindex)) +
3488 (n2) * (phiQL(jshapeindex,0)*dataleft[1].fNormalVec(1,jvectorindex)) ;
3490 ek(ip + FirstPL,jq + FirstQL) += (-1.0) * (Gamma) * (TimeStep) * weight * dotprod * phiPL(ip,0);
3500 for (
int iq=0; iq < QRowsleft; iq++)
3503 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
3504 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
3509 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
3510 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
3512 ef(iq + FirstQL) += (-1.0) * weight * (e1e1 + e2e2) * PseudoPressureL;
3517 REAL e1e1 = (Kabsolute(0,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
3518 Kabsolute(0,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n1);
3520 REAL e2e2 = (Kabsolute(1,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
3521 Kabsolute(1,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n2);
3524 ef(iq + FirstQL) += (-1.0) * weight * (e1e1 + e2e2) * PseudoPressureL;
3532 for (
int ip=0; ip < PRowsleft; ip++)
3534 ef(ip+FirstPL) += (-1.0) * (Gamma) * (TimeStep) * weight * dotqnL * phiPL(ip,0);
3538 for(
int iqg=0; iqg < QGRowsleft; iqg++)
3540 int iLvectorindex = dataleft[4].fVecShapeIndex[iqg].first;
3541 int iLshapeindex = dataleft[4].fVecShapeIndex[iqg].second;
3543 REAL vni = (phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(0,iLvectorindex)*n1)+(phiQGL(iLshapeindex,0)*dataleft[4].fNormalVec(1,iLvectorindex)*n2);
3545 for (
int jqg=0; jqg < QGRowsleft; jqg++)
3547 int jLvectorindex = dataleft[4].fVecShapeIndex[jqg].first;
3548 int jLshapeindex = dataleft[4].fVecShapeIndex[jqg].second;
3550 REAL vnj = (phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(0,jLvectorindex)*n1)+(phiQGL(jLshapeindex,0)*dataleft[4].fNormalVec(1,jLvectorindex)*n2);
3552 ek(iqg + FirstQGL,jqg + FirstQGL) += weight * (
gBigNumber * ( vnj ) * vni );
3566 for (
int ip=0; ip < PRowsleft; ip++)
3568 ef(ip + FirstPL) -= (1-Gamma) * (TimeStep) * weight * dotqnL * phiPL(ip,0);
3571 REAL UpwindFSaturation = 0.0;
3576 UpwindFSaturation = bulkfwaterl;
3581 UpwindFSaturation = 0.0;
3587 for(
int isat=0; isat<SRowsleft; isat++)
3589 REAL ResidualPart = (1-Theta) * (TimeStep) * ( UpwindFSaturation * bulkfoill * bulklambdal * (waterdensityl - oildensityl) * GravityFluxL );
3590 ef(isat + FirstSL) += signofG * (-1.0) * weight * phiSL(isat,0) * ResidualPart;
3600 v2[0] = bc.
Val2()(0,0);
3601 v2[1] = bc.
Val2()(1,0);
3605 v2[5] = bc.
Val2()(5,0);
3609 switch (bc.
Type()) {
3614 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3615 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3616 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3617 ApplySin(data,dataleft,weight,ek,ef,bc);
3622 ApplySin(data,dataleft,weight,ef,bc);
3632 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3633 ApplySin(data,dataleft,weight,ek,ef,bc);
3638 ApplySin(data,dataleft,weight,ef,bc);
3648 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3649 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3650 ApplySin(data,dataleft,weight,ek,ef,bc);
3655 ApplySin(data,dataleft,weight,ef,bc);
3664 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3665 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3666 ApplySin(data,dataleft,weight,ek,ef,bc);
3671 ApplySin(data,dataleft,weight,ef,bc);
3680 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3681 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3682 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3683 ApplySout(data,dataleft,weight,ek,ef,bc);
3698 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3699 ApplySout(data,dataleft,weight,ek,ef,bc);
3714 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3715 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3716 ApplySout(data,dataleft,weight,ek,ef,bc);
3730 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3731 ApplyQnD(data,dataleft,weight,ek,ef,bc);
3732 ApplySout(data,dataleft,weight,ek,ef,bc);
3746 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3747 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3748 ApplyPN(data,dataleft,weight,ek,ef,bc);
3749 ApplySin(data,dataleft,weight,ek,ef,bc);
3754 ApplySin(data,dataleft,weight,ef,bc);
3764 ApplyPN(data,dataleft,weight,ek,ef,bc);
3765 ApplySin(data,dataleft,weight,ek,ef,bc);
3770 ApplySin(data,dataleft,weight,ef,bc);
3780 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3781 ApplyPN(data,dataleft,weight,ek,ef,bc);
3782 ApplySin(data,dataleft,weight,ek,ef,bc);
3787 ApplySin(data,dataleft,weight,ef,bc);
3796 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3797 ApplyPN(data,dataleft,weight,ek,ef,bc);
3798 ApplySin(data,dataleft,weight,ek,ef,bc);
3803 ApplySin(data,dataleft,weight,ef,bc);
3812 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3813 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3814 ApplyPN(data,dataleft,weight,ek,ef,bc);
3815 ApplySout(data,dataleft,weight,ek,ef,bc);
3830 ApplyPN(data,dataleft,weight,ek,ef,bc);
3831 ApplySout(data,dataleft,weight,ek,ef,bc);
3846 ApplyUxD(data,dataleft,weight,ek,ef,bc);
3847 ApplyPN(data,dataleft,weight,ek,ef,bc);
3848 ApplySout(data,dataleft,weight,ek,ef,bc);
3862 ApplyUyD(data,dataleft,weight,ek,ef,bc);
3863 ApplyPN(data,dataleft,weight,ek,ef,bc);
3864 ApplySout(data,dataleft,weight,ek,ef,bc);
3874 default: std::cout <<
"This BC doesn't exist." << std::endl;
3893 int URowsleft = phiUL.
Rows();
3915 REAL uxL = sol_uL[0];
3919 v2[0] = bc.
Val2()(0,0);
3920 v2[1] = bc.
Val2()(1,0);
3924 v2[5] = bc.
Val2()(5,0);
3928 for(
int iu = 0 ; iu < URowsleft; iu++)
3931 ef(2*iu) += this->
fxi *
gBigNumber * weight * (uxL - v2[0]) * phiUL(iu,0);
3934 for(
int ju = 0 ; ju < URowsleft; ju++)
3937 ek(2*iu,2*ju) += this->
fxi *
gBigNumber * weight * phiUL(iu,0) * phiUL(ju,0);
3955 int URowsleft = phiUL.
Rows();
3978 REAL uyL = sol_uL[1];
3981 v2[0] = bc.
Val2()(0,0);
3982 v2[1] = bc.
Val2()(1,0);
3986 v2[5] = bc.
Val2()(5,0);
3990 for(
int iu = 0 ; iu < URowsleft; iu++)
3994 ef(2*iu+1) += this->
fxi *
gBigNumber * weight * (uyL - v2[1]) * phiUL(iu,0);
3996 for(
int ju = 0 ; ju < URowsleft; ju++)
4000 ek(2*iu+1,2*ju+1) += this->
fxi *
gBigNumber * weight * phiUL(iu,0) * phiUL(ju,0);
4016 int URowsleft = phiUL.
Rows();
4042 v2[0] = bc.
Val2()(0,0);
4043 v2[1] = bc.
Val2()(1,0);
4047 v2[5] = bc.
Val2()(5,0);
4051 for(
int iu = 0 ; iu < URowsleft; iu++)
4054 ef(2*iu) += weight * ( v2[0]) * phiUL(iu,0);
4055 ef(2*iu+1) += weight * ( v2[1]) * phiUL(iu,0);
4070 int URowsleft = phiUL.
Rows();
4071 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
4082 int FirstQL = URowsleft * UStateVar + FirstUL;
4088 REAL n1 = normal[0];
4089 REAL n2 = normal[1];
4094 REAL qxL = sol_qL[0];
4095 REAL qyL = sol_qL[1];
4096 REAL dotqnL = (qxL*n1) + (qyL*n2);
4100 v2[0] = bc.
Val2()(0,0);
4101 v2[1] = bc.
Val2()(1,0);
4105 v2[5] = bc.
Val2()(5,0);
4106 REAL qN = (v2[2]*n1 + v2[3]*n2);
4110 for(
int iq=0; iq < QRowsleft; iq++)
4112 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
4113 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
4115 REAL vni = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex)*n1)+(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)*n2);
4117 ef(iq + FirstQL) += weight * ( this->
fxi * (
gBigNumber * ( dotqnL - qN ) * vni ) );
4121 for (
int jq=0; jq < QRowsleft; jq++)
4123 int jLvectorindex = dataleft[1].fVecShapeIndex[jq].first;
4124 int jLshapeindex = dataleft[1].fVecShapeIndex[jq].second;
4126 REAL vnj = (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(0,jLvectorindex)*n1)+(phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(1,jLvectorindex)*n2);
4127 ek(iq + FirstQL,jq + FirstQL) += weight * ( this->
fxi * (
gBigNumber * ( vnj ) * vni ) );
4144 int URowsleft = phiUL.
Rows();
4145 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
4156 int FirstQL = URowsleft * UStateVar + FirstUL;
4162 REAL n1 = normal[0];
4163 REAL n2 = normal[1];
4188 int GeoIDLeft = dataleft[1].gelElId;
4202 Kinverse = this->
Kinv(Kabsolute);
4206 v2[0] = bc.
Val2()(0,0);
4207 v2[1] = bc.
Val2()(1,0);
4211 v2[5] = bc.
Val2()(5,0);
4224 for (
int iq=0; iq < QRowsleft; iq++)
4227 int iLvectorindex = dataleft[1].fVecShapeIndex[iq].first;
4228 int iLshapeindex = dataleft[1].fVecShapeIndex[iq].second;
4233 REAL e1e1 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))*(n1);
4234 REAL e2e2 = (phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex))*(n2);
4236 ef(iq + FirstQL) += (1.0) * weight * (e1e1 + e2e2 ) * (v2[4]);
4241 REAL e1e1 = (Kabsolute(0,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
4242 Kabsolute(0,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n1);
4244 REAL e2e2 = (Kabsolute(1,0)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(0,iLvectorindex))+
4245 Kabsolute(1,1)*(phiQL(iLshapeindex,0)*dataleft[1].fNormalVec(1,iLvectorindex)))*(n2);
4247 ef(iq + FirstQL) += (1.0) * weight * (e1e1 + e2e2 ) * (v2[4]);
4263 int URowsleft = phiUL.
Rows();
4264 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
4265 int PRowsleft = phiPL.
Rows();
4266 int SRowsleft = phiSL.
Rows();
4275 int FirstQL = URowsleft * UStateVar + FirstUL;
4276 int FirstPL = QRowsleft + FirstQL;
4277 int FirstSL = PRowsleft + FirstPL;
4281 REAL n1 = normal[0];
4282 REAL n2 = normal[1];
4301 REAL TimeStep = this->
fDeltaT;
4302 REAL Theta = this->
fTheta;
4307 int GeoIDLeft = dataleft[1].gelElId;
4321 Kinverse = this->
Kinv(Kabsolute);
4327 REAL rockporosityl, oildensityl, waterdensityl;
4328 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
4330 REAL oilviscosityl, waterviscosityl;
4331 REAL doilviscositydpl, dwaterviscositydpl;
4333 REAL bulklambdal, oillambdal, waterlambdal;
4334 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
4335 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
4337 REAL bulkfoill, bulkfwaterl;
4338 REAL dbulkfoildpl, dbulkfwaterdpl;
4339 REAL dbulkfoildsl, dbulkfwaterdsl;
4345 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
4346 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
4347 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
4348 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
4349 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
4350 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
4351 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
4352 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
4353 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
4354 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
4357 v2[0] = bc.
Val2()(0,0);
4358 v2[1] = bc.
Val2()(1,0);
4362 v2[5] = bc.
Val2()(5,0);
4363 REAL qN = (v2[2]*n1 + v2[3]*n2);
4367 REAL UpwindSaturation = 0.0;
4389 this->
fWater(bulkfwaterl, sol_pL[VecPos], v2[5], dbulkfwaterdpl, dbulkfwaterdsl);
4390 UpwindSaturation = bulkfwaterl;
4414 for(
int isat=0; isat < SRowsleft; isat++)
4416 REAL ResidualPart = (Theta) * (TimeStep) * ( (UpwindSaturation) * qN );
4417 ef(isat + FirstSL) -= (-1.0) * weight * phiSL(isat,0) * ResidualPart;
4431 int URowsleft = phiUL.
Rows();
4432 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
4433 int PRowsleft = phiPL.
Rows();
4434 int SRowsleft = phiSL.
Rows();
4443 int FirstQL = URowsleft * UStateVar + FirstUL;
4444 int FirstPL = QRowsleft + FirstQL;
4445 int FirstSL = PRowsleft + FirstPL;
4449 REAL n1 = normal[0];
4450 REAL n2 = normal[1];
4460 REAL qxL = sol_qL[0];
4461 REAL qyL = sol_qL[1];
4462 REAL dotqnL = (qxL*n1) + (qyL*n2);
4469 REAL TimeStep = this->
fDeltaT;
4470 REAL Theta = this->
fTheta;
4475 int GeoIDLeft = dataleft[1].gelElId;
4489 Kinverse = this->
Kinv(Kabsolute);
4495 REAL rockporosityl, oildensityl, waterdensityl;
4496 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
4498 REAL oilviscosityl, waterviscosityl;
4499 REAL doilviscositydpl, dwaterviscositydpl;
4501 REAL bulklambdal, oillambdal, waterlambdal;
4502 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
4503 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
4505 REAL bulkfoill, bulkfwaterl;
4506 REAL dbulkfoildpl, dbulkfwaterdpl;
4507 REAL dbulkfoildsl, dbulkfwaterdsl;
4513 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
4514 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
4515 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
4516 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
4517 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
4518 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
4519 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
4520 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
4521 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
4522 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
4525 v2[0] = bc.
Val2()(0,0);
4526 v2[1] = bc.
Val2()(1,0);
4530 v2[5] = bc.
Val2()(5,0);
4536 REAL UpwindSaturation = 0.0;
4541 UpwindSaturation = bulkfwaterl;
4543 for(
int isat=0; isat<SRowsleft; isat++)
4545 for(
int jsat=0; jsat<SRowsleft; jsat++)
4547 ek(isat + FirstSL,jsat + FirstSL) -= (-1.0) * weight
4548 * (Theta) * (TimeStep) * phiSL(isat,0) * dbulkfwaterdsl * phiSL(jsat,0) * dotqnL;
4556 UpwindSaturation = bulkfwaterl;
4557 if (dotqnL < 0.0 &&
fabs(dotqnL) > 1.0e-10) { std::cout <<
"Boundary condition error: inflow detected in outflow boundary condition: dotqnL = " << dotqnL <<
"\n";}
4561 for (
int isat=0; isat < SRowsleft; isat++) {
4563 for (
int jq=0; jq<QRowsleft; jq++)
4565 int jLvectorindex = dataleft[1].fVecShapeIndex[jq].first;
4566 int jLshapeindex = dataleft[1].fVecShapeIndex[jq].second;
4570 (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(0,jLvectorindex)) * (n1) +
4571 (phiQL(jLshapeindex,0)*dataleft[1].fNormalVec(1,jLvectorindex)) * (n2) ;
4574 ek(isat + FirstSL,jq + FirstQL) -= (-1.0) * weight * (Theta) * (TimeStep) * phiSL(isat,0) * (UpwindSaturation) * dotprodL;
4581 for(
int isat=0; isat<SRowsleft; isat++)
4583 REAL ResidualPart = (Theta) * (TimeStep) * ( (UpwindSaturation) * dotqnL );
4584 ef(isat + FirstSL) -= (-1.0) * weight * phiSL(isat,0) * ResidualPart;
4598 int URowsleft = phiUL.
Rows();
4599 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
4600 int PRowsleft = phiPL.
Rows();
4601 int SRowsleft = phiSL.
Rows();
4610 int FirstQL = URowsleft * UStateVar + FirstUL;
4611 int FirstPL = QRowsleft + FirstQL;
4612 int FirstSL = PRowsleft + FirstPL;
4616 REAL n1 = normal[0];
4617 REAL n2 = normal[1];
4636 REAL TimeStep = this->
fDeltaT;
4637 REAL Theta = this->
fTheta;
4642 int GeoIDLeft = dataleft[1].gelElId;
4656 Kinverse = this->
Kinv(Kabsolute);
4662 REAL rockporosityl, oildensityl, waterdensityl;
4663 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
4665 REAL oilviscosityl, waterviscosityl;
4666 REAL doilviscositydpl, dwaterviscositydpl;
4668 REAL bulklambdal, oillambdal, waterlambdal;
4669 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
4670 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
4672 REAL bulkfoill, bulkfwaterl;
4673 REAL dbulkfoildpl, dbulkfwaterdpl;
4674 REAL dbulkfoildsl, dbulkfwaterdsl;
4680 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
4681 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
4682 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
4683 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
4684 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
4685 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
4686 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
4687 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
4688 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
4689 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
4692 v2[0] = bc.
Val2()(0,0);
4693 v2[1] = bc.
Val2()(1,0);
4697 v2[5] = bc.
Val2()(5,0);
4698 REAL qN = (v2[2]*n1 + v2[3]*n2);
4700 REAL UpwindSaturation = 0.0;
4711 this->
fWater(bulkfwaterl, sol_pL[VecPos], v2[5], dbulkfwaterdpl, dbulkfwaterdsl);
4712 UpwindSaturation = bulkfwaterl;
4719 for(
int isat=0; isat<SRowsleft; isat++)
4722 REAL ResidualPart = (1-Theta) * (TimeStep) * ( (UpwindSaturation) * qN );
4723 ef(isat + FirstSL) -= (-1.0) * weight * phiSL(isat,0) * ResidualPart;
4737 int URowsleft = phiUL.
Rows();
4738 int QRowsleft = dataleft[1].fVecShapeIndex.
NElements();
4739 int PRowsleft = phiPL.
Rows();
4740 int SRowsleft = phiSL.
Rows();
4749 int FirstQL = URowsleft * UStateVar + FirstUL;
4750 int FirstPL = QRowsleft + FirstQL;
4751 int FirstSL = PRowsleft + FirstPL;
4755 REAL n1 = normal[0];
4756 REAL n2 = normal[1];
4766 REAL qxL = sol_qL[0];
4767 REAL qyL = sol_qL[1];
4768 REAL dotqnL = (qxL*n1) + (qyL*n2);
4775 REAL TimeStep = this->
fDeltaT;
4776 REAL Theta = this->
fTheta;
4781 int GeoIDLeft = dataleft[1].gelElId;
4795 Kinverse = this->
Kinv(Kabsolute);
4801 REAL rockporosityl, oildensityl, waterdensityl;
4802 REAL drockporositydpl, doildensitydpl, dwaterdensitydpl;
4804 REAL oilviscosityl, waterviscosityl;
4805 REAL doilviscositydpl, dwaterviscositydpl;
4807 REAL bulklambdal, oillambdal, waterlambdal;
4808 REAL dbulklambdadpl, doillambdadpl, dwaterlambdadpl;
4809 REAL dbulklambdadsl, doillambdadsl, dwaterlambdadsl;
4811 REAL bulkfoill, bulkfwaterl;
4812 REAL dbulkfoildpl, dbulkfwaterdpl;
4813 REAL dbulkfoildsl, dbulkfwaterdsl;
4819 this->
Porosity(sol_pL[VecPos], rockporosityl, drockporositydpl);
4820 this->
RhoOil(sol_pL[VecPos], oildensityl, doildensitydpl);
4821 this->
RhoWater(sol_pL[VecPos], waterdensityl, dwaterdensitydpl);
4822 this->
OilViscosity(sol_pL[VecPos], oilviscosityl, doilviscositydpl);
4823 this->
WaterViscosity(sol_pL[VecPos], waterviscosityl, dwaterviscositydpl);
4824 this->
OilLabmda(oillambdal, sol_pL[VecPos], sol_sL[VecPos], doillambdadpl, doillambdadsl);
4825 this->
WaterLabmda(waterlambdal, sol_pL[VecPos], sol_sL[VecPos], dwaterlambdadpl, dwaterlambdadsl);
4826 this->
Labmda(bulklambdal, sol_pL[VecPos], sol_sL[VecPos], dbulklambdadpl, dbulklambdadsl);
4827 this->
fOil(bulkfoill, sol_pL[VecPos], sol_sL[VecPos], dbulkfoildpl, dbulkfoildsl);
4828 this->
fWater(bulkfwaterl, sol_pL[VecPos], sol_sL[VecPos], dbulkfwaterdpl, dbulkfwaterdsl);
4831 v2[0] = bc.
Val2()(0,0);
4832 v2[1] = bc.
Val2()(1,0);
4836 v2[5] = bc.
Val2()(5,0);
4839 REAL UpwindSaturation = 0.0;
4843 UpwindSaturation = bulkfwaterl;
4847 UpwindSaturation = bulkfwaterl;
4848 if (dotqnL < 0.0 &&
fabs(dotqnL) > 1.0e-12) {std::cout <<
"Boundary condition error: inflow detected in outflow boundary condition: dotqnL = " << dotqnL <<
"\n";}
4852 for(
int isat=0; isat<SRowsleft; isat++)
4854 REAL ResidualPart = (1-Theta) * (TimeStep) * ( (UpwindSaturation) * dotqnL );
4855 ef(isat + FirstSL) -= (-1.0) * weight * phiSL(isat,0) * ResidualPart;
4862 if(!strcmp(
"BulkVelocity",name.c_str()))
return 1;
4863 if(!strcmp(
"WaterVelocity",name.c_str()))
return 2;
4864 if(!strcmp(
"OilVelocity",name.c_str()))
return 3;
4865 if(!strcmp(
"WeightedPressure",name.c_str()))
return 4;
4866 if(!strcmp(
"WaterSaturation",name.c_str()))
return 5;
4867 if(!strcmp(
"OilSaturation",name.c_str()))
return 6;
4868 if(!strcmp(
"WaterDensity",name.c_str()))
return 7;
4869 if(!strcmp(
"OilDensity",name.c_str()))
return 8;
4870 if(!strcmp(
"RockPorosity",name.c_str()))
return 9;
4871 if(!strcmp(
"GravityVelocity",name.c_str()))
return 10;
4872 if(!strcmp(
"Kabsolute",name.c_str()))
return 11;
4873 if(!strcmp(
"SwExact",name.c_str()))
return 12;
4874 if(!strcmp(
"Displacement",name.c_str()))
return 13;
4875 if(!strcmp(
"SigmaX",name.c_str()))
return 14;
4876 if(!strcmp(
"SigmaY",name.c_str()))
return 15;
4882 if(var == 1)
return 2;
4883 if(var == 2)
return 2;
4884 if(var == 3)
return 2;
4885 if(var == 4)
return 1;
4886 if(var == 5)
return 1;
4887 if(var == 6)
return 1;
4888 if(var == 7)
return 1;
4889 if(var == 8)
return 1;
4890 if(var == 9)
return 1;
4891 if(var == 10)
return 2;
4892 if(var == 11)
return 3;
4893 if(var == 12)
return 1;
4894 if(var == 13)
return 3;
4895 if(var == 14)
return 1;
4896 if(var == 15)
return 1;
4906 SolU = datavec[0].sol[0];
4907 SolQ = datavec[1].sol[0];
4908 SolP = datavec[2].sol[0];
4909 SolS = datavec[3].sol[0];
4910 SolQG = datavec[4].sol[0];
4913 dSolU = datavec[0].dsol[0];
4915 axesU = datavec[0].axes;
4923 REAL Tau, DSolxy[2][2];
4927 Solout[0] = SolQ[0];
4928 Solout[1] = SolQ[1];
4933 Solout[0] = SolP[0];
4938 Solout[0] = SolS[0];
4943 Solout[0] = 1.0-SolS[0];
4948 Solout[0] = SolQG[0];
4949 Solout[1] = SolQG[1];
4960 int iel = datavec[0].gelElId;
4968 Kinverse=this->
Kinv(Kabsolute);
4971 Solout[0] = Kabsolute(0,0);
4972 Solout[1] = Kabsolute(1,1);
4973 Solout[2] = Kabsolute(2,2);
4981 Solout[0] = SolSExact[0];
4986 Solout[0] = SolU[0];
4987 Solout[1] = SolU[1];
4994 DSolxy[0][0] = dSolU(0,0)*axesU(0,0)+dSolU(1,0)*axesU(1,0);
4995 DSolxy[1][0] = dSolU(0,0)*axesU(0,1)+dSolU(1,0)*axesU(1,1);
4997 DSolxy[0][1] = dSolU(0,1)*axesU(0,0)+dSolU(1,1)*axesU(1,0);
4998 DSolxy[1][1] = dSolU(0,1)*axesU(0,1)+dSolU(1,1)*axesU(1,1);
5000 divu = DSolxy[0][0]+DSolxy[1][1]+0.0;
5002 REAL lambda,lambdau, mu, Balpha, Sestr;
5010 epsx = DSolxy[0][0];
5011 epsy = DSolxy[1][1];
5012 epsxy = 0.5*(DSolxy[1][0]+DSolxy[0][1]);
5013 REAL C11 = 4*(mu)*(lambda+mu)/(lambda+2*mu);
5014 REAL C22 = 2*(mu)*(lambda)/(lambda+2*mu);
5018 SigX = C11*epsx+C22*epsy;
5019 SigY = C11*epsy+C22*epsx;
5025 SigX = ((lambda + 2*mu)*(epsx) + (lambda)*epsy - Balpha*SolP[0]);
5026 SigY = ((lambda + 2*mu)*(epsy) + (lambda)*epsx - Balpha*SolP[0]);
5027 SigZ = lambda*divu - Balpha*SolP[0];
5046 int nref = datavec.
size();
5047 for(
int i = 0; i<nref; i++ )
5049 datavec[i].SetAllRequirements(
false);
5050 datavec[i].fNeedsSol =
true;
5051 datavec[i].fNeedsNeighborSol =
true;
5052 datavec[i].fNeedsNeighborCenter =
false;
5053 datavec[i].fNeedsNormal =
true;
5059 int nref = datavec.
size();
5060 for(
int i = 0; i<nref; i++)
5062 datavec[i].fNeedsSol =
true;
5063 datavec[i].fNeedsNormal =
true;
5064 datavec[i].fNeedsNeighborSol =
true;
Defines the interface which material objects need to implement for discontinuous Galerkin formulation...
virtual void Execute(const TPZVec< REAL > &x, TPZVec< TVar > &f, TPZFMatrix< TVar > &df)
Performs function computation.
void OilLabmda(REAL &OilLabmda, REAL Po, REAL Sw, REAL &dOilLabmdaDPo, REAL &dOilLabmdaDSw)
Oil mobility. .
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ fabs
void Labmda(REAL &Labmda, REAL Pw, REAL Sw, REAL &dLabmdaDPw, REAL &dLabmdaDSw)
Bulk mobility. .
REAL fGamma
Parameter representing temporal scheme for conservation equation.
virtual void Contribute(TPZVec< TPZMaterialData > &datavec, REAL weight, TPZFMatrix< STATE > &ef) override
It computes a contribution to the stiffness matrix and load vector at one integration point to multip...
int ClassId() const override
Unique identifier for serialization purposes.
TPZManVector< REAL, 3 > normal
normal to the element at the integration point
virtual int NStateVariables() const override
Returns the number of state variables associated with the material.
Contains definitions to LOGPZ_DEBUG, LOGPZ_INFO, LOGPZ_WARN, LOGPZ_ERROR and LOGPZ_FATAL, and the implementation of the inline InitializePZLOG(string) function using log4cxx library or not. It must to be called out of "#ifdef LOG4CXX" scope.
virtual std::string Name() override
Returns the name of the material.
clarg::argBool bc("-bc", "binary checkpoints", false)
void OilViscosity(REAL po, REAL &OilViscosity, REAL &dOilViscosityDpo)
Oil viscosity. .
TPZAutoPointer< TPZFunction< STATE > > fBCForcingFunction
Pointer to bc forcing function, it is a variable boundary condition at differential equation...
REAL RhoWaterSC()
Water density on standard conditions - kg/m3.
virtual void FillDataRequirements(TPZVec< TPZMaterialData > &datavec) override
Fill material data parameter with necessary requirements for the Contribute method. Here, in base class, all requirements are considered as necessary. Each derived class may optimize performance by selecting only the necessary data.
void CapillaryPressure(REAL So, REAL &pc, REAL &DpcDSo)
Capilar pressure. .
void WaterLabmda(REAL &WaterLabmda, REAL Pw, REAL Sw, REAL &dWaterLabmdaDPw, REAL &dWaterLabmdaDSw)
Water mobility. .
virtual int VariableIndex(const std::string &name)
Returns the variable index associated with the name.
void Kro(REAL Sw, REAL &Kro, REAL &dKroDSw)
Oil relative permeability. .
virtual int Dimension() const override
Returns the integrable dimension of the material.
void RhoOil(REAL po, REAL &RhoOil, REAL &dRhoOilDpo)
void fOil(REAL &fOil, REAL Pw, REAL Sw, REAL &dfOilDPw, REAL &dfOilDSw)
Fractional oil flux. .
STATE BiotAlpha()
Biot parameter Parameter. .
REAL fRhoref
density reference - kg/m3
TPZStack< TPZFMatrix< REAL > > fKabsoluteMap
K map.
void WaterViscosity(REAL po, REAL &WaterViscosity, REAL &dWaterViscosityDpo)
Water viscosity. .
virtual void ApplyUyD(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
void fstar(REAL &fStar, REAL Pw, REAL Sw, REAL Gdotn, REAL &dfstarDPw, REAL &dfstarDSw)
Fractional product upwind function, Gdotn > 0 means water decrease (dSw/dt < 0), Gdotn < 0 means wate...
This class implements a simple vector storage scheme for a templated class T. Utility.
REAL fQref
Pressure reference - Pa.
virtual void ApplySin(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
virtual int ClassId() const override
Unique identifier for serialization purposes.
TPZFMatrix< STATE > & Val2(int loadcase=0)
int fDim
Problem dimension.
REAL fLref
Characteristic length - m.
virtual void ApplySout(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
virtual void Print(std::ostream &out=std::cout)
Prints out the data associated with the material.
virtual void ApplySigmaN(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
STATE LameMu()
Lame Second Parameter. .
bool fYorN
Use or not K map.
Contains the TPZBndCond class which implements a boundary condition for TPZMaterial objects...
int Zero() override
Makes Zero all the elements.
virtual void Solution(TPZVec< TPZMaterialData > &datavec, int var, TPZVec< STATE > &Solout) override
Returns the solution associated with the var index based on the finite element approximation.
int64_t size() const
Returns the number of elements of the vector.
virtual void Resize(const int64_t newsize, const T &object)
Resizes the vector object reallocating the necessary storage, copying the existing objects to the new...
REAL fEtaref
viscosity reference - Pa s
virtual void ApplyPN(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
virtual int VariableIndex(const std::string &name) override
Contains TPZMatrixclass which implements full matrix (using column major representation).
#define DebugStop()
Returns a message to user put a breakpoint in.
This class defines the boundary condition for TPZMaterial objects.
REAL fPref
Pressure reference - Pa.
void fWater(REAL &fWater, REAL Pw, REAL Sw, REAL &dfWaterDPw, REAL &dfWaterDSw)
Fractional water flux. .
int64_t Rows() const
Returns number of rows.
virtual void ContributeBCInterface(TPZMaterialData &data, TPZMaterialData &dataleft, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to residual vector at one BC integration point.
Material to solve a 2d multiphase transport problem by multiphysics simulation.
REAL fDeltaT
Simulation time step.
TPZFMatrix< STATE > & Val1()
void SetKMap(TPZStack< TPZFMatrix< REAL > > KabsoluteMap)
STATE Se()
//Se o 1/M coeficiente poroelastico de armazenamento a volume constante.
virtual void Print(std::ostream &out) override
Prints out the data associated with the material.
static REAL gBigNumber
Big number to penalization method, used for Dirichlet conditions.
virtual void ApplyUxD(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
int32_t Hash(std::string str)
TPZAutoPointer< TPZFunction< STATE > > fTimedependentFunctionExact
Pointer to time dependent exact solution function, needed to calculate exact error.
STATE LameLambdaU()
Undrained Lame First Parameter. .
void fOilstar(REAL &fOstar, REAL Pw, REAL Sw, REAL &dfOstarDPw, REAL &dfOstarDSw)
Fractional product function, oil decrease direction (dSw/dt > 0). .
void Porosity(REAL po, REAL &poros, REAL &dPorosDp)
Rock porosity. .
void fWaterstar(REAL &fWstar, REAL Pw, REAL Sw, REAL &dfWstarDPw, REAL &dfWstarDSw)
Fractional product function, water decrease direction (dSw/dt < 0). .
REAL fKref
Permeability reference - m2.
virtual void ContributeInterface(TPZMaterialData &data, TPZMaterialData &dataleft, TPZMaterialData &dataright, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef) override
It computes a contribution to stiffness matrix and load vector at one integration point...
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ log
virtual int NSolutionVariables(int var)
Returns the number of variables associated with the variable indexed by var.
REAL RhoOilSC()
Oil density on standard conditions - kg/m3.
This class implements a stack object. Utility.
void Krw(REAL Sw, REAL &Krw, REAL &dKrwSo)
Water relative permeability. .
virtual void FillBoundaryConditionDataRequirement(int type, TPZVec< TPZMaterialData > &datavec) override
This method defines which parameters need to be initialized in order to compute the contribution of t...
virtual void ContributeBC(TPZVec< TPZMaterialData > &datavec, REAL weight, TPZFMatrix< STATE > &ef, TPZBndCond &bc) override
It computes a contribution to the stiffness matrix and load vector at one BC integration point to mul...
expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ expr_ exp
int Resize(const int64_t newRows, const int64_t wCols) override
Redimension a matrix, but maintain your elements.
int64_t NElements() const
Returns the number of elements of the vector.
virtual void ApplyQnD(TPZMaterialData &data, TPZVec< TPZMaterialData > &dataleft, REAL weight, TPZFMatrix< STATE > &ek, TPZFMatrix< STATE > &ef, TPZBndCond &bc)
void LoadKMap(std::string MaptoRead)
Absolute permeability.
void K(TPZFMatrix< REAL > &Kab)
Absolute permeability.
REAL fTheta
Parameter representing temporal scheme for transport equation.
REAL fTime
Simulation current time.
void push_back(const T object)
virtual int NSolutionVariables(int var) override
Returns the number of variables associated with the variable indexed by var.
STATE LameLambda()
Lame First Parameter. .
void SWaterstar(REAL &Swstar, REAL &Po, REAL &Sw)
Water saturation maximum value of the fractional flow product function. .
TPZFMatrix< REAL > Gravity()
Gravity.
TPZFMatrix< REAL > Kinv(TPZFMatrix< REAL > &Kab)
Absolute permeability inverse.
REAL fxi
Big number balance.
int fPlaneStress
plane stress condition
void RhoWater(REAL pw, REAL &RhoWater, REAL &dRhoWaterDpo)