The equation for the magnetic field inside a solenoid is:
Bz = mu0 x N x I
where mu0 is the magnetic permeability of free space, N is the number of wire turns per unit length and I is the electrical current in the wire. This equation assumes that the solenoid is infinite in length.
The program TB-FIELD.EXE has been used to calculate the magnetic field inside a 100 mm long solenoid with radius of 5 mm. To do this, the tubes in TB-FIELD.EXE were given the properties of free space (electrical conductivity = 0 and the relative magnetic permeability = 1). The number of wire turns in this solenoid is 1000 and the number of turns per metre is 10000.
The coil input properties in TB-FIELD.EXE are shown below:
TB-FIELD was used to calculate the axial magnetic field component Bz at various radial positions within the solenoid. In the region of the solenoid that is away for the end, the magnetic field appears to be close enough to being uniform for practical purposes and it appears to match the theoretical value of magnetic field from the equation above in the region away from the ends of the solenoid (at 50 mm from the centre). Results of the calculation are shown in the chart below:
The magnetic field appears to significantly deviate from the theoretical value (assumes infinitely long solenoid) near the end of the solenoid (50 mm from the centre.