Class CrankNicolsonConvectionDiffusionEquation1D.Coefficients

  • Enclosing class:
    CrankNicolsonConvectionDiffusionEquation1D

    public static class CrankNicolsonConvectionDiffusionEquation1D.Coefficients
    extends Object
    Gets the coefficients of a discretized 1D convection-diffusion equation for each time step.
    • Constructor Detail

      • Coefficients

        public Coefficients​(ConvectionDiffusionEquation1D pde,
                            int M,
                            int N,
                            double[] x)
        Constructs the coefficient computation
        Parameters:
        pde - a 1 dimensional convection-diffusion equation
        M - the number of grid points along the time-axis (excluding the initial condition)
        N - the number of grid points along the space-axis (excluding the two boundaries)
        x - the spatial grid
    • Method Detail

      • getLHS

        public TridiagonalMatrix getLHS​(double tm)
        Gets the left hand side coefficient matrix of the Crank-Nicolson scheme.
        Parameters:
        tm - a timestamp
        Returns:
        the left hand side tridiagonal coefficient matrix
      • getRHS

        public Vector getRHS​(Vector um,
                             double tm)
        Computes the right hand side vector of the Crank-Nicolson scheme.
        Parameters:
        um - the solution at m
        tm - a timestamp
        Returns:
        the right hand side vector