A thermodynamic approach for assessing agroecosystem sustainability