Struphy data structures#

Check out Tutorial 07 - Struphy data structures for a hands-on introduction.

FEEC variables#

Struphy uses the FEEC data structures provided by the open source package Psydac for its fluid/EM-fields variables. FE coefficients are stores as

  • a StencilVector for scalar-valued variables (H1 or L2)

  • a BlockVector for vector-valued variables (Hcurl, Hdiv or H1vec)

A BlockVector is just a 3-list of StencilVectors.

class psydac.linalg.stencil.StencilVector(V)[source]#

Bases: Vector

Vector in n-dimensional stencil format.

Parameters:

V (psydac.linalg.stencil.StencilVectorSpace) – Space to which the new vector belongs.

property space#

Vector space to which this vector belongs.

toarray(*, order='C', with_pads=False)[source]#

Return a numpy 1D array corresponding to the given StencilVector, with or without pads.

Parameters:
  • with_pads (bool) – If True, include pads in output array (ignored in serial case).

  • order ({'C','F'}) – Memory representation of the data ‘C’ for row-major ordering (C-style), ‘F’ column-major ordering (Fortran-style).

Returns:

array – A copy of the data array collapsed into one dimension.

Return type:

numpy.ndarray

copy(out=None)[source]#

Return an identical copy of this vector.

Subclasses must ensure that x.copy(out=x) returns x and not a new object.

conjugate(out=None)[source]#

Compute the complex conjugate vector.

Please note that x.conjugate(out=x) modifies x in place and returns x.

If the field is real (i.e. self.dtype in (np.float32, np.float64)) this method is equivalent to copy. If the field is complex (i.e. self.dtype in (np.complex64, np.complex128)) this method returns the complex conjugate of self, element-wise.

The behavior of this function is similar to numpy.conjugate(self, out=None).

property starts#
property ends#
property pads#
toarray_local(*, order='C')[source]#

return the local array without the padding

topetsc()[source]#

Convert to petsc data structure.

property ghost_regions_in_sync#
update_ghost_regions()[source]#

Update ghost regions before performing non-local access to vector elements (e.g. in matrix-vector product).

Parameters:

direction (int) – Single direction along which to operate (if not specified, all of them).

exchange_assembly_data()[source]#

Exchange assembly data.

class psydac.linalg.block.BlockVector(V, blocks=None)[source]#

Bases: Vector

Block of Vectors, which is an element of a BlockVectorSpace.

Parameters:
  • V (psydac.linalg.block.BlockVectorSpace) – Space to which the new vector belongs.

  • blocks (list or tuple (psydac.linalg.basic.Vector)) – List of Vector objects, belonging to the correct spaces (optional).

property space#

Vector space to which this vector belongs.

toarray(order='C')[source]#

Convert to Numpy 1D array.

copy(out=None)[source]#

Return an identical copy of this vector.

Subclasses must ensure that x.copy(out=x) returns x and not a new object.

conjugate(out=None)[source]#

Compute the complex conjugate vector.

Please note that x.conjugate(out=x) modifies x in place and returns x.

If the field is real (i.e. self.dtype in (np.float32, np.float64)) this method is equivalent to copy. If the field is complex (i.e. self.dtype in (np.complex64, np.complex128)) this method returns the complex conjugate of self, element-wise.

The behavior of this function is similar to numpy.conjugate(self, out=None).

property blocks#
property n_blocks#
property ghost_regions_in_sync#
update_ghost_regions()[source]#
start_update_interface_ghost_regions()[source]#
end_update_interface_ghost_regions(req)[source]#
exchange_assembly_data()[source]#
toarray_local(order='C')[source]#

Convert to petsc Nest vector.

topetsc()[source]#

Convert to petsc data structure.

Kinetic variables#

All information pertaining to markers in Struphy is stored in the particle_base. In particular, the data structure holding the values of each marker is under struphy.pic.base.Particles.markers().