  Here, we test the weighted horizontal magnetic gradient ($WG_M$) as a flare
precursor, introduced by Korsos et. al. (2015, ApJ, 802, L21), by applying it
to a magneto-hydrodynamic (MHD) simulation of solar-like flares Chatterjee et.
al. (2016, Physical Review Letters, 116, 10, 101101). The pre-flare evolution
of the $WG_M$ and the behavior of the distance parameter between the
area-weighted barycenters of opposite polarity sunspots at various heights is
investigated in the simulated $\delta$-type sunspot. Four flares emanated from
this sunspot. We found the optimum heights above the photosphere where the
flare precursors of the $WG_M$ method are identifiable prior to each flare.
These optimum heights agree reasonably well with the heights of the occurrence
of flares identified from the analysis of their thermal and Ohmic heating
signatures in the simulation. We also estimated the expected time of the flare
onsets from the duration of the approaching-receding motion of the barycenters
of opposite polarities before each single flare. The estimated onset time and
the actual time of occurrence of each flare are in good agreement at the
corresponding optimum heights. This numerical experiment further supports the
use of flare precursors based on the $WG_M$ method.
