@@ -621,9 +621,10 @@ void construct_fluid(ComMod& com_mod, const mshType& lM, const SolutionStates& s
621621 Array<double > ksix (nsd,nsd);
622622 // Total resistance factor value of the RIS valves for the current element
623623 // at different quadrature points
624- Vector<double > risFactorTotalEl;
624+ Vector<double > urisFactorTotalEl;
625+ Array<double > urisValveVelTermTotalEl;
625626 if (com_mod.urisFlag ) {
626- uris::uris_compute_ris_factor (com_mod, lM, fs[0 ], e, risFactorTotalEl );
627+ uris::eval_uris_ris_factors_quadrature (com_mod, lM, fs[0 ], e, urisFactorTotalEl, urisValveVelTermTotalEl );
627628 }
628629
629630 for (int g = 0 ; g < fs[0 ].nG ; g++) {
@@ -660,13 +661,15 @@ void construct_fluid(ComMod& com_mod, const mshType& lM, const SolutionStates& s
660661 if (nsd == 3 ) {
661662 auto N0 = fs[0 ].N .rcol (g);
662663 auto N1 = fs[1 ].N .rcol (g);
663- double risFactorTotal = 0.0 ;
664+ double urisFactorTotal = 0.0 ;
665+ Vector<double > urisValveVelTermTotal (nsd);
664666 if (com_mod.urisFlag ) {
665- risFactorTotal = risFactorTotalEl (g);
667+ urisFactorTotal = urisFactorTotalEl (g);
668+ urisValveVelTermTotal = urisValveVelTermTotalEl.rcol (g);
666669 }
667670 fluid_3d_m (com_mod, vmsStab, fs[0 ].eNoN , fs[1 ].eNoN , w, ksix, N0 , N1 ,
668671 Nwx, Nqx, Nwxx, al, yl, bfl, lR, lK, K_inverse_darcy_permeability,
669- risFactorTotal );
672+ urisFactorTotal, urisValveVelTermTotal );
670673
671674 } else if (nsd == 2 ) {
672675 auto N0 = fs[0 ].N .rcol (g);
@@ -694,8 +697,8 @@ void construct_fluid(ComMod& com_mod, const mshType& lM, const SolutionStates& s
694697 // If the number of quadrature points is different for the continuity and
695698 // momentum function spaces, recompute the RIS factor
696699 if (com_mod.urisFlag ) {
697- if (static_cast < int >(risFactorTotalEl .size () ) != fs[1 ].nG ) {
698- uris::uris_compute_ris_factor (com_mod, lM, fs[1 ], e, risFactorTotalEl );
700+ if (urisFactorTotalEl .size () != fs[1 ].nG ) {
701+ uris::eval_uris_ris_factors_quadrature (com_mod, lM, fs[1 ], e, urisFactorTotalEl, urisValveVelTermTotalEl );
699702 }
700703 }
701704
@@ -724,13 +727,15 @@ void construct_fluid(ComMod& com_mod, const mshType& lM, const SolutionStates& s
724727 if (nsd == 3 ) {
725728 auto N0 = fs[0 ].N .rcol (g);
726729 auto N1 = fs[1 ].N .rcol (g);
727- double risFactorTotal = 0.0 ;
730+ double urisFactorTotal = 0.0 ;
731+ Vector<double > urisValveVelTermTotal (nsd);
728732 if (com_mod.urisFlag ) {
729- risFactorTotal = risFactorTotalEl (g);
733+ urisFactorTotal = urisFactorTotalEl (g);
734+ urisValveVelTermTotal = urisValveVelTermTotalEl.rcol (g);
730735 }
731736 fluid_3d_c (com_mod, vmsStab, fs[0 ].eNoN , fs[1 ].eNoN , w, ksix, N0 , N1 ,
732737 Nwx, Nqx, Nwxx, al, yl, bfl, lR, lK, K_inverse_darcy_permeability,
733- risFactorTotal );
738+ urisFactorTotal, urisValveVelTermTotal );
734739
735740 } else if (nsd == 2 ) {
736741 auto N0 = fs[0 ].N .rcol (g);
@@ -1439,7 +1444,7 @@ void fluid_3d_c(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
14391444 const Array<double >& Kxi, const Vector<double >& Nw, const Vector<double >& Nq, const Array<double >& Nwx,
14401445 const Array<double >& Nqx, const Array<double >& Nwxx, const Array<double >& al, const Array<double >& yl,
14411446 const Array<double >& bfl, Array<double >& lR, Array3<double >& lK, double K_inverse_darcy_permeability,
1442- double risFactorTotal )
1447+ const double urisFactorTotal, const Vector< double >& urisValveVelTermTotal )
14431448{
14441449 #define n_debug_fluid3d_c
14451450 #ifdef debug_fluid3d_c
@@ -1654,7 +1659,7 @@ void fluid_3d_c(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
16541659
16551660 // In case of unfitted RIS, compute the delta function at the quad point,
16561661 // add the additional value to the stabilization param
1657- kT = kT + pow (risFactorTotal , 2.0 );
1662+ kT = kT + pow (urisFactorTotal , 2.0 );
16581663
16591664 double kU = u[0 ]*u[0 ]*Kxi (0 ,0 ) + u[1 ]*u[0 ]*Kxi (1 ,0 ) + u[2 ]*u[0 ]*Kxi (2 ,0 )
16601665 + u[0 ]*u[1 ]*Kxi (0 ,1 ) + u[1 ]*u[1 ]*Kxi (1 ,1 ) + u[2 ]*u[1 ]*Kxi (2 ,1 )
@@ -1682,11 +1687,11 @@ void fluid_3d_c(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
16821687 // up[2] = -tauM*(rho*rV[2] + px[2] - rS[2] + mu*K_inverse_darcy_permeability*u[2]);
16831688
16841689 up[0 ] = -tauM*(rho*rV[0 ] + px[0 ] - rS[0 ] + mu*K_inverse_darcy_permeability*u[0 ]
1685- + risFactorTotal*u [0 ]);
1690+ + urisFactorTotal*u[ 0 ] - urisValveVelTermTotal [0 ]);
16861691 up[1 ] = -tauM*(rho*rV[1 ] + px[1 ] - rS[1 ] + mu*K_inverse_darcy_permeability*u[1 ]
1687- + risFactorTotal*u [1 ]);
1692+ + urisFactorTotal*u[ 1 ] - urisValveVelTermTotal [1 ]);
16881693 up[2 ] = -tauM*(rho*rV[2 ] + px[2 ] - rS[2 ] + mu*K_inverse_darcy_permeability*u[2 ]
1689- + risFactorTotal*u [2 ]);
1694+ + urisFactorTotal*u[ 2 ] - urisValveVelTermTotal [2 ]);
16901695
16911696 for (int a = 0 ; a < eNoNw; a++) {
16921697 double uNx = u[0 ]*Nwx (0 ,a) + u[1 ]*Nwx (1 ,a) + u[2 ]*Nwx (2 ,a);
@@ -1695,7 +1700,7 @@ void fluid_3d_c(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
16951700 T1 = -rho*uNx + mu*(Nwxx (0 ,a) + Nwxx (1 ,a) + Nwxx (2 ,a))
16961701 + mu_x[0 ]*Nwx (0 ,a) + mu_x[1 ]*Nwx (1 ,a) + mu_x[2 ]*Nwx (2 ,a)
16971702 - mu*K_inverse_darcy_permeability*Nw (a)
1698- - risFactorTotal *Nw (a);
1703+ - urisFactorTotal *Nw (a);
16991704
17001705 updu[0 ][0 ][a] = mu_x[0 ]*Nwx (0 ,a) + d2u2[0 ]*mu_g*esNx[0 ][a] + T1 ;
17011706 updu[1 ][0 ][a] = mu_x[1 ]*Nwx (0 ,a) + d2u2[1 ]*mu_g*esNx[0 ][a];
@@ -1764,7 +1769,7 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
17641769 const Array<double >& Kxi, const Vector<double >& Nw, const Vector<double >& Nq, const Array<double >& Nwx,
17651770 const Array<double >& Nqx, const Array<double >& Nwxx, const Array<double >& al, const Array<double >& yl,
17661771 const Array<double >& bfl, Array<double >& lR, Array3<double >& lK, double K_inverse_darcy_permeability,
1767- double risFactorTotal )
1772+ const double urisFactorTotal, const Vector< double >& urisValveVelTermTotal )
17681773{
17691774 #define n_debug_fluid_3d_m
17701775 #ifdef debug_fluid_3d_m
@@ -2000,7 +2005,7 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
20002005
20012006 // In case of unfitted RIS, compute the delta function at the quad point,
20022007 // add the additional value to the stabilization param
2003- kT = kT + pow (risFactorTotal , 2.0 );
2008+ kT = kT + pow (urisFactorTotal , 2.0 );
20042009
20052010 double kU = u[0 ]*u[0 ]*Kxi (0 ,0 ) + u[1 ]*u[0 ]*Kxi (1 ,0 ) + u[2 ]*u[0 ]*Kxi (2 ,0 )
20062011 + u[0 ]*u[1 ]*Kxi (0 ,1 ) + u[1 ]*u[1 ]*Kxi (1 ,1 ) + u[2 ]*u[1 ]*Kxi (2 ,1 )
@@ -2035,11 +2040,11 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
20352040 // up[2] = -tauM*(rho*rV[2] + px[2] - rS[2] + mu*K_inverse_darcy_permeability * u[2]);
20362041
20372042 up[0 ] = -tauM*(rho*rV[0 ] + px[0 ] - rS[0 ] + mu*K_inverse_darcy_permeability * u[0 ]
2038- + risFactorTotal * u[0 ]);
2043+ + urisFactorTotal * u[ 0 ] - urisValveVelTermTotal [0 ]);
20392044 up[1 ] = -tauM*(rho*rV[1 ] + px[1 ] - rS[1 ] + mu*K_inverse_darcy_permeability * u[1 ]
2040- + risFactorTotal * u[1 ]);
2045+ + urisFactorTotal * u[ 1 ] - urisValveVelTermTotal [1 ]);
20412046 up[2 ] = -tauM*(rho*rV[2 ] + px[2 ] - rS[2 ] + mu*K_inverse_darcy_permeability * u[2 ]
2042- + risFactorTotal * u[2 ]);
2047+ + urisFactorTotal * u[ 2 ] - urisValveVelTermTotal [2 ]);
20432048
20442049 double tauC, tauB, pa;
20452050 double eps = std::numeric_limits<double >::epsilon ();
@@ -2121,7 +2126,7 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
21212126 T1 = -rho*uNx[a] + mu*(Nwxx (0 ,a) + Nwxx (1 ,a) + Nwxx (2 ,a))
21222127 + mu_x[0 ]*Nwx (0 ,a) + mu_x[1 ]*Nwx (1 ,a) + mu_x[2 ]*Nwx (2 ,a)
21232128 - mu*K_inverse_darcy_permeability*Nw (a)
2124- - risFactorTotal *Nw (a);
2129+ - urisFactorTotal *Nw (a);
21252130
21262131 updu[0 ][0 ][a] = mu_x[0 ]*Nwx (0 ,a) + d2u2[0 ]*mu_g*esNx[0 ][a] + T1 ;
21272132 updu[1 ][0 ][a] = mu_x[1 ]*Nwx (0 ,a) + d2u2[1 ]*mu_g*esNx[0 ][a];
@@ -2158,7 +2163,7 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
21582163 lK (0 ,a,b) = lK (0 ,a,b) + wl*(T2 + T1 );
21592164 // lK(0,a,b) = lK(0,a,b) + mu*K_inverse_darcy_permeability*wl*Nw(b)*Nw(a);
21602165 lK (0 ,a,b) = lK (0 ,a,b) + mu*K_inverse_darcy_permeability*wl*Nw (b)*Nw (a)
2161- + risFactorTotal *wl*Nw (b)*Nw (a);
2166+ + urisFactorTotal *wl*Nw (b)*Nw (a);
21622167
21632168 // dRm_a1/du_b2
21642169 T2 = mu*rM[1 ][0 ] + tauC*rM[0 ][1 ] + esNx[0 ][a]*mu_g*esNx[1 ][b] - rho*tauM*uaNx[a]*updu[1 ][0 ][b];
@@ -2177,7 +2182,7 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
21772182 lK (5 ,a,b) = lK (5 ,a,b) + wl*(T2 + T1 );
21782183 // lK(5,a,b) = lK(5,a,b) + mu*K_inverse_darcy_permeability*wl*Nw(b)*Nw(a);
21792184 lK (5 ,a,b) = lK (5 ,a,b) + mu*K_inverse_darcy_permeability*wl*Nw (b)*Nw (a)
2180- + risFactorTotal *wl*Nw (b)*Nw (a);
2185+ + urisFactorTotal *wl*Nw (b)*Nw (a);
21812186
21822187 // dRm_a2/du_b3
21832188 T2 = mu*rM[2 ][1 ] + tauC*rM[1 ][2 ] + esNx[1 ][a]*mu_g*esNx[2 ][b] - rho*tauM*uaNx[a]*updu[2 ][1 ][b];
@@ -2196,7 +2201,7 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
21962201 lK (10 ,a,b) = lK (10 ,a,b) + wl*(T2 + T1 );
21972202 // lK(10,a,b) = lK(10,a,b) + mu*K_inverse_darcy_permeability*wl*Nw(b)*Nw(a);
21982203 lK (10 ,a,b) = lK (10 ,a,b) + mu*K_inverse_darcy_permeability*wl*Nw (b)*Nw (a)
2199- + risFactorTotal *wl*Nw (b)*Nw (a);
2204+ + urisFactorTotal *wl*Nw (b)*Nw (a);
22002205 // dmsg << "lK(10,a,b): " << lK(10,a,b);
22012206 }
22022207 }
@@ -2222,11 +2227,11 @@ void fluid_3d_m(ComMod& com_mod, const int vmsFlag, const int eNoNw, const int e
22222227 // Local residue
22232228 for (int a = 0 ; a < eNoNw; a++) {
22242229 lR (0 ,a) = lR (0 ,a) + mu*K_inverse_darcy_permeability*w*Nw (a)*(u[0 ]+up[0 ])
2225- + risFactorTotal* w*Nw (a)*u[0 ];
2230+ + w*Nw (a)*(urisFactorTotal* u[0 ] - urisValveVelTermTotal[ 0 ]) ;
22262231 lR (1 ,a) = lR (1 ,a) + mu*K_inverse_darcy_permeability*w*Nw (a)*(u[1 ]+up[1 ])
2227- + risFactorTotal* w*Nw (a)*u[1 ];
2232+ + w*Nw (a)*(urisFactorTotal* u[1 ] - urisValveVelTermTotal[ 1 ]) ;
22282233 lR (2 ,a) = lR (2 ,a) + mu*K_inverse_darcy_permeability*w*Nw (a)*(u[2 ]+up[2 ])
2229- + risFactorTotal* w*Nw (a)*u[2 ];
2234+ + w*Nw (a)*(urisFactorTotal* u[2 ] - urisValveVelTermTotal[ 2 ]) ;
22302235 }
22312236
22322237}
0 commit comments