Researchers have been working on flare prediction for many decades. However, the best prediction result achieved by Falconer et al. for major flares, CMEs, and solar proton events (SPEs) is a probability of detection of 39%, meaning that only 39% of the events are correctly predicted. Existing flare prediction algorithms are mainly based on a combination of data, statistical analysis, and pattern recognition algorithms. A serious deficiency of these algorithms is that they do not include the constraints and predictive power of the basic equations of magnetohydrodynamics (MHD) that describe the dynamics of the plasma atmosphere. We propose a new approach to flare prediction based on combining a detailed data based description of the solar atmosphere with the equations of magnetohydrodynamics (MHD). In this approach, a subset of the MHD equations take data as input, and then predict physical quantities that are not measured but may be important for predicting flares. Since the MHD equations must be obeyed by the plasma, when combined with data they also provide new constraints on pattern recognition algorithms that search for correlations between the occurrence of a flare and the values of observed and MHD model predicted quantities that describe the pre-flare plasma.