Changes between Initial Version and Version 1 of FpCtbtoWo4PreprocessingUtil


Ignore:
Timestamp:
Nov 6, 2015, 8:40:11 AM (8 years ago)
Author:
dearn
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • FpCtbtoWo4PreprocessingUtil

    v1 v1  
     1
     2= Preliminary background on grib2flexpart utility =
     3
     4grib2flexpart is a command line utility that processes ECMWF and GFS input data into an intermediate format (''.fp'')directly readable by FLEXPART. The main idea is that meteorological fields do not need to be read in and the parameters recalculated multiple times.
     5
     6Several issues needed to be addressed:
     7
     8* Decide what variables we think we need to save to .fp files - all the related variables in com_mod.f90 
     9* Decide what source files should go into the library - that would be all the ones in charge of reading the meteorological data, checking it and calculating the parameters needed for FLEXPART to run
     10* Inititate a conceptual drafting of the  procedures/algorithm inlcuding the treatment of the reading of the AVAILABLE files and the gridchecking.
     11
     12
     13The conceptual approach, which makes use as much as possible of original source code from FLEXPART,  is as follows:
     14
     15'''''image missing'''''
     16
     17----
     18
     19= GRIB2FLEXPART UTILITY =
     20
     21
     22== Procedure for preprocessing of GRIB data ==
     23
     24=== 1. Preprocessing ===
     25
     26There are currently two options for execution based on the same developed software:
     27
     28a) '''Command line''' option: this option is meant to process one file or a list of ordered files via command line execution. The main characteristics are as follow:
     29   - Execution line:
     30    {{{
     31       GRIB2FLEXPART forward/backward <lsubgrid> <output directory> <source file> [<source file>...]
     32    }}}
     33
     34   - the output directory is not generated automatically, the user needs to ensure that the directory already exists
     35   - no configuration files are parsed
     36   - the lsubgrid flag can be set to 1 or 0. The normal FLEXPART user will set it to 1.
     37   - ''GRIB2FLEXPART'' processes files in the order provided on command line in forward mode and in reverse order in backward mode. This leads to the same results as in the usual functioning of ''flexpart''
     38   - the output files are named <source file>_<fwd|bwd>.fp
     39   - This option will initialise the FLEXPART internal vertical coordinate system from the first file. If a list of files is provided they will all have the same vertical grid. If, on the contrary, one file is processed at a time, each time the vertical coordinate system will be reinitialised to match the processed file.
     40   - The nested runs should be done one at a time per timestamp and together mother and nest.
     41
     42b) '''Use Available''' option: this option makes use of the structure of FLEXPART and uses the pathnames, AVAILABLE and COMMAND files to process the meteorological data.
     43   - Execution line:
     44    {{{
     45        GRIB2FLEXPART useAvailable <output directory>
     46    }}}
     47   - pathnames, AVAILABLE and COMMAND configuration files are read in
     48   - the output directory is not generated automatically, the user needs to ensure that the directory already exists
     49   - ''grib2flexpart'' preprocesses only those GRIB files which would be read by ''flexpart'' and in the same order as in ''flexpart'' since it uses the same input and configuration files.
     50   - the output files are named <source file>_<fwd|bwd>.fp
     51   - This option will initialise the FLEXPART internal vertical coordinate system from the first file as it is usually done by FLEXPART
     52
     53The two options, and the reusing of FLEXPART source code for each of them, is exemplified in the following diagram:
     54
     55
     56'''''image missing'''''
     57
     58
     59===  2. Execution of FLEXPART with preprocessed data ===
     60- The COMMAND file is extended to support a new PREPROCESSED_DATA parameter. If set to 1, ''flexpart'' uses preprocessed data instead of GRIB files.
     61- The AVAILABLE file has no changed format. It will have to be copied to the location where the fp files are stored and adapt the pathnames file accordingly.
     62
     63=== 3. Software package===
     64
     65- ''GRIB2FLEXPART'' is a part of flexpart source code package and by default it is built together with ''flexpart'' executable (''make -f makefile.gfortran'')
     66- It is possible to build ''grib2flexpart'' and/or ''flexpart'' separately by calling ''make -f makefile.gfortran flexpart'' or ''make -f makefile.gfortran grib2flexpart''
     67
     68
     69----
     70
     71
     72
     73== EXAMPLES OF USAGE ==
     74
     75
     76'''Pre-processing using useAvailable'''
     77
     78- Prepare files and directories for test. Test directory should contain:
     79  - pathnames
     80  - options directory (including COMMAND file)
     81  - met_data directory (including AVAILABLE file, '''copied from original met_data, without any changes - these should look exactly like the AVAILABLE file you would use with GRIB data''')
     82{{{
     83     DATE     TIME         FILENAME     SPECIFICATIONS
     84     YYYYMMDD HHMISS
     85     ________ ______      __________      __________
     86     20140919 000000      EL14091900      ON DISC
     87     20140919 030000      EL14091903      ON DISC
     88     20140919 060000      EL14091906      ON DISC
     89}}}
     90  - preprocessed_data directory (empty)'''
     91- In options/COMMAND, add new parameter PREPROCESSED_DATA at the end of the parameter list. For preprocessing, value is not important but parameter must be defined so that readcommand routine succeeds.
     92- While in test case directory, run command "''GRIB2FLEXPART useAvailable preprocessed_data''"
     93- FP data are created in preprocessed_data directory.
     94
     95Differences compared to original Flexpart test case:
     96- PREPROCESSED_DATA parameter in COMMAND file must exist
     97
     98'''Running FLEXPART using preprocessed data'''
     99- Prepare files for test. Test directory should contain:
     100  - pathnames
     101  - options directory
     102  - preprocessed_data directory
     103  - preprocessed_data/AVAILABLE ('''copied from original met_data, without any changes''')
     104  - output directory (empty)
     105- In pathnames, change met_data to preprocessed_data and met_data/AVAILABLE to preprocessed_data/AVAILABLE
     106- In options/COMMAND, set PREPROCESSED_DATA parameter to 1
     107- Run FLEXPART
     108Differences compared to original Flexpart test case:
     109- PREPROCESSED_DATA parameter in COMMAND file must exist and the value must be 1
     110- paths in pathnames must point to preprocessed data instead of original GRIB files
     111
     112'''Pre-processing using command line, for ecmwf_tiny/so_simple_ec_33h_fwd test case'''
     113- Prepare files and directories for test. Test directory should contain:
     114  - met_data directory
     115  - preprocessed_data directory (empty)'''
     116- While in test case directory, run command "''GRIB2FLEXPART forward 1 preprocessed_data met_data/EL14091815 met_data/EL14091818 met_data/EL14091821 met_data/EL14091900 met_data/EL14091903 met_data/EL14091906 met_data/EL14091909 met_data/EL14091912 met_data/EL14091915 met_data/EL14091918 met_data/EL14091921 met_data/EL14092000''"
     117- FP data are created in preprocessed_data directory.
     118Differences compared to original Flexpart test case:
     119The standard Flexpart setup of config files is not needed at all in this case. Everything is provided on the command line.
     120
     121'''Running FLEXPART using GRIB data'''
     122- Prepare files for test. Test directory should contain:
     123  - pathnames
     124  - options directory
     125  - preprocessed_data directory
     126  - preprocessed_data/AVAILABLE
     127  - output directory
     128- In options/COMMAND, set PREPROCESSED_DATA parameter to 0
     129- Run FLEXPART
     130Differences compared to original Flexpart test case:
     131- PREPROCESSED_DATA parameter in COMMAND file must exist and the value must be 0
     132
     133
     134----
     135
     136
     137
     138== DISCUSSION ==
     139
     140=== Vertical grid coordinates ===
     141
     142__Issue__
     143
     144In FLEXPART the internal vertical coordinate system is initialised from the first meteorological file read in (that is, from its surface pressure and the orography field at the lower left corner of the met domain). If this is not treated in a consistent way, and the first file read in is different every time, then the vertical coordinate system and, when passed through the testing environment, errors appear.
     145
     146__ Approach__
     147
     148There are three different approaches possible and only two have been prepared and made ready available to CTBTO. The two provided options are as follows:
     149
     1501. '''Option A''':  produce the meteo file as they would be used in FLEXPART, in the exact same order. That means that, instead of processing one set of new files per day, every day a whole set of 15 days of meteorological data should be redone,but just twice: one forward and one backward. And they could use then these files for any simulation within that time frame. The run time would still be significantly reduced since the transformations on the fly would be skipped. In this option, the utility grib2flexpart would process all the 15 days meteo files at once to ensure the vertical grid is initialised with the first meteo data and then the data is useful for any runs following the same temporal configuration. This option is the one traditionally used in other modelling systems (CMAQ, WRF-CHEM, WRF, HYSPLIT …) whereby the user processes the meteorological driving data to match the runs to be done.   Option A makes use of many of the structures in FLEXPART, going through reading of AVAILABLE, gridcheck until the processing of the meteorological data in getfields.
     151
     1522. '''Option B''':  this option is a trade-off and imply some potential inconsistency in the treatment of the vertical coordinates. In this option we guarantee that only one single day of data needs to be processed (for backward and forward) nevertheless, although the number of internal vertical levels is kept the same, each time a file is generated a new system is initialised. For this case, each meteorological file (or in case of nests, mother and nest at the same time) may be processed via command line.
     153
     154The third approach (Option C) is a combination of both and require the generation of one additional control file (with the risk it implies of being lost, moved…). This option would need a routine to initialise the vertical grid into a file (for GFS, ECMWF and for nests) with the height(kz) variable. This file should be read in at the time of processing the binary files.
     155
     156__Impact__
     157
     158There are two main impacts related to this issue:
     159
     1601. Two options are provided instead of one and duplication is not necessarily good.
     161
     1622. Potential inconsistencies (with undetermined effect in the final concentrations, we do not expect it to be very large due to the interpolations performed during runtime, but some sensitivity tests are needed) in the vertical treatment.
     163
     164
     165=== Nested configuration ===
     166
     167__Issue__
     168
     169FLEXPART running with ECMWF data has the potentiality of using nested input with increasing horizontal resolution. The vertical resolution of the input data is not allowed to change from mother to nest. This means that, in order to read nested domains and process them properly, a mother domain must be read in first (gridcheck.f90 and verttransform.f90 are the routines in charge of initialising the vertical grid).
     170
     171__Approach__
     172
     173Two actions has been taken to handle input nests properly:
     174
     1751. the fp binary files for the nests are not produced as standalone files. Both a mother and a nest are processed for the same timestamp and one single fp binary files is produced.
     176
     1772. the just mentioned mother and nest into a single fp file approach implies that FLEXPART, in the case of working with fp files, will not go through gridcheck and gridcheck_nest routines but only one time through fpgridcheck routine, that has been programmed specifically to check the input fp files in terms of dimensions.
     178
     179__Impact__
     180
     181There are two impacts resulting from this issue:
     182
     1831. fp binary files must be processed for mother and nest together into one single fp file
     184
     1852. the usual workflow of FLEXPART has been modified to account for the single fp file including the meteorological data from the mother and nested inputs.
     186
     187
     188=== Specific options and compatibility ===
     189
     190__Issue__
     191
     192This WO has included modifications of existing code and addition of functionalities. Nevertheless, traditional FLEXPART use had to be ensured.
     193
     194__Approach__
     195
     196The additional routines needed for handling the fp fp formats are provided with the source code and can be compiled with them. A new set of additional makefiles are provided to the user to compile single or multiple components of the new system. In order to activate the different routines and options, ifdef directive have been added throughout the code allowing for conditional use of routines or section of routines and thus limit to a minimum the modifications in the options files.
     197
     198This has been supported by documentation.
     199
     200__Impact__
     201
     202New set of makefiles and additional compilation steps if the grib2flexpart and related libraries are needed.
     203
     204=== Deep convection ===
     205
     206__Issue__
     207
     208FLEXPART has the option to run with deep convection. Due to its computational demands, the common user, included CTBTO so far, opts out this feature.  This option requires additional handling of the meteorological input data and therefore the independent treatment of GFS, ECMWF and nested meteorological fields.
     209
     210__Approach__
     211
     212It is clear that to include deep convection, the variables needed for it must be stored in the fp binary files. They are indeed included. Nevertheless, the new routines to read in those and used them are not yet developed.
     213
     214Investigations in this direction have already been done. The routines involved vary in algorithms depending on whether it is ECMWF data or NCEP data. For the former, native ECMWF levels are used whereas for the GFS version, the FLEXPART native model vertical levels are the ones used. Given that the fp files are already in native coordinates, the routines that will be kept are the ones from GFS.  Initial tests show that the code automatically handles this but it would require further testing.
     215
     216__Impact__
     217
     218Deep convection has not yet been fully implemented for runs initialiased by fp data
     219
     220
     221
     222