Presentation is loading. Please wait.

Presentation is loading. Please wait.

Derek Mallia STILT tutorial v08/20/2015

Similar presentations


Presentation on theme: "Derek Mallia STILT tutorial v08/20/2015"— Presentation transcript:

1 Derek Mallia STILT tutorial v08/20/2015 Derek.Mallia@utah.edu
Weather Research and Forecasting – Stochastic Time-Inverted Lagrangian Transport (WRF-STILT) model Derek Mallia STILT tutorial v08/20/2015

2 PART I: STILT basics

3 Backward trajectory simulation using the WRF-STILT model for Hurricane Sandy
Why are the particles come from the SW and then from the SE. *HINT* we are by a Hurricane

4 Basics of the STILT model
The STILT model is a 4D (x,y,z,t) Lagrangian particle dispersion model (LDPM) for atmospheric transport The model was primarily developed to derive upstream source regions for a receptor Can also be used qualitatively to determine the source region of your air mass (similar to HYSPLIT) Driven by meteorological models/analyses such as the ECMWF, GDAS, NAM, and WRF However, WRF output cannot be directly used with the STILT model without converting the netcdf file format to “ARL” format which is used by the HYSPLIT model core in STILT For optimal results, time averaged mass fluxes are required (better mass conservation) [Nehrkorn et al., 2010] Much more difficult as this requires a working knowledge of WRF

5 For non-WRF analyses Go to: http://www.ready.noaa.gov/archives.php
I generally use these to get a “quick” first look Also good for using as an outer domain I.E if your particles leaves your outer WRF domain, you can still track them beyond that domain if you nest it with something like GDAS which is “global” Downside of these products? Generally, lower spatial and temporal resolution Worse mass conservation (see Nehrkorn et al. 2010) Not necessarily tailored to your needs GDAS domain Nested WRF domain

6 Basic STILT output Uinta Basin example: In the inversion…
Outside of the inversion…

7 Relevant papers for details
Lin, J.C., C. Gerbig, S.C. Wofsy, et al., A near-field tool for simulating the upstream influence of atmospheric observations: The Stochastic Time-Inverted Lagrangian Transport (STILT) model, J. Geophy. Res., 108(D16), 4493, doi: /2002JD003161, Nehrkorn, T., J. Eluszkiewicz, S.C. Wofsy, Lin, J.C., C. Gerbig, M. Longo, and S. Freitas. Coupled Weather Research and Forecasting--Stochastic Time-Inverted Lagrangian Transport (WRF-STILT) Model, Meteorology and Atmospheric Physics, 107, 51-64, 2010.

8 Cool model bro, where do I get this model?
First, need to download the STILT model by checking it out from our local SVN (type the following into your linux terminal): svn checkout Model uses name list file to run simular to that of WRF, however, can be ran using a “R” using the scripts provided in the stiltR directory Makes the model less clunky to use, however it requires becoming slightly familiar with R (very easy to use)

9 How do I compile STILT? After you have downloaded STILT from the SVN make yourself a working directory such as “STILT_modeling” mkdir STILT_modeling Copy the R scripts relevant for STILT (which are within the STILT_svn directory) to your working directory cp –R STILT_svn/trunk/stiltR STILT_modeling Copy from the stiltR subdirectory the file “setup.sh” in the newly created STILT modeling working directory and set the execution permission: cp STILT_modelling/stiltR/setup.sh STILT_modelling chmod +x STILT_modelling/setup.sh

10 Run the script “setup. sh”
Run the script “setup.sh”. This script will create some sub-directories (output, STILT_Exe) in the STILT modelling working directory and will setup some files for you. These files should include: A “stiltR” subdirectory STILT_Exe subdirectory Is is recommended that you install the following R libraries since many of the R scripts within stiltR will require them: foreign fields maps chron netcdf

11 cp hymodelc <your path>/STILT_modelling/STILT_Exe/Copy0/hymodelc
In addition, put the following line in your .bashrc file located in your home directory. This will set the path for the R libraries once you have them installed: export R_LIBS=/uufs/chpc.utah.edu/common/home/<USERNAME>/R/x86_64-unknown-linux-gnu-library/2.15/ Reset your terminal (close out and log back in) Compile an executable called “hymodelc” from source by entering the following directory: trunk/merged_stilt_hysplit/ To compile the STILT FORTRAN code type make into the command line and press enter (this will take approximately 30 seconds) Copy the hymodelc program from your merged_stilt_hysplit directory to your working STILT modeling directory that you created earlier, and stick it within the STILT_Exe/Copy0 cp hymodelc <your path>/STILT_modelling/STILT_Exe/Copy0/hymodelc

12 Great, if everything successfully compiled you should be ready to go!

13 How do I run STILT? There are two ways to run STILT, you can either run it from: The FOTRAN level by typing in hymodelc in your terminal within the Copy0 directory Or by running it using the R interface code which primarily uses the trajec.r code (this is the preferred method)

14 How does STILT work? STILT hymodec codes looks for several namelist files that are located within the executable directory STILT_Exe/Copy0/ CONTROL SETUP.CFG The CONTROL file determines the simulation time, length, which met fields are used, and the location of the receptor (lat/lon/agl height [m]) SETUP.CFC controls the STILT trajectory settings such as the timestep, number of trajectories, trajectory information such as lat/lon/temp/pressure ect…

15 CONTROL Only these lines need to be modified…
Line 1: year, month, day, hour Only these lines need to be modified… Line 3: lat, lon, agl height of receptor Line 4: simulation length (hours, negative denotes backwards simulation Line 7: number of met fields that we are going to use for our simulation Line 8-9: path of ARL formatted file, and ARL file name ***The order here is based on priority, use our high resolution WRF first, and if our trajectories drop out of that domain, look in the subsequent WRF domains (I.E STILT SUPPORTS nested MET fields! See STILThowtoV8.pdf for additional details

16 SETUP.CFG See STILThowtoV8.pdf for variable descriptions (REVIEW CAREFULLY!!!)

17 Type hymodelc into you command line once we have finished editing our CONTROL file…
If the CONTROL file was properly edited your code should be running! (will take a few minutes)

18 Sample output file…

19 WRF-STILT test case WRF-STILT test case files for August 15th 2012 can be found in at the following link: Met input files: wrfout_d01_aug.arl -WRF input file gdas1.aug GDAS input file Namelist files: CONTROL SETUP.CFG Sample output file for comparison: sample_PARTICLE.DAT

20 Running STILT using the stiltR interface
GDAS Let’s cd into the stiltR directory and get familiar with some of the most important subroutines Once your have your bearings lets open up 0wrf_stilt_tutorial.r with your favorite text editor Download this from the test case link from before and add the code to the stilt R directory… Enter R now (type R into the command line within the stiltR directory and run our tutorial code. While doing this we’ll need to set the appropriate variables to get it to run Note that this code via the trajec.r code will edit the CONTROL and SETUP.CDF files so we don’t have to do it manually! d01 d02 & 3

21 Hint The code that we really need to change is the following:
path<-"/home/johnlin/Rdat/" #path where output gets saved, #also input data (Receptor locations and times) #and boundary mixing ratio objects are read from 'path' metpath<-"/deas/group/stilt/Metdata/" #where met data are stored in ARL format, see tutorial about #important note for this link…. rundir<-"/home/johnlin/STILT/Exe/" #specifies main directory where different directories are found #to run hymodelc

22 Some Debugging Pro tips…
I primarily run it from FORTRAN when I’m debugging STILT RANDOM should be set to 0 in SETUP.CFG to use the same random seed, so that the pseudo-random trajectories always look the same when you repeat a run (for debugging purposes only). Otherwise set RANDOM = 1 (default setting).

23 Sample output when you’re done
Units: PPM / μmoles m-2 s-1

24 Sample output…

25 PART II: STILT w/ WRF

26 STILT model installed now what?
Need to get WRF data in ARL format and need to output specific variables that are required by the STILT model Involves installing a converter program and editing the WRF registry + recompiling the WRF Also had to fix some bugs as well No worries, I supplied the ARL converter code, additional FORTRAN fixes, and easy to read instructions for WRF registry editing: Directions for ARL converter code installation and running can be found here: Most of the starting steps can be skipped as I did this already! Don’t bother with having more than 100 WRF vertical levels… lots of ISSUES ZSG code can be found here (for STEP #8) :

27 Some PRO tips for installing the ARL converter… this is fairly easy if you KNOW what you are doing
The trick is to set the CORRECT PGI compilers, if you do this you’re going to be golden— (this is when compiling the hysplit library code) Also make sure you properly reference the hysplit library code when compiling the ARL converter All the gory details can be found in this document:

28 PART II: STILT-CO2 runs

29 Getting STILT to run CO2 simulations takes a fair share of work, especiall if you are doing this for the first time For example you need to match up STILT footprints with the correct emission and biospheric fluxes in space and time

30 Units: PPM / (μmoles m-2 s-1) Units: μmoles m-2 s-1
Footprint x Emissions = Contribution of emission source (mole fraction) Biomass Burning-derived CO emissions for : Units: PPM / (μmoles m-2 s-1) Units: μmoles m-2 s-1 μmoles m-2 s-1 X PPM /(μmoles m-2 s-1)

31 = concentration of species (ppm, ppb, other…)

32 This will then have to be done for all emission and flux types to get the total CO2 concentration which can be matched up to an observation In addition, you will also need to calculate the background concentration of CO2 (i.e your initial model condition) If done correctly you should get the following when you plot it up in a time series:

33 *Subtracted out the background in this example!

34 Sounds like a lot of work right? Yup!
But why reinvent the wheel when we have code lying around that does this!

35 This code then generates the footprints
Currently, we have STILT CO2 simulation code which runs trajectories for a receptor for a specified length of time This code then generates the footprints And with 3 subroutines the code matches your footprint with the emission/biospheric flux fields in time and space, automatically! Anthropogenic emissions Wildfire emissions (if relevant) Biospheric fluxes (if dealing with CO2) This code also has the ability to calculate the background CO2 concentration (your initial condition)

36 The relevant code can be found in the following directory:
/uufs/chpc.utah.edu/common/home/lin-group1/dvm/STILT_modelling/stiltR The relevant subroutines and “master” code are the following: carbonTrack_v5_subroutine.r “biospheric flux code” EDGAR_v2_subroutine.r “Anthropogenic code” WFEI_v3_subroutine.r “Wildfire emission code” CTbackground_subroutine.r “Background CO2 calculator” STILT_co2_simulations.r “Master code” The master code is responsible for running for 4 different subroutines (bioflux, anthropogenic, wildfire, background CO2) Note that each of the subroutines have a ton of bells and whistles, so its important for you to understand the code inside and out in order to get the most out of your research projects! (i.e STILT should not be used as a black box… a model is only as good as its modeler)

37 Lastly, additional code exists for CO and PM2
Lastly, additional code exists for CO and PM2.5, contact me if you need this and I’ll be more than happy to pass it along! As with any code, there may be bugs, so please report these to if you find any! If you have any questions or concerns, please me and I will be more than happy to assist you!


Download ppt "Derek Mallia STILT tutorial v08/20/2015"

Similar presentations


Ads by Google