Harmonic analysis
Contents 
Purpose
Harmonic analysis capabilities were introduced in SCHISM, version 2.0ha, by Dr. André Fortunato, using the routines of ADCIRC. These routines were developed by R.A. Luettich and J.J. Westerink, who are hereby acknowledged, and were used with written permission by R.A. Luettich. The present document describes the modifications done in SCHISM and provides a user’s guide to these capabilities.
Capabilities
ADCIRC performs 4 types of harmonic analyses:
 Elevations at specified stations
 Depthaveraged velocities at specified stations
 Elevations at all nodes
 Depthaveraged velocities at all nodes
In SCHISM, harmonic analysis at specified stations was not implemented. Option 3 (elevations at all nodes) was fully implemented. The code associated with option 4 was included and commented out. Because the version of SCHISM in which harmonic analysis was originally implemented did not explicitly compute depthaveraged velocities, these values are not available. However, the user can easily uncomment the correspond lines, providing that the necessary variables (UHA and VHA) are computed. This way, the user can easily perform harmonic analysis for any 2D array, defined at the nodes, called UHA or VHA. This feature can be used for instance to perform harmonic analysis for depthaveraged velocities (that will have to be computed), surface velocities, concentrations, etc.
Input files
Performing harmonic analysis requires the changing the following files:
 Makefile: the flag USE_HA must be set to yes
 param.in: the flag iharind must be included and set to 1
 harm.in: the file harm.in must be created with the following format (text adapted from the ADCIRC user’s manual):
where:
 NFREQ = number of frequencies included in harmonic analysis of model results.
for k=1 to NFREQ
 NAMEFR(k) = an alphanumeric descriptor (i.e. the constituent name) whose length must be <= 16 characters
 HAFREQ(k), HAFF(k), HAFACE(k) = frequency (rad/s), nodal factor, equilibrium argument (degrees)
end k loop
 THAS, THAF, NHAINC, FMV = the number of days after which data starts to be harmonically analysed, the number of days after which data ceases to be harmonically analysed, the number of time steps at which information is harmonically analysed (information every NHAINC time steps after THAS is used in harmonic analysis), fraction of the harmonic analysis period (extending back from the end of the harmonic analysis period) to use for comparing the water elevation and velocity means and variances from the raw model time series with corresponding means and variances of a time series resynthesized from the harmonic constituents. This comparison is helpful for identifying numerical instabilities and for determining how complete the harmonic analysis was. Examples: FMV = 0.  do not compute any means and vars. FMV = 0.1  compute means and vars. over final 10% of period used in harmonic analysis. FMV = 1.0  compute means and vars. over entire period used in harmonic analysis.
 NHAGE, NHAGV = flags that indicate whether or not harmonic analysis is performed: NHAGE= 0 no harmonic analysis is performed for global elevations; NHAGE = 1 harmonic analysis is performed for global elevations (output on harme.53); NHAGV = 0 no harmonic analysis is performed for global velocities; NHAGV = 1 harmonic analysis is performed for global velocities (output on harmv.54).
Output files
Results, in the form of amplitudes and phases at every node and for every frequency, are provided in the files harme.53 (for elevations) and harmv.54 (for whatever variable is introduced in UHA and VHA). The file format for harme.53 is the following (text adapted from the ADCIRC user’s manual):

NFREQ – see definition above
for k = 1,NFREQ

HAFREQ(k), HAFF(k), HAFACE(k), NAMEFR(k) – see definitions above
end k loop
NP – number of nodes
for k=1,NP

k
for j=1,NFREQ

EMAGT(k,j), PHASEDE(k,j) = Elevation amplitude and phase (in deg) for constituent j at node k.
end j loop
end k loop
The file format for harmv.54 is similar, but with four variables per line in the last loop (amplitudes and phases for the two analysed variables).
Harmonic analysis output files are written for each processor on the directory outputs. They can be combined using the auxiliary program combine_outHA.f. combine_outHA should be run in the directory above outputs, where the SCHISM run was performed. It assumes the local harme.53xxxx files are located in the directory outputs, together with the local_to_global_xxxx files, and writes a single harme.53 for the global grid in the directory where it is run. The harme.53 file can be transformed into a tct file (which is read by xmvis) using the program ad2tct.f.
List of global variables
Note: input and output variables (described above) are listed in italic:
 ELAV(:) (real)
 ELVA(:) (real)
 FMV(real)
 HAFACE(:) (real)
 HAFF(:) (real)
 HAFREQ(:) (real)
 ICHA (integer)
 IHABEG (integer)
 IHOTSTP (integer)
 IHARIND (integer)
 ITHAF (integer)
 ITHAS (integer)
 ITMV (integer)
 NAMEFR (:)(character)
 NFREQ (integer)
 NHAGE (integer)
 NHAGV (integer)
 NHAINC (integer)
 NTSTEPS (integer)
 THAF (real)
 THAS (real)
 TIMEBEG (real)
 XVELAV (:)(real)
 XVELVA (:)(real)
 YVELAV (:)(real)
 YVELVA (:)(real)