* *=== Cmemfl ===========================================================* * *----------------------------------------------------------------------* * * * Partial (all additions wrt the original one) * * Copyright (C) 2003-2019: CERN & INFN * * All Rights Reserved. * * * * CoMmon for ElectroMagnetic FieLds: * * * * Created on 16 January 1992 by Alfredo Ferrari in substitution of * * the old Magpar in order to include electric fields and crystal * * channeling * * * * Description of variables: * * Bifuni = strength of a possibly uniform magnetic field (Tesla)* * Umgfld = x-axis unit vector component of a possibly uniform * * magnetic field * * Vmgfld = y-axis unit vector component of a possibly uniform * * magnetic field * * Wmgfld = z-axis unit vector component of a possibly uniform * * magnetic field * * Elfuni = strength of a possibly uniform electric field (kV/cm)* * Uelfld = x-axis unit vector component of a possibly uniform * * electric field * * Velfld = y-axis unit vector component of a possibly uniform * * electric field * * Welfld = z-axis unit vector component of a possibly uniform * * electric field * * Bifcur = current strength of the magnetic field (Tesla) * * Umgcur = x-axis unit vector component of the current * * magnetic field * * Vmgcur = y-axis unit vector component of the current * * magnetic field * * Wmgcur = z-axis unit vector component of the current * * magnetic field * * Elfcur = strength of the current electric field (kV/cm) * * Uelcur = x-axis unit vector component of the current * * electric field * * Velcur = y-axis unit vector component of the current * * electric field * * Welcur = z-axis unit vector component of the current * * electric field * * Delfld = maximum tolerable error of the boundary iteration * * both for electric/magnetic transport (cm) * * Anglmg = biggest angle that particle is allowed to travel * * in the magnetic field (deg) * * Dstpmg = guarantees that step is not forced to be too small. * * (if suggested angle is too big, magnetic only) * * Rkrfra = max. fraction of a 2 pi angle allowed for a single * * Runge-Kutta step in magnetic field * * Dmgfrk = maximum step length with magnetic field if Runge- * * -Kutta integration is selected, used only in zones of* * zero local field * * Delfrk = maximum step length with electric field for Runge- * * -Kutta integration * * Denelf = energy gained or lost in the electric field * * Densra = energy lost by synchrotron radiation emission * * Fpbmax = factor by which to multiply Pmax in dp/dx tabulation.* * Lfmgel = flag for first time initialization * * Lrkuti = flag for selecting Runge-Kutta integration for an * * inhomogeneous magnetic field and no electric field * * Runge-Kutta is always selected if an electric field * * is present. * * Direct constant radius tracking is always selected * * only if an homogeneous magnetic field is present * * Lmgmap = flag for inhomogeneous magnetic field * * Lelmap = flag for inhomogeneous electric field * * Lmgfon(j,k) = flag for magnetic field presence for the j_th region * * for prompt (=1) or radioactive decay (=2) particles * * Lelfon(j,k) = flag for electric field presence for the j_th region * * for prompt (=1) or radioactive decay (=2) particles * * Icryon(j,k) = flag for crystal and channeling for the j_th region * * for prompt (=1) or radioactive decay (=2) particles * * If > 0 it is the index of the crystal corresponding * * to that region * *----------------------------------------------------------------------* * * LOGICAL LMGFON, LELFON, LFMGEL, LRKUTI, LMGFLD, LELFLD, LMGMAP, & LELMAP, LRKUTT COMMON / CMEMFL / BIFUNI, ELFUNI, BIFCUR, ELFCUR, UMGFLD, VMGFLD, & WMGFLD, UMGCUR, VMGCUR, WMGCUR, UELFLD, VELFLD, & WELFLD, UELCUR, VELCUR, WELCUR, DELFLD, ANGLMG, & DSTPMG, RKRFRA, DMGFRK, DELFRK, DEL000, ONMCTH, & ANGLRK, ONMCRK, DMINMN, DENELF, DENSRA, FPBMAX, & LFMGEL, LRKUTI, LMGFLD, LELFLD, LMGMAP, LELMAP, & LRKUTT, LMGFON (MXXRGN,2), LELFON (MXXRGN,2), & ICRYON (MXXRGN,2) SAVE / CMEMFL / *----------------------------------------------------------------------* * * * CoMmon for user defined MaGnetic FieLds: * * * * Description of variables: * * Mxflds = Maximum number of created fields allowed * * Mxrgns = Maximum number of magnatic field regions * * Nfldmg = Number of magnetic field types created * * Cnammg = Name of the magnetic field * * Itypmg = field main type * * Ixsmmg = input symmetry for X axis. If not than zero * * on entry apply symmetry and on exit select * * the appropriate field component: * * 1=Bx, 2=By, 3=Bz, 4=-Bx, 5=-By, 6=-Bz * * Iysmmg = input symmetry for Y axis. If not than zero * * Izsmmg = input symmetry for Z axis. If not than zero * * R2comg = maximum radius^2 of core field * * Xcormg = X origin of core field * * Ycormg = Y origin of core field * * Cosmg = Cosine of azimuth angle of field (wrt to +Y) * * Sinmg = Sine of azimuth angle of field (wrt to +Y) * * Rbndmg = bend radius of dipolar fields * * Sagtmg = sagitta (valid in case of a non-zero bend radius) * * Uuumg = U direction of constnat field * * Vvvmg = V direction of constnat field * * Wwwmg = W direction of constnat field * * Nxmg = X Number of nodes in grid * * Nymg = Y Number of nodes in grid * * Nzmg = Z Number of nodes in grid * * Ixptmg = X index pointer in blank common * * Iyptmg = Y index pointer in blank common * * Izptmg = Z index pointer in blank common * * Inptmg = number of nodes set with DATA for consistency * * checking it should be equal to Nxmg*Nymg*Nzmg * * * * Iregmg = index of field type on region * * Krttmg = rotation type there to be applied * * 0=region, 1=lattice-prototype, 2=lattice-replica * * Irotmg = rotation matrix for the field * * * * FIXME BNV what counting should I use for the user? * * Field Types numbering??? * * Constant 1 * * Dipolar 2 * * Quad 4 * * Sex 6 * * Octu 8 * * Deca 10 * * Int-RZ 100 * * Int-2D 200 * * Int-2D+Analytic 202..210 * * Int-3D 300 * * Int-3D+Analytic 302..310 * *----------------------------------------------------------------------* * PARAMETER (NMGCONST = 1) ! Constant/directional field PARAMETER (NMGDIPOLE = 2) ! Dipole constant direction field PARAMETER (NMGQUAD = 4) ! Quadrupole field PARAMETER (NMGSEX = 6) ! Sextupole field PARAMETER (NMGOCTU = 8) ! Octupole field PARAMETER (NMGDECA = 10) ! Decapole field PARAMETER (NMGINTRZ = 100) ! Interpolated RZ field PARAMETER (NMGINT2D = 200) ! Interpolated 2D field PARAMETER (NMGINT3D = 300) ! Interpolated 3D field PARAMETER (MXFLDS = 128) * FIXME WARNING reorder elements for correct padding COMMON /CMGFLD/ CNAMMG(MXFLDS), ITYPMG(MXFLDS), + R2COMG(MXFLDS), XCORMG(MXFLDS), YCORMG(MXFLDS), + RBNDMG(MXFLDS), SAGTMG(MXFLDS), + SINMG(MXFLDS), COSMG(MXFLDS), + UUUMG(MXFLDS), VVVMG(MXFLDS), WWWMG(MXFLDS), + IXSMMG(MXFLDS), IYSMMG(MXFLDS), IZSMMG(MXFLDS), + NXMG(MXFLDS), NYMG(MXFLDS), NZMG(MXFLDS), + XMINMG(MXFLDS), YMINMG(MXFLDS), ZMINMG(MXFLDS), + XMAXMG(MXFLDS), YMAXMG(MXFLDS), ZMAXMG(MXFLDS), + XSTPMG(MXFLDS), YSTPMG(MXFLDS), ZSTPMG(MXFLDS), + IXPTMG(MXFLDS), IYPTMG(MXFLDS), IZPTMG(MXFLDS), + INPTMG(MXFLDS), * Region field properties & IREGMG(MXXRGN), KRTTMG(MXXRGN), FREGMG(MXXRGN), & IROTMG(MXXRGN), * counters + NFLDMG CHARACTER*10 CNAMMG