CACK_OOPS_!@#$%^&*()*&^%$#@!_SPOO_KCAC T3D_READBt.FOR C+ C NAME: C T3D_ReadBt C PURPOSE: C Get radial and tangential magnetic field data at source surface C CATEGORY: C I/O C CALLING SEQUENCE: logical function T3D_ReadBt(t3d,XCbegMAT,XCendMAT,XCbegROI,XCendROI,BR3D,BT3D,Btmp) C INPUTS: C t3d(*) real contains information about reconstruction C (the array is filled by href=T3D_fill_global= C and href=T3D_fill_time=). C C XCbegMAT(nTim) real start Carrington variable of matrix (- NCoff) C XCendMAT(nTim) real end Carrington variable of matrix (- NCoff) C (range of matrix typically is three Carrington rotations) C XCbegROI(nTim) real start Carrington variable of region of interest C XCendROI(nTim) real end Carrington variable of region of interest C (the region of interest typically covers one whole C Carrington rotation C C Btmp(nLng,nLat,2) real scratch array C OUTPUTS: C BR3D(nLng,nLat,nRad,nTim) C real radial magnetic field C BT3D(nLng,nLat,nRad,nTim) C real tangential magnetic field C CALLS: C MapReadt, MapReadSRF, ArrR4Copy, Say C INCLUDE: c include 't3d_array.h' c include 'sun.h' C EXTERNAL: external MapReadSRF C SIDE EFFECTS: C !!!! Only the source surface field BR3D(*,*,1,*) and BT3D(*,*,1,*) is filled. C The rest of the array is not modified. C RESTRICTIONS: C The temporary array Btmp must have at least 2*nLng*nLat elements C (nLng = # longitudes, nLat = # latitudes) C PROCEDURE: C Using the mapreadt (instead of mapread) subroutine, C Either the Stanford potential field maps at a source surface of 2.5 C Rsun, or the identically formatted maps out put from TJD's C modification of Xuepu's IDL code, can be read in to fill in the source C surface of the BR3D array. Currently BT3D is not supported. C C Note that the input array BR3D and BT3D are 4D arrays, i.e. 3 spatial dimensions C (longitude, latitude, radial distance) and one time dimension. C MODIFICATION HISTORY: C DEC-2000, Paul Hick (UCSD; pphick@ucsd.edu) C SEP-2001, T Dunn (UCSD; tdunn@ucsd.edu) C- character cSay*10 /'T3D_readB'/ real BR3D(*), !4D radial magnetic array whose SS will be filled & BT3D(*), !4D tangential magnetic array whose SS will not be filled & Btmp(*) !scratch,filled by Mapreadt real XCbegMAT(*), !3 Rotaion matrix of start-times & XCendMAT(*), !3 Rotaion matrix of end-times & XCbegROI(*), !Start-times or region of interest & XCendROI(*) !End-times or region of interest real XCadj(3) /3*0./ include 't3d_array.h' include 'sun.h' T3D_ReadBt = .True. !may want to use this as a check !if "false", will print "no mag field data" c TJD: use t3d_get instead of directly acessing t3d call t3d_iget(T3D__NLNG,0,nLng) call t3d_iget(T3D__NLAT,0,nLat) call t3d_iget(T3D__NRAD,0,nRad) call t3d_iget(T3D__NTIM,0,nTim) call t3d_iget(T3D__NCOFF,0,NCoff) if (T3D_ReadBt) then Bad = BadR4() nLng1 = nLng-1 nLngLat = nLng*nLat nLoc = nLngLat*nRad nLng2 = 1+2*nLngLat C------- C iLng is the number of longitudes in a single Carrington rotation. C (here we assume XCbegROI to XCendROI cover exactly one rotation) T3D_ReadBt = .FALSE. L1 = 1-nLoc do L=1,nTim XCbeg = XCbegMAT(L) XCend = XCendMAT(L) c print *, 'XCendROI(L)',XCendROI(L) c print *, 'XCbegROI(L)',XCbegROI(L) c print *, 'XCend',XCend c print *, 'XCbeg',XCbeg c print *, 'nLng1',nLng1 c print *, '(XCend-XCbeg)',(XCend-XCbeg) c print *, 'iLng should equal:',((XCendROI(L)-XCbegROI(L))/(XCend-XCbeg)*nLng1)+1 iLng = nint((XCendROI(L)-XCbegROI(L))/(XCend-XCbeg)*nLng1)+1 iBlnk = 1 XCbeg = NCoff+XCbeg XCend = NCoff+XCend L1 = L1+nLoc c* iLng would only be for a single rotation c* Btmp is returned nLngLat in size print *, 'readbt - XCbeg,XCend',XCbeg,XCend c print *, ' XCadj',XCadj c print *, 'nLngLat',nLngLat c print *, 'iLng,nLat',iLng,nLat c print *, 'XCbeg,XCend',XCbeg,XCend call MapReadt(MapReadSRF,XCbeg,XCend,1,XCadj,0., & nLngLat,iLng,nLat,Btmp,BR3D(L1),iBlnk,Bmin,Bmax) T3D_ReadBt = T3D_ReadBt .or. Bmin .ne. Bad c TJD: The only holes should be at edges. c print *, 'Btmp(1)', Btmp(1) c print *, 'Btmp(2)', Btmp(2) c print *, 'Btmp(3)', Btmp(3) c print *, 'Btmp(300)', Btmp(300) c print *, 'Btmp(301)', Btmp(301) c print *, 'Btmp(302)', Btmp(302) c print *, 'Btmp(548)', Btmp(548) c print *, 'Btmp(549)', Btmp(549) c print *, 'Btmp(550)', Btmp(550) c call WhatisR4(nLat*nLng*3, Btmp,'Btmp info as follows') call ArrR4Copy(nLngLat,Btmp,BR3D(L1)) end do else call Say(cSay,'W','RR','source surface for Stanford maps '// & 'is at 2.5 solar radii#no magnetic field data read') end if return end