84 const Eigen::Matrix<Real,3,1> B(Bx,By,Bz);
85 Eigen::Matrix<Real,3,1> unit_B(B.normalized());
89 const Real B_mag = B.norm() + 1e-30;
91 unit_B(0,0) = 0; unit_B(1,0) = 0; unit_B(2,0) = 1;
94 const Real gyro_period
99 const Real EPSILON = 1e10 * numeric_limits<Real>::min();
109 Transform<Real,3,Affine> total_transform(Matrix<Real, 4, 4>::Identity());
111 unsigned int bulk_velocity_substeps;
112 bulk_velocity_substeps = std::abs(
dt) / std::abs(gyro_period*(0.1/360.0));
113 if (bulk_velocity_substeps < 1) bulk_velocity_substeps=1;
115 const Real substeps_radians = -(2.0*M_PI*
dt/gyro_period)/bulk_velocity_substeps;
116 const Real substeps_dt=
dt/bulk_velocity_substeps;
117 Eigen::Matrix<Real,3,1> EgradPe(
122 for (uint
i=0;
i<bulk_velocity_substeps; ++
i) {
125 Eigen::Matrix<Real,3,1> rotation_pivot(total_transform*bulk_velocity);
128 rotation_pivot[0]-= hallPrefactor*(dBZdy - dBYdz);
129 rotation_pivot[1]-= hallPrefactor*(dBXdz - dBZdx);
130 rotation_pivot[2]-= hallPrefactor*(dBYdx - dBXdy);
135 total_transform = Translation<Real,3>(-rotation_pivot)*total_transform;
136 total_transform = AngleAxis<Real>(substeps_radians,unit_B)*total_transform;
137 total_transform = Translation<Real,3>(rotation_pivot)*total_transform;
141 total_transform=Translation<Real,3>( (std::abs(
getObjectWrapper().particleSpecies[popID].charge)/
getObjectWrapper().particleSpecies[popID].mass) * EgradPe * substeps_dt) * total_transform;
145 return total_transform;
ObjectWrapper & getObjectWrapper()