mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Remove redundant local state in ParallelDebugOutput
This commit is contained in:
@@ -174,14 +174,17 @@ void solutionToSim( const data::Solution& sol,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if( sol.has( "RS" ) ) {
|
if( sol.has( "RS" ) ) {
|
||||||
|
state.registerCellData("GASOILRATIO", 1);
|
||||||
state.getCellData( "GASOILRATIO" ) = sol.data( "RS" );
|
state.getCellData( "GASOILRATIO" ) = sol.data( "RS" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sol.has( "RV" ) ) {
|
if( sol.has( "RV" ) ) {
|
||||||
|
state.registerCellData("RV", 1);
|
||||||
state.getCellData( "RV" ) = sol.data( "RV" );
|
state.getCellData( "RV" ) = sol.data( "RV" );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( sol.has( "SSOL" ) ) {
|
if ( sol.has( "SSOL" ) ) {
|
||||||
|
state.registerCellData("SSOL", 1);
|
||||||
state.getCellData("SSOL") = sol.data("SSOL");
|
state.getCellData("SSOL") = sol.data("SSOL");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -345,8 +345,6 @@ namespace Opm
|
|||||||
|
|
||||||
class PackUnPackSimulationDataContainer : public P2PCommunicatorType::DataHandleInterface
|
class PackUnPackSimulationDataContainer : public P2PCommunicatorType::DataHandleInterface
|
||||||
{
|
{
|
||||||
const SimulationDataContainer& localState_;
|
|
||||||
SimulationDataContainer& globalState_;
|
|
||||||
const data::Solution& localCellData_;
|
const data::Solution& localCellData_;
|
||||||
data::Solution& globalCellData_;
|
data::Solution& globalCellData_;
|
||||||
const WellStateFullyImplicitBlackoil& localWellState_;
|
const WellStateFullyImplicitBlackoil& localWellState_;
|
||||||
@@ -355,8 +353,7 @@ namespace Opm
|
|||||||
const IndexMapStorageType& indexMaps_;
|
const IndexMapStorageType& indexMaps_;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PackUnPackSimulationDataContainer( const SimulationDataContainer& localState,
|
PackUnPackSimulationDataContainer( std::size_t numGlobalCells,
|
||||||
SimulationDataContainer& globalState,
|
|
||||||
const data::Solution& localCellData,
|
const data::Solution& localCellData,
|
||||||
data::Solution& globalCellData,
|
data::Solution& globalCellData,
|
||||||
const WellStateFullyImplicitBlackoil& localWellState,
|
const WellStateFullyImplicitBlackoil& localWellState,
|
||||||
@@ -364,30 +361,20 @@ namespace Opm
|
|||||||
const IndexMapType& localIndexMap,
|
const IndexMapType& localIndexMap,
|
||||||
const IndexMapStorageType& indexMaps,
|
const IndexMapStorageType& indexMaps,
|
||||||
const bool isIORank )
|
const bool isIORank )
|
||||||
: localState_( localState ),
|
: localCellData_( localCellData ),
|
||||||
globalState_( globalState ),
|
|
||||||
localCellData_( localCellData ),
|
|
||||||
globalCellData_( globalCellData ),
|
globalCellData_( globalCellData ),
|
||||||
localWellState_( localWellState ),
|
localWellState_( localWellState ),
|
||||||
globalWellState_( globalWellState ),
|
globalWellState_( globalWellState ),
|
||||||
localIndexMap_( localIndexMap ),
|
localIndexMap_( localIndexMap ),
|
||||||
indexMaps_( indexMaps )
|
indexMaps_( indexMaps )
|
||||||
{
|
{
|
||||||
|
|
||||||
if( isIORank )
|
if( isIORank )
|
||||||
{
|
{
|
||||||
// add missing data to global state
|
|
||||||
for (const auto& pair : localState.cellData()) {
|
|
||||||
const std::string& key = pair.first;
|
|
||||||
if (!globalState_.hasCellData( key )) {
|
|
||||||
globalState_.registerCellData( key , localState.numCellDataComponents( key ));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// add missing data to global cell data
|
// add missing data to global cell data
|
||||||
for (const auto& pair : localCellData_) {
|
for (const auto& pair : localCellData_) {
|
||||||
const std::string& key = pair.first;
|
const std::string& key = pair.first;
|
||||||
std::size_t container_size = globalState_.numCells() *
|
std::size_t container_size = numGlobalCells;
|
||||||
pair.second.data.size() / localState_.numCells();
|
|
||||||
auto ret = globalCellData_.insert(key, pair.second.dim,
|
auto ret = globalCellData_.insert(key, pair.second.dim,
|
||||||
std::vector<double>(container_size),
|
std::vector<double>(container_size),
|
||||||
pair.second.target);
|
pair.second.target);
|
||||||
@@ -413,13 +400,9 @@ namespace Opm
|
|||||||
// write all cell data registered in local state
|
// write all cell data registered in local state
|
||||||
for (const auto& pair : localCellData_) {
|
for (const auto& pair : localCellData_) {
|
||||||
const auto& data = pair.second.data;
|
const auto& data = pair.second.data;
|
||||||
const size_t stride = data.size()/localState_.numCells();
|
|
||||||
|
|
||||||
for( size_t i=0; i<stride; ++i )
|
// write all data from local data to buffer
|
||||||
{
|
write( buffer, localIndexMap_, data);
|
||||||
// write all data from local state to buffer
|
|
||||||
write( buffer, localIndexMap_, data, i, stride );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// write all data from local well state to buffer
|
// write all data from local well state to buffer
|
||||||
@@ -428,23 +411,16 @@ namespace Opm
|
|||||||
|
|
||||||
void doUnpack( const IndexMapType& indexMap, MessageBufferType& buffer )
|
void doUnpack( const IndexMapType& indexMap, MessageBufferType& buffer )
|
||||||
{
|
{
|
||||||
// write all cell data registered in local state
|
// we loop over the data as
|
||||||
// we loop over the data of the local state as
|
|
||||||
// its order governs the order the data got received.
|
// its order governs the order the data got received.
|
||||||
for (auto& pair : localCellData_) {
|
for (auto& pair : localCellData_) {
|
||||||
const std::string& key = pair.first;
|
const std::string& key = pair.first;
|
||||||
|
|
||||||
auto& data = globalCellData_.data(key);
|
auto& data = globalCellData_.data(key);
|
||||||
const size_t stride = data.size() / globalState_.numCells();
|
|
||||||
|
|
||||||
for( size_t i=0; i<stride; ++i )
|
//write all data from local cell data to buffer
|
||||||
{
|
read( buffer, indexMap, data);
|
||||||
//write all data from local state to buffer
|
|
||||||
read( buffer, indexMap, data, i, stride );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// read well data from buffer
|
// read well data from buffer
|
||||||
readWells( buffer );
|
readWells( buffer );
|
||||||
}
|
}
|
||||||
@@ -615,7 +591,7 @@ namespace Opm
|
|||||||
};
|
};
|
||||||
|
|
||||||
// gather solution to rank 0 for EclipseWriter
|
// gather solution to rank 0 for EclipseWriter
|
||||||
bool collectToIORank( const SimulationDataContainer& localReservoirState,
|
bool collectToIORank( const SimulationDataContainer& /*localReservoirState*/,
|
||||||
const WellStateFullyImplicitBlackoil& localWellState,
|
const WellStateFullyImplicitBlackoil& localWellState,
|
||||||
const data::Solution& localCellData,
|
const data::Solution& localCellData,
|
||||||
const int wellStateStepNumber )
|
const int wellStateStepNumber )
|
||||||
@@ -649,7 +625,7 @@ namespace Opm
|
|||||||
globalCellData_->clear();
|
globalCellData_->clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
PackUnPackSimulationDataContainer packUnpack( localReservoirState, *globalReservoirState_,
|
PackUnPackSimulationDataContainer packUnpack( numCells(),
|
||||||
localCellData, *globalCellData_,
|
localCellData, *globalCellData_,
|
||||||
localWellState, globalWellState_,
|
localWellState, globalWellState_,
|
||||||
localIndexMap_, indexMaps_,
|
localIndexMap_, indexMaps_,
|
||||||
@@ -663,7 +639,7 @@ namespace Opm
|
|||||||
#endif
|
#endif
|
||||||
if( isIORank() )
|
if( isIORank() )
|
||||||
{
|
{
|
||||||
// Update values in the globalReservoirState
|
// copy values from globalCellData to globalReservoirState
|
||||||
const std::map<std::string, std::vector<double> > no_extra_data;
|
const std::map<std::string, std::vector<double> > no_extra_data;
|
||||||
solutionToSim(*globalCellData_, no_extra_data, phaseUsage_, *globalReservoirState_);
|
solutionToSim(*globalCellData_, no_extra_data, phaseUsage_, *globalReservoirState_);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user