Compare commits
5
Commits
32f4703f4e
...
53f0d0d86a
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
53f0d0d86a | ||
|
|
ca7b637577 | ||
|
|
46277ae340 | ||
|
|
9e9c9ac174 | ||
|
|
a6a9ac388c |
@@ -26,4 +26,38 @@ class Cylinder : public Geometry {
|
|||||||
const double height_;
|
const double height_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
/|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾|‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾\ ‾‾‾
|
||||||
|
/ | | \ ^
|
||||||
|
/ | | \ |
|
||||||
|
/ | | \ | R_cylinder
|
||||||
|
/ | | \ ⌄
|
||||||
|
|<-->|<------------------>|<------------------><---> ---
|
||||||
|
z=0 ^ ^ |
|
||||||
|
| | |
|
||||||
|
H_cone H_cylinder symmetry axis
|
||||||
|
|
||||||
|
The geometry will only know 3 regions, "inside", "hull", "top". Meaning the
|
||||||
|
cone will always have the same boundary condition as the cylinder boundary.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
Geometry of a cylinder with a cone as the end with its tip at z=0.
|
||||||
|
*/
|
||||||
|
class HalfCylinderWithCone : public Geometry {
|
||||||
|
public:
|
||||||
|
HalfCylinderWithCone(double radiusCylinder, double heightCylinder,
|
||||||
|
double heightCone, double zfrustum);
|
||||||
|
bool isInside(const Coordinate& position) const;
|
||||||
|
GeometryPositioning isWhere(const Coordinate& position) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const double cylinder_radius_;
|
||||||
|
const double cylinder_height_;
|
||||||
|
const double cone_height_;
|
||||||
|
const double z_frustum_;
|
||||||
|
|
||||||
|
double localRadius(double z) const;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* GEOMETRY_H */
|
#endif /* GEOMETRY_H */
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ class Interaction {
|
|||||||
std::function<double(double)> cross_section_;
|
std::function<double(double)> cross_section_;
|
||||||
std::shared_ptr<species::Specie> target_;
|
std::shared_ptr<species::Specie> target_;
|
||||||
CartesianVector target_velocity_;
|
CartesianVector target_velocity_;
|
||||||
|
|
||||||
|
double threshold_increase_J = 6.9032515e-26; // J (5 mK)
|
||||||
};
|
};
|
||||||
|
|
||||||
}; // namespace interaction
|
}; // namespace interaction
|
||||||
|
|||||||
@@ -16,8 +16,10 @@ enum class DeletionType {
|
|||||||
|
|
||||||
// to count physical particle deletion
|
// to count physical particle deletion
|
||||||
enum class PhysicalDeletionType {
|
enum class PhysicalDeletionType {
|
||||||
wall
|
wall,
|
||||||
|
large_energy_transfer
|
||||||
};
|
};
|
||||||
|
|
||||||
class Coordinate;
|
class Coordinate;
|
||||||
|
|
||||||
class DeletionLogger {
|
class DeletionLogger {
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
|
|
||||||
#include "simulation/coordinates.h"
|
#include "simulation/coordinates.h"
|
||||||
#include "simulation/position_binning.h"
|
#include "simulation/position_binning.h"
|
||||||
|
#include "constants/physical_constants.h"
|
||||||
|
|
||||||
class VectorField {
|
class VectorField {
|
||||||
public:
|
public:
|
||||||
@@ -50,4 +51,34 @@ class VectorFieldFunctionInZ : public VectorField {
|
|||||||
std::function<double(double, double, double)> F_z_;
|
std::function<double(double, double, double)> F_z_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Vector field implementing the analytical approximation to the
|
||||||
|
// magnetic field in the Project 8 LFA case, all parameters are hard-coded for now
|
||||||
|
// Note that only one half of the whole system is considered -> only one Gaussian peak
|
||||||
|
class PredefinedMagneticVectorFieldLFA : public VectorField {
|
||||||
|
public:
|
||||||
|
PredefinedMagneticVectorFieldLFA();
|
||||||
|
// Important: coordinate has to be a Cartesian Coordinate in oder for the calculation to be correct
|
||||||
|
CylinderVector value(const Coordinate& coordinate) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
// half opening angle of the cones = 35 deg, I_Ioffe = 5kA
|
||||||
|
const double cosa = std::cos(M_PI*35./180.);
|
||||||
|
const double sina = std::sin(M_PI*35./180.);
|
||||||
|
const double B0Ioffe = SI::mu0*5000/(2*M_PI); // Tm
|
||||||
|
// background field
|
||||||
|
const double Bbg = 0.0207; // T
|
||||||
|
// radius of ioffe wires
|
||||||
|
const double RIoffe = 0.3326; // m
|
||||||
|
// steepness of transition functions, currently not used
|
||||||
|
const double c1 = 10.; // 1/m
|
||||||
|
const double c2 = 100.; // 1/m
|
||||||
|
|
||||||
|
blitz::Array<double, 1> cosktheta{128};
|
||||||
|
blitz::Array<double, 1> sinktheta{128};
|
||||||
|
// z1, z2 in the system, where the Ioffe cone tip is in the origin,
|
||||||
|
// zoffset the distance between ioffe cone tip and cavity cone tip,
|
||||||
|
// z1 is the start of the ioffe frustum and z2 the transition from cone to cylinder
|
||||||
|
double z1, z2, zoffset;
|
||||||
|
};
|
||||||
|
|
||||||
#endif /* VECTOR_FIELD_H */
|
#endif /* VECTOR_FIELD_H */
|
||||||
|
|||||||
@@ -273,6 +273,8 @@ void SimulationOutput::writeNumDeletions(DeletionLogger* logger,
|
|||||||
for (auto& pair : physDeletions) {
|
for (auto& pair : physDeletions) {
|
||||||
if (pair.first == PhysicalDeletionType::wall) {
|
if (pair.first == PhysicalDeletionType::wall) {
|
||||||
writer.write(pair.second, path_to_deletions + "/Wall(physical)");
|
writer.write(pair.second, path_to_deletions + "/Wall(physical)");
|
||||||
|
} else if (pair.first == PhysicalDeletionType::large_energy_transfer) {
|
||||||
|
writer.write(pair.second, path_to_deletions + "/LargeEnergyTransfer");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,36 @@ std::shared_ptr<Geometry> buildGeometry(Parameter& parameter,
|
|||||||
DEBUG_LEVEL_3("with height: " + std::to_string(height) + " m");
|
DEBUG_LEVEL_3("with height: " + std::to_string(height) + " m");
|
||||||
#endif
|
#endif
|
||||||
return std::shared_ptr<Geometry>(new Cylinder(radius, height));
|
return std::shared_ptr<Geometry>(new Cylinder(radius, height));
|
||||||
|
} else if(parameter.jsonObjectFromBase(
|
||||||
|
json_path_append(path_to_geometry, {"HalfCylinderWithCone"}))) {
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
|
DEBUG("Creating geometry: half cylinder with cone.");
|
||||||
|
#endif
|
||||||
|
double radius =
|
||||||
|
json_read_length(parameter.jsonObjectFromBase(json_path_append(
|
||||||
|
path_to_geometry, {"HalfCylinderWithCone", "Radius"})),
|
||||||
|
"m");
|
||||||
|
double heightcylinder =
|
||||||
|
json_read_length(parameter.jsonObjectFromBase(json_path_append(
|
||||||
|
path_to_geometry, {"HalfCylinderWithCone", "HeightCylinder"})),
|
||||||
|
"m");
|
||||||
|
double heightcone =
|
||||||
|
json_read_length(parameter.jsonObjectFromBase(json_path_append(
|
||||||
|
path_to_geometry, {"HalfCylinderWithCone", "HeightCone"})),
|
||||||
|
"m");
|
||||||
|
double z_frustum =
|
||||||
|
json_read_length(parameter.jsonObjectFromBase(json_path_append(
|
||||||
|
path_to_geometry, {"HalfCylinderWithCone", "FrustumStartZ"})),
|
||||||
|
"m");
|
||||||
|
|
||||||
|
#ifdef debug
|
||||||
|
std::stringstream out;
|
||||||
|
out << "height cyl: " << heightcylinder << ", height cone: " << heightcone << ", radius: " << radius << ", zfrustum: " << z_frustum << "\n";
|
||||||
|
DEBUG(out.str());
|
||||||
|
#endif
|
||||||
|
return std::shared_ptr<Geometry>(
|
||||||
|
new HalfCylinderWithCone(radius, heightcylinder, heightcone, z_frustum));
|
||||||
} else {
|
} else {
|
||||||
ERROR("This geometry is not implemented.");
|
ERROR("This geometry is not implemented.");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ std::shared_ptr<DeletionLogger> buildDeletionLogger(json_t* object) {
|
|||||||
used_types.push_back(DeletionType::max_time_alive);
|
used_types.push_back(DeletionType::max_time_alive);
|
||||||
used_types.push_back(DeletionType::cluster_formation);
|
used_types.push_back(DeletionType::cluster_formation);
|
||||||
used_phys_types.push_back(PhysicalDeletionType::wall);
|
used_phys_types.push_back(PhysicalDeletionType::wall);
|
||||||
|
used_phys_types.push_back(PhysicalDeletionType::large_energy_transfer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,9 @@ std::shared_ptr<VectorField> buildVectorField(json_t* object) {
|
|||||||
|
|
||||||
return std::make_shared<VectorFieldFromArray>(
|
return std::make_shared<VectorFieldFromArray>(
|
||||||
v_radial, v_azimuthal, v_longitudinal, radius, length);
|
v_radial, v_azimuthal, v_longitudinal, radius, length);
|
||||||
|
} else if (json_object_by_path(object, {"PredefinedLFAMagneticField"})) {
|
||||||
|
SIM_INFO("Warn: The predefined function is a magnetic field!!!");
|
||||||
|
return std::shared_ptr<VectorField>(new PredefinedMagneticVectorFieldLFA());
|
||||||
} else {
|
} else {
|
||||||
ERROR("This vector field is not implemented");
|
ERROR("This vector field is not implemented");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "simulation/velocity_distribution.h"
|
#include "simulation/velocity_distribution.h"
|
||||||
#include "constants/sim_constants.h"
|
#include "constants/sim_constants.h"
|
||||||
#include "simulation/density_field.h"
|
#include "simulation/density_field.h"
|
||||||
|
#include "simulation/logger.h"
|
||||||
namespace interaction {
|
namespace interaction {
|
||||||
|
|
||||||
ElasticScattering::ElasticScattering(
|
ElasticScattering::ElasticScattering(
|
||||||
@@ -24,6 +25,8 @@ InteractionOutput ElasticScattering::performInteraction(
|
|||||||
#endif
|
#endif
|
||||||
const blitz::TinyVector<double, 3> v_impact =
|
const blitz::TinyVector<double, 3> v_impact =
|
||||||
particle.velocity().cartesianEntries();
|
particle.velocity().cartesianEntries();
|
||||||
|
|
||||||
|
double E_i = kinematic::kineticEnergy(v_impact, particle.mass_kg());
|
||||||
// const auto x_impact = particle.position();
|
// const auto x_impact = particle.position();
|
||||||
// const blitz::TinyVector<double, 3> v_target =
|
// const blitz::TinyVector<double, 3> v_target =
|
||||||
// target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
|
// target_->driftVelocity()->driftVelocity(x_impact).cartesianEntries() +
|
||||||
@@ -48,6 +51,13 @@ InteractionOutput ElasticScattering::performInteraction(
|
|||||||
v_impact, target_velocity_.cartesianEntries(), particle.mass_kg(),
|
v_impact, target_velocity_.cartesianEntries(), particle.mass_kg(),
|
||||||
target_->mass_kg(), theta, phi);
|
target_->mass_kg(), theta, phi);
|
||||||
|
|
||||||
|
double E_iprime = kinematic::kineticEnergy(v_impact_new, particle.mass_kg());
|
||||||
|
|
||||||
|
// energy conservation: Ei + Et = Ei' + Et' <==> Et' - Et = Ei - Ei' (lab frame)
|
||||||
|
if(E_i - E_iprime >= threshold_increase_J) {
|
||||||
|
particle.specie()->deletionLogger()->logDeletion(particle, PhysicalDeletionType::large_energy_transfer);
|
||||||
|
}
|
||||||
|
|
||||||
particle.velocity(CartesianVector(v_impact_new));
|
particle.velocity(CartesianVector(v_impact_new));
|
||||||
|
|
||||||
return InteractionOutput();
|
return InteractionOutput();
|
||||||
|
|||||||
@@ -23,3 +23,39 @@ GeometryPositioning Cylinder::isWhere(const Coordinate& position) const {
|
|||||||
return GeometryPositioning::inside;
|
return GeometryPositioning::inside;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HalfCylinderWithCone::HalfCylinderWithCone(double radiusCylinder, double heightCylinder,
|
||||||
|
double heightCone, double z_frustum) :
|
||||||
|
cylinder_height_(heightCylinder),
|
||||||
|
cylinder_radius_(radiusCylinder),
|
||||||
|
cone_height_(heightCone),
|
||||||
|
z_frustum_(z_frustum) {}
|
||||||
|
|
||||||
|
bool HalfCylinderWithCone::isInside(const Coordinate& coordinate) const {
|
||||||
|
const blitz::TinyVector<double, 3> cylinder_position = coordinate.cylinderEntries();
|
||||||
|
return (cylinder_position(2) > z_frustum_) &&
|
||||||
|
(cylinder_position(2) < (cylinder_height_ + cone_height_)) &&
|
||||||
|
(cylinder_position(0) < localRadius(cylinder_position(2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
GeometryPositioning HalfCylinderWithCone::isWhere(const Coordinate& coordinate) const {
|
||||||
|
const blitz::TinyVector<double, 3> cylinder_position = coordinate.cylinderEntries();
|
||||||
|
if(cylinder_position(2) <= z_frustum_ || cylinder_position(0) >= localRadius(cylinder_position(2))) {
|
||||||
|
return GeometryPositioning::hull;
|
||||||
|
} else if (cylinder_position(2) >= (cone_height_ + cylinder_height_)) {
|
||||||
|
return GeometryPositioning::top;
|
||||||
|
} else {
|
||||||
|
return GeometryPositioning::inside;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double HalfCylinderWithCone::localRadius(double z) const {
|
||||||
|
if(z >= cone_height_) {
|
||||||
|
return cylinder_radius_;
|
||||||
|
} else {
|
||||||
|
// can potentially be negative, but that should be fine for a check if
|
||||||
|
// the position is inside the geometry
|
||||||
|
return z/cone_height_*cylinder_radius_;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ CylinderCoordinate BorisMover::move(particle::Particle* particle,
|
|||||||
double old_kinetic_energy = particle->kineticEnergy_eV();
|
double old_kinetic_energy = particle->kineticEnergy_eV();
|
||||||
|
|
||||||
blitz::TinyVector<double, 3> B =
|
blitz::TinyVector<double, 3> B =
|
||||||
magnetic_field->value(old_position_cyl).cartesianEntries(old_position_cart);
|
magnetic_field->value(old_position_cart).cartesianEntries(old_position_cart);
|
||||||
blitz::TinyVector<double, 3> E;
|
blitz::TinyVector<double, 3> E;
|
||||||
if(particle->areLocalFieldsSet()) {
|
if(particle->areLocalFieldsSet()) {
|
||||||
// In case of spatially variable magnetic fields use the one at the "actual" particle
|
// In case of spatially variable magnetic fields use the one at the "actual" particle
|
||||||
@@ -53,25 +53,11 @@ CylinderCoordinate BorisMover::move(particle::Particle* particle,
|
|||||||
// B = particle->getLocalB();
|
// B = particle->getLocalB();
|
||||||
E = particle->getLocalE();
|
E = particle->getLocalE();
|
||||||
} else {
|
} else {
|
||||||
B = magnetic_field->value(old_position_cyl).cartesianEntries(old_position_cart);
|
B = magnetic_field->value(old_position_cart).cartesianEntries(old_position_cart);
|
||||||
E = electric_field->value(old_position_cyl).cartesianEntries(old_position_cart);
|
E = electric_field->value(old_position_cyl).cartesianEntries(old_position_cart);
|
||||||
particle->setLocalFields(E, B);
|
particle->setLocalFields(E, B);
|
||||||
}
|
}
|
||||||
|
|
||||||
// double old_mu;
|
|
||||||
// double new_mu;
|
|
||||||
// if magnetic field is 0 use e_z as a reference for the pitch angle
|
|
||||||
// calculation (don't know if best approach, probably not...)
|
|
||||||
// if (kinematic::norm(B) == 0) {
|
|
||||||
// old_mu = kinematic::cosPitchAngle(
|
|
||||||
// blitz::TinyVector<double, 3>(0,0,1),
|
|
||||||
// particle->velocity().cartesianEntries(old_position_cart));
|
|
||||||
// } else {
|
|
||||||
// old_mu = kinematic::cosPitchAngle(
|
|
||||||
// B, particle->velocity().cartesianEntries(old_position_cart));
|
|
||||||
// }
|
|
||||||
// new_mu = old_mu;
|
|
||||||
|
|
||||||
double timestep = 0;
|
double timestep = 0;
|
||||||
|
|
||||||
bool changed_position_bin = false;
|
bool changed_position_bin = false;
|
||||||
@@ -104,7 +90,7 @@ CylinderCoordinate BorisMover::move(particle::Particle* particle,
|
|||||||
auto new_position_cart = particle->cartesianPosition();
|
auto new_position_cart = particle->cartesianPosition();
|
||||||
auto new_velocity = particle->velocity();
|
auto new_velocity = particle->velocity();
|
||||||
|
|
||||||
B = magnetic_field->value(particle->cylinderPosition()).
|
B = magnetic_field->value(new_position_cart).
|
||||||
cartesianEntries(new_position_cart);
|
cartesianEntries(new_position_cart);
|
||||||
|
|
||||||
// if (kinematic::norm(B) == 0) {
|
// if (kinematic::norm(B) == 0) {
|
||||||
|
|||||||
@@ -59,3 +59,91 @@ CylinderVector VectorFieldFunctionInZ::value(
|
|||||||
0., 0.,
|
0., 0.,
|
||||||
F_z_(cylinder_position(0), cylinder_position(1), cylinder_position(2))));
|
F_z_(cylinder_position(0), cylinder_position(1), cylinder_position(2))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PredefinedMagneticVectorFieldLFA::PredefinedMagneticVectorFieldLFA() {
|
||||||
|
double theta = M_PI/64.;
|
||||||
|
for(int i = 0; i < 128; ++i) {
|
||||||
|
cosktheta(i) = std::cos(i*theta);
|
||||||
|
sinktheta(i) = std::sin(i*theta);
|
||||||
|
}
|
||||||
|
|
||||||
|
z1 = 0.1;
|
||||||
|
z2 = RIoffe*cosa/sina;
|
||||||
|
zoffset = 6e-3/sina;
|
||||||
|
}
|
||||||
|
|
||||||
|
// does not make use of the transition functions!!!
|
||||||
|
CylinderVector PredefinedMagneticVectorFieldLFA::value(const Coordinate& coordinate) const {
|
||||||
|
// Important that coordinate is a CartesianCoordinate since the transformation from
|
||||||
|
// CylinderCoordinate to CartesianCoordinate does not work, since phi is not tracked
|
||||||
|
blitz::TinyVector<double, 3> cartPos = coordinate.cartesianEntries();
|
||||||
|
double x = cartPos(0); double y = cartPos(1); double z = cartPos(2) + zoffset;
|
||||||
|
double r = std::sqrt(x*x + y*y);
|
||||||
|
double Bx, By, Bz;
|
||||||
|
|
||||||
|
Bx = 0;
|
||||||
|
By = 0;
|
||||||
|
Bz = 0;
|
||||||
|
|
||||||
|
double Dp = x*x + y*y + z*z;
|
||||||
|
double D0 = x*x + y*y + RIoffe*RIoffe;
|
||||||
|
|
||||||
|
double Dpk_plus, Dpk_minus, D0k;
|
||||||
|
|
||||||
|
// loop to gather cylinder Ioffe contribution
|
||||||
|
double sign = -1;
|
||||||
|
for(int i = 0; i < 128; ++i) {
|
||||||
|
sign *= -1;
|
||||||
|
|
||||||
|
D0k = 2*RIoffe*(x*cosktheta(i) + y*sinktheta(i));
|
||||||
|
|
||||||
|
Bx += sign*(y - RIoffe*sinktheta(i))/(D0 - D0k);
|
||||||
|
By += sign*(RIoffe*cosktheta(i) - x)/(D0 - D0k);
|
||||||
|
}
|
||||||
|
|
||||||
|
// only consider the cone contibution close to the cone
|
||||||
|
if(z < 1.2*z1) {
|
||||||
|
// loop to gather the cone Ioffe contribution
|
||||||
|
for(int i = 0; i < 128; i+=4) {
|
||||||
|
// positive current contribution at index i
|
||||||
|
Dpk_plus = x*sina*cosktheta(i) + y*sina*sinktheta(i) + z*cosa;
|
||||||
|
// negative current contribution at index i+1
|
||||||
|
Dpk_minus = x*sina*cosktheta(i+1) + y*sina*sinktheta(i+1) + z*cosa;
|
||||||
|
|
||||||
|
Bx += (z*sina*sinktheta(i) - y*cosa)/(Dp - Dpk_plus*Dpk_plus) -
|
||||||
|
(z*sina*sinktheta(i+1) - y*cosa)/(Dp - Dpk_minus*Dpk_minus);
|
||||||
|
|
||||||
|
By += (x*cosa - z*sina*cosktheta(i) )/(Dp - Dpk_plus*Dpk_plus) -
|
||||||
|
(x*cosa - z*sina*cosktheta(i+1))/(Dp - Dpk_minus*Dpk_minus);
|
||||||
|
|
||||||
|
Bz += (y*sina*cosktheta(i) - x*sina*sinktheta(i) )/(Dp - Dpk_plus*Dpk_plus) -
|
||||||
|
(y*sina*cosktheta(i+1) - x*sina*sinktheta(i+1))/(Dp - Dpk_minus*Dpk_minus);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Bx *= B0Ioffe;
|
||||||
|
By *= B0Ioffe;
|
||||||
|
Bz *= B0Ioffe;
|
||||||
|
|
||||||
|
|
||||||
|
// Magnetic Bottle
|
||||||
|
// assume the peak is located 2m away from the transition from cone to cylinder
|
||||||
|
double zg0 = z1 + 2; // m
|
||||||
|
double sig2 = 0.211954; // m^2
|
||||||
|
double B0g = 3.07e-4; // T
|
||||||
|
|
||||||
|
double Bzg = std::exp(-(z - zg0)*(z - zg0)/sig2)*B0g;
|
||||||
|
double Bxg = x*(z-zg0)/sig2*Bzg;
|
||||||
|
double Byg = y*(z-zg0)/sig2*Bzg;
|
||||||
|
|
||||||
|
// add all contributions
|
||||||
|
Bx += Bxg;
|
||||||
|
By += Byg;
|
||||||
|
Bz += Bzg + Bbg;
|
||||||
|
|
||||||
|
// transformation into cylinder vector
|
||||||
|
double Br = Bx*x/r + By*y/r;
|
||||||
|
double Bphi = By*x/r - Bx*y/r;
|
||||||
|
|
||||||
|
return CylinderVector(blitz::TinyVector<double, 3>(Br, Bphi, Bz));
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user