Variational principle for transport phenomena