subroutine initstatsdump use modmpi, only : myid,cmyidx,cmyidy,mpierr use modglobal, only : imax,jmax,cexpnr,kb,ke use modstat_nc, only : ncinfo,open_nc,define_nc,writestat_dims_nc use modfields, only : ncstattke,ncstatmint implicit none !> The TKE-budget output has been non-functional for years: genstats is not ! called in statsdump and nusgsav/disssgsav are never accumulated, so tkedump ! would be written full of zeros. Abort rather than emit a plausible-looking ! but meaningless file. See issue #352 for the repair. if (ltkedump) then if (myid == 0) then write(0, *) 'ERROR: ltkedump is disabled' write(0, *) 'The TKE-budget statistics path is not operational: genstats is' write(0, *) 'not called and nusgsav/disssgsav are never accumulated, so' write(0, *) 'tkedump.'//cexpnr//'.nc would contain zeros only.' write(0, *) 'Set ltkedump = .false. See uDALES issue #352.' end if call MPI_FINALIZE(mpierr) stop 1 end if allocate(ncstattke(nstattke,4)) allocate(ncstatmint(nstatmint,4)) klow=kb khigh=ke if (lmintdump) then mintname(10:12) = cmyidx mintname(14:16) = cmyidy mintname(18:20) = cexpnr call ncinfo(tncstatmint(1,:),'time' ,'Time' ,'s' ,'time') call ncinfo(ncstatmint( 1,:),'ut' ,'Streamwise velocity' ,'m/s' ,'mttt' ) call ncinfo(ncstatmint( 2,:),'vt' ,'Spanwise velocity' ,'m/s' ,'tmtt' ) call ncinfo(ncstatmint( 3,:),'wt' ,'Vertical velocity' ,'m/s' ,'ttmt' ) call ncinfo(ncstatmint( 4,:),'thlt' ,'Temperature' ,'K' ,'tttt' ) call ncinfo(ncstatmint( 5,:),'qtt' ,'Moisture' ,'kg/kg' ,'tttt' ) call ncinfo(ncstatmint( 6,:),'pt' ,'Pressure' ,'m^2/s^2','tttt' ) call open_nc(mintname, ncidmint, nrecmint, n1=imax, n2=jmax, n3=khigh-klow+1) if (nrecmint==0) then call define_nc( ncidmint, 1, tncstatmint) call writestat_dims_nc(ncidmint) end if call define_nc( ncidmint, nstatmint, ncstatmint) end if !> Generate time, y and x averaged NetCDF for tke budget: tkedump.xxx.nc if (ltkedump) then tkename(9:11) = cexpnr call ncinfo(tncstattke(1,:),'time' ,'Time' ,'s' ,'time') call ncinfo(ncstattke( 1,:),'p_b' ,'p_bant production or consumption term', 'm^2/s^3','tt' ) call ncinfo(ncstattke( 2,:),'t_p' ,'total viscous transport (?)' , 'm^2/s^3','tt' ) call ncinfo(ncstattke( 3,:),'adv' ,'Advection by mean wind' , 'm^2/s^3','tt' ) call ncinfo(ncstattke( 4,:),'t_t' ,'Total turb???' , 'm^2/s^3','tt' ) call ncinfo(ncstattke( 5,:),'t_sgs','total SGS term' , 'm^2/s^3','tt' ) call ncinfo(ncstattke( 6,:),'p_t' ,'Shear production term' , 'm^2/s^3','tt' ) call ncinfo(ncstattke( 7,:),'t_v' ,'Resolved viscous dissipation term' , 'm^2/s^3','tt' ) call ncinfo(ncstattke( 8,:),'d_sgs','SGS dissipation term' , 'm^2/s^3','tt' ) if (myid==0) then call open_nc(tkename, ncidtke, nrectke, n3=khigh-klow+1) if (nrectke==0) then call define_nc( ncidtke, 1, tncstattke) call writestat_dims_nc(ncidtke) end if call define_nc( ncidtke, nstattke, ncstattke) endif !myid==0 endif !> Set times to zero so works for warm starts... could have issues with warmstarts here... tsamplep = 0. tstatsdumpp = 0. end subroutine initstatsdump