Determination of lightning origins in a thunderstorm model