Skip to content

Commit

Permalink
Set eigenvalue field with evp set_state
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Mar 21, 2024
1 parent 328a4f4 commit 1cd4424
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions dedalus/core/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,18 @@ def solve_sparse(self, subproblem, N, target, rebuild_matrices=False, left=False
self.eigenvalues, pre_right_evecs = eig_output
self.right_eigenvectors = self.eigenvectors = sp.pre_right @ pre_right_evecs

def set_state(self, index, subsystem):
def set_state(self, index, subsystem=0):
"""
Set state vector to the specified eigenmode.
Parameters
----------
index : int
Index of desired eigenmode.
subsystem : Subsystem object or int
subsystem : Subsystem object or int, optional
Subsystem that will be set to the corresponding eigenmode.
If an integer, the corresponding subsystem of the last specified
eigenvalue_subproblem will be used.
eigenvalue_subproblem will be used. Default: 0.
"""
# TODO: allow setting left modified eigenvectors?
subproblem = self.eigenvalue_subproblem
Expand All @@ -317,6 +317,8 @@ def set_state(self, index, subsystem):
for var in self.state:
var['c'] = 0
subsystem.scatter(self.eigenvectors[:, index], self.state)
# Set eigenvalue
self.problem.eigenvalue['g'] = self.eigenvalues[index]


class LinearBoundaryValueSolver(SolverBase):
Expand Down

0 comments on commit 1cd4424

Please sign in to comment.