espressopp.integrator.LBInit¶
Overview
espressopp.integrator.LBInitPopUniform |
|
espressopp.integrator.LBInitPopWave |
|
espressopp.integrator.LBInitConstForce |
|
espressopp.integrator.LBInitPeriodicForce |
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:
espressopp.integrator.LBInitPopUniform
A typical choice. It initializes uniformly distributed density and velocity: On every lattice site the density isrho0
and velocity isu0
espressopp.integrator.LBInitPopWave
for uniform density at every lattice site, but harmonic velocity \(v_z (x)\) with the period of lattice sites in x-direction
-
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.LBInitConstForce
to manage constant (gravity-like) forces acting on every lattice site andespressopp.integrator.LBInitPeriodicForce
to manage periodic (sin-like) forces
-
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)
>>> lbforce.addForce( extForceToAdd )
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)
>>> lbforceSin.addForce( extForceToAdd )