In this function, the modeling equations (in this case mass conservation of oil, water and polymer) are assembled. The function returns the residual vector (one value per cell) and the Jacobians with respect to the main variables (pressure, saturation and polymer concentration).
function eqs = equationOWPolymer(state0, state, dt, bc, system, param)
Computation of the mobilities, in the cells. The mobilities at the dirichlet boundary have been already computed.
For an implicit solver, we compute the mobility using the current values for pressure, saturation and polymer concentration. For an explicit solver, we use the previous values. Note that this is the only modifications which are needed in the code to switch between an implicit and explicit transport solver.