LAPMOD SETUP INIT SRAND GETARG READINP WR_PID PROGRESS STARTLOG LSTRIM PRINT_DTZ RNPCHK LEAPYR LSTRIM OPNFIL LSTRIM WRITINP READREC LSTRIM SETMET METHDR ADD_DELTA_HOURS DAYNUM GET_DATE LEAPYR LSTRIM LUSELAB CHKMET ADD_DELTA_HOURS DAYNUM SETDOM LATLON UTM2LL METDAT SETNMET METDAT METHDR … see above SETDOM … see above SETTIM DAYNUM GETDUR SETSUB LSTRIM RTBIS SETEMI SOUCHKPOL SOUCHK LSTRIM RECOGN ODORING SETREC CAPTOSM LSTRIM WRITINP LSTRIM WRHEAD PROGRESS MET METHDR METDAT METTI INTRT1 INTRT2 INTRT3 INTRT4 TURPROC2 SIGTL_FLB EMI RDEMI GETDUR DAYNUM PRJJ CREAVAR_JJ DENSITY_WET PROFILI_JJ COMP_WSWD DENSITY_WET INTERP1D PVH2O STACKTIP DERIVS_JJ DENSITY_WET ENTRAINMENT_JJ WAXIS_JJ PROFILI_JJ (see above) TEMLIQVIS GETQS TIMPLIC WAXIS_JJ LSTRIM PRJJ_COMP RK4_JJ DERIVS_JJ (see above) PRWT CREAVAR_WT DENSITY_WET PROFILI_WT COMP_WSWD DENSITY_WET INTERP1D T2THETA T2THETA STACKTIP DERIVS_WT DENSITY_WET ENTRAINMENT_WT PROFILI_WT TEMP_WT THETA2T WAXIS_WT LSTRIM PRWT_COMP RK4_WT DERIVS_WT PAPLPE CLOCKS IDSET GENERA FHOLE FNDXYZ GENXYZPOL LOPCT GENXYZ PMOVE DEPOSD AERRES VDEPAER VSETTL DEPOSW FNDXYZ GETVAR2 FNDTS MOVE RND_GAUSS_PR NEWFLU RND_GAUSS RAND RBNDS OUTPUT OUTPUT_P LSTRIM WRINFO OUTPUT_C CALCCONC CALCCONCR CALCCONCR_SA WROUT A2TOA1 LSTRIM PREPNAME LSTRIM WRINFO WRITE_ESRI_GRD_1D LSTRIM WRITE_SURFER_GRD_1D WROUTR_BIN WROUTR LSTRIM WRITE_REC WROUTR_SA LSTRIM WRITE_REC OUTPUT_D CALCDEP DECAYDEP WROUT OUTPUT_K OUTPUT_P … see above FINDXYZ OUTPUT_C … see above UPDATE PROGRESS PRINT_DTZ DATE_AND_TIME ENDSIM LSTRIM
LAPMOD consists of many Fortran routines that are related as shown in the call tree presented in the box beside, while the scope of each routine is described in the following table.
Routine | Scope |
LAPMOD | Main program of LAPMOD. |
PRINT_DTZ | This routine prints date, time and time zone on open output units. It is called at simulation start and simulation end. |
SETUP | This routine reads the LAPMOD input variables from the main input file. It checks that inputs are correct and consistent. It opens the files containing the emissions of active species and the meteorology. It computes the duration of the simulation in seconds and it reads the simulation start date from the meteorological input file (it reads the file up to the hour preceding the start of the dispersion simulation). It initializes the random numbers sequence via several calls to the generator. It transforms UTM coordinates (as they are in the meteo file) to relative coordinates with origin in (0,0). |
INIT | This routine initializes all variables and matrices. |
READINP | This routine reads an input file, extracts the record between two text delimiters (generally two exclamation marks) and it reads the input value contained in the record. |
READREC | This routine reads from a string the pair of variables description and value. Values must be separated from their descriptions with an equal sign '=' (for example number of grids = 33). Values can be REAL, INTEGER, CHARACTER or LOGICAL, as specified from the input variable IVAR. |
LSTRIM | This routine gives the length of a string after removing the ending blanks and the non-printable characters. |
RNPCHK | This routine checks for the correctness of input values (dates, parameters exceeding limit values, ...) and it makes assignments based on input values. |
OPNFIL | It opens the intermediate output file, if requested. It opens the CALMET output file (that is the meteorological input to LAPMOD) and it writes an error message if it does not find it. It opens the input file containing the emissions and it issues an error message if it does not find them. |
WRITINP | This routine writes the input values in the log file. |
WRHEAD | This routine writes the headers of the concentration binary file (if LBINC = T) |
SETMET | This routine starts reading the CALMET binary file when NMET=1. It reads the title record and the data records up to the hour preceding the one when the dispersion simulation starts. It estimates how many hours of meteorological data must be read before the simulation starts. The simulation start and end hours are LST, as in the CALMET binary output. The routine computes the turbulent parameters (sigmas and Lagrangian times) in every point of the grid. It computes the mean pressure and relative humidity values at ground using measurements. |
SETNMET | This routine manages the initial reading of CALMET files, in case NMET > 1. It reads the headers of all files and it checks that they refer to the same domain. Moreover, it checks that the CALMET files are listed in the correct time sequence, and that they cover the LAMOD simulation time interval. The routine starts reading from the first CALMET binary file the title record and the records with data until the hour preceding the hour when the dispersion simulation starts. The routine computes the turbulent parameters (sigmas and Lagrangian times) in every point of the grid. It computes the mean pressure and relative humidity values at ground using measurements. |
STACKTIP | This routine computes the reduced stack height, due to the stack tip downwash. |
ODORING | This routine controls and suggests specific options for odor emissions. |
METHDR | This routine reads the title record from the CALMET binary file. After the call to this routine, topography, landuse data and variables are stored in memory and the pointer is ready to read the meterological data. |
ADD_DELTA_HOURS | This routine increments a given date and time by a given number of hours. |
DAYNUM | This routine computes a day number. One of the more useful applications for this routine is to compute the number of days between two dates. |
LEAPYR | Logical function returning TRUE if it is a leap year, FALSE otherwise. |
GET_DATE | This routine computes the day (YEAR, MONTH, DAY) from the Julian day DAY_NUMBER. A DAY_NUMBER of unity will return Oct. 15, 1582. |
LUSELAB | This routine determines the labels to assign to each LANDUSE category. Assignments are made using the CALMET default categories (p 4-85 of the CALMET users' guide) |
SETDOM | This routine verifies that the output domain is within the meteorological domain of CALMET. It calculates the initial and final indices of meteorological grids to use. It computes dispersion domain parameters. It computes the index of the meteorological grids within which falls each LAPMOD output point. |
LATLON | This routine calculates latitude and longitude of a generic point (x,y) in the UTM zone IZ |
UTM2LL | This routine transforms UTM coordinates into longitude and latitude. |
METDAT | This routine reads the meteorological data from the CALMET binary output file. It reads one hour of meteorological data every time it is called. The Monin Obukhov length is read and immediately transformed to its inverse that will be used during the simulation. The vertical velocity exiting from this routine is in terrain following coordinates. |
SETREC | This routine reads the coordinates of the discrete receptors, if any exists, and it converts the coordinates in input to relative coordinates within the computational domain. |
CAPTOSM | This routine converts the file names substituting capital letters with small letters. |
SETTIM | This routine sets all the times that are needed for the simulation (about emissions, output...) |
GETDUR | This routine calculates the duration of a time interval, in seconds, between an initial date and a final date. |
SETSUB | This routine initializes the properties of radioactive substances. |
RTBIS | This function implements the erfc function diminished by a constant C |
SETEMI | This routine initializes the emission parameters. |
SOUCHK | This routine checks the validity of source parameters read in SETEMI. |
RECOGN | This routine recognizes the name of the substance and stores its position in the substances database. If the substance is not found in the database the code stops. |
MET | This routine reads a record from the CALMET meteorological binary file. |
RDEMI | This routine reads the sources' emission data: emission rate for each substance, temperature and emission speed, date and time of emission. |
CLOCKS | This routine computes the longest integration interval that is possible with current input value (IDT). It updates the current date of the simulation (IDCURS) and it updates the current Julian day. This routine also updates the main "clocks" of the model, all expressed in seconds:
|
IDSET | This routine updates the vector storing the date by the integration interval in seconds, IDT. |
GENERA | This routine generates the new particles and reorders their vectors. The number of particles depends from the duration of the release, the number of sources, the number of substances and, for aerosols, by the number of granulometric intervals (bins). |
FHOLE | This routine finds the first empty slot in the particles vector IHOLE. |
GENXYZ | This routine assigns the coordinates to the generated particles. |
GENXYZPOL | This routine assigns the coordinates to the generated particles, for polygon sources. |
LOCPT | This routine evaluates if a point is within a polygon. |
FNDXYZ | This routine finds the lower left indexes of the meteorological cell containing the particle. |
PMOVE | This routine moves the particles during the simulation, finds the index of the cell containing the particle and the normalized coordinate of the particle within such cell. It extracts and computes the meteorological variables at particle's location and it computes the maximum time step that can be used to move the particle with local turbulence conditions. The routine also checks for particles rebounds in the surface layer. |
GETVAR2 | This routine extracts the value of the meteorological variables in correspondence of the particle position for the FLB scheme. |
FNDTS | This routine computes the short integration time step to be used to move the particle. |
NEWFLU | This routine updates the random components of the particle velocity. |
RND_GAUSS | This routine computes a random number based on a Gaussian distribution with zero mean and unit standard deviation. |
RND_GAUSS_PR | This routine computes a random number based on a Gaussian distribution with zero mean and unit standard deviation. Used for plume rise induced turbulence. |
DEPOSD | This routine computes the dry deposition of gases and aerosols. |
AERRES | This routine computes the aerodynamic resistance as proposed in Seinfeld and Pandis (1998), p. 963. |
VSETTL | This routine computes the deposition velocity of particles with given diameter and the Schmidt number. |
VDEPAER | This routine computes the deposition velocity for aerosols. |
DEPOSW | This routine computes the wet deposition velocity for gases and aerosols as sum of the scavenging effects of rainout and washout processes. |
MOVE | This routine computes the new position of the particle. |
RBNDS | This routine computes the reflection of the particle in case the particle is below ZMIN (e.g. the roughness length is a possible choice) or if the particle is above ZINV. If the particle is above ZINV there are two possibilities and consequences: if (1) the particle was within the PBL at previous step, the vertical velocity fluctuation is set to 0. (2) If the particle was already outside, no action is taken. |
UPDATE | This routine updated the array pointers of the particles |
OUTPUT | This routine saves particles' position and computes concentration and deposition. |
OUTPUT_P | This routine saves particles' position on a file. |
WRINFO | This routine writes information about particles and substances. |
OUTPUT_D | This routine saves depositions on file. |
CALCDEP | This routine computes depositions. |
WROUT | This routine writes on output files (concentration or deposition). |
WROUT_BIN | This routine writes on binary output file. |
PREPNAME | This routine prepares the name of the output file. |
A2TOA1 | This routine extracts ARRAY1D = ARRAY2D(*,ISU) and optionally inverts the order of the elements. |
WRITE_ESRI_GRD_1D | This routine writes an ESRI ASCII GRID file. |
WRITE_SURFER_GRD_1D | This routine writes an ASCII Sufer GRD file. |
CALCCONCR | This routine computes the concentrations in correspondence of discrete receptors. |
CALCCONCR_SA | This routine computes the concentrations due to each source in correspondence of a single receptor, when the source attribution algorithm is activated. |
WROUTR | This routine writes concentrations for discrete receptors. |
WROUTR_SA | This subroutine prepares the contributions of each single source to the concentration at a single discrete receptor. |
WROUTR_BIN | This routine writes on binary file the output at receptors (concentration) |
WRITE_REC | This routine writes on output file the concentrations in correspondence of discrete receptors. |
OUTPUT_C | This routine writes the instantaneous and the integrated concentrations. |
CALCCONC | This routine computes the concentrations (instantaneous and integrated). |
ENDSIM | This routine closes the files and creates the empty .ok file in the output directory. |