Thursday, June 30, 2016

Celerity versus velocity and the travel time problem

A little of introduction

Velocity of a fluid is the variation of particles position with time. However it is not velocity alone to determine fluxes. Fluxes in fact depend both on velocity of fluid particles and the section (the area) through which they flow. The area of the fluxes can vary: when there are waves. In the latter case, the section  through which the flow passes can suddenly increase (or decrease).  The first illustrating case is the kinematic wave from which, the variation of the fluxes is ruled by

$c := \frac{\partial Q}{\partial A}$

where $Q$ is discharge and $A$ is the cross-sectional area through which water moves.
In other cases, the variation of effective area is more subtle, as in unsaturated (vadose) porous media flow, where the flow that happens through pores is not visible, and flow can vary because pores of different size can be active or quiescent depending on the value of the global hydraulic head

Jeff McDonnell (GS), and Keith Beven (GS) with their nose for interesting topics, actually wrote recently a paper where they discuss it (which I did not find very illuminating)

One aspect is that velocity of water itself vary (in time) and this variation, is, obviously, due to some acting force (stress) as the second law (Newton law) of mechanics asks. The acting force can be usually be thought as a consequence of a potential field that, in hydrological problems, we often recognise as being  the hydraulic head (gradient of pressure terms, expressed in unit of length). Thus flow can actually vary as a consequence of local variations of hydraulic head pressures. These variations are communicated through the medium and the velocity to which they move is the pressure wave celerity (by definition).

To sum up, deformation in the pressures field travel, they result in variation of the flow area and of temporal variation of local (eulerian) velocity of a flow field.

One important point that Beven and McDonnell made (but this has been known from decades) is that transport of properties (passive tracers) depends on water molecules velocity and therefore between transported properties (like temperature, water isotopes, water age) and flow can be various discrepancies. 

One indicator of transport processes is the mean travel time. There is no doubt that it must be:

$<T_r >_t  := \int_0^\infty (t-\tau) p(t-\tau|t) d(t-\tau) $

where $<T_r >_t$ is the mean travel, $t$ is the actual time, and $\tau <  t$ is the injection time and $p(t-\tau|t)$ is the travel time distribution conditional to the actual time. Implicitly, it is assumed that the probability is evaluated at the closure (boundary) of a control volume, and, for deformation, I think it is the outlet of a catchment. This distribution is time variant but often, in the past it was assumed invariant. Moreover, it usually differs from the residence time distribution, which actually refer to the distribution of ages inside the control volume. (Details in here). The distribution represent the ensable distribution of infinite random experiment that regards the motion of a single molecule or, after the hypothesis of ergodicity, the distribution of the travel time of a bunch of molecules, which are injected together in the system. 

How $<T_r >_t$ is affected by celerity ? Let say that celerity has to do with fact that the probability is time varying. I cannot prove it at the moment, but I can give some heuristic.

Back to the basics

Let’s me re-discuss the topic from the scratch. When we have a velocity field, $u(\vec{x},t)$ in a fluid it can be either stationary or time varying. Assume it is stationary. Then:

$\frac{\partial u(\vec{x},t)}{\partial t} = 0$

which implies that $u(\vec{x},t) = u(\vec{x})$, i.e. it does not depends on space, and it is called stationary. Does it implies that forces does not act ? No, forces act, because still we can have gradient of velocity:

$\nabla u(\vec{x}) \equiv (\frac{\partial u(\vec{x})}{\partial x}, \frac{\partial u(\vec{x})}{\partial y}, \frac{\partial u(\vec{x})}{\partial z} ) \neq 0 $

However, forces they do not change in time and are subject to stationary resistances (dissipation) that do not allow for the overall system to accelerate (increase the total kinetic energy). 
So, because variation of velocity means acceleration, we have forces there. When the we follow a first particle moving (the so called Lagrangian vie of the motion), it is locally accelerated, and it feels a force. Its travel time in the domain is completely determined by the velocity field (this is a statement always valid) and (that is true just for this case) does not vary in time. If a second particle is injected in the same place of the first one, it will have the same travel time. Particles (parcels, molecules) injected in different points will have different trajectories, all stationary, and the overall distribution of of travel times for a bunch of particles injected together (or, BTW, at a different time) is not time varying. The fluxes that comes out from such a velocity field is not constant but reflect the mass (volume) of particle injected in the fields. What is going in will go out in a certain composition of ages which however is easy to disentangle from the knowledge of the spatial field and the amount of injected matter.  

In the above case no net energy is transferred and we do not have to invoke celerities besides energy. 

Now, assume we have a time varying velocity field, so that $u(x,t)$.  Therefore:

$ \frac{\partial u(\vec{x},t)}{\partial t} \neq 0$

So we have acceleration in (usually) many points. This acceleration can only be generated by a local force (which has to be time varying). The way to obtain it in a fluid is to generate a time-varying pressure gradient (yes, excluding time varying gravity, time varying electromagnetic fields, time varying applied work, time varying temperature or density gradient, ;-) etc. , all things we usually not deal with in our hydrological problems). Actually it can be shown that these pressure variations can travel from one place to another (in ways that are different in different phenomena: see Beven and Mcdonnell) so that this pressure variation is the cause of the varying velocity field, according to the thermodynamic fact that pressure is a generalized force. The velocity of these travelling pressures is the celerity. Conjointly with pressure field variations, also  fluxes in previously unaffected area are activated.

So we obtained in full the phenomenology that we described at the beginning of this page. In this case distribution of particles’ travel times is affected in two ways we anticipated: by mobilising water (and/or enlarging the sectional area) and by increasing (locally) water velocity.
From the above analysis is also evident that the phrase "celerity (of pressure waves) affects flows" is true, but in an indirect way, since flow is affected by velocity fields and their spatial extension, both modified by pressure waves. Celerity of water is probably a meaningless or imprecise naming which does not describe properly the phenomenon. In some cases (finally) the pressure waves is identifiable as movements of the free surface, and this generates actually, a lot of misunderstanding in the visualisation of the general process.

Consequences on the mean travel time

Distribution of the mean travel time can vary because the newly activate area can contain water of ages different from those activate previously, and because locally the velocity of water can increase (or decrease) at the passage of the pressure wave which travel with its own celerity. The latter effect can skew the distribution of travel time to the left (smaller travel times), but unless the variation is such that the whole the control section is affected (which can be the case) has not significant effects of the mean travel time, which is an integrated quantity. So it is probable that the  set of particles close to the outlet passed through the control volume in antecedent times,  and are not affected by a single perturbation.
Due to time variation of the velocity field, when we inject two water volumes in the same place at different times, the travel time of the two volumes is different, and inherently, the related transport. 

Well, the velocity field is not superimposed, but caused by the quantity of water itself.

So far we discussed the cause of  varying velocity fields which I suggested was due to pressure waves. However, is is interesting to know also what generates these wave pressures. In case of water flow is usually the water amount itself. The velocity field, in fact, is not something independent of the water quantity and distribution. On the contrary depends on it. So when we inject water, we cause pressure waves that propagates with a law dependent on the medium we are analysing: surface, vadose zone, or ground. 

Tuesday, June 21, 2016

Is possible to get the runoff for European Countries ?

This is a conversation between two groups of the CLIMAWARE project of some general interest. Further information about global or continental scale hydrology can be found in some previous posts.

Dear Alberto and Riccardo

we are writing about the data we need for the project CLIMAWARE. 

The objective of out analysis is to estimate the impacts on agricolture of modification of:

1)  soil use
2)  anything due to the changed water availability as a consequence of the climate change. 

We are thinking to consider two time frames, the first up to 2020, the second up to 2040 (this because the estimation of soil use variation are available for these two dates and to do an analysis on the national scale for all the Countries of the European Community. 

Alberto's answer:

Dear Martina,

for what I know, there are not detailed projections at this scale. I saw studies on the largest basins (as  Danube) where all is solved by putting R = P- E (runoff = precipitation - potential evapotranspiration). For what I know, nobody looks at the national scale, for the reasons that the river basins do not coincide with nations areas.

There are regional studies (not about the countries but  for Southern Europe, for instance) made by Giorgi’s group or by Julich’s colleagues using their Earth system model. 

Bruno Majone answer:

Dear Martina,
what you are opening is a Pandora’s vessel. I try to explain it better. To deal with water availability at European scale, there are many different approaches. The simplest is to do a hydrological budget simply by using the available climatic projections. Alternatively, one can use hydrological models working at pan-european scale that can be fed directly by the projections themselves. For any of the choices the real problem is selecting the right forcings. There isn’t a reference dataset: there are various “ensemble” of simulations derived from various climate models, each one of them following a different pathways scenarios.  The reference initiative for Europe is Euro-cordex that gathers the modelling work of various research groups that perform experiments with global and regional climate models, and scale down the results from a coarse grid of 125 km to one of around 25 km (see the pdf). Considering the results of these models one should observe that usually they have strong biases that need to be corrected. Otherwise the water budgets can be extremely wrong. For what I know, inside the Euro-Cordex group there are groups that are examining and providing scenarios by using various techniques of bias correction, but I am not sure that they are already available and usable. 

If your interest is to have annually aggregated data by country, I personally would not explore thid road because I believe that the effort to contact the active groups, download huge datasets and precess them could be overwhelming.

I would try instead to contact groups that already have hydrological models setup at European scale and are already estimating climate change impacts. Alberto mentioned the Julich group, but another possibility could be JRC. They have their model LIFSFLOOD set up at 5*5 km of resolution (and it could be that they already have used it to do some impact studies).  At this point you should ask for they to send some gridded data of runoff and afterwards aggregate them at country level.

Monday, June 6, 2016

Java, Python, C/C++ or FORTRAN in scientific programming ?

I found this simple post by Michael Scharf on Quora  that discusses part of the question. It is easy to read, clear, and probably true. So I publish it verbatim (with some comment of mine, especially for FORTRAN)

"I have used  (Java, Python, C/C++ - my note) each of them for 15-20+ years. There is no best. They have different strengths and weaknesses.
  • C and C++ require a lot of discipline because you have to do memory management yourself.
  • C++ is extremely powerful but also very complex.
  • C and C++ are "dangerous" because, if you are not careful, your program can access and modify data that it is not supposed to touch.
  • Python is elegant and designed to be easy to use and read. It has the least distractions when it comes to syntax.
  • The syntax of C, C++ and Java look somewhat similar. Python looks different, it  uses indentation instead of {} to group code
  • Java has the best IDE support (e.g. eclipse or IntelliJ)
  • C and C++ are also statically typed, but the preprocessor can add a level of complexity that can make it difficult to be sure what actually happens.
  • In terms of speed C/C++ are fastest, but for most problems Java is very close in speed. Python can be slow, but if needed critical parts can be written in C. On modern execution speed is rarely the limit - cache behaviour, memory and disc access are the limits.
If you want to learn programming, I would learn Python first, then Java, then C and finally C++.
I personally would not recommend C++ because of its complexity. However, if your are disciplined and have a strict set of rules for a project, C++ can be fantastic.
I would use C only for low level stuff, like writing device drivers.

Java is good for large projects, provided you write good APIs and you are carefully modularizing your software.

Python is good for small projects. If the team and the software gets bigger, it can become hard to maintain unless you have a very good test coverage."

There is no mention of FORTRAN  because since many years, it is just a language that regards the niche of users that do numerics (of any type).  Here a discussion in StackOverflow about this language compared (more or less) to the other languages mentioned above. 
I never really used FORTRAN, so I am not the best person to  talk about it.  I actually moved out of it in 1988 when I decided to use a language with dynamic memory allocation, and I never went back to it.  Generically I believe its velocity is overestimated, especially considering that the average scientific programmer is a bad programmer, and a bad program in FORTRAN can be much slower than a program in any of the above languages.

I saw a lot of tools made in FORTRAN and some large models. But I am not sure it is the best choice for a large project.  Anyway, FORTRAN plus Python is the choice of many in these days. Still I believe it is a sub-optimal choice for managing software projects that go beyond programming a few algorithms, and personally I do not like its syntax and its convoluted object orientation. But I will never personally test if this is actually the truth. 

Moreover, it is true that "It's (FORTRAN's) array handling is nice, with succinct array operations on both whole arrays and on slices, comparable with matlab or numpy but super fast. The language is carefully designed to make it very difficult to accidentally write slow code -- pointers are restricted in such a way that it's immediately obvious if there might be aliasing, as the standard example -- and so the optimizer can go to town on your code. Current incarnations have things like coarray fortran, and do concurrent and forall built into the language, allowing distributed memory and shared memory parallelism, and vectorization. (cit. from Stack Overflow)". However,  it is this attitude that favors such a certain laziness in software design that I do not appreciate. 

For most people, however, is just matter, of what they were taught, i.e. a matter of legacy. They just have a lot of material to which they got used to, and do not want (or have the time) to change. So think that your initial choice can stick with you for most of your life, because what Peter Norvig says, has a lot of foundations (Teach yourself programming in then years).  On the other hand,  consider that, if your activity has to do with programming, during your life you will embrace  more than one programming language (but one will remain your main one). Not because it is mandatory (and for some jobs it is), but because you are this type of guy (gal) that likes this sort of things. 

So what would be my choice for students ? Well, for students in hydrology, I will choose Python and R. But for real life applications, I would chose Java first (as I did).  Eventually, my recent reflections tend to support the idea that the language (with its syntax and attitudes) is just one part of the problem, and that the real focus should be (without making of it an idol) the design of the code and its proper documentation (which has some peculiarities when the concern is a scientific activity).

Wednesday, June 1, 2016

gvSIG Festival

gvSIG is the platform where are migrating my contributions to GIS, thanks to Hydrologis. It is my intention, obviously, to embrace it from version 2.3, hoping that this will be the home sweet home I deeply desired in the last years. In preparing the arrival of the version that contains my tools, the developers had the idea of a nice initiative called gvSIG Festival where many developers were asked to explain their work.

There you can find a lot of useful information. Not specifically about hydrology but someone are. Clicking on the figure you will access the main page. Video Presentations are here.

Monday, May 30, 2016

A Ph.D position at University of Bozen on: Short and medium term hydrological forecasting for hydropower production

The candidate is assumed to produce forecasting and scenarios, with the modelling system JGrass-NewAGE for supporting the organisation and analyses of economical (and other) issues concerning the hydropower production in the Northern Adige River Basin. She/He is also assumed to be able advance the knowledge on phenomena that stay behind the production of runoff, and, in general, to advance the knowledge of  sustainable energy production in mountains area.

He/She will be supervised by professor Maurizio Righetti and co-supervised by Riccardo Rigon (GS, RG) and Bruno Majone (RG). Programming skills are required in order to be able to add appropriate modules (as open source contributions)  to the existing hydrological system. R knowledge for statistical analysis will be considered as a title of merit.
She/He will be inserted in a dynamic working group of Bozen and Trento Universities which includes also Professor Alberto Bellin (GS, RG). 

Deadline for submission June 8th.

Other information can be found at:

Wednesday, May 25, 2016


This is a project we presented for the National Projects (PRIN 2015). The project is very good. Participants outstanding. Competition very high. I do not understand because our government does not double or triple the funding available. A little effort would have enormous effects, especially in the morale of the troops.

What is looking for doing: Vegetation effects on water partitioning and mixing across the Earth’s Critical Zone: observations and predictions under environmental changes.

The Abstract:

Earth’s Critical Zone, the thin outer layer of our planet from the top of the tree canopy to the bottom of water aquifers that supports almost all human activity, is experiencing ever-increasing pressure from growth in human population, wealth and climatic changes. Understanding, predicting and managing intensification of water use and associated economic services, while mitigating and adapting to rapid climate change and biodiversity decline, is now one of the most pressing societal challenges of the 21st century. Thus, the knowledge of how vegetation affects water storage and flow pathways is essential for a more efficient and sustainable management of water resources. In spite of past efforts to assess the role of vegetation on the water cycle, a thorough understanding of the ecohydrological mechanisms according to which vegetation stores and transpires water, interacts with runoff generation and affects flow regimes is still missing. Particularly, recent works argued the truthfulness of the widely adopted paradigm of a single ecohydrological reservoir, and suggested that two ‘water worlds', one originating groundwater and stream runoff, and one associated with the vegetation water uptake, may exist. The lack of water exchange between the two soil pools provides a fundamental challenge to current conceptualizations and analyses of water-cycle processes.

The general goal of the project is to gain new insights on the water partitioning and mixing within the Earth Critical Zone by testing hypotheses of eco-hydrological separation of vegetation water use. For this, the project will couple advanced isotopic, geophysical and micro-meteorological monitoring with detailed eco-hydrological models, and will specifically focus on the Mediterranean area. Finally, the project will develop a framework to translate the new critical zone knowledge into evidence to support policy and management decisions concerning water and land use in forested and agricultural ecosystems.

The project includes the organisation a Critical Zone Observatories Network. This includes five field sites which will provide a consistent access to different climatic, hydrological and ecological conditions which are representative of the Mediterranean and Alpine-Mediterranean environments. Each Observatory involves co-located research to be conducted by inter-disciplinary teams. By testing hypotheses of eco-hydrological separation of vegetation water use across multiple sites, the project will advance our capability to predict the effects of vegetation and climate change on water availability in space and time.

1 - State of the art

Earth’s Critical Zone (CZ), the thin outer layer of our planet from the top of the tree canopy to the bottom of water aquifers that supports almost all human activity, is experiencing ever-increasing pressure from growth in human population, wealth and climatic changes. Within the next decades, global demand for food and fuel is expected to double along with a more than 50% increase in demand for clean water. Understanding, predicting and managing intensification of water use and associated economic services, while mitigating and adapting to rapid climate change and biodiversity decline, is now one of the most pressing societal challenges of the 21st century.

Although over the past 60 years numerous studies have examined soil hydrologic processes, vegetation function, and micro-climate independently, investigating the feedbacks among these core areas has only recently become a research priority. Fundamental questions on vegetation’ effect on the hydrologic cycle remain unanswered: how is the vegetation water use linked to the water flows to groundwater and streams? to what extent does transpiration affect streamflow and groundwater? how does complex terrain, soil characteristics and land use influence the feedbacks between hydrology and ecology? Answering these questions is key to assess the influence of changing vegetation cover on hydrologic ecosystem services in agroforest environments.

Current soil-vegetation-atmosphere (SVAT) models assume that groundwater, streamflow and vegetation transpiration are all sourced and mediated by the same well mixed water reservoir—the soil (Romano et al., 2013). Indeed, a main tenant of forest and irrigation hydrology is that vegetation transpires water that would otherwise form streamflow and feed groundwater within a well-mixed subsurface reservoir. This vision has been recently and fundamentally challenged by a number of studies (Brooks et al., 2010; Penna et al., 2013; Good et al., 2015), which have shown evidence of eco-hydrological separation (the “two water world hypothesis”, McDonnell et al., 2014) —meaning that the soil water that supplies vegetation transpiration is isolated from the water that recharges groundwater and replenishes streamflow. Evaristo et al. (2015) provides widespread evidence of eco-hydrological separation across different biomes by using hydrogen and oxygen isotopic data. The lack of water exchange between soil pools questions previous conceptualizations and analyses of water-cycle processes (see Jasechko et al., 2013, for example), because it implies that methods for studying water partitioning that use measurements of isotope tracers in streams may be blind to the part of the soil-water balance that involves vegetation and soil evaporation.

These first studies delineate novel research lines because suggest a well compartmentalized eco-hydrological system, and indicate that vegetation uses, at least under some conditions, more tightly bound soil water than easily mobile soil water. Given that water moves through plants via gradients of water potential, the use of more tightly bound water, energetically more difficult to obtain, remains counterintuitive (Cassiani et al., 2015). Testing this ‘two water worlds (2WW) hypothesis’ represents therefore a grand challenge in hydrology (McDonnell, 2014; Good et al., 2015; Bowen, 2015) and would advance our understanding of relevant soil-vegetation-atmosphere feedbacks which shape hydrological fluxes and water availability under the impact of environmental changes.


Bowen G., 2015: Hydrology: The diversified economics of soil water. Nature, 525 (7567), 43-44.

Brooks R. et al., 2010: Ecohydrologic separation of water between trees and streams in a Mediterranean climate. Nature Geoscience, 3:100–104.

Cassiani G. et al., 2015: Monitoring and modelling of soil-plant interactions: The joint use of ERT, sap flow and eddy covariance data to characterize the volume of an orange tree root zone. Hydrology and Earth System Sciences, 19 (5), 2213-2225.

Evaristo J. et al., 2015: Global separation of plant transpiration from groundwater and streamflow. Nature, 525, 91-94.

Good S.P. et al., 2015: Hydrologic connectivity constrains partitioning of global terrestrial water fluxes. Science, 349 (6244), 175-177.

Jasechko, S., Sharp, Z.D., Gibson, J.J., Birks, S.J., Yi, Y., Fawcett, P.J., 2013: Terrestrial water fluxes dominated by transpiration. Nature, 496, 347-350.

McDonnell J. J., 2014. The two water worlds hypothesis: eco-hydrological separation of water between streams and trees? WIREs Water 2014.

Penna D. et al., 2013. Tracing the water sources of trees and streams: isotopic analysis in a small pre-alpine catchment. Proc. Env. Sci., 19, 106 - 112.

Romano N. et al., 2013: Parameterization of a bucket model for soil-vegetation-atmosphere modeling under seasonal climatic regimes. Hydrology and Earth System Sciences, 15, 3877-3893.

2 - Some of the methodology

The main goal of WATER-MIX is to advance the understanding of water partitioning and mixing within the Earth Critical Zone (CZ) by testing hypotheses of eco-hydrological separation of vegetation water use. For this, WATER-MIX will couple advanced isotopic, geophysical and micro-meteorological monitoring with detailed eco-hydrological models, and will particularly focus on the implications for water flow partitioning and water availability in the Mediterranean area. The investigation will sample across a transect of climatic, vegetation and elevation gradients, including both forested and agricultural ecosystems. Finally, the proposal will develop a framework to translate novel CZ knowledge into evidence to support water/land use policy and management decisions.

We define the following three key objectives for the project:
1) advancing the monitoring of water exchange and partitioning across the CZ by using integrated high-resolution isotopic, geophysical and hydro-meteorological measurements from point to catchment scale;
2) coupling the high-resolution CZ data set with eco-hydrological models at multiple scales to test hypotheses of i) eco-hydrological separation of vegetation water use , ii) residence time distribution and iii) energy partitioning across the CZ; 3) developing a framework to translate the new CZ-hydrology knowledge into evidence to support policy and management decisions concerning water and land use in forested and agricultural ecosystems.

2.2 The Critical Zone Observatories Network

The Project Critical Zone Observatories Network (CZN) includes five field sites (Fig. 1) which will provide a coherent access to different climatic, hydrological and ecological conditions which are representative of the Mediterranean and Alpine-Mediterranean environments. The CZN includes humid areas where vegetation water use and precipitation input are in phase, wet zones where seasonality of precipitation is low, and dry zones where water stress is high. Both forested and agricultural land use are represented in the CZN. Each CZ Observatory (CZO) involves co-located research to be conducted by interdisciplinary teams. The suite of measurements includes stable isotopic measurements, geophysical determination of soil water spatial distribution, land-atmosphere exchange of water, and linkages to the biosphere, surface and ground water systems. The CZOs are described in Section 3.

2.3 Structure of the work

To implement the project work, five WPs are defined and linked through a continuous exchange of information, with WP1 dedicated to the project management and dissemination of results. WP2 will develop a homogeneous protocol to integrate isotopic and geophysical observations with hydro-meteorological monitoring at various spatial scales to characterize water partitioning and balance across CZN. WP3 aims (i) at advancing isotope monitoring of vegetation and soil waters in order to help the identification of water pools and mixing processes and (ii) developing and implementing high-resolution, minimally invasive geophysical approaches to soil moisture content distributions, across the CZN. WP4 will couple the high-resolution CZN data set generated by WP2 and 3 with eco-hydrological models at multiple scales to test hypotheses of i) eco-hydrological separation of vegetation water use, ii) residence time distribution and iii) energy partitioning across the CZ. WP5 will develop a framework to translate the new CZ-hydrology knowledge into evidence to support policy and management decisions concerning water and land use in forested and agricultural ecosystems.

Saturday, May 21, 2016

GEOframe a system for doing hydrology by computer

This was the remodelling of a presentation I gave at the CUASHI biennial meeting in 2008. It is, more or less, the manifest that guided me, throughout the modelling I did in the subsequent years, and I am still pursuing. Some reference can be a little old, but not certainly obsolete. While revising it in preparing my last two presentation in Parma and Grado,  I found that the general idea still remains valid, and it seems not anachronistic.

There is actually some news which regards integration in the adoption of OMS and the possibility to use related web services. Click on the figure above to see the presentation. Any comment is welcomed.