In Situ Framework for Coupling Simulation and Machine Learning with Application to CFD