Mechanistic model for nitrous oxide emission via nitrification and denitrification