コード例 #1
0
ファイル: IOConfig.cpp プロジェクト: chflo/opm-parser
 void IOConfig::overrideRestartWriteInterval(size_t interval) {
     if (interval > 0) {
         size_t basic = 3;
         size_t timestep = 0;
         handleRPTRSTBasic(m_timemap, timestep, basic, interval, false, true);
         setWriteInitialRestartFile(true);
     } else {
         size_t basic = 0;
         size_t timestep = 0;
         handleRPTRSTBasic(m_timemap, timestep, basic, interval, false, true);
         setWriteInitialRestartFile(false);
     }
 }
コード例 #2
0
ファイル: IOConfig.cpp プロジェクト: chflo/opm-parser
    void IOConfig::handleRPTSOL( const DeckKeyword& keyword) {
        const auto& record = keyword.getRecord(0);

        size_t restart = 0;
        size_t found_mnemonic_RESTART = 0;
        bool handle_RPTSOL_RESTART = false;

        const auto& item = record.getItem(0);


        for (size_t index = 0; index < item.size(); ++index) {
            const std::string& mnemonic = item.get< std::string >(index);

            found_mnemonic_RESTART = mnemonic.find("RESTART=");
            if (found_mnemonic_RESTART != std::string::npos) {
                std::string restart_no = mnemonic.substr(found_mnemonic_RESTART+8, mnemonic.size());
                restart = boost::lexical_cast<size_t>(restart_no);
                handle_RPTSOL_RESTART = true;
            }
        }


        /* If no RESTART mnemonic is found, either it is not present or we might
           have an old data set containing integer controls instead of mnemonics.
           Restart integer switch is integer control nr 7 */

        if (found_mnemonic_RESTART == std::string::npos) {
            if (item.size() >= 7)  {
                const std::string& integer_control = item.get< std::string >(6);
                try {
                    restart = boost::lexical_cast<size_t>(integer_control);
                    handle_RPTSOL_RESTART = true;
                } catch (boost::bad_lexical_cast &) {
                    //do nothing
                }
            }
        }

        if (handle_RPTSOL_RESTART) {
            if (restart > 1) {
                setWriteInitialRestartFile(true);
            } else {
                setWriteInitialRestartFile(false);
            }
        }
    }
コード例 #3
0
ファイル: RestartConfig.cpp プロジェクト: magnesj/ResInsight
    void RestartConfig::overrideRestartWriteInterval(size_t interval) {
        size_t step = 0;
        /* write restart files if the interval is non-zero. The restart
         * mnemonic (setting) that governs restart-on-interval is BASIC=3
         */
        size_t basic = interval > 0 ? 3 : 0;

        RestartSchedule rs( step, basic, interval );
        restart_schedule.globalReset( rs );

        setWriteInitialRestartFile( interval > 0 );
    }
コード例 #4
0
ファイル: IOConfig.cpp プロジェクト: chflo/opm-parser
    void IOConfig::handleSolutionSection(TimeMapConstPtr timemap, std::shared_ptr<const SOLUTIONSection> solutionSection) {
        if (solutionSection->hasKeyword("RPTRST")) {
            const auto& rptrstkeyword        = solutionSection->getKeyword("RPTRST");
            const auto& record = rptrstkeyword.getRecord(0);
            const auto& item     = record.getItem(0);

            bool handleRptrstBasic = false;
            size_t basic = 0;
            size_t freq  = 0;

            for (size_t index = 0; index < item.size(); ++index) {
                if (item.hasValue(index)) {
                    std::string mnemonics = item.get< std::string >(index);
                    std::size_t found_basic = mnemonics.find("BASIC=");
                    if (found_basic != std::string::npos) {
                        std::string basic_no = mnemonics.substr(found_basic+6, found_basic+7);
                        basic = atoi(basic_no.c_str());
                        handleRptrstBasic = true;
                    }

                    std::size_t found_freq = mnemonics.find("FREQ=");
                    if (found_freq != std::string::npos) {
                        std::string freq_no = mnemonics.substr(found_freq+5, found_freq+6);
                        freq = atoi(freq_no.c_str());
                    }
                }
            }

            if (handleRptrstBasic) {
                size_t currentStep = 0;
                handleRPTRSTBasic(timemap, currentStep, basic, freq, true);
            }


            setWriteInitialRestartFile(true); // Guessing on eclipse rules for write of initial RESTART file (at time 0):
                                              // Write of initial restart file is (due to the eclipse reference manual)
                                              // governed by RPTSOL RESTART in solution section,
                                              // if RPTSOL RESTART > 1 initial restart file is written.
                                              // but - due to initial restart file written from Eclipse
                                              // for data where RPTSOL RESTART not set - guessing that
                                              // when RPTRST is set in SOLUTION (no basic though...) -> write inital restart.

        } //RPTRST


        if (solutionSection->hasKeyword("RPTSOL") && (timemap->size() > 0)) {
            handleRPTSOL(solutionSection->getKeyword("RPTSOL"));
        } //RPTSOL
    }
コード例 #5
0
ファイル: RestartConfig.cpp プロジェクト: magnesj/ResInsight
    void RestartConfig::handleSolutionSection(const SOLUTIONSection& solutionSection) {
        if (solutionSection.hasKeyword("RPTRST")) {
            const auto& rptrstkeyword        = solutionSection.getKeyword("RPTRST");

            const auto rptrst = RPTRST( rptrstkeyword, {}, 0 );
            this->restart_keywords.updateInitial( rptrst.first );
            this->restart_schedule.updateInitial( rptrst.second );
            setWriteInitialRestartFile(true); // Guessing on eclipse rules for write of initial RESTART file (at time 0):
                                              // Write of initial restart file is (due to the eclipse reference manual)
                                              // governed by RPTSOL RESTART in solution section,
                                              // if RPTSOL RESTART > 1 initial restart file is written.
                                              // but - due to initial restart file written from Eclipse
                                              // for data where RPTSOL RESTART not set - guessing that
                                              // when RPTRST is set in SOLUTION (no basic though...) -> write inital restart.
        } //RPTRST


        if (solutionSection.hasKeyword("RPTSOL") && (m_timemap->size() > 0)) {
            handleRPTSOL(solutionSection.getKeyword("RPTSOL"));
        } //RPTSOL
    }