Demo Iteration Project: Difference between revisions

From Tygron Preview Support Wiki
Jump to navigation Jump to search
 
(43 intermediate revisions by 2 users not shown)
Line 3: Line 3:
| demographic=hydrologists and other water experts
| demographic=hydrologists and other water experts
| showcases=the rainfall overlay in a iteration mode
| showcases=the rainfall overlay in a iteration mode
| image=demo_water_overview.jpg
| image=Demo_iteration.jpg
| description=The demo show the [[Simulation Core|iteration]] functionality that can be used to adjust the ground infiltration speed using a combo formula.
| description=The demo show the [[Simulation Core|iteration]] functionality that can be used to adjust the ground infiltration speed using a combo formula.
}}
}}


==Calculations using the Iteration option==
==Calculations using the Iteration option==
The demo project simulates a Dutch polder to demonstrate how rainfall infiltration can be modeled using the iteration option. A hypothetical formula is applied to calculate the infiltration rate per time step, based on the saturation level of the unsaturated zone. This iterative process determines the soil's saturation step by step, which in turn influences the potential infiltration.
The demo project simulates a Dutch polder to demonstrate how rainfall infiltration can be modeled using the [[Simulation Core|iteration]] option.  


The purpose of this demo project is to illustrate the capabilities of this iterative calculation method.
We want the speed at which rainwater infiltrates to depend on the degree of saturation of the soil. By dividing the rain event into several iteration steps, we can adjust the infiltration rate for each iteration step based on the degree of saturation of the soil. In this way, infiltration can be calculated in a more realistic way.
 
The purpose of this demo project is to clarify how an iterative calculation can be made. In this case, the infiltration of water during and after a precipitation event was chosen. However, on the basis of this demo project, it should also be possible to calculate other calculations iteratively.


==Setup of the Demo Project==
==Setup of the Demo Project==
The demo includes several essential components for performing these calculations. Each component is explained, along with the rationale for its use.
The demo project consists of a number of components that are essential for this calculation.  
 
Components:
 
*[[Combo Overlay]]
*[[Combo Overlay]]
*[[Rainfall Overlay]]
*[[Rainfall Overlay]]
*[[Iteration Collector]]
*[[Iteration Overlay|Iteration Collector]]
*[[Indicator]]
*[[Indicator]]
*Number of Iterations
*[[Simulation Core|Number of Simulation Iterations]]


==Combo Overlays==
==Combo Overlays==
Several overlays need to be prepared as inputs for the various iteration steps. Each step's outputs are set up for use in the subsequent iteration in combo overlays.
Before we create the Rainfall event, a number of overlays are created that serve as input for the various iteration steps. At the end of each iteration the combo overlay is updated an serves as the input for the next iteration step. We'll go through the different combo overlays.


===Combo Surface U and Combo Surface V===
===Combo Surface U and Combo Surface V===
When water flows, the velocity at the end of an iteration is used as the initial velocity for the next iteration. The overlay with the last U and V should be the input. Make sure to check the box "previous" to make sure the [[Combo overlay]] uses the U and V of the previous itertationstep.<br>
These overlays say something about the initial velocity of the surface water in x and y directions. When water flows down a slope, we want to use the speed at which the water flows at the end of an iteration step as the initial speed at the next iteration step. The input grid is the result of the last calculation. In the formula of this combo overlay, you can see that the formula is aimed at making sure that it computes with the data from the previous time step, unless the previous iteration step was step 0. In that case, 0 is used.
 
Make sure to check the box "previous" to make sure the [[Combo Overlay]] uses the U and V of the previous itertationstep.<br>
The formula in the combo overlay should in this case read: <code>IF(EQ(ITERATION, 0), 0, A)</code>
The formula in the combo overlay should in this case read: <code>IF(EQ(ITERATION, 0), 0, A)</code>


===Combo Fraction and Combo Groundwater Depth===
===Combo Fraction and Combo Groundwater Depth===
The percentage of the saturated fratcion of the unsaturated zone as well as the groundwaterdepth are both inputs for the next iteration stap. If there is no previous iterationi step, the [[global]] values are used. Make sure to check the box "previous" to make sure the [[Combo overlay]] uses the values of the previous itertationstep.
The purpose of the combo overlay Combo Fraction and the combo Groundwater Depth is to set the input from the previous iteration step to be used, unless the previous iteration step was step 0. In that case, a [[global]] value is used. The [[global]] DEFAULT_FRACTION is used for the saturation percentage, and the global DEFAULT_TABLE is used for the groundwater level.
 
For the saturation percentage the [[global]] GLOBAL_DEFAULT_FRACTION should be used.
<br>For the groundwater level the [[global]] GLOBAL_DEFAULT_TABLE shoulld be used.


<br> The formula in the combo overlay Combo Fraction should in this case read:  
<br> The formula in the combo overlay Combo Fraction should in this case read:  
<code> IF(EQ(ITERATION, 0), GLOBAL_DEFAULT_FRACTION, IF(EQ(A, NO_DATA), GLOBAL_DEFAULT_FRACTION, A))</code>
<code> IF(EQ(ITERATION, 0), GLOBAL_DEFAULT_FRACTION, IF(EQ(A, NO_DATA), GLOBAL_DEFAULT_FRACTION, A))</code>
<br> The formula in the combo overlay Combo Groundwater Depth should in this case read: <br>
<br> The formula in the combo overlay Combo Groundwater Depth should in this case read:
<code>IF(EQ(ITERATION, 0), GLOBAL_DEFAULT_TABLE, A)</code>
<code>IF(EQ(ITERATION, 0), GLOBAL_DEFAULT_TABLE, A)</code>


===Combo Surface===
===Combo Surface===
Determines input from previous iterations unless it’s iteration 0.
The combo Surface gives the last value of the waterlevel on the surface and is input for the next iteration step. If there is no previous iteration step, the value should be 0. Make sure to check the box "previous" to make sure the [[Combo Overlay]] uses the values of the previous itertationstep.
Formula:
IF(EQ(ITERATION, 0), 0, A)


Make sure to check the box "previous" to make sure the Combo overlay uses the values of the previous itertationstep.
<br> The formula in the combo overlay Combo Fraction should in this case read:
<code>IF(EQ(ITERATION, 0), 0, A)</code>


===Combo Infiltration Speed===
===Combo Infiltration Speed===
Calculates infiltration speed based on soil saturation using the Ground BOFEK ID overlay to identify soil type.
The purpose of the [[Combo Overlay]] Combo Infiltration Speed is to set the correct formula depending on the saturation of the soil. This example uses the overlay Ground BOFEK ID to determine the type of soil.  
Formula example:
 
MAX(0, SUB(GLOBAL_DEFAULT_INFIL, SWITCH(B, 0, 1004, MUL(10, SUB(A, GLOBAL_DEFAULT_FRACTION)), 1006, MUL(5, SUB(A, GLOBAL_DEFAULT_FRACTION)))))
The formula is entirely hypothetical and only serves to make it clear that, for each iteration step, a value is chosen based on the degree of saturation.
 
The formula in the combo overlay reads in this case:
<code>MAX(0, SUB(GLOBAL_DEFAULT_INFIL, SWITCH(B, 0, 1004, MUL(10, SUB(A, GLOBAL_DEFAULT_FRACTION)), 1006, MUL(5, SUB(A, GLOBAL_DEFAULT_FRACTION)))))</code>


==Rainfall Overlay==
==Rainfall Overlay==
Default settings are used for the rainfall overlay, with some exceptions:
When setting the rainfall overlay, the default settings can be used. The exceptions are described below.
 
Rain Event Duration: Here the the total duration of the calculation is specified. Later this is divided into different iterationsteps.
<br>Water System – Water Level: Here the initial water level and the U and V flow are set. Use the option "Advanced: Select Grid Overaly to set initial water level and also flow UV". 
The water level is set based on a specific overlay, which is the combo overaly Surface. Similarly, the y and x speed from the combo overlay is used as initial input.
<br>Groundwater: Initialize the groundwater level using the Groundwater Depth combo overlay.


Rain Event Duration: The total duration is specified and later divided into iterations.
<br>Unsaturated Zone: Initialize saturation and storage percentages per grid cell using the Fraction combo overlay.
Water System – Water Level: Set initial water level and UV flow using the Surface combo overlay.
<br>Generated Output Overlays:
Groundwater: Initialize groundwater level using the Groundwater Depth combo overlay.
Unsaturated Zone: Initialize saturation and storage percentages per grid cell using the Fraction combo overlay.
Generated Output Overlays:


Surface Last Value
*Surface Last Value
Rain
*Rain
Ground Last Value
*Ground Last Value
Ground Watertable
*Ground Watertable
Ground Last Unsaturated Storage
*Ground Last Unsaturated Storage
Ground Last Unsaturated Fraction
*Ground Last Unsaturated Fraction
Surface Last U
*Surface Last U
Surface Last V
*Surface Last V
The number of timeframes is set to 1.
*The number of timeframes is set to 1.


==Iteration Collector==
==Iteration Collector==
Displays results of each iteration step. The input overlay is the Rain Event.
The [[iteration collector]] is a type of overlay. It shows the results of each iteration step. An iteration collector needs an input overlay, in this case it is the Rainfall overlay. Of each iteration step one timeframes wil be saved.


Modulus: Set to 1 by default, meaning one output is saved per iteration as a timeframe in the collector.
An attribute of the [[iteration overlay]] is the [[modulus]]. The [[modulus]] determines how many iterations you store. By default, this is set to 1. This means that only one (the last) result of each iteration step is saved and used as a timeframe in the iteration collector. When the modulus is set to 1, every iteration is stored. When you set the modulus to 2, half of the iteration values ​​are stored.


==Indicator==
==Indicator==
Handles partial updates for specific timeframes.
Het doel van de indicator is het instellen van de start en eind tijd van de iteratiestap van de regenwateroverlay. Om dit te bewerkstelligen worden een aantal queries uitgevoerd . Allereerst wordt bepaald hoeveel iteratiestappen zijn gekozen en hoe lang de totale simulatietijd is ingesteld. Dit gebeurd met de query <code>SELECT_ITERATIONS_WHERE</code> en <code>SELECT_ATTRIBUUT_WHERE_NAME_IS_RAIN_M_AND_OVERLAY_IS_10_AND_RELATION_IS_WEATHER_AND_INDEX_IS_2</code>.<br><br>
Example formulas:
Met de querys <code>UPDATE_OVERLAY_PARTIAL_START_SEC_WHERE_OVERLAY_IS_3</code> en <code>UPDATE_OVERLAY_PARTIAL_END_SEC_WHERE_OVERLAY_IS_3</code> worden respectievelijk de begin en eindtijd van de volgende iteratiestap bijgesteld. Om te weten wat de volgende iteratiestap is wordt de query <code>SELECT_ITERATION_WHERE uitgevoerd</code>.<br><br>
Fraction Start en Fraction End geven de start en end als fractie. Bij Start en End wordt dit uitgedrukt in seconden door deze fractie te vermenigvuldigen met de totale simulatietijd.


UPDATE_OVERLAY_PARTIAL_END_SEC_WHERE_OVERLAY_IS_10
==Number of Iterations==
Queries like SELECT_ITERATIONS_WHERE and SELECT_ITERATION_WHERE retrieve the number of iterations and the current iteration.
The number of iterations can be set via the [[calculation panel]]. Here you find the option iteration where you can set the number of iterations. This is set to 1 by default.


==Number of Iterations==
==Exploring the results==
Set through the interface (default is 1).
To view the results of the calculation, the Iteration can be played everywhere. The following results can be seen here:
* Water on ground level in meters
* Iteration Fraction: The fraction of the total water storage capacity of the unsaturated zone that is filled with water in meters
* Iteration Storage: The amount of water in the unsaturated zone in meters
* Iteration Infil Speed: The infiltration speed in meters per day
* Iteration Rain: The total amount of rainfall up to that point in the simulation in meters.
* Iteration grondtable: The groundwater level in m + datum.
When the iteration ifil speed is viewed, it becomes clear that the two different soil types (BOFEK IDs) give a different result in the infiltration speed.


==Notes and Limitations==
==Notes and Limitations==
Debugging cannot be downloaded per iteration but can be saved for each iteration.
Debugging cannot be downloaded per iteration but can be saved for each iteration.
Specific updates (e.g., updating attributes for certain building types in iteration 5) can be executed using the API and indicator but not through TQL for non-initial iterations.
Specific updates (e.g., updating attributes for certain building types in iteration 5) can be executed using the API and indicator but not through TQL for non-initial iterations.
 
===Effect of Iterations on Calculation Accuracy===
 
When calculating a precipitation event, there may be a difference between a standard calculation and an iterative calculation, even if they use the same rainfall overlay. This is due to the way data is processed during an iterative calculation.<br>
 
In a standard calculation, the precipitation event is executed in a single step. In an iterative calculation, on the other hand, the event is split into multiple time steps, for example 10. After each iteration step, the data is stored and prepared for the next step. Rounding occurs during this process, which can affect the accuracy of the results.<br>
==Exploring the project==
The water levels are stored internally in a 64-bit format, which provides high precision with 12 decimal places. However, the results are displayed in a 32-bit format, which has an accuracy of 6 decimal places. In the iterative calculation, the 32-bit result is used. This causes small rounding differences between the results. The more iteration steps there are, the more often this rounding occurs and the larger the deviation can become.<br>
To begin exploring the project, see the outlet located on the left side.
At this point, these differences are considered negligible. If necessary, measures can be taken to solve this problem.


{{article end
{{article end

Latest revision as of 12:17, 20 November 2024

An overview of Demo Iteration.

The Demo Iteration project is available for all users and can be found in the main menu under Edit projects. This project does not count towards your license.

This project is intended for hydrologists and other water experts.

This project showcases the rainfall overlay in a iteration mode.

The demo show the iteration functionality that can be used to adjust the ground infiltration speed using a combo formula.

Calculations using the Iteration option

The demo project simulates a Dutch polder to demonstrate how rainfall infiltration can be modeled using the iteration option.

We want the speed at which rainwater infiltrates to depend on the degree of saturation of the soil. By dividing the rain event into several iteration steps, we can adjust the infiltration rate for each iteration step based on the degree of saturation of the soil. In this way, infiltration can be calculated in a more realistic way.

The purpose of this demo project is to clarify how an iterative calculation can be made. In this case, the infiltration of water during and after a precipitation event was chosen. However, on the basis of this demo project, it should also be possible to calculate other calculations iteratively.

Setup of the Demo Project

The demo project consists of a number of components that are essential for this calculation.

Combo Overlays

Before we create the Rainfall event, a number of overlays are created that serve as input for the various iteration steps. At the end of each iteration the combo overlay is updated an serves as the input for the next iteration step. We'll go through the different combo overlays.

Combo Surface U and Combo Surface V

These overlays say something about the initial velocity of the surface water in x and y directions. When water flows down a slope, we want to use the speed at which the water flows at the end of an iteration step as the initial speed at the next iteration step. The input grid is the result of the last calculation. In the formula of this combo overlay, you can see that the formula is aimed at making sure that it computes with the data from the previous time step, unless the previous iteration step was step 0. In that case, 0 is used.

Make sure to check the box "previous" to make sure the Combo Overlay uses the U and V of the previous itertationstep.
The formula in the combo overlay should in this case read: IF(EQ(ITERATION, 0), 0, A)

Combo Fraction and Combo Groundwater Depth

The purpose of the combo overlay Combo Fraction and the combo Groundwater Depth is to set the input from the previous iteration step to be used, unless the previous iteration step was step 0. In that case, a global value is used. The global DEFAULT_FRACTION is used for the saturation percentage, and the global DEFAULT_TABLE is used for the groundwater level.


The formula in the combo overlay Combo Fraction should in this case read: IF(EQ(ITERATION, 0), GLOBAL_DEFAULT_FRACTION, IF(EQ(A, NO_DATA), GLOBAL_DEFAULT_FRACTION, A))
The formula in the combo overlay Combo Groundwater Depth should in this case read: IF(EQ(ITERATION, 0), GLOBAL_DEFAULT_TABLE, A)

Combo Surface

The combo Surface gives the last value of the waterlevel on the surface and is input for the next iteration step. If there is no previous iteration step, the value should be 0. Make sure to check the box "previous" to make sure the Combo Overlay uses the values of the previous itertationstep.


The formula in the combo overlay Combo Fraction should in this case read: IF(EQ(ITERATION, 0), 0, A)

Combo Infiltration Speed

The purpose of the Combo Overlay Combo Infiltration Speed is to set the correct formula depending on the saturation of the soil. This example uses the overlay Ground BOFEK ID to determine the type of soil.

The formula is entirely hypothetical and only serves to make it clear that, for each iteration step, a value is chosen based on the degree of saturation.

The formula in the combo overlay reads in this case: MAX(0, SUB(GLOBAL_DEFAULT_INFIL, SWITCH(B, 0, 1004, MUL(10, SUB(A, GLOBAL_DEFAULT_FRACTION)), 1006, MUL(5, SUB(A, GLOBAL_DEFAULT_FRACTION)))))

Rainfall Overlay

When setting the rainfall overlay, the default settings can be used. The exceptions are described below.

Rain Event Duration: Here the the total duration of the calculation is specified. Later this is divided into different iterationsteps.
Water System – Water Level: Here the initial water level and the U and V flow are set. Use the option "Advanced: Select Grid Overaly to set initial water level and also flow UV". The water level is set based on a specific overlay, which is the combo overaly Surface. Similarly, the y and x speed from the combo overlay is used as initial input.
Groundwater: Initialize the groundwater level using the Groundwater Depth combo overlay.


Unsaturated Zone: Initialize saturation and storage percentages per grid cell using the Fraction combo overlay.
Generated Output Overlays:

  • Surface Last Value
  • Rain
  • Ground Last Value
  • Ground Watertable
  • Ground Last Unsaturated Storage
  • Ground Last Unsaturated Fraction
  • Surface Last U
  • Surface Last V
  • The number of timeframes is set to 1.

Iteration Collector

The iteration collector is a type of overlay. It shows the results of each iteration step. An iteration collector needs an input overlay, in this case it is the Rainfall overlay. Of each iteration step one timeframes wil be saved.

An attribute of the iteration overlay is the modulus. The modulus determines how many iterations you store. By default, this is set to 1. This means that only one (the last) result of each iteration step is saved and used as a timeframe in the iteration collector. When the modulus is set to 1, every iteration is stored. When you set the modulus to 2, half of the iteration values ​​are stored.

Indicator

Het doel van de indicator is het instellen van de start en eind tijd van de iteratiestap van de regenwateroverlay. Om dit te bewerkstelligen worden een aantal queries uitgevoerd . Allereerst wordt bepaald hoeveel iteratiestappen zijn gekozen en hoe lang de totale simulatietijd is ingesteld. Dit gebeurd met de query SELECT_ITERATIONS_WHERE en SELECT_ATTRIBUUT_WHERE_NAME_IS_RAIN_M_AND_OVERLAY_IS_10_AND_RELATION_IS_WEATHER_AND_INDEX_IS_2.

Met de querys UPDATE_OVERLAY_PARTIAL_START_SEC_WHERE_OVERLAY_IS_3 en UPDATE_OVERLAY_PARTIAL_END_SEC_WHERE_OVERLAY_IS_3 worden respectievelijk de begin en eindtijd van de volgende iteratiestap bijgesteld. Om te weten wat de volgende iteratiestap is wordt de query SELECT_ITERATION_WHERE uitgevoerd.

Fraction Start en Fraction End geven de start en end als fractie. Bij Start en End wordt dit uitgedrukt in seconden door deze fractie te vermenigvuldigen met de totale simulatietijd.

Number of Iterations

The number of iterations can be set via the calculation panel. Here you find the option iteration where you can set the number of iterations. This is set to 1 by default.

Exploring the results

To view the results of the calculation, the Iteration can be played everywhere. The following results can be seen here:

  • Water on ground level in meters
  • Iteration Fraction: The fraction of the total water storage capacity of the unsaturated zone that is filled with water in meters
  • Iteration Storage: The amount of water in the unsaturated zone in meters
  • Iteration Infil Speed: The infiltration speed in meters per day
  • Iteration Rain: The total amount of rainfall up to that point in the simulation in meters.
  • Iteration grondtable: The groundwater level in m + datum.

When the iteration ifil speed is viewed, it becomes clear that the two different soil types (BOFEK IDs) give a different result in the infiltration speed.

Notes and Limitations

Debugging cannot be downloaded per iteration but can be saved for each iteration. Specific updates (e.g., updating attributes for certain building types in iteration 5) can be executed using the API and indicator but not through TQL for non-initial iterations.

Effect of Iterations on Calculation Accuracy

When calculating a precipitation event, there may be a difference between a standard calculation and an iterative calculation, even if they use the same rainfall overlay. This is due to the way data is processed during an iterative calculation.
In a standard calculation, the precipitation event is executed in a single step. In an iterative calculation, on the other hand, the event is split into multiple time steps, for example 10. After each iteration step, the data is stored and prepared for the next step. Rounding occurs during this process, which can affect the accuracy of the results.
The water levels are stored internally in a 64-bit format, which provides high precision with 12 decimal places. However, the results are displayed in a 32-bit format, which has an accuracy of 6 decimal places. In the iterative calculation, the 32-bit result is used. This causes small rounding differences between the results. The more iteration steps there are, the more often this rounding occurs and the larger the deviation can become.
At this point, these differences are considered negligible. If necessary, measures can be taken to solve this problem.