mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
ebos/collecttoiorank: move to opm/simulators/flow
This commit is contained in:
@@ -234,7 +234,7 @@ namespace Opm {
|
||||
, phaseUsage_(phaseUsageFromDeck(eclState()))
|
||||
, param_( param )
|
||||
, well_model_ (well_model)
|
||||
, rst_conv_(simulator_.problem().eclWriter()->collectToIORank().localIdxToGlobalIdxMapping(),
|
||||
, rst_conv_(simulator_.problem().eclWriter()->collectOnIORank().localIdxToGlobalIdxMapping(),
|
||||
grid_.comm())
|
||||
, terminal_output_ (terminal_output)
|
||||
, current_relaxation_(1.0)
|
||||
|
||||
54
opm/simulators/flow/CollectDataOnIORank.cpp
Normal file
54
opm/simulators/flow/CollectDataOnIORank.cpp
Normal file
@@ -0,0 +1,54 @@
|
||||
// -*- 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.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <opm/simulators/flow/CollectDataOnIORank_impl.hpp>
|
||||
|
||||
#include <opm/grid/CpGrid.hpp>
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
#include <dune/fem/gridpart/adaptiveleafgridpart.hh>
|
||||
#include <dune/fem/gridpart/common/gridpart2gridview.hh>
|
||||
#include <ebos/femcpgridcompat.hh>
|
||||
#endif // HAVE_DUNE_FEM
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template class CollectDataOnIORank<Dune::CpGrid,
|
||||
Dune::CpGrid,
|
||||
Dune::GridView<Dune::DefaultLeafGridViewTraits<Dune::CpGrid>>>;
|
||||
|
||||
#if HAVE_DUNE_FEM
|
||||
template class CollectDataOnIORank<Dune::CpGrid,
|
||||
Dune::CpGrid,
|
||||
Dune::GridView<Dune::Fem::GridPart2GridViewTraits<Dune::Fem::AdaptiveLeafGridPart<Dune::CpGrid, Dune::PartitionIteratorType(4), false>>>>;
|
||||
template class CollectDataOnIORank<Dune::CpGrid,
|
||||
Dune::CpGrid,
|
||||
Dune::Fem::GridPart2GridViewImpl<
|
||||
Dune::Fem::AdaptiveLeafGridPart<
|
||||
Dune::CpGrid,
|
||||
Dune::PartitionIteratorType(4),
|
||||
false> > >;
|
||||
#endif // HAVE_DUNE_FEM
|
||||
|
||||
} // end namespace Opm
|
||||
174
opm/simulators/flow/CollectDataOnIORank.hpp
Normal file
174
opm/simulators/flow/CollectDataOnIORank.hpp
Normal file
@@ -0,0 +1,174 @@
|
||||
// -*- 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 OPM_COLLECT_DATA_ON_IO_RANK_HPP
|
||||
#define OPM_COLLECT_DATA_ON_IO_RANK_HPP
|
||||
|
||||
#include <opm/grid/common/p2pcommunicator.hh>
|
||||
|
||||
#include <opm/input/eclipse/Schedule/Well/WellTestState.hpp>
|
||||
|
||||
#include <opm/output/data/Aquifer.hpp>
|
||||
#include <opm/output/data/Cells.hpp>
|
||||
#include <opm/output/data/Groups.hpp>
|
||||
#include <opm/output/data/Solution.hpp>
|
||||
#include <opm/output/data/Wells.hpp>
|
||||
|
||||
#include <opm/simulators/flow/FlowsData.hpp>
|
||||
#include <opm/simulators/flow/InterRegFlows.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
namespace Dune {
|
||||
template<class Grid> class CartesianIndexMapper;
|
||||
}
|
||||
|
||||
namespace Opm {
|
||||
|
||||
template <class Grid, class EquilGrid, class GridView>
|
||||
class CollectDataOnIORank
|
||||
{
|
||||
public:
|
||||
using CollectiveCommunication = typename Grid::CollectiveCommunication;
|
||||
using P2PCommunicatorType = Dune::Point2PointCommunicator<Dune::SimpleMessageBuffer>;
|
||||
using IndexMapType = std::vector<int>;
|
||||
using IndexMapStorageType = std::vector<IndexMapType>;
|
||||
|
||||
static constexpr int dimension = Grid::dimension;
|
||||
|
||||
enum { ioRank = 0 };
|
||||
|
||||
static const bool needsReordering =
|
||||
!std::is_same<Grid, EquilGrid>::value;
|
||||
|
||||
CollectDataOnIORank(const Grid& grid,
|
||||
const EquilGrid* equilGrid,
|
||||
const GridView& gridView,
|
||||
const Dune::CartesianIndexMapper<Grid>& cartMapper,
|
||||
const Dune::CartesianIndexMapper<EquilGrid>* equilCartMapper,
|
||||
const std::set<std::string>& fipRegionsInterregFlow = {});
|
||||
|
||||
// gather solution to rank 0 for EclipseWriter
|
||||
void collect(const data::Solution& localCellData,
|
||||
const std::map<std::pair<std::string, int>, double>& localBlockData,
|
||||
const data::Wells& localWellData,
|
||||
const data::WellBlockAveragePressures& localWBPData,
|
||||
const data::GroupAndNetworkValues& localGroupAndNetworkData,
|
||||
const data::Aquifers& localAquiferData,
|
||||
const WellTestState& localWellTestState,
|
||||
const InterRegFlowMap& interRegFlows,
|
||||
const std::array<FlowsData<double>, 3>& localFlowsn,
|
||||
const std::array<FlowsData<double>, 3>& localFloresn);
|
||||
|
||||
const std::map<std::pair<std::string, int>, double>& globalBlockData() const
|
||||
{ return globalBlockData_; }
|
||||
|
||||
const data::Solution& globalCellData() const
|
||||
{ return globalCellData_; }
|
||||
|
||||
data::Solution& globalCellData()
|
||||
{ return globalCellData_; }
|
||||
|
||||
const data::Wells& globalWellData() const
|
||||
{ return globalWellData_; }
|
||||
|
||||
const data::WellBlockAveragePressures& globalWBPData() const
|
||||
{ return this->globalWBPData_; }
|
||||
|
||||
const data::GroupAndNetworkValues& globalGroupAndNetworkData() const
|
||||
{ return globalGroupAndNetworkData_; }
|
||||
|
||||
const data::Aquifers& globalAquiferData() const
|
||||
{ return globalAquiferData_; }
|
||||
|
||||
const WellTestState& globalWellTestState() const
|
||||
{ return this->globalWellTestState_; }
|
||||
|
||||
InterRegFlowMap& globalInterRegFlows()
|
||||
{ return this->globalInterRegFlows_; }
|
||||
|
||||
const InterRegFlowMap& globalInterRegFlows() const
|
||||
{ return this->globalInterRegFlows_; }
|
||||
|
||||
const std::array<FlowsData<double>, 3>& globalFlowsn() const
|
||||
{ return globalFlowsn_; }
|
||||
|
||||
const std::array<FlowsData<double>, 3>& globalFloresn() const
|
||||
{ return globalFloresn_; }
|
||||
|
||||
bool isIORank() const
|
||||
{ return toIORankComm_.rank() == ioRank; }
|
||||
|
||||
bool isParallel() const
|
||||
{ return toIORankComm_.size() > 1; }
|
||||
|
||||
int localIdxToGlobalIdx(unsigned localIdx) const;
|
||||
|
||||
const std::vector<int>& localIdxToGlobalIdxMapping() const
|
||||
{
|
||||
return localIdxToGlobalIdx_;
|
||||
}
|
||||
|
||||
bool doesNeedReordering() const
|
||||
{ return needsReordering;}
|
||||
|
||||
std::size_t numCells () const
|
||||
{ return globalCartesianIndex_.size(); }
|
||||
|
||||
const std::vector<int>& globalRanks() const
|
||||
{ return globalRanks_; }
|
||||
|
||||
bool isCartIdxOnThisRank(int cartIdx) const;
|
||||
|
||||
protected:
|
||||
P2PCommunicatorType toIORankComm_;
|
||||
InterRegFlowMap globalInterRegFlows_;
|
||||
IndexMapType globalCartesianIndex_;
|
||||
IndexMapType localIndexMap_;
|
||||
IndexMapStorageType indexMaps_;
|
||||
std::vector<int> globalRanks_;
|
||||
data::Solution globalCellData_;
|
||||
std::map<std::pair<std::string, int>, double> globalBlockData_;
|
||||
data::Wells globalWellData_;
|
||||
data::WellBlockAveragePressures globalWBPData_;
|
||||
data::GroupAndNetworkValues globalGroupAndNetworkData_;
|
||||
data::Aquifers globalAquiferData_;
|
||||
WellTestState globalWellTestState_;
|
||||
std::vector<int> localIdxToGlobalIdx_;
|
||||
std::array<FlowsData<double>, 3> globalFlowsn_;
|
||||
std::array<FlowsData<double>, 3> globalFloresn_;
|
||||
/// \brief sorted list of cartesian indices present-
|
||||
///
|
||||
/// non-empty only when running in parallel
|
||||
std::vector<int> sortedCartesianIdx_;
|
||||
};
|
||||
|
||||
} // end namespace Opm
|
||||
|
||||
#endif // OPM_COLLECT_DATA_ON_IO_RANK_HPP
|
||||
1128
opm/simulators/flow/CollectDataOnIORank_impl.hpp
Normal file
1128
opm/simulators/flow/CollectDataOnIORank_impl.hpp
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user