Skip to content
Snippets Groups Projects
Commit 93bf19c1 authored by Bernd Flemisch's avatar Bernd Flemisch Committed by Timo Koch
Browse files

[assembly][newton] reimplement partial reassembly

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.
parent 39d52d47
No related branches found
No related tags found
1 merge request!796[assembly][newton] reimplement partial reassembly
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment