darsia.BeckmannNewtonSolver#
- class BeckmannNewtonSolver(grid, weight=None, options={})[source]#
Bases:
BeckmannProblemClass to determine the L1 EMD/Wasserstein distance solved with Newton’s method.
Implements the
darsia.BeckmannProbleminterface by specifying the methoddarsia.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 for the Newton iteration.
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
- compute_jacobian(solution)[source]#
Compute the Jacobian of the optimality conditions.
- Parameters:
- solution
np.ndarray Solution.
- solution
- Returns:
sps.linalg.spluLU factorization of the jacobian.
- compute_residual(solution, beckmann_problem_rhs)[source]#
Compute the residual of the solution - the optimality conditions.
- Parameters:
- solution
np.ndarray Solution.
- solution
- Returns:
np.ndarrayResidual.
- solve_beckmann_problem(mass_diff)[source]#
Solve the Beckmann problem using Newton’s method.
- Parameters:
- mass_diff
np.ndarray Difference of mass distributions.
- mass_diff
- Returns:
tupleDistance, solution, info.
- convergence_criteria#
“Convergence criteria for the Newton iteration.