Merge pull request #4795 from akva2/eclactionhandler_move

EclActionHandler: move from ebos/ to opm/simulators/flow
This commit is contained in:
Bård Skaflestad 2023-08-15 13:02:24 +02:00 committed by GitHub
commit 0673fae595
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 102 additions and 103 deletions

View File

@ -24,7 +24,6 @@
# find opm -name '*.c*' -printf '\t%p\n' | sort
list (APPEND MAIN_SOURCE_FILES
ebos/collecttoiorank.cc
ebos/eclactionhandler.cc
ebos/eclgenericcpgridvanguard.cc
ebos/eclgenericoutputblackoilmodule.cc
ebos/eclgenericproblem.cc
@ -45,6 +44,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/flow/Banners.cpp
opm/simulators/flow/countGlobalCells.cpp
opm/simulators/flow/ConvergenceOutputConfiguration.cpp
opm/simulators/flow/EclActionHandler.cpp
opm/simulators/flow/ExtraConvergenceOutputThread.cpp
opm/simulators/flow/FlowMainEbos.cpp
opm/simulators/flow/KeywordValidation.cpp
@ -380,7 +380,6 @@ list (APPEND PUBLIC_HEADER_FILES
ebos/collecttoiorank.hh
ebos/collecttoiorank_impl.hh
ebos/ebos.hh
ebos/eclactionhandler.hh
ebos/eclalugridvanguard.hh
ebos/eclbaseaquifermodel.hh
ebos/eclbasevanguard.hh
@ -422,6 +421,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/flow/BlackoilModelParametersEbos.hpp
opm/simulators/flow/Banners.hpp
opm/simulators/flow/ConvergenceOutputConfiguration.hpp
opm/simulators/flow/EclActionHandler.hpp
opm/simulators/flow/ExtraConvergenceOutputThread.hpp
opm/simulators/flow/FlowMainEbos.hpp
opm/simulators/flow/Main.hpp

View File

@ -1,97 +0,0 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef ECL_ACTION_HANDLER_HH
#define ECL_ACTION_HANDLER_HH
#include <opm/simulators/utils/ParallelCommunication.hpp>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm {
namespace Action {
class ActionX;
class State;
}
class BlackoilWellModelGeneric;
class EclipseState;
class Schedule;
struct SimulatorUpdate;
class SummaryState;
class UDQState;
//! \brief Class handling Action support in simulator
class EclActionHandler
{
public:
//! \brief Function handle to update transmissiblities.
using TransFunc = std::function<void(bool)>;
EclActionHandler(EclipseState& ecl_state,
Schedule& schedule,
Action::State& actionState,
SummaryState& summaryState,
BlackoilWellModelGeneric& wellModel,
Parallel::Communication comm);
void applyActions(int reportStep,
double sim_time,
const TransFunc& updateTrans);
//! \brief Evaluates UDQ assign statements.
void evalUDQAssignments(const unsigned episodeIdx,
UDQState& udq_state);
private:
/*
This function is run after applyAction has been completed in the Schedule
implementation. The sim_update argument should have members & flags for
the simulator properties which need to be updated. This functionality is
probably not complete.
*/
void applySimulatorUpdate(int report_step,
const SimulatorUpdate& sim_update,
bool& commit_wellstate,
const TransFunc& updateTrans);
std::unordered_map<std::string, double>
fetchWellPI(int reportStep,
const Action::ActionX& action,
const std::vector<std::string>& matching_wells);
EclipseState& ecl_state_;
Schedule& schedule_;
Action::State& actionState_;
SummaryState& summaryState_;
BlackoilWellModelGeneric& wellModel_;
Parallel::Communication comm_;
};
} // namespace Opm
#endif

View File

@ -32,7 +32,6 @@
#include <dune/common/fvector.hh>
#include <dune/common/fmatrix.hh>
#include <ebos/eclactionhandler.hh>
#include <ebos/eclbaseaquifermodel.hh>
#include <ebos/eclcpgridvanguard.hh>
#include <ebos/ecldummygradientcalculator.hh>
@ -78,6 +77,7 @@
#include <opm/output/eclipse/EclipseIO.hpp>
#include <opm/simulators/flow/EclActionHandler.hpp>
#include <opm/simulators/timestepping/SimulatorReport.hpp>
#include <opm/simulators/utils/DeferredLoggingErrorHelpers.hpp>
#include <opm/simulators/utils/ParallelSerialization.hpp>

View File

@ -22,8 +22,7 @@
*/
#include <config.h>
#include <ebos/eclactionhandler.hh>
#include <opm/simulators/flow/EclActionHandler.hpp>
#include <opm/common/OpmLog/OpmLog.hpp>
#include <opm/common/utility/TimeService.hpp>
@ -208,7 +207,7 @@ void EclActionHandler::applySimulatorUpdate(const int report_step,
std::unordered_map<std::string, double>
EclActionHandler::fetchWellPI(const int reportStep,
const Action::ActionX& action,
const std::vector<std::string>& matching_wells)
const std::vector<std::string>& matching_wells) const
{
auto wellpi_wells = action.wellpi_wells(WellMatcher(schedule_[reportStep].well_order(),

View File

@ -0,0 +1,97 @@
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef ECL_ACTION_HANDLER_HPP
#define ECL_ACTION_HANDLER_HPP
#include <opm/simulators/utils/ParallelCommunication.hpp>
#include <functional>
#include <string>
#include <unordered_map>
#include <vector>
namespace Opm {
namespace Action {
class ActionX;
class State;
}
class BlackoilWellModelGeneric;
class EclipseState;
class Schedule;
struct SimulatorUpdate;
class SummaryState;
class UDQState;
//! \brief Class handling Action support in simulator
class EclActionHandler
{
public:
//! \brief Function handle to update transmissiblities.
using TransFunc = std::function<void(bool)>;
EclActionHandler(EclipseState& ecl_state,
Schedule& schedule,
Action::State& actionState,
SummaryState& summaryState,
BlackoilWellModelGeneric& wellModel,
Parallel::Communication comm);
void applyActions(int reportStep,
double sim_time,
const TransFunc& updateTrans);
//! \brief Evaluates UDQ assign statements.
void evalUDQAssignments(const unsigned episodeIdx,
UDQState& udq_state);
private:
/*
This function is run after applyAction has been completed in the Schedule
implementation. The sim_update argument should have members & flags for
the simulator properties which need to be updated. This functionality is
probably not complete.
*/
void applySimulatorUpdate(int report_step,
const SimulatorUpdate& sim_update,
bool& commit_wellstate,
const TransFunc& updateTrans);
std::unordered_map<std::string, double>
fetchWellPI(int reportStep,
const Action::ActionX& action,
const std::vector<std::string>& matching_wells) const;
EclipseState& ecl_state_;
Schedule& schedule_;
Action::State& actionState_;
SummaryState& summaryState_;
BlackoilWellModelGeneric& wellModel_;
Parallel::Communication comm_;
};
} // namespace Opm
#endif // ECL_ACTION_HANDLER_HPP