Print Friendly and PDF

Convolution DLLs

Nick Martin -

Convolution is a mathematical operation on two functions to produce a third function. It has applications that include probability, statistics, image and signal processing, engineering, and differential equations. Typically, one function is the input signal, or data stream, and the other function is the impulse response or filter kernel. The application of the impulse response to the data stream produces a transformed output which is the produced/calculated/derived, third function. Wikipedia provides additional discussion of the convolution operation.

The convolution operation can be applied to both continuous input signals/functions and to discrete input signals/functions. In practice (especially when dealing with dynamic simulation on a computer), the input signal will always be discrete as it will be sampled at discrete time points if it is defined using a continuous function or it will be defined at discrete time points (e.g. a time series). The act of sampling or defining the input stream at discrete time points places important restrictions on the convolution calculation.

For most applications, convolution is a static calculation where the entire input signal is known or operated upon by the response function in one operation. GoldSim is a dynamic simulation framework which is highly optimized for simulating changes through time. As a result, there are likely a limited number of use cases for convolution in GoldSim.

However, there is a Convolution Element included in GoldSim which is used infrequently. This element provides an acceptable solution for some simple convolution calculations.

Unfortunately, there are number of drawbacks to using this element in general scenarios. These drawbacks include the following.

  • The two functions (input signal and impulse response) are approximated with a Cartesian geometric algorithm (i.e. trapezoidal rule type of implementation) which represents functions which vary smoothly and linearly fairly well. This algorithm, however, does not always apply very well near certain boundaries (like 0 and step discontinuities), and it represents non-linear functions, including step functions, poorly.
    • As a result, it does not work for the direct runoff calculation via convolution of excess precipitation and a unit hydrograph because both excess precipitation and the unit hydrograph are step functions.
  • The GoldSim Convolution element, also, does not enforce the sampling interval in the presence of inserted time steps which means that the solution can diverge from the correct solution because one or both functions (input signal and impulse response) are applied using different intervals.

To address the shortcomings of the Convolution element, two dynamic-link libraries (DLLs) are available for use with the External element in order to provide a more robust and generally applicable convolution calculation. The DLLs and example GoldSim models illustrating the use of the DLLs with the GoldSim External element are available in the link to the zip archive at the bottom of this page.

There are two DLLs (and two example GoldSim models). The two DLLs employ similar algorithms but are implemented in different programming languages and using different underlying numerical libraries.

  1. Python Convolution DLL which uses the GoldSim Python DLL and SciPy which is a Python-based ecosystem of open-source software for mathematics, science, and engineering.
  2. GSL Convolution DLL which uses GNU Scientific Library and is written in C++.

To use these two Convolution DLLs, you should access the supporting source code available in the Python DLL and GoldSim External Element and the GNU Scientific Library articles.


Download the Convolution DLLs and the example GoldSim models:

GoldSim Model Library






  • DLL
  • Convolution
  • External element
  • C++
  • Python
Have more questions? Submit a request