core

The core module for the pCubit package.

class Ellipsoid(**kwargs)

Bases: EllipsoidBase

The core class for an ellipsoid.

Attributes:

placed (bool): Whether or not the ellipsoid has placed in the geometry.

place(block_id=None)

Places the ellipsoid in an existing geometry.

The ellipsoid is placed by subtracting the portion of any volumes that overlap with the ellipsoid volume. If the ellipsoid is a pore, the ellipsoid volume is then deleted. Otherwise, the ellipsoid volume is added to a new element block.

Args:
block_id (int, optional, default=None):

The id for the element block that the ellipsoid will be added to, if not a pore. If an id is not specified, the ellipsoid will be added to a new element block.

Example:

Place an single particle in a unit cube:

>>> from pcubit import cubit_cmd, cubit_init, Particle
>>> cubit_init()
>>> cubit_cmd('brick x 1')
>>> cubit_cmd('block 1 volume 1')
>>> particle = Particle(
...     location=[0, 0, 0],
...     radii=[0.23, 0.55, 0.3],
...     angles=[0, 1, 2]
... )
>>> particle.place()
class Ellipsoids(**kwargs)

Bases: EllipsoidsBase

The core class for a set of ellipsoids.

property child_class

The Ellipsoid class considered to be the child class.

Returns:

Ellipsoid: The child class.

place(**kwargs)

Sequentially places the ellipsoids in an existing geometry.

A new element block is created using the next available block id, and each ellipsoid is added to that element block during placement.

Args:
kwargs: Arbitrary keyword arguments.

Passed to place().

class Particle(**kwargs)

Bases: Ellipsoid

The core class for a particle.

class Particles(**kwargs)

Bases: Ellipsoids

The core class for a set of particles.

property child_class

The Particle class considered to be the child class.

Returns:

Particle: The child class.

class Pore(**kwargs)

Bases: Ellipsoid

The core class for a pore.

class Pores(**kwargs)

Bases: Ellipsoids

The core class for a set of pores.

property child_class

The Pore class considered to be the child class.

Returns:

Pore: The child class.

cubit_cmd(string, silent=True)

Sends arbitrary commands to Cubit, asserting their success.

Args:

string (str): The command string. silent (bool, optional, default=True): Whether to silence Cubit.

cubit_init(offscreen_graphics=False)

Starts a instance of Cubit, quietly, with developer settings on.

Args:
offscreen_graphics (bool, optional, default=False):

Whether to enable graphics (offscreen) for things like screenshots.