darsia.BeckmannBregmanSolver#

class BeckmannBregmanSolver(grid, weight=None, options={})[source]#

Bases: BeckmannProblem

Class to determine the Wasserstein distance solved with the Bregman method.

Implements the darsia.BeckmannProblem interface by specifying the method darsia.BeckmannProblem.solve_beckmann_problem().

Initialise the Bregman solver.

Parameters:
griddarsia.Grid

Tensor grid associated with the images.

weightdarsia.Image, optional

Weight for the heterogeneous case.

optionsdict, optional

Solver options. Recognised keys, with defaults:

L (float)              1.0    penalty parameter (face mobility)
bregman_update         never  callable(iter) -> bool deciding
                              when to update the regularisation
num_iter (int)         100    max iterations
tol_residual (float)   inf    relative mass-conservation residual
tol_increment (float)  inf    relative aux/force increment
tol_distance (float)   inf    relative distance increment

Methods

broken_darcy_with_custom_flux_block(...)

Construct the broken Darcy operator with given flux-flux block.

cell_weighted_flux(cell_flux)

Compute the cell-weighted flux.

distance_matrix(images)

Compute the distance between each iteam of a list.

eliminate_flux(jacobian, residual)

Eliminate the flux block from the jacobian and residual.

eliminate_lagrange_multiplier(...)

Eliminate the lagrange multiplier from the reduced system.

exact_linearization(solution)

Compute the exact linearization of the constrained minimization problem.

flat_view(img)

Flatten the image to a vector.

flux_view(vector)

Extract the flux from the vector.

l1_dissipation(flat_flux)

Compute the l1 dissipation of the solution.

linear_solve(matrix, rhs[, ...])

Solve the linear system.

ndofs()

Return the total number of degrees of freedom.

optimality_conditions(solution, ...)

Evaluate optimality conditions of the constrained minimization problem.

pressure_view(vector)

Extract the pressure from the vector.

rescaled_flux_optimality_conditions(solution)

Evaluate scaled optimality conditions of the constrained minimization problem.

solve_beckmann_problem(flat_mass_diff)

Solve the Beckmann problem using the Bregman method.

transport_density(flat_flux[, weighted, flatten])

Compute the transport density from the solution.

transport_density_faces(flat_flux)

Compute the transport density from the solution.

Attributes

L

Penalty parameter for the Bregman iteration, associated to face mobility.

bregman_update

Function to determine whether/when to update the Bregman regularization.

convergence_criteria

Convergence criteria for the Bregman solver.

grid

darsia.Grid: grid

voxel_size

np.ndarray: voxel size

options

dict: options for the solver

regularization

float: regularization parameter

verbose

bool: verbosity

mobility_mode

str: mode for computing the mobility

weight

Weight defined on cells

callbacks

list: list of callbacks to be called during the optimization

solve_beckmann_problem(flat_mass_diff)[source]#

Solve the Beckmann problem using the Bregman method.

Parameters:
flat_mass_diffnp.ndarray

Difference of mass distributions.

Returns:
tuple

Distance, solution, info.

L#

Penalty parameter for the Bregman iteration, associated to face mobility.

bregman_update#

Function to determine whether/when to update the Bregman regularization.

convergence_criteria#

Convergence criteria for the Bregman solver.