subroutine instant_init implicit none linstantdump = lfielddump .or. lislicedump .or. ljslicedump .or. lkslicedump .or. lprobedump if(.not.(linstantdump)) return if(runtime+btime <= tinstantstart) then if(myid==0) then write(*,*) "ERROR: no instantaneous fields will be written as runtime+btime <= tinstantstart. Note that & &runtime+btime must be greater than tinstantstart for wiriting instantaneous output files." write(*,*) "Curent setting: runtime = ", runtime, ", btime = ", btime, ", tinstantstart = ", tinstantstart write(*,*) "Either correct the time settings or change all the instantaneous output flags to false." !abort every rank: a bare STOP inside a rank-0 guard leaves the other ranks alive until walltime call MPI_ABORT(MPI_COMM_WORLD, 1, mpierr) end if end if ! Instantaneous dumps follow the absolute schedule tinstantstart + n*tinstantdump, ! also across warm starts: the first dump of a restarted run is the first ! schedule instant at or after btime, so the output times of chained runs ! stay on the same grid. if (tinstantstart .le. btime) then tnextinstantdump = tinstantstart + ceiling((btime - tinstantstart)/tinstantdump)*tinstantdump else tnextinstantdump = tinstantstart end if ! Validate the namelist inputs here so that configuration errors still abort ! at start-up; the file creation itself is deferred to instant_prepare. if (lfielddump) call instant_validate_output_vars(nfieldvars, fieldvars, 'fieldvars', 'lfielddump') if (lislicedump .or. ljslicedump .or. lkslicedump) then call instant_validate_output_vars(nslicevars, slicevars, 'slicevars', 'one or more of lislicedump, ljslicedump and lkslicedump') call instant_validate_slice_inputs(lkslicedump, nkslice, kslice, 'kslice') call instant_validate_slice_inputs(lislicedump, nislice, islice, 'islice') call instant_validate_slice_inputs(ljslicedump, njslice, jslice, 'jslice') end if if (lprobedump) then call instant_validate_output_vars(nprobevars, probevars, 'probevars', 'lprobedump') if (nprobe <= 0) then write(0, *) 'ERROR: lprobedump=.true. but nprobe=', nprobe, ' (must be > 0)' stop 1 end if end if if (.not. ltempeq .and. ((lfielddump .and. index(fieldvars, 'ta') > 0) .or. & ((lislicedump .or. ljslicedump .or. lkslicedump) .and. index(slicevars, 'ta') > 0) .or. & (lprobedump .and. index(probevars, 'ta') > 0))) then if (myid == 0) write(0,*) "ERROR: 'ta' output requires ltempeq=.true." stop 1 end if if ((.not. ltempeq .or. .not. lmoist) .and. & ((lfielddump .and. index(fieldvars, 'rh') > 0) .or. & ((lislicedump .or. ljslicedump .or. lkslicedump) .and. index(slicevars, 'rh') > 0) .or. & (lprobedump .and. index(probevars, 'rh') > 0))) then if (myid == 0) write(0,*) "ERROR: 'rh' output requires ltempeq=.true. and lmoist=.true." stop 1 end if if (.not. lmoist .and. ((lfielddump .and. index(fieldvars, 'ql') > 0) .or. & ((lislicedump .or. ljslicedump .or. lkslicedump) .and. index(slicevars, 'ql') > 0) .or. & (lprobedump .and. index(probevars, 'ql') > 0))) then if (myid == 0) write(0,*) "ERROR: 'ql' output requires lmoist=.true." stop 1 end if lfieldtemp = lfielddump .and. ltempeq .and. index(fieldvars, 'ta') > 0 lslicetemp = (lislicedump .or. ljslicedump .or. lkslicedump) .and. ltempeq .and. index(slicevars, 'ta') > 0 lfieldrh = lfielddump .and. ltempeq .and. lmoist .and. index(fieldvars, 'rh') > 0 lslicerh = (lislicedump .or. ljslicedump .or. lkslicedump) .and. ltempeq .and. lmoist .and. & index(slicevars, 'rh') > 0 lfieldpabs = lfielddump .and. index(fieldvars, 'pa') > 0 end subroutine instant_init