Combustion of hydrogen can take place in different modes such as laminar flames, slow and fast deflagrations and detonations. As these modes have widely varying propagation mechanisms, modeling the transition from one to the other presents a challenging task. This involves implementation of different sub-models and methods for turbulence-chemistry interaction, flame acceleration and shock propagation. In the present work, a unified numerical framework based on OpenFOAM has been evolved to simulate such phenomena with a specific emphasis on the Deflagration to Detonation Transition (DDT) in hydrogen-air mixtures. The approach is primarily based on the transport equation for the reaction progress variable. Different sub-models have been implemented to capture turbulence chemistry interaction and heat release due to autoignition. The choice of sub-models has been decided based on its applicability to lean hydrogen mixtures at high pressures and is relevant in the context of the present study. Simulations have been carried out in a two dimensional rectangular channel based on the GraVent experimental facility. Numerical results obtained from the simulations have been validated with the experimental data. Specific focus has been placed on identifying the flame propagation mechanisms in smooth and obstructed channels with stratified initial distribution. In a smooth channel with stratified distribution, it is observed that the flame surface area increases along the propagation direction, thereby enhancing the energy release rate and is identified to be the key parameter leading to strong flame acceleration. When obstacles are introduced, the increase in burning rate due to turbulence induced by the obstacles is partly negated by the hindrance to the unburned gases feeding the flame. The net effect of these competing factors leads to higher flame acceleration and propagation mechanism is identified to be in the fast deflagration regime. Further analysis shows that several pressure pulses and shock complexes are formed in the obstacle section. The ensuing decoupled shock-flame interaction augments the flame speed until the flame coalesces with a strong shock ahead of it and propagates as a single unit. At this point, a sharp increase in propagation speed is observed thus completing the DDT process. Subsequent propagation takes place at a uniform speed into the unburned mixture.