Skip to content

Commit

Permalink
Minor tweaks adding subproblem buffers and background vars to EVP
Browse files Browse the repository at this point in the history
  • Loading branch information
kburns committed Apr 18, 2024
1 parent b0b4363 commit d83755b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions dedalus/core/problems.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,9 @@ def build_EVP(self, eigenvalue=None, backgrounds=None, perturbations=None, **kw)
# Add linearized equation and copy valid modes
evp_eqn = EVP.add_equation((M + L - dF, 0))
evp_eqn['valid_modes'][:] = eqn['valid_modes']
# Add backgrounds to EVP namespace
for var in backgrounds:
EVP.local_namespace[var.name] = var
return EVP


Expand Down
8 changes: 6 additions & 2 deletions dedalus/core/subsystems.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,12 @@ def __init__(self, solver, subsystems, group):
# Build input and output buffers and views, except for EVPs
from .problems import EigenvalueProblem
if not isinstance(problem, EigenvalueProblem):
self._input_buffer, self._input_views = self._build_buffer_views(self.problem.LHS_variables)
self._output_buffer, self._output_views = self._build_buffer_views([eqn['F'] for eqn in problem.equations])
self._build_buffers()

def _build_buffers(self):
self._input_buffer, self._input_views = self._build_buffer_views(self.problem.LHS_variables)
if 'F' in self.problem.equations[0]:
self._output_buffer, self._output_views = self._build_buffer_views([eqn['F'] for eqn in self.problem.equations])

@CachedAttribute
def shape(self):
Expand Down

0 comments on commit d83755b

Please sign in to comment.