# Coupling of Codes

This section introduces the software tools for the uncertainty and sensitivity analysis, as well as the coupling with the appropriate geochemical speciation code used that was capable of handling sorption processes. The sampling (based on advanced Monte Carlo methods, e.g. Latin Hyper Cube) has to also reflect any available correlation information in an efficient way. To allow for an efficient generation of the sensitivity calculations (in particular the variation of the SCM parameters) the coding of the coupling had at least to provide for a partial automation. Difficulties usually arise from the fact that geochemical speciation is generally computed in an iterative fashion. Thus the coupling with the sensitivity analysis requires a specially adapted interface that had to be programmed within this project.

The coupling (code packages and data transfer) is illustrated in Fig. 1. The computation has as the outermost shell the code providing input parameter variation, i.e. sampling tool to vary all parameters simultaneously and according to their error distribution functions and mutual correlations. The middle shell takes each parameter vector (plus all constant parameters), converts each into a valid input file for a speciation code and passes it on to such a code. The innermost shell then computes the geochemical speciation with associated species distributed between mobile and immobile phase(s). Then the middle shell takes the output, strips all unnecessary information, and computes a K_{d}. The outer shell then links this K_{d} to the respective input and collects such value sets for all parameter variations. The last step is to perform a statistical analysis to obtain correlation matrices and rank tables. The whole package is implemented on a Windows platform.

**Fig. 1: Flow chart of the sensitivity analysis package, with the sampling and statistics code SimLab (1), the data processor UCODE (2), and the geochemical speciation code PHREEQC (3)**