Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reading ISG files #326

Open
Manangka opened this issue Feb 6, 2023 · 6 comments
Open

Add support for reading ISG files #326

Manangka opened this issue Feb 6, 2023 · 6 comments
Labels
backwards_compatibility Backwards compatibility with iMOD5

Comments

@Manangka
Copy link
Collaborator

Manangka commented Feb 6, 2023

In GitLab by @JoerivanEngelen on Feb 6, 2023, 17:31

From what I know, the ISG file format follows a fairly complicated data model.

It is however used in the regional models of the Netherlands, for the SFR package, as far as I know. (Not for the LHM).

@JoerivanEngelen
Copy link
Contributor

JoerivanEngelen commented Apr 9, 2024

Notes Part 1

I sat with @Huite to discuss possible approaches a while ago. He worked on a branch, but never got to finishing it.

My notes are as follows:

  • Investigate what ISG functionality is actually required.
  • The iMOD5 manual describes all ISG options
  • ASFR = 0 is standard ISG, ASFR = 1 requires graph. Don't support ASFR=1.

Segment definition

ISP   ISD
|     |
+-----x-----x-----x-----+

ISD: Calculation points
ISP: Segment definition points

Files

Basically:

  • ISP: segment definitions
  • ISD: calculation points, contains waterlevels
  • ISC: cross-sections

More specifically:

  • ISP: contains xy coordinates segment
  • ISD1: calculation point locations
  • ISD2: timeseries
  • ISC1: cross-sections settings
  • ISC2: definition cross-sections

ISC1

N > 0 : cross-section
N < 0 : bathymetry

DIST: distance along segments

ISC2

DIST: Distance of the cross-section measured from the centre of the riverbed (minus to the left, and positive to the right)

N > 0

      DIST       DIST
   |<------>|<---------->|
   |        |            x
  -x-       |  x        /
 x   \      | / \      /
/     \     |x   \    /
       x   /|     x--x
        --x |      

N < 0

    +---+---+---+
    |   |   |   |
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+
    |   |   |   |
    +---+---+---+
            | O |
            +---+

Data which defines cell O:

if dx > 0 and dy > 0:

  • (x, y, z)
  • where: z = 32-bit float

if dx < 0 and dy < 0

  • (x, y, z_m, z_c, z_p),
  • where: z_m = 16-bit int, z_c = 8-bit int, z_p = 8-bit int

IST

For weirs

w_level_up  ->
------------|
            |
            | w_level_down
            |---------------

ISQ

For Q-H relations

Tabulated rating curve (just like RIBASIM)

Q, width, depth, factor

@JoerivanEngelen JoerivanEngelen moved this from 📯 New to 🤝 Accepted in iMOD Suite Apr 9, 2024
@github-project-automation github-project-automation bot moved this to 📯 New in iMOD Suite Apr 9, 2024
@JoerivanEngelen JoerivanEngelen moved this from 🤝 Accepted to 📯 New in iMOD Suite Apr 9, 2024
@JoerivanEngelen
Copy link
Contributor

Notes part 2

Gridding bathymetry (N<0)

Say for the following 2D bathymetry grid:

    +---+---+---+
    |   |   |   |
+---+---+---+---+
|   |   |   |   |
+---+---+---+---+
    |   |   |   |
    +---+---+---+
            |   |
            +---+

We have the following line orthogonal to the segment at calculation point X:

    +---+---+---+
    | 4\|   |   |
+---+-------+---+
|   |   |\3 |   |
+---+---+-X-+---+
    |   | 2\|   |
    +---+---+---+
            |\1 |
            +---+

With the following cross-sections and water-level h at the calculation point:

|                       |
|                       |
|                       |
x-----x                 |
   1  |~~~~~~~~~~~~~~~~~|<-- h
      |                 |
      x-----x     x-----x
         2  |     |  4
            x-----x
               3

The bathymetry can be gridded to a Ugrid2D. The orthogonal lines at calculation points can be used to map stages at calcution points to bathymetry grid cells. The grid can be fully filled with a Laplace interpolation. All cells active where h>bottom, else make nan

@JoerivanEngelen
Copy link
Contributor

JoerivanEngelen commented Apr 10, 2024

Notes part 3

Gridding cross-sections (N>0)

We discussed rasterrizing the cross-sections by using a buffer of their maximum width, but this idea was discarded because of the many (literal) corner cases.

For each profile, create a table with the wetted area/perimeter for each stage.
Conduct piecewise linear interpolation for inbetween values.

  h  | A
-----------
0.1  | 1.0
0.2  | 2.2
0.3  | 3.1
....

This can be used to compute the conductance. River bottom elevation is determined by simply taking the minimum elevation. Stage is defined by calculation points ISG.

In this way, we can keep things to rasterizing a 1D Ugrid network, as explained further.

For the following segment laying on a grid:

                       O
                      /
+------+------+------+
|      |      |     /|
|      |      |    / |
+------+------+---/--+
|      O------|--O   |
|     /|      |      |
+------+------+------+
|   /  |      |      |
|  O   |      |      |
+------+------+------+

Then we add extra points on the 1D network where it intersects the grid edges (the numbers indicate cellids for the first column):

                       O
                      /
+------+------+------X
|0     |      |     /|
|      |      |    / |
+------+------+---X--+
|3     O------X--O   |
|     /|      |      |
+----X-+------+------+
|6  /  |      |      |
|  O   |      |      |
+------+------+------+

The new intersection points can be filled with Laplace interpolation. With this, we can work towards the following table, which is used to compute conductances:

segment|cellid|length|h_int|wetted_fraction
-----------------------------------------
0      | 6    | 0.75 |  .  |     .
1      | 3    | 0.75 |  .  |     .
2      | 4    | 1.5  |  .  |     .
3      | 5    | 0.5  |  .  |     .
4      | 5    | 0.25 |  .  |     .
5      | 2    | 1.25 |  .  |     .

For this we require tools to refine networks, based on vertices. Care should be taken here with the indexes.

0               1    	    2
^               ^    	    ^
O---X---X---X---O---X---X---O
^   ^   ^   ^   ^   ^   ^   ^
0   1   2   3   4   5   6   7

Should become:

O---X---X---X---O---X---X---O
^   ^   ^   ^   ^   ^   ^   ^
0   4   5   6   2   7   8   3

This requires the following features:

@JoerivanEngelen
Copy link
Contributor

JoerivanEngelen commented Apr 10, 2024

@Huite and I had a meeting with Wouter. It was mentioned there that:

  • The Bathymetry grids are used mainly for big rivers in Moria & Ibrahym
  • Big rivers with 1D cross-section profiles rarely occur

@Huite
Copy link
Contributor

Huite commented Apr 10, 2024

Laplace interpolation for 1D has already been fixed a little while ago: Deltares/xugrid@90c03be

@JoerivanEngelen
Copy link
Contributor

Thanks, updated the list with issues to track in the other repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backwards_compatibility Backwards compatibility with iMOD5
Projects
Status: 📯 New
Development

No branches or pull requests

3 participants