Characterization of ion transfer and modeling of fouling in nanofiltration and reverse osmosis membranes