pygeon.discretizations.fvm.boundary_conditions module

Module for finite-volume boundary condition classes.

class pygeon.discretizations.fvm.boundary_conditions.FiniteVolumeBC(_sd, data, keyword)[source]

Bases: object

Parent class of boundary condition objects for finite volume methods in PyGeoN.

dim_of_bc_vals

Dimension of the boundary values, typically 1 or the dimension of the domain

__init__(_sd, data, keyword)[source]

Initialize the FiniteVolumeBC object and store it in the data dictionary.

Parameters:
  • _sd (pg.Grid) – The grid.

  • data (dict) – The data dictionary.

  • keyword (str) – The keyword of the relevant finite volume discretization.

class pygeon.discretizations.fvm.boundary_conditions.ElasticityBC(sd, data, keyword='unitary_data')[source]

Bases: FiniteVolumeBC

__init__(sd, data, keyword='unitary_data')[source]

Initialize the ElasticityBC object and store it in the data dictionary.

Parameters:
  • sd (pg.Grid) – The grid.

  • data (dict) – The data dictionary.

  • keyword (str) – The keyword of the relevant finite volume discretization.

set_displacement_bcs(indices=None, u_0=None)[source]

Sets displacement boundary conditions.

Parameters:
  • indices (np.ndarray) – The global face indices on which the BC is imposed. Defaults to None.

  • u_0 (np.ndarray) – shape [dim, n_faces] such that u_0[indices] contains the BC values. Defaults to zero.

set_traction_bcs(indices=None, sig_0=None)[source]

Set traction boundary conditions.

Parameters:
  • indices (np.ndarray) – The global face indices on which the BC is imposed. Defaults to None.

  • sig_0 (np.ndarray) – shape [dim, n_faces] such that sig_0[indices] contains the BC values. Defaults to zero.

set_spring_bcs(dists, indices=None, u_0=None)[source]

Set spring boundary conditions, cf. Appendix A2.21 in Nordbotten and Keilegavlen (2025), https://doi.org/10.1016/j.camwa.2025.07.035: $n cdot sigma = 2 / mathrm{dists} ,(u_0 - u)$.

Parameters:
  • dists (np.ndarray) – Weighted distance (inverse spring constant).

  • indices (np.ndarray) – The global face indices on which the BC is imposed. Defaults to None.

  • u_0 (np.ndarray) – shape [dim, n_faces] such that u_0[indices] contains the BC values. Defaults to zero.

class pygeon.discretizations.fvm.boundary_conditions.FlowBC(sd, data, keyword='unitary_data')[source]

Bases: FiniteVolumeBC

__init__(sd, data, keyword='unitary_data')[source]

Initialize the FlowBC object and store it in the data dictionary.

Parameters:
  • sd (pg.Grid) – The grid.

  • data (dict) – The data dictionary.

  • keyword (str) – The keyword of the relevant finite volume discretization.

set_pressure_bcs(indices=None, p_0=None)[source]

Set pressure boundary conditions.

Parameters:
  • indices (np.ndarray) – The global face indices on which the BC is imposed. Defaults to None.

  • p_0 (np.ndarray) – shape [n_faces, ] such that p_0[indices] contains the BC values. Defaults to zero.

set_flux_bcs(indices=None, q_0=None)[source]

Set flux boundary conditions.

Parameters:
  • indices (np.ndarray) – The global face indices on which the BC is imposed. Defaults to None.

  • q_0 (np.ndarray) – shape [n_faces, ] such that q_0[indices] contains the BC values. Defaults to zero.

set_robin_bcs(dists, indices=None, p_0=None)[source]

Set Robin boundary conditions: $n cdot q = (p - p_0) / mathrm{dists}$.

Parameters:
  • dists (np.ndarray) – Weighted distance (inverse permeability).

  • indices (np.ndarray) – The global face indices on which the BC is imposed. Defaults to None.

  • p_0 (np.ndarray) – shape [n_faces, ] such that p_0[indices] contains the BC values. Defaults to zero.