R/calpuff_inp_generate_template.R

#' Generate a template for a CALPUFF input file
#' @description Generate a template for a CALPUFF input file.
#' @export calpuff_inp_generate_template

calpuff_inp_generate_template <- function(){
  
  writeLines(
    c("CALPUFF.INP     2.0             File version record",
      "",
      "",
      "0 -- Input and Output File Names",
      "",
      "Input files",
      "! METDAT  = !",
      "! ISCDAT  = !",
      "! PLMDAT  = !",
      "! PRFDAT  = !",
      "! SFCDAT  = !",
      "! RSTARTB = !",
      "",
      "! PTDAT  = !",
      "! VOLDAT = !",
      "! ARDAT  = !",
      "! LNDAT  = !",
      "",
      "! OZDAT   = !",
      "! VDDAT   = !",
      "! CHEMDAT = !",
      "! AUXEXT  = !",
      "",
      "! H2O2DAT = !",
      "! NH3ZDAT = !  ",
      "! HILDAT  = !",
      "! RCTDAT  = !",
      "! CSTDAT  = !",
      "! BDYDAT  = !",
      "! BCNDAT  = !",
      "",
      "Output files",
      "! PUFLST =  !",
      "! CONDAT =  !",
      "! DFDAT  =  !",
      "! WFDAT  =  !",
      "",
      "! VISDAT  = !",
      "! T2DDAT  = !",
      "! RHODAT  = !",
      "! RSTARTE = !",
      "",
      "! DEBUG  = !",
      "! FLXDAT = !",
      "! BALDAT = !",
      "! FOGDAT = !",
      "! RISDAT = !",
      "",
      "! LCFILES = !",
      "",
      "Number of Modeling Domains",
      "! NMETDOM = !",
      "",
      "Number of CALMET.DAT files for run",
      "! NMETDAT = !",
      "",
      "Number of PTEMARB.DAT files for run",
      "! NPTDAT = !",
      "",
      "Number of BAEMARB.DAT files for run",
      "! NARDAT = !",
      "",
      "Number of VOLEMARB.DAT files for run",
      "! NVOLDAT = !",
      "",
      "! END !",
      "",
      "Names for each CALMET domain if NMETDOM > 1",
      "! DOMAIN1 = !  ! END !",
      "! DOMAIN2 = !  ! END !",
      "! DOMAIN3 = !  ! END !",
      "! DOMAIN4 = !  ! END !",
      "! DOMAIN5 = !  ! END !",
      "",
      "Names for each CALMET.DAT file if NMETDAT > 1",
      "! METDAT = !  ! END !",
      "! METDAT = !  ! END !",
      "! METDAT = !  ! END !",
      "! METDAT = !  ! END !",
      "! METDAT = !  ! END !",
      "",
      "Names for each PTEMARB.DAT file if NPTDAT > 0",
      "! PTDAT = !  ! END !",
      "",
      "Names for each BAEMARB.DAT file if NARDAT > 0",
      "! ARDAT = !  ! END !",
      "",
      "Names for each VOLEMARB.DAT file if NVOLDAT > 0",
      "! VOLDAT = !  ! END !",
      "",
      "// end SECTION 0",
      "",
      "--------------------------------------------------------------------------------",
      "",
      "1 -- General run control parameters",
      "",
      "! METRUN = !",
      "",
      "Starting date/time",
      "! IBYR  = !",
      "! IBMO  = !",
      "! IBDY  = !",
      "! IBHR  = !",
      "! IBMIN = !",
      "! IBSEC = !",
      "",
      "Ending date/time",
      "! IEYR  = !",
      "! IEMO  = !",
      "! IEDY  = !",
      "! IEHR  = !",
      "! IEMIN = !",
      "! IESEC = !",
      "",
      "UTC time zone",
      "! ABTZ = !",
      "",
      "Length of modeling time-step (seconds)",
      "! NSECDT = !",
      "",
      "Number of chemical species",
      "! NSPEC = !",
      "",
      "Number of chemical species to be emitted",
      "! NSE = !",
      "",
      "Run parameters",
      "! ITEST    = !",
      "! MRESTART = !",
      "! NRESPD   = !",
      "! METFM    = !",
      "! MPRFFM   = !",
      "! AVET     = !",
      "! PGTIME   = !",
      "! IOUTU    = !",
      "! IOVERS   = !",
      "",
      "! END ! // end SECTION 1",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "2 -- Technical options",
      "",
      "! MGAUSS   = !",
      "! MCTADJ   = !",
      "! MCTSG    = !",
      "! MSLUG    = !",
      "! MTRANS   = !",
      "! MTIP     = !",
      "! MRISE    = !",
      "! MBDW     = !",
      "! MSHEAR   = !",
      "! MSPLIT   = !",
      "! MCHEM    = !",
      "! MAQCHEM  = !",
      "! MLWC     = !",
      "! MWET     = !",
      "! MDRY     = !",
      "! MTILT    = !",
      "! MDISP    = !",
      "! MTURBVW  = !",
      "! MDISP2   = !",
      "! MTAULY   = !",
      "! MTAUADV  = !",
      "! MCTURB   = !",
      "! MROUGH   = !",
      "! MPARTL   = !",
      "! MPARTLBA = !",
      "! MTINV    = !",
      "! MPDF     = !",
      "! MSGTIBL  = !",
      "! MBCON    = !",
      "! MSOURCE  = !",
      "! MFOG     = !",
      "! MREG     = !",
      "",
      "! END ! // end SECTION 2",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "3 -- Species list",
      "",
      "Modelled species",
      "! CSPEC = !  ! END !",
      "",
      "Species Name       Modelled, Emitted, DDep, Number",
      "!                = !",
      "",
      "! END ! // end SECTION 3",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "4 -- Map Projection and Grid control parameters",
      "",
      "! PMAP   = !",
      "! FEAST  = !",
      "! FNORTH = !",
      "! IUTMZN = !",
      "! UTMHEM = !",
      "! RLAT0  = !",
      "! RLON0  = !",
      "! XLAT1  = !",
      "! XLAT2  = !",
      "",
      "! DATUM = !",
      "",
      "Meteorological grid",
      "! NX = !",
      "! NY = !",
      "! DGRIDKM = !",
      "! XORIGKM = !",
      "! YORIGKM = !",
      "",
      "! NZ = !",
      "! ZFACE = !",
      "",
      "Computational Grid",
      "",
      "X index of LL corner",
      "! IBCOMP = !",
      "",
      "Y index of LL corner",
      "! JBCOMP = !",
      "",
      "X index of UR corner",
      "! IECOMP = !",
      "",
      "Y index of UR corner",
      "! JECOMP = !",
      "",
      "Sampling Grid",
      "",
      "! LSAMP = !",
      "",
      "X index of LL corner",
      "! IBSAMP = !",
      "",
      "Y index of LL corner",
      "! JBSAMP = !",
      "",
      "X index of UR corner",
      "! IESAMP = !",
      "",
      "Y index of UR corner",
      "! JESAMP = !",
      "",
      "Nesting factor of the sampling grid",
      "! MESHDN = !",
      "",
      "! END ! // end SECTION 4",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "5 -- Output Options",
      "",
      "! ICON = !",
      "! IDRY = !",
      "! IWET = !",
      "! IT2D = !",
      "! IRHO = !",
      "! IVIS = !",
      "",
      "! LCOMPRS = !",
      "",
      "! IQAPLOT = !",
      "! IPFTRAK = !",
      "! IMFLX   = !",
      "! IMBAL   = !",
      "! INRISE  = !",
      "! ICPRT   = !",
      "! IDPRT   = !",
      "! IWPRT   = !",
      "! ICFRQ   = !",
      "! IDFRQ   = !",
      "! IWFRQ   = !",
      "! IPRTU   = !",
      "! IMESG   = !",
      "",
      "Species list for output options",
      "",
      "Species Name       Conc (prn, dsk), Dflux (prn, dsk), Wflux (prn, dsk), Mflux (dsk)",
      "",
      "!                = !",
      "",
      "Options for printing debug quantities",
      "",
      "! LDEBUG = !",
      "! IPFDEB = !",
      "! NPFDEB = !",
      "! NN1    = !",
      "! NN2    = !",
      "",
      "! END ! // end SECTION 5",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "6 -- Subgrid scale complex terrain inputs",
      "",
      "! NHILL   = !",
      "! NCTREC  = !",
      "! MHILL   = !",
      "! XHILL2M = !",
      "! ZHILL2M = !",
      "! XCTDMKM = !",
      "! YCTDMKM = !",
      "",
      "! END ! // end SECTION 6",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "7 -- Chemical parameters for dry deposition of gases",
      "",
      "                 diffusivity, alpha star, reactivity,",
      "                 mesophyll resistance, Henry's Law coefficient",
      "!              = !",
      "",
      "! END ! // end SECTION 7",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "8 -- Size parameters for dry deposition of particles",
      "",
      "                  geometric mass mean diameter, geometric SD",
      "!               = !",
      "",
      "! END ! // end SECTION 8",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "9 -- Miscellaneous dry deposition parameters",
      "",
      "! RCUTR  = !",
      "! RGR    = !",
      "! REACTR = !",
      "! NINT   = !",
      "! IVEG   = !",
      "",
      "! END ! // end SECTION 9",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "10 -- Wet Deposition Parameters",
      "                                                          ",
      "                 scavenging coefficient (liquid precipitation),",
      "                 scavenging coefficient (frozen precipitation)",
      "!              = !",
      "",
      "! END ! // end SECTION 10",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "11 -- Chemistry Parameters",
      "",
      "Several parameters are needed for one or more of the chemical transformation",
      "mechanisms. Those used for each mechanism are:",
      "     ",
      "                                       M                 B            ",
      "                                       A  B  R  R  R     C  B        N",
      "                                 B     V  C  N  N  N  M  K  C  O     D",
      "                                 C  M  G  K  I  I  I  H  H  K  F  V  E",
      "                              M  K  N  N  N  T  T  T  2  2  P  R  C  C",
      "                              O  O  H  H  H  E  E  E  O  O  M  A  N  A",
      "     Mechanism (MCHEM)        Z  3  3  3  3  1  2  3  2  2  F  C  X  Y",
      "     --------------------   --------------------------------------------",
      "     0 None                   .  .  .  .  .  .  .  .  .  .  .  .  .  .",
      "     1 MESOPUFF II            X  X  .  .  X  X  X  X  .  .  .  .  .  .",
      "     2 User Rates             .  .  .  .  .  .  .  .  .  .  .  .  .  .",
      "     3 RIVAD                  X  X  .  .  X  .  .  .  .  .  .  .  .  .",
      "     4 SOA                    X  X  .  .  .  .  .  .  .  .  X  X  X  .",
      "     5 Radioactive Decay      .  .  .  .  .  .  .  .  .  .  .  .  .  X",
      "     6 RIVAD/ISORRPIA         X  X  X  X  X  X  .  .  X  X  .  .  .  .",
      "     7 RIVAD/ISORRPIA/SOA     X  X  X  X  X  X  .  .  X  X  X  X  .  .",
      "",
      "Ozone data input option",
      "! MOZ = !",
      "",
      "Monthly ozone concentrations in ppb (BCKO3)",
      "! BCKO3 = !",
      "",
      "Ammonia data option",
      "! MNH3 = !",
      "",
      "Ammonia vertical averaging option",
      "! MAVGNH3 = !",
      "",
      "Monthly ammonia concentrations in ppb",
      "! BCKNH3 = !",
      "",
      "Nighttime SO2 loss rate in %/hour",
      "! RNITE1 = !",
      "",
      "Nighttime NOx loss rate in %/hour",
      "! RNITE2 = !",
      "",
      "Nighttime HNO3 formation rate in %/hour",
      "! RNITE3 = !",
      "",
      "H2O2 data input option",
      "! MH2O2 = !",
      "",
      "Monthly H2O2 concentrations in ppb",
      "! BCKH2O2 = !",
      "",
      "Typical values for several distinct air mass types are:",
      "",
      "    Month    1    2    3    4    5    6    7    8    9   10   11   12",
      "            Jan  Feb  Mar  Apr  May  Jun  Jul  Aug  Sep  Oct  Nov  Dec",
      "",
      " Clean Continental",
      "    BCKPMF   1.   1.   1.   1.   1.   1.   1.   1.   1.   1.   1.   1.",
      "    OFRAC  .15  .15  .20  .20  .20  .20  .20  .20  .20  .20  .20  .15",
      "    VCNX    50.  50.  50.  50.  50.  50.  50.  50.  50.  50.  50.  50.",
      "",
      " Clean Marine (surface)",
      "    BCKPMF  .5   .5   .5   .5   .5   .5   .5   .5   .5   .5   .5   .5",
      "    OFRAC  .25  .25  .30  .30  .30  .30  .30  .30  .30  .30  .30  .25",
      "    VCNX    50.  50.  50.  50.  50.  50.  50.  50.  50.  50.  50.  50.",
      "",
      " Urban - low biogenic (controls present)",
      "    BCKPMF  30.  30.  30.  30.  30.  30.  30.  30.  30.  30.  30.  30.",
      "    OFRAC  .20  .20  .25  .25  .25  .25  .25  .25  .20  .20  .20  .20",
      "    VCNX     4.   4.   4.   4.   4.   4.   4.   4.   4.   4.   4.   4.",
      "",
      " Urban - high biogenic (controls present)",
      "    BCKPMF  60.  60.  60.  60.  60.  60.  60.  60.  60.  60.  60.  60.",
      "    OFRAC  .25  .25  .30  .30  .30  .55  .55  .55  .35  .35  .35  .25",
      "    VCNX    15.  15.  15.  15.  15.  15.  15.  15.  15.  15.  15.  15.",
      "",
      " Regional Plume",
      "    BCKPMF  20.  20.  20.  20.  20.  20.  20.  20.  20.  20.  20.  20.",
      "    OFRAC  .20  .20  .25  .35  .25  .40  .40  .40  .30  .30  .30  .20",
      "    VCNX    15.  15.  15.  15.  15.  15.  15.  15.  15.  15.  15.  15.",
      "",
      " Urban - no controls present",
      "    BCKPMF 100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100. 100.",
      "    OFRAC  .30  .30  .35  .35  .35  .55  .55  .55  .35  .35  .35  .30",
      "    VCNX     2.   2.   2.   2.   2.   2.   2.   2.   2.   2.   2.   2.",
      "",
      "Default: Clean Continental",
      "! BCKPMF = !",
      "! OFRAC  = !",
      "! VCNX   = !",
      "",
      "! NDECAY = !",
      "",
      "! END ! // end SECTION 11 - PART A",
      "",
      "NDECAY blocks assigning the half-life for a parent species and mass yield",
      "factors for each child species (if any) produced by the decay.",
      "",
      "                  half-life (sec), mass yield factor",
      "! SPEC1         = ! (parent)",
      "! SPEC2         = ! (child)",
      "",
      "! END ! // end SECTION 11 - PART B",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "12 -- Misc. Dispersion and Computational Parameters",
      "",
      "! SYTDEP = !",
      "! MHFTSZ = !",
      "! JSUP   = !",
      "! CONK1  = !",
      "! CONK2  = !",
      "! TBD    = !",
      "",
      "Range of land use categories for which urban dispersion is assumed",
      "! IURB1 = !",
      "! IURB2 = !",
      "",
      "Site characterization parameters for single-point meteorological data files ",
      "! ILANDUIN = !",
      "! Z0IN     = !",
      "! XLAIIN   = !",
      "! ELEVIN   = !",
      "! XLATIN   = !",
      "! XLONIN   = !",
      "! ANEMHT   = !",
      "! ISIGMAV  = !",
      "! IMIXCTDM = !",
      "! XMXLEN   = !",
      "! XSAMLEN  = !",
      "! MXNEW    = !",
      "! MXSAM    = !",
      "! NCOUNT   = !",
      "! SYMIN    = !",
      "! SZMIN    = !",
      "! SZCAP_M  = !",
      "",
      "Default minimum turbulence velocities sigma-v and sigma-w",
      "for each stability class over land and over water",
      "",
      "                   ----------  LAND  ----------    ---------  WATER  ----------",
      " Stability Class :  A    B    C    D    E    F      A    B    C    D    E    F",
      "                   ---  ---  ---  ---  ---  ---    ---  ---  ---  ---  ---  ---",
      "   Default SVMIN : .50, .50, .50, .50, .50, .50,   .37, .37, .37, .37, .37, .37",
      "   Default SWMIN : .20, .12, .08, .06, .03, .016,  .20, .12, .08, .06, .03, .016",
      "",
      "! SVMIN = !",
      "          ",
      "! SWMIN = !",
      "",
      "! CDIV    = !",
      "! NLUTIBL = !",
      "! WSCALM  = !",
      "! XMAXZI  = !",
      "! XMINZI  = !",
      "",
      "Default wind speed classes",
      "ISC RURAL : 1.54, 3.09, 5.14, 8.23, 10.8 (10.8+)",
      "! WSCAT = !",
      "",
      "Default wind speed profile power-law",
      "ISC RURAL : .07, .07, .10, .15, .35, .55",
      "ISC URBAN : .15, .15, .20, .25, .30, .30",
      "! PLX0 = !",
      "",
      "Default potential temperature gradient for stable classes E, F (degK/m)",
      "! PTG0 = !",
      "",
      "Default plume path coefficients for each stability class ",
      "",
      "Stability Class :  A     B     C     D     E     F",
      "Default PPC     : .50,  .50,  .50,  .50,  .35,  .35",
      "! PPC = !",
      "",
      "! SL2PF = !",
      "",
      "! NSPLIT   = !",
      "! IRESPLIT = !",
      "",
      "! ZISPLIT = !",
      "! ROLDMAX = !",
      "",
      "! NSPLITH  = !",
      "! SYSPLITH = !",
      "! SHSPLITH = !",
      "! CNSPLITH = !",
      "",
      "! EPSSLUG = !",
      "! EPSAREA = !",
      "! DSRISE  = !",
      "",
      "! HTMINBC = !",
      "",
      "! RSAMPBC = !",
      "",
      "! MDEPBC = !",
      "",
      "! END ! // end SECTION 12",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "13 -- Point source parameters",
      "",
      "Number of point sources with parameters provided below",
      "! NPT1 = !",
      "",
      "Units used for point source emissions below",
      "! IPTU = !",
      "",
      "Number of source-species combinations with variable",
      "emissions scaling factors",
      "! NSPT1 = !",
      "",
      "Number of point sources with variable emission parameters",
      "provided in an external file",
      "! NPT2 = !",
      "",
      "! END ! // end SECTION 13 - Part A",
      "",
      "Point Source: Constant Data",
      "",
      "  Source       X         Y       Stack    Base     Stack    Exit  Exit    Bldg.  Emission",
      "   No.     Coordinate Coordinate Height Elevation Diameter  Vel.  Temp.   Dwash   Rates",
      "              (km)      (km)       (m)      (m)       (m)  (m/s) (deg. K)         ",
      "  ------   ---------- ---------- ------  ------   -------- ----- -------- ----- --------",
      "   1 ! SRCNAM = !",
      "   1 ! X = ! ",
      "   1 ! ZPLTFM = !",
      "   1 ! FMFAC  = !  ! END !",
      "",
      "Building dimension data for sources subject to downwash",
      "",
      "Source     Effective building height, width, length and X/Y offset (in meters)",
      "No.        every 10 degrees. LENGTH, XBADJ, and YBADJ are only needed for",
      "           MBDW = 2 (PRIME downwash option)",
      "------     --------------------------------------------------------------------",
      "",
      "",
      "Point Source: Variable Emissions Data",
      "",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "14 -- Area source parameters",
      "",
      "Number of polygon area sources with",
      "parameters specified below",
      "! NAR1 = !",
      "",
      "Units used for area source emissions below ",
      "! IARU = !",
      "",
      "Number of source-species combinations with variable",
      "emissions scaling factors",
      "! NSAR1 = !",
      "",
      "Number of buoyant polygon area sources with variable",
      "location and emission parameters",
      "! NAR2 = !",
      "",
      "! END !",
      "",
      "Area Source: Constant Data",
      "",
      "Source           Effect.    Base      Initial    Emission",
      " No.             Height   Elevation   Sigma z     Rates",
      "                   (m)       (m)        (m)      ",
      "-------          ------    ------     --------   ---------",
      "",
      "",
      "",
      "           COORDINATES (km) FOR EACH VERTEX(4) OF EACH POLYGON",
      "           --------------------------------------------------------",
      "Source                                                               a",
      " No.       Ordered list of X followed by list of Y, grouped by source",
      "------     ------------------------------------------------------------",
      "",
      "",
      "Area Source: Variable Emissions Data",
      "",
      "",
      "",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "15 -- Line source parameters",
      "",
      "Number of buoyant line sources with variable",
      "location and emission parameters",
      "! NLN2 = !",
      "",
      "! NLINES = !",
      "! ILNU   = !",
      "! NSLN1  = !",
      "! MXNSEG = !",
      "! NLRISE = !",
      "! XL     = !",
      "",
      "! HBL = !",
      "",
      "! WBL     = !",
      "! WML     = !",
      "! DXL     = !",
      "! FPRIMEL = !",
      "",
      "! END !",
      "",
      "Buoyant Line Source: Constant Data",
      "",
      "Source     Beg. X      Beg. Y      End. X    End. Y     Release    Base        Emission",
      " No.     Coordinate  Coordinate  Coordinate Coordinate  Height    Elevation      Rates",
      "            (km)        (km)        (km)       (km)       (m)       (m)          ",
      "------   ----------  ----------  ---------  ----------  -------   ---------    ---------",
      "",
      "",
      "",
      "Buoyant Line Source: Variable Emissions Data",
      "",
      "",
      "",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "16 -- Volume source parameters",
      "",
      "Number of volume sources with parameters provided",
      "! NVL1 = !",
      "",
      "! IVLU  = !",
      "! NSVL1 = !",
      "! NVL2  = !",
      "",
      "! END !",
      "",
      "Volume Source: Constant Data",
      "",
      "         X           Y        Effect.    Base     Initial    Initial    Emission",
      "     Coordinate  Coordinate   Height   Elevation  Sigma y    Sigma z     Rates",
      "        (km)       (km)         (m)       (m)        (m)       (m)      ",
      "     ----------  ----------   ------    ------    --------   --------   --------",
      "",
      "",
      "",
      "",
      "Volume Source: Variable Emissions Data",
      "",
      "",
      "",
      "",
      "-------------------------------------------------------------------------------",
      "",
      "17 -- Non-gridded (discrete) receptor information",
      "",
      "Number of non-gridded receptors",
      "! NREC = !",
      "",
      "! END !",
      "",
      "Discrete receptor data",
      "",
      "            X (km), Y (km), ground elevation (m), height above ground (m)",
      "1     ! X = !  ! END !",
      ""), "calpuff_template.txt", sep = "\n")
  
}
rich-iannone/PuffR documentation built on May 27, 2019, 7:46 a.m.