set_BC#

FickianDiffusion.set_BC(pores=None, bctype=[], bcvalues=[], mode='add')#

The main method for setting and adjusting boundary conditions.

This method is called by other more convenient wrapper functions like set_value_BC.

Parameters:
  • pores (array_like) – The pores where the boundary conditions should be applied. If None is given then all pores are assumed. This is useful when mode='remove'.

  • bctype (str) – Specifies the type or the name of boundary condition to apply. This can be anything, but normal options are ‘rate’ and ‘value’. If an empty list is provided, then all bc types will be assumed. This is useful for clearing all bcs if mode='remove' and pores= None.

  • bcvalues (int or array_like) – The boundary value to apply, such as concentration or rate. If a single value is given, it’s assumed to apply to all locations. Different values can be applied to all pores in the form of an array of the same length as pores. Note that using mode='add' and values=np.nan is equivalent to removing bcs from the given pores.

  • mode (str or list of str, optional) –

    Controls how the boundary conditions are applied. Options are:

    mode

    meaning

    ’add’

    (default) Adds the supplied boundary conditions to the given locations. Raises an exception if values of any type already exist in the given locations.

    ’overwrite’

    Adds supplied boundary conditions to the given locations, including overwriting conditions of the given type or any other type that may be present in the given locations.

    ’remove’

    Removes boundary conditions of the specified type from the specified locations. If bctype is not specified then all types are removed. If no locations are given then values are remvoed from all locations.

    If a list of strings is provided, then each mode in the list is handled in order, so that ['remove', 'add'] will give the same results add 'overwrite'.

Notes

It is not possible to have multiple boundary conditions for a specified location in one algorithm.