Initialize the module GLM MHD uses split source addition in psi:
subroutine phys_init() use mod_global_parameters use mod_radiative_cooling, only: rc_fl, radiative_cooling_init_params, radiative_cooling_init integer :: idir, idum call read_params(par_files) call phys_units() phys_energy = mhd_energy phys_total_energy = mhd_energy phys_internal_e = .false. phys_gamma = mhd_gamma phys_partial_ionization=mhd_partial_ionization need_global_cmax=.true. gamma_1=mhd_gamma-1.0_dp inv_gamma_1=1.0_dp/gamma_1 use_particles = mhd_particles ! Determine flux variables rho_ = var_set_rho() allocate(mom(ndir)) mom(:) = var_set_momentum(ndir) ! Set index of energy variable if (mhd_energy) then e_ = var_set_energy() p_ = e_ else e_ = -1 p_ = -1 end if ! Set index for heat flux variable(s) allocate(q_(ndir)) q_ = var_set_qvec(ndir, need_bc=.false.) allocate(mag(ndir)) mag(:) = var_set_bfield(ndir) psi_ = var_set_fluxvar('psi', 'psi', need_bc=.false.) !> GLM MHD uses split source addition in psi: any_source_split = .true. ! Whether diagonal ghost cells are required for the physics phys_req_diagonal = .true. ! Register tracer fields tracer(1) = var_set_fluxvar("trc", "trp", 1, need_bc=.false.) ! set number of variables which need update ghostcells nwgc=nwflux ! Define custom flux types: if (.not. allocated(flux_type)) then allocate(flux_type(ndir, nw_flux)) flux_type = flux_default else if (any(shape(flux_type) /= [ndir, nw_flux])) then call mpistop("phys_check error: flux_type has wrong shape") end if ! BnormLF fix: flux_type(:,psi_)=flux_tvdlf do idir=1,ndir flux_type(idir,mag(idir))=flux_tvdlf end do nvector = 2 ! No. vector vars allocate(iw_vector(nvector)) iw_vector(1) = mom(1) - 1 iw_vector(2) = mag(1) - 1 ! use cycle, needs to be dealt with: ! ! Initialize particles module ! if (mhd_particles) then ! call particles_init() ! phys_req_diagonal = .true. ! end if call radiative_cooling_init_params(phys_gamma,He_abundance) call radiative_cooling_init(rc_fl) end subroutine phys_init