We model formation and evolution of transverse dune fields. In the model, only the cross section of the dune is simulated. The only physical variable of relevance is the dune height, from which the dune width and velocity are determined, as well as phenomenological rules for interaction between two dunes of different heights. We find that dune fields with no sand on the ground between dunes are unstable, i.e. small dunes leave the higher ones behind. We then introduce a saturation length to simulate transverse dunes on a sand bed and show that this leads to stable dune fields with regular spacing and dune heights. Finally, we show that our model can be used to simulate coastal dune fields if a constant sand influx is considered, where the dune height increases with the distance from the beach, reaching a constant value.