This package contains the FORTRAN files for the global minimisation method and the hybrid method described in Crouch (2015, Solar Physics).

COMPILING

This code has been developed using the Intel FORTRAN compiler, ifort. It is written in standard FORTRAN f77 and it should compile using other compilers but this has not been tested. To compile the code type on the command line:

make ambig.x86_64.ifort

RUNNING THE CODE

Type on the command line:

./ambig.x86_64.ifort

OTHER INPUT PARAMETERS

The subroutine read_inputs reads the file me.in which contains several input parameters. By default the file me.in lives in the same directory where code is run. The input parameters are:

c iseed an integer controlling the seed for the random number generator, also used to label the output files (see output.f)
c
c lambda2 the weighting factor for the additional constraint based on the smoothness of the magnetic field
c
c Btmin the threshold for the magnitude of the transverse component of the field below which pixels are revisited by the smoothing
c       algorithm (see post1.f)
c
c iverb an integer controlling the degree of verbosity of printed output
c
c tfac0 scales the initial temperature used by the simulated annealing algorithm (see minimise_energy.f)
c
c tfactr is the cooling rate used by the simulated annealing algorithm (see minimise_energy.f)
c
c neq controls the number of reconfigurations that are attempted at each temperature setting used by the simulated annealing
c     algorithm (see minimise_energy.f)
c
c nxa,nya,nxb,nyb control the boundaries of the regions to be disambiguated. If the inputs are zero or negative then the field of
c                 view values are used.
c                 nxa (nya) is the x (y) index of the bottom left pixel. nxb (nyb) is the x (y) index of the top right pixel.
c                 The region to be disambiguated is rectangular unless the value of mask is not one (see setup_mask.f), which is not
c                 implemented here.

INPUT/OUTPUT

By default the input files containing the magnetic field information need to be in the directory temp/mgram2. To change this see include_file.two_heights_files.f. The input files are:

mgram.dat which contains pixel size information, position information and the size of the field of view. The parameters are:

dxi the pixel size in the image x direction

nx the size of the field of view in the image x direction

dyi the pixel size in the image y direction (in the same units as dxi)

ny the size of the field of view in the image y direction

theta is the central meridian angle of the center of the field of view

phi is the latitude of the center of the field of view

dz the separation between the two heights in the line-of-sight direction (in the same units as dxi and dyi)

b is the solar b-angle

p is the solar p-angle 

For the first observation height, the magnetic field files are Bx_in.dat, By_in.dat, and Bz_in.dat, which respectively contain the components of the magnetic field in the x, y, and z image directions (where the z image direction is the line-of-sight direction). For the second height, the files are Bx_in_h1.dat, By_in_h1.dat, and Bz_in_h1.dat. For the expected format of these files see setup_gen2.f.

This package is shipped with a simple example contained in temp/mgram2. For a sensible choice of input parameters the code should retrieve the correct azimuthal angle in all pixels (the correct configuration of azimuthal angles corresponds to the field provided in temp/mgram2).

The output to file of the final disambiguated solution at each height is controlled by the subroutine in output.f. The x-image and y-image components of the field at the lower height, in the arrays Bx and By, are output. For details of formatting and the file name convention see output.f.

If you have any questions please contact me at ash@cora.nwra.com
