ReversePerturbationFlow

class hoomd.md.update.ReversePerturbationFlow(filter, flow_target, slab_direction, flow_direction, n_slabs, max_slab=-1, min_slab=-1)

Bases: Updater

Reverse Perturbation method to establish shear flow.

Parameters:
  • filter (hoomd.filter.filter_like) – Subset of particles on which to apply this updater.

  • flow_target (hoomd.variant.variant_like) – Target value of the time-integrated momentum flux. \([\delta t \cdot \mathrm{mass} \cdot \mathrm{length} \cdot \mathrm{time}^{-1}]\) - where \(\delta t\) is the integrator step size.

  • slab_direction (str) – Direction perpendicular to the slabs. Can be “x”, “y”, or “z”

  • flow_direction (str) – Direction of the flow. Can be “x”, “y”, or “z”

  • n_slabs (int) – Number of slabs used to divide the simulation box along the shear gradient. Using too few slabs will lead to a larger volume being disturbed by the momentum exchange, while using too many slabs may mean that there are not enough particles to exchange the target momentum.

  • max_slab (int) – Id < n_slabs where the max velocity component is search for. If set < 0 the value is set to its default n_slabs/2.

  • min_slab (int) – Id < n_slabs where the min velocity component is search for. If set < 0 the value is set to its default 0.

“Florian Mueller-Plathe. Reversing the perturbation in nonequilibrium molecular dynamics: An easy way to calculate the shear viscosity of fluids. Phys. Rev. E, 59:4894-4898, May 1999.”

The simulation box is divided in a number of slabs. Two distinct slabs of those are chosen. The “max” slab searches for the maximum velocity component in flow direction while the “min” slab searches for the minimum velocity component. Afterward, both velocity components are swapped.

This introduces a momentum flow, which drives the flow. The strength of this flow is set through the flow_target argument, which defines a target value for the time-integrated momentum flux. The searching and swapping is repeated until the target is reached. Depending on the target sign, the “max” and “min” slab might be swapped.

Attention

  • This updater uses hoomd.trigger.Periodic(1) as a trigger, meaning it is applied every timestep.

  • This updater works currently only with orthorhombic boxes.

Note

The attributes of this updater are immutable once the updater is attached to a simulation.

Examples:

# const integrated flow with 0.1 slope for max 1e8 timesteps
ramp = hoomd.variant.Ramp(0.0, 0.1e8, 0, int(1e8))
# velocity gradient in z direction and shear flow in x direction.
mpf = hoomd.md.update.ReversePerturbationFlow(
    filter=hoomd.filter.All(),
    flow_target=ramp,
    slab_direction="Z",
    flow_direction="X",
    n_slabs=20,
)

Members inherited from AutotunedObject:

property kernel_parameters

Kernel parameters. Read more...

property is_tuning_complete

Check if kernel parameter tuning is complete. Read more...

tune_kernel_parameters()

Start tuning kernel parameters. Read more...


Members inherited from Integrator:

trigger

The trigger to activate this operation. Read more...


Members defined in ReversePerturbationFlow:

filter

Subset of particles on which to apply this updater.

Type:

hoomd.filter.filter_like

flow_target

Target value of the time-integrated momentum flux.

Type:

hoomd.variant.Variant

slab_direction

Direction perpendicular to the slabs.

Type:

str

flow_direction

Direction of the flow.

Type:

str

n_slabs

Number of slabs.

Type:

int

max_slab

Id < n_slabs where the max velocity component is searched for.

Type:

int

min_slab

Id < n_slabs where the min velocity component is searched for.

Type:

int

property summed_exchanged_momentum

Returns the summed up exchanged velocity of the full simulation.

(Loggable: category=”scalar”)