Files
mozart_to_wrf
Folders and files
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
The WRF utility, mozbc, a single cpu code, maps species concentrations from Mozart datasets to WRF concentrations for initial condition and boundary condition datasets. The utility is setup for Mozart species concentrations to be in volume mixing ratio and WRF species concentrations to be either part per million, ppm, volume mixing ratio or part per billion , ppb, mass mixing ratio depending on whether the WRF species is gas phase or aerosol. The mozbc utility allows for a versatile mapping from each WRF species to the Mozart species including multiple Mozart species per single WRF species with : (a) an individual weight factor per Mozart species (b) an overall conversion factor per WRF species Mozbc reads a namelist input file that specifies all aspects of the mapping from Mozart to WRF and checks key namelist control variables for validity. Below is a complete listing of all namelist control variables. Before invoking mozbc you must have a WRF initial condition file per WRF domain and/or a WRF boundary condition file for the first WRF domain. Standard WRF initial condition files are denoted : wrfinput_d<nn> where <nn> represents the domain number in two digit,integer format Thus the standard initial condition file for WRF domain number 1 is : wrfinput_d01 Similarly the standard WRF boundary condition file is denoted : wrfbdy_d01 The WRF initial condition files will contain species concentrations for one time point; the simulation start time. The WRF boundary condition file will contain concentrations for two or more time points. In fact the boundary condition file must cover the entire WRF simulation time span. The Mozart datasets are interpolated in space; bilinearly in longitude, longitude and linearly in pressure. However, the Mozart datasets are NOT temporally interpolated. If a Mozart dataset with a time matching the WRF time can not be found then mozbc error halts. Building mozbc ======== ===== In the mozbc source code directory issue the command : make_mozbc That's it. The make_mozbc script is presently setup to compile on either Linux or AIX systems using the Portland Group Fortan90 compile, pgf90, on Linux system or the xlf90 compiler on IBM AIX systems. If you need to use another compiler such as the Intel Fortran90 compiler, ifort, you can set the environment variable FC before invoking make_mozbc. As an example you would issue the command : export FC=ifort in the sh, bash, or ksh Linux shells or setenv FC ifort in the csh or tcsh shells. Presently the make_mozbc utility recognizes the following FC settings : pgf90 (PGI) gfortran (GNU) ifort (Intel) lf95 (Lahey) xlf90 (IBM) The mozbc utility requires the netcdf library and make_mozbc will attempt to locate the libnetcdf.a library. However, this is not a foolproof process and thus you may need to set the environment variable NETCDF_DIR to the directory containing the file lib/libnetcdf.a. As an example in the ksh shell, if you issued the command : export NETCDF_DIR=/usr/local/netcdf-3.6.2 then make_mozbc would look for the file libnetcdf.a in the directory /usr/local/netcdf-3.6.2/lib (make_mozbc automatically appends the /lib string to the NETCDF_DIR string. If you require assistance with compiler and/or netcdf issues send email to : [email protected] Namelist control variables ======== ======= ========= Variable name Variable type default value -------- ---- -------- ---- ------- ----- do_bc logical,scalar .false. do_ic logical,scalar .false. dir_wrf character(len=100),scalar (None) dir_moz character(len=100),scalar (None) fn_moz character(len=100),scalar (None) spc_map character(len=164),array (None) domain integer,scalar 1 bdy_cond_file_prefix character(len=100),scalar 'wrfbdy' init_cond_file_prefix character(len=100),scalar 'wrfinput' moz_var_suffix character,scalar '_VMR_inst' met_file_prefix character,scalar 'met_em' met_file_suffix character,scalar '.nc' met_file_separator character(len=1),scalar '.' surf_press_name character,scalar 'PSFC' def_missing_var logical,scalar .false. Of the first six namelist variables either do_bc and/or do_ic must be set to .true. or mozbc will do nothing. If either do_bc and/or do_ic are .true. then the next four of the first six variables must be set or mozbc will error halt. None of the remaining namelist variables need be set and often are not as the defaults cover most situations. Namelist variable notes ======== ======== ===== do_bc, do_ic Controls whether or not WRF initial(do_ic) and/or boundary(do_bc) conditions are set from Mozart input. You may have one or both do_ic, do_bc set to .true. . Remember, per domain, WRF initial and boundary condition files, defaulting to wrfinput_d<nn> and wrfbdy_<nn>, must be present in the directory defined by the dir_wrf namelist variable. dir_wrf Specifies the directory where mozbc expects to find all WRF datasets which include the initial and boundary condition files for each domain and the WRF meterological files whose file name is specified by the met_file_... namelist variables. Note that dir_wrf must end with a "/" as in : /myhome/WRF_data/ dir_moz Specifies the directory where mozbc expects to find all Mozart datasets. Again dir_moz must end with a "/" as in : /myhome/mozart_data/ fn_moz Specifies the initial mozart data filename in the dir_moz directory. Mozbc will attemp to find the first WRF time, either from the WRF initial or boundary condition file, in the file fn_moz. If mozbc can not find an exact match for the WRF time then mozbc will error halt. fn_moz must be of the form : prefix<nnn>.nc where : prefix is any set of legal filename characters that is fixed for all Mozart datafiles such as "h" <nnn> represents any string of integer digits that comprise a valid fortran interger such as "0001" Thus the following is a valid fn_moz specification : hb0032.nc Note that if need be mozbc will increment the fn_moz filename to look for matching times once the end of the fn_moz file has been reached. spc_map Specifies the mapping between WRF and Mozart variables. src_map is a character array of size 500. If you enter more 500 variables there is no error halt but only the first 500 will be mapped. Each entry in the is of the form : <WRF_variable> -> multiplier * <Mozart_variable> + multiplier * <Mozart_variable> ; conversion_factor or <WRF_variable> = specified_value Where <WRF_variable> is the exact name of the WRF variable as it appears in the intial and/or boundary condition files. multiplier is any legal,positive fortran real or integer number. multiplier defaults to 1. and may vary from Mozart variable to Mozart variable. <Mozart_variable> is the exact name prefix for a variable in the Mozart datasets. The moz_var_suffix will be attached to each Mozart variable. You may have any number of Mozart variables per each WRF variable. conversion factor is an optional mapping factor that is applied to the sum of the weighted Mozart variables making up the WRF variable. It must be a valid fortran real or integer number. For gas phase WRF species conversion_factor defaults to 1.e6. For WRF aerosol species the default conversion_factor is 1. specified_value is any legal,positive fortran real or integer number. Please note that the delimiter "=" is used to separate the WRF species from the numeric value whereas the "->" delimiter is used for WRF species whose values will be formed by interpolating Mozart variable(s). The value denoted by specified_value will be assigned to the WRF initial, boundary condition at all spatial points. Furthermore, in the case for boundary conditions the specified_value will be assigned at all WRF times. Individual entries in the src_map namelist variable are separated by commas and each entry must fit on a single line in the input file. Each src_map entry is limited to 164 characters. The following are three examples of src_map specification; as such they are each only for one WRF variable. spc_map = 'o3 -> O3' map the Mozart variable O3_VMR_inst to the WRF variable o3 presuming the default moz_var_suffix. spc_map = 'o3->O3','o -> .75 * O1D + .25 * O1S' map as in the prior example and add a weighted combination of Mozart variables O1D and O1S to set WRF variable o. spc_map = 'ch4 = .034' set the WRF variable ch4 initial condition or boundary condition to .034 ppm at all spatial points. domain Specifies the total number of WRF domains. Defaults to 1. Remember if for instance you set : domain = 2 Then with standard prefixes mozbc will expect to find files : wrfinput_d01, wrfinput_d02 and/or wrfbdy_d01, wrfbdy_d02 in the dir_wrf directory depending on the do_bc, do_ic settings. bdy_cond_file_prefix Specifies the prefix string for the WRF boundary condition files. All such files are of the form bdy_cond_file_prefix_d<nn>. Defaults to wrfbdy. init_cond_file_prefix Specifies the prefix string for the WRF initial condition files. All such files are of the form init_cond_file_prefix_d<nn>. Defaults to wrfinput. moz_var_suffix Specifies the suffix string for all Mozart variables. Defaults to "_VMR_inst". A common variation is : moz_var_suffix = '_VMR_AVRG' met_file_prefix Specifies the prefix string for the WRF meterological files. WRF meterological files have the standard naming convention of : met_em.d<nn>.<date>.nc for em_real simulations where <nn> is as before a two digit integer and <date> is a WRF date format yyyy-mm-dd_hh:mm:ss wherein yyyy = four digit year mm = two digit month of year dd = two digit day of month hh = two digit hour of day mm = two digit minutes of hour ss = two digit seconds of minute The default setting for met_file_prefix is "met_em". met_file_suffix Specifies the suffix string for the WRF meterological files. The default value is ".nc" met_file_separator Specifies the separator character for the WRF meterological files. The default value is ".". This character separates the met_file_prefix, d<nn>, <date>, and met_file_suffix components in the met file filename. surf_press_name Specifies the name of the surface pressure variable in the WRF meterological files. Defaults to "PSFC". def_missing_var Specifies whether or not to add a WRF variable specified in the spc_map input if the WRF initial and/or boundary condition files do NOT have the indicated variable. As an example, if in the above example for spc_map the WRF variable o3 does not exist in the WRF initial condition file and do_ic == .true. then mozbc will add the variable o3 to the WRF initial condition file and do the interpolation from the Mozart dataset to the WRF variable. Running mozbc ======= ===== To run mozbc issue the command: mozbc < mozbc.inp > mozbc.out (Redirected input is required. Redirected output to mozbc.out is optional. The mozbc.inp and mozbc.out filenames are for illustration only; you may use any valid filename in place of mozbc.inp, mozbc.out)