null

Message Boards

Delft3D-WAQ. Different dispersion for each cell

AR
Alonso Rodríguez Benítez, modified 4 Years ago.

Delft3D-WAQ. Different dispersion for each cell

Youngling Posts: 4 Join Date: 1/7/15 Recent Posts
Hi. I have a question about Delft3D-WAQ. Is there a way to specify different values of dispersion coefficients for each cell on the mesh?

Thanks for your help.
Christophe Thiange, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell (Answer)

Jedi Knight Posts: 125 Join Date: 11/15/12 Recent Posts
Hi Alonso,

Yes, you can define spatially varying dispersion coefficients.

But first of all, dispersion coefficients are not defined per cell (or segment) but per exchange, the interface between two segments.

D-WAQ organizes exchanges per direction. When used with curvilinear grids there are two directions in the horizontal direction (the two grid axes) and a third direction being the vertical in the case of a 3D model.

The GUI allows you to specify uniform coefficients for all the relevant directions.
To use spatially varying coefficients you can use additional dispersion arrays. To do so, activate the checkbox "Use dispersion arrays" located under the uniform dispersion coefficients.
You then have to specify the file containing the additional dispersion coefficients. You can write such a file yourself with a regular text editor.
Here's a template you could use:
;Data option:
1 ; InformationInformation is constant and input will be provided without defaults
  ; See section 11.2 of the input file description manual
;
; first direction
;
1.0 ; scale factor
; dispersion values as a matrix with shape nb_of_exchanges x nb_dispersion_arrays:
2.0000e+01 ; dispersion coeff for 1st exchange in first direction
2.1000e+01 ; dispersion coeff for 2nd exchange in first direction
1.8000e+01 ; dispersion coeff for 3rd exchange in first direction
1.7000e+01 ; dispersion coeff for 4th exchange in first direction
...
2.5000e+01 ; dispersion coeff for last exchange in first direction
;
; second direction
;
1.0 ; scale factor
; dispersion values as a matrix with shape nb_exchanges x nb_dispersion_arrays:
2.0000e+01 ; dispersion coeff for 1st exchange in second direction
2.1000e+01 ; dispersion coeff for 2nd exchange in second direction
1.8000e+01 ; dispersion coeff for 3rd exchange in second direction
1.7000e+01 ; dispersion coeff for 4th exchange in second direction
...
2.5000e+01 ; dispersion coeff for last exchange in first direction

; no third direction (2D model)

The number of records for each direction should match the number of exchanges of each directions. You can find these numbers in block 4 of your input file. Look for something like:
; fourth block of model input (transport)
600  ; exchanges in direction 1
600  ; exchanges in direction 2
0  ; exchanges in direction 3
;

Saving this file with a *.dsp extension, specifying it's name in de GUI and saving the scenario will modify your input file in the following way:

In block 4 of your input file you should see the following:
0  ; dispersion arrays
0  ; velocity arrays

changing to:
1  ; dispersion arrays
'DispArray'
3*1
0  ; velocity arrays

Where 3 is the number of active substance in your model.

If you want to use different additional dispersion arrays depending on the substance, you have to manually modify the input file to add more than one dispersion array and specify which array is to be used for which substance:
2  ; dispersion arrays
'DispArray_1'
'DispArray_2'
1 0 2
0  ; velocity arrays
Here we have defined two dispersion arrays. The first one will be used for substance 1, the second one for substance 3. For substance 2 only the uniform dispersion coefficients will be used.

Now we have to modify our *dsp file accordingly by adding an extra column for the second dispersion array:
;Data option:
1 ; InformationInformation is constant and input will be provided without defaults
  ; See section 11.2 of the input file description manual
;
; first direction
;
1.0 ; scale factor
; dispersion values as a matrix with shape nb_of_exchanges x nb_dispersion_arrays:
2.0000e+01 3.1000e+01 ; dispersion coeffs for 1st exchange in first direction for dispersion arrays 1 and 2
2.1000e+01 3.2000e+01 ; dispersion coeffs for 2nd exchange in first direction for dispersion arrays 1 and 2
1.8000e+01 3.2000e+01 ; dispersion coeffs for 3rd exchange in first direction for dispersion arrays 1 and 2
1.7000e+01 3.3000e+01 ; dispersion coeffs for 4th exchange in first direction for dispersion arrays 1 and 2
...
2.5000e+01 3.6000e+01 ; dispersion coeffs for last exchange in first direction for dispersion arrays 1 and 2
;
; second direction
;
1.0 ; scale factor
; dispersion values as a matrix with shape nb_exchanges x nb_dispersion_arrays:
2.0000e+01 3.4000e+01 ; dispersion coeffs for 1st exchange in second direction for dispersion arrays 1 and 2
2.1000e+01 3.8000e+01 ; dispersion coeffs for 2nd exchange in second direction for dispersion arrays 1 and 2
1.8000e+01 3.9000e+01 ; dispersion coeffs for 3rd exchange in second direction for dispersion arrays 1 and 2
1.7000e+01 3.9000e+01 ; dispersion coeffs for 4th exchange in second direction for dispersion arrays 1 and 2
...
2.5000e+01 3.3000e+01 ; dispersion coeffs for last exchange in first direction for dispersion arrays 1 and 2

; no third direction (2D model)

If you have a lot of redundant values, you can specify defaults in your *.dsp file. For more info have a look at the input file description manual:
- section 4.3
- section 4.5.1
- section 11.2 (look for the text under "ASCII input if the first option was -1 or 1")

To know the number of an exchange between two segments you will have to look into the pointer file (*.poi).
The *.poi file is just a sequence of integers representing the from, to, from-1 and to+1 segment numbers of each exchange.
So the first four integers refer to exchange 1, the next four to exchange 2, etc...
The segment numbers can be visualized with quickplot.

Hope this helps.
Javier García Alba, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell

Youngling Posts: 12 Join Date: 1/4/12 Recent Posts
Hi Christophe,
I tried to open the com.poi file with quickplot and this type can not be open with quickplot (matlab). Can you explain better how I can read this file?

Thank you in advance,

Regards
Christophe Thiange, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell

Jedi Knight Posts: 125 Join Date: 11/15/12 Recent Posts
The pointer file (*.poi) cannot be read by QUICKPLOT. See here instead.

I mentioned QUICKPLOT to visualize the segment numbers since the *.poi file describes exchanges using segment numbers. To display those numbers spatially just run a simple simulation with your model to produce a *.map file and load it in QUICKPLOT. One of the available output variables will be those segment numbers.
AR
Alonso Rodríguez Benítez, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell

Youngling Posts: 4 Join Date: 1/7/15 Recent Posts
Dear Christophe. Thank you very much for your answer. I found it very useful. I could observe the segment numbers in QUICKPLOT from .map file, and locate the .poi file from the copuling. I also could convert it from binary to ascii using the script Michel posted here:
http://oss.deltares.nl/web/delft3d/delwaq/-/message_boards/view_message/586986#_19_message_587235

My problem now is how to generate the .dsp file specifying the dispersion coefficients for each exchange. I have a lot of elements in the mesh. From .inp file, the number of exchanges is 148282 for each direction (296564 in total). The most viable way to do this would be using a bidimensional data entry aid, like QUICKIN. Is there a way to do so?

Thanks in advance for your help
AR
Alonso Rodríguez Benítez, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell

Youngling Posts: 4 Join Date: 1/7/15 Recent Posts
Well, I have been thinking about this procedure:

With the aid of the QUICKPLOT, selecting the segment number dataset of the .map file; and use the select grid range button of the grid view tool. Then files containing the list of the segment numbers of specific areas of the mesh can be generated. Then a script can be written in order to generate an array of dispersion coefficient which can be used to build the .dsp file. The script reads the segment numbers of from and to columns of the .poi file for each exchange and assigns the dispersion value according to the segment numbers of the specific area files generated before with the QUICKPLOT.

Is there a better way? If this is the way to build the .dsp file, I have a doubt: Can I assume that the .poi file has first the list of the exchanges for first direction, and then comes the list for second direction, or does it has a mixed order, like 1) first cell, first direction 2) first cell, second direction 3) second cell, and so on? This is to know where to cut, in the script to be built, the generation of the dispersion array for first direction, and begin the one for the seconf direction.

Thank you.
Christophe Thiange, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell

Jedi Knight Posts: 125 Join Date: 11/15/12 Recent Posts
Hi Alonso,

There is no graphical tool available to generate *.dsp files. You have to build your own scripts instead. The method you proposed sounds fine.

To answer your question, the exchanges are sorted by direction. The first noq1 exchanges are in the first direction, then you have noq2 exchanges in the second direction and finally noq3 exchanges in the third direction. Of course the number of directions depends on your model. If you have a 3D schematisation, then the vertical direction is the third one.
AR
Alonso Rodríguez Benítez, modified 4 Years ago.

RE: Delft3D-WAQ. Different dispersion for each cell

Youngling Posts: 4 Join Date: 1/7/15 Recent Posts
Hi Christophe, I have found your comments very helpful. Thank you very much.