Couple the TransportSimulation with RichardsSimulation
Description
Couple the TransportSimulation
with RichardsSimulation
.
Proposal
In order to make the coupling, it is needed that the RichardsSimulation
provides the water flux and the water content at the current time and at the time before. This means that any information shared by the RichardsSimulation
must be persistent even if the RichardsSimulation
has changed. For this, I propose to share the current_state
of the model by sharing the grid function space, the vector of coefficients, and the current time. The first two as shared pointers.
struct State {
using GridFunctionSpace = ...;
using Coefficients = ...;
using TimeField = ...;
shared_ptr<GridFunctionSpace> grid_function_space;
shared_ptr<Coefficients> coefficients;
TimeField time;
};
Sharing this is important for adaptivity due to the fact that it has to be done in a synchronized state and for all the grid function spaces and coefficients at the same time. Hence, they have to be shared anyways.
With the data exchange defined, I propose a class called RichardsTransportCouplingSimulation
that creates the RichardsSimulation
and the TransportSimulation
and provide them with correct data at construction and simulation steps. Each step of this class will be equivalent to a step of RichardsSimulation
and as many as needed of TransportSimulation
so that both models are synchronized at the end of the step. Such a class will also be in charge of adaptivity by (i) asking one of the models to mark the grid, and (ii) gathering the grid function spaces and coefficients and finally adopting them.
How to test the implementation?
Running a system test.
Related issues
See #62 (closed)