Second law analysis of combined heat and mass transfer in internal and external flows