FhSim  3.1.0
Marine systems simulation
Loading...
Searching...
No Matches
environment::Tide Class Reference

#include <Tide.h>

Classes

struct  Constituent
 One constituent of the input. More...
 

Public Member Functions

 Tide (double meanLevel, std::vector< Constituent > constituents, double startTime)
 
double Level (double t) const
 The water level eta [m] at the simulation time t [s], positive up.
 
double Rate (double t) const
 The rate of the water level [m/s] at the simulation time t [s].
 
double MaxLevel () const
 An upper bound of |eta| [m]: |Z0| + sum of f_i H_i.
 
double MeanLevel () const
 
double StartTime () const
 
const std::vector< Constituent > & Constituents () const
 

Static Public Member Functions

static std::vector< Constituent > ReadFile (const std::string &path, double &meanLevel)
 
static double ParseUtc (const std::string &text)
 
static bool Known (const std::string &name)
 True when the name is in the constituent table (case-insensitive).
 
static double SpeedDegPerHour (const std::string &name)
 The angular speed [deg/h] of a constituent in the table (for tests and documentation).
 

Detailed Description

The astronomical tide at one place from its harmonic constituents (Tide.*; plan doc/plans/tide-wakes-gunnerus.md, Phase T1).

eta(t) = Z0 + sum_i f_i H_i cos(V_i(t) + u_i - g_i)

with t the calendar time in UTC (the start time plus the simulation time), H_i and g_i the amplitude and the Greenwich phase lag of constituent i (UTC, degrees), V_i its astronomical argument from its Doodson numbers and f_i, u_i its nodal factor and angle (Schureman's formulas, from the longitude of the Moon's node). The nodal terms are taken at the start time: they change by less than 0.1 % of the amplitude per week.

The constituent table holds the 30 constituents that fit a year of Kartverket's predictions for Trondheim to 1.7 cm (rms, checked in another year): the main semi-diurnal, diurnal, long-period and shallow-water ones. Names as in the IHO list (case-insensitive): M2 S2 N2 K2 K1 O1 P1 Q1 M4 MS4 MN4 Mf Mm Sa Ssa 2N2 MU2 NU2 L2 T2 LAM2 J1 OO1 2Q1 S1 M3 MK3 M6 2MS6 MSf.

Heights are positive up, relative to the scene's z = 0 (NED: the still-water surface is at z = -eta). No Ogre types.

Constructor & Destructor Documentation

◆ Tide()

environment::Tide::Tide ( double  meanLevel,
std::vector< Constituent >  constituents,
double  startTime 
)
Parameters
[in]meanLevelZ0 [m], positive up.
[in]constituentsThe constituents (each name once).
[in]startTimeThe calendar time at simulation time 0, seconds since 1970-01-01T00:00Z (UTC).
Exceptions
std::invalid_argumentfor an unknown or repeated name, or a negative or non-finite value.

Member Function Documentation

◆ ParseUtc()

static double environment::Tide::ParseUtc ( const std::string &  text)
static

Parse an ISO 8601 time in UTC, "YYYY-MM-DDThh:mm[:ss[.fff]]" with an optional "Z" or "+00:00".

Returns
Seconds since 1970-01-01T00:00Z.
Exceptions
std::invalid_argumentfor anything else (other time zones included).

◆ ReadFile()

static std::vector< Constituent > environment::Tide::ReadFile ( const std::string &  path,
double &  meanLevel 
)
static

Read the constituents from a JSON file (fhsim_environment.tide/1):

{ "format": "fhsim_environment.tide/1", "mean_level": 0.0, "phase_reference": "UTC",
"constituents": [ {"name": "M2", "amplitude": 0.927, "phase": 306.6}, ... ] }
Parameters
[in]pathThe file.
[out]meanLevelThe file's mean level [m].
Returns
The constituents.
Exceptions
std::runtime_errorwith the reason.

The documentation for this class was generated from the following file: