C+ C NAME: C write3D_input_3D_MHD_DV C PURPOSE: C Writes a 3D file and pertinent information over at times XCint(N) + half of the interval. (B Jackson, February 28, 2018) C This program is used to simply write out the input 3-D_MHD inpuuts into the format used at UCSD in order to C check to see that the data input are complete and in the format that can be used by the UCSD traceback technique C that utilizes input voulmetric data. C C These volumetric data should match the density and velocity that are gotten by the normal high-resolution C writes that are produced using the external or kinematic traceback routines that utilize the lower C boundary alone to provide the volumetric analysis before any iterations are performed. C C XCint(N) values are the beginnings (and ends) of the time intervals used to select data. When the data selection C used is set to a daily cadence with a one day resolution, these XCint(N) values are the beginning and C ending midnight on Earth at the longitude the data is obtained. The actual start time of the time matrix XCtbeg C is set to the middle of the first set of these values and proceeds at precise nT interval values from this C value until the end value XCtbeg, which is the middle of the last interval. Thus, the time value for the C extraction of the matrix as near as possible should be the middle of the temporal XCint(N) intervals in C order to match the Earth location at local noon. The motive here is to select an extract time when most of the C IPS sources are observed. If temporal intervals are set at a daily cadence, but at higher temporal C resolutions than one day, then the matrix output, should still be set to the middle of the interval. C C CALLING SEQUENCE: C call write3D_input_3D_MHD_DV(cPre,Nit,NiterT,Ninter,NCoff,XCintD,XCbe,XCtbeg,XCtend,iYr,RR,dRR,R1AU, C nLng,nLat,nMap,nT,nTmax,nCar,JDCar, C PWV,PWG,PWRV,PWRG,DEN1AU,CONRV,CONRD,CONSTV,CONSTG,CONVT,CONDT, C ClipLng,Scale,VMAP,DMAP,FALLOFFV,FALLOFFD,VVV3,DDD1,V3D,D3D,VV,DD) C INPUTS: C cPre character Character prefix for output files C Nit integer interation number C NiterT integer maximum number of iterations C Ninter integer # of intermediate steps C NCoff integer Carrington variable offset C XCintD(nTmax) real*8 Beginning and ends of the time intervals used to select data C XCbe(2,nT) real Beginning (1,nT) and end (2,nT) of Carrington rotation times C XCtbeg real Start time C XCtend real End time C iYr integer year at beginning time C RR real radial distance of the source surface C dRR real radial resolution C R1AU real The 1 AU solar distance in AU (1.0) C nLng integer # longitudes C nLat integer # latitudes C nMap integer # radial distances C nT integer # of time values C nTmax integer maximum # of time values C nCar integer # Carrington rotations C JDCar real*8 Julian Date at beginning of rotations C PWV real g-level power to fit velocity C PWG real g-level power to fit density C PWRV real radial g-level power to fit g density C (or radial density falloff for Thomson scattering) C PWRG real radial g-level power to fit V density C DEN1AU real Density at 1 AU C CONRV real Velocity spatial smoothing constant C CONRD real Density spatial smoothing constant C CONSTV real Velocity spatial hole-filling constant C CONSTG real Density spatial hole-filling constant C CONVT real Velocity temporal smoothing constant C CONDT real Density temporal smoothing constant C ClipLng real Clip longitude C Scale real extra scaling factor (set to 1 if no scaling is required) C VMAP(nLng,nLat) real Velocity map at source surface C DMAP(nLng,nLat) real Density map at Source Surface C FALLOFFV real The power falloff of velocity (usually 0.0) C FALLOFFD real The power falloff of density (usually 2.0) C VVV3(nLng,nLat,nMap,nT,3) real 3D velocity matrix input C DDD1(nLng,nLat,nMap,nT) real 3D density matrix input C V3D(nLng,nLat,nMap) real 3D velocity matrix (dummy array) written out C D3D(nLng,nLat,nMap) real 3D density matrix (dummy array) written out - normalized to 1 AU C VV(nLng,nLat) real Written velocity map at source surface C DD(nLng,nLat) real Written density map at source Surface C FUNCTIONS/SUBROUTINES: C T3D_fill_global, T3D_fill_time, T3D_write_nv C- subroutine write3D_input_3D_MHD_DV(cPre,Nit,NiterT,Ninter,NCoff,XCintD,XCbe,XCtbeg,XCtend,iYr,RR,dRR,R1AU, & nLng,nLat,nMap,nT,nTmax,nCar,JDCar, & PWV,PWG,PWRV,PWRG,DEN1AU,CONRV,CONRD,CONSTV,CONSTG,CONVT,CONDT, & ClipLng,Scale,VMAP,DMAP,FALLOFFV,FALLOFFD,VVV3,DDD1,V3D,D3D,VV,DD) character cStrAdd(1)*120, & cFile*120, & cPre*4 real XCbe(2,nTmax) real VVV3 (nLng,nLat,nMap,nTmax,3), ! Velocity input from MHD & DDD1 (nLng,nLat,nMap,nTmax), ! Density input from MHD & VMAP (nLng,nLat,nTmax), ! Velocity source surface map & DMAP (nLng,nLat,nTmax), ! Density source surface map & VV (nLng,nLat), ! Velocity source surface map written & DD (nLng,nLat), ! Density source surface map written & V3D (nLng,nLat,nMap), & D3D (nLng,nLat,nMap), & Scale (4), & XCsh (3) real PwrR (3) /0.0, 2.0, -1.0/ real*8 XCtbeg,XCtend,XCtfull,X,XCtim,XCt,JDCar(nCar) real*8 XCintD(nTmax) external EARTH8 include 't3d_array_3.h' include 'MAPCOORDINATES.H' Bad = BadR4() PwrR(3) = Bad print *, 'In write3d_infotd', nLng, nLat, nMap, nT, nTmax XCdif = sngl(XCtend-XCtbeg)/nT XCbegt = sngl(XCtbeg) call T3D_fill_global(t3d,0,Nit,NiterT,NCoff,XCbegt,XCdif,RR,dRR,nLng,nLat,nMap,nT, & PWV,PWG,PWRV,PWRG,DEN1AU,CONRV,CONRD,CONSTV,CONSTG,CONVT,CONDT,ClipLng,Scale) call T3D_set(T3D__R_PWR,3,PwrR ) iset =1 Ninterp = Ninter + 1 ANinterp = Ninterp RRSDONE2 = (RR*RR) do N=1,nT XCbeg = XCbe(1,N) XCend = XCbe(2,N) XCdif = sngl(XCintD(N+1)-XCintD(N)) AI = XCdif/ANinterp XCtim = XCintD(N) ! Times the matrix is to be extracted this N XCM = XMAP_SC_POS8(EARTH8,iYr,XCtim,nCAR,JDCar) ! Earth location in Carrington coords. at XCtim XCbegROI = XCM - 0.5 ! Region of interest beginning (-NCoff) XCendROI = XCM + 0.5 ! Region of interest ending (-NCoff) TT = XCM write(*,'(A,I3,A,F8.3,A,F11.5)') 'Writing 3D file', N,' at XCtim =', XCtim,' or TT =', NCOFF + TT do K=1,nMap RSS = RRhght(K) RRSCOND = (RSS/R1AU)**FALLOFFD RRSCONV = (RSS/R1AU)**FALLOFFV do J=1,nLat do I=1,nLng D3D(I,J,K) = DDD1(I,J,K,N)*RRSCOND V3D(I,J,K) = VVV3(I,J,K,N,1)*RRSCONV if(K .eq. 1) then DD(I,J) = D3D(I,J,K) VV(I,J) = V3D(I,J,K) end if end do end do end do call T3D_fill_time(t3d,nT,TT,XCbeg,XCend,XCbegROI,XCendROI) call T3D_write_nv_3(cPre,t3d,VV,DD,V3D,D3D,0,cStrAdd,cFile) end do return end