ReactiveTransport

class ReactiveTransport(*args, **kwargs)[source]

Bases: openpnm.algorithms.GenericTransport.GenericTransport

A subclass for steady-state simulations with (optional) source terms.

Parameters
  • network ((OpenPNM Network object)) – The network object to which this algorithm will apply.

  • name ((string, optional)) – Name of the algorithm

  • project ((OpenPNM Project object, optional)) – Either a Network or a Project must be supplied

Notes

This subclass performs steady simulations of transport phenomena with reactions when source terms are added.

remove_source(propname, pores=None)[source]

Removes source terms from specified pores.

Parameters
  • propname (str) – The property name of the source term model to be removed.

  • pores (array_like) – The pore indices where the source term should be applied.

reset(source_terms=False, **kwargs)[source]

Resets the algorithm to enable re-use.

This allows the reuse of an algorithm inside a for-loop for parametric studies. The default behavior means that only alg.reset() and alg.run() must be called inside a loop. To reset the algorithm more completely requires overriding the default arguments.

Parameters
  • results (boolean) – If True (default) all previously calculated values pertaining to results of the algorithm are removed.

  • bcs (boolean (default = False)) – If True all previous boundary conditions are removed.

  • source_terms (boolean) – If True removes source terms. The default is False.

run(x0=None)[source]

Builds the A and b matrices, and calls the solver specified in the settings attribute.

Parameters

x0 (ND-array) – Initial guess of unknown variable

set_source(propname, pores, mode='overwrite')[source]

Applies a given source term to the specified pores.

Parameters
  • propname (string) – The property name of the source term model to be applied.

  • pores (array_like) – The pore indices where the source term should be applied.

  • mode (str) –

    Controls how the sources are applied. Options are:

    ’merge’ - Adds supplied source term to already existing ones. ‘overwrite’ - (default) Deletes all existing source terms of the given propname then adds the specified new ones

Notes

Source terms cannot be applied in pores where boundary conditions have already been set. Attempting to do so will result in an error being raised.

setup(phase=None, quantity='', conductance='', nlin_max_iter=None, relaxation_source=None, relaxation_quantity=None, **kwargs)[source]

This method takes several arguments that are essential to running the algorithm and adds them to the settings.

Parameters
  • phase (str) – The name of the phase on which the algorithm acts

  • quantity (str) – The name of the physical quantity to be calculated

  • conductance (str) – The name of the pore-scale transport conductance values. These are typically calculated by a model attached to a Physics object associated with the given Phase.

  • phase – The name of the phase on which the algorithm acts

  • quantity – The name of the physical quantity to be calculated

  • conductance – The name of the pore-scale transport conductance values. These are typically calculated by a model attached to a Physics object associated with the given Phase.

Notes

Under-relaxation is a technique used for improving stability of a computation, particularly in the presence of highly non-linear terms. Under-relaxation used here limits the change in a variable from one iteration to the next. An optimum choice of the relaxation factor is one that is small enough to ensure stable simulation and large enough to speed up the computation.