当前位置: 首页>>代码示例>>C++>>正文


C++ BaseType::wellRates方法代码示例

本文整理汇总了C++中BaseType::wellRates方法的典型用法代码示例。如果您正苦于以下问题:C++ BaseType::wellRates方法的具体用法?C++ BaseType::wellRates怎么用?C++ BaseType::wellRates使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BaseType的用法示例。


在下文中一共展示了BaseType::wellRates方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setWellSolutions

        /// Set wellSolutions() based on the base class members.
        void setWellSolutions(const PhaseUsage& pu)
        {
            // Set nw and np, or return if no wells.
            if (wells_.get() == nullptr) {
                return;
            }
            const int nw = wells_->number_of_wells;
            if (nw == 0) {
                return;
            }
            const int np = wells_->number_of_phases;

            well_solutions_.clear();
            well_solutions_.resize(nw * np, 0.0);
            std::vector<double> g = {1.0,1.0,0.01};
            for (int w = 0; w < nw; ++w) {
                WellControls* wc = wells_->ctrls[w];

                // The current control in the well state overrides
                // the current control set in the Wells struct, which
                // is instead treated as a default.
                const int current = currentControls()[w];
                well_controls_set_current( wc, current);
                const WellType& well_type = wells_->type[w];

                switch (well_controls_iget_type(wc, current)) {
                case THP: // Intentional fall-through
                case BHP:
                    if (well_type == INJECTOR) {
                        for (int p = 0; p < np; ++p)  {
                            well_solutions_[w] += wellRates()[np*w + p] * wells_->comp_frac[np*w + p];
                        }
                    } else {
                        for (int p = 0; p < np; ++p) {
                            well_solutions_[w] += g[p] * wellRates()[np*w + p];
                        }
                    }
                    break;
                case RESERVOIR_RATE: // Intentional fall-through
                case SURFACE_RATE:
                    wellSolutions()[w] = bhp()[w];
                    break;
                }

                double total_rates = 0.0;
                for (int p = 0; p < np; ++p)  {
                    total_rates += g[p] * wellRates()[np*w + p];
                }

                const int waterpos = pu.phase_pos[Water];
                const int gaspos = pu.phase_pos[Gas];

                assert(np == 3 || (np == 2 && !pu.phase_used[Gas]));
                // assumes the gas fractions are stored after water fractions
                if(std::abs(total_rates) > 0) {
                    if( pu.phase_used[Water] ) {
                        wellSolutions()[nw + w] = g[Water] * wellRates()[np*w + waterpos] / total_rates;
                    }
                    if( pu.phase_used[Gas] ) {
                        wellSolutions()[2*nw + w] = g[Gas] * wellRates()[np*w + gaspos] / total_rates ;
                    }
                } else {
                    if( pu.phase_used[Water] ) {
                        wellSolutions()[nw + w] = wells_->comp_frac[np*w + waterpos];
                    }
                    if( pu.phase_used[Gas] ) {
                        wellSolutions()[2*nw + w] = wells_->comp_frac[np*w + gaspos];
                    }
                }
            }
        }
开发者ID:babrodtk,项目名称:opm-simulators,代码行数:72,代码来源:WellStateFullyImplicitBlackoilDense.hpp


注:本文中的BaseType::wellRates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。