Exemple #1
0
    def __init__(self, *args, **kwargs):
        super(LambdaU, self).__init__(*args, **kwargs)
        HasExactSolutionMixin.__init__(self, *args, **kwargs)
        HasDirectImplicitMixin.__init__(self, *args, **kwargs)
        if self.time_start is None:
            self.time_start = 0.0
        if self.time_end is None:
            self.time_end = 1.0
        if self.initial_value is None:
            self.initial_value = complex(1.0, 0.0) * np.ones(self.dim)
            # self.initial_value = 1.0 * np.ones(self.dim)

        self.lmbda = kwargs.get('lmbda', 1.0)

        if isinstance(self.lmbda, complex):
            self.numeric_type = np.complex

        self.exact_function = lambda phi_of_time: self.initial_value * np.exp(self.lmbda * phi_of_time)

        self._strings['rhs_wrt_time'] = r"\lambda u(t, \phi(t))"
        self._strings['exact'] = r"e^{\lambda t}"
    def __init__(self, *args, **kwargs):
        super(OneDimensionalHeatEquation, self).__init__(*args, **kwargs)
        HasExactSolutionMixin.__init__(self, *args, **kwargs)
        HasDirectImplicitMixin.__init__(self, *args, **kwargs)

        if self.time_start is None:
            self.time_start = 0.0
        if self.time_end is None:
            self.time_end = 1.0
        if self.initial_value is None:
            self.initial_value = complex(1.0, 0.0) * np.ones(self.dim)

        if "alpha" not in kwargs:
            kwargs["alpha"] = 1.0
        self.alpha = kwargs["alpha"]

        if isinstance(self.alpha, complex):
            self.numeric_type = np.complex

        # self.exact_function = lambda phi_of_time: self.initial_value * np.exp(self.lmbda * phi_of_time)

        self._strings["rhs"] = r"\alpha \laplace u(x,t)"
        self._strings["exact"] = r"derivable using Fourier transformation"