darsia.BeckmannNewtonSolver#

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

Bases: BeckmannProblem

Class to determine the L1 EMD/Wasserstein distance solved with Newton’s method.

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

Solves the Beckmann problem in mixed form with a Newton-like method. The linearization of the optimality conditions is relaxed with a cut-off parameter L for the mobility. In addition, to circumvent singular Jacobians, merely a fixed-point type linearization is employed. This results in a method that is in between a pure Newton method and a fixed-point iteration.

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.

compute_jacobian(solution)

Compute the Jacobian of the optimality conditions.

compute_residual(solution, beckmann_problem_rhs)

Compute the residual of the solution - the optimality conditions.

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(mass_diff)

Solve the Beckmann problem using Newton's 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

convergence_criteria

"Convergence criteria for the Newton iteration.

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

compute_jacobian(solution)[source]#

Compute the Jacobian of the optimality conditions.

Parameters:
solutionnp.ndarray

Solution.

Returns:
sps.linalg.splu

LU factorization of the jacobian.

compute_residual(solution, beckmann_problem_rhs)[source]#

Compute the residual of the solution - the optimality conditions.

Parameters:
solutionnp.ndarray

Solution.

Returns:
np.ndarray

Residual.

solve_beckmann_problem(mass_diff)[source]#

Solve the Beckmann problem using Newton’s method.

Parameters:
mass_diffnp.ndarray

Difference of mass distributions.

Returns:
tuple

Distance, solution, info.

convergence_criteria#

“Convergence criteria for the Newton iteration.