spectral_galerkin_heat.solvers.base
Abstract interface for Heat Equation Solvers.
Classes
Abstract interface for a Heat Equation Solver. |
Module Contents
- class spectral_galerkin_heat.solvers.base.HeatSolver
Bases:
abc.ABCAbstract interface for a Heat Equation Solver.
Encapsulates the physics engine and numerical methods for solving the transient heat equation with phase change and evaporation.
Contract: - Call
initializeonce beforestep. - Callsteprepeatedly to advance time. - Callfinalizeto release resources (GPU memory, etc.). - Do not modify returned state objects; callstepto evolve.- abstractmethod initialize(context)
Initialize (or re-initialize) the solver with the given context.
Stores the context internally, allocates fields and spectral coefficients, and returns the initial state object.
- Parameters:
context (SimulationContext) – Full simulation parameters (geometry, material, etc.).
- Returns:
The initial state object (implementation-dependent).
- Return type:
Any
- abstractmethod step(t, dt)
Advance the simulation by one time step dt.
- Parameters:
t (float) – Current simulation time.
dt (float) – Time step size.
- Returns:
- new_stateAny
The evolved state object.
- metricsdict
Dictionary of scalar diagnostics (e.g., {‘P_laser’: 50.0, ‘T_max’: 2000.0}).
- Return type:
tuple
- abstractmethod finalize()
Clean up resources (GPU memory, thread pools) if necessary.
- Return type:
None