mirror of
https://github.com/OPM/opm-simulators.git
synced 2025-02-25 18:55:30 -06:00
Correctly distribute the hydro carbon state for parallel runs.
This is needed since hydro carbon state is used to get the
primal variables since PR #687, commit 9c771ab6
. Therefore we
now distribute the state along with rest of the black oil state
variable at the start of a parallel simulation.
This closes issue #695
This commit is contained in:
parent
9c771ab6b1
commit
22e71dff08
@ -219,7 +219,7 @@ public:
|
|||||||
{
|
{
|
||||||
if ( T::codimension == 0)
|
if ( T::codimension == 0)
|
||||||
{
|
{
|
||||||
return 2 * sendState_.numPhases() +4+2*sendGrid_.numCellFaces(e.index());
|
return 2 * sendState_.numPhases() + 5 + 2*sendGrid_.numCellFaces(e.index());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -240,6 +240,10 @@ public:
|
|||||||
buffer.write(sendState_.rv()[e.index()]);
|
buffer.write(sendState_.rv()[e.index()]);
|
||||||
buffer.write(sendState_.pressure()[e.index()]);
|
buffer.write(sendState_.pressure()[e.index()]);
|
||||||
buffer.write(sendState_.temperature()[e.index()]);
|
buffer.write(sendState_.temperature()[e.index()]);
|
||||||
|
//We can only send one type with this buffer. Ergo we convert the enum to a double.
|
||||||
|
double hydroCarbonState_ = sendState_.hydroCarbonState()[e.index()];
|
||||||
|
buffer.write(hydroCarbonState_);
|
||||||
|
|
||||||
for ( size_t i=0; i<sendState_.numPhases(); ++i )
|
for ( size_t i=0; i<sendState_.numPhases(); ++i )
|
||||||
{
|
{
|
||||||
buffer.write(sendState_.saturation()[e.index()*sendState_.numPhases()+i]);
|
buffer.write(sendState_.saturation()[e.index()*sendState_.numPhases()+i]);
|
||||||
@ -274,6 +278,10 @@ public:
|
|||||||
recvState_.pressure()[e.index()]=val;
|
recvState_.pressure()[e.index()]=val;
|
||||||
buffer.read(val);
|
buffer.read(val);
|
||||||
recvState_.temperature()[e.index()]=val;
|
recvState_.temperature()[e.index()]=val;
|
||||||
|
//We can only send one type with this buffer. Ergo we convert the enum to a double.
|
||||||
|
buffer.read(val);
|
||||||
|
recvState_.hydroCarbonState()[e.index()]=static_cast<HydroCarbonState>(val);
|
||||||
|
|
||||||
for ( size_t i=0; i<recvState_.numPhases(); ++i )
|
for ( size_t i=0; i<recvState_.numPhases(); ++i )
|
||||||
{
|
{
|
||||||
buffer.read(val);
|
buffer.read(val);
|
||||||
@ -440,9 +448,10 @@ void distributeGridAndData( Dune::CpGrid& grid,
|
|||||||
distributed_material_law_manager,
|
distributed_material_law_manager,
|
||||||
grid.numCells());
|
grid.numCells());
|
||||||
BlackoilState distributed_state(grid.numCells(), grid.numFaces(), state.numPhases());
|
BlackoilState distributed_state(grid.numCells(), grid.numFaces(), state.numPhases());
|
||||||
// construction does not resize surfacevol. Do it manually.
|
// construction does not resize surfacevol and hydroCarbonState. Do it manually.
|
||||||
distributed_state.surfacevol().resize(grid.numCells()*state.numPhases(),
|
distributed_state.surfacevol().resize(grid.numCells()*state.numPhases(),
|
||||||
std::numeric_limits<double>::max());
|
std::numeric_limits<double>::max());
|
||||||
|
distributed_state.hydroCarbonState().resize(grid.numCells()*state.numPhases());
|
||||||
BlackoilStateDataHandle state_handle(global_grid, grid,
|
BlackoilStateDataHandle state_handle(global_grid, grid,
|
||||||
state, distributed_state);
|
state, distributed_state);
|
||||||
BlackoilPropsDataHandle props_handle(properties,
|
BlackoilPropsDataHandle props_handle(properties,
|
||||||
|
Loading…
Reference in New Issue
Block a user