advance.F: | ctpoten_time,ntimes_power,power_time,potential_model,iamie, advance.F: | iamie_bkg,ilow_proton advance.F: use amie_module,only: getamie,tiepot advance.F:! Get AMIE data advance.F: if (iamie==1) then advance.F: if (iprint>0) write(6,"('advance calling getamie...')") advance.F: call getamie(iyear,iday,int(secs),iamie_bkg,iprint) advance.F:! If an amie run, ignore potential_model, and use electric potential from advance.F:! amie module. advance.F: if (iamie <= 0) then advance.F:! If an amie run, use tiepot from amie.F: advance.F:! write(6,"('advance: amie phihm min,max=',2e12.4)") fmin,fmax amie.F: module amie_module amie.F:! Module used to read data from the AMIE outputs (POT,mean energy, amie.F:! Define parameters for AMIE input data file: amie.F: | mxgdays = 10, ! maximum number of days of AMIE data amie.F: | mxtimes = 1441, ! maximum number of times of AMIE data per day amie.F: | ithmx = 55, ! maximum number of latitudes of AMIE data amie.F: | lonmx = 36 ! maximum number of longitudes of AMIE data amie.F:! Define AMIE output fields amie.F:! defined output AMIE fields in TGCM geographic grid amie.F:! Define fields for AMIE input data file: amie.F:! amie_cusplat_nh(sh) and amie_cuspmlt_nh(sh) are amie.F:! AMIE cusp latitude and MLT in NH and SH amie.F:! amie_hpi_nh(sh) are AMIE hemi-integrated power amie.F:! amie_pcp_nh(sh) are AMIE polar-cap potential drop amie.F:! Saved AMIE outputs with suffix _amie amie.F: | amie_pot_nh, amie_pot_sh, amie_ekv_nh, amie_ekv_sh, amie.F: | amie_efx_nh, amie_efx_sh amie.F: | pot_nh_amie,pot_sh_amie, ekv_nh_amie,ekv_sh_amie, amie.F: | efx_nh_amie,efx_sh_amie amie.F: | amie_cusplat_nh, amie_cuspmlt_nh, amie_hpi_nh, amie.F: | amie_pcp_nh, amie_nh_ut, amie.F: | amie_cusplat_sh, amie_cuspmlt_sh, amie_hpi_sh, amie.F: | amie_pcp_sh, amie_sh_ut amie.F: | cusplat_nh_amie, cuspmlt_nh_amie, cusplat_sh_amie, amie.F: | cuspmlt_sh_amie, hpi_sh_amie, hpi_nh_amie, pcp_sh_amie, amie.F: | pcp_nh_amie, crad(2), phida(2) amie.F: subroutine rdamie_nh amie.F:! Read AMIE data for the northern hemisphere from amienh amie.F: use input_module,only: tempdir,amienh amie.F: call mkdiskflnm(amienh,dskfile) amie.F: call getms(amienh,dskfile,tempdir,' ') amie.F: write(6,"('RDAMIE_NH: read AMIE data for northern hemisphere:')") amie.F: write(6,"(/,'>>> rdamie_nh: error opening netcdf NH AMIE data ', amie.F: stop 'rdamie_nh' amie.F: write(6,"('rdamie_nh: opened file ',a)") trim(dskfile) amie.F:! Get AMIE grid dimension: amie.F: | 'rdamie_nh: Error getting AMIE longitude dimension') amie.F: | 'rdamie_nh: Error getting AMIE latitude dimension') amie.F: | 'rdamie_nh: Error getting time dimension') amie.F:! write(6,"('rdamie_nh: ntimes=',i3)") ntimes amie.F:! Search for requested AMIE output fields amie.F:! Get 1-D AMIE fields (ntimes) amie.F:! | amie_cusplat_nh, amie_cuspmlt_nh, amie_hpi_nh, amie.F:! | amie_pcp_nh, amie_nh_ut, amie.F: if (.not. allocated(amie_nh_ut)) amie.F: | allocate(amie_nh_ut(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_nh_ut: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_cusplat_nh)) amie.F: | allocate(amie_cusplat_nh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_cusplat_nh: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_cuspmlt_nh)) amie.F: | allocate(amie_cuspmlt_nh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_cuspmlt_nh: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_hpi_nh)) amie.F: | allocate(amie_hpi_nh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_hpi_nh: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_pcp_nh)) amie.F: | allocate(amie_pcp_nh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_pcp_nh: ntimes=',i3)")ntimes amie.F: | 'rdamie_nh: Error getting NH AMIE UT id') amie.F: istat = nf_get_var_double(ncid,idv_ut,amie_nh_ut) amie.F: | 'rdamie_nh: Error getting NH AMIE variable ut') amie.F: | 'rdamie_nh: Error getting NH AMIE hpi id') amie.F: istat = nf_get_var_double(ncid,idv_hpi,amie_hpi_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable hpi') amie.F: | 'rdamie_nh: Error getting NH AMIE pcp id') amie.F: istat = nf_get_var_double(ncid,idv_pcp,amie_pcp_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable pcp') amie.F: | 'rdamie_nh: Error getting NH AMIE cusplat id') amie.F: istat = nf_get_var_double(ncid,idv_cusplat,amie_cusplat_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable cusplat') amie.F: | 'rdamie_nh: Error getting NH AMIE cusplat id') amie.F: istat = nf_get_var_double(ncid,idv_cuspmlt,amie_cuspmlt_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable cuspmlt') amie.F:! | pot_nh_amie, ekv_nh_amie, efx_nh_amie amie.F: if (.not. allocated(pot_nh_amie)) amie.F: | allocate(pot_nh_amie(lonp1,latp1),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' pot_nh_amie: lonp1=',i3,' latp1=',i3)")lonp1,latp1 amie.F: if (.not. allocated(ekv_nh_amie)) amie.F: | allocate(ekv_nh_amie(lonp1,latp1),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' ekv_nh_amie: lonp1=',i3,' latp1=',i3)")lonp1,latp1 amie.F: if (.not. allocated(efx_nh_amie)) amie.F: | allocate(efx_nh_amie(lonp1,latp1),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' efx_nh_amie: lonp1=',i3,' latp1=',i3)")lonp1,latp1 amie.F:! | amie_pot_nh, amie_pot_sh, amie_ekv_nh, amie_ekv_sh, amie.F:! | amie_efx_nh, amie_efx_sh amie.F: if (.not. allocated(amie_pot_nh)) amie.F: | allocate(amie_pot_nh(lonp1,latp1,ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_pot_nh: lonp1=',i3,' latp1=',i3,' ntimes=',i3)") amie.F: if (.not. allocated(amie_ekv_nh)) amie.F: | allocate(amie_ekv_nh(lonp1,latp1,ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_ekv_nh: lonp1=',i3,' latp1=',i3,' ntimes=',i3)") amie.F: if (.not. allocated(amie_efx_nh)) amie.F: | allocate(amie_efx_nh(lonp1,latp1,ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', amie.F: | ' amie_efx_nh: lonp1=',i3,' latp1=',i3,' ntimes=',i3)") amie.F:! Get 3-D AMIE fields (lon,lat,ntimes) amie.F:! AMIE electric potential amie.F: | 'rdamie_nh: Error getting NH AMIE electric potential id') amie.F: istat = nf_get_var_double(ncid,idv_pot,amie_pot_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable pot') amie.F:! AMIE mean energy amie.F: | 'rdamie_nh: Error getting NH AMIE mean energy id') amie.F: istat = nf_get_var_double(ncid,idv_ekv,amie_ekv_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable ekv') amie.F:! AMIE energy flux amie.F: | 'rdamie_nh: Error getting NH AMIE energy flux id') amie.F: istat = nf_get_var_double(ncid,idv_efx,amie_efx_nh) amie.F: | 'rdamie_nh: Error getting NH AMIE variable efx') amie.F: write(6,"('Completed read from NH AMIE data file ',a)") amie.F: end subroutine rdamie_nh amie.F: subroutine rdamie_sh amie.F:! Read AMIE data for the southern hemisphere from amiesh amie.F: use input_module,only: tempdir,amiesh amie.F: call mkdiskflnm(amiesh,dskfile) amie.F: call getms(amiesh,dskfile,tempdir,' ') amie.F: write(6,"('RDAMIE_SH: read AMIE data for southern hemisphere:')") amie.F: write(6,"(/,'>>> rdamie_nh: error opening netcdf SH AMIE data ', amie.F: stop 'rdamie_sh' amie.F:! Get AMIE grid dimension: amie.F: | 'rdamie_sh: Error getting AMIE longitude dimension') amie.F: | 'rdamie_sh: Error getting AMIE latitude dimension') amie.F: | 'rdamie_sh: Error getting time dimension') amie.F:! Search for requested AMIE output fields amie.F:! Get 1-D AMIE fields (ntimes) amie.F:! | amie_cusplat_sh, amie_cuspmlt_sh, amie_hpi_sh, amie.F:! | amie_pcp_sh, amie_sh_ut, amie.F: if (.not. allocated(amie_sh_ut)) amie.F: | allocate(amie_sh_ut(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_sh_ut: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_cusplat_sh)) amie.F: | allocate(amie_cusplat_sh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_cusplat_sh: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_cuspmlt_sh)) amie.F: | allocate(amie_cuspmlt_sh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_cuspmlt_sh: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_hpi_sh)) amie.F: | allocate(amie_hpi_sh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_hpi_sh: ntimes=',i3)")ntimes amie.F: if (.not. allocated(amie_pcp_sh)) amie.F: | allocate(amie_pcp_sh(ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_pcp_sh: ntimes=',i3)")ntimes amie.F: | 'rdamie_sh: Error getting SH AMIE UT id') amie.F: istat = nf_get_var_double(ncid,idv_ut,amie_sh_ut) amie.F: | 'rdamie_sh: Error getting SH AMIE variable ut') amie.F: | 'rdamie_sh: Error getting SH AMIE hpi id') amie.F: istat = nf_get_var_double(ncid,idv_hpi,amie_hpi_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable hpi') amie.F: | 'rdamie_sh: Error getting SH AMIE pcp id') amie.F: istat = nf_get_var_double(ncid,idv_pcp,amie_pcp_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable hpi') amie.F: | 'rdamie_sh: Error getting SH AMIE cusplat id') amie.F: istat = nf_get_var_double(ncid,idv_cusplat,amie_cusplat_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable cusplat') amie.F: | 'rdamie_sh: Error getting SH AMIE cusplat id') amie.F: istat = nf_get_var_double(ncid,idv_cuspmlt,amie_cuspmlt_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable cuspmlt') amie.F:! | pot_sh_amie, ekv_sh_amie, efx_sh_amie amie.F: if (.not. allocated(pot_sh_amie)) amie.F: | allocate(pot_sh_amie(lonp1,latp1),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' pot_sh_amie: lonp1=',i3,' latp1=',i3)")lonp1,latp1 amie.F: if (.not. allocated(ekv_sh_amie)) amie.F: | allocate(ekv_sh_amie(lonp1,latp1),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' ekv_sh_amie: lonp1=',i3,' latp1=',i3)")lonp1,latp1 amie.F: if (.not. allocated(efx_sh_amie)) amie.F: | allocate(efx_sh_amie(lonp1,latp1),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' efx_sh_amie: lonp1=',i3,' latp1=',i3)")lonp1,latp1 amie.F:! | amie_pot_nh, amie_pot_sh, amie_ekv_nh, amie_ekv_sh, amie.F:! | amie_efx_nh, amie_efx_sh amie.F: if (.not. allocated(amie_pot_sh)) amie.F: | allocate(amie_pot_sh(lonp1,latp1,ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_pot_nh: lonp1=',i3,' latp1=',i3,' ntimes=',i3)") amie.F: if (.not. allocated(amie_ekv_sh)) amie.F: | allocate(amie_ekv_sh(lonp1,latp1,ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_ekv_nh: lonp1=',i3,' latp1=',i3,' ntimes=',i3)") amie.F: if (.not. allocated(amie_efx_sh)) amie.F: | allocate(amie_efx_sh(lonp1,latp1,ntimes),stat=ier) amie.F: if (ier /= 0) write(6,"('>>> rdamie_sh: error allocating', amie.F: | ' amie_efx_nh: lonp1=',i3,' latp1=',i3,' ntimes=',i3)") amie.F:! Get 3-D AMIE fields (lon,lat,ntimes) amie.F:! AMIE electric potential amie.F: | 'rdamie_sh: Error getting SH AMIE electric potential id') amie.F: istat = nf_get_var_double(ncid,idv_pot,amie_pot_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable pot') amie.F:! AMIE mean energy amie.F: | 'rdamie_sh: Error getting SH AMIE mean energy id') amie.F: istat = nf_get_var_double(ncid,idv_ekv,amie_ekv_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable ekv') amie.F:! AMIE energy flux amie.F: | 'rdamie_sh: Error getting SH AMIE energy flux id') amie.F: istat = nf_get_var_double(ncid,idv_efx,amie_efx_sh) amie.F: | 'rdamie_sh: Error getting SH AMIE variable efx') amie.F: write(6,"('Completed read from SH AMIE data file ',a)") amie.F: end subroutine rdamie_sh amie.F: subroutine getamie(iyear,iday,iutsec,amie_ibkg,iprint) amie.F:! Read AMIE outputs from amie_ncfile file, returning electric potential, amie.F: use input_module,only: amiesh,amienh amie.F: integer,intent(in) :: iyear,iday,iutsec,amie_ibkg,iprint amie.F: integer :: nn, iset, iset1, m, mp1, n, amie_debug,amieday amie.F: write(6,"('GETAMIE:')") amie.F: write(6,"('>>> getamie: wrong year,iyear=',2i4)") amie.F: stop 'getamie' amie.F: amieday = jday(1) amie.F: if (amie_ibkg > 0) amieday = jday(1) - 1 amie.F:! if (amieday /= iday .and. amie_ibkg == 0) then amie.F:! write(6,"('>>> getamie: wrong amieday,modelday=',2i4)") amie.F:! | amieday,iday amie.F:! stop 'getamie' amie.F: write(6,"('>>> getamie: bad imin=',3i4)") modeltime(3) amie.F: stop 'getamie' amie.F: write(6,"('>>> getamie: bad isec=',3i4)") modeltime(4) amie.F: stop 'getamie' amie.F: model_ut = (modeltime(1)-amieday)*24. + float(iutsec)/3600. amie.F:! Interpolate AMIE data to modeltime iutsec amie.F:! amie_ibkg = 0 use real UT AMIE data amie.F:! = 1 use the first AMIE volumne as the background amie.F:! = 2 use the 24-hr average AMIE volumne as the background amie.F: pot_sh_amie(:,:) = 0. amie.F: ekv_sh_amie(:,:) = 0. amie.F: efx_sh_amie(:,:) = 0. amie.F: cusplat_sh_amie = 0. amie.F: cuspmlt_sh_amie = 0. amie.F: hpi_sh_amie = 0. amie.F: pcp_sh_amie = 0. amie.F: n = len_trim(amiesh) amie.F:! write(6,"('getamie: Interpolate AMIE SH Data n=',i3)")n amie.F: nn = size(amie_sh_ut) amie.F: if (amie_ibkg == 0) then amie.F: if (amie_sh_ut(i) < model_ut) iset = i amie.F: denoma = amie_sh_ut(iset1) - amie_sh_ut(iset) amie.F: f1 = (amie_sh_ut(iset1) - model_ut)/denoma amie.F: f2 = (model_ut - amie_sh_ut(iset))/denoma amie.F: cusplat_sh_amie = (f1*amie_cusplat_sh(iset1) + amie.F: | f2*amie_cusplat_sh(iset)) amie.F: cuspmlt_sh_amie = (f1*amie_cuspmlt_sh(iset1) + amie.F: | f2*amie_cuspmlt_sh(iset)) amie.F: hpi_sh_amie = (f1*amie_hpi_sh(iset1) + f2*amie_hpi_sh(iset)) amie.F: pcp_sh_amie = (f1*amie_pcp_sh(iset1) + f2*amie_pcp_sh(iset)) amie.F: pot_sh_amie(:,:) = (f1*amie_pot_sh(:,:,iset1) + amie.F: | f2*amie_pot_sh(:,:,iset)) amie.F: ekv_sh_amie(:,:) = (f1*amie_ekv_sh(:,:,iset1) + amie.F: | f2*amie_ekv_sh(:,:,iset)) amie.F: efx_sh_amie(:,:) = (f1*amie_efx_sh(:,:,iset1) + amie.F: | f2*amie_efx_sh(:,:,iset)) amie.F: call boxcar_ave(amie_pot_sh,pot_sh_amie,lonp1,latp1, amie.F: call boxcar_ave(amie_efx_sh,efx_sh_amie,lonp1,latp1, amie.F: call boxcar_ave(amie_ekv_sh,ekv_sh_amie,lonp1,latp1, amie.F: if (amie_ibkg == 1) then amie.F: pot_sh_amie(:,:) = amie_pot_sh(:,:,1) amie.F: ekv_sh_amie(:,:) = amie_ekv_sh(:,:,1) amie.F: efx_sh_amie(:,:) = amie_efx_sh(:,:,1) amie.F: cusplat_sh_amie = amie_cusplat_sh(1) amie.F: cuspmlt_sh_amie = amie_cuspmlt_sh(1) amie.F: hpi_sh_amie = amie_hpi_sh(1) amie.F: pcp_sh_amie = amie_pcp_sh(1) amie.F: pot_sh_amie(:,:) = pot_sh_amie(:,:) + amie_pot_sh(:,:,1) amie.F: ekv_sh_amie(:,:) = ekv_sh_amie(:,:) + amie_ekv_sh(:,:,1) amie.F: efx_sh_amie(:,:) = efx_sh_amie(:,:) + amie_efx_sh(:,:,1) amie.F: cusplat_sh_amie = cusplat_sh_amie + amie_cusplat_sh(1) amie.F: cuspmlt_sh_amie = cuspmlt_sh_amie + amie_cuspmlt_sh(1) amie.F: hpi_sh_amie = hpi_sh_amie + amie_hpi_sh(1) amie.F: pcp_sh_amie = pcp_sh_amie + amie_pcp_sh(1) amie.F: pot_sh_amie(:,:) = pot_sh_amie(:,:)/nn amie.F: ekv_sh_amie(:,:) = ekv_sh_amie(:,:)/nn amie.F: efx_sh_amie(:,:) = efx_sh_amie(:,:)/nn amie.F: cusplat_sh_amie = cusplat_sh_amie/nn amie.F: cuspmlt_sh_amie = cuspmlt_sh_amie/nn amie.F: hpi_sh_amie = hpi_sh_amie/nn amie.F: pcp_sh_amie = pcp_sh_amie/nn amie.F:! get NH AMIE data amie.F: pot_nh_amie(:,:) = 0. amie.F: ekv_nh_amie(:,:) = 0. amie.F: efx_nh_amie(:,:) = 0. amie.F: cusplat_nh_amie = 0. amie.F: cuspmlt_nh_amie = 0. amie.F: hpi_nh_amie = 0. amie.F: pcp_nh_amie = 0. amie.F: n = len_trim(amienh) amie.F: nn = size(amie_nh_ut) amie.F:! write(6,"('getamie: Interpolate AMIE NH Data nn=',i3)")nn amie.F: if (amie_ibkg == 0) then amie.F: if (amie_nh_ut(i) < model_ut) iset = i amie.F: denoma = amie_nh_ut(iset1) - amie_nh_ut(iset) amie.F: f1 = (amie_nh_ut(iset1) - model_ut)/denoma amie.F: f2 = (model_ut - amie_nh_ut(iset))/denoma amie.F: cusplat_nh_amie = (f1*amie_cusplat_nh(iset1) + amie.F: | f2*amie_cusplat_nh(iset)) amie.F: cuspmlt_nh_amie = (f1*amie_cuspmlt_nh(iset1) + amie.F: | f2*amie_cuspmlt_nh(iset)) amie.F: hpi_nh_amie = (f1*amie_hpi_nh(iset1) + f2*amie_hpi_nh(iset)) amie.F: pcp_nh_amie = (f1*amie_pcp_nh(iset1) + f2*amie_pcp_nh(iset)) amie.F: pot_nh_amie(:,:) = (f1*amie_pot_nh(:,:,iset1) + amie.F: | f2*amie_pot_nh(:,:,iset)) amie.F: ekv_nh_amie(:,:) = (f1*amie_ekv_nh(:,:,iset1) + amie.F: | f2*amie_ekv_nh(:,:,iset)) amie.F: efx_nh_amie(:,:) = (f1*amie_efx_nh(:,:,iset1) + amie.F: | f2*amie_efx_nh(:,:,iset)) amie.F: call boxcar_ave(amie_pot_nh,pot_nh_amie,lonp1,latp1, amie.F:! call fminmax(amie_pot_nh(:,:,iset),lonp1*latp1,fmin,fmax) amie.F:! write(6,"('AMIE pot max,min = ',2f8.0)")fmax,fmin amie.F:! call fminmax(pot_nh_amie(:,:),lonp1*latp1,fmin,fmax) amie.F:! write(6,"('boxcar_ave AMIE pot max,min= ',2f8.0)")fmax,fmin amie.F: call boxcar_ave(amie_efx_nh,efx_nh_amie,lonp1,latp1, amie.F:! call fminmax(amie_efx_nh(:,:,iset),lonp1*latp1,fmin,fmax) amie.F:! write(6,"('AMIE efx max,min = ',2f8.0)")fmax,fmin amie.F:! call fminmax(efx_nh_amie(:,:),lonp1*latp1,fmin,fmax) amie.F:! write(6,"('boxcar_ave AMIE efx max,min= ',2f8.0)")fmax,fmin amie.F: call boxcar_ave(amie_ekv_nh,ekv_nh_amie,lonp1,latp1, amie.F:! call fminmax(amie_ekv_nh(:,:,iset),lonp1*latp1,fmin,fmax) amie.F:! write(6,"('AMIE ekv max,min = ',2f8.0)")fmax,fmin amie.F:! call fminmax(ekv_nh_amie(:,:),lonp1*latp1,fmin,fmax) amie.F:! write(6,"('boxcar_ave AMIE ekv max,min= ',2f8.0)")fmax,fmin amie.F: if (amie_ibkg == 1) then amie.F: pot_nh_amie(:,:) = amie_pot_nh(:,:,1) amie.F: ekv_nh_amie(:,:) = amie_ekv_nh(:,:,1) amie.F: efx_nh_amie(:,:) = amie_efx_nh(:,:,1) amie.F: cusplat_nh_amie = amie_cusplat_nh(1) amie.F: cuspmlt_nh_amie = amie_cuspmlt_nh(1) amie.F: hpi_nh_amie = amie_hpi_nh(1) amie.F: pcp_nh_amie = amie_pcp_nh(1) amie.F: pot_nh_amie(:,:) = pot_nh_amie(:,:) + amie_pot_nh(:,:,1) amie.F: ekv_nh_amie(:,:) = ekv_nh_amie(:,:) + amie_ekv_nh(:,:,1) amie.F: efx_nh_amie(:,:) = efx_nh_amie(:,:) + amie_efx_nh(:,:,1) amie.F: cusplat_nh_amie = cusplat_nh_amie + amie_cusplat_nh(1) amie.F: cuspmlt_nh_amie = cuspmlt_nh_amie + amie_cuspmlt_nh(1) amie.F: hpi_nh_amie = hpi_nh_amie + amie_hpi_nh(1) amie.F: pcp_nh_amie = pcp_nh_amie + amie_pcp_nh(1) amie.F: pot_nh_amie(:,:) = pot_nh_amie(:,:)/nn amie.F: ekv_nh_amie(:,:) = ekv_nh_amie(:,:)/nn amie.F: efx_nh_amie(:,:) = efx_nh_amie(:,:)/nn amie.F: cusplat_nh_amie = cusplat_nh_amie/nn amie.F: cuspmlt_nh_amie = cuspmlt_nh_amie/nn amie.F: hpi_nh_amie = hpi_nh_amie/nn amie.F: pcp_nh_amie = pcp_nh_amie/nn amie.F: if (cusplat_sh_amie > 65.0) then amie.F: cusplat_sh_amie = 65.0 amie.F: cuspmlt_sh_amie = 11. amie.F: if (cusplat_sh_amie < 60.0) then amie.F: cusplat_sh_amie = 60.0 amie.F: cuspmlt_sh_amie = 11. amie.F: cusplat_sh_amie = amin1(65.0,cusplat_sh_amie) amie.F: if (cusplat_nh_amie > 65.0) then amie.F: cusplat_nh_amie = 65.0 amie.F: cuspmlt_nh_amie = 11. amie.F: if (cusplat_nh_amie < 60.0) then amie.F: cusplat_nh_amie = 60.0 amie.F: cuspmlt_nh_amie = 11. amie.F: cusplat_nh_amie = amin1(65.0,cusplat_nh_amie) amie.F: crad(1) = (90.-cusplat_sh_amie)*pi/180. amie.F: crad(2) = (90.-cusplat_nh_amie)*pi/180. amie.F: phida(1) = (cuspmlt_sh_amie - 12.) * pi / 12. amie.F: phida(2) = (cuspmlt_nh_amie - 12.) * pi / 12. amie.F:! gl - 14/07/2002 changed from Emery's original amieterp.f amie.F:! AMIE grid goes from -90 to ~-40 for SH and +90 to ~+40 for NH. amie.F:! ekvm(i,j) = ekv_sh_amie(i,latp1) amie.F:! ekvm(i,jmxm+1-j) = ekv_nh_amie(i,latp1) amie.F:! Put in AMIE arrays from pole to JMFT amie.F:! potm(i,j) = pot_sh_amie(i,j) amie.F:! potm(i,latp1+1-j) = pot_nh_amie(i,j) amie.F:! ekvm(i,j) = ekv_sh_amie(i,j) amie.F:! ekvm(i,latp1+1-j) = ekv_nh_amie(i,j) amie.F:! efxm(i,j) = efx_sh_amie(i,j) amie.F:! efxm(i,latp1+1-j) = efx_nh_amie(i,j) amie.F: ekvm(i,j) = (1.-del)*ekv_sh_amie(m,latp1) + amie.F: | del*ekv_sh_amie(mp1,latp1) amie.F: ekvm(i,jmxm+1-j) = (1.-del)*ekv_nh_amie(m,latp1) + amie.F: | del*ekv_nh_amie(mp1,latp1) amie.F:C Put in AMIE arrays from pole to latp1 amie.F: potm(i,j) = (1.-del)*pot_sh_amie(m,j) + del*pot_sh_amie(mp1,j) amie.F: potm(i,jmxm+1-j) = (1.-del)*pot_nh_amie(m,j) + amie.F: | del*pot_nh_amie(mp1,j) amie.F: ekvm(i,j) = (1.-del)*ekv_sh_amie(m,j) + del*ekv_sh_amie(mp1,j) amie.F: ekvm(i,jmxm+1-j) = (1.-del)*ekv_nh_amie(m,j) + amie.F: | del*ekv_nh_amie(mp1,j) amie.F: efxm(i,j) = (1.-del)*efx_sh_amie(m,j) + del*efx_sh_amie(mp1,j) amie.F: efxm(i,jmxm+1-j) = (1.-del)*efx_nh_amie(m,j) + amie.F: | del*efx_nh_amie(mp1,j) amie.F:C DMLAT=lat spacing in degrees of AMIE apex grid amie.F:! temp - save the AMIE output in geographic grid amie.F: amie_debug = 1 amie.F: if (amie_debug > 0) then amie.F: write(6,"('getamie: AMIE data interpolated to date and time')") amie.F: end subroutine getamie amie.F: end module amie_module aurora.F: | crit ! may be changed from default if amie run aurora.F: use amie_module,only: crad,phida,ekvg,efxg,hpi_sh_amie, aurora.F: | hpi_nh_amie,pcp_sh_amie,pcp_nh_amie aurora.F: use input_module,only: iamie aurora.F: real :: arad(2),hp_amie,c25,c35 aurora.F:! Recalculate some parameters if an amie run: aurora.F: if (iamie > 0) then aurora.F: theta0(:) = crad(:) ! radians from amie module aurora.F: phid(:) = phida(:) ! radians from amie module aurora.F: hp_amie = max(hpi_sh_amie,hpi_nh_amie) aurora.F: plevel = 2.09*alog(hp_amie) aurora.F: write(6,"(/,'aurora_cons (iamie=',i2,'):')") iamie aurora.F:! (if this is an amie run, then theta0 and phid have been taken aurora.F:! from amie, see aurora_cons) aurora.F:! Recalculate alfa, flux, drizl if an amie run (as in old sub amiepa): aurora.F: if (iamie > 0) then cons.F:! Set default crit. If reading amie data, this may be changed dynamo.F: use input_module,only: potential_model,iamie dynamo.F: real,dimension(nmlonp1,nmlat0) :: phisym ! symmetric amie potential dynamo.F: real,dimension(nmlonp1,nmlat) :: phiasym ! asymmetric amie potential dynamo.F:! At this point, phihm is heelis, weimer, or amie (see advance.F) dynamo.F:! If not amie: dynamo.F: if (iamie <= 0) then ! not amie run (heelis or weimer) dynamo.F:! If amie, then break phihm into symmetric (phisym) and asymmetric (phiasym) dynamo.F: else ! is amie dynamo.F:! Modify stencils of symmetric part of amie potential: dynamo.F: endif ! iamie dynamo.F: if (iamie <= 0) then ! not amie (heelis or weimer) dynamo.F:! Amie (fractional partitioning was done above): dynamo.F: else ! amie dynamo.F: call addfsech_ij('PHISYM','symmetric AMIE potential','Volts ', dynamo.F: call addfsech_ij('PHIASYM','asymmetric AMIE potential','Volts ', dyndiag.F: | qamie, ! joule heating from amie dyndiag.F: | famieu,famiev, ! horizontal current from amie dyndiag.F: | qwind_sec,qamie_sec,work_sec,wtot_sec,fwindu_sec, dyndiag.F: | fwindv_sec,famieu_sec,famiev_sec,famie_sec,fwind_sec, dyndiag.F: real :: qamie0,qwind0,wtot0,work0,famieu0,famiev0, dyndiag.F:! qamie = Joule Heating due to ion drift dyndiag.F: qamie(:,lat) = 0. dyndiag.F: famieu(:,lat) = 0. dyndiag.F: famiev(:,lat) = 0. dyndiag.F:! qamie=sigp{(Bx^2+Bz^2)*Wx^2 + (By^2+Bz^2)*Wy^2-2.*Bx*By*Wx*Wy dyndiag.F:! qamie is Joule heating without neutral wind dyndiag.F:! qamie=sigp{(Bx^2+Bz^2)*Vx^2+(By^2+Bz^2)*Vy^2+2.*Bx*By*Vx*Vy}/ dyndiag.F: qamie0 = sigma1(k,i)*(tm1(i)*ui(k,i)**2+tm2(i)* dyndiag.F: qamie0 = qamie0*bmod(i,lat)**2 / sndip(i)**2 dyndiag.F:! wtot = sigp (E + UxB).E = Qamie + sigp*{(UxB).E} dyndiag.F: wtot0 = qamie0 + wtot0 dyndiag.F: work0 = wtot0 - qwind0 - qamie0 dyndiag.F: qamie_sec(i,lat,k) = qamie0 * 1.e-9 dyndiag.F: qamie(i,lat) = qamie(i,lat)+(z(k+1,i)-z(k,i))*qamie0*1.e-11 dyndiag.F: famieu0 = -tm1(i)*sigma2(k,i)* dyndiag.F: famiev0 = -tm2(i)*sigma2(k,i)* dyndiag.F: famieu0 = famieu0*bmod(i,lat)*1.e-8/sndip(i)**2 dyndiag.F: famiev0 = famiev0*bmod(i,lat)*1.e-8/sndip(i)**2 dyndiag.F: famieu(i,lat) = famieu(i,lat)+(z(k+1,i)-z(k,i))*famieu0 dyndiag.F: famiev(i,lat) = famiev(i,lat)+(z(k+1,i)-z(k,i))*famiev0 dyndiag.F: famieu_sec(i,lat,k) = famieu0 dyndiag.F: famiev_sec(i,lat,k) = famiev0 dyndiag.F: qamie_sec(:,lat,nlevp1) = qamie(:,lat) dyndiag.F: famieu_sec(:,lat,nlevp1) = famieu(:,lat) dyndiag.F: famiev_sec(:,lat,nlevp1) = famiev(:,lat) dyndiag.F:! | 'qamie_sec = ',/,(6g12.2))") dyndiag.F:! | ped_sec(lon0,lat,:),qamie_sec(lon0,lat,:) dyndiag.F:! call addfsech_ik('QAMIE1',' ',' ',qamie_sec(lon0:lon1,lat,:), dyndiag.F:! Note total fwind and famie are not calculated here (as they were in dyndiag.F:! call addfsech_ik('QAMIE' ,' ',' ', dyndiag.F:! | qamie_sec(lon0:lon1,lat,:),lon0,lon1,nk,nk,lat) dyndiag.F:! call addfsech_ij('FAMIEU' ,' ',' ', dyndiag.F:! | famieu(lon0:lon1,lat0:lat1),lon0,lon1,lat0,lat1) dyndiag.F:! call addfsech_ij('FAMIEV' ,' ',' ', dyndiag.F:! | famiev(lon0:lon1,lat0:lat1),lon0,lon1,lat0,lat1) dyndiag.F: | (/'PEDERSEN','HALL ','QAMIE ','QWIND ','WTOT ', dyndiag.F: | 'WORK ','TEC ','FAMIEU ','FAMIEV ','FWINDU ', dyndiag.F: | qamie_sec(lon0:lon1,lat0:lat1,:) dyndiag.F: | famieu_sec(lon0:lon1,lat0:lat1,:) dyndiag.F: | famiev_sec(lon0:lon1,lat0:lat1,:) dyndiag.F: qamie_sec(ilon0:ilon1,ilat0:ilat1,:) = dyndiag.F: famieu_sec(ilon0:ilon1,ilat0:ilat1,:) = dyndiag.F: famiev_sec(ilon0:ilon1,ilat0:ilat1,:) = extraoutput.F: | qwind_sec,qamie_sec,work_sec,wtot_sec,fwindu_sec, extraoutput.F: | fwindv_sec,famieu_sec,famiev_sec,famie_sec,fwind_sec, extraoutput.F: famie_sec(:,:,:) = 0. extraoutput.F: famie_sec(i,j,k) = extraoutput.F: | ((famieu_sec(lonp,j,k)-famieu_sec(lonm,j,k))/ extraoutput.F: | dlamda + (sn(j+1)*famiev_sec(i,j+1,k)-sn(j-1)* extraoutput.F: | famiev_sec(i,j-1,k))/dphi) / (2.*re*sn(j)) / extraoutput.F: ftot_sec(i,j,k) = famie_sec(i,j,k)+fwind_sec(i,j,k) extraoutput.F: famie_sec(:,1,k)=(famie_sec(:,2,k)-famie_sec(:,1,k))/re/dphi extraoutput.F: famie_sec(:,nlat,k) = (famie_sec(:,nlat,k)- extraoutput.F: + famie_sec(:,nlat-1,k))/re/dphi extraoutput.F: ftot_sec(:,1,k) = fwind_sec(:,1,k)+famie_sec(:,1,k) extraoutput.F: ftot_sec(:,nlat,k)=fwind_sec(:,nlat,k)+famie_sec(:,nlat,k) extraoutput.F: qamie_sec(1,j,:) = qamie_sec(nlon+1,j,:) ! 73 <- 1 extraoutput.F: qamie_sec(2,j,:) = qamie_sec(nlon+2,j,:) ! 74 <- 2 extraoutput.F: qamie_sec(nlonp1+2,j,:) = qamie_sec(3,j,:) ! 75 <- 3 extraoutput.F: qamie_sec(nlonp1+3,j,:) = qamie_sec(4,j,:) ! 76 <- 4 extraoutput.F: call addfsech_ik('QAMIE',' ',' ',qamie_sec(1:nlonp4,j,:), extraoutput.F: famie_sec(1,j,:) = famie_sec(nlon+1,j,:) ! 73 <- 1 extraoutput.F: famie_sec(2,j,:) = famie_sec(nlon+2,j,:) ! 74 <- 2 extraoutput.F: famie_sec(nlonp1+2,j,:) = famie_sec(3,j,:) ! 75 <- 3 extraoutput.F: famie_sec(nlonp1+3,j,:) = famie_sec(4,j,:) ! 76 <- 4 extraoutput.F: call addfsech_ik('FAMIE',' ',' ',famie_sec(1:nlonp4,j,:), extraoutput.F: qjh_tot_sec(:,:,:) = qamie_sec(:,:,:) + qwind_sec(:,:,:) heelis.F: use amie_module,only: tiepot ! (nmlonp1,nmlat) heelis.F:! Average amie results show r1=-2.6 for 11.3 degrees init.F: | amienh,amiesh,aurora_proton init.F: use amie_module,only: rdamie_nh,rdamie_sh init.F:! Read amie data files if necessary: init.F:! call init_amie init.F: if (len_trim(amienh) > 0) then init.F: write(6,"('Reading AMIENH file ',a)") trim(amienh) init.F: call rdamie_nh init.F: if (len_trim(amiesh) > 0) then init.F: write(6,"('Reading AMIESH file ',a)") trim(amiesh) init.F: call rdamie_sh input.F: | amiesh, ! file or mss path of amie SH data file (optional) input.F: | amienh ! file or mss path of amie NH data file (optional) input.F: | iamie, ! 0/1 flag for AMIE data (not in namelist read) input.F: | iamie_bkg, ! 0/1/2 flag for read real, 1st, or 24-hr averaged data input.F: | label, tempdir, magvol, amiesh,amienh, gpi_ncfile, input.F: | iamie, iamie_bkg, input.F: | calendar_advance,ctpoten_time,power_time,amiesh,amienh, input.F: | iamie_bkg,aurora_proton,ilow_proton input.F: amiesh = ' ' input.F: amienh = ' ' input.F: iamie = 0 ! will be set 1 if amienh or amiesh files are given input.F: iamie_bkg = 0 ! default is read in real time amie data input.F:! Set iamie flag to 1 if user has provided either amiesh or amienh input.F: if (len_trim(amiesh) + len_trim(amienh) > 0) then input.F: write(6,"('Will read AMIE data inputs')") input.F: iamie = 1 input.F: potential_model = 'AMIE' input.F: inp%amiesh = aurora_proton input.F: inp%amiesh = amiesh input.F: inp%amienh = amienh input.F: inp%iamie = iamie input.F: inp%iamie_bkg = iamie_bkg input.F: if (len_trim(amiesh) > 0) input.F: | write(6,"(' amiesh = ',a,/,4x, input.F: | '(file or mss path containing amie SH data)')") input.F: | trim(inp%amiesh) input.F: if (len_trim(amienh) > 0) input.F: | write(6,"(' amienh = ',a,/,4x, input.F: | '(file or mss path containing amie NH data)')") input.F: | trim(inp%amienh) low_proton.F:! Read AMIE data for the northern hemisphere from amienh low_proton.F: | 'rdamie_nh: Error getting proton latitude dimension') low_proton.F: | 'rdamie_nh: Error getting auroral proton UT id') low_proton.F: | 'rdamie_nh: Error getting proton variable ut') low_proton.F: if (ier /= 0) write(6,"('>>> rdamie_nh: error allocating', low_proton.F:! Get 3-D AMIE fields (lon,lat,ntimes) low_proton.F:! Read AMIE outputs from amie_ncfile file, returning electric potential, low_proton.F:! amie_ibkg = 0 use real UT AMIE data low_proton.F:! = 1 use the first AMIE volumne as the background low_proton.F:! = 2 use the 24-hr average AMIE volumne as the background wei01gcm.F:C eliminate? (6) Add wrapper routine (WEIEPOT01) for use with AMIE; this is a wei01gcm.F:C uses for AMIE: As absolute magnetic latitude decreases to the wei01gcm.F:C Interface to Weimer-01 (a.k.a w2k) for AMIE's combined electrostatic wei01gcm.F:C Since the AMIE model assumes a NH solution although the