Home

Open Processes Library User Manual

image

Contents

1. Edit list of Available Substances Figure 4 7 Edit Substances list or select a substance window with the new sub stances selected Deltares 21 of 56 Open Processes Library User Manual soe TT D Substance Boichemical Oxygen Demand 5 day E Active Available Processes Figure 4 8 The empty Select Processes window for Biochemical Oxygen Demand 5 day Process name lt 50 characters Process ID lt 10 characters must be unique Available processes for this substance Add Edit Delete Save Cancel Figure 4 9 Add new and Edit existing Processes window 22 of 56 Deltares Tutorial Process identification Properties of the FORTRAN subroutine Process ID Process name Name lt 10 chars lt 10 chars lt 50 characters BODDecay Decay of Biochemical Oxygen Demand 7 Acts on horizontal exch interfaces Acts on vertical exch interfaces Input items in their order of appearance in the FORTRAN code Add Edit Delete Output FLUXES in their order of appearance in the FORTRAN code Delete Other output items in their order of appearance in the FORTRAN code Add Edit Delete Create FORTRAN code Save cancel CREATE Figure 4 10 Edit processes window for process window for the newly created BOD Decay pr
2. Figure 4 4 Edit substances list or select a substance window before our new group 4 3 Create substances If you select the BOD DO group also in the right hand side list of the Edit groups list or select a group window Figure 4 3 then the Edit substances list or select a substance window of Figure 4 4 opens We want to add substances to the group so we press the Edit button to edit the substances list We now see the window of Figure 4 5 Because you use this window to display add or edit substances in a substances group the name of the group is displayed in the window title BOD DO in our case The window contains a number of input fields The substance name which can extend to 50 characters and is meant for a meaningful description It does not need to be unique but it is easier if it is It is displayed in many windows The unique substance ID by which each substance is identified is limited to 10 characters only and gives little opportunity for a meaningful description Nevertheless you should try to make the ID as explanatory as possible The end user will see the ID for instance as a name in the output files 18 of 56 Deltares Tutorial Substance name lt 50 characters Substance ID lt 10 characters must be unique v Transportable v Substance Unit lt 20 characters v Available Substances in Group Add Change Delete Save Cancel Figure 4 5 Ad
3. Figure 4 23 BOD DO curve for BOD Decay as before but now with reaeration compute the percentage of saturation as output variable because that can be a useful item for graphical presentation The flow velocity and the total depth and depth of computational elements need to be calcu lated by separate processes The water guality module only has flow velocities at the inter faces of computational elements and the total depth and element depth are no state variables at all There are several solutions to this issue You can Use the pre programmed processes in the standard processes library that take care of velocity and both depth values You do so in the standard processes library by selecting the items Velocity Depth and TotalDepth that are already available there They are calculated by the processes Veloc DynDepth and TotDepth respectively Or you can also program them yourself as will be explained in the Chapter 5 If you do the last you need to do so only once because once the processes are on your bookshelf you can use them any time you want If you follow the last line of working you will get more familiar with the advanced topics of process library programming This basically should allow you in the end to rebuild Deltares pre programmed processes library yourself from scratch using our technical reference man ual and program anything additional that comes to your mind We will fo
4. Enabling Delta Life Open Processes Library User Manual D Water Ouality Version 0 99 Revision 41593 18 December 2015 Open Processes Library User Manual Published and printed by Deltares telephone 31 88 335 82 73 Boussinesgweg 1 fax 31 88 335 85 82 2629 HV Delft e mail info deltares nl P O 177 www https www deltares nl 2600 MH Delft The Netherlands For sales contact For support contact telephone 31 88 335 81 88 telephone 31 88 335 81 00 fax 31 88 335 81 11 fax 31 88 335 81 11 e mail sales deltaressystems nl e mail support deltaressystems nl www http www deltaressystems nl www http www deltaressystems n Copyright O 2015 Deltares All rights reserved No part of this document may be reproduced in any form by print photo print photo copy microfilm or any other means without written permission from the publisher Deltares Contents Contents 1 Aguide to this manual 1 LI SONG 4 4 sa 8 a 4 35 6 Rh re ME jrin K a 1 1 2 Manual version and revisions 2 ss sk 1 1 3 Typographical conventions kk e 1 2 Introduction to Open PLCT 3 al ESK o son ke Pe hee aie Suan se Na Hoe ek he oe s 3 22 ene cee e E 4 eg eee a a Phe ee ee eae AS KUR 6 3 Getting started 11 3 1 StartingDelff8D 2 2 2 22 JAR se ee ees 11 3 2 Getting into the OpenPLCOT Mh hhh 11 3 3 Exiting OpenPLCT AM Sc ls 13 4 Tutorial 15 4 1 Howto start t
5. 1 Water velocity in midpoints of comp elements 2 Total water depth at this horizontal location 3 Water depth of this computational element 4 Saturation value for Dissolved Oxygen 5 Dissolved Oxygen order of appearance in the FORTRAN code 1 Reaeration flux for Dissolved Oxygen Create FORTRAN code CREATE Figure 4 21 Edit Processes window for the DO reaeration process 35 of 56 4 9 1 Open Processes Library User Manual integer nog4 I Nr of exchanges in the bottom bottom layers specialist use only integer ipnt 5 l Local work array for the pointering integer iseg Local loop counter for computational element loop Heo oo Sa AS EEE EE EEEE SS GGG RR I IA CK aa sk kk Type Name I 0 Description Unit real 4 Velocity I Water velocity in midpoints of comp elements m s real 4 Tot Depth I Total water depth at this horizontal location m real 4 Depth I Water depth of this computational element m real 4 DO Sat I Saturation value for Dissolved Oxygen g m3 real 4 Oxygen I Dissolved Oxygen g m3 real 4 DO R flux F Reaeration flux for Dissolved Oxygen g m3 d integer IDO_R_flux Pointer to the Reaeration flux for Dissolved Oxygen DS SSO OS ooo ooo ooo a RIS Ia Ia a kK k kk kkk ipnt IDO_R_flux ipoint 1 do 9000 iseg 1 noseg Velocity pmsa ipnt 1 Tot_Depth pmsa ipnt Depth pmsa ipnt 3 DO Sat pmsa
6. application_type Indicating in which environment the PLCT is running Delft3D or SOBEK nefis data file and nefis definition file The configuration tables of the processes library are contained in a database file These used to be two files lt proc def dat gt and lt proc def def gt but a more recent version of the underlying library combines these two files into one If these parameters are missing the PLCT will prompt you to select them If you have an empty processes library then these files are simply missing At the prompt you just push the Cancel button and the PLCT starts with an empty processes library Once you have edited things and you save your work in a processes database your own processes library then you can specify this file at the next startup and you can continue where you have saved the work in the previous session The file you save is created as a single file defaulthome This is the directory containing any selected substances processes and or items with normal use of the PLCT In general you do not need this directory when you are adding new items to the library Usually you will start the PLCT from the SOBEK or Delft3D user interface at normal use and then it is set by the respective user interfaces Your configuration should match the license file that you have got If started with an empty processes library your configuration will become USER Example General Deltares 15 of 56 4 2 O
7. KKK e 29 Open Processes Library OPL window L 31 Specify processes window for process Decay of Biochemical Oxygen Demand 32 BOD DO curve for BOD Decay x axis in km y axis BOD lower graph and Oxygen upper Apni 498 s ss NL VLK VV a 33 Adding substance Dissolved Oxygen reaeration 34 Edit Processes window for the DO reaeration process 35 Source code of the Oxygen Reaeration process L 36 BOD DO curve for BOD Decay as before but now with reaeration 37 Computer code to compute horizontal velocities 42 Code to compute the total water depth at all locations 44 Code modified with lines for computation at active segments only 45 Sample Fortran file for reaeration of Dissolved Oxygen 46 Subroutine for temperature dependent BOD Decay with optimisations 50 V Open Processes Library User Manual vi Deltares List of Tables List of Tables 5 1 Items that are available to the process library from the system 51 Deltares vii Open Processes Library User Manual viii Deltares 1 1 1 2 1 3 A guide to this manual Introduction The Open Processes Library is an extensible collection of subroutines used by the water quality module in Delft3D and SOBEK To support this extensibility the tool that gives access to the contents of the processes library has been adjusted It now essentially has two modes
8. Now we save the stoichiometry and we save the flux Deltares 27 of 56 4 6 Open Processes Library User Manual Edit stochiometry of flux Decay flux of BOD Substance ID B0D5 Factor 1 000000 Substance name Boichemical Oxygen Demand 5 day aud Factor Substance r Change 1 000000 Boichemical Oxygen Demand 5 da 1 000000 Dissolved Oxygen Delete inn in Figure 4 15 Edit Stochiometry of flux window after stoichiometry has been entered Generating computer code The Edit Process window now shows the input items and the flux item in its lists see Fig ure 4 16 We now have to create the subroutine that will do the actual work Fill in the name of the subroutine BOD_DECAY Press the CREATE button The system generates a skeleton subroutine file We will call our subroutine BOD_DECAY and we press the CREATE button for the creation of a Fortran file The system tells that it successfully wrote the skeleton file and indeed we see that a file named lt BOD_DECAY f90 gt is created in our working directory The code is standard Fortran90 except for the question marks where you are supposed to insert your water quality computations Inspection shows something like subroutine BOD DECAY pmsa fl ipoint increm noseg amp noflux iexpnt iknmrk noqi noq2 amp 1093 1094 DEC ATTRIBUTES DLLEXPORT ALIAS BOD_DECAY BOD DECAY boaa
9. NOQ2 00003 NOQ3 NOQ4 00004 C D0005 CKXLLKXKXKKKKKKLLXLXKXKKKKKKKLLNXKXKKKKKKKKNLNLNXKXKKKKKKKKNLN K KKKKKKKNLNLN K KKKKKKKNNLNXNKKKKKK 00006 00007 IMPLICIT NONE 00003 C 00009 C Type Nane 1 0 Description 00010 C 00011 REAL 4 PMSA 11 0 Process Manager System Array window of routine to process library 00012 REAL 4 FL O Array of fluxes made by this process in mass volume time 00013 INTEGER IPOINT 4 I Array of pointers in PMSA to get and store the data 00014 INTEGER INCREM 4 I Increments in IPOINT for segment loop O constant l spatially varying 00015 INTEGER NOSEG I Number of computational elements in the whole model schematisation 00016 INTEGER NOFLUX I Number of fluxes increment in the FL array 00017 INTEGER IEXPNT I From To From 1 and To 1 segment numbers of the exchange surfaces 00018 INTEGER IKNMRK I Active Inactive Surface water bottom see manual for use 00019 INTEGER NOQ1 I Nr of exchanges in ist direction only horizontal dir if irregular mesh 00020 INTEGER NOQ2 I Nr of exchanges in 2nd direction NOQ1 NOQ2 gives hor dir reg grid 00021 INTEGER NOQ3 I Nr of exchanges in 3rd direction vertical direction pos downward 00022 INTEGER NO04 I Nr of exchanges in the bottom bottom layers specialist use only 00023 INTEGER IPNT 4 Local work array for the pointering anne INTEGER ISEG Local loop counter for computational element loop 025 C D0026 Cree 2636 36 96 96 96 36 2 2 JE JE IE EIE JE J
10. multiplication with the water surface area m and division by the underlying water volume m This means the reaeration coefficient consists of a 3 95 v Depth part m day and a 1 Depth part 1 m from surface area divided by volume The last term reflects that surface reaeration influences shallow water more pronounced than deep water Because O Connor derived his formula for depth averaged modelling both factors con taining the depth were egual for him In a 3D model you should use the total water depth in the factor 3 95 v Depth gt and the depth of a computational element in the factor 1 Depth To get the oxygen flux we have to multiply the O Connor Dobbins rate with the difference between the oxygen saturation value and the actual oxygen concentration So we define a reaeration process with five input items and one output flux item Five input items 1 Id Velocity name Water velocity in midpoints of comp elements unit m s 2 Id Tot Depth Deltares 33 of 56 Open Processes Library User Manual Process name lt 50 characters Reaeration of Oxygen at the water surface Process ID lt 10 characters must be unique DO Rear v Available processes for this substance Decay of Biochemical Oxygen Demand Edit Delete Save Cancel Figure 4 20 Adding substance Dissolved Oxygen reaeration name Total water depth at th
11. 56 Deltares 5 5 Advanced programming Settling from the water column towards the bottom The BOD DO example up to now was limited to the water column either as one depth av eraged computational element or as layered system of computational elements Part of the water quality substances may not be dissolved but may be particulate Especially in BOD as raw sewage a substantial part may be released as particulate fraction The settling tanks in a treatment plant may reduce the release of particulates but may not fully eliminate them And why wouldn t you want to apply the water quality model to a settling tank Roughly there are two approaches to the settling of substances You define additional substances for the settled substances Those substances are NOT transported with the water and are only found in the bottom layer of a 3D system Settling then means a migration from the water bound normal substance to the settled substance This is the way the simple sediment model in Deltares processes library works All partic ulate substances in the water have their S1 and S2 equivalent for the first and the second sediment layers But also all sediment models with own often analytical solutions of the behaviour IN the bottom work this way In dedicated versions of the Deltares processes library this holds for the European ERSEM model and for the US HydroQual Sediment Flux Model SFM You define bottom layers underneath the water phase
12. D rate PMSA IPNT 1 00046 BOD PMSA IPNT 2 00047 C 00048 C ted Insert your code here xxx 00049 C 00050 BOD D flux 777777 00051 C 00052 C dad End of your code d 00053 C 00054 FL IBOD D flux BOD D flux 00055 C 00056 endif 00057 C 00058 IBOD D flux IBOD D flux NOFLUX 00059 IPNT IPNT INCREM 00060 C 00061 9000 CONTINUE 00062 C 00063 RETURN 00064 00065 End of File Figure 5 3 Code modified with lines for computation at active segments only The feature or segment property Up to now all computational elements were considered the same They however may not be the same In some Delft3D schematisations a full matrix is used with roughly half of the computational elements being active and the others being inactive One may want to limit water guality computations to active elements only Speaking about Delft3D the reaeration as introduced in previous BOD DO example only works at the water surface This means that we want to see whether our computational element is a water surface element and equally for any bottom oxygen demand that you may whish to introduce you want to see whether a computational element is at the bottom There are generic approaches for this allowing your model to automatically work correct both in depth averaged mode and in modes with a schematisation between the surface and the bottom like in 2D vertical and in 3D models Together with the software of you deve
13. Increments in IPOINT for segment loop O constant l spatially varying 00016 INTEGER NOSEG I Number of computational elements in the whole model schematisation 00017 INTEGER NOFLUX I Number of fluxes increment in the FL array 00018 INTEGER IEXPNT 4 I From To From 1 and Tori segment numbers of the exchange surfaces 00019 INTEGER IKNMRK I Active Inactive Surface vater bottom see manual for use 00020 INTEGER NO01 I Nr of exchanges in Ist direction only horizontal dir if irregular mesh 00021 INTEGER NOQ2 I Nr of exchanges in 2nd direction NOQ1 NOQ2 gives hor dir reg grid 00022 INTEGER NOQ3 I Nr of exchanges in 3rd direction vertical direction pos downward 00023 INTEGER NO04 I Nr of exchanges in the bottom bottom layers specialist use only 00024 INTEGER IPNT 2 i Local work array for the pointering 00025 INTEGER ISEG Local loop counter for computational element loop 00026 C 00027 0202663636 96 9696 96 EJE JEJEJE IE JEJE JE FEJE KIEN JE JEJE JE IK JE HEFE JE JEJE JE MEJE JE JEJE JE EJE JE HEME JEPE JE JE EJE JE PEJE JE E JE EI IE 00028 C 00029 C Type Name I O Description Unit 00030 C 00031 REAL 4 Depth I Water depth of this computational element m 00032 REAL 4 Tot Depth O Total water depth at this horizontal location m 00033 INTEGER IQ Local loop counter for exchanges loop 00034 INTEGER Ifrom Ito Local help variables with from and to comp element numbers 00035 C 00026 CHEIE se se 2626 3636
14. MEIE IE IE 3 X II JE JE II KX AX HEH E JE JE JEJE JE HH JE EJE JE E JE JE JE JE JE E JE JE IE JE JE IE JE JE JEJE JEJE JE JE JEJE JEJE JE JE JE JE JE JEJE JEJEJE JEJEJE JEJEJEJE 00037 C 00038 IPNT IPOINT 00039 C 00040 C Copy the depth of computational elements in the Total Depth array 00041 C Somewhat expanded to show meaning of array locations 00042 C 00043 DO 10 ISEG 1 NOSEG 00044 Depth PMSA IPNT 1 1 ISEG 00045 Tot Depth Depth 00046 PMSA IPNT 2 1 ISEG Tot Depth 00047 10 CONTINUE 00048 C 00049 C Sum the depths according to the vertical pointer 00050 C 00051 DO 20 IQ NO01 N002 1 NO01 N002 N003 00052 Ifrom IEXPNT 1 10 00053 Ito IEXPNT 2 1Q 00054 IF Ifrom GT 0 AND Ito GT 0 THEN 00055 PMSA IPNT 2 1 Ito PMSA IPNT 2 1 Ito 00056 PMSA IPNT 2 1 Ifrom 0005 PMSA IPNT 2 1 Ifrom 0 0 00058 ENDIF 00059 20 CONTINUE 00060 C 00061 C Fill all Total Depth values in reversed order 00062 C 00063 DO 30 IQ NO01 N002 N003 NO01 N002 1 1 00064 Ifrom IEXPNT 1 10 00065 Ito IEXPNT 2 10 00066 IF Ifrom GT 0 AND Ito GT 0 THEN 00067 IF PMSA IPNT 2 1 Ito GT 0 0 00068 PMSA IPNT 2 1 Ifrom PMSA IPNT 2 1 Ito 00069 ENDIF 00070 30 CONTINUE 00071 00072 RETURN 00073 END 00074 x End of File Figure 5 2 Code to compute the total water depth at all locations of this is that in all locations
15. Processes Library Return to Delft3D WAQ tools menu Select working directory Figure 3 3 Open Processes Library OPL window to start the OpenPLCT To start the OpenPLCT for WAQ simple algae a similar path need to be followed 12 of 56 Deltares Getting started Messages D Processes Library Configuration Tool EI x m Edit groups list or select a group File Edit Help Available Groups Selected Groups Configuration OPL Developer environment Edit list of available groups Figure 3 4 Open Processes Library Configuration Tool start windows empty database 3 3 Exiting OpenPLCT To exit the OpenPLCT Click File Exit You will be back in the Open Processes Library OPL selection window see Figure 3 3 Now ignore the other options and just Click several times Return to return to the main window of Delft3D MENU see Figure 3 1 Click Exit The window is closed and the control is returned to the desktop or the command line This Getting Started session will have given you the general idea of how to access the Open Processes Library Configuration Tool OpenPLCT Deltares 13 of 56 Open Processes Library User Manual 14 of 56 Deltares 4 Tutorial 4 1 The Open Processes Library is the developer environment of the existing Deltares Processes Library Configuration Tool PLCT Every licensed user who is
16. flexible but like with everything in life exaggeration will do no good The two checkboxes act on horizontal vertical exchanges in the upper right corner are re served for future use We see three empty lists Input items This is the list of all items that the process needs to do its computation Output Fluxes The list of all arrows between substances that the process will compute Other output items The list of all output items that the process will produce Input items We need the decay rate k for BOD as input parameter for the simple BOD decay formula OBOD z Tha BOD 4 1 In general however this decay rate is temperature dependent according to ky kao E TER 4 2 coef The rate equals the rate at 20 C multiplied with a temperature coefficient to the power 7 20 This means that we now have three input items temperature the temperature coefficient and the decay coefficient at 20 C We press the Add button besides the Input Items section and the Edit Item window appears Figure 4 11 Here we insert the ID BOD Dr 20 with the name Decay rate at 20 C for Biochemical Oxy gen Demand this is 48 characters so about the maximum for this field O Remark ID s are directly used in the computer generated source code So they should be valid Fortran names Use underscores in stead of minus signs That is also the reason why Oxygen should be preferred as ID rather that DO because
17. form of waste loads meteorology open boundary concentrations etc Important scope of work for the water guality modeller however is the selection of substances and or ganisms to be included in the model and the nature of their mutual interactions This selection of substances and their mutual interactions is perhaps as important for the water guality mod eller as grid generation is for the hydrodynamic modeller This documentation deals exactly with this activity of the water guality modeller Closed software Many water guality models consist of a piece of software that computes the spatial concentra tion patterns and their evolution over time for a certain set of substances and their interactions Users are able to insert waste load information and open boundary conditions and other forc ing like meteorology Furthermore a number of reaction coefficients playing a role in the implemented formulae of interactions can be modified to calibrate the model behaviour to available measurement data If for a new application the setting of substances and or their interactions need to be changed the computer code of the water guality model needs to be changed If you use closed as is software you cannot change the computer code and you must ask the maintainer to do so The only thing you can furthermore do is fiddle around a bit with the value of coefficients Open software The first versions of Deltares water guality software in use from
18. from previously entered substances to avoid typographical differences such as differences in case and or additional spaces The 10 character unit field is in some applications added to the 10 character D field of a substance For those situations it is convenient to distinguish the unit format from the ID by placing the unit between brackets e g g m3 Remark The check box Transportable may seem strange If you realise however that material as settled on the bottom of your computational element can also be distinguished as a sub 14 megawatt 1 MW 10 J s 1 calorie heats 1 cm of water 1 C 1 calorie is 4 19 J This means that 1 MW 10 4 19 cal s or 1 4 19 C m s So you divide the number of megawatts by 4 19 to get the load per second that corresponds with the state variable temperature expressed in C Deltares 19 of 56 Open Processes Library User Manual stance you realise that not all substances are transported by the water Transportable is the default state If a substance is attached to the bottom or walls you uncheck this box and the substance is excluded from the advection diffusion eguation solver but the water guality processes still act Once you start typing a substance name ID and unit the Add button becomes active You add the substance to the list by the Add button If you select a substance in the list the fields for name ID and unit are filled in with the information of tha
19. g measured data or just by specifying them yourself in a number of points Finally you may specify it as a time series of spatially distributed fields In a number of cases the latter can come from the hydrodynamic model result water depth salinity temperature bot tom shear stress water velocity etc if switched on there In those cases the link with the hydrodynamic model result is made automatically In the user interface you will also see the selected substances as potential output items Also all those process input and output items that you clicked on as being available for output appear as candidate for output in the user interface In the user interface you specify which of all these items you want actually be saved into the output file and thus be available for graphical post processing It is very convenient to have spatial graphs and or animations also for the nutrient limitation of algal growth or the local bottom shear stress besides that of your modelled substances Finally you can specify online statistics like averages moving and total exceedence fre quencies and percentiles of all these variables Those statistics also appear in normal output files that can be processed in a standard way by the graphical post processing tools Different levels of users The afore mentioned approach distinguishes the following different levels of use The model end user Through the SOBEK or Delft3D user interface scenario computations
20. has ap peared a TEO This means that the computation of depth is switched on automatically as soon as you switch on the Reaeration process that needs the depth If it is not needed the depth is not com puted If itis needed several times in different processes it is only computed once and used everywhere where needed It is now on the shelf of your processes library Use hydrodynamic results to compute the velocity The second advanced programming effort is in the computation of the flow velocity As stated before you can use our standard process for that aim but the development of a routine of your own gives valuable experience and insight in how to deal with these topics You must realise that the water guality module uses the so called finite volume approach For the mathematicians this means that the advection diffusion eguation is integrated over all individual computational elements Gauss s theorem furthermore says that the volume integral of the advection and diffusion terms egual the surface integral of the advective and diffusive fluxes through the outer surface of each volume This ensures mass conservation but it also explains why in the water guality module the velocities are known at the segment interfaces only Even they are not known as velocities but as flows and cross sectional areas but that is a minor detail since velocity flow area Now you have to decide how to compute the velocity that is repre
21. ipnt 4 Oxygen pmsa ipnt 5 7 kK Insert your code here L DD R flux i EEEE ES End of your code k kkk fl IDO_R_flux DO R flux IDO R flux ipnt IDO R flux noflux ipnt increm 9000 continue return end subroutine Figure 4 22 Source code of the Oxygen Reaeration process Figure 4 22 shows the corresponding source code of the reaeration process and Figure 4 23 shows the result that would be obtained with a saturation value of 10 mg l a water depth of 10 m and a river stream velocity of 1 m s A minimum concentration of oxygen can be seen after about 100 km although it is not striking for this relatively fast flowing large river Towards advanced features The addition of reaeration brings up some questions Why consider the water velocity as input it should be known by the model Why consider the total water depth and the depth of a computational element as input it should be known by the model The oxygen saturation value depends on temperature and salinity The last item is easiest to deal with It is analogous to the temperature dependence of BOD Decay It can be incorporated in this process and then temperature and salinity should be added to the set of input variables or you can compute the DO saturation value by a separate process that is a matter of taste In any case it is useful to let your Fortran routine also 36 of 56 Deltares Tutorial
22. is however good policy to adopt a more or less uniform typographical convention We will insert the substances Dissolved Oxygen with ID DO and unit g I and Biochem ical Oxygen Demand 5 day with ID BOD5 and unit g m3 in this new group Before the Add button is pressed for the last substance the window may look like Figure 4 6 Note that at this point the program does not know whether you want to change the selected Dissolved Oxygen substance ID and rename it to BOD5 or whether you want to add BOD5 Press the Add button A new substance is added and becomes selected in its turn Once you press the Save button the substance will appear in the list of the Edit Substances list or select a substance window See Figure 4 7 20 of 56 Deltares Tutorial Substance name lt 50 characters Boichemical Oxygen Demand 5 day Substance ID lt 10 characters must be unique BODS v Transportable Ie 4 Substance Unit lt 20 characters g m3 Available Substances in Group Add Change Delete Save Cancel L Figure 4 6 Add Copy or Edit Substances in Group window before BOD5 is added Substance group BOD DO Developer environment Boichemical Oxygen Demand 5 day BOD5 Available Substances Selected Substances Dissolved Oxygen lt Dissolved Oxygen a Boichemical Oxygen Demand 5 da Boichemical Oxygen Demand 5 day
23. it then would be similar to the Fortran DO loop instruction 24 of 56 Deltares Tutorial Item identification Item ID lt 10 characters Item name lt 50 characters v Function of the item for this process only 1 Order in input Values Unit Default v Show in UI for process Settings Acts on exchanges Active substance sae Use the default for this process Aggreation volume volume Cancel lt Aggregation Disaggregation Figure 4 11 Edit Item window We see that it is assumed to be the first item in the input seguence for this subroutine You can change that number to a higher number but that will leave some entries with lower numbers blank If you mention here a lower number that already exists the system asks you whether you want to replace the existing item or to move the existing item This allows you to change the order of items for your Fortran program The Show in UI for process checkbox is checked by default If you uncheck this your item will be hidden and the user will not be able to specify it You may do so if you would define e g an item Pi that you want to use consistently throughout the system but you do not want to show it to the users Be aware that the item then needs to have a default value e g 3 14 for the item Pi because it cannot be resolved otherwise This option also allows you to hide some constants for the user that yo
24. ooo ooo ooo rr IMPLICIT NONE Type Name I 0 Description real 4 pmsa real 4 f1 integer ipoint 4 integer increm 4 integer noseg integer noflux integer iexpnt 4 integer iknmrk integer nogi integer noq2 integer nog3 integer nog4 integer ipnt 4 integer iseg I O Process Manager System Array window of routine to process library 0 Array of fluxes made by this process in mass volume time Array of pointers in pmsa to get and store the data Increments in ipoint for segment loop O constant 1 spatially varying Number of computational elements in the whole model schematisation Number of fluxes increment in the fl array From To From 1 and To 1 segment numbers of the exchange surfaces Active Inactive Surface water bottom see manual for use Nr of exchanges in ist direction the horizontal dir if irregular mesh Nr of exchanges in 2nd direction nogi nog2 gives hor dir reg grid Nr of exchanges in 3rd direction vertical direction pos downward Nr of exchanges in the bottom bottom layers specialist use only Local work array for the pointering Local loop counter for computational element loop HHHHHHHHHH 1 ILL 1 Type Name I 0 Description Unit 28 of 56 Deltares Tutorial real 4 real 4 real 4 real 4 real 4 integer Edit processes window for process Decay of Biochemical Oxygen Demand e Process identification Properties of the FORTRAN subroutine Process ID Pro
25. the bottom In such a way the pool of dead organic matter increases rapidly at the die off of algae blooms and reduces gradually over the months to follow This is the origin of the so called bottom oxygen demand Oxygen models exist where a bottom oxygen demand is included as a parameter as a co efficient that can be set to e g 1 g02 m day or so It must be noted that the only source of organic matter that can cause such a bottom oxygen demand is the organic matter that settled towards the bottom at earlier days That is why this approach is not recommended It allows you to let the bottom demand more oxygen than would be justified by the settling of organic matter in the past It also allows you accumulate dead organic matter on the bottom without knowing it if the bottom oxygen demand is much lower than would be justified by the settling of organic matter in the past It basically is a violation of the law of conservation of mass of organic matter Deltares 47 of 56 5 6 Open Processes Library User Manual The settling discussed here can be included as a process by the following steps 1 Define a new substance being the BOD at the water bottom called BOD Sed Take care that you specify that it is NOT transported by the water see section 4 3 2 Add the computation of the shear stress 7 to the process that computes the water velocity see section 5 2 The formula can e g be at ity pg ia 5 2 Chezy More advanced appr
26. the two main directions If the grid is irregular 40 of 56 Deltares Advanced programming it is difficult to propose an approach Finite element models may deliver you the velocities in the nodes for finite volume models on irregular grids you must make the best of it How can your process routine see that it is operating in a 1D 2D or 3D environment When you inspect the skeleton Fortran routine in detail you will see a NOQ1 NOQ2 NOQ3 and a NOQ4 in the parameter list They reflect the number of interfaces between computational ele ments in four directions The number in the first horizontal direction NOQ1 generally always differs from 0 The number in the second horizontal direction NOQ2 generally does so only if you have a horizontal or layered 3D model with two distinct directions The number in the third direction NOQ3 reflects the number of vertical interfaces It determines whether your model is horizontally only NOQ3 0 2D vertically NOQ1 and NOQ3 non zero NOQ2 0 or 3D NOQ1 NOQ2 and NOQ3 are non zero In a 1D vertical model NOQ3 may even be the only non zero of the three NOQ4 is the number of interfaces between computational elements within the water bottom A further inspection of the subroutine header gives you an integer variable IEXPNT This is not a single variable It is an array with dimension 4 NOQ1 NOQ2 NOQ3 NOQ4 It stores for each of the interfaces between computational elements the from el
27. we could think of being relevant and includes all interac tions between the substances we could think of being relevant At the moment some 223 substances organisms and fractions of substances e g dissolved and particulate and also different algal species are contained for the standard WAQ module alone there are also ECOlogical and CHEMistry extensions The amount of interactions between the substances the arrows between the boxes in common water quality graphs stands now at some 425 processes for the WAQ module alone The number of coefficients to steer the processes is several thousands The 425 processes are computed by some 89 library software functions Fortran subroutines Because several processes for e g different heavy metals or different organic micro pollutants essentially behave the same although with different coefficients they could be computed by the same library function fed with different input This is why the library functions are re used on average 425 89 4 8 times Although with careful design probably even a somewhat higher re use rate could be obtained a rate of almost 5 seems not bad at all Because you could not add substances or processes Fortran source code to this library himself Deltares felt committed to add all user reguests free of charge and in due time during the past decade Success through multi level user interface This huge amount of substances and organisms and their processes can only be man
28. 0 CONTINUE Compute the average velocity in the first direction lalala DO 20 ISEG 1 NOSEG IF SumArea ISEG GT 1 0E 15 THEN Velocity SumFlow ISEG SumArea ISEG ELSE Velocity 0 0 ENDIF PMSA IPNT 3 1 ISEG Velocity 20 CONTINUE If there is a second direction do the same in the second direction IF NOQ2 GT 0 THEN SumFlow 0 0 SumArea 0 0 NO01 1 NOQ1 NOQ2 ABS PMSA IPNT 1 1 IQ ABS PMSA IPNT 2 1 10 IEXPNT 1 10 IEXPNT 2 1Q IF Ifrom GT 0 SumFlowf lfrom SumFlow Ifrom FLOW nian SumFlow Ifrom XAREA ENDI IF Ito GT 0 THEN SumFlow Ito SumFlow Ito FLOW SumArea Ito SumFlow Ito XAREA ENDIF 30 CONTINUE 000 pa a m E an non n THEN Apply Pythagoras 000 DO 40 ISEG 1 NOSEG IF SumArea ISEG GT 1 0E 15 THEN Velocity PMSA IPNT 3 1 ISEG Velocity SORT Velocity Velocity SunFlow ISEG SumFlow ISEG SunArea ISEG SumArea ISEG PMSA IPNT 3 1 ISEG Velocity ENDIF 40 CONTINUE ENDIF RETURN END End of File g Figure 5 1 Computer code to compute horizontal velocities Deltares 5 3 Advanced programming Then we constructed a loop over NOQ1 exchanges and picked the FLOW and AREA vari ables directly from the PMSA array without incrementing the IPNT pointer like in previous code We got the values for the Ifrom and the Ito variables from the exchange pointers
29. 2 2 Open Processes Library User Manual are using intelligent inferences on the data Teamwork The Deltares team that works on the Processes Library consists of O o O Jos van Gils who developed the library approach in the early 90s of the past century and who was the teamleader of the further development of the library since Pascal Boderie who developed the first comprehensive set of process routines Jan van Beek who developed the whole data structure and administrative programs call ing the process routines is responsible for the whole core simulation interface with the process routines of which he also developed guite a number himself Arjen Markus Stef Hummel and Antoon Koster were involved in its user interface that runs both on MS Windows and Linux Johannes Smits recently reviewed the whole set of processes and coefficients and ex panded the library approach to a layered bottom underneath the water phase Leo Postma saw that the others did a splendid job was responsible for the opening up of the process library for external users and wrote this manual Concepts The processes library is an extensible library of water guality components The following water guality components are distinguished O Substances These are all constituents where a concentration or density can be computed for by the water guality model The concentration density is computed by the time integration of the reaction equation
30. 48 of 56 Deltares Advanced programming you use the correct sign if the first layer is on top and the NOQ3 pointers are adminis trated positively from top to bottom as is common in the standard processes library of Deltares WL Delft Hydraulics then a positive settling velocity acts towards the bottom and a negative velocity would e g account for the floatation like with algae and oil 4 You see that a stochiometry button appeared You press it and you select all substances that you want to be subject to this settling velocity and you give as weight coefficient 1 0 Remarks The array space that is available for the result of your process Fortran routine generally is equal to the amount of computational elements By pressing the button acts on exchanges the array space becomes as large as the number of exchanges By the selection of velocity in step 2 you cause this term to be added to the water velocity in the advection diffusion solver for this substance This means that the term is subject to all numerics of the selected advection diffusion solver This is especially important for settling velocities since they may be so high that explicit schemes along the vertical would require a much to small computational time step You solve this problem by selection for you simulation of one of the numerical scheme s that deal with the vertical in an implicit way Had you selected a diffusion type term the result wo
31. 81 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 42 of 56 Top of File SUBROUTINE CALVELO PMSA FL IPOINT INCREM NOSEG NOFLUX IEXPNT IKNMRK NOQ1 NOQ2 NOQ3 NoQ4 IDEC ATTRIBUTES DLLEXPORT ALIAS CALVELO CALVELO C9626 DEE KIEN II PE HKKK NNN NNN N FE JE JE JEME JE JE JEJE DE JE MEME ME JEFE JE IE DEJE EJE DE JE ME JE ME JE JE JE JE JEJE E JE ME JE JE JE ME JE JEJEJE IE IEE E IMPLICIT NONE E G Type Nane I O Description REAL 4 PMSA 11 0 Process Manager System Array window of routine to process library REAL 4 FL O Array of fluxes made by this process in mass volume tine INTEGER IPOINT 3 I Array of pointers in PMSA to get and store the data INTEGER INCREM 3 I Increments in IPOINT for segment loop O constant l spatially varying INTEGER NOSEG I Number of computational elements in the whole model schematisation INTEGER NOFLUX I Number of fluxes increment in the FL array INTEGER IEXPNT 4 I From To From 1 and To 1 segment numbers of the exchange surfaces INTEGER IKNMRK I Active Inactive Surface vater bottom see manual for use INTEGER NOQ1 I Nr of exchanges in lst direction only horizontal dir if irregular mesh INTEGER NOQ2 I Nr of exchanges in 2nd direction N001 N002 gives hor dir reg grid INTEGER
32. C Program Files x86 Deltares Delft8D 4 1 0 win32 waq default gt if you installed the system in the lt C Program Files x86 Deltares Delft38D 4 1 0 gt directory If the existing lt proc_def dat gt file is not empty you got a license for the Deltares processes On Linux is this D3Dwag OpenPL so note the mixture of upper and lower case 30 of 56 Deltares 4 8 1 4 8 2 Tutorial E Open Processes Library OPI fiesian tidal inlet ele Open ECO Open PLCT using BLOOM algae Open WAQ Open PLCT not using BLOOM algae Open PLCT not using predefined algae Build the Processes DLL via Visual Studio Install the Processes Library and Processes DLL Restore the default Processes Library Return to Delft3D WAQ tools menu Select working directory Figure 4 17 Open Processes Library OPL window library as well this file should be saved for future use Now you copy your file to overwrite the existing lt proc def dat gt in the directory As these actions are somewhat tedious and error prone we provide automatic procedures to do this Delft3D The menu by which you start the PLCT in developer mode also facilitates the building and installation of the new library see Figure 4 17 O O The assumption is that the working directory is the directory that contains or will contain the sources the files reguired for building th
33. Depth and will be the corresponding input item for the reaeration formula So press Add in the Output Item section and add the existing item Depth to this Output Item section 7 Now we create the skeleton Fortran file as lt DEPTH f90 gt 8 We insert Depth VOLUME SURF in the user code section of the Fortran routine If you feel not sure you could insert Depth 1 0 andthen if SURF gt 1 0E 10 Depth VOLUME SURF This is safer in case the horizontal surface could have a value of zero 9 You save your newly created version of the process library We will check what happened a We open the PLCT again and choose our newly created processes file Do not enter the developer mode b We press the Edit button for Extra processes and see that the window is empty Deltares 39 of 56 5 2 Open Processes Library User Manual c We select the group BOD DO We select the substance Dissolved Oxygen and we switch the Reaeration process on e We enter immediately into the Specify Process window because some of the input is not resolved velocity total depth and saturation value of dissolved oxygen if you did not give these items a default value f You also see that the depth of the computational element is now resolved and will be computed by the process called Depth For all items without a default you check Editable and you press OK Now you will see in the Edit Extra processes window that the process Depth
34. E JE JE FE FE JE JE IE E JE JE JE N 00027 C 00028 C Type Nane 1 0 Description Unit 00029 C 00030 REAL 4 W Velocity I The water stream velocity m s 00031 REAL 4 W Depth I The water depth mn 00032 REAL 4 DO Satur I Saturation value for Dissolved Oxygen g 02 m3 00033 REAL 4 DO I Dissolved Oxygen m3 00034 REAL 4 DO R flux F Reaeration flux for Dissolved Oxygen g 02 m3 day 00035 INTEGER IDO R flux Pointer to the Reaeration flux for Dissolved Oxygen 00036 INTEGER IActive Used to limit computation to active computational elements only 00037 INTEGER ISurface Used to test whether the computational element is at the water surface 00038 C 00039 CEE EAE EBEE 9 9 939690909 EIE EIE EIEE BEE PEIE EEE IEEE EIE EIE EIEE PEE BEIE EIE EIEE DE SEJE EJEDE EJE EJEDE IEE EIE IIE EIEEE 00040 C 00041 IPNT IPOINT 00042 IDO R flux 1 00043 C 00044 DO 9000 ISEG 1 NOSEG 00045 C 00046 call DHKMRK 1 IKNMRK ISEG IActive 00047 if IActive EQ 1 then 00048 active elements only 00049 call DHKMRK 2 SIME BCISESH ISurface 00050 if ISurface EQ 0 ISurface EQ 1 then 00051 C surface elements only 00052 W Velocity PMSA IPNT 1 00053 W Depth PMSA IPNT 2 00054 DO Satur PMSA IPNT 3 00055 PMSA IPNT 4 00056 C 00057 C xxxx Insert your code here 00058 C 00059 DOR flux 3 95 W Depth SORT W Velocity W Depth 00060 DO Satur DO 00061 C 00062 C ERE End of your code
35. HERE 00063 C 00064 endif 00065 C 00066 endif 00067 C 00068 FL IDOR flux DOR flux 00069 C 00070 1DO Reflux et R flux NOFLUX 00071 INCREM 00072 C 00073 9000 CONTINUE 00074 C 00075 RETURN 00076 END 00077 End of File Figure 5 4 Sample Fortran file for reaeration of Dissolved Oxygen Computational elements at the water surface or at the water bottom The call to DHKMRK with feature number 2 as argument returns an integer that can be tested for its value as follows Value is 0 the computational element has both a water surface an a bottom typical for depth averaged modelling Value is 1 the computational element has a water surface but no water bottom Value is 2 the computational element has no water surface and no water bottom Value is 3 the computational element has no water surface but it has a water bottom The process routine for reaeration that was not furthermore elaborated in detail in Chapter 4 could look like in Figure 5 4 If you carefully proceed along these lines of computer code generation you make your mod elling library functioning egually correct for vertically average modelling and for layered mod elling of e g stratified lakes or 3D estuaries The standard Deltares processes library e g is developed in this way so exactly the same library is used in the Delft1D 2D SOBEK system and in the Delft3D system making water guality modelling completely consistent 46 of
36. IEXPNT as explained and we summed Flows and Areas Then we included a segment loop that is somewhat comparable with previous code ex amples and store the velocity directly in the PMSA array without incrementing IPNT If there is a second direction we do the same in the second direction and apply Pythago ras Note how we picked Ifrom and Ito from IEXPNT for this second direction Although this code is already somewhat more complicated it should be easily understood by an average Fortran programmer Again you do this only once you add the routine to the DLL and your process producing Velocity is in the library and is even switched on automatically if some other process needs this Velocity Compute the total water depth The third advanced programming effort is the computation of total water depth This variable may be produced by the hydrodynamic model and may be available as parameter specified through an external file from the hydrodynamic model You may also use our pre programmed code for that aim In this tutorial however we use the subject to show how the vertical is addressed in the processes library The depth of computational elements as computed in 5 1 is equal to the total water depth for depth averaged models For layered models however the total water depth is the sum of all depths of all layers on top of each other We must make some restrictions here The first is that it is only possibl
37. NOQ3 I Nr of exchanges in 3rd direction vertical direction pos INTEGER NO04 I Nr of exchanges in the bottom bottom layers specialist use only INTEGER IPNT 3 Local work array for the pointering INTEGER ISEG Local loop counter for computational element loop C996 96 96 96 96 JE E JE E JE IE DE JE DE JE E JE MEJE JE JEJE JE JE IE JE EJE E JE IE JEJE JE JE JEJE E JEME JEJE JEJE JEJE DEJE MEJE JE JE SE JEJE JE EJE JE JE JEJEJE JEJEJEJE JE SEJE JE REJER SE IE IE C c Type Nane I O Description Unit C REAL 4 FLOW I flow m3 s REAL 4 XAREA I exchange area m2 REAL 4 Velocity O Water velocity in midpoints of comp elements m s INTEGER IQ Local loop counter for exchanges loop REAL 4 SAVE Allocatable SumFlow REAL 4 SAVE Allocatable SumArea INTEGER Ifrom Ito local help variables with from and to comp element numbers C I IPNT IPOINT IF NOT ALLOCATED SumFlow THEN ALLOCATE SumFlow NOSEG ALLOCATE SumArea NOSEG ENDIF SumFlow SumArea 0 0 0 0 000 Sum the flows and the area s for the adjacent computational elements DO 10 IQ 1 NO01 FLOW ABS PMSA IPNT 1 1 IQ XAREA ARSL PMSA IPNT 2 1 IQ Ifrom IEXPNT 1 1Q Ito IEXPNT 2 10 IF Ifrom GT 0 THEN SumFlow Ifrom SumFlow lfrom FLOW SumArea Ifrom SumFlow lfrom ZAREA ENDIF IF Ito GT 0 THEN SumFlow Ito SumFlow Ito FLOW SumArea Ito SumFlow Ito EKAREA ENDIF 1
38. Now no additional substances are defined but the same substances also exist in bottom layers The settling from the water column now is just a transport process from a water bound computational element to a computational element in the bottom and through benthic mixing by worms or other invertebrates the substance can reach lower bottom layers as well This approach is used in the Layered bottom version of the Deltares processes library It is to be expected that the second approach of a layered bottom will replace the first approach of separated bottom models with own substances in the bottom within several years Up to now however most models behave with the first approach so this tutorial will focus on the first approach There is another reason to do so Often an approach with one or two bottom layers is simpler to implement and adequate for the problem at hand while the layered bottom approach requires additional schematisation of the water bottom and of the transport processes in the water bottom The basic reason to include the water bottom in Dissolved Oxygen models is twofold You want to model the disappearance of organic Carbon and Nitrogen towards the water bottom in such a way that it does not influence the water phase any more This is the case if part of the organic matter will migrate to the confined bottom to become oil or natural gas in the end You want to include a reduced decomposition of the material that settled to
39. O constant l spatially varying 00015 INTEGER NOSEG I Number of computational elements in the whole model schematisation 00016 INTEGER NOFLUX I Number of fluxes increment in the FL array 00017 INTEGER IEXPNT I From To From 1 and To 1 segment numbers of the exchange surfaces 00018 INTEGER IKNMRK I Active Inactive Surface vater bottom see manual for use 00019 INTEGER NO01 I Nr of exchanges in lst direction only horizontal dir if irregular mesh 00020 INTEGER NOQ2 I Nr of exchanges in 2nd direction NOQ1 NOQ2 gives hor dir reg grid 00021 INTEGER NOQ3 I Nr of exchanges in 3rd direction vertical direction pos downward 00022 INTEGER NO04 I Nr of exchanges in the bottom bottom layers specialist use only 00023 INTEGER IPNT 2 Local work array for the pointering 00024 INTEGER ISEG Local loop counter for computational element loop 00025 C 0 0 0 2 6 C3636 36 IHI JE JE JE JE JE JE JE JE JE JE JE E HIH H H H JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE HH H H H H HIH JE JE HIH JE JE JE JE JE JE JE JE JE JE IE JE HH H H H HIH JE JE JE JE JE JE JE JE FE 00027 C 00028 C Type Name 1 0 Description Unit 00029 C 00030 REAL 4 BOD D rate I Decay rate for Biochemical Oxygen Demand at 20 oC 1 day 00031 REAL 4 BOD I Biochemical Oxygen Demand g 02 n3 00032 REAL 4 BOD T coef I Temperature coefficient for decay of BOD 00033 REAL 4 Temp deg C I Temperature in degrees Centigrade oc 00034 REAL 4 BOD D flux F Decay flux for Bioche
40. ace if they affect substances in the model There however also may be derived guantities e g Secchi depth as result of available particulates in the water or Chlorophyll as result of Algae Carbon in the water that are not used in that form by the substances In that case they would be unreachable for the user in the user interface You can prevent this by specifying those derived properties as a flux and let them act on all substances where they may be associated with As weighing factor for the flux you use however 0 0 so no actual flux takes place The process however now appears in the list of processes that can be switched on for a substance and the Secchi Depth and the Chlorophyll can be selected as output variable for graphical post processing It is one of the very few tricks that is reguired in the furthermore very straight forward definition of substances processes fluxes and input and output items 52 of 56 Deltares References O Connor D and W Dobbins 1956 The mechanism of reaeration in natural streams ASCE 82 no SA6 469 J San Eng ASCE 82 no SA6 469 Streeter H and E Phelps 1925 Study of the pollution and natural purification of the Ohio E river Tech Rep Bulletin NO 146 U S Public Health Service Washington D C reprinted 1958 Deltares 53 of 56 Open Processes Library User Manual 54 of 56 Deltares Deltares sustems PO Box 177 31 0 88 335 81 88 2600 MH Delft sales de
41. aged by a multi level user interface We made a six levels deep hyperlink user interface In this user interface you select substances organism from the library by switching them on For all se lected substances you can subseguently switch on processes at will Most of the coefficients and steering functions have default values You select which of these many coefficients and functions you want to make editable by you rather than to apply these default values This was a great success Since the mid 90s all Deltares advisory work on water quality was con ducted with this process library and the many hundreds of users of the water quality module that use it world wide have benefitted from this environment The most important advantage was that it ensured error less functioning Error less because all code and administration on e g which coefficients enter where in the system are the coefficients spatially constant or heterogeneous are the coefficients constant in time or a time function how do your results enter into graphs was taken care of by the system The only care for you and that is also your core job requiring your expertise and experience is to select the appropriate combinations of substances organisms select the processes that should be active to select the appropriate setting of coefficients for the problem at hand You could save your set up for one project and use it with slightly different selection
42. all 4 levels yourself you will nevertheless recognize these different levels as separate actions to be taken during your work Deltares 9 of 56 Open Processes Library User Manual 10 of 56 Deltares 3 Getting started 3 1 Starting Delft3D The Delft3D suite is a range of modules that can be run independently of one another The main menu of Delft3D provides access to each of the main modules Delft3D MENU can be started either In Microsoft Windows select Delft3D in the Programs Menu or click on the Delft3D icon on the desk top In Linux type delft3d menu on the command line The main window of Delft3D MENU is shown in Figure 3 1 E E3 Delft3D 4 01 00 tutorial wag friesian tidal inlet kon Information Information and version numbers Grid Grid and bathymetry Flow Hydrodynamics including morphology Wave Waves standalone Part Partide tracking Far field water quality Utilities Delft3D Utilities Exit Exit Delft3D menu Select working directory i Figure 3 1 Main window of Delft3D MENU Whether or not you may use specific Delft3D modules and features depends on the license file you have delft3d lt hostid gt lic in your DS Flex directory There are two ways to exit the Delft3D MENU Click Exit Click the close button x in the top right corner of the menu bar 3 2 Getting into th
43. along the water column the same total depth of that water column is stored We may call our Fortran routine for this process TDEPTH and call the process TotDepth We will only have one input variable the already existing item Depth We will produce one output variable the already existing item TotDepth We will produce no fluxes The code looks like in Figure 5 2 Remarks The loops with labels 20 and 30 are automatically skipped if NOQ3 equals zero so if no vertical is present Here and also in 5 2 to compute the velocities the construction with the IPNT and the INCREM array are not used any more That construction is aimed to deal with spatially constant values INCREM 0 and spatially varying values INCREM 1 in the same routine This allows for process routines that operate equally well for spatially constant steering as may be used in some applications as for spatially variable steering as may be used in other applications The fact that this construction is not used in sections 5 2 and 5 3 reflects the fact that it is assumed that velocities flows exchange areas and water depths will always be spatially distributed variables 44 of 56 Deltares 5 4 Advanced programming 00036 00037 IPNT IPOINT 00038 IBOD D flux 1 00033 C 00040 DO 9000 ISEG 1 NOSEG 00041 C 00042 call DHKMRK 1 IKNMRK ISEG IActive 00043 if IActive EQ 1 then 00044 C 00045 BOD
44. and corresponding graphics are made by adjusting e g wasteloads boundaries or coefficients for an existing model through the user interface This can be done by a technician The modeller Using the SOBEK or Delft3D productivity tools a model is set up for a certain area An existing saved file with a selected set of substances and processes is imported The model developer Using the PLCT Processes Library Configuration Tool a selection of existing substances processes and items from the Library is made and saved in a file The water quality ecological modelling scientist Using the Open Processes Library and a Fortran compiler substances processes and or 8 of 56 Deltares Introduction to Open PLCT items are added to the existing library The last level is the only level that requires computer programming effort and may thus be con ducted by a scientist together with a computer programmer The procedures for this last level are explained further in Chapter 6 Please be aware that this is for each substance process a one of activity comparable with the purchase of new books for the collection by a real librar ian The borrowing of books from the library is a one level higher activity and the reading of the borrowed books is done by the top two levels It is of course up to the procedures within your organisation whether you want to distinguish all of these levels by assigning them to different persons or not If you do
45. ature dependent BOD Decay with optimisations 50 of 56 Deltares 5 8 Advanced programming Retrieving information from the hydrodynamics In earlier sections of this chapter we showed how we could derive the segment velocity the segment depth and the total water depth from the terms that were delivered by the hydrody namic model Here an overview is given of all the terms that are available from the hydrody namic model There are 11 items in the processes library that are always present and that can be used They are listed in Table 5 1 Table 5 1 Items that are available to the process library from the system Item Dimension Meaning VOLUME NOSEG The volumes of the computational elements m FLOW NOQ The flows between the computational elements m s XAREA NOQ The exchange surfaces between computational elements m7 XLENFROM NOQ The distance of mid of from element to exchange surface m XLENTO NOQ The distance of mid of to element to exchange surface m SURF NOSEG The horizontal surface area of the computational elements IDT 1 The system time step for the Advection Diffusion solver s DELT 1 The system time step fro water quality processes d ITIME 1 The time in simulation from reference s ITSTOP 1 The simulation start time from reference s ITSTRT 1 The simulation stop time from reference s If one or more of the items of Table 5 1 are specified as inpu
46. borrow it any time you want through the multi level user interface like all other already exist ing features No software errors are possible once you have added your book to the library If your book says that temperature is reguired for the process in the book the system will take care that temperature is there at the right place and in the right form without any coding from your side If your book produces a result in the form of a flux from one organism to another organism the system takes care that the flux actually operates on the organisms without any further coding from your side This manual describes the functioning of the processes library itself to start with a good un derstanding It then shows with a tutorial how to add your own substances organisms and processes to an initially empty processes library Then a number of advanced programming topics is explained Finally in tutorial style new European Community so called Priority Sub stances for the Water Framework Directive will be added to the existing Deltares pre WFD version of the library With this functionality we feel that we can face the next 10 years of water guality modelling with confidence What will come after that period is still to be guessed The specialist on artificial intelligence and formula generation Vladan Babovic already expects that probably by that time the process formulas in the library could be generated by formula generators that Deltares 5 of 56
47. cess name Name lt 10 chars BOD DECAY v lt 10 chars lt 50 characters BoDDecay Decay of Biochemical Oxygen Demand Input items in their order of appearance in the FORTRAN code 7 Acts on horizontal exch interfaces 7 Acts on vertical exch interfaces 1 Decay rate at 20 C for Biochemical Oxygen Demand Add 2 Temperature in degrees Celsius 3 Temperature coefficient for BOD Decay Edit 4 Biochemical Oxygen Demand 5 day Delete Output FLUXES in their order of appearance in the FORTRAN code 1 Decay flux of BOD 5 Add Edit Delete Other output items in their order of appearance in the FORTRAN code Add Edit Delete Create FORTRAN code save cancel CREATE Figure 4 16 Edit Process with input items Temp C I Temperature in degrees Celsius BOD5 I Biochemical Oxygen Demand 5 day BOD Dr 20 I Decay rate at 20 C for Biochemical Oxygen Demand Tcoef_BOD I Temperature coefficient for BOD Decay BOD5 flux F Decay flux of BOD 5 IBOD5 flux Pointer to the Decay flux of BOD 5 EEEE E EE E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E E ipnt IBOD5 fl do 9000 Temp BOD5 BOD D Tcoef RK BOD5_ ok kk fl IBOD5 ipnt 9000 continue return end subr The skeleton ipoint ux 1 iseg 1 noseg c pmsa ip
48. d Copy or Edit Substances in Group window The unit is part of the explanatory information The system does nothing do with the unit It is neither parsed nor automatically converted although features of that type may come in future Nevertheless it is important to think over the units carefully The WAQ system uses Sl units like meter m for lengths and distances If you want to have your substances represented by the mg l unit then you need to realise that this is equivalent with g m and you have to release waste loads of the substance in g unit of time to obtain mg l as concentration unit This seems trivial but the concentrations of heavy metals and organic micropollutants are generally expressed in ug l or mg m So here the waste load needs to be in mg unit of time More complicated is the common unit for faecal bacteria MPN 100 ml If you release MPN per unit of time then you get MPN m and that is 107 MPN 100 ml This means that you have to divide your waste load by 107 to get the required concentration unit as output Errors are easily made in this respect so a careful check of your settings is advised As an exercise you may try to identify how you have to scale your thermal waste load given in megawatt to produce the substance excess temperature in C in the water For your convenience the unit field is a drop down box containing all units that have previously been defined This allows you to select one
49. dC dt together with the advection diffusion equation ADE if the substance is carried with the water or without the ADE for substances that are not carried with the water e g those that lay on the bottom as particulates Also organisms bacteria algae filter feeders etc are called substances Also phenomena e g BOD salinity pH are called substances although they are not in strict chemical or biological sense Because the list of available substances in the user interface could become long they are divided into substance groups This is just for the ease of reference and has no specific further meaning in the computation Processes These are the water quality kinetics It is the right hand side of dC dt In flow charts of water quality models processes generally represent the arrows or fluxes between the substances Each process is computed by a tiny computer program a Fortran subroutine Each process has its input coefficients and produces one or more arrows in the flow chart of water quality kinetics The arrow itself is called Flux so the process produces fluxes The process may also produce output variables These variables may be used as input for other processes If e g mortality of bacteria depends on salinity but the modelled sub stance is chloride then a process may take chloride and other ions as input and compute salinity as output that is used again as input for the mortality of bacteria Output variables may a
50. e Save the current PLCT lt x 0 gt file using the previously given name or the default name lt substate 0 gt A substance file lt x sub gt is saved simultaneously Save the current PLCT lt x 0 gt file and specify its filename A substance file lt x sub gt is saved simultaneously Exit the PLCT Merge the current data with an existing processes library the new Deltares Tutorial Group name BOD DO lt 30 chars Available Substance Groups Add Change Delete Save cancel Figure 4 2 Add groups and Edit Group names window after entering BOD DO before pressing Add processes library will be available after saving this session Tables Export the data to several lt cvs gt files on the current directory Expets Help About When clicking About a window will display the current version number of PLCT If you press the Edit button a screen opens and you can enter the name of a substance group We will enter the name BOD DO Figure 4 2 because our first additions to the library will consist of the classic BOD DO kinetics by Streeter and Phelps 1925 We press the Add and Save buttons to create the group The Change button in Figure 4 2 will just change the name of the selected group to the string that you entered in the edit field The Delete button only deletes the group if it does not contain any substances any more So you need to move substances t
51. e OpenPLCT Before continuing with any of the selections you must select the directory in which you are going to prepare a scenario Click the Select working directory button see Figure 3 2 for the window displayed A standard file selection window is opened and you can navigate to the reguired directory Browse to the desired directory and enter this working directory Confirm your selection by clicking OK Remark O In case you want to create a new directory click E and specify a name Enter the new Deltares 11 of 56 Open Processes Library User Manual Lookin Ji D Deltares Delft30 4 1 0 ooo UH yy My Computer p manuals 5 a source R mooiman W tutorial J win32 Figure 3 2 Select working directory window to set the directory to for saving files directory and click OK to confirm your selection Now we are back in the main water guality menu and we can define new substances and processes To start the OpenPLCT for WAO general water guality press first th button Water Ouality Figure 3 1 followed by General and Tools and OpenPLCT now you get a window similar to Figure 3 3 and Define Input The OpenPLCT will start showing three different windows see Figure 3 4 Do not use BLOOM algae Build the Processes DLL via Visual Studio Install Install the Processes Library and Processes DLL Restore Restore the default
52. e for a process routine to compute total depth in a layered system The water quality module allows for arbitrarily shaped and stacked computational elements but with a free vertical topology e g one ele ment having more elements on top of it and covering only part of another element that also expands to the side of it it is impossible to program the intelligence to compute total water depth from individual depths Secondly although not impossible it is difficult to program in telligence to compute total water depth if the exchange pointers between the layers are not stored in either a systematic order form top to bottom or from the bottom to the top WAQ at the moment generally uses the order that the first layer is the surface water layer and the last layer is the bottom layer and also stores its pointers that way but the routine that we will develop will also work for the other way around The routine that we will develop will also work for incomplete layers e g strictly horizontal layers that may disappear partly at shallow loca tions so called z coordinates contrary to 0 coordinates The procedure will be developed along the following lines The depth of each computational element will be copied to the total depth array If there is no vertical in the model the procedure stops The vertical from and to exchange pointers will be used to sum the depth of the from element to that of the to element and
53. e library and the library itself The button marked Build starts the Visual Studio for either a select you select or the only solution in that directory This way you can adjust the source files you just generated and build the DLL without leaving Delft3D If there is no solution file yet an empty one will be copied with the right settings All you need to do is add the source files and edit them The button marked Install copies the various files that is the database file which must be called lt proc def dat gt and the DLL called lt D3Dwag OpenPL dll gt from either the debug or the release directory whichever is newer into the Delft3D installation The original files will be saved so that you can restore them whenever you want The button marked Restore will restore the original Delft3D processes database and it will remove the extra DLL The most important thing to keep in mind is that the procedures behind these buttons assume fixed file and directory names so that you do not need to select files over and over again SOBEK In development Deltares 31 of 56 4 9 Open Processes Library User Manual Modify an existing process library Now it is also time to save our work We press the Save buttons in the various windows until we reach the Processes Library Configuration Tool window again and we press Save from the File Specify a meaningful name and your very first and small process library is created You exit the co
54. e same ares for every computational element and powers with real numbers are computation time consuming In Figure 5 5 a code example of temperature dependent BOD decay is given that evaluates the temperature function only once for the whole area if the temperature is the same everywhere It makes use of the property that the INCREM entry for items is O if an item is specified as a spatially constant e g as a single time function for the whole area The code also works if T is different per location That is important never lean on limitations always insert general and generic code into your library the you will benefit most from its generality Deltares 49 of 56 Open Processes Library User Manual y 00001 SUBROUTINE BOD DECAY FMSA FL IPOINT INCREM NOSEG 00002 NOFLUX IEXPNT IKNMRK NO01 NOQ2 00003 NOQ3 NOQ4 00004 C OD0DS CI IA X JEJEJEJE JE JEJE IE H II E JEJE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE HE JE E JE JEJE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE JE HH JE JEJE JE JE JE JE JE JEJEJE JEJEJE 00006 C 00007 IMPLICIT NONE 00008 C 00009 C Type Nane 1 0 Description 00010 C 00011 REAL 4 PMSA 11 0 Process Manager System Array window of routine to process library 00012 REAL 4 FL O Array of fluxes made by this process in mass volume time 00013 INTEGER IPOINT 2 I Array of pointers in PMSA to get and store the data 00014 INTEGER INCREM 2 I Increments in IPOINT for segment loop
55. ement number the to element number the from 1 element number and the to 1 element number respectively The last two may be zero is the interface with the hydrodynamic model does not support them They allow for higher order approximations along the directions if present The cookbook style procedure to make the velocity now becomes 1 Open the PLCT using the just saved BOD DO kinetics 2 Switch Developer mode on and select e g Dissolved Oxygen and press the Add Edit button in the Select Processes window 3 Make a new process called Calvelo Computation of horizontal velocities of computa tional elements 4 Add the process and see the Edit processes window open Name the Fortran file to CALVELO and press Add at the Input items section 5 Press the list button for Item IDs And see that there is an item FLOW and XAREA in this list You did not define this items they were defined already because they are available from the hydrodynamic computation We will add both as input item 6 Inthe Fortran routine we will compute the velocity in a computational element by the earlier described procedure We will not produce a Flux but we will produce an output This will be called Velocity and will be the corresponding input item for the reaeration formula So press Add in the Output Item section and add the existing item Velocity to this Output Item section 7 Now we create the skeleton Fortran
56. ether Deltares 7 of 56 Open Processes Library User Manual they are provided as a constant as a single time function for the whole area as a spatially distributed constant or as a spatially distributed time function Archive of the set up The total configuration of your water quality model consists of the choices you made This total configuration is saved for archive purposes This means that you can always reproduce your selection from a previous study by importing its setting Your new study may consist of a slight modification of this setting You save the new setting under a different name and both settings remain available for future use How do you turn your saved set up into an actual water quality model The saved set up is imported either in the user interface of the Deltares 1D 2D system SOBEK or in the Delft3D user interface In this user interface you will see that all items appear that you have specified as being user editable In this SOBEK or Delft3D user interface you define whether you will specify this input as a constant that you enter into the corresponding field like is done with parameters for e g a sensitivity test You may also specify it as a time function like solar radiation above your model area through out the year or as a Spatially distributed function like the bottom organic matter content Both SOBEK and Delft3D have tools to conveniently make such a spatially distributed func tion from e
57. file as CALVELO f 8 We insert the earlier described computational procedure in the user code section of the Fortran routine If you feel not sure you could insert precautions for the case where the XAREA is zero Your will look like in Figure 5 1 See also the explanatory text following the figure 9 You save your newly created version of the process library We could not lean that much any more on the skeleton Fortran file that was produced by the software Inthe declaration section we had to add a loop counter over exchanges called IQ and two convenience variables Ifrom and Ito We furthermore had to declare working space in the form of two allocatable arrays Sum Flow and SumArea With the SAVE attributed they are allocated only once and reused every timestep that is better for performance Deltares 41 of 56 Open Processes Library User Manual 00000 00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 000
58. hat we will program ourselves to compute the BODDecay process Note that you can use a generic approach here If you have three types of bacteria for which the mathematical description of the processes decay or growth differ only by their Deltares 23 of 56 Open Processes Library User Manual coefficients they may share the same Fortran routine The same is true for ten heavy metals or fifteen organic micro pollutants that mutually react in the same way but only with differences in reaction rates Furthermore the name of the subroutine is converted to uppercase Fortran standard and is used in uppercase throughout We could call our subroutine FIRSTORDER and use it for all first order decay processes like coliform bacteria as well This would be a very generic routine This has a drawback We would have to include an additional process that computes the coliform decay rate as a function of temperature salinity and UV radiation For BOD we have to include an additional process that computes the BOD decay rate as a function of temperature and of available oxygen Instead of doing so we will join these two steps into one subroutine for the decay of BOD that we will call BOD DECAY The above reasoning shows the type of decisions you have to make to keep your library manageable It is a matter of taste whether you prefer a few large subroutines or many small subroutines In general smaller routines make the system more
59. he developer environment ss ss L 15 4 2 Create substance groups 1 K L 16 4 3 Create substances 2 2 2 ae ea KL 18 4 4 Create processes n VV I L L AV VV ee een 23 4 5 Setting up the stoichiometry NL 27 4 6 Generating computer code 00 L 28 4 7 Make a Windows DLL from your source files s ene 30 4 8 Incorporation of your new process library database 30 4 8 1 DelftaD S AR 11 31 4 8 2 SOBEK NALLI LIIK V L 31 4 9 Modify an existing process library aoa a a ee ken 32 4 9 1 Towards advancedfeatures 0 0 00 eee eee 36 5 Advanced programming 39 5 1 Use hydrodynamic results to compute depth 39 5 2 Use hydrodynamic results to compute the velocity 40 5 3 Compute the total water depth ke 43 5 4 The feature or segment property L 45 5 5 Settling from the water column towards the bottom 47 5 6 The vertical velocity in 3D models eee eee eee een nn 48 5 7 Further performance Improvement eee a 49 5 8 Retrieving information from the hydrodynamics 51 5 9 DerivedWemiities MP L K A 52 References 53 Deltares iii Open Processes Library User Manual iv Deltares List of Figures List of Figures 3 1 3 2 3 3 3 4 4 1 4 2 4 3 4 4 4 5 4 6 4 7 4 8 4 9 4 10 4 11 4 12 4 13 4 14 4 15 4 16 4 17 4 18 4 19 4 20 4 21 4 22 4 23 TM 52 5 3 5 4 S R Deltares Main
60. iochemical Oxy gen Demand 5 day After selecting Dissolved Oxygen in right hand side listbox the window Select Processes appears Press the button Specify and nearly the same window as in Figure 4 18 appears but you will see that the BOD5 item is now considered to be modelled The item Temp C temperature in C still has no value and if you click that it is Editable it will appear in the Delft3D and SOBEK user interface for specification You should be able to use this model set up for an actual computation The result will be something like Figure 4 19 for a river that flows with 1 m s Our BOD DO model is not ready yet because in this classical model there is also reaeration of oxygen at the water surface that we should incorporate as a process We need to enter the developer mode again 32 of 56 Deltares Tutorial Figure 4 19 BOD DO curve for BOD Decay x axis in km y axis BOD lower graph and Oxygen upper graph In the Selected Substances list box we select Dissolved Oxygen to add a process see Figure 4 20 We will implement the well known O Connor Dobbins reaeration formula O Connor and Dob bins 1956 3 05 v vu 4 3 Depth 5 Gw Rearation rate 1 day Some remarks must be made here Remarks O Connor derived his formula for the concentration equation and got a rate of 1 day The correct dimension in a numerical model is m day The 1 day rate is obtained after
61. is horizontal location unit m 3 Id Depth name Water depth of this computational element unit m 4 id DO Sat name Saturation value for Dissolved Oxygen unit g m3 5 id Oxygen name Dissolved Oxygen unit g m3 and one output flux item 1 id DO R flux name Reaeration flux for Dissolved Oxygen unit g m3 d The process produces the Reaeration flux with dimension gO2 m5 day If the influx of Oxygen through the water surface is considered positive then we add 1 for DO in the stoichiometry window We insert the O Connor Dobbins reaeration rate formula in the skeleton Fortran file and multiply it with Saturation value minus Dissolved Oxygen concentration to obtain the reaeration flux Figure 4 21 shows how the reaeration process would look like in the Edit Processes window after you followed similar procedure as described for the set up of decay of BOD5 34 of 56 Deltares Tutorial Deltares Process identification Properties of the FORTRAN subroutine Process ID Process name Name lt 10 chars DO REAR v lt 10 chars lt 50 characters DO Rear Reaeration of Oxygen at the water surface v Acts on horizontal exch interfaces Acts on vertical exch interfaces Input items in their order of appearance in the FORTRAN code Output FLUXES in their Other output items in their order of appearance in the FORTRAN code
62. listbox If they are a transportable substance like Oxygen in our example then this box will show up as checked Your entry could look like in Figure 4 12 We save this new item and see it appear in the Input Items list of the Edit Process window Deltares 25 of 56 Open Processes Library User Manual Item identification Item ID Item name lt 10 characters lt 50 characters BOD Dr 20 Decay rate at 20 C for Biochemical Oxygen Demand Function of the item for this process only 1 Order in input IV Show in UI for process v Use the default for this process Values Settings Aggreation 174 v Unit Acts on exchanges volume lt Aggregation 2 3 Default Active substance volume Disaggregation Save Cancel Figure 4 12 Edit Item window with the BOD Decay Rate filled in We continue the same way with temperature and with the temperature coefficient 1 Id Temp O name Temperature in degrees Celsius unit ToC 2 Id Tcoef BOD name Temperature coefficient for BOD Decay unit P We continue the same way for BOD5 The formula Equation 4 2 shows that we need not only the decay rate but also the actual BOD concentration to determine the decay flux 1 Id BOD5 When we leave the ID field and click another field the system prompts that it already knows a Biochemical Oxygen Demand 5 day item that was the substance that we defined earlier and asks permission t
63. llow the second line in this tutorial to show you examples of more advanced programming efforts Deltares 37 of 56 Open Processes Library User Manual 38 of 56 Deltares 5 1 Advanced programming In Chapter 4 the basics of setting up a process library have been shown It may seem some what complicated to conduct so many actions to set up the classical Streeter Phelps BOD DO model Streeter and Phelps 1925 The advantage however is that you do this only once for each substance or process that you want to include Then they are in the library and you can easily decide to switch substances on or off and processes on or off without having to bother about IT things as what input is connected to what piece of the software Once you have included correct pieces of Fortran in the tiny objects called process routines you cannot make any programming errors anymore You add substances and processes by adding new routines in the same way to the existing library You use only what you switch on Not fully tested new developments like the products of students in an academic environment or results from still ongoing in house research can be added without disturbing the functioning of the existing system as long as they are not switched on This is a systematic and consistent way to preserve your investments in research and developments without having to bother about versions and releases of source code and merging of source code The topics
64. loper version a set of Fortran subroutines is delivered in source code You must compile them together with your process routines to the Windows dil or to the Linux run time library that you will use for modelling One of the routines is the DHKMRK routine It looks into a segment property or feature array for values This IKNMRK array is one of the arguments to your own process routine You invoke the routine with CALL DHKMRK feature number IKNMRK ISEG result The middle argument comes from the argument and the integer ISEG is the linear segment number like in the BOD DO example Active or inactive computational elements A call to DHKMRK with feature number 1 returns integer one 1 for active computational elements and zero 0 for elements that are not active at that time So the computation is limited to active computational elements only by the insertion of code like in Figure 5 3 Be aware The endif of this if statement should be placed before all pointers are incremented lines 58 and 59 in Figure 5 3 The issue was to skip inactive computational elements Those computational elements are there in storage and in the linear numbering so you should skip the inactive elements by incrementing the pointers only Deltares 45 of 56 Open Processes Library User Manual 00000 Top of File 00001 SUBROUTINE PMSA FL IPOINT INCREM NOSEG 00002 NOFLUX IEXPNT IKNMRK NO01
65. lso be used for analysis purposes If you e g let the process deliver some intermediate results like the nutrient limitation factor for algal growth as output then it can be displayed in graphs and statistics just like a normal substance Several processes can use the same Fortran subroutine for their computation but with different input output and flux variables If the resuspension and sedimentation of suspended sediment has to be computed for 3 size fractions of suspended sediments in an identical way but with different coefficients they can use the same Fortran subroutine The same holds for all those heavy metals that partition in the same way but with different partitioning coefficients or isotherms Items 6 of 56 Deltares Introduction to Open PLCT These are the input variables for the processes but also the output variables that may be input to other processes Also the fluxes between substances are items but they are special in the sense that they contain a description of the substances that they affect Also the concentrations can appear as items if they are input to a process A process may behave e g temperature dependent temperature can be a substance if it is modelled as a state variable of the model It can also act as ordinary input item if it is prescribed from outside by you The same items can be input to several different processes temperature for instance is an input parameter for many processes Input item
66. ltaressystems nl Rotterdamseweg 185 www deltaressystems nl 2629 HD Delft The Netherlands Photo by Mathilde Matthijsse www zeelandonderwater nl
67. mentioned in this Advanced features section may seem even more cumbersome than the first introduction of the BOD DO model but they also need to be done only once and then future developments can easily benefit from their results Use hydrodynamic results to compute depth The first advanced program is the use of hydrodynamic model results on the fly to compute the water depth of a computational element The procedure is given pointwise with explana tion added to several points so it is more or less cook book style but you should understand the reasons while doing it 1 Open the PLCT using the newly saved BOD DO kinetics in developer mode 2 Select e g Dissolved Oxygen and press the Add Edit button in the Select Processes window 3 Make a new process called Depth Computation of depths of computational elements 4 Add the process and see the Edit processes window open Call the Fortran routine DEPTH and press Add at the nput items section 5 Press the list button for Item ID s And see that there is an item VOLUME and SURF in this list You did not define this items they were defined already because they are available from the hydrodynamic computation We will add both as input item 6 In the Fortran routine we will compute the depth of a computational element by dividing the volume through the horizontal surface area We will not produce a Flux but we will produce an output This will be called
68. mical Oxygen Demand g 02 m3 day 00035 INTEGER IBOD D flux Pointer to the Decay flux for Biochemical Oxygen Demand 00036 INTEGER IActive Used to limit computation to active computational elements only 00037 INTEGER ISurface Used to test whether the computational element is at the water surface 1055 a REAL 4 T_Coef Local temperature function result for BOD decay OD040 3636336365 JEJEJEJE JEJEJEJE III HE IE SESE H JEJE JE JE HE FE JE JE JEJE JE JE JE JE JEJE JE IE JEJE SE JE JEJE SE JEJE JE JE JE JE JE JE JE JEJE JEJEJE JE JEJE JE SE JE JE JE JEJEJE FE IE SE FE FE IESE 00041 C 00042 IPNT IPOINT 00043 IBOD D flux 1 00044 C 00045 BOD T coef PMSA IPNT 3 00046 Temp deg C PMSA IPNT 4 00047 T Coef BOD T coef Temp deg C 20 0 00048 C 00049 DO 9000 ISEG 1 NOSEG 00050 C 00051 call DHKMRK 1 IKNMRK ISEG IActive 00052 if IActive EQ 1 then active elements only 00053 C 00054 BOD D rate PMSA IPNT 1 00055 EOD PMSA IPNT 2 00056 if INCREM 3 NE 0 OR INCREM 4 NE 0 then 00057 BOD T coef PMSA IPNT 3 00058 Temp deg C PMSA IPNT 4 00059 T Coef EOD T coef Temp deg C 20 0 00060 endif 00061 C 00062 BOD D flux BOD D rate T Coef BOD 00063 FL IBODD flux BOD D flux 00064 C 00065 endif 00066 C 00067 IBOD D flux IBOD D flux NOFLUX 00068 IPNT IPNT INCREM 00069 C 00070 9000 CONTINUE 00071 C 00072 RETURN 00073 END Figure 5 5 Subroutine for temper
69. mputer program and you restart it using the freshly created process library You now see that the BOD DO group exists in the Select Groups window If you select it and click the right list of this window the substances in this group are shown Here you find Dissolved Oxygen and Boichemical Oxygen Demand 5 day If you now select Dissolved Oxygen you see that the Decay of Biochemical Oxygen Demand BODDecay process is listed as process for this substance That is because the flux made by the BOD_Decay pro cess also affects Dissolved Oxygen through its stoichiometry If you make the process active you enter immediately into a specification window see Fig ure 4 18 because some of the items are not specified neither BOD5 or Temp_C have a default If you press Cancel in this window and also Cancel in the window by which you TTL Process Decay of Biochemical Oxygen Demand Input Output parameters Unit Editable Output Biochemical Oxygen Demand 5 day BOD5 Constant NODEFAULT g m3 Temperature in degrees Celsius Temp Constant NODEFAULT oC Decay rate at 20 C for Biochemical Oxy Constant 2 3 174 Temperature coefficient for BOD Deca Constant NODEFAULT H Decay flux of BOD 5 BOD5 flux Flux g m 3 d Scroll Up Scroll Down am Figure 4 18 Specify processes window for process Decay of Biochemical Oxygen De mand made the process active you can switch on Dissolved Oxygen together B
70. nt 2 pmsa ipnt 4 r 20 pmsa ipnt 1 BOD pmsa ipnt 3 Insert your code here flux 777777 End of your code Kk KKK IBOD5 flux BOD5 flux flux IBOD5 flux noflux ipnt increm outine code shows The decay rate at 20 C is input parameter 1 The temperature in degrees Celsius is input parameter 2 Deltares oC g m3 1 d g m3 d 29 of 56 4 7 4 8 Open Processes Library User Manual The temperature coefficient is nr 3 The concentration of BOD is nr 4 The flux the amount of BOD that is decayed is saved in the FL array At the location of the question marks we just insert our process code The code for our sample case is BOD5_flux BOD Dr 20 TCoefBOD Temp_C 20 0 BODS5 With this we have completed our computer code and we can compile it to run our water quality model Note thatif we specified a stoichiometric factor of 1 0 rather than 1 0 we would have had to specify the flux as 1 0 times the flux shown above Save your subroutine at a safe location because every time you press the Fortran button for this process this subroutine may be overwritten Note also that the whole linkage to data and other substances is resolved by the system itself We just need to insert our process formula in Fortran style Note also the compiler directive in line 4 It is used by the Intel Fortran compiler to properly prepare the library that is the sub
71. nual Figure 4 14 Edit Stochiometry of flux window Setting up the stoichiometry After pressing the Stochi button a message appears The message says that the Item settings will be saved first to ensure consistency That is because you are about to connect substances to each other with a flux item and if you would save the links in the Edit stochiometry of flux window but cancel the Edit Item session of the stochi an inconsistency results Once you have confirmed the save action the Edit stochiometry of flux window appears Figure 4 14 The flux you are editing is displayed in the title of the window Fluxes can only act on sub stances that are already defined so you should select the substance from the drop down list Now we must take some care The formula says that the decay is k BOD5 If we specify kj and BOD5 with positive values then a negative sign is required somewhere If we compute the flux as k BO D5 in our subroutine then we should use a positive factor of 1 0 to let it work correctly on the substance BO D5 If we compute the flux as k BO D5 on the other hand we should use 1 0 as factor We will do the latter So we choose BOD5 explicitly for substance and 1 0 as the factor and we press Add Our flux however also diminishes the Oxygen concentration in the same way so we also add DO as stoichiometry and 1 0 as factor and add this The result looks like in Figure 4 15
72. o include it here You press on Yes and all fields are filled in with the settings for this substance The checkbox Active substance is checked since BOD is an active transportable substance Now you can immediately press the Save button to add BOD as input for your process Output fluxes Now we press Add besides the Output Fluxes list because we must influence the sub stances DO and BOD with our process We define a flux with see Equation 4 2 1 Id BOD5_flux name Decay flux of BOD 5 unit g m3 d The Edit item window looks like Figure 4 13 We see that there is also a Stochi button available that was not available for input items This button will allow us to link our arrow to the substances between which the arrow works 26 of 56 Deltares 4 5 Tutorial Item identification Item ID Item name lt 10 characters lt 50 characters BODS flux v Decay flux of BOD 5 Function of the item for this process only 1 Order in output IV Show in UI for process Use the default for this process Values Settings Aggreation g m 3 d v Unit Acts on exchanges volume Aggregation Default Active substance volume v Disaggregation Save Stochi Cancel Figure 4 13 Edit Item window with specified flux and Stochi button Edit stochiometry of flux flux of BOD lel Substance ID BOD5 v Factor Substance name un Factor Substance Change Delete ma
73. o other groups or delete substances first to make a group empty before you can delete the group itself This procedure for deleting a group is exemplary for all such actions in the developer environment this way you avoid accidentally losing data Once you press the Save button the modifications are irreversibly updated into your session To save your modifications to disk you have to select the Files Save As menu item of the main window Remark It is good practice to save your work some now and again You can then always start again from a previous saved state if something goes wrong Then you can exit the software and restart it with the intermediately saved database as input There is no facility equivalent to an undo button in the developer environment of the PLCT After you have added and saved the BOD DO group it is inserted in the Available Groups canvas of the Edit groups list or select a group window and you may select the group by clicking it Your screen will look like Figure 4 3 Deltares 17 of 56 Open Processes Library User Manual Available Groups Selected Groups BOD DO BOD DO Edit list of available groups Figure 4 3 The newly created group BOD DO is selected TT Edit substances list or select a substa Substance group BOD DO Developer environment Available Substances Selected Substances Edit Edit list of Available Substances Ready
74. oaches are possible with additions of the effects of wind generated waves and the influences of shipping It is also possible to make a separate process to compute 7 with the water velocity as an input All up to you 3 Make a process and a coorsponding Fortran source code that computes the settling of BOD e g according to the following formula i f Sed vsea Max o 1 z BOD 5 3 Te with 7 is the critical shear stress for sedimentation and vsed is the settling velocity in still water 4 Modify the process such that it only works for those computational elements that have a water bottom see section 5 5 This makes your model working egually well for 1D 2D and 3D applications 5 Set the stoichimetry see section 4 5 such that the settling acts with factor 1 on BOD and with a factor of 1 on BOD_ Sed In the same way a resuspension process can be constructed that takes material from the BOD_Sed pool towards the BOD pool as soon as the shear stress is so high that resuspension occurs The vertical velocity in 3D models In section 5 5 we discussed the settling of particulates towards the water bottom It should however be noted that particulates generally also have a vertical gravity velocity in the water column that must be taken into account especially in 3D and in vertical 2D or 1D models This is special because all processes and items up to now were computed per computational ele ment whereas transport velocities and flows a
75. ocess 4 4 Create processes Now we have substances and we need to specify interactions between the substances The interactions are made by processes In the Edit Substances list or select a substance window we first click Biochemical Oxygen Demand 5 day in the list at the right hand side Then the empty Select Processes window Figure 4 8 appears If we click the Add Edit button there the Add new and Edit existing Processes window Figure 4 9 appears Now we will specify the process Decay of Biochemical Oxygen Demand and give it the ID BODDecay Pressing the Add button causes several things to happen First a warning is displayed It says that this process is now in the list but that it only stays there if the influences the substance BOD5 This reflects the fact that a process computes fluxes between substances and the system does not know yet between which substances you will create a flux with this process You could for instance create a process that does a lot but nothing with BOD5 In that case the process will later on appear only in the list of the substances that are affected by this process and not in the list for BOD If we press the OK button for the message we automatically enter the Edit processes window for this new process Figure 4 10 This is an important window it is your link with the computer code We have to specify the name of a Fortran subroutine We will fill in the name of a subroutine t
76. of operation Selecting the substances and water quality processes for a particular computation o Extending the library itself with new substances and processes It is this latter mode that is the subject of the current document Manual version and revisions This manual describes the functionality of the Open Processes Library Tool version 2 99 00 and later versions with minor revisions Typographical conventions Throughout this manual the following conventions help you to distinguish between different styles of text used to describe various aspects of the graphical user interface Example Description Waves Title of a window or sub window Boundaries Sub windows are displayed in the Module window and cannot be moved Windows can be moved independently from the Mod ule window such as the Visualisation Area window Save Item from a menu title of a push button or the name of a user interface input field Upon selecting this item click or in some cases double click with the left mouse button on it a related action will be executed in most cases it will result in displaying some other sub window In case of an input field you are supposed to enter input data of the reguired format and in the reguired domain lt tutorial wave swan curvi gt Directory names filenames and path names are ex lt siu mdw gt pressed between angle brackets lt gt For the Linux and UNIX environment a forward slash is u
77. ot of non relevant computer programming and data structures and administration Subseguently students then could add their result to the library of the scientific institute as well In this way their work would be saved for the institute that automatically obtains a software knowledge base that steadily increases like the institutes library of normal books This is guite a different approach from the sometimes current practice that the computer program of the student is archived as a dedicated piece of software that becomes obsolete after the student finalises his her study What is the Open Processes Library more than just a computer program The Open Processes Library can best be compared with a real library with books on the shelves one book for each substance one book for each process one book for each steering coefficient or function Thousands of books that are already contained in the existing pro cesses library produced at Deltares If a new substance a new process or a new steering function is needed you only need to make this new book put it on the shelf and insert its name and reference in the online catalogue From that time on the existing library is ex panded with your substance process or steering function Whether you or others will use this functionality in subseguent studies will depend on the study at hand Sometimes you will sometimes you won t The feature is however contained in the library and you can select it
78. pen Processes Library User Manual configuration ECO application type Delft3D mode Developer System nefis_data_file D Deltares Delft3D 4 1 0 win32 waq default proc_def dat nefis_definition_file D Deltares Delft3D 4 1 0 win32 waq default proc_def def algaedb D Deltares Delft3D 4 1 0 win32 waq default bloom spe defaulthome D Deltares Delft3D 4 1 0 win32 waq Create substance groups After start up the PLCT consists of three windows Figure 4 1 1 Messages 2 Processes Library Configu ration Tool 3 Select Groups Window displays messages when errors occur mostly related to missing information File managing window for opening and saving files and exiting the PLCT The window also gives an overview of the substances se lected so far Overview of available substances groups and entry point to select substances Also entry point to Extra processes Messages D Processes Library Configuration Tool File Edit Help Configuration OPL Developer environment B Edit groups list or select a group Available Groups Selected Groups Edit list of available groups Figure 4 1 First PLCT screens with an empty Processes Library The menu bar has the following menu bar options Processes Library Configuration Tool window File New Open Save Save as Exit Edit Merge 16 of 56 Start a new scenario clear all input Open an existing PLCT lt x 0 gt fil
79. re defined on interfaces between computational elements A first encounter of this phenomena was in section 5 2 where we computed the segment velocity using the flows and the cross sectional areas at the interfaces that came from the Hydrodynamic model Now we will produce ourselves an additional settling velocity in the water column The procedure is as following 1 Define a process that will compute the settling velocity with all input that you might need to do so In its simplest form this input it is just one coefficient the settling velocity of that particulate However for e g cohesive sediments many formulations are known that relate the settling velocity to the concentration of the sediment either positively through cohesion of single particles or negatively through hindered settling 2 Define as output item for this process the additional settling velocity at the interfaces see section 4 4 But now you specify that this output item should act on exchanges see Figure 4 12 Now something special happens You are asked whether you want to specify a velocity type term or a diffusion mixing type term at the interfaces or no specific term at all You select velocity 3 Make a Fortran routine that computes this velocity For our vertical velocity you set the value at 0 0 for the first NOQ1 NOQ2 entries in the array those are the horizontal ex changes and you fill in the computed vertical velocity in the NOQ3 entries Be sure that
80. rogen to oxidized nitrogen What services does the processes library offer you Make the model as large as you specify You can switch on substances switch on processes that influence the substances and you can define which items you want to be editable through the user interface and where a default value would do for you You furthermore can specify which items you want to be added to the output set the modelled substances are by default members of the output set but you can add any other intermediate computational result Once you have finished the model is exactly as large as you have specified so there is no overhead by the non used part of the processes library Administrate all data flows The system takes care that it acguires all input for the processes that the processes are invoked and produce output and fluxes and that the fluxes act between the substances You cannot influence this and that is why you also cannot make errors in this respect The system automatically takes your modelled substance temperature if you switched it on The system also automatically switches on all processes that produce output that is reguired as input for the processes that you have switched on yourself manually At set up time the system prompts you already to take action if not all reguired input for a simulation is resolved yet Intelligent data administration The system identifies for all items that you have specified to be editable by you wh
81. routine can be used from outside the DLL that should be produced You may need to change this to the conventions of your own Fortran compiler As long as it produces a standard MS Windows DLL or a Linux shared object everything should work fine Make a Windows DLL from your source files Once you have created one or more subroutines for use in the water quality module you need to compile them and link them into a dynamic link library called D3Dwag OpenPL alP This library must then be found by the water guality module While the procedure varies for each compiler we describe it for the MicroSoft Developer Studio and Compag Visual Fortran Store the relevant source files in a separate directory for easy reference Start the Developer Studio and create in this directory a project of the type Fortran Dy namic Link Library Set the name of the project to D3Dwaq_OpenPL or make sure that the resulting DLL is called D3Dwaq_OpenPL dll Add the source files to the project Build the DLL When this is done the DLL and the process definition file must be copied to a spot where the water quality module can find them This is described in the next section Incorporation of your new process library database The database file that you created must be copied to the location in your Deltares software environment where the file lt proc_def dat gt file is located For the Delft3D environment this is e g the directory lt
82. s for another project without stumbling around with different versions of source code that may mutually conflict 4 of 56 Deltares Introduction to Open PLCT Why is there a need for an open processes library Why then at the first decade of this century must we set a next step Both staff at engineering firms and institutes who are using our software and our own staff want now and then new substances organisms processes and coefficients to be introduced in the library Up to now they had to contact our software support group who do this fast This works fine but some users would prefer to obtain that ability in house This is especially true for the university community They want to be able to program their own water guality kinetics Prof Joseph Lee of the old and respected place Hong Kong University once said that students should not only just apply commercial software but also be able to create the computer code that represents heir scientific topic of study Since his students are not pro gramming their own word processor before they are writing their thesis we saw possibilities for the processes library software It could act as a kind of word processor for the water guality processes that his students would write during their study If we could deliver the library empty and allow the students to program the substances organisms and processes themselves they could focus on the water guality processes without having to deal with a l
83. s for a process can have a default value Per process however you can specify whether you want the system to use this default value or not If an item is modelled the system generally automatically takes the model result as input for all processes that reguire the item You can overrule this by specifying the item externally Items can be D constant in time and for the whole model area D atime function that is uniform over the whole model area O a spatially heterogeneous factor that is constant in time O a spatially and temporally varying item A model result generally is in the last form You do not need to care You can use different approaches for the same item in different studies o temperature as a prescribed constant for a short term simulation o asa prescribed time function for a one year simulation of a coastal zone or river O temperature modelled with input from solar radiation cloudiness and humidity The system automatically resolves all references Fluxes A special class of items consists of the fluxes between substances They have an as sociated stoichiometry That is a table with the name of the substances where they act upon and the factor with which they act The nitrification flux e g acts with a factor 1 0 on ammoniacal nitrogen and with a factor 1 0 on oxidised nitrogen but it also acts with a factor of 4 57 on oxygen This 4 57 represents the amount of oxygen in gram needed to nitrify 1 gram of ammoniacal nit
84. sed in stead of the backward slash for PCs 27 08 1999 Data to be typed by you into the input fields are dis played between double quotes Selections of menu items option boxes etc are de scribed as such for instance select Save and go to the next window Deltares 1 of 56 Open Processes Library User Manual Example Description delft3d menu Commands to be typed by you are given in the font Courier New 10 points gt User actions are indicated with this arrow m s Units are given between square brackets when used next to the formulae Leaving them out might result in misinterpretation 2 of 56 Deltares 2 1 Introduction to Open PLCT Background As important as grid generation for the hydrodynamicist For hydrodynamic models the schematisation of a river basin a lake an estuary or a sea is of utmost importance The model grid the correct bottom elevation on that grid external forcing etc are the scope of work of the hydrodynamic modeller The mathematical modelling software solves the model eguations on the prescribed grid with the prescribed external forc ing For water guality modelling the spatial resolution generally consists of the resolution of the underlying flow field as generated by the hydrodynamic model itself or of flows on integer multiples of those hydrodynamic grid cells For water quality modelling there also is external forcing in the
85. sentative in a computational element in e g a 1D branched river basin network That is a modelling decision It has nothing to do with the concept of an open processes library Any model using a so called staggered grid velocities defined at the interfaces of computational elements has to incorporate a pro cedure to assess velocities that are representative for the computational elements itself The open processes library however allows you to develop your own ideas on this topic Fora 1D branched river you could consider to average velocities proportional to the areas after a split or before a confluence and to average the upstream and downstream value This would create the following formula for a split or confluence Qi41 41 Oli 42 Qi at Aen ae Ain Qi i1 i v 0 5 0 5 N ue fan A Ala T Aa A Aini Ain 5 1 The approximation is exact if the sum of the two surface areas after the split eguals the surface area before the split The resulting formula is simple to implement You sum all flows and areas associated with a computational element separately and divide in the end To compute the horizontal velocity in a 2D horizontal model or in one layer of a layered 3D model you could use the same procedure for each of the 2 main directions if main directions can be distinguished Then however you need to use Pythagoras law to compute the velocity as the root of sum of squares of the velocities in
86. set the depth of the from element to zero After this step is completed either at the top or at the bottom now the total water depth is accumulated and at the remainder of the water column the depth is zero For dry parts of incomplete layers it is assumed that zero depth was stored in the array locations so zero volume of the computational element This requirement can be relaxed later on because then the options to check whether a computational element is dry or wet etc will be discussed The vertical from and to pointer table is travelled in reversed order and all depth value larger than zero in a to element is copied to the location for the from element The result Deltares 43 of 56 Open Processes Library User Manual 00000 Top of File I 00001 SUBROUTINE TDEPTH L PMSA FL IPOINT INCREM NOSEG 00002 NOFLUX IEXPNT IKNMRK NO01 NOQ2 00003 NOQ3 NOQ4 00004 DEC ATTRIBUTES DLLEXPORT ALIAS TDEPTH TDEPTH 00005 C 00006 Crease se 26 96 26 96 96 96 96 DEJE IE RE HHH HEHEHE HEHEHE HEHEHE EHR EKER EEE 00007 C 00008 IMPLICIT NONE 00009 C 00010 C Type Nane 1 0 Description 00011 C 00012 REAL 4 PMSA 11 0 Process Manager System Array window of routine to process library 00013 REAL 4 FL 1 O Array of fluxes made by this process in mass volume tinme 00014 INTEGER IPOINT 2 I Array of pointers in PMSA to get and store the data 00015 INTEGER INCREM 2 I
87. t for a process the system considers them as resolved by the model So you can assume them to be available It is also possible to obtain other information from the hydrodynamic modelling part If you want to use e g the bottom shear stress in the Delft3D environment then you define an input to your process with this name and at modelling time you select the item to be specified as user input In the Delft3D user interface you couple the datafile containing this bottom shear stress to the item with this name of your processes library and you can use the item The difference with the items in Table 5 1 is that those in Table 5 1 are always present both in the 1D 2D SOBEK environment and in the Delft3D environment The availability of other items depends on the setting of your hydrodynamic run If you model e g thermal stratification with your Delft3D hydrodynamic model then you can specify the temperature result of that model as item for your Delft3D water quality simulation If you do not model temperature with the hydrodynamic model then you will have to model temperature with your water quality model or just specify a temperature time function for the area in the user interface We however need to obtain the velocity and the depth and Figures 5 1 and 5 2 give routines that do that job Deltares 51 of 56 5 9 Open Processes Library User Manual Derived entities Processes and their input and output are only displayed in the user interf
88. t substance Now also the Delete button becomes active The Delete button deletes a substance To do so however all processes associated with that substance should also be removed Even then the substance is not fully removed from the system but it is converted into an input item This input item can later on be deleted according to the rules for those items This very conservative approach is used to avoid accidental loss of data You will have noticed that the title of the Add button changed to Copy That reflects the fact that you cannot add a substance with the same specification as an existing one but you can copy it under a different name This copy feature is discussed in more detail in Section 5 of this manual If you change the information in name ID or unit field the buttons will be labelled Add and Change reflecting the fact that you can add a substance with the modified name ID and unit or change the selected substance towards the new values in the fields A special situation occurs if you specify a substance ID using the drop down list You can then select a substance that already exists in another group If you now press the Add button you are asked whether you want to move the substance from the other group to this group If you answer yes the substance is moved from the other group to this group You only need to specify the ID for that action All ID s are case insensitive so Oxygen is the same sub stance as OXYGEN It
89. the early 80s to the early 90s of the past century had the option of user programmable water guality You wrote a Fortran subroutine with water guality kinetics That routine was linked with the main system and you were able in this way to change your water guality model eguations at need A number of sample kinetics was delivered to give you a flying start We used this procedure also for our own advisory work from 1983 to 1993 This resulted over time in a number of in house programs or subroutines all doing partly the same for common substances and partly different things for substances and interactions that were specific for the problem at hand This procedure was very prone to errors especially because for a somewhat realistic water guality model the amount of code for the substances and their interactions could become substantial and also the amount of different projects and thus different versions of the user defined code was substantial at Deltares Deltares 3 of 56 Open Processes Library User Manual Software library approach That is why Deltares developed in the early 90s of the past century its processes library This is an object oriented approach where each substance is an object Each arrow be tween substances in the commonly used flow charts of water guality kinetics called process is an object as well Finally each steering coefficient or steering function is also an object The library includes all substances
90. u do not want them to change The only one who then can change the value of the constant is you through this developer environment You can specify the unit of the item either directly or select a previously entered unit from the list here we specify 1 d An item specified this way can appear in many processes like temperature does in general It has one default value but per process you can specify whether you allow this default value to be used here 2 3 The consequences of not allowing a default value is that the item must be specified as a modelled substance the output of some process or as input provided by the user This is a method to force an entry by the user for the item for certain processes As soon as you modify the default value the checkbox is checked automatically You can however uncheck it again Remark If you try to check Act on exchanges the system produces a warning and refuses to do so This feature only can be checked for output items that are made on computational element interfaces e g a settling velocity rather than on computational elements itself Once such an output item is made this way you can select the existing item from the ID listoox as an input item for other processes e g the settling of suspended sediment itself Also if you want to check the checkbox Active substance the system refuses with a warning This checkbox is only meant for existing items that you selected from the ID
91. uld be added to the diffusion term in the advection diffusion equation and again the term was taken into account by the advection diffusion solver If you selected neither a velocity nor a diffusion type of term then the term will not be added to the advection diffusion equation but it will just be there to serve as input for other processes The latter situation can e g be the case for an item as the density gradient at a cross sectional area This density gradient can then be used in commonly used formula s for reduced vertical diffusion due to stratification with as net result a vertical diffusion type of term It is however also possible to specify a velocity of salmon towards a freshwater source if you first computed the salinity gradient as cross sections 5 7 Further performance improvement If we look at the BOD Decay formula OBOD k BOD 5 4 DE 1 5 4 then the decay constant kj is a constant In reality it is a bacterial process that is temperature dependent with TE ki kao ToS ja 5 5 Here Troef is the temperature dependency generally 1 047 for decay of organic matter T the temperature in degrees centigrade and kon the decay constant at 20 C This formula tion is easily included in the source code with help of the previously given examples If the temperature T is not modelled but specified as a constant for the whole river or estuary then straight forward programming will result in the evaluation of th
92. using an existing processes li brary like the library that is delivered together with the Deltares software uses the Processes Library Configuration Tool PLCT to select substances for modelling to select processes for the interactions and to select parameters for user input and user output It is easier to un derstand the developer environment if you already know the functioning of this PLCT It is however not mandatory You can use this tutorial also as a novice user In the tutorial two things will be done step by step to illustrate the functioning starting with a fully empty processes library we will set up a complete Streeter Phelps BOD set of processes for the library starting with the full WAQ license from Deltares we will add an additional substance that is considered a priority substance for the European Water Framework Directive and that was not contained yet in the library at the time of writing the WAQ manual How to start the developer environment The developer environment is incorporated in the Processes Library Configuration Tool You start the PLCT from the SOBEK or Delft3D user interface using the corresponding tool button In developer mode the PLCT takes several extra parameters in a Windows INI file configuration The configuration parameter gives the configuration where you start the system with Common configurations are O ECO the ecology configuration DH WAQ the general water quality configuration
93. window of Delft3D MENU 0 000 eee ene 11 Select working directory window to set the directory to for saving files 12 Open Processes Library OPL window to start the OpenPLCT 12 Open Processes Library Configuration Tool start windows empty database 13 First PLCT screens with an empty Processes Library 16 Add groups and Edit Group names window after entering BOD DO before PSS SINN EN nn oe ok K eA ae Be a ee ee ee eae 17 The newly created group BOD DO is selected 18 Edit substances list or select a substance window before our new group 18 Add Copy or Edit Substances in Group window 19 Add Copy or Edit Substances in Group window before BOD5 is added 21 Edit Substances list or select a substance window with the new substances selected sokki OB ZOO 21 The empty Select Processes window for Biochemical Oxygen Demand 5 TU ae ee ee oe EO ee Oe E L n we Es 22 Add new and Edit existing Processes window 22 Edit processes window for process window for the newly created BODDe cay process p 23 Editltemwindow SMM eee ee 25 Edit Item window with the BOD Decay Rate filled in oaoa aa aaa 26 Edit Item window with specified flux and Stochibutton 27 Edit Stochiometry of flux window s Ke 27 Edit Stochiometry of flux window after stoichiometry has been entered 28 Edit Process with input items

Download Pdf Manuals

image

Related Search

Related Contents

Zanussi DCE 5655 Instruction Booklet  Manual de Instruções FP 3 E  Land Pride RTR10 311-431P User's Manual  PDFファイル  OpenBricks Embedded Linux Framework  Stow SFCG1 CE.p65  S28C(w)  Rapid RechargeMax Quick Start Guide - Support    User`s Manual V1 - Chase Scientific Company  

Copyright © All rights reserved.
Failed to retrieve file