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 fluid 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 b the maximum attainable conversion efficiency is surprisingly insensitive to the effective cell length L and depends on b and L only through the factor 16β/b2 where is a relatively weak function of the ratio b/L, 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. Copyright © 1987 by The Institute of Electrical and Electronics Engineers, Inc.