Negative-ion-source modeling: From expansion to extraction region