HypothesisBased on energy balance during two-phase displacement in porous media, it has recently been shown that a thermodynamically consistent contact angle can be determined from micro-tomography images. However, the impact of viscous dissipation on the energy balance has not been fully understood. Furthermore, it is of great importance to determine the spatial distribution of wettability. We use direct numerical simulation to validate the determination of the thermodynamic contact angle both in an entire domain and on a pore-by-pore basis. SimulationsTwo-phase direct numerical simulations are performed on complex 3D porous media with three wettability states: uniformly water-wet, uniformly oil-wet, and non-uniform mixed-wet. Using the simulated fluid configurations, the thermodynamic contact angle is computed, then compared with the input contact angles. FindingsThe impact of viscous dissipation on the energy balance is quantified; it is insignificant for water flooding in water-wet and mixed-wet media, resulting in an accurate estimation of a representative contact angle for the entire domain even if viscous effects are ignored. An increasing trend in the computed thermodynamic contact angle during water injection is shown to be a manifestation of the displacement sequence. Furthermore, the spatial distribution of wettability can be represented by the thermodynamic contact angle computed on a pore-by-pore basis.