subroutine read_efield_model_coef use ModAMIE use ModFiles use ModEField implicit none integer :: ierr Efield_BGModel = 0.0 if (index(efield_model,'weimer96') > 0) then call merge_str(models_dir, weimer96_file) open(lun_efield,file=weimer96_file,status='old', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',weimer96_file call stop_mpi("error!") endif call ReadCoef96(lun_efield) endif if (index(efield_model,'weimer01') > 0) then call merge_str(models_dir, weimer01_file) open(lun_efield,file=weimer01_file,status='old',& form='unformatted', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',weimer01_file call stop_mpi("error!") endif call ReadCoef01(lun_efield) endif if (index(efield_model,'samie') > 0) then call merge_str(models_dir, stat_amie_file) open(lun_efield,file=stat_amie_file,status='old', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',stat_amie_file call stop_mpi("error!") endif call read_amies(lun_efield) close(lun_efield) endif if (index(efield_model,'millstone_hpi') > 0) then call merge_str(models_dir, millstone_hill_i_file) open(lun_efield,file=millstone_hill_i_file,status='old', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',millstone_hill_i_file call stop_mpi("error!") endif call mhinit(1, lun_efield, 1, DebugLevel) endif if (index(efield_model,'millstone_imf') > 0) then call merge_str(models_dir, millstone_hill_s_file) open(lun_efield,file=millstone_hill_s_file,status='old', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',millstone_hill_s_file call stop_mpi("error!") endif call mhinit(2, lun_efield, 1, DebugLevel) endif if (index(efield_model,'hmr89') > 0) then call merge_str(models_dir, hepner_maynard_file) open(lun_efield,file=hepner_maynard_file,status='old', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',hepner_maynard_file call stop_mpi("error!") endif call gethmr(lun_efield) endif if (index(efield_model,'izmem') > 0) then call merge_str(models_dir, izmem_file) open(lun_efield,file=izmem_file,status='old', iostat = ierr) if (ierr /= 0) then write(6,*) 'Error opening file :',izmem_file call stop_mpi("error!") endif call izinit(lun_efield) endif end subroutine read_efield_model_coef subroutine calc_background_efield use ModAMIE use ModIndices use ModEField implicit none integer :: i,j,n, ifirst real :: alatd, ETheta, EPhi, Potential, mini, maxi integer, dimension(7) :: itime integer :: year, month, day, hour, minute, second logical :: useal !useal = logical (T or F) to use AL index or not call time_real_to_int(currenttime, itime) year = itime(1) month = itime(2) day = itime(3) hour = itime(4) minute = itime(5) second = itime(6) n = iteration_number ifirst = 1 mini = 1.0e10 maxi = -mini if (DebugLevel > 1) & write(*,*) 'IMF Parameters (me=',me_world,'), v,by,bz :', & Indices(n,sw_v_), Indices(n,imf_by_),Indices(n,imf_bz_) if (Indices(n,sw_v_) <= 50.) Indices(n,sw_v_) = 440. if (Indices(n,sw_n_) <= 1.) Indices(n,sw_n_) = 1.0 if (DebugLevel > 1) & write(*,*) ' ==> Reading E-field model of ',efield_model do i = 0, ithmx alatd = 90.0 - clatd(i) do j = 1, lonmx if (index(efield_model,'weimer96') > 0) then call WEIEPOT96(year,month,day,hour,minute,Indices(n,sw_v_), & Indices(n,imf_by_),Indices(n,imf_bz_),ihsoln,ifirst, & alatd,mlt(j), ETheta, EPhi, Potential) endif if (index(efield_model,'weimer01') > 0) then useal = .false. call WEIEPOT01(year,month,day,hour,minute,Indices(n,sw_v_), & Indices(n,sw_n_),Indices(n,imf_by_),Indices(n,imf_bz_), & Indices(n,al_),useal,ihsoln,ifirst, & alatd,mlt(j), ETheta, EPhi, Potential) endif if (index(efield_model,'samie') > 0) then call amiespot (Indices(n,imf_by_),Indices(n,imf_bz_),alatd,mlt(j),& ETheta, EPhi, Potential) endif if (index(efield_model,'dt') > 0) then call amiedt (i,j,iteration_number,ETheta, EPhi, Potential) endif if (index(efield_model,'millstone_hpi') > 0) then call MHEMODL(alatd,mlt(j),Indices(n,hpi_),Indices(n,imf_by_), & Indices(n,imf_bz_),1,ETheta, EPhi, Potential) endif if (index(efield_model,'millstone_imf') > 0) then call MHEMODL(alatd,mlt(j),Indices(n,hpi_),Indices(n,imf_by_), & Indices(n,imf_bz_),2,ETheta, EPhi, Potential) endif if (index(efield_model,'hmr89') > 0) then call HMREPOT(alatd,mlt(j),Indices(n,imf_by_),Indices(n,imf_bz_), & Indices(n,kp_),ifirst,ETheta, EPhi, Potential) endif if (index(efield_model,'izmem') > 0) then call IZEPOT(month,alatd,mlt(j),Indices(n,imf_by_), & Indices(n,imf_bz_),ETheta, EPhi, Potential) endif if (index(efield_model,'zero') > 0) then ETheta = 0. EPhi = 0. Potential = 0. endif ifirst = ifirst + 1 if (Potential < mini) mini = Potential if (Potential > maxi) maxi = Potential Efield_BGModel(j,i,potential_) = Potential Efield_BGModel(j,i,efield_east_) = EPhi Efield_BGModel(j,i,efield_north_) = -ETheta Efield_BGModel(j,i,efield_magnitude_) = & SQRT(ETheta*ETheta + EPhi*EPhi) * 1.E3 enddo enddo Efield_BGModel(0,:,potential_) = & Efield_BGModel(lonmx,:,potential_) Efield_BGModel(0,:,efield_east_) = & Efield_BGModel(lonmx,:,efield_east_) Efield_BGModel(0,:,efield_north_) = & Efield_BGModel(lonmx,:,efield_north_) Efield_BGModel(0,:,efield_magnitude_) = & Efield_BGModel(lonmx,:,efield_magnitude_) if (DebugLevel > 1) & write(*,*) ' ==> CPCP of background ( me =',me_world,') : ', maxi-mini end subroutine calc_background_efield