Modeling of energy buildup for a flare-productive region