Skip to content

Base Classes

digirock.Element

Base consumer class from which all other consumer classes are defined. For example, uses to define input consumer classes like fluids, mineral mixing models etc.

Attributes:

Name Type Description
name str

The name of the Model.

tree: Tree property readonly

Prints a rich tree view of the Class

__init__(self, name=None, keys=None) special

Parameters:

Name Type Description Default
name str

The Element name/id, if None will be assigned an instance ID

None
keys Sequence[str]

Keys this element will consume, keys must be unique

None

deregister_key(self, key)

Deregister a keyword across the digirock classes

get_summary(self)

Returns a summary of this class.

keys(self)

Returns a list of keys this class will require for computation.

Returns:

Type Description
List[str]

The keys this class requires.

register_key(self, key)

Register a new keyword across digirock classes

trace(self, props, methods, **kwargs)

Returns a props trace for all methods, switching keys in props are ignored.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]] required
methods Union[str, List[str]] required
**kwargs

passed to methods

{}

Returns:

Type Description
Dict[str, Any]

trace of method values through model tree

trace_tree(self, props, methods, **kwargs)

Returns a props trace for all methods, switching keys in props are ignored.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]] required
methods Union[str, List[str]] required
**kwargs

passed to methods

{}

Returns:

Type Description
Tree

tree view of the trace

digirock.Switch

Base class for performing switching on other model classes e.g. Element or Blend.

Switching works by passing a suitable NDArrayOrFloat in the props argument of any valid Element, the switch_key value should contain the index of desired element to use.

Switches consume the switch_key prop from the props so it is not passed to it's children.

Uses methods argument to build factory methods to map to Elements. Each Element must have a method matching the names in methods.

Attributes:

Name Type Description
name str

Name for switch

switch_key str

Key to use for switching

elements list

A list of elements

methods list

A list of methods that the Switch should implement to match the Elements.

n_elements int

The number of elements

tree: Tree property readonly

Prints a rich tree view of the Class

all_keys(self)

Get keys from all levels

get_summary(self)

Returns a summary of this class.

trace(self, props, methods, **kwargs)

Returns a props trace for all methods, switching keys in props are ignored.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]] required
methods Union[str, List[str]] required
**kwargs

passed to methods

{}

Returns:

Type Description
Dict[str, Any]

trace of method values through model tree

digirock.Blend

Blend Element types to create new hybrid Elements.

The blending process is specific to the implementation which inherits Blend.

Attributes:

Name Type Description
name str

Name for switch

blend_keys list

Keys to use for blending (must be unique)

elements list

A list of elements

methods list

A list of methods that the Switch should implement to match the Elements.

n_elements int

The number of elements

tree: Tree property readonly

Prints a rich tree view of the Class

all_keys(self)

Get keys from all levels

get_summary(self)

Returns a summary of this class.

trace(self, props, methods, **kwargs)

Returns a props trace for all methods, switching keys in props are ignored.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]] required
methods Union[str, List[str]] required
**kwargs

passed to methods

{}

Returns:

Type Description
Dict[str, Any]

trace of method values through model tree

digirock.Transform

Transform Element types to adjust the outputs of those Elements.

The transform process is specific to the implementation which inherits Transform.

Attributes:

Name Type Description
name str

Name for switch

transform_keys list

Keys to use for transforming (must be unique)

element

The element to transform

methods list

A list of methods that the Transform should implement to match the Element.

tree: Tree property readonly

Prints a rich tree view of the Class

all_keys(self)

Get keys from all levels

get_summary(self)

Returns a summary of this class.

trace(self, props, methods, **kwargs)

Returns a props trace for all methods, switching keys in props are ignored.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]] required
methods Union[str, List[str]] required
**kwargs

passed to methods

{}

Returns:

Type Description
Dict[str, Any]

trace of method values through model tree

digirock.Fluid

Base Class for defining fluids, all new fluids should be based upon this class.

Attributes:

Name Type Description
name str

name of the fluid

bulk_modulus(self, props, **kwargs)

Returns bulk_modulus of fluid

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]]

A dictionary of properties required.

required
kwargs

ignored

{}

Returns:

Type Description
Union[numpy.ndarray, float]

Modulus for temp and pres (GPa).

density(self, props, **kwargs)

Returns density of fluid

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]]

A dictionary of properties required.

required
kwargs

ignored

{}

Returns:

Type Description
Union[numpy.ndarray, float]

Density for temp and pres (g/cc).

get_summary(self)

Return a dictionary containing a summary of the fluid.

Returns:

Type Description
dict

Summary of properties.

shear_modulus(self, props, **kwargs)

Fluid shear modulus is zero. Return zero for all fluids.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]]

A dictionary of properties required.

required
kwargs

ignored

{}

Returns:

Type Description
Union[numpy.ndarray, float]

Modulus for temp and pres (GPa). Always 0.0

velocity(self, props, **kwargs)

Returns acoustic velocity of fluid

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]]

A dictionary of properties required.

required
kwargs

ignored

{}

Returns:

Type Description
Union[numpy.ndarray, float]

Velocity for temp and pres (m/s).

vp(self, props, **kwargs)

Alias for velocity

vs(self, props, **kwargs)

Always returns 0

digirock.FluidSwitch

Class for fluid switching, e.g. when different fluid properties are needed in different PVT zones

Implements the following [Switch][digirock.Switch] methods:

  • density
  • bulk_modulus
  • shear_modulus
  • velocity

Attributes:

Name Type Description
name str

Name for switch

switch_key str

Key to use for switching

elements list

A list of elements

n_elements int

The number of elements

digirock.StressModel

Base Class for defining stress fields, all new stress fields should be based upon this class.

Attributes:

Name Type Description
name str

name of the field

effective_stress(self, props, **kwargs)

Returns the effective stress \(S_e\) for the class at a given depth \((z)\) and for a particular formation pressure \(p_f\).

\(S_e = S_v(d) - p_f\)

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]]

A dictionary of properties; requires depth (m) and pres (MPa)

required
kwargs

ignored

{}

Returns:

Type Description

effective stress (MPa)

get_summary(self)

Return a dictionary containing a summary of the fluid.

Returns:

Type Description
dict

Summary of properties.

vertical_stress(self, props, **kwargs)

Returns the vertical stress \(S_v\) for the class.

Parameters:

Name Type Description Default
props Dict[str, Union[numpy.ndarray, float, int]]

A dictionary of properties required

required
kwargs

ignored

{}