calculates fluxes as needed