program test use ModAMIE use ModData ! Remove at some point::: use ModFiles use ModIndices use ModConductance use ModEField implicit none include "mpif90.h" !\ ! Time Stuff !/ integer, dimension(7) :: itime integer, external :: jday integer :: year, month, day, hour, minute, second, julianday !\ ! Timing Stuff !/ real*8 :: code_start_time, code_end_time !\ ! Array Indices !/ integer :: n, i, j, ifile real :: rtime real :: glat, glon, a, alat, alon, bmag, xmag, ymag, zmag, v logical :: GetMoreData !\ ! Initalize and start up MPI. !/ call MPI_INIT(ira) call MPI_COMM_RANK(MPI_COMM_WORLD, me_world, ira) call MPI_COMM_SIZE(MPI_COMM_WORLD, numprocs, ira) code_start_time = mpi_wtime() if (DebugLevel > 1) & write(*,*) " ==> Going into read_inputs, me:",me_world call read_inputs if (DebugLevel > 1) & write(*,*) " ==> Going into initialize_amie, me:",me_world call initialize_amie if (DebugLevel > 1) & write(*,*) " ==> Going into read_cond_model_coef, me:",me_world call read_cond_model_coef if (DebugLevel > 1) & write(*,*) " ==> Going into read_efield_model_coef, me:",me_world call read_efield_model_coef if (DebugLevel > -1) write(*,*) "Reading Data" if (Use_Magnetometers) then if (DebugLevel > 1) & write(*,*) " ==> Going into read_psi_file, me:",me_world call read_psi_file if (DebugLevel > 1) & write(*,*) " ==> Going into read_magnetometers, me:",me_world call read_magnetometers endif ! if (nefield_files > 0) then ! ! if (DebugLevel > 1) & ! write(*,*) " ==> Going into read_efields, me:",me_world ! ! call read_efields ! ! endif if (ncurrent_files > 0) then if (DebugLevel > 1) & write(*,*) " ==> Going into read_currents, me:",me_world call read_currents endif do iteration_number = 1, ntimes !\ ! Set up time !/ if (timelist(iteration_number) > -1.0e32) & currenttime = timelist(iteration_number) if (DebugLevel > 2) write(*,*) '===> currenttime from amie.f90:',currenttime 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) julianday = jday(year, month, day) rtime = float(year) + float(julianday)/jday(year,12,31) ut = hour + float(minute)/60.0 + float(second)/3600.0 !\ ! Find subsolar stuff !/ call find_subsolar_info(year,julianday,hour,minute,second) if (DebugLevel >= 0) & write(*,"(a,i3,a,i5,5i3)") & 'Computing time ( me =',me_world,") :",itime(1:6) if (ncond_files > 0) then if (DebugLevel > 1) & write(*,*) " ==> Going into read_conductances, me:",me_world call read_conductances endif if (nefield_files > 0) then ! GetMoreData = .false. ! ! do ifile = 1, nefield_files ! if (npts_efield(ifile) == Max_Data + 1 .and. & ! currenttime-window_dt > EfieldTimes(ifile, Max_Data-1)) & ! GetMoreData = .true. ! enddo ! ! if (GetMoreData) then if (DebugLevel > 1) & write(*,*) " ==> Going into read_efields, me:",me_world call read_efields ! endif endif do j = 1, nmagnetometers call magloctm(mglon(j), subsolar_lat, subsolar_lon, & pole_colat, pole_east_lon, amltmg(j)) enddo if (OutputData) then write(lun_dataoutput, "(a)") "" write(lun_dataoutput, "(a5)") "#TIME" write(lun_dataoutput, "(7i5)") itime endif !\ ! Get background Models !/ if (DebugLevel > 1) & write(*,*) " ==> Going into calc_background_conductivity, me:",& me_world call calc_background_conductivity if (DebugLevel > 1) & write(*,*) " ==> Going into calc_background_efield, me:",me_world call calc_background_efield !\ ! Solve for Aurora !/ if (DebugLevel > 1) & write(*,*) " ==> Going into ahn, me:",me_world call ahn if (DebugLevel > 1) & write(*,*) " ==> Going into Conductance_Cu_set, me:",me_world call Conductance_Cu_set if (DebugLevel > 0) & write(*,*) " => Going into Solve_for_Aurora, me:",me_world call Solve_for_Aurora !\ ! Solve for Electric field !/ if (DebugLevel > 1) & write(*,*) " ==> Going into EField_Cu_set, me:",me_world call EField_Cu_set if (DebugLevel > 0) & write(*,*) " => Going into Solve_for_EField, me:",me_world call Solve_for_EField !\ ! Output results !/ if (DebugLevel > 1) & write(*,*) " ==> Going into output, me:",me_world call output if (timelist(iteration_number) == -1.0e32) currenttime = currenttime + dt enddo if (IsOutputBinary) then write(LunMainOutput) Version else write(LunMainOutput,*) Version endif close(LunMainOutput) if (OutputData) close(lun_dataoutput) code_end_time = mpi_wtime() - code_start_time if (DebugLevel > -1) then write(*,"(a,f7.1,a,i4)") & "AMIE took ",code_end_time," seconds to complete, me:",me_world endif call MPI_BARRIER(MPI_COMM_WORLD,ira) ! ----------- BARRIER ------ call MPI_finalize(ira) end program test