The upper atmosphere and ionosphere of Titan: A coupled model