Commit fb5086dd authored by kraus's avatar kraus
Browse files

adding option SCALABLE to distribution to make generation scalable. Time...

adding option SCALABLE to distribution to make generation scalable. Time dependency and scalability can be chosen independently
parent ab327ac5
......@@ -49,7 +49,7 @@ The distribution command is used to introduce particles into an \opal simulation
commands \seechp{format}, the distribution command is of the form:
\begin{example}
Name:DISTRIBUTION, DISTRIBUTION = TYPE,
Name:DISTRIBUTION, TYPE = DISTRIBUTION_TYPE,
ATTRIBUTE #1 =,
ATTRIBUTE #2 =,
.
......@@ -141,8 +141,10 @@ distribution type. These are defined in \secref{universaldistattributes,injected
\hline
\tabhead{Attribute Name & Default Value & Units & Description }
\hline
\tabline{WRITETOFILE}{\index{WRITETOFILE} \keyword{FALSE} & None & Echo initial distribution to text file \filename{data/distribution.data}.}
\tabline{WRITETOFILE}{\index{WRITETOFILE} \keyword{FALSE} & None & Echo initial distribution to text file \filename{data/\textless basename \textgreater\_ DIST.dat}.}
%\hline
\tabline{SCALABLE}{\index{SCALABLE} \keyword{FALSE} & None & Makes the generation scalable with respect of number of particles. The result depends on the number of cores used.}
%
\tabline[sec:distlist]{WEIGHT}{\num{1.0} & None & Weight of distribution when used in a distribution list \seesec{distlist}.}
%\hline
\tabline[sec:FSENBINS]{NBIN}{\num{0} & None & The distribution (beam) will be broken up into \keyword{NBIN} energy bins.
......@@ -259,13 +261,13 @@ we list the single attribute specific to this type of distribution type.
An example of an \emph{injected} \keyword{FROMFILE} distribution definition is:
\begin{example}
Name:DISTRIBUTION, DISTRIBUTION = FROMFILE,
Name:DISTRIBUTION, TYPE = FROMFILE,
FNAME = ``text file name'';
\end{example}
an example of an \emph{emitted} \keyword{FROMFILE} distribution definition is:
\begin{example}
Name:DISTRIBUTION, DISTRIBUTION = FROMFILE,
Name:DISTRIBUTION, TYPE = FROMFILE,
FNAME = ``text file name'',
EMITTED = TRUE,
EMISSIONMODEL = None;
......@@ -401,7 +403,7 @@ In \tabref{distattrgauss} we list the basic attributes available for a \keyword{
can use these to create a very simple \keyword{GAUSS} distribution:
\begin{example}
Name:DISTRIBUTION, DISTRIBUTION = GAUSS,
Name:DISTRIBUTION, TYPE = GAUSS,
SIGMAX = 0.001,
SIGMAY = 0.003,
SIGMAZ = 0.002,
......@@ -576,7 +578,7 @@ As an example of defining a correlated beam, let the initial correlation coeffic
then the corresponding distribution command will read:
\begin{example}
Dist:DISTRIBUTION, DISTRIBUTION = GAUSS,
Dist:DISTRIBUTION, TYPE = GAUSS,
SIGMAX = 4.796e-03,
SIGMAPX = 231.0585,
CORRX = 0.756,
......@@ -689,7 +691,7 @@ Below we show an example of a \keyword{FLATTOP} distribution command with an ell
in time, \SI{10}{\pico\second} long with a \SI{0.5}{\pico\second} rise and fall time as defined in \figref{flattop}.
\begin{example}
Dist:DISTRIBUTION, DISTRIBUTION = FLATTOP,
Dist:DISTRIBUTION, TYPE = FLATTOP,
SIGMAX = 0.001,
SIGMAY = 0.002,
TRISE = 0.5e-12,
......@@ -798,7 +800,7 @@ as the particles would not move off the cathode, causing all of the emitted char
time step before the beam space charge is calculated.
\begin{example}
Dist:DISTRIBUTION, DISTRIBUTION = FLATTOP,
Dist:DISTRIBUTION, TYPE = FLATTOP,
SIGMAX = 0.001,
SIGMAY = 0.002,
TRISE = 0.5e-12,
......@@ -812,7 +814,7 @@ Dist:DISTRIBUTION, DISTRIBUTION = FLATTOP,
EMITTED = TRUE;
\end{example}
One thing to note, it may be that if you are emitting your own distribution using the \keyword{DISTRIBUTION = FROMFILE}
One thing to note, it may be that if you are emitting your own distribution using the \keyword{TYPE = FROMFILE}
option, you may want to set \keyword{EKIN = 0} if you have already added some amount of momentum, $p_{z}$, to the
particles.
......@@ -867,7 +869,7 @@ An example of using the \keyword{NONEQUIL} emission model is given below. This m
cathodes and cathodes such as $CsTe$.
\begin{example}
Dist:DISTRIBUTION, DISTRIBUTION = GAUSS,
Dist:DISTRIBUTION, TYPE = GAUSS,
SIGMAX = 0.001,
SIGMAY = 0.002,
TRISE = 1.0e-12,
......
......@@ -370,6 +370,7 @@ void ParallelTTracker::execute() {
evenlyDistributeParticles();
deletedParticles_m = false;
}
itsBunch_m->toLabTrafo_m = referenceToLabCSTrafo_m;
itsBunch_m->RefPartR_m = referenceToLabCSTrafo_m.transformTo(RefPartR_m);
itsBunch_m->RefPartP_m = referenceToLabCSTrafo_m.rotateTo(RefPartP_m);
......
......@@ -580,11 +580,11 @@ void PartBunch::computeSelfFields(int binNumber) {
true);
}
interpolationCacheSet_m = true;
this->Q.scatter(this->rho_m, this->R, IntrplCIC_t(), interpolationCache_m);
} else {
this->Q.scatter(this->rho_m, IntrplCIC_t(), interpolationCache_m);
}
this->Q /= this->dt;
this->rho_m /= getdT();
......@@ -1456,6 +1456,7 @@ void PartBunch::computeSelfFields_cycl(int bin) {
*gmsg << "min of bunch is (" << rmin_m(0) << ", " << rmin_m(1) << ", " << rmin_m(2) << ") [m] " << endl;
*/
IpplTimings::stopTimer(selfFieldTimer_m);
}
......@@ -1552,17 +1553,18 @@ void PartBunch::boundp() {
if (getIfBeamEmitting() && dist_m != NULL) {
// keep particles per cell ratio high, don't spread a hand full particles across the whole grid
double percent = std::max((1.0 + (3 - nr_m[2]) * dh_m) / (nr_m[2] - 1), dist_m->getPercentageEmitted());
double length = std::abs(rmax_m[2] - rmin_m[2]);
double percent = std::max(1.0 / (nr_m[2] - 1), dist_m->getPercentageEmitted());
double length = std::abs(rmax_m[2] - rmin_m[2]) / (1.0 + 2 * dh_m);
if (percent < 1.0 && percent > 0.0) {
length /= (1.0 + 2 * dh_m);
rmax_m[2] -= dh_m * length;
rmin_m[2] = rmax_m[2] * (1.0 - 1.0 / percent);
rmin_m[2] = rmax_m[2] - length / percent;
length /= percent;
length = std::abs(rmax_m[2] - rmin_m[2]);
rmax_m[2] += dh_m * length;
rmin_m[2] -= dh_m * length;
hr_m[2] = length * (1.0 + 2 * dh_m) / (nr_m[2] - 1);
hr_m[2] = (rmax_m[2] - rmin_m[2]) / (nr_m[2] - 1);
}
}
......@@ -1584,8 +1586,6 @@ void PartBunch::boundp() {
GuardCellSizes<Dim>(1),
vbc_m);
} else {
*gmsg << __DBGMSG__ << std::scientific << volume << "\t" << dh_m << endl;
throw GeneralClassicException("boundp() ", "h<0, can not build a mesh");
}
}
......
This diff is collapsed.
......@@ -428,9 +428,8 @@ private:
double M_m; /// mass in terms of proton mass
std::string bfieldfn_m; /// only temporarly
/// seed for the rng, If seed == -1 every core has
/// a differnt seed, otherwiese the seed is Ippl::myNode()
unsigned long mySeed_m;
// Some legacy members that need to be cleaned up.
......@@ -475,4 +474,4 @@ inline double Distribution::getPercentageEmitted() const {
return (double)totalNumberEmittedParticles_m / (double)totalNumberParticles_m;
}
#endif // OPAL_Distribution_HH
#endif // OPAL_Distribution_HH
\ No newline at end of file
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