#coding: utf8
import plask


class Dynamic2D(plask.Solver):
    """
    Dynamic2D(name="")
    
    Finite element thermal solver for 2D Cartesian geometry.
    """
    algorithm = None
    """
    Chosen matrix factorization algorithm
    """

    def compute(self, time):
        """
        compute(self, time)
        
            Run thermal calculations
        """

    elapsed_time = None
    """
    Alias for :attr:`time` (obsolete).
    """

    geometry = None
    """
    Geometry provided to the solver
    """

    id = None
    """
    Id of the solver object. (read only)
    
    Example:
        >>> mysolver.id
        mysolver:category.type
    """

    inHeat = None
    """
    Receiver of the heat sources density required for computations [W/m³].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.HeatReceiver2D`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inHeat = other_solver.outHeat
    
    See also:
    
       Receciver class: :class:`plask.flow.HeatReceiver2D`
    
       Provider class: :class:`plask.flow.HeatProvider2D`
    
       Data filter: :class:`plask.filter.HeatFilter2D`
    """

    include_empty = None
    """
    Should empty regions (e.g. air) be included into computation domain?
    """

    def initialize(self):
        """
        initialize(self)
        
            Initialize solver.
            
            This method manually initialized the solver and sets :attr:`initialized` to
            *True*. Normally calling it is not necessary, as each solver automatically
            initializes itself when needed.
            
            Returns:
                bool: solver :attr:`initialized` state prior to this method call.
        """

    initialized = None
    """
    True if the solver has been initialized. (read only)
    
    Solvers usually get initialized at the beginning of the computations.
    You can clean the initialization state and free the memory by calling
    the :meth:`invalidate` method.
    """

    inittemp = None
    """
    Initial temperature [K]
    """

    def invalidate(self):
        """
        invalidate(self)
        
            Set the solver back to uninitialized state.
            
            This method frees the memory allocated by the solver and sets
            :attr:`initialized` to *False*.
        """

    def load_xpl(self, xpl, manager):
        """
        load_xpl(self, xpl, manager)
        
            Load configuration from XPL reader.
            
            This method should be overriden in custom Python solvers.
            
            Example:
              .. code-block:: python
            
                 def load_xpl(self, xpl, manager):
                     for tag in xpl:
                         if tag == 'config':
                             self.a = tag['a']
                             self.b = tag.get('b', 0)
                             if 'c' in tag:
                                 self.c = tag['c']
                         if tag == 'combined':
                             for subtag in tag:
                                 if subtag == 'withtext':
                                     self.data = subtag.attrs
                                     # Text must be read last
                                     self.text = subtag.text
                         elif tag == 'geometry':
                             self.geometry = tag.getitem(manager.geo, 'ref')
        """

    logfreq = None
    """
    Frequency of iteration progress reporting
    """

    lumping = None
    """
    Chosen mass matrix type from lumped or non-lumped (consistent)
    """

    mesh = None
    """
    Mesh provided to the solver
    """

    methodparam = None
    """
    Initial parameter determining the calculation method: 0.5 - Crank-Nicolson method, 0 - explicit method, 1 - implicit method
    """

    outHeatFlux = None
    """
    Provider of the computed heat flux [W/m²].
    
    
    outHeatFlux(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the heat flux on the specified mesh **[W/m²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inHeatFlux = solver.outHeatFlux
    
       Obtain the provided field:
    
       >>> solver.outHeatFlux(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.HeatFluxProvider2D`
    
       Receciver class: :class:`plask.flow.HeatFluxReceiver2D`
    """

    outTemperature = None
    """
    Provider of the computed temperature [K].
    
    
    outTemperature(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the temperature on the specified mesh **[K]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inTemperature = solver.outTemperature
    
       Obtain the provided field:
    
       >>> solver.outTemperature(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.TemperatureProvider2D`
    
       Receciver class: :class:`plask.flow.TemperatureReceiver2D`
    """

    outThermalConductivity = None
    """
    Provider of the computed thermal conductivity [W/(m×K)].
    
    
    outThermalConductivity(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the thermal conductivity on the specified mesh **[W/(m×K)]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inThermalConductivity = solver.outThermalConductivity
    
       Obtain the provided field:
    
       >>> solver.outThermalConductivity(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.ThermalConductivityProvider2D`
    
       Receciver class: :class:`plask.flow.ThermalConductivityReceiver2D`
    """

    rebuildfreq = None
    """
    Frequency of rebuild mass
    """

    temperature_boundary = None
    """
    Boundary conditions for the constant temperature 
    
    This field holds a list of boundary conditions for the solver. You may access
    and alter is elements a normal Python list. Each element is a special class
    that has two attributes:
    
    ============= ==================================================================
    :attr:`place` Boundary condition location (:class:`plask.mesh.RectangularBase2D.Boundary`).
    :attr:`value` Boundary condition value.
    ============= ==================================================================
    
    When you add new boundary condition, you may use two-argument ``append``, or
    ``prepend`` methods, or three-argument ``insert`` method, where you separately
    specify the place and the value. See the below example for clarification.
    
    Example:
        >>> solver.temperature_boundary.clear()
        >>> solver.temperature_boundary.append(solver.mesh.Bottom(), some_value)
        >>> solver.temperature_boundary[0].value = different_value
        >>> solver.temperature_boundary.insert(0, solver.mesh.Top(), new_value)
        >>> solver.temperature_boundary[1].value == different_value
        True
    """

    time = None
    """
    Time of calculations performed so far since the last solver invalidation.
    """

    timestep = None
    """
    Time step [ns]
    """



class Dynamic3D(plask.Solver):
    """
    Dynamic3D(name="")
    
    Finite element thermal solver for 3D Cartesian geometry.
    """
    algorithm = None
    """
    Chosen matrix factorization algorithm
    """

    def compute(self, time):
        """
        compute(self, time)
        
            Run thermal calculations
        """

    elapsed_time = None
    """
    Alias for :attr:`time` (obsolete).
    """

    geometry = None
    """
    Geometry provided to the solver
    """

    id = None
    """
    Id of the solver object. (read only)
    
    Example:
        >>> mysolver.id
        mysolver:category.type
    """

    inHeat = None
    """
    Receiver of the heat sources density required for computations [W/m³].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.HeatReceiver3D`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inHeat = other_solver.outHeat
    
    See also:
    
       Receciver class: :class:`plask.flow.HeatReceiver3D`
    
       Provider class: :class:`plask.flow.HeatProvider3D`
    
       Data filter: :class:`plask.filter.HeatFilter3D`
    """

    def initialize(self):
        """
        initialize(self)
        
            Initialize solver.
            
            This method manually initialized the solver and sets :attr:`initialized` to
            *True*. Normally calling it is not necessary, as each solver automatically
            initializes itself when needed.
            
            Returns:
                bool: solver :attr:`initialized` state prior to this method call.
        """

    initialized = None
    """
    True if the solver has been initialized. (read only)
    
    Solvers usually get initialized at the beginning of the computations.
    You can clean the initialization state and free the memory by calling
    the :meth:`invalidate` method.
    """

    inittemp = None
    """
    Initial temperature [K]
    """

    def invalidate(self):
        """
        invalidate(self)
        
            Set the solver back to uninitialized state.
            
            This method frees the memory allocated by the solver and sets
            :attr:`initialized` to *False*.
        """

    def load_xpl(self, xpl, manager):
        """
        load_xpl(self, xpl, manager)
        
            Load configuration from XPL reader.
            
            This method should be overriden in custom Python solvers.
            
            Example:
              .. code-block:: python
            
                 def load_xpl(self, xpl, manager):
                     for tag in xpl:
                         if tag == 'config':
                             self.a = tag['a']
                             self.b = tag.get('b', 0)
                             if 'c' in tag:
                                 self.c = tag['c']
                         if tag == 'combined':
                             for subtag in tag:
                                 if subtag == 'withtext':
                                     self.data = subtag.attrs
                                     # Text must be read last
                                     self.text = subtag.text
                         elif tag == 'geometry':
                             self.geometry = tag.getitem(manager.geo, 'ref')
        """

    logfreq = None
    """
    Frequency of iteration progress reporting
    """

    lumping = None
    """
    Chosen mass matrix type from lumped or non-lumped (consistent)
    """

    mesh = None
    """
    Mesh provided to the solver
    """

    methodparam = None
    """
    Initial parameter determining the calculation method: 0.5 - Crank-Nicolson method, 0 - explicit method, 1 - implicit method
    """

    outHeatFlux = None
    """
    Provider of the computed heat flux [W/m²].
    
    
    outHeatFlux(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the heat flux on the specified mesh **[W/m²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inHeatFlux = solver.outHeatFlux
    
       Obtain the provided field:
    
       >>> solver.outHeatFlux(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.HeatFluxProvider3D`
    
       Receciver class: :class:`plask.flow.HeatFluxReceiver3D`
    """

    outTemperature = None
    """
    Provider of the computed temperature [K].
    
    
    outTemperature(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the temperature on the specified mesh **[K]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inTemperature = solver.outTemperature
    
       Obtain the provided field:
    
       >>> solver.outTemperature(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.TemperatureProvider3D`
    
       Receciver class: :class:`plask.flow.TemperatureReceiver3D`
    """

    outThermalConductivity = None
    """
    Provider of the computed thermal conductivity [W/(m×K)].
    
    
    outThermalConductivity(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the thermal conductivity on the specified mesh **[W/(m×K)]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inThermalConductivity = solver.outThermalConductivity
    
       Obtain the provided field:
    
       >>> solver.outThermalConductivity(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.ThermalConductivityProvider3D`
    
       Receciver class: :class:`plask.flow.ThermalConductivityReceiver3D`
    """

    rebuildfreq = None
    """
    Frequency of rebuild mass
    """

    temperature_boundary = None
    """
    Boundary conditions for the constant temperature 
    
    This field holds a list of boundary conditions for the solver. You may access
    and alter is elements a normal Python list. Each element is a special class
    that has two attributes:
    
    ============= ==================================================================
    :attr:`place` Boundary condition location (:class:`plask.mesh.RectangularBase3D.Boundary`).
    :attr:`value` Boundary condition value.
    ============= ==================================================================
    
    When you add new boundary condition, you may use two-argument ``append``, or
    ``prepend`` methods, or three-argument ``insert`` method, where you separately
    specify the place and the value. See the below example for clarification.
    
    Example:
        >>> solver.temperature_boundary.clear()
        >>> solver.temperature_boundary.append(solver.mesh.Bottom(), some_value)
        >>> solver.temperature_boundary[0].value = different_value
        >>> solver.temperature_boundary.insert(0, solver.mesh.Top(), new_value)
        >>> solver.temperature_boundary[1].value == different_value
        True
    """

    time = None
    """
    Time of calculations performed so far since the last solver invalidation.
    """

    timestep = None
    """
    Time step [ns]
    """



class DynamicCyl(plask.Solver):
    """
    DynamicCyl(name="")
    
    Finite element thermal solver for 2D cylindrical geometry.
    """
    algorithm = None
    """
    Chosen matrix factorization algorithm
    """

    def compute(self, time):
        """
        compute(self, time)
        
            Run thermal calculations
        """

    elapsed_time = None
    """
    Alias for :attr:`time` (obsolete).
    """

    geometry = None
    """
    Geometry provided to the solver
    """

    id = None
    """
    Id of the solver object. (read only)
    
    Example:
        >>> mysolver.id
        mysolver:category.type
    """

    inHeat = None
    """
    Receiver of the heat sources density required for computations [W/m³].
    
    
    You will find usage details in the documentation of the receiver class
    :class:`~plask.flow.HeatReceiverCyl`.
    
    Example:
       Connect the reveiver to a provider from some other solver:
    
       >>> solver.inHeat = other_solver.outHeat
    
    See also:
    
       Receciver class: :class:`plask.flow.HeatReceiverCyl`
    
       Provider class: :class:`plask.flow.HeatProviderCyl`
    
       Data filter: :class:`plask.filter.HeatFilterCyl`
    """

    include_empty = None
    """
    Should empty regions (e.g. air) be included into computation domain?
    """

    def initialize(self):
        """
        initialize(self)
        
            Initialize solver.
            
            This method manually initialized the solver and sets :attr:`initialized` to
            *True*. Normally calling it is not necessary, as each solver automatically
            initializes itself when needed.
            
            Returns:
                bool: solver :attr:`initialized` state prior to this method call.
        """

    initialized = None
    """
    True if the solver has been initialized. (read only)
    
    Solvers usually get initialized at the beginning of the computations.
    You can clean the initialization state and free the memory by calling
    the :meth:`invalidate` method.
    """

    inittemp = None
    """
    Initial temperature [K]
    """

    def invalidate(self):
        """
        invalidate(self)
        
            Set the solver back to uninitialized state.
            
            This method frees the memory allocated by the solver and sets
            :attr:`initialized` to *False*.
        """

    def load_xpl(self, xpl, manager):
        """
        load_xpl(self, xpl, manager)
        
            Load configuration from XPL reader.
            
            This method should be overriden in custom Python solvers.
            
            Example:
              .. code-block:: python
            
                 def load_xpl(self, xpl, manager):
                     for tag in xpl:
                         if tag == 'config':
                             self.a = tag['a']
                             self.b = tag.get('b', 0)
                             if 'c' in tag:
                                 self.c = tag['c']
                         if tag == 'combined':
                             for subtag in tag:
                                 if subtag == 'withtext':
                                     self.data = subtag.attrs
                                     # Text must be read last
                                     self.text = subtag.text
                         elif tag == 'geometry':
                             self.geometry = tag.getitem(manager.geo, 'ref')
        """

    logfreq = None
    """
    Frequency of iteration progress reporting
    """

    lumping = None
    """
    Chosen mass matrix type from lumped or non-lumped (consistent)
    """

    mesh = None
    """
    Mesh provided to the solver
    """

    methodparam = None
    """
    Initial parameter determining the calculation method: 0.5 - Crank-Nicolson method, 0 - explicit method, 1 - implicit method
    """

    outHeatFlux = None
    """
    Provider of the computed heat flux [W/m²].
    
    
    outHeatFlux(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the heat flux on the specified mesh **[W/m²]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inHeatFlux = solver.outHeatFlux
    
       Obtain the provided field:
    
       >>> solver.outHeatFlux(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.HeatFluxProviderCyl`
    
       Receciver class: :class:`plask.flow.HeatFluxReceiverCyl`
    """

    outTemperature = None
    """
    Provider of the computed temperature [K].
    
    
    outTemperature(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the temperature on the specified mesh **[K]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inTemperature = solver.outTemperature
    
       Obtain the provided field:
    
       >>> solver.outTemperature(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.TemperatureProviderCyl`
    
       Receciver class: :class:`plask.flow.TemperatureReceiverCyl`
    """

    outThermalConductivity = None
    """
    Provider of the computed thermal conductivity [W/(m×K)].
    
    
    outThermalConductivity(mesh, interpolation='default')
    
    :param mesh mesh: Target mesh to get the field at.
    :param str interpolation: Requested interpolation method.
    
    :return: Data with the thermal conductivity on the specified mesh **[W/(m×K)]**.
    
    Example:
       Connect the provider to a receiver in some other solver:
    
       >>> other_solver.inThermalConductivity = solver.outThermalConductivity
    
       Obtain the provided field:
    
       >>> solver.outThermalConductivity(mesh)
       <plask.Data at 0x1234567>
    
    See also:
    
       Provider class: :class:`plask.flow.ThermalConductivityProviderCyl`
    
       Receciver class: :class:`plask.flow.ThermalConductivityReceiverCyl`
    """

    rebuildfreq = None
    """
    Frequency of rebuild mass
    """

    temperature_boundary = None
    """
    Boundary conditions for the constant temperature 
    
    This field holds a list of boundary conditions for the solver. You may access
    and alter is elements a normal Python list. Each element is a special class
    that has two attributes:
    
    ============= ==================================================================
    :attr:`place` Boundary condition location (:class:`plask.mesh.RectangularBase2D.Boundary`).
    :attr:`value` Boundary condition value.
    ============= ==================================================================
    
    When you add new boundary condition, you may use two-argument ``append``, or
    ``prepend`` methods, or three-argument ``insert`` method, where you separately
    specify the place and the value. See the below example for clarification.
    
    Example:
        >>> solver.temperature_boundary.clear()
        >>> solver.temperature_boundary.append(solver.mesh.Bottom(), some_value)
        >>> solver.temperature_boundary[0].value = different_value
        >>> solver.temperature_boundary.insert(0, solver.mesh.Top(), new_value)
        >>> solver.temperature_boundary[1].value == different_value
        True
    """

    time = None
    """
    Time of calculations performed so far since the last solver invalidation.
    """

    timestep = None
    """
    Time step [ns]
    """

