spectral_galerkin_heat.solvers.spectral_cpu_linear ================================================== .. py:module:: spectral_galerkin_heat.solvers.spectral_cpu_linear .. autoapi-nested-parse:: Spectral CPU Linear Solver Implementation. Classes ------- .. autoapisummary:: spectral_galerkin_heat.solvers.spectral_cpu_linear.SpectralSolverCPULinear Module Contents --------------- .. py:class:: SpectralSolverCPULinear(context = None) Bases: :py:obj:`spectral_galerkin_heat.solvers.base.HeatSolver` SpectralSolverCPULinear implements a strictly linear spectral method for solving the heat equation on the CPU. It disables latent heat and evaporation, applying only the laser source. Useful for testing against exact linear analytical solutions. .. py:method:: initialize(context = None) Set up the spectral solver state, allocate buffers, and set the initial condition. :param context: If provided, replaces the stored SimulationContext. By default None. :type context: SimulationContext, optional :returns: The initialized solver state object containing grid buffers and spectra. :rtype: spectral_galerkin_heat.physics.spectral_cpu_kernels.SpectralSolverState :raises RuntimeError: If SimulationContext is neither provided here nor at construction. .. py:method:: step(t, dt) Advance the spectral solution by one time step linearly. Only the laser source is applied. No latent heat or evaporation. :param t: Current simulation time. :type t: float :param dt: Time step size. :type dt: float :returns: SsState : spectral_galerkin_heat.physics.spectral_cpu_kernels.SpectralSolverState The updated linear solver state. metrics : dict Metrics from the iteration, such as max temperature and number of evaporation steps. :rtype: tuple .. py:method:: set_state(temperature_field) Overwrite the internal spectral coefficients from a spatial temperature field. :param temperature_field: A 3-D array (shape ``(N_z, N_y, N_x)``) containing temperatures. :type temperature_field: np.ndarray :raises RuntimeError: If called before the solver is initialized. .. py:method:: finalize() Clean up CPU resources.