Reply To: Wall contact in particle simulation (dkt2d example)
OpenLB – Open Source Lattice Boltzmann Code › Forums › on OpenLB › General Topics › Wall contact in particle simulation (dkt2d example) › Reply To: Wall contact in particle simulation (dkt2d example)
Dear avrachan,
you’re on the right track already. It’s important that all functions know about the periodicity. The ParticleManager
can only pass it to the functions that have access to it. The functions you mentioned don’t know it, hence you have to manually pass it.
The particle position must be explicitly updated when it moves outside the domain. The example doesn’t include that, so I’m sure it’s difficult to find, sorry about that. Currently, we have the following function that should compute the new position:
const PhysR<T,D> position = particles::communication::applyPeriodicityToPosition(
cuboidGeometry, periodicity, particle.template getField<GENERAL,POSITION>());
Note that you have to update the position afterwards:
particle.template setField<GENERAL, POSITION>(position);
Also, instead of accessing the fields like that, it’s likely better to use the functions provided in src/particles/functions/dataAccessWrappers.h”, e.g., getPosition
and setPosition
.
Best regards,
Jan