# sfepy.discrete.conditions module

The Dirichlet, periodic and linear combination boundary condition classes, as well as the initial condition class.

class sfepy.discrete.conditions.Condition(name, **kwargs)

  Common boundary condition methods.

  canonize_dof_names(dofs)

    Canonize the DOF names using the full list of DOFs of a variable.

    Assumes single condition instance.

  iter_single()

    Create a single condition instance for each item in self.dofs and yield it.

class sfepy.discrete.conditions.Conditions(objs=None, **kwargs)

  Container for various conditions.

  canonize_dof_names(dofs)

    Canonize the DOF names using the full list of DOFs of a variable.

  static from_conf(conf, regions)
  group_by_variables(groups=None)

    Group boundary conditions of each variable. Each condition is a group is a single condition.

    Parameters:
      groups dict, optional

        If present, update the groups dictionary.

    Returns:
      out dict

        The dictionary with variable names as keys and lists of single condition instances as values.

  sort()

    Sort boundary conditions by their key.

  zero_dofs()

    Set all boundary condition values to zero, if applicable.

class sfepy.discrete.conditions.DGEssentialBC(*args, diff=0, **kwargs)

  This class is empty, it serves the same purpose as EssentialBC, and is created only for branching in dof_info.py

class sfepy.discrete.conditions.DGPeriodicBC(name, regions, dofs, match, key='', times=None)

  This class is empty, it serves the same purpose as PeriodicBC, and is created only for branching in dof_info.py

class sfepy.discrete.conditions.EssentialBC(name, region, dofs, key='', times=None)

  Essential boundary condidion.

  Parameters:
    name str

      The boundary condition name.

    region Region instance

      The region where the boundary condition is applied.

    dofs dict

      The boundary condition specification defining the constrained DOFs and their values.

    key str, optional

      The sorting key.

    times list or str, optional

      The list of time intervals or a function returning True at time steps, when the condition applies.

  zero_dofs()

    Set all essential boundary condition values to zero.

class sfepy.discrete.conditions.InitialCondition(name, region, dofs, key='')

  Initial condidion.

  Parameters:
    name str

      The initial condition name.

    region Region instance

      The region where the initial condition is applied.

    dofs dict

      The initial condition specification defining the constrained DOFs and their values.

    key str, optional

      The sorting key.

class sfepy.discrete.conditions.LinearCombinationBC(name, regions, dofs, dof_map_fun, kind, key='', times=None, arguments=None)

  Linear combination boundary condidion.

  Parameters:
    name str

      The boundary condition name.

    regions list of two Region instances

      The constrained (master) DOFs region and the new (slave) DOFs region. The latter can be None if new DOFs are not field variable DOFs.

    dofs dict

      The boundary condition specification defining the constrained DOFs and the new DOFs (can be None).

    dof_map_fun str

      The name of function for mapping the constrained DOFs to new DOFs (can be None).

    kind str

      The linear combination condition kind.

    key str, optional

      The sorting key.

    times list or str, optional

      The list of time intervals or a function returning True at time steps, when the condition applies.

    arguments: tuple, optional

      Additional arguments, depending on the condition kind.

  canonize_dof_names(dofs0, dofs1=None)

    Canonize the DOF names using the full list of DOFs of a variable.

    Assumes single condition instance.

  get_var_names()

    Get names of variables corresponding to the constrained and new DOFs.

class sfepy.discrete.conditions.PeriodicBC(name, regions, dofs, match, key='', times=None)

  Periodic boundary condidion.

  Parameters:
    name str

      The boundary condition name.

    regions list of two Region instances

      The master region and the slave region where the DOFs should match.

    dofs dict

      The boundary condition specification defining the DOFs in the master region and the corresponding DOFs in the slave region.

    match str

      The name of function for matching corresponding nodes in the two regions.

    key str, optional

      The sorting key.

    times list or str, optional

      The list of time intervals or a function returning True at time steps, when the condition applies.

  canonize_dof_names(dofs)

    Canonize the DOF names using the full list of DOFs of a variable.

    Assumes single condition instance.

sfepy.discrete.conditions.get_condition_value(val, functions, kind, name)

  Check a boundary/initial condition value type and return the value or corresponding function.