From 1cd44240d864484b380a4f8f8a7d7923c5bc5296 Mon Sep 17 00:00:00 2001 From: "Keaton J. Burns" Date: Thu, 21 Mar 2024 15:11:44 +0100 Subject: [PATCH] Set eigenvalue field with evp set_state --- dedalus/core/solvers.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dedalus/core/solvers.py b/dedalus/core/solvers.py index 1fa6b233..5e34bddc 100644 --- a/dedalus/core/solvers.py +++ b/dedalus/core/solvers.py @@ -293,7 +293,7 @@ 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. @@ -301,10 +301,10 @@ def set_state(self, index, subsystem): ---------- 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 @@ -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):