Skip to content
  • Bernd Flemisch's avatar
    [assembly][newton] reimplement partial reassembly · 93bf19c1
    Bernd Flemisch authored and Timo Koch's avatar Timo Koch committed
    Transfer the partial reassembly functionality to the current
    structure.
    
    The `NewtonSolver` is responsible for the partial reassembly.
    It owns a `unique_ptr` to an object of a new class
    `PartialReassembler` which is invoked in the constructor as well as
    in the methods `solve`, `newtonUpdate` and `assembleLinearSystem`.
    The `PartialReassembler` object is created only if the parameter
    `Newton.EnablePartialReassembly` is set to true.
    
    After each Newton iteration, the `PartialReassembler` colors the
    geometrical degrees of freedom depending on the shift of the
    primary variables from the last time that the derivatives have been
    calculated. This shift is updated by the function
    `updateDistanceFromLastLinearization_` of the `NewtonSolver` and
    passed to the function `computeColors` of the `PartialReassembler`
    for the actual coloring. For green-colored entities, the entries in
    the Jacobian are kept, while for the other entities, they are
    recalculated.
    
    Use an enum class `EntityColor` for the coloring, enable read
    access to the color of an entity via the `PartialReassembler`.
    
    Pass a pointer to the `PartialReassembler` when calling the routine
    `assembleJacobianAndResidual` of the `Assembler`. Use SFINAE and
    `enable_if` so that only assemblers accepting the additional
    argument are invoked. The correspnding local assemblers have to be
    adapted such that no calculations are performed for green elements.
    Implement the functionality for Box, TPFA and MPFA; adapt the
    `FVAssembler` as well as the `Box`/`CCLocalAssembler`
    correspondingly.
    
    The `PartialReassembler` throws if constructed with a discretization
    method equal to None or Staggered. All `BoxLocalAssembler`s apart
    from the implicit numeric one throw if called with a non-nullptr
    to a `PartialReassembler`.
    
    Allow for a default `nullptr` parameter to the assembly functions
    that take a `PartialReassembler`. This requires a new class
    `DefaultPartialReassembler` to be passed as a default template
    parameter for these functions. This makes it possible to use the
    functions `assembleJacobianAndResidual` of the global and local
    assemblers as before without the additional argument.
    
    Allow to set the thresholds and the weight for the calculation of
    the effective reassembly threshold as parameters. Try to explain
    the corresponding formula in a comment.
    
    Use the functionality in the two-phase incompressible tests.
    93bf19c1