This testcase is an example to use the Delft3D-FLOW functionality called mormerge Prerequisites ============= Tcl must be installed on the machine where the mormerge calculation is executed. Tcl is installed by default on most Linux machines. Tcl is open source and can be downloaded from http://www.activestate.com Running the mormerge testcase ============================= - Build the Delft3D open source code (release version) by running (at the top level) the build.bat (windows) or build.sh (linux) script with build configuration "all". When this is finished, binaries will be installed in directory ".../build_all/x64" (windows) or ".../build_all/lnx64" (linux). - Go to subdirectory ".../examples/05_mormerge/merge" and execute script "run" with extension ".sh" (Linux) or ".bat" (Windows). Several processes are started in the background. They will disappear when the calculation is finished. If the calculation does not finish normally, the user must check whether all started processes are killed. Output ====== - Directory ".../examples/05_mormerge/merge/sync" will be created, containing files showing the progress of all FLOW and MORMERGE processes. - All model output is in the "condition"-directories: ".../examples/05_mormerge\0deg" ".../examples/05_mormerge\45deg" etcetera Each of these directories contain a file named "d_hydro.scr" and optionally "wave.scr", containing the screen output. All conditions will have identical bedlevels. - A file named ".../examples/05_mormerge/merge/mormerge_.scr" will be created for each mormerge process, containing: - information about the progress during the initialisation phase The following message can be ignored: "ERROR: ld.so: object '/part0/u/mourits/code/oss/bin/lnx/flow2d3d/bin/../lib/libgfortran.so.3' from LD_PRELOAD cannot be preloaded: ignored." - the message "Infinite loop started ..." when the initialisation phase is finished normally and the calculation is started - the message "GetPutArrayError: ABORT Recvfrom host:40036 returns 0 bytes. Is the peer process dead?" mormerge does not have information about the number of time steps to be performed. When the FLOW processes are finished, mormerge detects that and writes this message, both when this is a regular finish or a premature abort. The user must check the FLOW output. - A file named ".../examples/05_mormerge/merge/mormerge_.log" will be created for each mormerge process. - Intermediate scripts will appear in directory ".../examples/05_mormerge/merge" during initialisation. They will be removed automatically when the debug flag inside the mm-file is set to zero and left for inspection otherwise. The mormerge algorithm ====================== Define different conditions for basicly the same model. For example by varying wind, wave or boundary conditions. All conditions must be identical on the following items: - Grid-dimensions - Initial bedlevel - Morphology being modelled; Start time for bed updating must be identical All conditions run at the same time as separate Delft3D-FLOW calculations. Each half time step, the bedlevels of all conditions are averaged. This averaged bedlevel is then used by all conditions during the next half time step. Input ===== A mormerge testcase directory must contain two subdirectories (exactly) named "input" and "merge". Subdirectory "input" contains: - all files that are identical for all conditions. These files will be copied to all separate work directories, one work directory for each condition - a subdirectory for each condition with (exactly) the same name as that condition, containing input files specific for that condition. These files will be copied into (replacing duplicates) the work directory of the related condition. Directory "input" (or each condition subdirectory) must contain a full set of Delft3D-FLOW input files, including a morphology file, see the Delft3D-FLOW manual for it's format. This morphology file must contain the following line, inside block [Morphology]: Multi = true Subdirectory "merge" contains: - an ini-format mm-file containing: - references to the binaries to be used - some run parameters/flags - a list of all conditions to be activated, each with a weight factor. These weight factors are being scaled, such that the total weight is 1.0. - a script to start the mormerge calculation Implementation ============== When starting a mormerge calculation, a script is executed named "mormerge.tcl", written in the script language Tcl. This script: - reads the mm-file - allocates nodes of a cluster (optionally), Only works on Linux - creates a work directory for each condition, containing both the general and condition-specific input files - starts an instance of executable "mormerge.exe" for each subdomain (one after each other) - starts an instance of Delft3D-FLOW for each condition (one after each other), optionally with an instance of Delft3D-WAVE running online with FLOW - waits until all started processes are finished Each FLOW process communicates with all mormerge instances by using C++ streams as follows: - Each mormerge instance executes a "createstream" call for all conditions and writes the resulting handle in a file named "streamfile" in the specific work directory (for each condition) - Each FLOW subdomain: - reads the handle from the "streamfile" in it's work directory - appends the runid of the subdomain - and executes a "getstream" call with this handle Now FLOW and mormerge can exchange data using "putarray" and "getarray" calls. Initially some dimensions are exchanged. Each half time step, after calculating the bedlevel update: - Each FLOW calculation communicates the sediment-specific, cell-specific bedlevel update to the relevant mormerge instance - Each mormerge instance sums all condition-specific arrays, multiplied with the (scaled) weight factor and communicates the resulting array back to all FLOW calculations - Each FLOW calculation uses the received averaged bedlevel update to continue the calculation Adri Mourits