Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create config for setting solver #58

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Empty file added femwell/maxwell/__init__.py
Empty file.
13 changes: 11 additions & 2 deletions femwell/maxwell/waveguide.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Waveguide analysis based on https://doi.org/10.1080/02726340290084012."""
from dataclasses import dataclass
from functools import cached_property
from typing import List
from typing import List, Optional

import matplotlib.pyplot as plt
import numpy as np
Expand Down Expand Up @@ -30,6 +30,13 @@
from skfem.utils import solver_eigen_scipy


class Conf:
solver = "scipy"


CONFIG = Conf()


@dataclass(frozen=True)
class Mode:
frequency: float
Expand Down Expand Up @@ -196,8 +203,10 @@ def compute_modes(
metallic_boundaries=False,
radius=np.inf,
n_guess=None,
solver="slepc",
solver: Optional[str] = None,
) -> Modes:
solver = solver or CONFIG.solver

if solver == "scipy":
solver = solver_eigen_scipy
elif solver == "slepc":
Expand Down