Nanochannels and nanoporous membranes in reverse electrodialysis for harvesting osmotic energy