Reference no: EM132375901
GETTING STARTED WITH GLM
A: Lake Stratification with the General Lake Model (GLM)
The simulation in the "Kinneret97" directory is an example 40 m deep, monomictic lake that is used to supply drinking water and support an active fishery.
Before running the model, open the file glm.nml in a text editor of choice and inspect the model setup etc. This file is the main configuration file that drives the model. For editing text files we recommend jEdit, Atom or Notepad++, but Wordpad will suffice (don't use MS Word). In Wordpad, use View/Word wrap/No wrap to view it more easily. The file glm.nml has several key sections in it related to the model domain and parameters, the sources of boundary condition data, and details of outputs. Scan the parameters, eg number of layers, light extinction coefficient, mixing coefficient etc.
Once the model has run, you can inspect the results. There are three ways to look at output:
1. via the time-depth contour plots that appear during the run (configured via plots.nml);
2. further information on the daily water and energy balance is in the output file lake.csv; and
3. time series values of selected state variables (eg temp, salinity etc) can be requested for a specific depth (depth above bottom)- this is setup in &outputs (eg. WQ_5.csv).
Exercises:
• Draw a schematic picture of the lake, the relevant boundary conditions (both related to water fluxes and energy fluxes).
• Identify and open the boundary condition input files - these are csv files containing time-series of meteorological information, and inflow and outflow volumes. These files can be opened in Excel or a text-editor. Find where these files are called from within glm.nml.
• Plot the lake water balance - volume, water level and fluxes including inflows, outflows, rainfall and evaporation (refer to columns in lake.csv, and copy the appropriate data into your own excel spreadsheet).
• Plot the surface heat fluxes such as shortwave, longwave, sensible heat latent heat (refer to columns in lake.csv).
• Go to the &output section of glm3.nml and customize the configuration to make two output files, one at 5 m from the bottom (ie. in the lake hypolimnion) and one at 35 m from the bottom (ie. in the lake epilimnion). Plot the temperate of the two layers in excel.
• Assess how the degree of stratification changes as the initial water level of the lake is reduced by 20 m. To do this change the initial starting lake depth and profile (&init_profiles) and sediment details in glm3.nml. You will also need to update the output depth of your surface output file.
NOTE: Remember to watch out the date format when you save an inflow csv file from Excel. Excel changes the date format to be its preferred style instead of the style GLM requires (YYYY-MM-DD) so you must be sure to set that manually in the cell format properties section of excel before saving csv files. The met_hourly file uses YYYY-MM-DD hh:mm.
B: The ecosystem model
The "Kinneret97" model simulation above has the ecological model aed2 enabled. It has been pre- configured to run the customizable AED modules, configured using the text file aed2.nml.
Exercise:
• Add these variables to the specific depth output files. Edit the &output section of the glm3.nml file, by adding the variables as extra columns to the csv file that were configured above. Once they are there, make sure that the number of variables is large enough to include them all.
Dissolved nutrients
|
Phytoplankton
|
Zooplankton
|
Organic matter
|
'NIT_amm',
|
'PHY_green',
|
'ZOO_zoo01',
|
'OGM_don',
|
'NIT_nit',
|
'PHY_crypto',
|
|
'OGM_dop',
|
'FRP_frp',
|
'PHY_diatom',
|
|
'OGM_doc',
|
'OXY_oxy',
|
|
|
'OGM_poc',
|
• Also add them to the plots.nml file. You will have to create titles for them (see the manual or the website, or an example in plots_aed2.nml), and set the upper and lower limits of the colourbar. This may take a bit of trial and error until you get a nice contrast.
• Create a well formatted, interesting graph of variables of your choice (for example, you may like to consider all of the phytoplankton groups, all of the nitrogen variables, or create sums of these to generate a NPZD model) to see how they interact and change over time. If any variables are much bigger or smaller than the others, then use two y axes or multiple plots.
• How would these concentrations change if the air temperature increased by 2 °C?
(You will need to edit the met_hourly.csv file). Date format is also hourly (YYYY-MM-DD hh:mm)
• What happens if we change the water clarity? Increase and decrease from the original value to see the response
(HINT: you must change the light extinction coefficient Kw (0-1) in the glm.nml file).
C: ASSESSING ERROR & SENSITIVITY
• Calculate the mean absolute error in the simulation using the provided temperature data (the provided temperature data is from the surface layer in lake.csv).
MAE = ∑i |Cisim - Ciobs|/n
• Calculate the sensitivity of the modelled temperature to changes in water clarity (the light extinction coefficient, Kw) and wind speed (wind_factor). These can be found in glm.nml. Try increasing and decreasing the default parameter value by 20% and see how much the output changes.
SI = ((Outputnew - Outputoriginal)/Outputoriginal)/((Parameternew - Parameteroriginal)/Parameteroriginal)
• Assess how sensitive the phytoplankton biomass is to water clarity.
Parameter
|
Water clarity
-20%
|
Water clarity
original
|
Water clarity
+20%
|
|
|
|
Output
Sensitivity
|
Mean surface temperature
|
|
|
|
|
|
|
Output
Sensitivity
|
Mean phytoplankton biomass
|
|
|
|
|
|
|
Parameter
|
Wind speed
-20%
|
Wind speed
original
|
Wind speed
+20%
|
|
|
|
Output
Sensitivity
|
Mean surface temperature
|
|
|
|
|
|
|
Output
Sensitivity
|
Mean phytoplankton biomass
|
|
|
|
|
|
|
D: GLMr and the graphical user interface (optional)
Get GLM working with RStudio, as per the instructions on the first page. Once you have the latest version working, you can repeat some of the above exercises by using the Change parameters.R and Plot.R scripts.
Software assessment:
• How do you compare using a text editor and Excel versus using RStudio for running GLM? What are the strengths and weaknesses of each approach?
• How do you compare using Excel versus using RStudio for making figures? What are the strengths and weaknesses of each approach?
• What would you like to see added to the GLMr package?
Finally, see if you can get the GUI working. Open the script RGUI_158_6.R. At the end of the script, change the path to the package on your computer. Run the whole script and wait patiently while it downloads the necessary packages from the internet. Once it is running, set the simulation directory to be Kinneret97. Repeat some of the exercises from above, including changing individual parameters and rerunning the model. Hit the Output button and view some of the plots.
Software assessment:
• How do you compare the first two approaches versus using the GUI?
• What are the main bugs of the GUI at the moment? Which bugs were you able to solve by altering the code? Which need to be solved by the developers?
ASSIGNMENT SUBMISSION
Summarize your work in a concise report, including the results of sections A, B and C, including answers to the exercise questions posed above, and other insights you found from the model.
Structure your report to include:
• title - "Lake water quality dynamics: implications for water management"
• a brief introduction (1/2 page) outlining the motivation of the model study (assuming the lake is used as a drinking water supply), and introducing the model approach. Add references of related literature.
• model description, describing its approach and where to get information
• your results from the tasks in each exercise, in terms of how they answer the questions posed. Use sub-headings to structure this section.
• at the end of the report write a recommendation section for a potential water utility client who is managing the water body to:
a) summarise the implications of the model results for water quality management in the context of a changing climate, and
b) suggest 5 (or more) variables you would propose to monitor to allow for critical validation of the model's performance.
Attachment:- LAKE WATER QUALITY MODELLING.rar