#ifndef VECTOR_FIELD_H #define VECTOR_FIELD_H #include #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& radial_component, const blitz::Array& azimuthal_component, const blitz::Array& 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 Fr_; const blitz::Array Fphi_; const blitz::Array Fz_; CylinderBinning binning_; CylinderVector value(const blitz::TinyVector& 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 v_z); CylinderVector value(const Coordinate& coordinate) const; private: std::function 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 cosktheta{128}; blitz::Array 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 */