Discretizing the direct problem