double UpscalerBase<Traits>::upscaleNTG() const { double total_vol = 0.0; double total_net_vol = 0.0; for (CellIter c = ginterf_.cellbegin(); c != ginterf_.cellend(); ++c) { total_vol += c->volume(); total_net_vol += c->volume()*res_prop_.ntg(c->index()); } return total_net_vol/total_vol; }
double UpscalerBase<Traits>::upscaleNetPorosity() const { double total_net_vol = 0.0; double total_pore_vol = 0.0; for (CellIter c = ginterf_.cellbegin(); c != ginterf_.cellend(); ++c) { total_net_vol += c->volume()*res_prop_.ntg(c->index()); total_pore_vol += c->volume()*res_prop_.porosity(c->index())*res_prop_.ntg(c->index()); } if (total_net_vol>0.0) return total_pore_vol/total_net_vol; else return 0.0; }
void getInverseMatrix(const CellIter& c, FullMatrix<Scalar,SP,FortranOrdering>& Binv) const { // Binv = (N*lambda*K*N' + t*diag(A)*(I - Q*Q')*diag(A))/vol // ^ ^^^^^^^^^^^^^^^^^^^^^^^^^^ // precomputed: n_ precomputed: second_term_ // t = 6/dim * trace(lambda*K) int ci = c->index(); int nf = Binv.numRows(); ImmutableFortranMatrix n(nf, dim, &n_[ci][0]); ImmutableFortranMatrix t2(nf, nf, &second_term_[ci][0]); Binv = t2; ImmutableFortranMatrix lambdaK(dim, dim, lambdaK_.data()); SharedFortranMatrix T2(nf, dim, &t2_[0]); // T2 <- N*lambda*K matMulAdd_NN(Scalar(1.0), n, lambdaK, Scalar(0.0), T2); // Binv <- (T2*N' + t*Binv) / vol(c) // == (N*lambda*K*N' + t*(diag(A) * (I - Q*Q') * diag(A))) / vol(c) // // where t = 6/d * TRACE(lambda*K) (== 2*TRACE(lambda*K) for 3D). // Scalar t = Scalar(6.0) * trace(lambdaK) / dim; matMulAdd_NT(Scalar(1.0) / c->volume(), T2, n, t / c->volume(), Binv ); }
double UpscalerBase<Traits>::upscaleSOWCR(const bool NTG) const { double total_sowcr = 0.0; double total_pore_vol = 0.0; if (NTG) { for (CellIter c = ginterf_.cellbegin(); c != ginterf_.cellend(); ++c) { total_sowcr += c->volume()*res_prop_.porosity(c->index())*res_prop_.ntg(c->index())*res_prop_.sowcr(c->index()); total_pore_vol += c->volume()*res_prop_.porosity(c->index())*res_prop_.ntg(c->index()); } } else { for (CellIter c = ginterf_.cellbegin(); c != ginterf_.cellend(); ++c) { total_sowcr += c->volume()*res_prop_.porosity(c->index())*res_prop_.sowcr(c->index()); total_pore_vol += c->volume()*res_prop_.porosity(c->index()); } } return total_sowcr/total_pore_vol; }
double SteadyStateUpscaler<Traits>::lastSaturationUpscaled() const { typedef typename GridInterface::CellIterator CellIter; double pore_vol = 0.0; double sat_vol = 0.0; for (CellIter c = this->ginterf_.cellbegin(); c != this->ginterf_.cellend(); ++c) { double cell_pore_vol = c->volume()*this->res_prop_.porosity(c->index()); pore_vol += cell_pore_vol; sat_vol += cell_pore_vol*last_saturation_state_[c->index()]; } // Dividing by pore volume gives average saturations. return sat_vol/pore_vol; }
std::pair<double, double> poreSatVolumes(const GridInterface& grid, const ReservoirProperties& rp, const std::vector<double>& sat) { typedef typename GridInterface::CellIterator CellIter; double pore_vol = 0.0; double sat_vol = 0.0; for (CellIter c = grid.cellbegin(); c != grid.cellend(); ++c) { double cell_pore_vol = c->volume()*rp.porosity(c->index()); pore_vol += cell_pore_vol; sat_vol += cell_pore_vol*sat[c->index()]; } // Dividing by pore volume gives average saturations. return std::make_pair(pore_vol, sat_vol); }