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


C++ opm::DeckConstPtr类代码示例

本文整理汇总了C++中opm::DeckConstPtr的典型用法代码示例。如果您正苦于以下问题:C++ DeckConstPtr类的具体用法?C++ DeckConstPtr怎么用?C++ DeckConstPtr使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1:

    IncompPropertiesSinglePhase::IncompPropertiesSinglePhase(Opm::DeckConstPtr deck,
                                                             Opm::EclipseStateConstPtr eclState,
                                                             const UnstructuredGrid& grid)
    {
        rock_.init(eclState, grid.number_of_cells, grid.global_cell, grid.cartdims);

        if (deck->hasKeyword("DENSITY")) {
            Opm::DeckRecordConstPtr densityRecord = deck->getKeyword("DENSITY")->getRecord(0);
            surface_density_ = densityRecord->getItem("OIL")->getSIDouble(0);
        } else {
            surface_density_ = 1000.0;
            OPM_MESSAGE("Input is missing DENSITY -- using a standard density of "
                        << surface_density_ << ".\n");
        }

        // This will be modified if we have a PVCDO specification.
        reservoir_density_ = surface_density_;

        if (deck->hasKeyword("PVCDO")) {
            Opm::DeckRecordConstPtr pvcdoRecord = deck->getKeyword("PVCDO")->getRecord(0);
            if (pvcdoRecord->getItem("OIL_COMPRESSIBILITY")->getSIDouble(0) != 0.0 ||
                pvcdoRecord->getItem("OIL_VISCOSIBILITY")->getSIDouble(0) != 0.0) {
                OPM_MESSAGE("Compressibility effects in PVCDO are ignored.");
            }
            reservoir_density_ /= pvcdoRecord->getItem("OIL_VOL_FACTOR")->getSIDouble(0);
            viscosity_ = pvcdoRecord->getItem("OIL_VISCOSITY")->getSIDouble(0);
        } else {
            viscosity_ = 1.0 * prefix::centi*unit::Poise;
            OPM_MESSAGE("Input is missing PVCDO -- using a standard viscosity of "
                        << viscosity_ << " and reservoir density equal to surface density.\n");
        }
    }
开发者ID:jepebe,项目名称:opm-core,代码行数:32,代码来源:IncompPropertiesSinglePhase.cpp

示例2: if

RockCompressibility::RockCompressibility(Opm::DeckConstPtr deck,
        Opm::EclipseStateConstPtr eclipseState)
    : pref_(0.0),
      rock_comp_(0.0)
{
    const auto tables = eclipseState->getTableManager();
    const auto& rocktabTables = tables->getRocktabTables();
    if (rocktabTables.size() > 0) {
        const auto& rocktabTable = rocktabTables.getTable<RocktabTable>(0);
        if (rocktabTables.size() != 1)
            OPM_THROW(std::runtime_error, "Can only handle a single region in ROCKTAB.");

        p_ = rocktabTable.getColumn("PO").vectorCopy( );
        poromult_ = rocktabTable.getColumn("PV_MULT").vectorCopy();
        if (rocktabTable.hasColumn("PV_MULT_TRAN")) {
            transmult_ =  rocktabTable.getColumn("PV_MULT_TRAN").vectorCopy();
        } else {
            transmult_ =  rocktabTable.getColumn("PV_MULT_TRANX").vectorCopy();
        }
    } else if (deck->hasKeyword("ROCK")) {
        Opm::DeckKeywordConstPtr rockKeyword = deck->getKeyword("ROCK");
        if (rockKeyword->size() != 1) {
            // here it would be better not to use std::cout directly but to add the
            // warning to some "warning list"...
            std::cout << "Can only handle a single region in ROCK ("<<rockKeyword->size()<<" regions specified)."
                      << " Ignoring all except for the first.\n";
        }

        pref_ = rockKeyword->getRecord(0)->getItem("PREF")->getSIDouble(0);
        rock_comp_ = rockKeyword->getRecord(0)->getItem("COMPRESSIBILITY")->getSIDouble(0);
    } else {
        std::cout << "**** warning: no rock compressibility data found in deck (ROCK or ROCKTAB)." << std::endl;
    }
}
开发者ID:jepebe,项目名称:opm-core,代码行数:34,代码来源:RockCompressibility.cpp

示例3: phaseUsageFromDeck

    /// Looks at presence of WATER, OIL and GAS keywords in deck
    /// to determine active phases.
    inline PhaseUsage phaseUsageFromDeck(Opm::DeckConstPtr deck)
    {
        PhaseUsage pu;
        std::fill(pu.phase_used, pu.phase_used + BlackoilPhases::MaxNumPhases, 0);

        // Discover phase usage.
        if (deck->hasKeyword("WATER")) {
            pu.phase_used[BlackoilPhases::Aqua] = 1;
        }
        if (deck->hasKeyword("OIL")) {
            pu.phase_used[BlackoilPhases::Liquid] = 1;
        }
        if (deck->hasKeyword("GAS")) {
            pu.phase_used[BlackoilPhases::Vapour] = 1;
        }
        pu.num_phases = 0;
        for (int i = 0; i < BlackoilPhases::MaxNumPhases; ++i) {
            pu.phase_pos[i] = pu.num_phases;
            pu.num_phases += pu.phase_used[i];
        }

        // Only 2 or 3 phase systems handled.
        if (pu.num_phases < 2 || pu.num_phases > 3) {
            OPM_THROW(std::runtime_error, "Cannot handle cases with " << pu.num_phases << " phases.");
        }

        // We need oil systems, since we do not support the keywords needed for
        // water-gas systems.
        if (!pu.phase_used[BlackoilPhases::Liquid]) {
            OPM_THROW(std::runtime_error, "Cannot handle cases with no OIL, i.e. water-gas systems.");
        }

        return pu;
    }
开发者ID:chflo,项目名称:opm-core,代码行数:36,代码来源:phaseUsageFromDeck.hpp

示例4: initFromDeck

        /// set the tables which specify the temperature dependence of the water viscosity
        void initFromDeck(std::shared_ptr<const PvtInterface> isothermalPvt,
                          Opm::DeckConstPtr deck,
                          Opm::EclipseStateConstPtr eclipseState)
        {
            isothermalPvt_ = isothermalPvt;
            watvisctTables_ = 0;

            // stuff which we need to get from the PVTW keyword
            const auto& pvtwKeyword = deck->getKeyword("PVTW");
            int numRegions = pvtwKeyword.size();
            pvtwRefPress_.resize(numRegions);
            pvtwRefB_.resize(numRegions);
            pvtwCompressibility_.resize(numRegions);
            pvtwViscosity_.resize(numRegions);
            pvtwViscosibility_.resize(numRegions);
            for (int regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
                const auto& pvtwRecord = pvtwKeyword.getRecord(regionIdx);
                pvtwRefPress_[regionIdx] = pvtwRecord.getItem("P_REF").getSIDouble(0);
                pvtwRefB_[regionIdx] = pvtwRecord.getItem("WATER_VOL_FACTOR").getSIDouble(0);
                pvtwViscosity_[regionIdx] = pvtwRecord.getItem("WATER_VISCOSITY").getSIDouble(0);
                pvtwViscosibility_[regionIdx] = pvtwRecord.getItem("WATER_VISCOSIBILITY").getSIDouble(0);
            }

            // quantities required for the temperature dependence of the viscosity
            // (basically we expect well-behaved VISCREF and WATVISCT keywords.)
            if (deck->hasKeyword("VISCREF")) {
                auto tables = eclipseState->getTableManager();
                watvisctTables_ = &tables->getWatvisctTables();
                const auto& viscrefKeyword = deck->getKeyword("VISCREF");

                assert(int(watvisctTables_->size()) == numRegions);
                assert(int(viscrefKeyword.size()) == numRegions);

                viscrefPress_.resize(numRegions);
                for (int regionIdx = 0; regionIdx < numRegions; ++ regionIdx) {
                    const auto& viscrefRecord = viscrefKeyword.getRecord(regionIdx);

                    viscrefPress_[regionIdx] = viscrefRecord.getItem("REFERENCE_PRESSURE").getSIDouble(0);
                }
            }

            // quantities required for the temperature dependence of the density
            if (deck->hasKeyword("WATDENT")) {
                const auto& watdentKeyword = deck->getKeyword("WATDENT");

                assert(int(watdentKeyword.size()) == numRegions);

                watdentRefTemp_.resize(numRegions);
                watdentCT1_.resize(numRegions);
                watdentCT2_.resize(numRegions);
                for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
                    const auto& watdentRecord = watdentKeyword.getRecord(regionIdx);

                    watdentRefTemp_[regionIdx] = watdentRecord.getItem("REFERENCE_TEMPERATURE").getSIDouble(0);
                    watdentCT1_[regionIdx] = watdentRecord.getItem("EXPANSION_COEFF_LINEAR").getSIDouble(0);
                    watdentCT2_[regionIdx] = watdentRecord.getItem("EXPANSION_COEFF_QUADRATIC").getSIDouble(0);
                }
            }
        }
开发者ID:chflo,项目名称:opm-core,代码行数:60,代码来源:ThermalWaterPvtWrapper.hpp

示例5:

void Rock<dim>::assignPorosity(Opm::DeckConstPtr deck,
                               const std::vector<int>& global_cell)
{
    porosity_.assign(global_cell.size(), 1.0);

    if (deck->hasKeyword("PORO")) {
        const std::vector<double>& poro = deck->getKeyword("PORO").getSIDoubleData();

        for (int c = 0; c < int(porosity_.size()); ++c) {
            porosity_[c] = poro[global_cell[c]];
        }
    }
}
开发者ID:qilicun,项目名称:opm-upscaling,代码行数:13,代码来源:Rock_impl.hpp

示例6:

    void
    PolymerInflowFromDeck::setInflowValues(Opm::DeckConstPtr deck,
                                           Opm::EclipseStateConstPtr eclipseState,
                                           size_t currentStep)
    {
        Opm::DeckKeywordConstPtr keyword = deck->getKeyword("WPOLYMER");
        
        //        Schedule schedule(deck);
        ScheduleConstPtr schedule = eclipseState->getSchedule();
        for (size_t recordNr = 0; recordNr < keyword->size(); recordNr++) {
            DeckRecordConstPtr record = keyword->getRecord(recordNr);

            const std::string& wellNamesPattern = record->getItem("WELL")->getTrimmedString(0);
            std::string wellName = record->getItem("WELL")->getTrimmedString(0);
            std::vector<WellPtr> wells = schedule->getWells(wellNamesPattern);
            for (auto wellIter = wells.begin(); wellIter != wells.end(); ++wellIter) {
                WellPtr well = *wellIter;
                WellInjectionProperties injection = well->getInjectionProperties(currentStep);
                if (injection.injectorType == WellInjector::WATER) {
                    WellPolymerProperties polymer = well->getPolymerProperties(currentStep);
                    wellPolymerRate_.insert(std::make_pair(wellName, polymer.m_polymerConcentration));
                } else {
                    OPM_THROW(std::logic_error, "For polymer injector you must have a water injector");
                }
            }
        }
    }
开发者ID:edbru,项目名称:opm-polymer,代码行数:27,代码来源:PolymerInflow.cpp

示例7: createGrdecl

    void GridManager::createGrdecl(Opm::DeckConstPtr deck, struct grdecl &grdecl)
    {
        // Extract data from deck.
        const std::vector<double>& zcorn = deck->getKeyword("ZCORN").getSIDoubleData();
        const std::vector<double>& coord = deck->getKeyword("COORD").getSIDoubleData();
        const int* actnum = NULL;
        if (deck->hasKeyword("ACTNUM")) {
            actnum = &(deck->getKeyword("ACTNUM").getIntData()[0]);
        }

        std::array<int, 3> dims;
        if (deck->hasKeyword("DIMENS")) {
            const auto& dimensKeyword = deck->getKeyword("DIMENS");
            dims[0] = dimensKeyword.getRecord(0).getItem(0).get< int >(0);
            dims[1] = dimensKeyword.getRecord(0).getItem(1).get< int >(0);
            dims[2] = dimensKeyword.getRecord(0).getItem(2).get< int >(0);
        } else if (deck->hasKeyword("SPECGRID")) {
            const auto& specgridKeyword = deck->getKeyword("SPECGRID");
            dims[0] = specgridKeyword.getRecord(0).getItem(0).get< int >(0);
            dims[1] = specgridKeyword.getRecord(0).getItem(1).get< int >(0);
            dims[2] = specgridKeyword.getRecord(0).getItem(2).get< int >(0);
        } else {
            OPM_THROW(std::runtime_error, "Deck must have either DIMENS or SPECGRID.");
        }

        // Collect in input struct for preprocessing.

        grdecl.zcorn = &zcorn[0];
        grdecl.coord = &coord[0];
        grdecl.actnum = actnum;
        grdecl.dims[0] = dims[0];
        grdecl.dims[1] = dims[1];
        grdecl.dims[2] = dims[2];

        if (deck->hasKeyword("MAPAXES")) {
            const auto& mapaxesKeyword = deck->getKeyword("MAPAXES");
            const auto& mapaxesRecord = mapaxesKeyword.getRecord(0);

            // memleak alert: here we need to make sure that C code
            // can properly take ownership of the grdecl.mapaxes
            // object. if it is not freed, it will result in a
            // memleak...
            double *cWtfMapaxes = static_cast<double*>(malloc(sizeof(double)*mapaxesRecord.size()));
            for (unsigned i = 0; i < mapaxesRecord.size(); ++i)
                cWtfMapaxes[i] = mapaxesRecord.getItem(i).getSIDouble(0);
            grdecl.mapaxes = cWtfMapaxes;
        } else
            grdecl.mapaxes = NULL;

    }
开发者ID:chflo,项目名称:opm-core,代码行数:50,代码来源:GridManager.cpp

示例8: getMapaxesValues

std::vector<double> getMapaxesValues(Opm::DeckConstPtr deck)
{
    const auto& mapaxesRecord = deck->getKeyword("MAPAXES").getRecord(0);
    std::vector<double> result;
    for (size_t itemIdx = 0; itemIdx < mapaxesRecord.size(); ++itemIdx) {
        const auto& curItem = mapaxesRecord.getItem(itemIdx);

        for (size_t dataItemIdx = 0; dataItemIdx < curItem.size(); ++dataItemIdx) {
            result.push_back(curItem.get< double >(dataItemIdx));
        }
    }
    return result;
}
开发者ID:chflo,项目名称:opm-core,代码行数:13,代码来源:mirror_grid.cpp

示例9: if

    TimeMap::TimeMap(Opm::DeckConstPtr deck) {
        // The default start date is not specified in the Eclipse
        // reference manual. We hence just assume it is same as for
        // the START keyword for Eclipse R100, i.e., January 1st,
        // 1983...
        boost::posix_time::ptime startTime(boost::gregorian::date(1983, 1, 1));

        // use the 'START' keyword to find out the start date (if the
        // keyword was specified)
        if (deck->hasKeyword("START")) {
            Opm::DeckKeywordConstPtr keyword = deck->getKeyword("START");
            startTime = timeFromEclipse(keyword->getRecord(/*index=*/0));
        }

        m_timeList.push_back( startTime );

        // find all "TSTEP" and "DATES" keywords in the deck and deal
        // with them one after another
        size_t numKeywords = deck->size();
        for (size_t keywordIdx = 0; keywordIdx < numKeywords; ++keywordIdx) {
            Opm::DeckKeywordConstPtr keyword = deck->getKeyword(keywordIdx);

            // We're only interested in "TSTEP" and "DATES" keywords,
            // so we ignore everything else here...
            if (keyword->name() != "TSTEP" &&
                keyword->name() != "DATES")
            {
                continue;
            }

            if (keyword->name() == "TSTEP")
                addFromTSTEPKeyword(keyword);
            else if (keyword->name() == "DATES")
                addFromDATESKeyword(keyword);
        }
    }
开发者ID:flikka,项目名称:opm-parser,代码行数:36,代码来源:TimeMap.cpp

示例10: initFromDeck

    /*!
     * \brief Reads all relevant material parameters form a cell of a parsed ECL deck.
     *
     * This requires that the opm-parser module is available.
     */
    void initFromDeck(Opm::DeckConstPtr deck)
    {
        enableHysteresis_ = false;

        if (!deck->hasKeyword("SATOPTS"))
            return;

        Opm::DeckItemConstPtr satoptsItem = deck->getKeyword("SATOPTS")->getRecord(0)->getItem(0);
        for (unsigned i = 0; i < satoptsItem->size(); ++i) {
            std::string satoptsValue = satoptsItem->getString(0);
            std::transform(satoptsValue.begin(),
                           satoptsValue.end(),
                           satoptsValue.begin(),
                           ::toupper);

            if (satoptsValue == "HYSTER")
                enableHysteresis_ = true;
        }

        // check for the (deprecated) HYST keyword
        if (deck->hasKeyword("HYST"))
            enableHysteresis_ = true;

        if (!enableHysteresis_)
            return;

        if (!deck->hasKeyword("EHYSTR"))
            OPM_THROW(std::runtime_error,
                      "Enabling hysteresis via the HYST parameter for SATOPTS requires the "
                      "presence of the EHYSTR keyword");

        Opm::DeckKeywordConstPtr ehystrKeyword = deck->getKeyword("EHYSTR");
        if (deck->hasKeyword("NOHYKR"))
            krHysteresisModel_ = -1;
        else {
            krHysteresisModel_ = ehystrKeyword->getRecord(0)->getItem("relative_perm_hyst")->getInt(0);
            if (krHysteresisModel_ != 0)
                OPM_THROW(std::runtime_error,
                          "Only the Carlson kr hystersis model (indicated by a 0 on the second item"
                          " of the 'EHYSTR' keyword) is supported");
        }

        if (deck->hasKeyword("NOHYPC"))
            pcHysteresisModel_ = -1;
        else {
            // if capillary pressure hysteresis is enabled, Eclipse always uses the
            // Killough model
            pcHysteresisModel_ = 0;
        }
    }
开发者ID:GitPaean,项目名称:opm-material,代码行数:55,代码来源:EclHysteresisConfig.hpp

示例11: init

    void BlackoilPVT::init(Opm::DeckConstPtr deck)
    {
        Opm::ParseMode parseMode;
        const auto eclipseState = std::make_shared<EclipseState>(deck , parseMode);
	region_number_ = 0;

	// Surface densities. Accounting for different orders in eclipse and our code.
	if (deck->hasKeyword("DENSITY")) {
        Opm::DeckRecordConstPtr densityRecord =
            deck->getKeyword("DENSITY")->getRecord(/*regionIdx=*/0);
	    densities_[Aqua]   = densityRecord->getItem("WATER")->getSIDouble(0);
	    densities_[Vapour] = densityRecord->getItem("GAS")->getSIDouble(0);
	    densities_[Liquid] = densityRecord->getItem("OIL")->getSIDouble(0);
	} else {
	    OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
	}

        // Water PVT
        if (deck->hasKeyword("PVTW")) {
            water_props_.reset(new MiscibilityWater(deck->getKeyword("PVTW")));
        } else {
            water_props_.reset(new MiscibilityWater(0.5*Opm::prefix::centi*Opm::unit::Poise)); // Eclipse 100 default 
        }

        // Oil PVT
        const auto& tables     = eclipseState->getTableManager();
        const auto& pvdoTables = tables->getPvdoTables();
        const auto& pvtoTables = tables->getPvtoTables();
        if (!pvdoTables.empty()) {
            const auto& pvdoTable = pvdoTables.getTable<PvdoTable>(0);
            oil_props_.reset(new MiscibilityDead(pvdoTable));
        } else if (pvtoTables.empty()) {
            // PVTOTables is a std::vector<>
            const auto& pvtoTable = pvtoTables[0];
            oil_props_.reset(new MiscibilityLiveOil(pvtoTable));
        } else if (deck->hasKeyword("PVCDO")) {
            auto *misc_water = new MiscibilityWater(0);
            misc_water->initFromPvcdo(deck->getKeyword("PVCDO"));
            oil_props_.reset(misc_water);
        } else {
            OPM_THROW(std::runtime_error, "Input is missing PVDO and PVTO\n");
        }

	// Gas PVT
        const auto& pvdgTables = tables->getPvdgTables();
        const auto& pvtgTables = tables->getPvtgTables();
        if (!pvdgTables.empty()) {
            const auto& pvdgTable = pvdgTables.getTable<PvdgTable>(0);
            gas_props_.reset(new MiscibilityDead(pvdgTable));
        } else if (pvtgTables.empty()) {
            gas_props_.reset(new MiscibilityLiveGas(pvtgTables[0]));
        } else {
	    OPM_THROW(std::runtime_error, "Input is missing PVDG and PVTG\n");
        }
    }
开发者ID:jokva,项目名称:opm-porsol,代码行数:55,代码来源:BlackoilPVT.cpp

示例12: init

    void PvtPropertiesIncompFromDeck::init(Opm::DeckConstPtr deck)
    {
        // So far, this class only supports a single PVT region. TODO?
        int region_number = 0;

        PhaseUsage phase_usage = phaseUsageFromDeck(deck);
        if (phase_usage.phase_used[PhaseUsage::Vapour] ||
            !phase_usage.phase_used[PhaseUsage::Aqua] ||
            !phase_usage.phase_used[PhaseUsage::Liquid]) {
            OPM_THROW(std::runtime_error, "PvtPropertiesIncompFromDeck::init() -- must have gas and oil phases (only) in deck input.\n");
        }

        // Surface densities. Accounting for different orders in eclipse and our code.
        if (deck->hasKeyword("DENSITY")) {
            const auto& densityRecord = deck->getKeyword("DENSITY").getRecord(region_number);
            surface_density_[phase_usage.phase_pos[PhaseUsage::Aqua]]   = densityRecord.getItem("OIL").getSIDouble(0);
            surface_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] = densityRecord.getItem("WATER").getSIDouble(0);
        } else {
            OPM_THROW(std::runtime_error, "Input is missing DENSITY\n");
        }

        // Make reservoir densities the same as surface densities initially.
        // We will modify them with formation volume factors if found.
        reservoir_density_ = surface_density_;

        // Water viscosity.
        if (deck->hasKeyword("PVTW")) {
            const auto& pvtwRecord = deck->getKeyword("PVTW").getRecord(region_number);
            if (pvtwRecord.getItem("WATER_COMPRESSIBILITY").getSIDouble(0) != 0.0 ||
                pvtwRecord.getItem("WATER_VISCOSIBILITY").getSIDouble(0) != 0.0) {
                OPM_MESSAGE("Compressibility effects in PVTW are ignored.");
            }
            reservoir_density_[phase_usage.phase_pos[PhaseUsage::Aqua]] /= pvtwRecord.getItem("WATER_VOL_FACTOR").getSIDouble(0);
            viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = pvtwRecord.getItem("WATER_VISCOSITY").getSIDouble(0);
        } else {
            // Eclipse 100 default.
            // viscosity_[phase_usage.phase_pos[PhaseUsage::Aqua]] = 0.5*Opm::prefix::centi*Opm::unit::Poise;
            OPM_THROW(std::runtime_error, "Input is missing PVTW\n");
        }

        // Oil viscosity.
        if (deck->hasKeyword("PVCDO")) {
            const auto& pvcdoRecord = deck->getKeyword("PVCDO").getRecord(region_number);

            if (pvcdoRecord.getItem("OIL_COMPRESSIBILITY").getSIDouble(0) != 0.0 ||
                pvcdoRecord.getItem("OIL_VISCOSIBILITY").getSIDouble(0) != 0.0) {
                OPM_MESSAGE("Compressibility effects in PVCDO are ignored.");
            }
            reservoir_density_[phase_usage.phase_pos[PhaseUsage::Liquid]] /= pvcdoRecord.getItem("OIL_VOL_FACTOR").getSIDouble(0);
            viscosity_[phase_usage.phase_pos[PhaseUsage::Liquid]] = pvcdoRecord.getItem("OIL_VISCOSITY").getSIDouble(0);
        } else {
            OPM_THROW(std::runtime_error, "Input is missing PVCDO\n");
        }
    }
开发者ID:chflo,项目名称:opm-core,代码行数:54,代码来源:PvtPropertiesIncompFromDeck.cpp

示例13: setInflowValues

    /// Constructor.
    /// @param[in]  deck     Input deck expected to contain WPOLYMER.
    PolymerInflowFromDeck::PolymerInflowFromDeck(Opm::DeckConstPtr deck,
                                                 Opm::EclipseStateConstPtr eclipseState,
                                                 const Wells& wells,
                                                 const int num_cells,
                                                 size_t currentStep)
        : sparse_inflow_(num_cells)
    {
        if (!deck->hasKeyword("WPOLYMER")) {
            OPM_MESSAGE("PolymerInflowFromDeck initialized without WPOLYMER in current epoch.");
            return;
        }
        setInflowValues(deck, eclipseState, currentStep);
        
        std::unordered_map<std::string, double>::const_iterator map_it;
        // Extract concentrations and put into cell->concentration map.
        std::map<int, double> perfcell_conc;
        for (size_t i = 0; i < wellPolymerRate_.size(); ++i) {
            // Only use well name and polymer concentration.
            // That is, we ignore salt concentration and group
            // names.
            int wix = 0;
            for (; wix < wells.number_of_wells; ++wix) {
                map_it = wellPolymerRate_.find(wells.name[wix]);
                if (map_it == wellPolymerRate_.end()) {
                    OPM_THROW(std::runtime_error, "Could not find a match for well from WPOLYMER.");
                } else {
                    break;
                }
            }
            for (int j = wells.well_connpos[wix]; j < wells.well_connpos[wix+1]; ++j) {
                const int perf_cell = wells.well_cells[j];
                perfcell_conc[perf_cell] = map_it->second;
            }
        }

        // Build sparse vector from map.
        std::map<int, double>::const_iterator it = perfcell_conc.begin();
        for (; it != perfcell_conc.end(); ++it) {
            sparse_inflow_.addElement(it->second, it->first);
        }
    }
开发者ID:edbru,项目名称:opm-polymer,代码行数:43,代码来源:PolymerInflow.cpp

示例14: init

    inline void BlackoilPropertiesFromDeck::init(Opm::DeckConstPtr deck,
                                                 Opm::EclipseStateConstPtr eclState,
                                                 std::shared_ptr<MaterialLawManager> materialLawManager,
                                                 int number_of_cells,
                                                 const int* global_cell,
                                                 const int* cart_dims,
                                                 const parameter::ParameterGroup& param,
                                                 bool init_rock)
    {
        // retrieve the cell specific PVT table index from the deck
        // and using the grid...
        extractPvtTableIndex(cellPvtRegionIdx_, eclState, number_of_cells, global_cell);

        if(init_rock){
            rock_.init(eclState, number_of_cells, global_cell, cart_dims);
        }

        const int pvt_samples = param.getDefault("pvt_tab_size", -1);
        pvt_.init(deck, eclState, pvt_samples);

        // Unfortunate lack of pointer smartness here...
        std::string threephase_model = param.getDefault<std::string>("threephase_model", "gwseg");
        if (deck->hasKeyword("ENDSCALE") && threephase_model != "gwseg") {
            OPM_THROW(std::runtime_error, "Sorry, end point scaling currently available for the 'gwseg' model only.");
        }

        SaturationPropsFromDeck* ptr
            = new SaturationPropsFromDeck();
        ptr->init(phaseUsageFromDeck(deck), materialLawManager);
        satprops_.reset(ptr);

        if (pvt_.numPhases() != satprops_->numPhases()) {
            OPM_THROW(std::runtime_error, "BlackoilPropertiesFromDeck::BlackoilPropertiesFromDeck() - Inconsistent number of phases in pvt data ("
                  << pvt_.numPhases() << ") and saturation-dependent function data (" << satprops_->numPhases() << ").");
        }
    }
开发者ID:jepebe,项目名称:opm-core,代码行数:36,代码来源:BlackoilPropertiesFromDeck.cpp

示例15: initFromDeck

    /*!
     * \brief Reads all relevant material parameters form a cell of a parsed ECL deck.
     *
     * This requires that the opm-parser module is available.
     */
    void initFromDeck(Opm::DeckConstPtr deck,
                      Opm::EclipseStateConstPtr eclState,
                      Opm::EclTwoPhaseSystemType twoPhaseSystemType)
    {
        // find out if endpoint scaling is used in the first place
        if (!deck->hasKeyword("ENDSCALE")) {
            // it is not used, i.e., just set all enable$Foo attributes to 0 and be done
            // with it.
            enableSatScaling_ = false;
            enableThreePointKrSatScaling_ = false;
            enablePcScaling_ = false;
            enableKrwScaling_ = false;
            enableKrnScaling_ = false;
            return;
        }

        // endpoint scaling is used, i.e., at least saturation scaling needs to be enabled
        enableSatScaling_ = true;

        // check if three-point scaling is to be used for the saturations of the relative
        // permeabilities
        if (deck->hasKeyword("SCALECRS")) {
            // if the deck features the SCALECRS keyword, it must be set to 'YES'
            Opm::DeckKeywordConstPtr scalecrsKeyword = deck->getKeyword("SCALECRS");
            std::string scalecrsValue =
                scalecrsKeyword->getRecord(0)->getItem("VALUE")->getString(0);
            // convert the value of the SCALECRS keyword to upper case, just to be sure
            std::transform(scalecrsValue.begin(),
                           scalecrsValue.end(),
                           scalecrsValue.begin(),
                           ::toupper);

            if (scalecrsValue == "YES" || scalecrsValue == "Y")
                enableThreePointKrSatScaling_ = true;
            else
                enableThreePointKrSatScaling_ = false;
        }
        else
            enableThreePointKrSatScaling_ = false;

        // check if we are supposed to scale the Y axis of the capillary pressure
        if (twoPhaseSystemType == EclOilWaterSystem)
            enablePcScaling_ =
                eclState->hasDoubleGridProperty("PCW")
                || eclState->hasDoubleGridProperty("SWATINIT");

        else {
            assert(twoPhaseSystemType == EclGasOilSystem);
            enablePcScaling_ = eclState->hasDoubleGridProperty("PCG");
        }

        // check if we are supposed to scale the Y axis of the wetting phase relperm
        if (twoPhaseSystemType == EclOilWaterSystem)
            enableKrwScaling_ = eclState->hasDoubleGridProperty("KRW");
        else {
            assert(twoPhaseSystemType == EclGasOilSystem);
            enableKrwScaling_ = eclState->hasDoubleGridProperty("KRO");
        }

        // check if we are supposed to scale the Y axis of the non-wetting phase relperm
        if (twoPhaseSystemType == EclOilWaterSystem)
            enableKrnScaling_ = eclState->hasDoubleGridProperty("KRO");
        else {
            assert(twoPhaseSystemType == EclGasOilSystem);
            enableKrnScaling_ = eclState->hasDoubleGridProperty("KRG");
        }
    }
开发者ID:GitPaean,项目名称:opm-material,代码行数:72,代码来源:EclEpsConfig.hpp


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