Tutorial M05

From TUFLOW FV Wiki
(Redirected from Tutorial Module05)
Jump to navigation Jump to search
USEFUL LINKS
Wiki Links Help Downloads
TUFLOW FV Wiki Main Page Products Support/Contact TUFLOW FV Downloads
TUFLOW FV Tutorials Requesting a Licence Tutorial Module Data
TUFLOW Classic/HPC Wiki TUFLOW FV Glossary Manuals

Tutorial Description

Tutorial Module 5 investigates temperature and salinity stratification in a small estuary model. The key objective of the tutorial is to demonstrate 3D visualisation techniques of TUFLOW FV results using the TUFLOW Viewer Plugin for QGIS.

Unlike the Tutorial Modules 1-4 that provide step-by-step model build instructions, Tutorial Module 5 provides you with a full set of working model files that you can re-run and use to experiment with. Starting with a 2D model, the models we review will progressively increase in complexity, incorporating 3D geometry and density effects to observe stratification. Results will be reviewed using the TUFLOW Viewer Plugin for QGIS.

The tutorial includes the following sub-sections:

Requirements and Downloads

Requirement Brief Description
TUFLOW FV Download TUFLOW FV Latest Release. Extract the zip and save to your system, for example C:\TUFLOWFV\2023.1
External Turbulence API TUFLOW FV can be configured to run with external vertical turbulence closure schemes such as GOTM. We will use the external option to run our models.

Download the TUFLOW FV External Turbulence API

Once downloaded, unzip the file tuflowfv_external_turb.dll and replace (copy over) the default tuflowfv_external_turb.dll that resides in the same directory as TUFLOWFV.exe (for example, C:\TUFLOWFV\2023.1).

Model Data Download the Tutorial Module 5 Data Package.

Please note results are not provided as part of this tutorial data package. You will need to run the models to produce them using the batch file provided.

Assumed Knowledge This tutorial assumes you have completed Tutorial Modules 1 to 4, or are already familiar with using TUFLOW FV. If you run into any problems or need help, please contact support@tuflow.com

Model Overview

In estuarine environments, it is common to observe the formation of a 'salt wedge' where less dense freshwater fluxes from the catchment flow over the top of more dense saltwater. For more information on salt wedge estuaries, there's a good summary on the Coastal Wiki.

Modelling the contribution of salinity and temperature to horizontal and vertical density gradients is key to modelling a salt wedge estuary well. Reproducing density gradients requires the 3D simulation of flows, salinity and temperature, atmospheric heat exchange and careful consideration of vertical mixing.

In this demonstration, the results of three models are investigated. Each model simulates temperature and salinity in a different way. Reviewing our model results will show us the impact that these different ways have on our salt wedge formation. The models include:
1. 2D hydrodynamics only with temperature and salinity modelled as passive tracers only.
2. 3D hydrodynamics with temperature and salinity without density coupling.
3. 3D hydrodynamics with temperature and salinity with density coupling.

The TUFLOW FV control files (.fvc) for the models for this tutorial are located in the Complete_Model\TUFLOWFV\runs directory. For information regarding the syntax and command updates made to each model FVC, please follow the links provided in the table below:

HYD_000 2D hydrodynamics only with temperature and salinity modelled as passive tracers only.
HYD_001 3D hydrodynamic without temperature and salinity density coupling.
HYD_002 3D hydrodynamic with density coupling to salinity and temperature.

Model Setup

In this section we will review key components of the model setup.

The folder structure for the Complete_Model folder should contain the following structure:

Tutorial 5 Folder Structure .png

Model Mesh File

The estuary model mesh comprises a combination of quadrilateral and triangular elements. To review the mesh bed elevation and materials, please step through the below sections.

Firstly, open QGIS and save a project called "Tut_05.qgz" into the Complete_Model folder.

Now we will open the hydraul_006.2dm mesh file. Please use the below steps:
1. Please launch the TUFLOW Viewer by clicking the viewer Tut 01 PluginButton .png button from your toolbar.
2. In your File Explorer window, navigate to Complete_Model\TUFLOWFV\model\geo\. Now drag and drop the hydraul_006.2dm file into your QGIS workspace.

Your workspace should look similar to the below:

001 Image.png

To review the mesh bed elevation, please use the below steps:

1. In the TUFLOW Viewer, select the Toggle Mesh Rendering Toggle Mesh Rendering.png.

2. In the Result Type > Map Output window, right click on Bed Elevation and then select Properties.

Tut05 006 Image.png

3. In the Symbology window, please specify the Min and Max display values as -15.00 & 5.00.

4. From the Color ramp dropdown, please select Create New Color Ramp...

Tut05 003 Image.png

5. The Color ramp type dialog will now appear. From the dropdown, please select Catalog: cpt-city and then select OK.

Tut05 004 Image.png

6. You will now see the cpt-city has many colour ramps to choose from. For this tutorial, please click on the Bathymetry palettes. Select the GMT_ocean colour ramp and then OK > Apply > OK.

Tut05 005 Image.png

Your workspace should look similar to the below. Please take your time to zoom in and review the mesh bathymetry.

Tut05 007 Image.png

Now we will review where different materials have been assigned throughout the mesh. Please follow the below steps:

1. This time, in the Result Type > Map Output, right click on the Material ID and select Properties.

Tut05 010 Image.png

2. In the Symbology window, please change the Resampling method to None and then select OK.

Tut05 008 Image.png

Now if you zoom into the mesh, you will be able to see where different materials have been assigned.

Tut05 009 Image.png

Upstream and Downstream Open Boundary Conditions

For the purposes of this demonstrative model, the downstream boundary applies a water level astronomical tide signal with a constant salinity and temperature of 35 ppt and 20o C respectively. To review the boundary condition data, you can open \bc_dbase\Downstream_WL_001.csv in Excel or in your preferred text editor. The time series span the duration of May 2011, and therefore cover the desired simulation period (first week of May).

Tutorial 5 Upstream BC.png

At the upstream boundary, a constant inflow of 20m3/s was applied with 0 ppt salinity (fresh water) and a constant temperature of 10o C. To review the boundary condition data, you can open \bc_dbase\Upstream_Q_001.csv.

Tutorial 5 Upstream Boundary .png

Meteorological Boundary Conditions

The meteorological data for the model is stored in the NetCDF file Complete_Model\TUFLOWFV\bc_dbase\met\CFSR_20110401_20110701_AEST.nc. The data has been sourced from CFSv2 model output downloaded using the GetAtmos Python command line interface tool as follows:

GetAtmos A "2011-04-01 00:00" "2011-06-01 00:00" Xmin Xmax Ymin Ymax --source CFSR

Please note we've withheld the coordinates used to shift the location of the model but if you were running GetAtmos, you would replace Xmin, Xmax, Ymin, Ymax with the longitude and latitude values for your study area. For further examples on using GetAtmos, refer to the TUFLOW FV Get Atmos Wiki Page.

As meteorological data varies spatially, it is preferable to use gridded data for an environment the size of the estuary. For a 3D simulation including atmospheric heat exchange, TUFLOW FV requires the following variables and units:

  • 10m 10min wind speed (m/s)
  • Mean sea level pressure (hPa)
  • Incident downward shortwave radiation (W/m2)
  • Incident downward longwave radiation (W/m2)
  • Air temperature (oC)
  • Surface relative humidity (%)

The GetAtmos tools will automatically generate the required TUFLOW FV boundary condition blocks for simulation. Please review the contents of Complete_Model\TUFLOWFV\bc_dbase\met\CFSR_20110401_20110701_AEST.fvc to see how the gridded meteorological boundary conditions are being applied. Note the use of the bc scale command to convert mean sea level pressure from pascals to hectopascals, and the bc offset command to convert from degree Kelvin to degrees Centigrade.

To review our meteorological inputs, we can open the NetCDF in QGIS. Please complete the following steps:

1. To open your results, please select File > Load Results-Map Output and navigate to Complete_Model\TUFLOWFV\bc_dbase\met\CFSR_20110401_20110701_AEST.nc

Tut 05 plugin loadresults.png


2. Use the shift key to select both wind_10m and wind_10m Vector within the TUFLOW Viewer > Result Type panel.

3. Tick the Show as dates box to display the time slider in date and time format.

4. Slide the time slider forward to view how the wind speed and direction changes during the months of April and May.

Tut 5 Met Review.png

Note that the model domain is well within the spatial extent of our boundary conditions. Try experimenting with the other inputs such as downward shortwave radiation, air temperature and mean sea level pressure.

3D Model Updates

For a detailed description of the commands and syntax in the FVC file, please refer to HYD_001 and HYD_002. Two key updates are the addition of 3D geometry and vertical mixing commands.

Vertical Discretisation

There are 3 methods of vertical discretisation in TUFLOW FV:

  1. Sigma
  2. Z (Fixed Z)
  3. Hybrid Z-Sigma

3d Layering.png

In this example, hybrid z-sigma coordinates are used as follows:

  • The layer faces file specifies 10 fixed z levels that define the faces between vertical cells. Open the file Complete_Model\TUFLOWFV\model\csv\3D_Z_Layers_003.csv in a text editor and review the contents. The values in the file range from -16m to -3m (reduced level model datum). Fixed z layers do not support wetting and drying, so it is important that the face elevation levels you specify remain always wet throughout the simulation. In our model, the tide never falls below -3m and therefore our z layers never dry out.
  • Above -3m (reduced level model datum) we have specified that there will be 4 surface sigma layers that are equally distributed between -3m (reduced level model datum) and the water surface. These 4 sigma layers expand and contract during the simulation in response to the local water level and also allow cells to wet and dry.
  • The minimum bottom layer at the bed is set to be 0.5m to avoid any thin z-layers between the bottom layer face and the bed (and avoid the associated small timestep).
  • The cell 3D depth command causes areas where the depth is less than 1m to revert to a 2D flux calculation and can improve model stability and runtimes, particularly if models exhibit wetting and drying areas (such as within this model).

The relevant 3D geometry commands are shown in the TUFLOW FV command syntax snippet below:

Vertical Mesh Type == z
Layer Faces == ..\model\csv\3D_Z_Layers_003.csv
Surface Sigma Layers == 4
Min Bottom Layer Thickness == 0.5
Cell 3D Depth == 1.0

Vertical Mixing

To enable mixing of turbulence, and scalar fields such as temperature and salinity, we need to include vertical mixing model commands in our control file. For this model we are using the k-epsilon option from GOTM.

! Vertical Mixing
Vertical Mixing Model == external
Global Vertical Eddy Viscosity Limits == 1.0e-4, 1.0
Global Vertical Scalar Diffusivity Limits == 0., 1.0
External Turbulence Model Directory == ..\GOTM\
Turbulence Update dt == 1800

Run The Models

Results have not been provided with the data download package and you will need to re-run the models to obtain them. To do this, you can refer to Running TUFLOW FV for a detailed description of the various methods for running a TUFLOW FV simulation. A template batch file is provided in the Complete_Model\TUFLOWFV\runs folder. Within this batch file, you will need to re-path to the version of TUFLOW FV you have downloaded and updated with the external turbulence API. Please run all three model simulations, noting this may take 10-15 minutes depending on your computer hardware.

Reviewing 2D Model Results

In this section we will review the 2D only model temperature results of simulation HYD_000.fvc via some 2D timeseries and plan view sheet plots.

Creating Timeseries Plots

A 2D variable timeseries plot allows you to view the time series of a single variable at a single location. In this section we will create a timeseries plot of Temperature from the HYD_000 model results.

To open your results, please select File > Load Results-Map Outputs and navigate to results\HYD_000.nc.

Tut 05 plugin loadresults.png

Your project window will now look similar to the below:

Tut 05 HYP000 result 00.png

To extract your temperature timeseries from HYD_000, please use the following steps:
1. In the Result Type window, select the temperature result.
2. Select the Plot Time Series drop-down Tut 01 TSplot button .png and in the drop-down check temperature.
3. Now select the Plot Time Series Tut 01 TSplot button .png tool and your cursor should now become a crosshair [+].
4. Click on your desired location within your result, as shown by the arrow and red dot in the below figure.

Having used the Plot Time Series tool, you should a similar plot to the below in your time series window:

Tut 05 HYP000 result temp TS 001.png

Do you notice how the temperature oscillates throughout the simulation?

Tut 05 HYP000 result temp TS 002.png

What causes the oscillation?

In the bc_dbase folder, open the files Upstream_Q_Temp_Sal_Sed_001.csv and Downstream_H_Temp_Sal_Sed_001.csv.
Tut 5 bc files.jpg

Observe that the upstream temperature is set to 10 degrees, while the downstream temperature is set to 20 degrees. The oscillation in temperature is caused by the tide, where the temperature surges during flood tide as 20 degree water enters the model from the downstream boundary, and falls with the ebb tide back towards the upstream temperature of 10 degrees.

How does the initial temperature affect the simulation?

Recall that the initial temperature for the model was set to 20 degrees in the line:

Initial Temperature == 20.

However, as visible in the timeseries plot, the temperature in the timeseries approaches a value closer to 11 degrees by the end of the simulation. With an upstream temperature of 10 degrees and a downstream temperature of 20 degrees, it is natural that there should be an observable temperature gradient through the estuary. However, this temperature gradient will only become visible once the model has run for enough time for the boundary conditions to overwrite the initial global temperature. In this way, a timeseries plot can provide insight to when a model converges towards a steady state. Given that the model temperature quickly diverges from the initial condition, is our selection of initial temperature suitable for this system? Most likely not. Try running the model again with an initial condition of 15 degrees and see how this affects the system.

Creating a 2D Plan View Map (Sheet Plot)

As identified in the timeseries plots, oscillations in temperature are observed. We make the assumption that this is due to the effect of the tide. However, when reviewing results, you should never just look at time series to get a good appreciation of what is happening. To further investigate, we will create a contoured plan view map (a sheet plot in TUFLOW FV nomenclature) with vectors to see how the results are varying both spatially and temporally.

Firstly, clear the timeseries plot you made in the previous section by right clicking on the timeseries plot and selecting Clear Plot Window. Now use the following steps to create a 2D plan view map:

1. In the Result Type, use the shift key select both temperature and velocity Vector.
2. Now drag the timestamp to see how temperature and velocity vectors vary both spatially and temporally throughout the model.
3. Notice you can also use the Next Timestep and Play Through Timesteps buttons to visualise the results for the entire simulation.

Tut 05 sheet plots 00.png

As shown below, during ebb tide, the vectors indicate a surge in flow downstream. During this time, the temperature is shown to fall due to cold water flowing downstream. Conversely, in the bottom panel of the figure, showing the model during flood tide, the vectors indicate a surge in flow upstream. During this time, the temperature rises due to the influence of the downstream boundary and initial conditions.

Tut 05 HYP000 result flood ebb temp 001.png

Review of Density Stratification - 3D Result Visualisation

In this section we will:

  1. Compare 2D and 3D salinity results via a vertical profile plot.
  2. Investigate the impact of enabling density coupling by comparing long section curtain plots of our 3D results.
  3. Undertake depth averaging at different 3D depths and display the results as a plan view sheet plot.
  4. Extract time series of salinity at different depths.

Reviewing 3D Results With A Vertical Profile Plot

A profile plot allows you to view a variable through the vertical water column at a particular model timestep. In this section, we will compare the salinity profile of the 2D model HYD_000 with the 3D model HYD_001 results. Please make sure that the HYD_000.nc result is still open in your QGIS project window. Open the HYD_001.nc result file via the QGIS TUFLOW Plugin.

Using the below steps, create a salinity profile plot of the 3D model results:
1. In the Open Results window, select HYD_001.
2. In the Result Type window, select salinity.
3. Under the Vertical Profile dropdown Tut 05 Vertical profile tool.png, select salinity.
4. Select the Vertical Profile Tut 05 Vertical profile tool.png tool. Your cursor should now become a crosshair [+].
5. Click on your result in a similar location to that shown by the arrow in the below figure.
6. Now review your salinity profile result.

Tut 05 HYP001 Profile Plot.png

Now we will compare the salinity vertical profile of the 3D model to the 2D model. To do this, hold down shift and select both HYD_001 and HYD_000 in Open Results. Your plot should look similar to the below:

Tut 05 HYP001 HYP00 Profile Plot.png


The 2D depth averaged model only has one value per model cell. By enabling the model in 3D, we get vertical variation in salinity. However, as HYD_001 does not include density coupling, this result does not include key hydrodynamic forcings required to represent stratification in the estuary.

Next, we will investigate the effect of adding density coupling to our 3D model setup.
1. Open the results file HYD_002.nc via the TUFLOW Viewer Plugin.
2. Follow the steps above to extract a salinity profile, this time near the downstream boundary.
3. Ensure that the three results are selected in the Open Results panel of the TUFLOW Viewer.
4. Move the time slider to 01/05/2011 05:00:00

3D Stratification Density Coupling Profile.png

As you can see, the effect of density coupling on the vertical profile is significant. Near the surface, the initial condition salinity of 10 ppt remains. At depth, the saltwater wedge moves upstream with the incoming tide, resulting in a heavily stratified flow field.

As you can see, the effect of density coupling on the vertical profile is significant. Near the surface, the initial condition salinity of 10 ppt remains. At depth, the saltwater wedge moves upstream with the incoming tide, resulting in a heavily stratified flow field.

Creating Curtain Plot

To further investigate the propagation of the salt wedge, we can extract and review 3D cross sections (or long sections) from our results using a curtain plot. A curtain plot can allow you to view a variable as a function of chainage and depth (with a time slider bar). In this section, we will create a salinity curtain plot from the 3D density coupled model result HYD_002.

To produce a salinity curtain plot for the HYD_002 results, please follow the below steps:
1. In the Open Results window, select HYD_002.
2. In the Result Type window, select salinity.
3. Under the Curtain Plot Tut 05 Curtain plot tool.png dropdown, select salinity.
4. Select the Curtain Plot Tut 05 Curtain plot tool.png tool. Your cursor should now become a crosshair [+].
5. Now take a long section from the downstream boundary to the upstream boundary.
6. Review your salinity curtain plot.
7. Now use the time stamp controls to review how salinity changes temporally and spatially throughout the model.

Tut 05 HYP002 Curtain plot.png

As shown above, now that density coupling is included in the model, a salt wedge is clearly visible. As density is now treated as a function of temperature and salinity, the heavier salt water is seen to lie below the freshwater, creating a wedge. This behaviour is common in an estuarine environment where fresh and salt water mixing occurs.

Using Sheet Plots With Different 3D Depth Averaging Methods

Although our results are 3D, when we look at a plan view plot, we can only visualise a depth averaged slice. This section will show you how to apply different depth averaging methods using the TUFLOW Viewer Plugin.

1. In the Open Results panel, select the HYD_002.
2. In the Result Type panel, select salinity.
3. Right click on salinity and then select Properties.


Dave salinity props.png


4. Navigate to the Stacked mesh averaging method tab to view the Average 3D Stacked Mesh Results to 2D Dataset Values section.
5. You will note that the default is Sigma, with Start fraction 0.00 and End fraction 1.00. This is a depth averaged 3D visualisation over the full water depth, where 0.00 is the bed level and 1.00 is the water surface.

Dave selection.png


6. Now change the End fraction value to 0.20. This will show the salinity in the bottom 20% of the water column.

Change dave sigma.png

Below is a figure comparing the map results of the full depth average to the map results of the bottom 20%. We see that there are higher salinity concentrations in the bottom 20%, as indicated by the yellow colouring of the figure in the right-hand panel. This implies that water is far saltier near the bed due to the effects of density stratification.

Sal Sigma Compare.png

Try experimenting with some of the other depth averaging methods. For more information on the methods available, please refer to our Depth Averaging Results page.

Plotting Timeseries with Different 3D Depth Averaging Methods

In this section we will extract time series results of salinity using different vertical depth averaging methods.

1. In the TUFLOW Viewer Plugin, navigate to the 3D to 2D Averaging Timeseries 3D to 2D Averaging Timeseries Tool.png tool and click the dropdown.
2. From the dropdown options, select Sigma.
3. Use the Add Additional... button to add two new fields. You should now have three fields. Set each of them to the variable salinity. Update the Start Fraction and End Fraction to be given by the following three pairings: (0.0, 1.0) (0, 0.2) and (0.9, 1.0). This will depth average the results over the full water depth, the bottom 20% and top 10% respectively.

Update dave select.png

Now that we have specified our result type and vertical averaging method, we can create our time series plot:

4. Select the 3D to 2D Averaging Timeseries 3D to 2D Averaging Timeseries Tool.png tool. Your cursor should now become a crosshair [+].
5. Select a location on the results similar to point 2 shown in the figure below.

The resultant timeseries plot shows us that the saltiest water is at depth, with less salty water near the surface.

Update dave result.png

Going Further - Water Quality Application

The constructed model, HYD_002, may be coupled with a water quality model in order to simulate the behaviour of various water quality constituents.
If you wish to learn how to incorporate water quality into the HYD_002 model, please complete Tutorial Module 9.

Going Further - TUFLOW FV Python and MATLAB Toolboxes

If you'd like to try out the estuary model results within our TUFLOW FV Python or MATLAB Toolboxes please check out the following pages:

Conclusion

In this tutorial we have explored an idealised stratified estuary case study. We have used several 2D and 3D model result visualisation and review techniques within the TUFLOW Viewer Plugin for QGIS, including:

  • 2D time series
  • 2D sheets
  • 3D profiles
  • 3D curtains
  • 2D depth averaged 3D result sheets
  • 2D depth averaged 3D result time series

We hope that you find these tools useful for your projects.

Return to the Tutorial Introduction Page to complete further model build tutorials.