field in the P8 LFA scenario: Ioffe: infinite wire approximations Bottle: Gaussian profile in Bz
85 lines
2.8 KiB
C++
Executable File
85 lines
2.8 KiB
C++
Executable File
#ifndef VECTOR_FIELD_H
|
|
#define VECTOR_FIELD_H
|
|
|
|
#include <functional>
|
|
#include "blitz/array.h"
|
|
|
|
#include "simulation/coordinates.h"
|
|
#include "simulation/position_binning.h"
|
|
#include "constants/physical_constants.h"
|
|
|
|
class VectorField {
|
|
public:
|
|
virtual CylinderVector value(const Coordinate& coordinate) const = 0;
|
|
};
|
|
|
|
class VectorFieldFromArray : public VectorField {
|
|
public:
|
|
VectorFieldFromArray(const blitz::Array<double, 2>& radial_component,
|
|
const blitz::Array<double, 2>& azimuthal_component,
|
|
const blitz::Array<double, 2>& longitudial_component,
|
|
double radius,
|
|
double length);
|
|
|
|
CylinderVector value(const Coordinate& coordinate) const;
|
|
|
|
private:
|
|
// todo: make sure we use fast axis on z to reduce access time
|
|
const blitz::Array<double, 2> Fr_;
|
|
const blitz::Array<double, 2> Fphi_;
|
|
const blitz::Array<double, 2> Fz_;
|
|
|
|
CylinderBinning binning_;
|
|
CylinderVector value(const blitz::TinyVector<int, 2>& bin) const;
|
|
};
|
|
|
|
class VectorFieldConstant : public VectorField {
|
|
public:
|
|
VectorFieldConstant(const CylinderVector& constant);
|
|
CylinderVector value(const Coordinate& coordinate) const;
|
|
|
|
private:
|
|
const CylinderVector constant_;
|
|
};
|
|
|
|
class VectorFieldFunctionInZ : public VectorField {
|
|
public:
|
|
VectorFieldFunctionInZ(std::function<double(double, double, double)> v_z);
|
|
CylinderVector value(const Coordinate& coordinate) const;
|
|
|
|
private:
|
|
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 */
|