add BlackoilWellModelConstraints

start by moving hasTHPConstraints
This commit is contained in:
Arne Morten Kvarving 2022-10-24 09:36:05 +02:00
parent f373c2f908
commit 2d9d452fff
5 changed files with 103 additions and 8 deletions

View File

@ -80,6 +80,7 @@ list (APPEND MAIN_SOURCE_FILES
opm/simulators/utils/ParallelFileMerger.cpp
opm/simulators/utils/ParallelRestart.cpp
opm/simulators/wells/ALQState.cpp
opm/simulators/wells/BlackoilWellModelConstraints.cpp
opm/simulators/wells/BlackoilWellModelGeneric.cpp
opm/simulators/wells/BlackoilWellModelRestart.cpp
opm/simulators/wells/GasLiftCommon.cpp
@ -348,6 +349,7 @@ list (APPEND PUBLIC_HEADER_FILES
opm/simulators/wells/ALQState.hpp
opm/simulators/wells/BlackoilWellModel.hpp
opm/simulators/wells/BlackoilWellModel_impl.hpp
opm/simulators/wells/BlackoilWellModelConstraints.hpp
opm/simulators/wells/BlackoilWellModelGeneric.hpp
opm/simulators/wells/BlackoilWellModelRestart.hpp
opm/simulators/wells/GasLiftCommon.hpp

View File

@ -0,0 +1,44 @@
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
Copyright 2016 - 2017 Statoil ASA.
Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2016 - 2018 IRIS AS
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 3 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/>.
*/
#include <config.h>
#include <opm/simulators/wells/BlackoilWellModelConstraints.hpp>
#include <opm/simulators/wells/BlackoilWellModelGeneric.hpp>
#include <opm/simulators/wells/WellInterfaceGeneric.hpp>
namespace Opm {
bool BlackoilWellModelConstraints::
hasTHPConstraints() const
{
int local_result = false;
for (const auto& well : wellModel_.genericWells()) {
if (well->wellHasTHPConstraints(wellModel_.summaryState())) {
local_result = true;
}
}
return wellModel_.comm().max(local_result);
}
}

View File

@ -0,0 +1,49 @@
/*
Copyright 2016 SINTEF ICT, Applied Mathematics.
Copyright 2016 - 2017 Statoil ASA.
Copyright 2017 Dr. Blatt - HPC-Simulation-Software & Services
Copyright 2016 - 2018 IRIS AS
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 3 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/>.
*/
#ifndef OPM_BLACKOILWELLMODEL_CONSTRAINTS_HEADER_INCLUDED
#define OPM_BLACKOILWELLMODEL_CONSTRAINTS_HEADER_INCLUDED
namespace Opm {
class BlackoilWellModelGeneric;
class SummaryState;
/// Class for handling constraints for the blackoil well model.
class BlackoilWellModelConstraints
{
public:
//! \brief Constructor initializes reference to the well model.
BlackoilWellModelConstraints(const BlackoilWellModelGeneric& wellModel)
: wellModel_(wellModel)
{}
/// Return true if any well has a THP constraint.
bool hasTHPConstraints() const;
private:
const BlackoilWellModelGeneric& wellModel_; //!< Reference to well model
};
} // namespace Opm
#endif

View File

@ -36,6 +36,7 @@
#include <opm/input/eclipse/EclipseState/SummaryConfig/SummaryConfig.hpp>
#include <opm/simulators/utils/DeferredLogger.hpp>
#include <opm/simulators/wells/BlackoilWellModelConstraints.hpp>
#include <opm/simulators/wells/BlackoilWellModelRestart.hpp>
#include <opm/simulators/wells/GasLiftStage2.hpp>
#include <opm/simulators/wells/VFPProperties.hpp>
@ -1780,13 +1781,7 @@ bool
BlackoilWellModelGeneric::
hasTHPConstraints() const
{
int local_result = false;
for (const auto& well : well_container_generic_) {
if (well->wellHasTHPConstraints(summaryState_)) {
local_result=true;
}
}
return comm_.max(local_result);
return BlackoilWellModelConstraints(*this).hasTHPConstraints();
}
bool

View File

@ -99,6 +99,8 @@ public:
const Schedule& schedule() const { return schedule_; }
const PhaseUsage& phaseUsage() const { return phase_usage_; }
const GroupState& groupState() const { return this->active_wgstate_.group_state; }
std::vector<const WellInterfaceGeneric*> genericWells() const
{ return {well_container_generic_.begin(), well_container_generic_.end()}; }
/*
Immutable version of the currently active wellstate.
@ -156,10 +158,13 @@ public:
bool forceShutWellByName(const std::string& wellname,
const double simulation_time);
const std::vector<PerforationData>& perfData(const int well_idx) const
{ return well_perf_data_[well_idx]; }
const Parallel::Communication& comm() const { return comm_; }
const SummaryState& summaryState() const { return summaryState_; }
protected:
/*