|
MolSim
|
Strategy functions for calculating the position of one or more particles. More...
Go to the source code of this file.
Functions | |
| void | calculateX (ParticleContainer &particles, double delta_t, double g_grav, CellContainer *lc=nullptr, bool membrane=false) |
| Calculates the position \( x \) for all Particle objects in a given ParticleContainer. | |
| void | calculateX_LC (ParticleContainer &particles, double delta_t, double g_grav, CellContainer *lc, bool membrane=false) |
| Calculates the position \( x \) for all Particle objects in a given ParticleContainer when using the linked cells method. | |
Strategy functions for calculating the position of one or more particles.
| void calculateX | ( | ParticleContainer & | particles, |
| double | delta_t, | ||
| double | g_grav, | ||
| CellContainer * | lc = nullptr, |
||
| bool | membrane = false |
||
| ) |
Calculates the position \( x \) for all Particle objects in a given ParticleContainer.
The position \( x_i \) of a given particle \( i \) at the next unit of time \( t_{n+1} \) is calculated using the formula
\[ x_i(t_{n+1}) = x_i(t_n) + \Delta t \cdot v_i(t_n) + (\Delta t)^2 \frac{F_i(t_n)}{2m_i}. \]
As an optimization, in order to prevent looping through all particles once more to reset the existing force and potentially apply gravity in the upcoming force calculation step of the time integration, this is done at the end of this function instead. If the gravity is set to 0, the force applied to all active particles will be zeroed instead.
| particles | The ParticleContainer containing the Particle objects to iterate over. |
| delta_t | The timestep \( \Delta t \). |
| g_grav | The gravitational force \( g_{grav} \). |
| lc | Unused. Present to allow calling function without last argument. |
| membrane | Unused. Present to allow calling function without last argument. |
| void calculateX_LC | ( | ParticleContainer & | particles, |
| double | delta_t, | ||
| double | g_grav, | ||
| CellContainer * | lc, | ||
| bool | membrane = false |
||
| ) |
Calculates the position \( x \) for all Particle objects in a given ParticleContainer when using the linked cells method.
The position update occurs analogously to the default, non-linked-cell function.
After each update, the particle may need to be moved to a different cell. The algorithm checks this and updates the cell correspondence accordingly. If the particle enters a halo cell, the appropriate boundary condition will be applied.
If a particle enters a corner halo cell where one side has a different boundary condition to the other, the condition is chosen based on which boundary the particle will hit first. See the report and presentation for more details.
As an optimization, in order to prevent looping through all particles once more to reset the existing force and potentially apply gravity in the upcoming force calculation step of the time integration, this is done at the end of this function instead. If the gravity is set to 0, the force applied to all active particles will be zeroed instead.
| particles | The ParticleContainer containing the Particle objects to iterate over. |
| delta_t | The timestep \( \Delta t \). |
| g_grav | The gravitational force \( g_{grav} \). |
| lc | The CellContainer for the linked cells method. |
| membrane | Determines, whether gravity should be applied along the z-axis (true) or y-axis (false). |