Elements#

This is a collection of classes that are used to create the elements of the DFN. The classes are:

Element parent class#

Notes

This module contains the element class that is a parent class to all elements.

class andfn.element.Element(label, id_, type_)[source]#

Bases: object

The parent class for all elements in the andfn model.

__init__(label, id_, type_)[source]#

Initialize the element.

Parameters:
  • label (str) – The label of the element.

  • id (int) – The id of the element.

  • type (int) –

    The type of the element. Element Types:

    0 = Intersection 1 = Bounding Circle 2 = Well 3 = Constant Head Line 4 = Impermeable Circle 5 = Impermeable Line

__str__()[source]#

Returns the string representation of the element.

Returns:

The string representation of the element.

Return type:

str

change_property(**kwargs)[source]#

Change a given property/ies of the element.

Parameters:

kwargs (dict) – The properties to change

Return type:

None. The element is updated in place.

consolidate()[source]#

Consolidate into a numpy structures array.

Returns:

  • struc_array (np.ndarray) – The structure array.

  • index_array (np.ndarray) – The index array.

consolidate_hpc()[source]#

Consolidate into a numpy structures array for HPC solver.

Returns:

  • struc_array (np.ndarray) – The structure array.

  • index_array (np.ndarray) – The index array.

plot(pl, line_width)[source]#

Plot the element using the given plotter.

Parameters:
  • pl (pyvista.Plotter) – The plotter to use for plotting.

  • line_width (float) – The width of the lines in the plot.

Returns:

The element is plotted in the plotter.

Return type:

None

set_id(id_)[source]#

Set the id of the element.

Parameters:

id (int) – The id of the element.

Return type:

None. The id is updated in place.

set_new_ncoef(n, nint_mult=2)[source]#

Increase the number of coefficients in the asymptotic expansion.

Parameters:
  • n (int) – The new number of coefficients.

  • nint_mult (int) – The multiplier for the number of integration points.

unconsolidate(struc_array, index_array, fracs)[source]#

Unconsolidate from a numpy structures array.

Return type:

None. The element is updated in place.

unconsolidate_hpc(struc_array, index_array, fracs)[source]#

Unconsolidate from a numpy structures array for HPC solver.

Return type:

None. The element is updated in place.

andfn.element.element_dtype_hpc = dtype([('id_', '<i8'), ('type_', '<i8'), ('frac0', '<i8'), ('frac1', '<i8'), ('endpoints0', '<c16', (2,)), ('endpoints1', '<c16', (2,)), ('radius', '<f8'), ('center', '<c16'), ('head', '<f8'), ('phi', '<f8'), ('ncoef', '<i8'), ('nint', '<i8'), ('q', '<f8'), ('thetas', '<f8', (400,)), ('coef', '<c16', (200,)), ('old_coef', '<c16', (200,)), ('dpsi_corr', '<f8', (400,)), ('error', '<f8'), ('error_old', '<f8')])#

The element data type for the HPC solver. Note that not all elements have all properties.

Element Types: 0 = Intersection 1 = Bounding Circle 2 = Well 3 = Constant Head Line 4 = Impermeable Circle 5 = Impermeable Line

Parameters:
  • id (int) – The id of the element.

  • type (int) – The type of the element. (see above)

  • frac0 (int) – The id of the first fracture.

  • frac1 (int) – The id of the second fracture.

  • endpoints0 (np.ndarray) – The endpoints of the element in frac0.

  • endpoints1 (np.ndarray) – The endpoints of the element in frac1.

  • radius (float) – The radius of the element.

  • center (np.ndarray) – The center of the element.

  • head (float) – The hydraulic head of the element.

  • phi (float) – The discharge potential of the element.

  • ncoef (int) – The number of coefficients in the expansion.

  • nint (int) – The number of integration points.

  • q (float) – The discharge of the element.

  • thetas (np.ndarray) – The angles of the integration points in the chi-plane.

  • coef (np.ndarray) – The coefficients of the expansion.

  • old_coef (np.ndarray) – The old coefficients of the expansion.

  • dpsi_corr (np.ndarray) – The correction to the psi values.

  • error (float) – The error of the element.

andfn.element.initiate_elements_array()[source]#

Function that initiates the elements array.

Returns:

elements – The elements array.

Return type:

np.ndarray

andfn.element.initiate_elements_array_hpc()[source]#

Function that initiates the elements array for HPC.

Returns:

elements – The elements array.

Return type:

np.ndarray