alec-glisman / Swimming-in-Potential-Flow

Study dynamics of inertial active matter in a potential fluid (irrotational, incompressible).
https://doi.org/10.1017/jfm.2022.946
GNU General Public License v3.0
1 stars 0 forks source link

Isolated collinear swimmer develops acceleration in 2nd component of unit quaternion #12

Closed alec-glisman closed 2 years ago

alec-glisman commented 2 years ago

I decided to first validate the system with the collinear swimmer before moving to the wall problem for simplicity in tracking down any issues. Physically, the system should purely translate and not experience any rotation, as all articulation and configuration are collinear. However, after the first step in RK4 integration, the 2nd component of the unit body quaternion develops some rotation. This issue will serve as the documentation for tracking down this bug and fixing it.

alec-glisman commented 2 years ago

Here is what I have gathered thus far:

alec-glisman commented 2 years ago

On the last point, this is not strictly true. The total (magnitude) of the added mass is invariant to a rigid spatial translation, but the "amount" of added mass in each spatial direction will change, so there should be a non-zero gradient term.

alec-glisman commented 2 years ago

Found a bug in the calculation of gradZeta: was not correctly setting gradient of cross product to zero if the particle was a locater particle

alec-glisman commented 2 years ago

On the first assignment of N2 (initial configuration) the first 3 rows of the 5 gradient are all zeros. After the first RK4 sub-step, the positions are all still collinear, but these elements become non-zero. Find out why

alec-glisman commented 2 years ago

Found a bug in calculation of chi matrix element: was not indexing the quaternion component correctly.

alec-glisman commented 2 years ago

I even tried two separate algorithms for the gradient of the rotated position with respect to the quaternion, but got the same results. The simulation is still unstable on component (5) in the previously discussed locations. I am very confused

alec-glisman commented 2 years ago

Found a bug in the calculation of m_particles_accelerations. RBM components were overwriting the body components, rather than outputting the particle components

alec-glisman commented 2 years ago

Redid derivations to combine rbm_conn and psi matrices into one term and removed the need for scalar_w in the process. Still experiencing the same issue

alec-glisman commented 2 years ago

After refactoring much of SystemData calculations, it appears the bug is located in SystemData::chiMatrixElement().

Specically, the calculation of g_matrix seems to be an issue. The form it has does not match my analytical derivations.

alec-glisman commented 2 years ago

After adding more safeties and refactoring the problematic function, it seems stable now