Skip to content

Commit

Permalink
Add print_subproblem_ranks for NLBVP
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Mar 30, 2024
1 parent f263415 commit f86f309
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions dedalus/core/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,17 @@ def __init__(self, problem, **kw):
self.F = F_handler.fields
logger.debug('Finished NLBVP instantiation')

def print_subproblem_ranks(self, subproblems=None):
"""Print rank of each subproblem LHS."""
if subproblems is None:
subproblems = self.subproblems
# Check matrix rank
for i, sp in enumerate(subproblems):
if not hasattr(sp, 'dF_min'):
continue
dF = sp.dF_min.A
print(f"MPI rank: {self.dist.comm.rank}, subproblem: {i}, group: {sp.group}, matrix rank: {np.linalg.matrix_rank(dF)}/{dF.shape[0]}, cond: {np.linalg.cond(dF):.1e}")

def newton_iteration(self, damping=1):
"""Update solution with a Newton iteration."""
# Compute RHS
Expand Down

0 comments on commit f86f309

Please sign in to comment.