Commit 42b385ee authored by Daniel Winklehner's avatar Daniel Winklehner
Browse files

Passing meanR and rotation quaternion to PartBunch, added get functionsfor the two -Dw

parent af4f4904
...@@ -1112,14 +1112,16 @@ void PartBunch::computeSelfFields_cycl(double gamma) { ...@@ -1112,14 +1112,16 @@ void PartBunch::computeSelfFields_cycl(double gamma) {
void PartBunch::computeSelfFields_cycl(double gamma, Vector_t const meanR, Vektor<double, 4> const quaternion) { void PartBunch::computeSelfFields_cycl(double gamma, Vector_t const meanR, Vektor<double, 4> const quaternion) {
IpplTimings::startTimer(selfFieldTimer_m); IpplTimings::startTimer(selfFieldTimer_m);
globalMeanR = meanR;
globalToLocalQuaternion = quaternion;
/// set initial charge density to zero. /// set initial charge density to zero.
rho_m = 0.0; rho_m = 0.0;
/// set initial E field to zero /// set initial E field to zero
eg_m = Vector_t(0.0); eg_m = Vector_t(0.0);
if(fs_m->hasValidSolver()) { if(fs_m->hasValidSolver()) {
/// scatter particles charge onto grid. /// scatter particles charge onto grid.
this->Q.scatter(this->rho_m, this->R, IntrplCIC_t()); this->Q.scatter(this->rho_m, this->R, IntrplCIC_t());
...@@ -1133,7 +1135,7 @@ void PartBunch::computeSelfFields_cycl(double gamma, Vector_t const meanR, Vekto ...@@ -1133,7 +1135,7 @@ void PartBunch::computeSelfFields_cycl(double gamma, Vector_t const meanR, Vekto
hr_scaled[1] *= gamma; hr_scaled[1] *= gamma;
/// now charge density is in rho_m /// now charge density is in rho_m
/// calculate Possion equation (without coefficient: -1/(eps)) /// calculate Possion equation (without coefficient: -1/(eps))
fs_m->solver_m->computePotential(rho_m, hr_scaled); fs_m->solver_m->computePotential(rho_m, hr_scaled);
/// additional work of FFT solver /// additional work of FFT solver
...@@ -1166,7 +1168,6 @@ void PartBunch::computeSelfFields_cycl(double gamma, Vector_t const meanR, Vekto ...@@ -1166,7 +1168,6 @@ void PartBunch::computeSelfFields_cycl(double gamma, Vector_t const meanR, Vekto
*gmsg << "Field along z axis E = " << eg_m[m2][m2][i] << " Pot = " << rho_m[m2][m2][i] << endl; *gmsg << "Field along z axis E = " << eg_m[m2][m2][i] << " Pot = " << rho_m[m2][m2][i] << endl;
// end debug // end debug
*/ */
/// interpolate electric field at particle positions. /// interpolate electric field at particle positions.
Ef.gather(eg_m, this->R, IntrplCIC_t()); Ef.gather(eg_m, this->R, IntrplCIC_t());
......
...@@ -104,6 +104,8 @@ public: ...@@ -104,6 +104,8 @@ public:
void do_binaryRepart(); void do_binaryRepart();
/// per default the MT value of the field solver is used /// per default the MT value of the field solver is used
void set_nBinsLineDensity(int n); void set_nBinsLineDensity(int n);
...@@ -400,6 +402,9 @@ public: ...@@ -400,6 +402,9 @@ public:
inline void setNumBunch(int n); inline void setNumBunch(int n);
inline int getNumBunch() const; inline int getNumBunch() const;
inline Vector_t getGlobalMeanR() {return globalMeanR;}
inline Vektor<double, 4> getGlobalToLocalQuaternion() {return globalToLocalQuaternion;}
void setSteptoLastInj(int n); void setSteptoLastInj(int n);
int getSteptoLastInj(); int getSteptoLastInj();
...@@ -553,6 +558,9 @@ private: ...@@ -553,6 +558,9 @@ private:
/// energy spread of the beam in keV /// energy spread of the beam in keV
double dE_m; double dE_m;
Vektor<double, 4> globalToLocalQuaternion;
Vector_t globalMeanR;
/// maximal extend of particles /// maximal extend of particles
Vector_t rmax_m; Vector_t rmax_m;
/// minimal extend of particles /// minimal extend of particles
......
...@@ -2032,7 +2032,7 @@ void ParallelCyclotronTracker::Tracker_RK4() { ...@@ -2032,7 +2032,7 @@ void ParallelCyclotronTracker::Tracker_RK4() {
// itsBunch->Bf[ii](1) = temp_E2; // By,T // itsBunch->Bf[ii](1) = temp_E2; // By,T
// } // }
} else { } else {
// --- Single bunch mode --- // // --- Single bunch mode --- //
double temp_meangamma = sqrt(1.0 + dot(PreviousMeanP, PreviousMeanP)); double temp_meangamma = sqrt(1.0 + dot(PreviousMeanP, PreviousMeanP));
Vektor<double, 4> quaternionToYAxis; Vektor<double, 4> quaternionToYAxis;
...@@ -2042,7 +2042,6 @@ void ParallelCyclotronTracker::Tracker_RK4() { ...@@ -2042,7 +2042,6 @@ void ParallelCyclotronTracker::Tracker_RK4() {
globalToLocal(itsBunch->R, quaternionToYAxis, meanR); globalToLocal(itsBunch->R, quaternionToYAxis, meanR);
itsBunch->R /= Vector_t(1000.0); // mm --> m itsBunch->R /= Vector_t(1000.0); // mm --> m
// // in global Cartesian frame, calculate the direction of longitudinal angle of bunch // // in global Cartesian frame, calculate the direction of longitudinal angle of bunch
// double meanPhi = calculateAngle(meanP(0), meanP(1)) - 0.5 * pi; // double meanPhi = calculateAngle(meanP(0), meanP(1)) - 0.5 * pi;
...@@ -2078,10 +2077,10 @@ void ParallelCyclotronTracker::Tracker_RK4() { ...@@ -2078,10 +2077,10 @@ void ParallelCyclotronTracker::Tracker_RK4() {
itsBunch->boundp(); itsBunch->boundp();
IpplTimings::stopTimer(TransformTimer_m); IpplTimings::stopTimer(TransformTimer_m);
repartition(); repartition();
itsBunch->computeSelfFields_cycl(temp_meangamma, meanR, quaternionToYAxis); itsBunch->computeSelfFields_cycl(temp_meangamma, 0.001 * meanR, quaternionToYAxis);
IpplTimings::startTimer(TransformTimer_m); IpplTimings::startTimer(TransformTimer_m);
...@@ -2199,7 +2198,6 @@ void ParallelCyclotronTracker::Tracker_RK4() { ...@@ -2199,7 +2198,6 @@ void ParallelCyclotronTracker::Tracker_RK4() {
rold_m[j] = variable_m[j]; // used for gap cross checking rold_m[j] = variable_m[j]; // used for gap cross checking
pold_m[j] = variable_m[j+3]; // used for gap cross pold_m[j] = variable_m[j+3]; // used for gap cross
} }
// integrate for one step in the lab Cartesian frame (absolute value). // integrate for one step in the lab Cartesian frame (absolute value).
// IpplTimings::startTimer(IntegrationTimer_m); // IpplTimings::startTimer(IntegrationTimer_m);
flagNoDeletion = rk4(variable_m, t, dt, i); flagNoDeletion = rk4(variable_m, t, dt, i);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment