subroutine Lorentz_init() use mod_global_parameters integer :: idir, nwx if(physics_type/='mhd') call mpistop(& "Lorentz particles need magnetic field!") if(ndir/=3) call mpistop("Lorentz particles need ndir=3!") ! The first 6 gridvars are always B and E ngridvars = ndir*2 nwx=0 ! density if(particles_etah>0) nwx = 1 allocate(bp(ndir)) do idir = 1, ndir nwx = nwx + 1 bp(idir) = nwx end do allocate(ep(ndir)) ! electric field do idir = 1, ndir nwx = nwx + 1 ep(idir) = nwx end do allocate(vp(ndir)) ! fluid velocity do idir = 1, ndir nwx = nwx + 1 vp(idir) = nwx end do allocate(jp(ndir)) ! current do idir = 1, ndir nwx = nwx + 1 jp(idir) = nwx end do nwx = nwx + 1 ! density rhop = nwx ngridvars=nwx particles_fill_gridvars => lorentz_fill_gridvars if (associated(particles_define_additional_gridvars)) then call particles_define_additional_gridvars(ngridvars) end if select case(integrator_type_particles) case('Boris','boris') integrator = Boris case('Vay','vay') integrator = Vay case('HC','hc','higueracary') integrator = HC case('LM','lm','lapentamarkidis') integrator = LM case default integrator = Boris end select particles_integrate => Lorentz_integrate_particles end subroutine Lorentz_init