Non-Equilibrium Thermodynamics In Porous Media : Battery Degradation, And Sorption And Transport In Porous Materials