solver.py

Define functions to find the solution of a sparse linear system of the format Ax = b, in Edge Finite Element Method (EFEM) of lowest order in tetrahedral meshes.

petgem.solver.solver.direct_scipy(A, b)[source]

Interface to direct sparse scipy solver.

Parameters:
  • A (ndarray) – sparse and complex coefficients matrix in a CSR format.
  • b (ndarray) – rigth hand side.
Returns:

solution to the system.

Return type:

ndarray of complex coefficients.

petgem.solver.solver.iterative_scipy(A, b, type_solver, tol, maxiter)[source]

Interface to iterative sparse scipy solver.

Parameters:
  • A (ndarray) – sparse and complex coefficients matrix in a CSR format.
  • b (ndarray) – rigth hand side.
  • type_solver (str) – solver type. Available solvers are: bicgstab.
  • tol (float) – solver tolerance.
  • maxiter (int) – maximum number of solver iterations.
Returns:

solution to the system.

Return type:

ndarray of complex coefficients.

petgem.solver.solver.set_dirichlet_boundaries(A, b, in_boundaries)[source]

Compute the list of degrees of freedom.

Parameters:
  • A (ndarray) – sparse and complex coefficients matrix in a CSR format.
  • b (ndarray) – rigth hand side.
  • in_boundaries (ndarray) – boundary-edges array.
Returns:

equation system after applied Dirichlet BC.

Return type:

ndarray.

petgem.solver.solver.solver(A, b, boundaries, model)[source]

Solve a matrix system of the form Ax = b.

Parameters:
  • A (ndarray) – sparse and complex coefficients matrix in a CSR format.
  • b (ndarray) – rigth hand side.
  • boundaries (ndarray) – boundary-edges array.
  • model (object_modelling) – CSEM modelling with physical parameters.
Returns:

solution to the system.

Return type:

ndarray of complex coefficients.

petgem.solver.solver.unitary_test()[source]

Unitary test for solver.py script.