Code for flight code

The first version code can be found in /home/marc/f90/flightCode, while the second version can be found in /home/marc/f90/flightCode_v2. Details on the modules and routines are given below.

Modules for version 1

The modules contain the parameters and variables which are needed by several routines

  • coreParamsMod: contains the core parameters: such as value of pi; rad2deg, which converts radians to degrees; precTol, which is the precision the code can be be expected to work to; and posTol, which is the acceptable tolerance for accepting that route has reached destination. It also sets iRouteOutput, which determine if routes are written to ASCII file (largely for debugging).
  • inputMod: contains all the variables which are read from namelist.
  • windMod: contains the variables read from wind file, so latitude, longitude, u and v components of wind and their dimensions.

Routines for version 1

The routines are

  • mainProg: the main program. It reads the input. Fans the angles around the great circle route looking for possibile solutions at at a fairly low resolution. If it finds a possible solution, calls findNearestSoln at a higher resolution to find a solution. Picks the best solution and writes the route to file. It calls
    • readInput: reads the namelist data.
    • angleAtoB: determines the distance between two points. The unit is given as an angle of the Earth
    • readWindVector: reads in the latitude, longitude and wind vectors. It calls
      • getDimLengths: gets the dimension lengths from netCDF file
      • getVariables: gets the variables from netCDF file. It calls
        • getDimLengths: see above. It's only called if v component of wind is contained in a separate file and is used to check that dimensions of u and v appear to be the same.
    • calcBearing: determines the bearing from one point to another
    • findNearestSoln: given an initial track angle, find the nearest initial track angle which produces a path that reaches the destination. It calls
      • oneRoute: given an origin and initial track angle, determines the path of least time. It keeps going until the distance between the origin and destination is reached (this maybe be no where near destination). It calls
        • lat2merc (function): converts latitude to Mercator y.
        • calcRadius: uses the change in track angle equation to determine the radius of curvature. Also calculates the ground speed. It calls
          • av2point: determines u, v, du/dx, du/dy, dv/dx and dv/dy at current location. It calls
            • lat2merc (function), see above.
        • merc2lat (function): converts Mercator y to latitude.
        • angleAtoB, see above.
      • writeRoute: writes a path to ASCII file.
      • angleAtoB, see above.
      • whenDiverge: when two routes are so close that it becomes almost impossible for precision to separate routes, determines when these routes are sufficiently far apart.
      • calcBearing, see above.
      • findNearestSoln, see above. Calls its self if two routes become to close to separate. It is applied from when the routes diverge sufficiently that it's easy to tell them apart.
    • writeRoute, see above.
    • oneRoute, see above.
    • writeRouteNetcdf: writes solution to netCDF file.

Modules for version 2

The modules for version 2 are the same the modules for version 1 except there is the addition of

  • rotateMod: contains values derived directly from α and β

Routines for version 2

The routines for version 2 are largely the same at the routines for version 1, so this shows the same list as before but with additional routines highlighted in bold:

  • mainProg: the main program. It reads the input. Fans the angles around the great circle route looking for possibile solutions at at a fairly low resolution. If it finds a possible solution, calls findNearestSoln at a higher resolution to find a solution. Picks the best solution and writes the route to file. It calls
    • readInput: reads the namelist data.
    • angleAtoB: determines the distance between two points. The unit is given as an angle of the Earth
    • calcRotateAngles: calculates the angles α and β.
    • norm2rotateCoord: convert standard latitude and longitude, φ and λ, to rotated coordinates, φ' and λ'.
    • readWindVector: reads in the latitude, longitude and wind vectors. It calls
      • getDimLengths: gets the dimension lengths from netCDF file
      • getVariables: gets the variables from netCDF file. It calls
        • getDimLengths: see above. It's only called if v component of wind is contained in a separate file and is used to check that dimensions of u and v appear to be the same.
      • addPoleVel: adds an extra level of u and v either side of south and north pole.
      • calcVorticity: calculates the real vortiticy at every grid point.
    • calcTilt (function): calculates the tilt angle - the angle between the normal lat-lon axis and our rotated lat-lon axis
    • calcBearing: determines the bearing from one point to another
    • findNearestSoln: given an initial track angle, find the nearest initial track angle which produces a path that reaches the destination. It calls
      • oneRoute: given an origin and initial track angle, determines the path of least time. It keeps going until the distance between the origin and destination is reached (this maybe be no where near destination). It calls
        • calcTilt (function), see above.
        • lat2merc (function): converts latitude to Mercator y.
        • calcRadius: uses the change in track angle equation to determine the radius of curvature. Also calculates the ground speed. It calls
          • av2point: determines u, v, du/dx, du/dy, dv/dx and dv/dy at current location. It calls
            • lat2merc (function), see above.
        • merc2lat (function): converts Mercator y to latitude.
        • angleAtoB, see above.
        • rotate2normCoord: convert rotated latitude and longitude, φ' and λ', to the standard latitude and longitude, φ and λ.
      • writeRoute: writes a path to ASCII file.
      • angleAtoB, see above.
      • whenDiverge: when two routes are so close that it becomes almost impossible for precision to separate routes, determines when these routes are sufficiently far apart. It calls
        • rotate2normCoord, see above.
      • calcBearing, see above.
      • findNearestSoln, see above. Calls its self if two routes become to close to separate. It is applied from when the routes diverge sufficiently that it's easy to tell them apart.
    • writeRoute, see above.
    • oneRoute, see above.
    • writeRouteNetcdf: writes solution to netCDF file.

Things to do now

Contact

Page navigation