Thermodynamic formulation of the constitutive equations for solids and fluids