darsia.BeckmannBregmanSolver#
- class BeckmannBregmanSolver(grid, weight=None, options={})[source]#
Bases:
BeckmannProblemClass to determine the Wasserstein distance solved with the Bregman method.
Implements the
darsia.BeckmannProbleminterface by specifying the methoddarsia.BeckmannProblem.solve_beckmann_problem().Initialise the Bregman solver.
- Parameters:
- grid
darsia.Grid Tensor grid associated with the images.
- weight
darsia.Image,optional Weight for the heterogeneous case.
- options
dict,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
- grid
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
Penalty parameter for the Bregman iteration, associated to face mobility.
Function to determine whether/when to update the Bregman regularization.
Convergence criteria for the Bregman solver.
griddarsia.Grid: grid
voxel_sizenp.ndarray: voxel size
optionsdict: options for the solver
regularizationfloat: regularization parameter
verbosebool: verbosity
mobility_modestr: mode for computing the mobility
weightWeight defined on cells
callbackslist: 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_diff
np.ndarray Difference of mass distributions.
- flat_mass_diff
- Returns:
tupleDistance, 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.