mpcd.force

Overview

BodyForce

Body force.

BlockForce

Block force.

ConstantForce

Constant force.

SineForce

Sine force.

Details

MPCD particle body forces.

MPCD can apply a body force to each MPCD particle as a function of position. The external force should be compatible with the chosen Geometry. Global momentum conservation can be broken by adding a body force, so care should be chosen that the entire model is designed so that the system does not have net acceleration. For example, solid boundaries can be used to dissipate momentum, or a balancing force can be applied to particles that are embedded in the MPCD particles through the collision step. Additionally, a thermostat will likely be required to maintain temperature control in the driven system.

class hoomd.mpcd.force.BlockForce(force, separation=None, width=None)

Bases: BodyForce

Block force.

Parameters:
  • force (float) – Magnitude of the force in x per particle.

  • separation (float) – Distance between the centers of the blocks.

  • width (float) – Width of each block.

The force magnitude F is applied in the x direction on the MPCD particles in blocks defined along the y direction by the separation \(2H\) and the width \(2w\). The force in x is \(+F\) in the upper block, \(-F\) in the lower block, and zero otherwise.

\begin{equation} \mathbf{F} = \begin{cases} +F \mathbf{e}_x & |r_y - H| < w \\ -F \mathbf{e}_x & |r_y + H| < w \\ \mathbf{0} & \mathrm{otherwise} \end{cases} \end{equation}

The BlockForce can be used to implement the double-parabola method for measuring viscosity using separation \(L_y/2\) and width \(L_y/2\), where \(L_y\) is the size of the simulation box in y.

Warning

You should define the blocks to lie fully within the simulation box and to not overlap each other.

Example:

Block force for double-parabola method.

Ly = simulation.state.box.Ly
force = hoomd.mpcd.force.BlockForce(
    force=1.0, separation=Ly/2, width=Ly/2)
stream = hoomd.mpcd.stream.Bulk(period=1, mpcd_particle_force=force)
simulation.operations.integrator.streaming_method = stream
force

Magnitude of the force in x per particle.

Example:

force.force = 1.0
Type:

float

separation

Distance between the centers of the blocks.

Example:

Ly = simulation.state.box.Ly
force.separation = Ly / 2
Type:

float

width

Width of each block.

Example:

Ly = simulation.state.box.Ly
force.width = Ly / 2
Type:

float

class hoomd.mpcd.force.BodyForce

Bases:

Body force.

The BodyForce is a body force applied to each MPCD particle. This class should not be instantiated directly. It exists for type checking.

class hoomd.mpcd.force.ConstantForce(force)

Bases: BodyForce

Constant force.

Parameters:

force (tuple [float, float, float]) – Force vector per particle.

The same constant force is applied to all MPCD particles, independently of time and position. This force is useful for simulating pressure-driven flow in conjunction with a confined geometry having no-slip boundary conditions. It is also useful for measuring diffusion coefficients with nonequilibrium methods.

Example:

force = hoomd.mpcd.force.ConstantForce((1.0, 0, 0))
stream = hoomd.mpcd.stream.Bulk(period=1, mpcd_particle_force=force)
simulation.operations.integrator.streaming_method = stream
force

Force vector per particle.

Example:

force.force = (1.0, 0.0, 0.0)
Type:

tuple [float, float, float]

class hoomd.mpcd.force.SineForce(amplitude, wavenumber)

Bases: BodyForce

Sine force.

Parameters:
  • amplitude (float) – Amplitude of the sinusoid.

  • wavenumber (float) – Wavenumber for the sinusoid.

SineForce applies a force with amplitude F in x that is sinusoidally varying in y with wavenumber k to all MPCD particles:

\[\mathbf{F}(\mathbf{r}) = F \sin (k r_y) \mathbf{e}_x\]

Typically, the wavenumber should be something that is commensurate with the simulation box. For example, \(k = 2\pi/L_y\) will generate one period of the sine.

Example:

Sine force with one period.

Ly = simulation.state.box.Ly
force = hoomd.mpcd.force.SineForce(
    amplitude=1.0,
    wavenumber=2 * numpy.pi / Ly)
stream = hoomd.mpcd.stream.Bulk(period=1, mpcd_particle_force=force)
simulation.operations.integrator.streaming_method = stream
amplitude

Amplitude of the sinusoid.

Example:

force.amplitude = 1.0
Type:

float

wavenumber

Wavenumber for the sinusoid.

Example:

Ly = simulation.state.box.Ly
force.wavenumber = 2 * numpy.pi / Ly
Type:

float