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.setBoundaryConditions(A, b, boundaries, Istart_boundaries, Iend_boundaries, rank)[source]

Given a parallel matrix and a parallel vector, set Dirichlet boundary conditions.

Parameters:
  • matrix A (petsc) – sparse and complex coefficients matrix in petsc format
  • vector b (petsc) – parallel right hand side
  • vector boundaries (petsc) – array of boundary indexes
  • Istart_boundaries (int) – init range for boundaries
  • Iend_boundaries (int) – last range for boundaries
Para int rank:

MPI rank

Returns:

equation system after applied Dirichlet boundary conditions and elapsed time

Return type:

petsc matrix, petsc vector and float.

petgem.solver.solver.solveSystem(A, b, x, rank)[source]

Solve a matrix system of the form Ax = b in parallel.

Parameters:
  • matrix A (petsc) – sparse and complex coefficients matrix in petsc format
  • vector b (petsc) – parallel right hand side
  • vector x (petsc) – parallel solution vector
  • rank (int) – MPI rank
Returns:

solution of the equation system, iteration number of solver and elapsed time

Return type:

petsc vector, int and float

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

Unitary test for solver.py script.