Personal tools

Difference between revisions of "Eutrofização Albufeiras"

From MohidWiki

Jump to: navigation, search
(Prepare Meteorology data)
(Prepare Meteorology data)
Line 203: Line 203:
 
How to calculate the Dew point, extracted from Wikipedia, the most simple equation is:
 
How to calculate the Dew point, extracted from Wikipedia, the most simple equation is:
  
:<math>
+
:<math>T_d = T - \frac {(100 - RH)} </math>
T_d = T - \frac {(100 - RH)} {5}
 
</math>
 
  
 
*'''T_d''' = Dew point temperature.
 
*'''T_d''' = Dew point temperature.

Revision as of 21:40, 12 November 2009

Overview

It is intended to produce a step-by-step procedure to run reservoir model CE-QUAL-W2

Where to Start?

  1. If you need to have first insights on CEQUAL-W2 model, applications already done see \\datacenter\Albufeiras_Eutrofizacao\ComoFazer\0.Bibliografia
  2. If you already feel ready to start, initiate with collecting all the data available for your reservoir and watershed in snirh (http://snirh.pt). First use the shapes in \\datacenter\Albufeiras_Eutrofizacao\Produtos\ProjectosGIS\ShapesBase to check which flow and quality stations are in the reservoir and watershed. Then, go to snirh to download the desired data from that stations.
  3. Follow the steps in \\datacenter\Albufeiras_Eutrofizacao\ComoFazer

Tasks

1.Get Input Data

Water Quantity in the reservoir

  1. Go to http://snirh.pt
  2. For water quantity in the reservoir click "Albufeiras->Dados de base".
  3. Choose your desired station (reservoir name) and click "Seleccionar estações"
  4. click "Validar Lista". Check below which parameters to choose to download (holding shift or ctrl while clicking will perform multiple selections)
  5. After all desired parameters selected, click "Ver/Guardar Dados"
  6. Wait until all data is dowloaded and the click upper right button "Export CSV"
  7. Choose a folder and a name for your file (use the recommended folder structure and a name that identifies the type of data)
  8. Open and transform your data using "Data->Text to Columns" then save the .csv file into excel .xls.

List of input data needed:

Consumo agrícola mensal
Consumo municipal mensal
Descarga de fundo mensal
Descarga de superfície mensal
Volume armazenado mensal (final do mês) 
Cota da Albufeira - recommned to download together with the next to a different file because is daily data (sometimes also hourly)
Volume armazenado (convencional) - recommned  to download together with the previous to a different file because is daily data

Water Quality in the reservoir

  1. Go to http://snirh.pt
  2. For water quality in the reservoir click "Rios->Dados de base(qualidade)".
  3. Choose your desired station (reservoir name) and click "Seleccionar estações"
  4. click "Validar Lista". Check below which parameters to choose to download (holding shift or ctrl while clicking will perform multiple selections)
  5. After all desired parameters selected, click "Ver/Guardar Dados"
  6. Wait until all data is dowloaded and the click upper right button "Export CSV"
  7. Choose a folder and a name for your file (use the recommended structure)
  8. Open and transform your data using "Data->Text to Columns" then save the .csv file into excel .xls.

List of input data needed:

Temperatura da amostra
Transparência
Nitrato Total (em NO3)
Amónia Total  (em NH4)
Nitrito Total (em NO2)
Azoto Orgânico(ou Azoto Kjeldahl)
Azoto Total
Ortofosfato Total
Fósforo Total
Clorofila-a
Fitoplancton ... (Espécies de algas - normalmente não existe esta informação) 
Sólidos Suspensos Totais
Oxigénio dissolvido (normalmente aparecem vários)
CBO 5dias
Ferro dissolvido
Ferro total
Ferro particulado

Meteorology - need to know which station are closer. Use ArcGIS, reservoir and station shapefiles in \\Datacenter\Albufeiras_Eutrofizacao\Produtos\ProjectosGIS\ShapesBase to check them. See the video using MOHID GIS in http://screencast.com/t/vOa6esZAjFL

  1. Go to http://snirh.pt
  2. For meteorology click "Meteorologia->Dados de base".
  3. Choose your desired stations and click "Seleccionar estações"
  4. click "Validar Lista". Check below which parameters to choose to download (holding shiftor ctrl while clicking will perform multiple selections)
  5. After all desired parameters selected, click "Ver/Guardar Dados"
  6. Wait until all data is dowloaded and the click upper right button "Export CSV"
  7. Choose a folder and a name for your file (use the recommended structure)
  8. Open and transform your data using "Data->Text to Columns" then save the .csv file into excel .xls.

List of input data needed:

Temperatura do ar média diária
Humidade relativa média diária  - for dew point calculation
Velocidade do vento médio diário
Direcção do vento horário - recommned to download to a different file because is hourly data


Water Quantity in the incoming rivers - need to know which station are in the inflowing rivers. Use ArcGIS, reservoir, river and station shapefiles in \\Datacenter\Albufeiras_Eutrofizacao\Produtos\ProjectosGIS\ShapesBase to check them. See the video using MOHID GIS in http://screencast.com/t/vOa6esZAjFL

  1. Go to http://snirh.pt
  2. For water quantity in the river click "Rios->Dados de base(quantidade)".
  3. Choose your desired station and click "Seleccionar estações"
  4. click "Validar Lista". Check below which parameters to choose to download (holding shift or ctrl while clicking will perform multiple selections)
  5. After all desired parameters selected, click "Ver/Guardar Dados"
  6. Wait until all data is dowloaded and the click upper right button "Export CSV"
  7. Choose a folder and a name for your file (use the recommended structure)
  8. Open and transform your data using "Data->Text to Columns" then save the .csv file into excel .xls.

List of input data needed:

Caudal médio diário
Nível médio diário (se não existir caudal)

Water Quality in the incoming rivers- need to know which station are in the inflowing rivers. Use ArcGIS, reservoir, river and station shapefiles in \\Datacenter\Albufeiras_Eutrofizacao\Produtos\ProjectosGIS\ShapesBase to check them. See the video using MOHID GIS in http://screencast.com/t/vOa6esZAjFL

  1. Go to http://snirh.pt
  2. For water quality in the river click "Rios->Dados de base(qualidade)".
  3. Choose your desired station and click "Seleccionar estações"
  4. click "Validar Lista". Check below which parameters to choose to download (holding shift or ctrl while clicking will perform multiple selections)
  5. After all desired parameters selected, click "Ver/Guardar Dados"
  6. Wait until all data is dowloaded and the click upper right button "Export CSV"
  7. Choose a folder and a name for your file (use the recommended structure)
  8. Open and transform your data using "Data->Text to Columns" then save the .csv file into excel .xls.

List of input data needed:

Temperatura da amostra
Nitrato Total (em NO3)
Amónia Total  (em NH4)
Nitrito Total (em NO2)
Azoto Orgânico(ou Azoto Kjeldahl)
Azoto Total
Ortofosfato Total
Fósforo Total
Clorofila-a
Fitoplancton ... (Espécies de algas - normalmente não existe esta informação) 
Sólidos Suspensos Totais
Oxigénio dissolvido (normalmente aparecem vários)
CBO 5dias
Ferro dissolvido
Ferro total


How to prepare input data for model to run see \\datacenter\Albufeiras_Eutrofizacao\ComoFazer\1.PreparaInputs

2.Check Data

Note It is important to check input data for a) outliers b) detection limit values c) understanding the reservoir or river dynamic. As so, always perform time serie graphs for each property or/and flow. Also ploting several related properties (e.g. nutrients and chlorofila) or several meteorological stations will help in understanding the data consistency.


3.Create Bathymetry

Prepare Carta Militar

  1. See in which "carta militar" your reservoir is in, opening in MOHID GIS the reservoir shapefiles and the file Portugal_cartas.img (as Background Image) from \\datacenter\Albufeiras_Eutrofizacao\Produtos\ProjectosGIS\imagens
  2. Go to \\Kepler\DataCenter1\DataCenter\DadosBase\Terra\Cartas Militares. The folders are named with the range number of the "carta militares". Enter in the directory where your carta is and copy it to your directory.
  3. Check if the .jpg file is associated with one .jpgw. If it is, you can proceed to the next step. If not search for assistance.
  4. Open your just copied image in MOHID GIS using the steps in How to Import georeferenced images in MOHID GIS

Use Carta Militar and some drawing to get reservoir geometry

  1. Check your NPA ("Nivel de Pleno Armazenamento"), the maximum height ("Cota do coroamento") and the elevation over the natural terrain ("Altura acima do terreno natural") of your reservoir at http://cnpgb.inag.pt/gr_barragens/gbportugal/Lista.htm
  2. If your reservoir appears in the Carta Militar, check if the water surface represented is the NPA by checking if it's the same height around the waterbody than the pointed in the NPA; However, if the reservoir does not appear in the Carta Militar (only the river prior to the costruction), draw the inundated area at NPA (insert polygon in MOHID GIS).
  3. Draw lines where top geometry of the reservoir (or NPA) changes to help you define the next steps.

Create the reservoir bathymetry

  1. To create the bathymetry there are two excel files in \\Datacenter\Albufeiras_Eutrofizacao\ComoFazer\1.PreparaInputs\2.Batimetria\Geometria. One is the tool if your reservoir appears in Carta Militar and the other if it wont.
  2. Follow specific instructions for the filling of excel file in \\Datacenter\Albufeiras_Eutrofizacao\ComoFazer\1.PreparaInputs\2.Batimetria\Geometria - HowtoUseExcelFiles.txt
  3. Open W2i Program in \\Datacenter\Albufeiras_Eutrofizacao\ComoFazer\1.PreparaInputs\2.Batimetria\W2i. This program will generate the cequal bathymetry file.
  4. Select "New Build" and browse for the excel file that you just did.
  5. W2i will produce bathymetry file and other cequal input files.
  6. Select now in W2i "View Bat" and browse in the excel folder for the w2.con file that W2i produced.
  7. Check if your bathymetry is like you imagined it!

Validate your bathymetry

  1. Check total volume of your reservoir (in INAG page above) with obtained with the total volume of your geometry (may compute in the excel bathymetry file or use W2i to get reservoir volume curve ("view bat") and then "Volume = f(Height)" and see volume at the higher "cota" - represents the total volume).
  2. For a finer comparison use W2i to get reservoir volume curve (cotas vs volume) in "view bat" and then "Volume = f(Height)" and compare it with water quantity in the reservoir downloaded (first step of this tutorial) - "cota" and "volume armazenado" - check the video Step 3 at the bottom of the page

4. Run CE-QUAL model

See video link in http://www.screencast.com/t/9HMApeM21VPs or video file (larger screen) in \\Datacenter\Albufeiras_Eutrofizacao\Produtos\Apresentacoes\Videos (comofuncionacequal.swf)

How does the model work?

The model has a core file "w2.con" where all information about how many branches, segments, layers, water inputs and uptakes, hydrodynamic and quality parameters, output information, other files needed names... Basically has it all. All other files have their names in w2.con and model will search for them if needed. When running the executable the model will process all the information in "w2.con" and the needed information from the other files (meteorology, inflows and outflows) and the evolution with time appears (lines are printed out to screen with julian day of simulation, dt and other info).

How do I run the model?

After performing all the steps to prepare the model to run (next chapters), just need to double click on the .bat file present (see next steps) and that is it. The .bat file function is to pause the .exe file if program crashes in order to see error info.

First Run

In the first run we are going just to put the model running with less concern to boundary conditions. In order to see the project example that we are going to use go to \\datacenter\Albufeiras_Eutrofizacao\ComoFazer\2.CorreCe-Qual\ExemploBase_Maranhao\RunRef38_Maranhao\WithoutOutputFiles The w2.con file is there and all the input files associated (.npt)

The w2.con file

To understand w2.con file follow cequal manual in \\datacenter\Albufeiras_Eutrofizacao\ComoFazer\0.Bibliografia from page 297 and on where all the keywords are explained. Take at least a couple of minutes to understand w2.con structure and type of parameters. This will be important for next steps.

Steps

See video link in http://www.screencast.com/t/wWYfZPFk9t or video (larger screen) file in \\Datacenter\Albufeiras_Eutrofizacao\Produtos\Apresentacoes\200908-Albufeiras (comofazerprimeirasimulacao.swf)

  1. Create a new folder for the process
  2. Copy to the created folder, in this order: i) the manual from \\datacenter\Albufeiras_Eutrofizacao\ComoFazer\0.Bibliografia; ii) the files created for your reservoir by W2i program when producing the bathymetry; Make a backup copy of the w2_con.npt file naming it for example w2_con_old.npt; iii) the w2.con file, the .exe file, the .bat file, graph.npt, Cin_Br1.npt, Qin_Br1.npt and Tin_Br1.npt from the Beliche project in \\Datacenter\Albufeiras_Eutrofizacao\ComoFazer\2.CorreCe-Qual\ExemploFeito_Beliche\1.SimulacaoZero\AdaptedToW2con (let it rewrite the files with the same name already present)
  3. If you have more than one branch make copies of Qin_br1.npt, Cin_br1.npt and Tin_br1.npt and rename them (e.g. Qin_br2, Qin_br3, Tin_br2, ...)
  4. Copy your meteo file for this run from \\Datacenter\Albufeiras_Eutrofizacao\ComoFazer\2.CorreCe-Qual\meteo_files. Use for example the one for Alentejo. In this simulation it is not important to have local climatology, that will be important in the next run.
  5. Now is time to convert the w2.con from the Beliche project to your reservoir project. W2.con file is very strict on where keywords and values are aligned. As so, try to follow the structure already initiated. IMPORTANT: Always have the cequal manual in hand to search for any keyword that you want to know what it is; after page 297 the control file (w2.con) is all detailed what parameters mean and how to fill them.
  6. Change w2_con - Here is the list of keywords you need to change from the Beliche sample w2_con.npt file. Insert the values that are suited for your reservoir.
  7. Change w2_con - The above example (Beliche reservoir) has 3 branches. However, w2.con needs for some parameters one line per branch even if parameters are not defined or left blank (this is mandatory and if you do not do it program will not run). So if you have more than 3 branches add one line with branch number for each branch when appears "Br1" "Br2" "Br3" in w2_con, or delete all the lines with "Br2" and "Br3" if you have for instance only one branch. Deleting a line does not mean clear its content and left it blank, it means the file needs to have one less line (all the text below will go up). Adding a line means a new line in text (all the text below will go down).
  8. Change other files - Remind that the number and order of concentrations species in Cin.npt is controled in "CIN" keyword in W2.con file. This is a remind task do not need to do anything but it will be important in a real simulation.
  9. Change other files - Also remind to give initial and final date inputs (Qin.npt, Cin.npt, Tin.npt or wsc.npt) that comprise the simulation period. This has to be done only on WSC.npt because Qin.npt, Cin.npt and Tin.npt were copied from Beliche.
  10. Run the program double clicking in the .bat files and hope there will be no error messages. If error message is something like "input conversion error" and the file name that points is w2_con it is because you failed to adapt your w2_con file. Reinspect file and look for "Br1" Br2" "Br3" to have always all your branch numbers. Look for things dependent on geometry as for example remind tat "S DEMAND" keyword requires one value for each segment wich means that you may have to add or delete values in order to have as many values as segments.

Running with local boundary conditions

Prepare Meteorology data

Use the meteorology data downloaded in step 1 to prepara monthly averaged data (that will be looped in the simulation). The looping meteorology is necessary because meteorology data is available only since 00's and we want to make long reservoir runs. For that it is going to be necessary to modify the winds from degrees into radians. Use the following formulas for that purpose:

u = - sin(wd*pi/180)
v = - cos(wd*pi/180)
To check that the calculus was right you turn them back to degrees with the following expressions: 
wd = 3.*pi/2. - ATAN2(u,v)
if (wd > 2*Pi) wd = wd - 2*Pi
being
u = x-wind component
v = y-wind component
wd = wind direction

How to calculate the Dew point, extracted from Wikipedia, the most simple equation is:

Failed to parse (unknown error): T_d = T - \frac {(100 - RH)}
  • T_d = Dew point temperature.
  • T = Temperature in degrees
  • RH = Relative humidity.
Run SWAT Model for river inputs

In order to have the river input entering in the reservoir and taking into account that flow and concentrations data in the river or do not exist, or when exist the periods where we have both at the same time is very limited, we will use SWAT as the model for boundary river simulation. The field data when exists will be used for validation.

  1. See How to Install SWAT
  2. See How to run SWAT model for your reservoir watershed.

5. Evaluating Results

FAQ

Q: What is the software that I need to install?

A: For Cequal you only will need an .exe file that will be distributed. For the first steps you will need any GIS software that opens shapefiles and georeferenced images (ArcGIS, MohidGIS, etc.). If any doubt on how to install them call David. IE or Mozilla web browser will work just fine in www.snirh.pt

Q: Where do I find data?

A: All the data needed up to now is from http://snirh.pt. Water flows in the reservoir, water height and volumes are taken from "Albufeiras" network. However, water quality in the reservoir is taken from "Rios->Dados de base (qualidade)"; this may cause confusion because reservoir data is in river network. Water flow and water quality entering in the reservoir from tributaries are taken from "Rios->Dados de base (qualidade)" and "Rios->Dados de base (quantidade)" - remember to check first which stations are inside the reservoir watershed.

Q: What is the desired period time of the simulation?

A: The desired period of simulation is around 10-20 years. The best practice is not to filter data (as much of it e.g. water quality has not yet reached 10 years) because all the data may be needed.

Q: My excel 2003 doesn't open big csv files (with more than 65545 lines. What can I do?

A: Use excel 2007. Use Data-->TextToColumns to spread your csv data on several columns.

Q: How to convert excel dates into Julian dates?

A: Define a year where to start as for example 1990 (e.g. first year of simulation). 1-1-1990 will be your julian day 1, all other days will be in this reference. To convert excel dates to julian dates in this example do Julian date = Excel Date - (1-1-1990) + 1, meaning that you have to subtract all excel dates with the date of your first julian date (1-1-1990 in the example) and add 1 because 1-1-1990 has to be day one and not day zero, and so on.

Q: O braço dum afluente encaixa na margem errada do braço principal. Como posso indicar para o afluente encaixar na "outra margem"?

A: Tenta mudar a orientação do segmento do braço principal (o segmento aonde se vai encaixar o braço do afluente). Mudar a orientação do segmento do afluente que encaixa no braço principal não serve de nada. Eis um exemplo: antes e depois.

Q: Quais são as palavras-chave no ficheiro w2_con.npt que dependem do número de segmentos e do número de camadas?

A: S DEMAND depende do número de segmentos.

Support Material

  • The kick-off internal meeting video is available at \\datacenter\Albufeiras_Eutrofizacao\Produtos\Apresentacoes

Video tutorials