  Free Electron Lasers driven by Super-Conducting Linacs require the
generation, acceleration and transport of trains of bunches with high charge,
high repetition rate and low emittance. A numerical model already developed for
the modeling of beam dynamics in SC Linacs has been now extended to treat RF
guns with proper description of the photocathode bunch generation. The model
algorithm is based on a coupled integration of Newton and Maxwell equations
under a slowly varying envelope approximation for the time evolution of mode
amplitudes in the accelerating structure and an envelope equation description
for a set of bunch slices. In this way beam loading effects and higher order
modes excitation can be studied. The application to the TTF-FEL injector as a
particular design is presented and the optimization according to the invariant
envelope concept is discussed, in the frame of single bunch calculations
compared to the results of other multi-particle codes.
