Change Driver Generation
Idea
Writing driver for operator splitting problems is quite ugly. If I have two PDEs I want to couple I can generate both drivers separately and copy/paste/modify a new driver but it's no fun. One idea to solve this problem is to generate drivers like the one attached. The whole setup of the PDESolver (might be stationary or instationary) happens within a class (called DriverBlock in the example). You can acces relevant data through get_* methods which provide a shared pointer to the object.
Goal
Solving a stationary problem could then be done like this
using DB = DriverBlock<GV, Dune::ParameterTree>;
DB driverBlock(gv, initree);
auto slp = driverBlock.get_solver();
slp->apply();
In the case of operator splitting one would need to be able to set the coefficient functions in the other operator. I will try out how that could look like. I hope that something like this is possible:
// Setup driver blocks
using DB_A = DriverBlockA<GV, Dune::ParameterTree>;
DB_A driverBlockA(gv, initree);
using DB_A = DriverBlockB<GV, Dune::ParameterTree>;
DB_B driverBlockB(gv, initree);
// Set coefficient functions
auto x_a = driverBlockA.get_coefficient();
auto x_b = driverBlockB.get_coefficient();
DriverBlockA::Coefficient x_a_new(*x_a)
DriverBlockB::Coefficient x_b_new(*x_b)
driverBlockA.set_coefficient_function(x_b_new);
driverBlockB.set_coefficient_function(x_a_new);
// Get PDE solvers
auto osm_a = driverBlockA.get_solver();
auto osm_b = driverBlockB.get_solver();
// Time loop
double time=0;
double dt=0.1;
double T=10;
while (time<T-1e-8){
osm_a->apply(time, dt, *x_a, x_a_new);
osm_b->apply(time, dt, *x_b, x_b_new);
*x_a = x_a_new;
*x_b = x_b_new;
time += dt;
}
Ini File
One could then introduce options for driver blocks in the ini file eg
[formcompiler]
driver_blocks = driver_a, driver_b
[formcompiler.driver_a]
classname = DriverBlockA
filename = driver_block_a.hh
spatial_form = a
mass_form = a_mass
...
[formcompiler.driver_b]
classname = DriverBlockB
filename = driver_block_b.hh
spatial_form = b
mass_form = b_mass