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:
Markus Blatt 2016-05-24 19:52:09 +00:00
parent 9c771ab6b1
commit 22e71dff08

View File

@ -219,7 +219,7 @@ public:
{
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
{
@ -240,6 +240,10 @@ public:
buffer.write(sendState_.rv()[e.index()]);
buffer.write(sendState_.pressure()[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 )
{
buffer.write(sendState_.saturation()[e.index()*sendState_.numPhases()+i]);
@ -274,6 +278,10 @@ public:
recvState_.pressure()[e.index()]=val;
buffer.read(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 )
{
buffer.read(val);
@ -440,9 +448,10 @@ void distributeGridAndData( Dune::CpGrid& grid,
distributed_material_law_manager,
grid.numCells());
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(),
std::numeric_limits<double>::max());
distributed_state.hydroCarbonState().resize(grid.numCells()*state.numPhases());
BlackoilStateDataHandle state_handle(global_grid, grid,
state, distributed_state);
BlackoilPropsDataHandle props_handle(properties,