An example of analogy in popular science writing:
"…the giant stellar clouds that we call galaxies. In fact, we can consider such a clustering of the billions of stars as a flock of gas in which the rôle of molecules is now played by individual stars."
George Gamow (1961) One, Two, Three…Infinity. Facts and speculations of science, Revised Edition, Dover Publications, Inc., New York.
(Scientists do sometimes treat galaxies of stars as if collections of gas molecules for some purposes!)
Read examples of scientific analogies
Many examples of science analogies are listed in 'Creative comparisons: Making science familiar through language. An illustrative catalogue of figurative comparisons and analogies for science concepts'. Free Download.
I have not some across the use of 'flock' in this context before, although if it was a metaphor (cf. flock of sheep) one would expect it to be a flock of molecules (discrete entities) not of a flock of gas (macroscopically a continuous material.
Read about metaphor in science
Read about examples of science metaphors
Many examples of science metaphors are listed in 'Creative comparisons: Making science familiar through language. An illustrative catalogue of figurative comparisons and analogies for science concepts'. Free Download.