qmat.solvers.sdc ================ .. py:module:: qmat.solvers.sdc .. autoapi-nested-parse:: Functions to run SDC and evaluate its numerical error on simple problems. Functions --------- .. autoapisummary:: qmat.solvers.sdc.solveDahlquistSDC qmat.solvers.sdc.errorDahlquistSDC qmat.solvers.sdc.getOrderSDC Module Contents --------------- .. py:function:: solveDahlquistSDC(lam, u0, tEnd, nSteps: int, nSweeps: int, Q: numpy.ndarray, QDelta: numpy.ndarray, weights=None, monitors=None) Solve the Dahlquist problem with SDC. :Parameters: * **lam** (*complex or float*) -- The :math:`\lambda` coefficient. * **u0** (*complex or float*) -- The initial solution :math:`u_0`. * **tEnd** (*float*) -- Final time :math:`T`. * **nSteps** (*int*) -- Number of time-step for the whole :math:`[0,T]` interval. * **nSweeps** (*int*) -- Number of SDC sweeps. * **Q** (*np.ndarray*) -- Quadrature matrix :math:`Q` used for SDC. * **QDelta** (*np.ndarray*) -- Approximate quadrature matrix :math:`Q_\Delta` used for SDC. If three dimensional, use the first dimension for the sweep index. * **weights** (*np.ndarray, optional*) -- Quadrature weights to use for the step update. If None, step update is not performed. The default is None. :returns: **uNum** -- Array containing the `nSteps+1` solutions :math:`\{u(0), ..., u(T)\}`. :rtype: np.ndarray .. py:function:: errorDahlquistSDC(lam, u0, tEnd, nSteps, nSweeps, Q, QDelta, weights=None, uNum=None) Compute the time :math:`L_\infty` error of SDC. :Parameters: * **lam** (*complex or float*) -- The :math:`\lambda` coefficient. * **u0** (*complex or float*) -- The initial solution :math:`u_0`. * **tEnd** (*float*) -- Final time :math:`T`. * **nSteps** (*int*) -- Number of time-step for the whole :math:`[0,T]` interval. * **nSweeps** (*int*) -- Number of SDC sweeps. * **Q** (*np.ndarray*) -- Quadrature matrix :math:`Q` used for SDC. * **QDelta** (*np.ndarray*) -- Approximate quadrature matrix :math:`Q_\Delta` used for SDC. * **weights** (*np.ndarray, optional*) -- Quadrature weights to use for the step update. If None, step update is not performed. The default is None. * **uNum** (*np.ndarray, optional*) -- Numerical solution, if not provided use the `solveDahlquist` method to compute the solution. The default is None. :returns: The :math:`L_\infty` norm. :rtype: float .. py:function:: getOrderSDC(coll, nSweeps, qDelta, stepUpdate) Give the expected order of SDC after a fixed number of iterations. :Parameters: * **coll** (:class:`qmat.qcoeff.collocation.Collocation`) -- The underlying `Collocation` class. * **nSweeps** (*int*) -- Number of sweeps for SDC. * **qDelta** (*str*) -- Type of the :math:`Q_\Delta` approximation used. * **stepUpdate** (*bool*) -- Wether or not the stepUpdate is done at the end. :returns: **order** -- Expected order of the SDC time-integration. :rtype: int