Program to create a grid of magnetic field values from a set of known axial values

 

This program is called prog04.f90 and is is supplied with the CPO package.

 

A compiled version called prog04.exe is also supplied with the CPO package, and is activated by the command ‘prog04’. Remember to firstly put the input information (as explained below) into the file ‘tempin.dat’ in the same directory. The output data will be put into the file ‘tempout.dat’.

 

Program for using known axial values of a cylindrically symmetric magnetic field to deduce a 2D or 3D grid of off-axis values, in a format suitable for re-use by cpo3d.

 

The CPO3D program allows the magnetic grid data to be read in as a complete or incomplete array of grid points. The option for an incomplete array is useful when there are regions of zero field, since the relevant array points can then be left unspecified. There are differences in the formats required for the 'complete' and 'incomplete' options, due to the way that the relevant lines in CPO3D were written, which cannot be changed now, because compatability with previous versions must be preserved.

 

The '2D' option gives an output in (r,z) space.

The '3D' option gives an output in (x,y,z) space.

 

Beware: This routine works well only if the supplied axial values are smooth enough that they can be differentiated 4 times.

Beware: It also works well only for radial distances r for which (r**4/64.)*ddddb(iz) is much smaller than b(iz), where b(iz) is the axial field and ddddb(iz) is its 4th differential.

 

Input data is in tempin.dat.

The first line of tempin.dat is either '2D' or '3D', to give an output either in (rho,z) space or (x,y,z) space.

The second line is the first 2 letters of either 'complete' or 'incomplete'. The CPO3D program allows the magnetic grid data to be read in as a complete or incomplete array of grid points. The option for an incomplete array is useful when there are regions of zero field, since the relevant array points can then be left unspecified.

The format of the rest of the input data depends on this choice:

For the 'complete' option with 2D output:

The third line of tempin.dat contains nr, nz, where nr is the required number of radial points (including the point on the axis).

The fourth line contains z_min, dl, where dl is the spacing in the r and z directions.

The fifth line contains n_dummy, which is the number of unwanted numbers in the data lines.

The following nz lines contain n_dummy numbers followed by bz, which is the field on the axis.

For the 'complete' option with 3D output:

The third line of tempin.dat contains nx, ry, nz, which are the required numbers of points (including any points on the axis).

The fourth line contains x_min, y_min, z_min, dl, where dl is the spacing in the x, y and z directions.

The fifth line contains n_dummy, which is the number of unwanted numbers in the data lines.

The following nz lines contain n_dummy numbers followed by bz, which is the field on the axis.

For the 'incomplete' option with 2D output:

The third line of tempin.dat contains nr , nz (see above).

The fourth line of tempin.dat contains z_min, dl where dl is the spacing in the r and z directions.

The fifth line contains n_dummy, which is the number of unwanted numbers in the data lines.

The following nz lines contain n_dummy numbers followed by bz, which is the field on the axis.

For the 'incomplete' option with 3D output:

The third line of tempin.dat contains nx , ny , nz (see above).

The fourth line of tempin.dat contains x_min, y_min , z_min, dl where dl is the spacing in the x, y and z directions

The fifth line contains n_dummy, which is the number of unwanted numbers in the data lines.

The following nz lines contain n_dummy numbers followed by bz, which is the field on the axis.

 

The output data is put in file tempout.dat.

The format of the output data depends on the choices:

For the 'complete' option with 2D output:

The first line of tempout.dat contains nr, nz_output. -Note that nz_output < nz because some points are lost in the differentiations.

The second line contains z_min_output, dl -similarly z_min_output > z_min because of differentiations.

The following nr*nz_output lines contain bx, bz.

For the 'complete' option with 3D output:

The first line of tempout.dat contains nx, ny, nz_output.

The second line contains x_min, y_min, z_min_output, dl.

The following nx*ny*nz_output lines contain bx, by, bz (see notes above on loss of points due to differentiations)

For the 'incomplete' option with 2D output:

The first line of tempout.dat contains r_min (=0), r_max.

The second line of tempres.dat contains z_min_output, z_max.

The third line contains n_total, dl, where n_total = nr*nz = (r_max/dl + 1)*((z_max - z_min_output)/dl + 1).

The following n_total lines contain r, z, br, bz (see notes above on loss of points due to differentiations)

(The difference in format for 'complete' and 'incomplete' is due to the way that the relevant lines in CPO3D were written, which cannot be changed now, because compatability with previous versions must be preserved.)

For the 'incomplete' option with 3D output:

The first line of tempres.dat contains x_min, x_max.

The second line of tempres.dat contains y_min, y_max.

The third line of tempres.dat contains z_min_output, z_max.

The fourth line contains n_total, dl, where n_total = nx*ny*nz, nx = ((x_max - x_min)/dl + 1), etc.

The following n_total lines contain x, y, z, bx, by, bz (see notes above on loss of points due to differentiations)

(The difference in format for 'complete' and 'incomplete' is due to the way that the relevant lines in CPO3D were written, which cannot be changed now, because compatability with previous versions must be preserved.)