R/write_job_noR.R

Defines functions write_job_noR

write_job_noR <-
  function(file = file.path(getwd(),"job.sh"),
         nodes = 1,ppn = 18,mem = 16,walltime = 24,
         prerun = "ml UDUNITS/2.2.26-intel-2018a R/3.4.4-intel-2018a-X11-20180131 HDF5/1.10.1-intel-2018a; ulimit -s unlimited",
         CD = "/user/scratchkyukon/gent/gvo000/gvo00074/felicien/ED2/ED/run",
         ed_exec = "/user/scratchkyukon/gent/gvo000/gvo00074/felicien/ED2/ED/run/ed_2.1-opt",
         ED2IN = "ED2IN"){

  ed2in <- read_ed2in(file.path(CD,ED2IN))
  DN <- dirname(ed2in$FFILOUT)
  analy <- basename(ed2in$FFILOUT)
  init <- paste(ed2in$IYEARA,sprintf('%02d',ed2in$IMONTHA),sprintf('%02d',ed2in$IDATEA),sep='/')
  end <- paste(ed2in$IYEARZ,sprintf('%02d',ed2in$IMONTHZ),sprintf('%02d',ed2in$IDATEZ),sep='/')

  writeLines("#!/bin/bash -l",con = file)
  write(paste0("#PBS -l nodes=",nodes,":ppn=",ppn),file=file,append=TRUE)
  write(paste0("#PBS -l mem=",mem,"gb"),file=file,append=TRUE)
  write(paste0("#PBS -l walltime=",walltime,":00:00"),file=file,append=TRUE)
  write("",file=file,append=TRUE)
  write(prerun,file=file,append=TRUE)
  write("",file=file,append=TRUE)
  write(paste("cd",CD),file=file,append=TRUE)
  write("",file=file,append=TRUE)
  write(paste(ed_exec,"-f",ED2IN),file=file,append=TRUE)
  write("",file=file,append=TRUE)
}
femeunier/ED2scenarios documentation built on July 19, 2023, 8:43 a.m.