evoxels.solvers
Classes
|
Generic wrapper for solving one or more fields with a time stepper. |
|
Multiphase-specific solver wrapper. |
|
Solver for steady-state problems. |
|
Solver for time-dependent problems. |
- class evoxels.solvers.BaseSolver(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda')
Generic wrapper for solving one or more fields with a time stepper.
- __init__(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda') None
- backend: str
- device: str = 'cuda'
- fieldnames: str | list[str]
- solve(time_increment=0.1, frames=10, max_iters=100, problem_kwargs=None, jit=True, verbose=True, vtk_out=False, plot_bounds=None, colormap='viridis')
Run the time integration loop.
- Parameters:
time_increment (float) – Size of a single time step.
frames (int) – Number of output frames (for plotting, vtk, checks).
max_iters (int) – Number of time steps to compute.
problem_kwargs (dict | None) – Problem-specific input arguments.
jit (bool) – Create just-in-time compiled kernel if
Trueverbose (bool | str) – If
Trueprints memory stats,'plot'updates an interactive plot.vtk_out (bool) – Write VTK files for each frame if
True.plot_bounds (tuple | None) – Optional value range for plots.
- step_fn: Callable | None = None
- timestepper_cls: Type[TimeStepper] | None = None
- vf: Any
- class evoxels.solvers.MultiPhaseSolver(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda', from_labels: bool = True, output_label_fieldname: str | None = None, max_phases: int = 10)
Multiphase-specific solver wrapper.
Two modes: (A) labels-mode (default):
from_labels=True and fieldnames=”labels” (or [“labels”]) -> reads a labeled integer array, builds one-hot phase tensor (P, Nx, Ny, Nz),
runs the solver, and exports a single label field by argmax over phases.
fields-mode: fieldnames = [“phi0”,”phi1”,…] -> stacks them to u with shape (P, Nx, Ny, Nz) and exports back to the same fields.
- Safety:
If P > max_phases, exits with a warning (dense arrays become RAM-critical).
- __init__(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda', from_labels: bool = True, output_label_fieldname: str | None = None, max_phases: int = 10) None
- from_labels: bool = True
- max_phases: int = 10
- output_label_fieldname: str | None = None
- phases_to_rgb(phis_slice)
Map phase-fields to RGB image.
- class evoxels.solvers.SteadyStatePseudoTimeSolver(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda', conv_crit: float = 1e-06, check_freq: int = 10)
Solver for steady-state problems.
- __init__(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda', conv_crit: float = 1e-06, check_freq: int = 10) None
- check_convergence(diff, verbose)
Check for convergence based on relative change in fields.
- check_freq: int = 10
- conv_crit: float = 1e-06
- class evoxels.solvers.TimeDependentSolver(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda')
Solver for time-dependent problems.
- __init__(vf: Any, fieldnames: str | list[str], backend: str, problem_cls: Type[ODE] | None = None, timestepper_cls: Type[TimeStepper] | None = None, step_fn: Callable | None = None, device: str = 'cuda') None