Rolling Fields

Functions to manipulate fields

fieldkit.manipulate.roll(fields, shift)[source]

roll the fields across the PBC using shift

Parameters:
  • fields – a list of Field objects

  • shift – list of length dim. How much to roll the fields. In range [0-1].

Returns:

a list of Field objects, in which each Field object has been translated.

Return type:

fields_new

Example

npw = (64,64)
field = fk.Field(npw_Nd=npw)
fk.add_ellipse(field,center=(0.5,0.5), axis_lengths=(0.3,0.2),height=1)
fk.write_to_VTK("fields_init.vtk",[field])
fields_new = fk.roll([field],shift=(0.25,0.5))
fk.write_to_VTK("fields_roll.vtk",fields_new)

Output

Before using the roll function (left) and after using the roll function (right)

_images/field_before_roll.png _images/field_after_roll.png