Model calculations are presented for the nucleus of comet P/Wirtanen, the main target of the upcoming Rosetta mission. A porous, spherical nucleus, made of ice and dust in equal mass fractions is considered, assuming a few percent of CO and CO2 occluded in the amorphous ice. The main effects included in the code are: crystallization of amorphous ice and release of occluded: gases, condensation, sublimation and (Knudsen) flow of gases through the pores, changing pore sizes, flow of dust grains of different radii. Evolution is followed through several orbits, for different initial parameter combinations. It is found that a stratified structure develops for the outer layer of the nucleus: a highly porous dust mantle, a denser layer of crystalline ice and dust below it, followed by layers of amorphous ice and dust including frozen CO2, and deeper down, frozen CO. The production rate of H2O varies strongly with heliocentric distance; at perihelion the calculated rate is very close to that inferred from observations. The CO production rate is maintained nearly constant throughout the orbit and that of CO2 varies moderately. Outbursts are obtained for some models at large heliocentric distances.