matto.utility#

Solver options and their defaults, the Newton wrapper for the state problem, and the gather of a parallel field into serial ordering for the saved arrays.

matto.utility.apply_petsc_options(petsc_object, petsc_options, prefix=None)[source]#

Apply a dict of PETSc options to one prefixed solver object.

matto.utility.resolve_solver_options(fem_options)[source]#

Return {state, adjoint, filter} solver settings with defaults.

Accepts fem_options["solver_options"]. If only the older fem_options["petsc_options"] key is present, that dict is used for both the state and filter solvers.

class matto.utility.WrapNonlinearProblem(u, R, bcs=None, solver_options=None)[source]#

Bases: object

solve_fem()[source]#

Run Newton iteration until R(u) is within the state tolerances.

class matto.utility.Communicator(func_space, mesh_serial, size=1)[source]#

Bases: object

Communicate information among different processes.

bcast(func, global_values)[source]#

Broadcast data from Process 0 to all the other processes.

gather(func)[source]#

Gather owned values to Process 0 from all the other processes.

matto.utility.compare_matrices(array1, array2, precision=12, k=1)[source]#

Find the “args” such that array1[args] == array2.