We consider the process of optical harmonic generation in systems with arbitrary gas density variation along the optical beam and specifically consider the case of frequency tripling in a free-jet expansion. Generalized relationships are presented for harmonic conversion efficiency as a function of the shape of the density profile and of the focusing conditions. For the case of frequency tripling, we have examined these effects numerically and find that the maximum attainable third-harmonic power is relatively insensitive to the form of this profile for negatively dispersing gases, but is quite sensitive to the profile in the case of positive dispersion. We also find that for a given confocal parameter

the maximum attainable conversion efficiency is surprisingly insensitive to the effective cell length

and depends on

and

only through the factor

where β is a relatively weak function of the ratio

, ranging from 1 to 4 for the case of negative dispersion and from 0 to 1 for the case of positive dispersion. The specific case of frequency tripling in a free-jet expansion is modeled, and stategies for power optimization are discussed.