boundary_conditions

Handle boundary conditions.

class boundary_conditions.BoundaryConditions(params, thermo, V_partial, min_atom_fraction, logger, side, ready)[source]

Bases: object

Boundary conditions on one side of the domain (left or right).

Can be either:

  • ‘Dirichlet’: prescribed composition, if ‘atom_fractions’ is provided in the input parameters.

  • ‘Neumann’: prescribed flux, if ‘flux’ is provided.

Defaults to 0-flux if none is specified in the input parameters.

The class is used through cvar_fun and J_fun, which are both function of time built from the input parameters, which may be a float or a str with t as the time variable (ex: (3*t + 2)**(1/2)).

Variables:
  • thermo (thermodynamics.Thermodynamics) – Thermodynamic properties handler.

  • comps (list of str) – System components.

  • inds (list of str) – Independent components.

  • V_partial (dict) – Partial molar volumes. See data_io.get_volume_data().

  • min_atom_fraction (float) – Minimum atom fraction accepted.

  • logger (log_utils.CustomLogger) – Logger.

  • side (str) – Side where boundary condition applies (left or right).

  • type (str) – Type of boundary condition (Neumann or Dirichlet).

cvar_fun(t) :

Function of time, returns a composition_variables.CompositionVariables instance.

J_fun(t)

Function of time, returns a flux array.

__init__(params, thermo, V_partial, min_atom_fraction, logger, side, ready)[source]

Class constructor.

make_BC_type(params)[source]

Guess BC type from input dict and make sure input is consistent.

make_BC_dict(params, var)[source]

Format input dictionary.

make_J_fun(Jparams)[source]

Make function that returns a boundary flux array.

The inner function returns a 1D array of fluxes, which include all atom components.

make_cvar_fun(xparams)[source]

Make function that returns a boundary composition variable.

The inner function returns a composition_variables.CompositionVariables instance. Two assumptions are made:

  • vacancies are at equilibrium,

  • the pore fraction is 0.

check_BC_components(found, expected, varname)[source]

Make sure all expected components are present in the BC.

clip_xBC_values(xparams)[source]

Make sure atom fractions are within accepted bounds.

x_fun(t)[source]

Atom fractions on boundary.