Пример #1
0
    def df(self, semi_implicit=False):
        """
        Returns derivative of the double-well potential as a function of two
        scalar variables :math:`d^f = d^f(c, c_0)`. The first argument
        corresponds to order parameter @ CTL, while the second one
        to order parameter @ PTL.

        Fully-implicit expression of the derivative, that is
        :math:`d^f(c, c_0) = \\frac{df}{dc}(c)` is returned by default.
        However, for higher order temporal discretizations, it can be
        convenient to work with semi-implicit approximation of the derivative
        :math:`d^f(c, c_0) = \\frac{f(c) - f(c_0)}{c - c_0}`.

        :param semi_implicit: if true then semi-implicit approximation of
                              the derivative is returned
        :type semi_implicit: bool
        :returns: (approximation of) derivative of the double-well potential
        :rtype: function
        """
        # FIXME: computation of df could be automated
        # from dolfin import conditional, eq
        # df_full = lambda c, c0: df(c)
        # df_semi = lambda c, c0: \
        #               conditional(eq(c, c0), df(c), (f(c) - f(c0))/(c - c0))
        not_implemented_msg(self)
Пример #2
0
    def load_ic_from_file(self, filenames):
        """
        .. todo:: add possibility to load IC from HDF5 files

        :param filenames: list of HDF5 files
        :type filenames: list
        """
        not_implemented_msg(self)
Пример #3
0
    def f(self):
        """
        Returns the double-well potential represented as a function of one
        scalar variable.

        :returns: double-well potential
        :rtype: function
        """
        not_implemented_msg(self)
Пример #4
0
    def load_ic_from_simple_cpp(self, ic):
        """
        An abstract method.

        Update solution functions on the closest previous time level with
        values stored in ``ic``.

        :param ic: initial conditions collected within a special class designed
                   for the purpose of loading them at this point
        :type ic: :py:class:`muflon.functions.iconds.SimpleCppIC`
        """
        not_implemented_msg(self)
Пример #5
0
    def setup(self):
        """
        An abstract method.

        When creating a new class by subclassing this generic class,
        one must override this method in such a way that it sets attributes

        * ``_solution_ctl``
        * ``_solution_ptl``
        * ``_fit_primitives``
        * ``_ndofs``

        to the new class. The first two attributes represent vectors of
        solution functions at current and previous time levels respectively,
        while the third attribute must be a callable function with the
        following signature:

        .. code-block:: python

          def  _fit_primitives(vec, deepcopy=False, indexed=True):
               \"\"\"
               Split/collect components of 'vec' (solution/test/trial fcns)
               to fit the vector of primitive variables.
               \"\"\"
               pass # need to be implemented

        The last attribute represents a dictionary with keys listed `here`__.

        __ list_dof_keys_

        Each item contains number of degrees of freedom. Symbolically written,
        we have the relation ``total = (N-1)*(phi + chi) + gdim*v + p + th``,
        where ``N`` is the number of components and ``gdim`` is geometrical
        dimension.

        Moreover, the implementation of this method must equip the private
        attribute ``_subspace``, which is has been initialized as an empty
        dictionary, with subspaces for individual primitive variables.
        These subspaces then can be requested throughout the method
        :py:meth:`subspace`.

        Examples:

        * :py:meth:`Monolithic.setup`
        * :py:meth:`SemiDecoupled.setup`
        * :py:meth:`FullyDecoupled.setup`
        """
        not_implemented_msg(self)
Пример #6
0
    def free_energy_coefficents(self):
        """
        Returns free energy coefficients :math:`a` and :math:`b` given by

        .. math::

          a = \\frac{\\max_{[0, 1]} \\sqrt{f}}{\\int_0^1 \\sqrt{f}},
          \\qquad
          b = \\frac{1}{2 \\max_{[0, 1]} \\sqrt{f} \\int_0^1 \\sqrt{f}},

        where :math:`f` is the double-potential.

        :returns: free energy coefficients ``(a, b)``
        :rtype: tuple
        """
        # FIXME: computation of a, b could be automated
        not_implemented_msg(self)
Пример #7
0
    def build_pressure_null_space(self):
        """
        An abstract method.

        This method takes responsibility for building the null space associated
        with pressure values for problems in which pressure is not fixed at the
        boundary. (There is only :math:`\\nabla p` in Navier-Stokes equations,
        which leads to the fact that in such type of problems the pressure is
        unique up to a constant.) The null space can be later attached to the
        system matrix.

        This method also returns a constant vector with pressure DOFs being set
        to one and other DOFs being set to zero. This vector forms the basis of
        the created null space and can be used to postprocess computed pressure
        in a way that its (integral) mean value is equal to zero.

        :returns: a pair of null space represented by a
                  :py:class:`dolfin.VectorSpaceBasis` object and the
                  corresponding basis vector as a :py:class:`Function` object
        :rtype: tuple
        """
        not_implemented_msg(self)
Пример #8
0
 def create(self, *args, **kwargs):
     msg = "Cannot create solver from a generic class."
     not_implemented_msg(self, msg)
Пример #9
0
 def create(self, *args, **kwargs):
     msg = "Cannot create discretization scheme from a generic class. "
     not_implemented_msg(self, msg)
Пример #10
0
 def _create_figure(self):
     not_implemented_msg(self)
Пример #11
0
 def _tstepping_loop(self, *args, **kwargs):
     """
     An abstract method.
     """
     msg  = "Cannot run time-stepping algorithm."
     not_implemented_msg(self)