Modelling matter and energy flows in the biosphere and human economy