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


C++ DeckConstPtr::getKeyword方法代码示例

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


在下文中一共展示了DeckConstPtr::getKeyword方法的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: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: filterIntegerField

 void filterIntegerField(const std::string& keyword, std::vector<int>& output_field)
 {
     if (deck_->hasKeyword(keyword)) {
         const std::vector<int>& field = deck_->getKeyword(keyword)->getIntData();
         filterField(field, output_field);
     }
 }
开发者ID:GitPaean,项目名称:opm-core,代码行数:7,代码来源:CornerpointChopper.hpp

示例8: filterDoubleField

 void filterDoubleField(const std::string& keyword, std::vector<double>& output_field)
 {
     if (deck_->hasKeyword(keyword)) {
         const std::vector<double>& field = deck_->getKeyword(keyword)->getRawDoubleData();
         filterField(field, output_field);
     }
 }
开发者ID:GitPaean,项目名称:opm-core,代码行数:7,代码来源:CornerpointChopper.hpp

示例9: 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

示例10:

    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

示例11: 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

示例12:

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

示例13: 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

示例14: init

    void BlackoilPvtProperties::init(Opm::DeckConstPtr deck,
                                     Opm::EclipseStateConstPtr eclipseState,
                                     int numSamples)
    {
        phase_usage_ = phaseUsageFromDeck(deck);

        // Surface densities. Accounting for different orders in eclipse and our code.
        Opm::DeckKeywordConstPtr densityKeyword = deck->getKeyword("DENSITY");
        int numRegions = densityKeyword->size();

        densities_.resize(numRegions);
        for (int regionIdx = 0; regionIdx < numRegions; ++regionIdx) {
            if (phase_usage_.phase_used[Liquid]) {
                densities_[regionIdx][phase_usage_.phase_pos[Liquid]]
                    = densityKeyword->getRecord(regionIdx)->getItem("OIL")->getSIDouble(0);
            }
            if (phase_usage_.phase_used[Aqua]) {
                densities_[regionIdx][phase_usage_.phase_pos[Aqua]]
                    = densityKeyword->getRecord(regionIdx)->getItem("WATER")->getSIDouble(0);
            }
            if (phase_usage_.phase_used[Vapour]) {
                densities_[regionIdx][phase_usage_.phase_pos[Vapour]]
                    = densityKeyword->getRecord(regionIdx)->getItem("GAS")->getSIDouble(0);
            }
        }

        // Resize the property objects container
        props_.resize(phase_usage_.num_phases);

        // Water PVT
        if (phase_usage_.phase_used[Aqua]) {
            // if water is used, we require the presence of the "PVTW"
            // keyword for now...
            std::shared_ptr<PvtConstCompr> pvtw(new PvtConstCompr);
            pvtw->initFromWater(deck->getKeyword("PVTW"));

            props_[phase_usage_.phase_pos[Aqua]] = pvtw;
        }

        {
            auto tables = eclipseState->getTableManager();
            // Oil PVT
            if (phase_usage_.phase_used[Liquid]) {
                // for oil, we support the "PVDO", "PVTO" and "PVCDO"
                // keywords...
                const auto &pvdoTables = tables->getPvdoTables();
                const auto &pvtoTables = tables->getPvtoTables();
                if (pvdoTables.size() > 0) {
                    if (numSamples > 0) {
                        auto splinePvt = std::shared_ptr<PvtDeadSpline>(new PvtDeadSpline);
                        splinePvt->initFromOil(pvdoTables, numSamples);
                        props_[phase_usage_.phase_pos[Liquid]] = splinePvt;
                    } else {
                        auto deadPvt = std::shared_ptr<PvtDead>(new PvtDead);
                        deadPvt->initFromOil(pvdoTables);
                        props_[phase_usage_.phase_pos[Liquid]] = deadPvt;
                    }
                } else if (pvtoTables.size() > 0) {
                    props_[phase_usage_.phase_pos[Liquid]].reset(new PvtLiveOil(pvtoTables));
                } else if (deck->hasKeyword("PVCDO")) {
                    std::shared_ptr<PvtConstCompr> pvcdo(new PvtConstCompr);
                    pvcdo->initFromOil(deck->getKeyword("PVCDO"));

                    props_[phase_usage_.phase_pos[Liquid]] = pvcdo;
                } else {
                    OPM_THROW(std::runtime_error, "Input is missing PVDO, PVCDO or PVTO\n");
                }
            }
            // Gas PVT
            if (phase_usage_.phase_used[Vapour]) {
                // gas can be specified using the "PVDG" or "PVTG" keywords...
                const auto &pvdgTables = tables->getPvdgTables();
                const auto &pvtgTables = tables->getPvtgTables();
                if (pvdgTables.size() > 0) {
                    if (numSamples > 0) {
                        std::shared_ptr<PvtDeadSpline> splinePvt(new PvtDeadSpline);
                        splinePvt->initFromGas(pvdgTables, numSamples);

                        props_[phase_usage_.phase_pos[Vapour]] = splinePvt;
                    } else {
                        std::shared_ptr<PvtDead> deadPvt(new PvtDead);
                        deadPvt->initFromGas(pvdgTables);

                        props_[phase_usage_.phase_pos[Vapour]] = deadPvt;
                    }
                } else if (pvtgTables.size() > 0) {
                    props_[phase_usage_.phase_pos[Vapour]].reset(new PvtLiveGas(pvtgTables));
                } else {
                    OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
                }
            }
        }
    }
开发者ID:higgscc,项目名称:opm-core,代码行数:93,代码来源:BlackoilPvtProperties.cpp

示例15: grid

std::vector<std::shared_ptr<PvtInterface> > getProps(Opm::DeckConstPtr deck, PhaseUsage phase_usage_){
    Opm::GridManager grid(deck);

    enum PhaseIndex { Aqua = 0, Liquid = 1, Vapour = 2 };
    int samples = 0;

    std::vector<std::shared_ptr<PvtInterface> > props_;
    // Set the properties.
    props_.resize(phase_usage_.num_phases);

    // Water PVT
    if (phase_usage_.phase_used[Aqua]) {
        if (deck->hasKeyword("PVTW")) {
            std::shared_ptr<PvtConstCompr> pvtw(new PvtConstCompr);
            pvtw->initFromWater(deck->getKeyword("PVTW"));

            props_[phase_usage_.phase_pos[Aqua]] = pvtw;
        } else {
            // Eclipse 100 default.
            props_[phase_usage_.phase_pos[Aqua]].reset(new PvtConstCompr(0.5*Opm::prefix::centi*Opm::unit::Poise));
        }
    }

    // Oil PVT
    if (phase_usage_.phase_used[Liquid]) {
        if (deck->hasKeyword("PVDO")) {
            Opm::DeckKeywordConstPtr pvdoKeyword(deck->getKeyword("PVDO"));
            if (samples > 0) {
                std::shared_ptr<PvtDeadSpline> splinePvt(new PvtDeadSpline);
                splinePvt->initFromOil(pvdoKeyword, samples);
                props_[phase_usage_.phase_pos[Liquid]] = splinePvt;
            } else {
                std::shared_ptr<PvtDead> deadPvt(new PvtDead);
                deadPvt->initFromOil(pvdoKeyword);
                props_[phase_usage_.phase_pos[Liquid]] = deadPvt;
            }
        } else if (deck->hasKeyword("PVTO")) {
            props_[phase_usage_.phase_pos[Liquid]].reset(new PvtLiveOil(deck->getKeyword("PVTO")));
        } else if (deck->hasKeyword("PVCDO")) {
            std::shared_ptr<PvtConstCompr> pvcdo(new PvtConstCompr);
            pvcdo->initFromOil(deck->getKeyword("PVCDO"));

            props_[phase_usage_.phase_pos[Liquid]] = pvcdo;
        } else {
            OPM_THROW(std::runtime_error, "Input is missing PVDO, PVCDO or PVTO\n");
        }
    }
    // Gas PVT
    if (phase_usage_.phase_used[Vapour]) {
        if (deck->hasKeyword("PVDG")) {
            Opm::DeckKeywordConstPtr pvdgKeyword(deck->getKeyword("PVDG"));
            if (samples > 0) {
                std::shared_ptr<PvtDeadSpline> splinePvt(new PvtDeadSpline);
                splinePvt->initFromGas(pvdgKeyword, samples);
                props_[phase_usage_.phase_pos[Vapour]] = splinePvt;
            } else {
                std::shared_ptr<PvtDead> deadPvt(new PvtDead);
                deadPvt->initFromGas(pvdgKeyword);
                props_[phase_usage_.phase_pos[Vapour]] = deadPvt;
            }
        } else if (deck->hasKeyword("PVTG")) {
            props_[phase_usage_.phase_pos[Vapour]].reset(new PvtLiveGas(deck->getKeyword("PVTG")));
        } else {
            OPM_THROW(std::runtime_error, "Input is missing PVDG or PVTG\n");
        }
    }

    return props_;
}
开发者ID:PETECLAM,项目名称:opm-core,代码行数:69,代码来源:test_blackoilfluid.cpp


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