Removed atan2
This commit is contained in:
@@ -66,6 +66,9 @@ class CylinderCoordinate : public Coordinate {
|
||||
private:
|
||||
void limitPhi();
|
||||
blitz::TinyVector<double, 3> cylinder_position;
|
||||
#ifdef debug
|
||||
bool phi_was_set = false;
|
||||
#endif
|
||||
};
|
||||
|
||||
class Vector {
|
||||
|
||||
@@ -73,7 +73,7 @@ blitz::TinyVector<double, 3> CartesianCoordinate::cylinderEntries() const {
|
||||
// std::pow(cartesian_position(1), 2));
|
||||
const double radius = std::sqrt(cartesian_position(0)*cartesian_position(0) +
|
||||
cartesian_position(1)*cartesian_position(1));
|
||||
const double phi = std::atan2(cartesian_position(1), cartesian_position(0));
|
||||
const double phi = 0.;//std::atan2(cartesian_position(1), cartesian_position(0));
|
||||
const double z = cartesian_position(2);
|
||||
return blitz::TinyVector<double, 3>(radius, phi, z);
|
||||
}
|
||||
@@ -89,6 +89,9 @@ void CartesianCoordinate::add(const Coordinate& coordinate) {
|
||||
CylinderCoordinate::CylinderCoordinate(
|
||||
const blitz::TinyVector<double, 3>& cylinder_position)
|
||||
: cylinder_position(cylinder_position) {
|
||||
#ifdef debug
|
||||
phi_was_set = true;
|
||||
#endif
|
||||
// limitPhi();
|
||||
}
|
||||
|
||||
@@ -98,14 +101,26 @@ CylinderCoordinate::CylinderCoordinate(const Coordinate& coordinate)
|
||||
}
|
||||
|
||||
double CylinderCoordinate::cosAzimuth() const {
|
||||
#ifdef debug
|
||||
if(!phi_was_set)
|
||||
fprintf(stdout, "CylinderCoordinate cos calc\n");
|
||||
#endif
|
||||
return std::cos(cylinder_position(1));
|
||||
}
|
||||
|
||||
double CylinderCoordinate::sinAzimuth() const {
|
||||
#ifdef debug
|
||||
if(!phi_was_set)
|
||||
fprintf(stdout, "CylinderCoordinate sin calc\n");
|
||||
#endif
|
||||
return std::sin(cylinder_position(1));
|
||||
}
|
||||
|
||||
blitz::TinyVector<double, 3> CylinderCoordinate::cartesianEntries() const {
|
||||
#ifdef debug
|
||||
if(!phi_was_set)
|
||||
fprintf(stdout, "Transformation form cylinder coordinate to cartesian!\n");
|
||||
#endif
|
||||
return blitz::TinyVector<double, 3>(
|
||||
cylinder_position(0) * std::cos(cylinder_position(1)),
|
||||
cylinder_position(0) * std::sin(cylinder_position(1)),
|
||||
@@ -210,6 +225,7 @@ blitz::TinyVector<double, 3> CartesianVector::cartesianEntries() const {
|
||||
|
||||
blitz::TinyVector<double, 3> CartesianVector::cylinderEntries(
|
||||
const Coordinate& coordinate) const {
|
||||
fprintf(stdout, "Transformation Cartesian Vector to Cylinder vector\n");
|
||||
const blitz::TinyVector<double, 3> cylinder_vector =
|
||||
coordinate.cylinderEntries();
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void BorisMover::move(particle::Particle* particle,
|
||||
ElectricField* electric_field,
|
||||
MagneticField* magnetic_field,
|
||||
GravityField* gravity_field) {
|
||||
|
||||
// DEBUG("start mover");
|
||||
// only useful if the timescale defined by the gyro frequency allows fast particles
|
||||
// to move too far
|
||||
// keep hard coded for now; has to be decided to be either kept (new field for Boris
|
||||
@@ -177,7 +177,8 @@ void BorisMover::move(particle::Particle* particle,
|
||||
DEBUG(out.str());
|
||||
}
|
||||
#endif
|
||||
particle->specie()->currentCollector()->collect(particle, old_position_cyl);
|
||||
particle->specie()->currentCollector()->collect(particle, old_position_cart);
|
||||
// DEBUG("end mover");
|
||||
}
|
||||
|
||||
void BorisMover::movementStep(
|
||||
|
||||
@@ -10,9 +10,9 @@ bool ReflectorDPS::needsReflectionBackToDomain(
|
||||
|
||||
void ReflectorDPS::reflectBackToDomain(particle::Particle* particle) const {
|
||||
blitz::TinyVector<double, 3> old_position =
|
||||
particle->cylinderPosition().cylinderEntries();
|
||||
particle->cartesianPosition().cartesianEntries();
|
||||
old_position(2) = 2 * z_position_dps_ - old_position(2);
|
||||
particle->position(CylinderCoordinate(old_position));
|
||||
particle->position(CartesianCoordinate(old_position));
|
||||
blitz::TinyVector<double, 3> old_velocity =
|
||||
particle->velocity().cartesianEntries();
|
||||
old_velocity(2) *= -1;
|
||||
|
||||
Reference in New Issue
Block a user