Adaptive control of modeling error for multiscale simulations