Modeling pion production in heavy-ion collisions at intermediate energies