MOM_harmonic_analysis module reference

Inline harmonic analysis (conventional)

Data Types

HA_type

The private control structure for storing the HA info of a particular field

HA_node

A linked list of control structures that store the HA info of different fields

harmonic_analysis_CS

The public control structure of the MOM_harmonic_analysis module

Functions/Subroutines

HA_init

This subroutine sets static variables used by this module and initializes CS%list. THIS MUST BE CALLED AT THE END OF tidal_forcing_init.

HA_register

This subroutine registers each of the fields on which HA is to be performed.

HA_accum

This subroutine accumulates the temporal basis functions in FtF and FtSSH and then calls HA_write to compute harmonic constants and write results. The tidal constituents are those used in MOM_tidal_forcing, plus the mean (of zero frequency). For FtF, only the main diagonal and entries below it are calculated, which are needed for Cholesky decomposition.

HA_write

This subroutine computes the harmonic constants and write output for the current field

HA_solver

This subroutine computes the harmonic constants (stored in x) using the dot products of the temporal basis functions accumulated in FtF, and the dot products of the SSH (or other fields) with the temporal basis functions accumulated in FtSSH. The system is solved by Cholesky decomposition,

Detailed Description

Major revision (August, 2025)

This module is now independent of MOM_tidal_forcing, providing more flexibility for performing harmonic analyses on tidal constituents not available in MOM_tidal_forcing (e.g., MK3, M4), with the following conditions:

  1. For tidal constituents not available in MOM_tidal_forcing, the frequencies and equilibrium phases (if used) must be specified manually in MOM_input.

  2. If any tidal constituents not available in MOM_tidal_forcing are used, the nodal modulation cannot be added. Or, if nodal modulation is added, then harmonic analysis can only be performed on major tidal constituents.

Original version (April, 2024)

This module computes the harmonic constants which can be used to reconstruct the tidal elevation (or other fields) through SSH = F * x, where F is an nt-by-2*nc matrix (nt is the number of time steps and nc is the number of tidal constituents) containing the cosine/sine functions for each frequency evaluated at each time step, and x is a 2*nc-by-1 vector containing the constant coefficients of the sine/cosine for each constituent (i.e., the harmonic constants). At each grid point, the harmonic constants are computed using least squares,

(F' * F) * x = F' * SSH_in, => FtF * x = FtSSH,

where the prime denotes matrix transpose, and SSH_in is the sea surface height (or other fields) determined by the model. The dot products (F' * F) and (F' * SSH_in) are computed by accumulating the sums as the model is running and stored in the arrays FtF and FtSSH, respectively. The FtF matrix is inverted as needed before computing and writing out the harmonic constants.

Ed Zaron and William Xu (chengzhu.xu@oregonstate.edu)

Type Documentation

type, private :: HA_type

The private control structure for storing the HA info of a particular field

Parameters
  • key

    Name of the field of which harmonic analysis is to be performed

  • grid

    The grid on which the field is defined ('h', 'q', 'u', or 'v')

  • old_time

    The time of the previous accumulating step [T ~> s]

  • ref

    The initial field in arbitrary units [A]

  • FtF

    Accumulator of (F' * F) [nondim]

  • is

    Lower and upper bounds of input data

  • ie

    Lower and upper bounds of input data

  • js

    Lower and upper bounds of input data

  • je

    Lower and upper bounds of input data

type, private :: HA_node

A linked list of control structures that store the HA info of different fields

Parameters
  • this

    Control structure of the current field in the list

  • next

    The list of other fields

type, public :: harmonic_analysis_CS

The public control structure of the MOM_harmonic_analysis module

Parameters
  • HAready

    If true, perform harmonic analysis

  • time_start

    Start time of harmonic analysis

  • time_end

    End time of harmonic analysis

  • time_ref

    Reference time (t = 0) used to calculate tidal forcing

  • freq

    The frequency of a tidal constituent [T-1 ~> s-1]

  • phase0

    The phase of a tidal constituent at time 0 [rad]

  • tide_fn

    Amplitude modulation of tides by nodal cycle [nondim].

  • tide_un

    Phase modulation of tides by nodal cycle [rad].

  • nc

    The number of tidal constituents in use

  • length

    Number of fields of which harmonic analysis is to be performed

  • const_name

    The name of each constituent

  • path

    Path to directory where output will be written

  • US

    A dimensional unit scaling type

  • list

    A linked list for storing the HA info of different fields

Functions/Subroutine Documentation

subroutine HA_init(Time, US, param_file, nc, CS)

This subroutine sets static variables used by this module and initializes CS%list. THIS MUST BE CALLED AT THE END OF tidal_forcing_init.

Parameters
  • Time [in]

    The current model time

  • US [in]

    A dimensional unit scaling type

  • param_file [in]

    A structure to parse for run-time parameters

  • nc [in]

    The number of tidal constituents in use

  • CS [out]

    Control structure of the MOM_harmonic_analysis module

  • tides

    True if tidal forcing module is enabled

  • use_eq_phase

    If true, tidal forcing is phase-shifted to match equilibrium tide. Set to false if providing tidal phases that have already been shifted by the astronomical/equilibrium argument

  • add_nodal_terms

    If true, insert terms for the 18.6 year modulation when calculating tidal forcing.

  • tide_ref_date

    Reference date (t = 0) for tidal forcing (year, month, day)

  • nodal_ref_date

    Date to calculate nodal modulation for (year, month, day)

  • nodal_time

    Model time to calculate nodal modulation for.

  • tidal_longitudes

    Astronomical longitudes used to calculate tidal phases at t = 0.

  • nodal_longitudes

    Solar and lunar longitudes for tidal forcing

  • const_name

    Names of all tidal constituents to be harmonically analyzed

  • ha1

    A temporary, null field used for initializing CS%list

  • HA_start_time

    Start time of harmonic analysis [T ~> s]

  • HA_end_time

    End time of harmonic analysis [T ~> s]

  • mdl

    This module's name

Callees call graph
Callees of mom_harmonic_analysis::ha_init calls cluster_mom_error_handler MOM_error_handler cluster_mom_file_parser MOM_file_parser cluster_mom_harmonic_analysis MOM_harmonic_analysis cluster_mom_tidal_forcing MOM_tidal_forcing cluster_mom_time_manager MOM_time_manager mom_error_handler::mom_error MOM_error mom_error_handler::mom_mesg MOM_mesg mom_file_parser::interface::get_param get_param (interface) mom_harmonic_analysis::ha_init HA_init mom_harmonic_analysis::ha_init->mom_error_handler::mom_error mom_harmonic_analysis::ha_init->mom_error_handler::mom_mesg mom_harmonic_analysis::ha_init->mom_file_parser::interface::get_param mom_harmonic_analysis::ha_register HA_register [private/internal] mom_harmonic_analysis::ha_init->mom_harmonic_analysis::ha_register mom_tidal_forcing::astro_longitudes_init astro_longitudes_init mom_harmonic_analysis::ha_init->mom_tidal_forcing::astro_longitudes_init mom_tidal_forcing::eq_phase eq_phase mom_harmonic_analysis::ha_init->mom_tidal_forcing::eq_phase mom_tidal_forcing::nodal_fu nodal_fu mom_harmonic_analysis::ha_init->mom_tidal_forcing::nodal_fu mom_tidal_forcing::tidal_frequency tidal_frequency mom_harmonic_analysis::ha_init->mom_tidal_forcing::tidal_frequency mom_time_manager::real_to_time real_to_time mom_harmonic_analysis::ha_init->mom_time_manager::real_to_time
Text view
Callers call graph
Callers of mom_harmonic_analysis::ha_init calls cluster_mom_dynamics_split_rk2 MOM_dynamics_split_RK2 cluster_mom_dynamics_split_rk2b MOM_dynamics_split_RK2b cluster_mom_harmonic_analysis MOM_harmonic_analysis mom_dynamics_split_rk2::initialize_dyn_split_rk2 initialize_dyn_split_RK2 mom_harmonic_analysis::ha_init HA_init mom_dynamics_split_rk2::initialize_dyn_split_rk2->mom_harmonic_analysis::ha_init mom_dynamics_split_rk2b::initialize_dyn_split_rk2b initialize_dyn_split_RK2b mom_dynamics_split_rk2b::initialize_dyn_split_rk2b->mom_harmonic_analysis::ha_init
Text view

External calls

time_manager_mod
  • get_date (time_manager_mod::get_date)

  • set_date (time_manager_mod::set_date)

subroutine HA_register(key, grid, CS)

This subroutine registers each of the fields on which HA is to be performed.

Parameters
  • key [in]

    Name of the current field

  • grid [in]

    The grid on which the key field is defined

  • CS [inout]

    Control structure of the MOM_harmonic_analysis module

  • ha1

    Control structure for the current field

  • tmp

    A temporary list to hold the current field

Callers call graph
Callers of mom_harmonic_analysis::ha_register calls cluster_mom_harmonic_analysis MOM_harmonic_analysis mom_harmonic_analysis::ha_init HA_init mom_harmonic_analysis::ha_register HA_register [private/internal] mom_harmonic_analysis::ha_init->mom_harmonic_analysis::ha_register
Text view
subroutine HA_accum(key, data, Time, G, CS)

This subroutine accumulates the temporal basis functions in FtF and FtSSH and then calls HA_write to compute harmonic constants and write results. The tidal constituents are those used in MOM_tidal_forcing, plus the mean (of zero frequency). For FtF, only the main diagonal and entries below it are calculated, which are needed for Cholesky decomposition.

Parameters
  • key [in]

    Name of the current field

  • data [in]

    Input data of which harmonic analysis is to be performed [A]

  • Time [in]

    The current model time

  • G [in]

    The ocean's grid structure

  • CS [inout]

    Control structure of the MOM_harmonic_analysis module

  • now

    The relative time compared with the tidal reference [T ~> s]

  • dt

    The current time step size of the accumulator [T ~> s]

  • cosomegat

    The components of the phase [nondim]

  • sinomegat

    The components of the phase [nondim]

  • ccosomegat

    The components of the phase [nondim]

  • ssinomegat

    The components of the phase [nondim]

Callees call graph
Callees of mom_harmonic_analysis::ha_accum calls cluster_mom_error_handler MOM_error_handler cluster_mom_harmonic_analysis MOM_harmonic_analysis cluster_mom_time_manager MOM_time_manager mom_error_handler::mom_error MOM_error mom_harmonic_analysis::ha_accum HA_accum mom_harmonic_analysis::ha_accum->mom_error_handler::mom_error mom_harmonic_analysis::ha_write HA_write [private/internal] mom_harmonic_analysis::ha_accum->mom_harmonic_analysis::ha_write mom_time_manager::time_minus_signed time_minus_signed mom_harmonic_analysis::ha_accum->mom_time_manager::time_minus_signed mom_time_manager::time_to_real time_to_real mom_harmonic_analysis::ha_accum->mom_time_manager::time_to_real
Text view
Callers call graph
Callers of mom_harmonic_analysis::ha_accum calls cluster_mom MOM cluster_mom_barotropic MOM_barotropic cluster_mom_harmonic_analysis MOM_harmonic_analysis mom::step_mom step_MOM mom_harmonic_analysis::ha_accum HA_accum mom::step_mom->mom_harmonic_analysis::ha_accum mom_barotropic::btstep btstep mom_barotropic::btstep->mom_harmonic_analysis::ha_accum
Text view
subroutine HA_write(ha1, Time, G, CS)

This subroutine computes the harmonic constants and write output for the current field

Parameters
  • ha1 [in]

    Control structure for the current field

  • Time [in]

    The current model time

  • G [in]

    The ocean's grid structure

  • CS [in]

    Control structure of the MOM_harmonic_analysis module

  • FtSSHw

    An array containing the harmonic constants [A]

  • filename

    Output file name

  • cdf

    The file handle for output harmonic constants

  • cdf_vars

    Output variable names

  • cdf_fields

    Field type variables for the output fields

Callees call graph
Callees of mom_harmonic_analysis::ha_write calls cluster_mom_harmonic_analysis MOM_harmonic_analysis cluster_mom_io MOM_io mom_harmonic_analysis::ha_solver HA_solver [private/internal] mom_harmonic_analysis::ha_write HA_write [private/internal] mom_harmonic_analysis::ha_write->mom_harmonic_analysis::ha_solver mom_io::create_mom_file create_MOM_file mom_harmonic_analysis::ha_write->mom_io::create_mom_file mom_io::interface::mom_write_field MOM_write_field (interface) mom_harmonic_analysis::ha_write->mom_io::interface::mom_write_field mom_io::var_desc var_desc mom_harmonic_analysis::ha_write->mom_io::var_desc
Text view
Callers call graph
Callers of mom_harmonic_analysis::ha_write calls cluster_mom_harmonic_analysis MOM_harmonic_analysis mom_harmonic_analysis::ha_accum HA_accum mom_harmonic_analysis::ha_write HA_write [private/internal] mom_harmonic_analysis::ha_accum->mom_harmonic_analysis::ha_write
Text view

External calls

time_manager_mod
  • get_date (time_manager_mod::get_date)

subroutine HA_solver(ha1, nc, FtF, x)

This subroutine computes the harmonic constants (stored in x) using the dot products of the temporal basis functions accumulated in FtF, and the dot products of the SSH (or other fields) with the temporal basis functions accumulated in FtSSH. The system is solved by Cholesky decomposition,

FtF * x = FtSSH, => L * (L' * x) = FtSSH, => L * y = FtSSH,

where L is the lower triangular matrix, y = L' * x, and x is the solution vector.

Parameters
  • ha1 [in]

    Control structure for the current field

  • nc [in]

    Number of harmonic constituents

  • FtF [in]

    Accumulator of (F' * F) for all fields [nondim]

  • x [out]

    Solution vector of harmonic constants [A]

  • tmp0

    Temporary variable for Cholesky decomposition [nondim]

  • L

    Lower triangular matrix of Cholesky decomposition [nondim]

  • tmp1

    Inverse of the diagonal entries of L [nondim]

  • tmp2

    2D temporary array involving FtSSH [A]

  • y

    3D temporary array, i.e., L' * x [A]

Callers call graph
Callers of mom_harmonic_analysis::ha_solver calls cluster_mom_harmonic_analysis MOM_harmonic_analysis mom_harmonic_analysis::ha_solver HA_solver [private/internal] mom_harmonic_analysis::ha_write HA_write [private/internal] mom_harmonic_analysis::ha_write->mom_harmonic_analysis::ha_solver
Text view
API generated with Flint · Rendered from reStructuredText