Ejemplo n.º 1
0
    def eval_f(self,u,t):
        """
        Routine to evaluate both parts of the RHS

        Args:
            u: current values
            t: current time

        Returns:
            the RHS divided into two parts
        """

        f = rhs_imex_mesh(self.nvars)
        f.impl = self.__eval_fimpl(u,t)
        f.expl = self.__eval_fexpl(u,t)
        return f
Ejemplo n.º 2
0
    def prolong_space(self, G):
        """
        Dummy prolongation routine

        Args:
            G: the coarse level data (easier to access than via the coarse attribute)
        """

        if isinstance(G, mesh):
            F = mesh(G)
        elif isinstance(G, rhs_imex_mesh):
            F = rhs_imex_mesh(G)
        else:
            print("Transfer error")
            exit()
        return F
Ejemplo n.º 3
0
    def eval_f(self, u, t):
        """
        Routine to evaluate both parts of the RHS

        Args:
            u: current values
            t: current time

        Returns:
            the RHS divided into two parts
        """

        f = rhs_imex_mesh(self.nvars)
        f.impl = self.__eval_fimpl(u, t)
        f.expl = self.__eval_fexpl(u, t)
        return f
Ejemplo n.º 4
0
    def prolong_space(self,G):
        """
        Prolongation implementation

        Args:
            G: the coarse level data (easier to access than via the coarse attribute)
        """

        if isinstance(G,mesh):
            u_fine = mesh(self.init_c,val=0)
            u_fine.values = self.Pspace.dot(G.values)
        elif isinstance(G,rhs_imex_mesh):
            u_fine = rhs_imex_mesh(self.init_c)
            u_fine.impl.values = self.Pspace.dot(G.impl.values)
            u_fine.expl.values = self.Pspace.dot(G.expl.values)

        return u_fine
Ejemplo n.º 5
0
    def restrict_space(self,F):
        """
        Restriction implementation

        Args:
            F: the fine level data (easier to access than via the fine attribute)
        """

        if isinstance(F,mesh):
            u_coarse = mesh(self.init_c,val=0)
            u_coarse.values = self.Rspace.dot(F.values)
        elif isinstance(F,rhs_imex_mesh):
            u_coarse = rhs_imex_mesh(self.init_c)
            u_coarse.impl.values = self.Rspace.dot(F.impl.values)
            u_coarse.expl.values = self.Rspace.dot(F.expl.values)

        return u_coarse
Ejemplo n.º 6
0
    def restrict_space(self, F):
        """
        Dummy restriction routine

        Args:
            F: the fine level data (easier to access than via the fine attribute)

        """

        if isinstance(F, mesh):
            G = mesh(F)
        elif isinstance(F, rhs_imex_mesh):
            G = rhs_imex_mesh(F)
        else:
            print("Transfer error")
            exit()
        return G
Ejemplo n.º 7
0
    def restrict_space(self, F):
        """
        Restriction implementation

        Args:
            F: the fine level data (easier to access than via the fine attribute)
        """

        if isinstance(F, mesh):
            u_coarse = mesh(self.init_c, val=0)
            u_coarse.values = np.dot(self.Rspace, F.values)
        elif isinstance(F, rhs_imex_mesh):
            u_coarse = rhs_imex_mesh(self.init_c)
            u_coarse.impl.values = np.dot(self.Rspace, F.impl.values)
            u_coarse.expl.values = np.dot(self.Rspace, F.expl.values)

        return u_coarse
Ejemplo n.º 8
0
    def prolong_space(self, G):
        """
        Prolongation implementation

        Args:
            G: the coarse level data (easier to access than via the coarse attribute)
        """

        if isinstance(G, mesh):
            u_fine = mesh(self.init_c, val=0)
            u_fine.values = np.dot(self.Pspace, G.values)
        elif isinstance(G, rhs_imex_mesh):
            u_fine = rhs_imex_mesh(self.init_c)
            u_fine.impl.values = np.dot(self.Pspace, G.impl.values)
            u_fine.expl.values = np.dot(self.Pspace, G.expl.values)

        return u_fine