On a Physics specification, it says:
6.7 Know how to use two permanent magnets to produce a uniform magnetic field pattern.
Isn't it "produce an uniform magnetic field", or is the existing "produce a uniform magnetic field pattern" correct?
The word uniform begins with a palatal approximant /j/. The palatal approximant is a consonantal sound, even though the letter itself is a vowel. Since we use the pronunciation of the word following the article to determine whether we use "a" or "an", and because it is pronounced starting with a consonant, we use "a". Thus, the original sentence is correct.
Just for the sake of completeness, the letter "u" can also have a vowel sound, such as in the word "umbrella", which begins with an open-mid back unrounded vowel /ʌ/.
The rule of placing an before a vowel is actually to place an before a vowel sound. Therefore, because uniform is pronounced with a "y" sound (/ˈjuːnɪfɔːm/), which is not a vowel sound, it takes an a before it.
I would use "a uniform", because uniform, although it is spelled with an initial vowel, is pronounced as beginning with a "y" sound. Compare, on the other side of the coin, "an honor" where, although h is a consonant, the word is pronounced as though starting with a vowel (at least, in my part of the world...)
Whether you use a or an is entirely decided by the sound of the following word, and doesn't necessarily have anything to do with the spelling of the following word. Words like uniform or user are pronounced with an initial "y" sound (a palatal glide), and so it's correct to say a uniform, a user. Saying an uniform, an user is incorrect.