# espressopp.integrator.LBInit¶

Overview

Details

This abstract class provides the interface to (re-)initialize populations and handle external forces.

class espressopp.integrator.LBInit
createDenVel(rho0, u0)

to set initial density and velocity of the LB-fluid.

Parameters: rho0 (real) – density u0 (Real3D) – velocity

The following options for LB-fluid initialization are supported:

setForce(value)

to set an external force onto LB-fluid.

Parameters: value (Real3D) – value of the force
addForce(force)

to add a new external force to the existing one.

Parameters: force (Real3D) – value of the force

Two main external force types are implemented:

## espressopp.integrator.LBInitPopUniform¶

This class creates LB-fluid with uniform density rho0 and velocity u0 (lattice units).

Example:

>>> # set initial density and velocity
>>> initDen = 1.
>>> initVel = Real3D( 0. )
>>>
>>> # create initPop object and initialize populations
>>> initPop = espressopp.integrator.LBInitPopUniform(system,lb)
>>> initPop.createDenVel( initDen, initVel )


## espressopp.integrator.LBInitPopWave¶

This class creates LB-fluid with uniform density and harmonic velocity (lattice units):

$$v_x = 0$$, $$v_y = 0$$, $$v_z(i) = A \cdot sin (2 \pi \cdot i \,/ N_x)$$, where $$A$$ is the amplitude of the velocity wave, $$N_x$$ is the number of lattice nodes in $$x$$-direction and $$i$$ is the index of the node the velocity is calculated for.

This may be used to test the system: total moment is zero and the liquid tends to equilibrium, i.e. relaxes to a uniform zero velocity.

Example:

>>> # set initial density
>>> initDen = 1.
>>>
>>> # set initial velocity
>>> Vx = Vy = 0.
>>> ampVz = 0.0005
>>> initVel = Real3D( Vx, Vy, ampVz )
>>>
>>> # create initPop object and initialize populations
>>> initPop = espressopp.integrator.LBInitPopWave(system,lb)
>>> initPop.createDenVel( initDen, initVel )


## espressopp.integrator.LBInitConstForce¶

This class allows to set or add constant (gravity-like) external forces (lattice units) to the LB-fluid. At first, one has to create a force object and then set or add this force to the system.

Example to set extenal force:

>>> extForceToSet = Real3D(0., 0., 0.0005)
>>> lbforce = espressopp.integrator.LBInitConstForce(system,lb)
>>> lbforce.setForce( extForceToSet )


Example to add extenal force to the existing forces:

>>> extForceToAdd = Real3D(0.0001, 0., 0.)
>>> lbforce = espressopp.integrator.LBInitConstForce(system,lb)


## espressopp.integrator.LBInitPeriodicForce¶

This class allows to set or add external periodic forces (lattice units) to the LB-fluid. At first, one has to create a force object and then set or add this force to the system.

Note

Please note, that a periodic (sin-like) force acts in z-direction as a function of x. The z-component of the force provides therefore the amplitude of the sin-modulation. The x- and y-components of the specified force interpreted as body forces in corresponding directions.

Example to set external sin-like force.

>>> ampFz = 0.0001
>>> Fx = Fy = 0.
>>> extForceToSet = Real3D( Fx, Fy, ampFz )
>>> lbforceSin = espressopp.integrator.LBInitConstForce(system,lb)
>>> lbforceSin.setForce( extForceToSet )


Example to add external sin-like force.

>>> ampFz = 0.0005
>>> Fx = Fy = 0.
>>> extForceToAdd = Real3D( Fx, Fy, ampFz )
>>> lbforceSin = espressopp.integrator.LBInitConstForce(system,lb)