<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing with OASIS Tables v3.0 20080202//EN" "https://jats.nlm.nih.gov/nlm-dtd/publishing/3.0/journalpub-oasis3.dtd">
<article xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:oasis="http://docs.oasis-open.org/ns/oasis-exchange/table" xml:lang="en" dtd-version="3.0" article-type="research-article"><?xmltex \bartext{Model description paper}?>
  <front>
    <journal-meta><journal-id journal-id-type="publisher">GMD</journal-id><journal-title-group>
    <journal-title>Geoscientific Model Development</journal-title>
    <abbrev-journal-title abbrev-type="publisher">GMD</abbrev-journal-title><abbrev-journal-title abbrev-type="nlm-ta">Geosci. Model Dev.</abbrev-journal-title>
  </journal-title-group><issn pub-type="epub">1991-9603</issn><publisher>
    <publisher-name>Copernicus Publications</publisher-name>
    <publisher-loc>Göttingen, Germany</publisher-loc>
  </publisher></journal-meta>
    <article-meta>
      <article-id pub-id-type="doi">10.5194/gmd-16-6515-2023</article-id><title-group><article-title>Ocean wave tracing v.1: a numerical solver of the wave ray equations for ocean waves on variable currents at arbitrary depths</article-title><alt-title>Ocean wave ray tracing</alt-title>
      </title-group><?xmltex \runningtitle{Ocean wave ray tracing}?><?xmltex \runningauthor{T. Halsne et al.}?>
      <contrib-group>
        <contrib contrib-type="author" corresp="yes" rid="aff1 aff2">
          <name><surname>Halsne</surname><given-names>Trygve</given-names></name>
          <email>trygve.halsne@met.no</email>
        <ext-link>https://orcid.org/0000-0001-6675-2000</ext-link></contrib>
        <contrib contrib-type="author" corresp="no" rid="aff1 aff3">
          <name><surname>Christensen</surname><given-names>Kai Håkon</given-names></name>
          
        </contrib>
        <contrib contrib-type="author" corresp="no" rid="aff1">
          <name><surname>Hope</surname><given-names>Gaute</given-names></name>
          
        </contrib>
        <contrib contrib-type="author" corresp="no" rid="aff1 aff2">
          <name><surname>Breivik</surname><given-names>Øyvind</given-names></name>
          
        </contrib>
        <aff id="aff1"><label>1</label><institution>Oceanography and Marine Meteorology, Norwegian Meteorological Institute, Oslo, Norway</institution>
        </aff>
        <aff id="aff2"><label>2</label><institution>Geophysical Institute, University of Bergen, Bergen, Norway</institution>
        </aff>
        <aff id="aff3"><label>3</label><institution>Department of Geosciences –  Section for Meteorology and Oceanography, University of Oslo, Oslo, Norway</institution>
        </aff>
      </contrib-group>
      <author-notes><corresp id="corr1">Trygve Halsne (trygve.halsne@met.no)</corresp></author-notes><pub-date><day>14</day><month>November</month><year>2023</year></pub-date>
      
      <volume>16</volume>
      <issue>22</issue>
      <fpage>6515</fpage><lpage>6530</lpage>
      <history>
        <date date-type="received"><day>3</day><month>February</month><year>2023</year></date>
           <date date-type="rev-request"><day>23</day><month>March</month><year>2023</year></date>
           <date date-type="rev-recd"><day>17</day><month>August</month><year>2023</year></date>
           <date date-type="accepted"><day>2</day><month>October</month><year>2023</year></date>
      </history>
      <permissions>
        <copyright-statement>Copyright: © 2023 </copyright-statement>
        <copyright-year>2023</copyright-year>
      <license license-type="open-access"><license-p>This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this licence, visit <ext-link ext-link-type="uri" xlink:href="https://creativecommons.org/licenses/by/4.0/">https://creativecommons.org/licenses/by/4.0/</ext-link></license-p></license></permissions><self-uri xlink:href="https://gmd.copernicus.org/articles/.html">This article is available from https://gmd.copernicus.org/articles/.html</self-uri><self-uri xlink:href="https://gmd.copernicus.org/articles/.pdf">The full text article is available as a PDF file from https://gmd.copernicus.org/articles/.pdf</self-uri>
      <abstract><title>Abstract</title>

      <p id="d1e122">Lateral changes in the group velocity of waves propagating in oceanic or coastal waters cause a deflection in their propagation path. Such refractive effects can be computed given knowledge of the ambient current field and/or the bathymetry. We present an open-source module for solving the wave ray equations by means of numerical integration in Python v3. The solver is implemented for waves on variable currents and arbitrary depths following the Wentzel–Kramers–Brillouin (WKB) approximation. The ray tracing module is implemented in a class structure, and the output is verified against analytical solutions and tested for numerical convergence. The solver is accompanied by a set of ancillary functions such as retrieval of ambient conditions using OPeNDAP, transformation of geographical coordinates, and structuring of data using community standards. A number of use examples are also provided.</p>
  </abstract>
    
<funding-group>
<award-group id="gs1">
<funding-source>Norges Forskningsråd</funding-source>
<award-id>MATNOC 308796</award-id>
<award-id>Stormrisk 300608</award-id>
</award-group>
</funding-group>
</article-meta>
  </front>
<body>
      

<sec id="Ch1.S1" sec-type="intro">
  <label>1</label><title>Introduction</title>
      <p id="d1e134">Ambient currents and varying water depth affect the propagation path of ocean waves through refraction. Such changes can induce substantial horizontal wave height variability and build complex sea states through crossing rays, leading to caustics (Fig. <xref ref-type="fig" rid="Ch1.F1"/>) <xref ref-type="bibr" rid="bib1.bibx15" id="paren.1"/>. The linear theory of wave kinematics has been known for almost a century and applies the Wentzel–Kramers–Brillouin approximation (WKB, and sometimes WKBJ, where the last initial refers to Jeffreys) to characteristic wave and current conditions <xref ref-type="bibr" rid="bib1.bibx19" id="paren.2"/>. That is, the changes in wave amplitude <inline-formula><mml:math id="M1" display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula>, angular intrinsic frequency <inline-formula><mml:math id="M2" display="inline"><mml:mi mathvariant="italic">σ</mml:mi></mml:math></inline-formula>, and ambient medium are small over distances on the order of a wavelength <inline-formula><mml:math id="M3" display="inline"><mml:mi mathvariant="italic">λ</mml:mi></mml:math></inline-formula>. Such a treatment is known as the <italic>geometrical optics approximation</italic> and is applicable in various scientific branches dealing with the propagation of wave rays on different frequency scales. The resulting set of equations, typically referred to as the <italic>wave ray equations</italic>, only have analytical solutions for certain idealized cases; hence numerical integration is necessary to calculate the wave rays in arbitrary current fields and over arbitrary bathymetry <xref ref-type="bibr" rid="bib1.bibx19 bib1.bibx27 bib1.bibx17" id="paren.3"/>. Such solvers have been available in the ocean wave community since the advent of spectral wave models but often as part of a large and complex model framework and not generally available as stand-alone applications.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F1" specific-use="star"><?xmltex \currentcnt{1}?><?xmltex \def\figurename{Figure}?><label>Figure 1</label><caption><p id="d1e178">Depth refraction of swell against Rottnest Island off the coast of Western Australia depicted by the Copernicus Sentinel-2 mission, processed by ESA, in December 2021. The swell propagates northeastwards (white arrow) and interacts with the bathymetry when coming close to the island. Red arrows indicate the change in wave propagation direction, which is normal to the wave crest. An area subject to crossing waves is found on the east side of the island due to the change in wave propagation direction on both sides of the island.</p></caption>
        <?xmltex \igopts{width=455.244094pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f01.jpg"/>

      </fig>

      <p id="d1e187">Recent developments in the ocean modeling community, including assimilation of observations, have led to more realistic ocean-model output fields, which in turn have led to an increased interest in wave–current interaction studies <xref ref-type="bibr" rid="bib1.bibx4" id="paren.4"/>. Current-induced refraction has often been singled out as the principal mechanism leading to horizontal wave height variability at scales between 1 km and several hundred kilometers <xref ref-type="bibr" rid="bib1.bibx16 bib1.bibx3 bib1.bibx2" id="paren.5"><named-content content-type="pre">e.g.,</named-content></xref>. Thus, a number of recent studies employ wave ray equation solvers in order to quantify the impact of refraction <xref ref-type="bibr" rid="bib1.bibx30 bib1.bibx31 bib1.bibx2 bib1.bibx26 bib1.bibx7 bib1.bibx13 bib1.bibx32 bib1.bibx34 bib1.bibx11 bib1.bibx29 bib1.bibx22 bib1.bibx6 bib1.bibx18 bib1.bibx33 bib1.bibx25 bib1.bibx35 bib1.bibx24" id="paren.6"><named-content content-type="pre">e.g.,</named-content></xref>. However, such implementations are rarely open to the community. To the best of our knowledge, there is no open-source solver available<?pagebreak page6516?> in a high-level computer language to support such analyses. Furthermore, some of the solvers only focus on deep water where the wave ray equations are simplified since the topographic steering is negligible <xref ref-type="bibr" rid="bib1.bibx6 bib1.bibx7 bib1.bibx27 bib1.bibx19 bib1.bibx29 bib1.bibx22" id="paren.7"><named-content content-type="pre">e.g.,</named-content></xref>. However, the joint effect of current- and depth-induced refraction at intermediate depth can be important <xref ref-type="bibr" rid="bib1.bibx31 bib1.bibx13" id="paren.8"/>.</p>
      <p id="d1e212">The scope of this paper is to present an open-source numerical solver of the wave ray equations implemented in Python. The paper is structured as follows: in Sect. <xref ref-type="sec" rid="Ch1.S2"/> we present the theoretical background for the geometrical optics approximation of the wave ray equations on ambient currents and in variable depths. The numerical discretization and implementation of the equations and model are given in Sect. <xref ref-type="sec" rid="Ch1.S3"/>. Furthermore, some ancillary functions that support efficient workflows are also presented in Sect. <xref ref-type="sec" rid="Ch1.S3"/>. In Sect. <xref ref-type="sec" rid="Ch1.S4"/>, we compare the model output against analytical solutions and inspect the numerical convergence. A selection of examples using the ray tracing module, including idealized current fields and output from ocean circulation models, are presented in Sect. <xref ref-type="sec" rid="Ch1.S5"/>. Finally, a brief discussion and some concluding remarks are provided in Sect. <xref ref-type="sec" rid="Ch1.S6"/>.</p>
</sec>
<sec id="Ch1.S2">
  <label>2</label><title>Derivation of the wave ray equations</title>
      <p id="d1e236">For simplicity, we first derive the wave ray equations in the <inline-formula><mml:math id="M4" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> direction and then extend the results to both horizontal directions. We assume linear wave theory such that <inline-formula><mml:math id="M5" display="inline"><mml:mrow><mml:mi>a</mml:mi><mml:mi>k</mml:mi><mml:mo>≪</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>, where <inline-formula><mml:math id="M6" display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula> denotes the wave amplitude and <inline-formula><mml:math id="M7" display="inline"><mml:mrow><mml:mi>k</mml:mi><mml:mo>=</mml:mo><mml:mo>|</mml:mo><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo>|</mml:mo><mml:mo>=</mml:mo><mml:mo>|</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>|</mml:mo></mml:mrow></mml:math></inline-formula> is the wave number. When considering the kinematics of wave trains through the geometrical optics approximation, it should be emphasized that diffraction is neglected. For a more complete description of the kinematics and dynamics of ocean waves, we refer the reader to <xref ref-type="bibr" rid="bib1.bibx28" id="text.9"/> and <xref ref-type="bibr" rid="bib1.bibx21" id="text.10"/>.</p>
<sec id="Ch1.S2.SS1">
  <label>2.1</label><title>The one-dimensional problem</title>
      <?pagebreak page6517?><p id="d1e320">A plane wave propagating in a slowly varying medium is given by
            <disp-formula id="Ch1.E1" content-type="numbered"><label>1</label><mml:math id="M8" display="block"><mml:mrow><mml:mi mathvariant="italic">η</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi>a</mml:mi><mml:msup><mml:mi>e</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mi mathvariant="italic">χ</mml:mi></mml:mrow></mml:msup><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M9" display="inline"><mml:mrow><mml:mi mathvariant="italic">χ</mml:mi><mml:mo>=</mml:mo><mml:mi>k</mml:mi><mml:mi>x</mml:mi><mml:mo>-</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mi>t</mml:mi><mml:mo>+</mml:mo><mml:mi mathvariant="italic">δ</mml:mi></mml:mrow></mml:math></inline-formula> is the phase function. Here <inline-formula><mml:math id="M10" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M11" display="inline"><mml:mi mathvariant="italic">δ</mml:mi></mml:math></inline-formula> denote position, time, and the phase, respectively, and <inline-formula><mml:math id="M12" display="inline"><mml:mi mathvariant="italic">σ</mml:mi></mml:math></inline-formula> is the wave angular intrinsic frequency given by the dispersion relation
            <disp-formula id="Ch1.E2" content-type="numbered"><label>2</label><mml:math id="M13" display="block"><mml:mrow><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>(</mml:mo><mml:mi>k</mml:mi><mml:mo>,</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msqrt><mml:mrow><mml:mi>g</mml:mi><mml:mi>k</mml:mi><mml:mi>tanh⁡</mml:mi><mml:mo>(</mml:mo><mml:mi>k</mml:mi><mml:mi>d</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:msqrt><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M14" display="inline"><mml:mrow><mml:mi>d</mml:mi><mml:mo>=</mml:mo><mml:mi>d</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the water depth, which we assume to be constant in time. In the presence of an ambient current <inline-formula><mml:math id="M15" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mi>U</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, the absolute wave angular frequency is
            <disp-formula id="Ch1.E3" content-type="numbered"><label>3</label><mml:math id="M16" display="block"><mml:mrow><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi><mml:mo>(</mml:mo><mml:mi>k</mml:mi><mml:mo>,</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>+</mml:mo><mml:mi>k</mml:mi><mml:mi>U</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          which is often referred to as the <italic>Doppler shift equation</italic>. Consider now a phase function <inline-formula><mml:math id="M17" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="italic">χ</mml:mi><mml:mo>′</mml:mo></mml:msup><mml:mo>=</mml:mo><mml:mi>k</mml:mi><mml:mi>x</mml:mi><mml:mo>-</mml:mo><mml:mi mathvariant="italic">ω</mml:mi><mml:mi>t</mml:mi><mml:mo>+</mml:mo><mml:mi mathvariant="italic">δ</mml:mi></mml:mrow></mml:math></inline-formula> in a frame of reference not moving with the current. Since <inline-formula><mml:math id="M18" display="inline"><mml:mrow><mml:mi>k</mml:mi><mml:mo>=</mml:mo><mml:mo>∂</mml:mo><mml:msup><mml:mi mathvariant="italic">χ</mml:mi><mml:mo>′</mml:mo></mml:msup><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M19" display="inline"><mml:mrow><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mo>∂</mml:mo><mml:msup><mml:mi mathvariant="italic">χ</mml:mi><mml:mo>′</mml:mo></mml:msup><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:math></inline-formula>, by cross-differentiating, we obtain the <italic>conservation of wave crests</italic> <xref ref-type="bibr" rid="bib1.bibx15" id="paren.11"><named-content content-type="pre">see Note D,</named-content><named-content content-type="post">p. 339</named-content></xref>,
            <disp-formula id="Ch1.E4" content-type="numbered"><label>4</label><mml:math id="M20" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          If we also assume local stationarity, i.e., <inline-formula><mml:math id="M21" display="inline"><mml:mrow><mml:mo>∂</mml:mo><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M22" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> becomes constant in time and the frequency remains constant along the rays (<inline-formula><mml:math id="M23" display="inline"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>x</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>). By taking the partial derivative of Eq. (<xref ref-type="disp-formula" rid="Ch1.E3"/>) while keeping <inline-formula><mml:math id="M24" display="inline"><mml:mi>t</mml:mi></mml:math></inline-formula> constant, we obtain
            <disp-formula id="Ch1.E5" content-type="numbered"><label>5</label><mml:math id="M25" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M26" display="inline"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>k</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mi>U</mml:mi></mml:mrow></mml:math></inline-formula> is the advection velocity, which contains the wave group velocity <inline-formula><mml:math id="M27" display="inline"><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>≡</mml:mo><mml:mo>∂</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:math></inline-formula>. We define the material (or total) derivative as
            <disp-formula id="Ch1.E6" content-type="numbered"><label>6</label><mml:math id="M28" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mi mathvariant="normal">d</mml:mi><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mi>U</mml:mi><mml:mo>)</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Thus, advection of a wave group is simply
            <disp-formula id="Ch1.E7" content-type="numbered"><label>7</label><mml:math id="M29" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>x</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mi>U</mml:mi><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          This is the first of the wave ray equations. The evolution of the wave number <inline-formula><mml:math id="M30" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> follows by inserting Eq. (<xref ref-type="disp-formula" rid="Ch1.E5"/>) into Eq. (<xref ref-type="disp-formula" rid="Ch1.E4"/>) such that
            <disp-formula id="Ch1.E8" content-type="numbered"><label>8</label><mml:math id="M31" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>k</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mfenced open="(" close=")"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="italic">σ</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mi>k</mml:mi><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>U</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mrow></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          which is the second of the wave ray equations. Using the same approach for <inline-formula><mml:math id="M32" display="inline"><mml:mi mathvariant="italic">ω</mml:mi></mml:math></inline-formula>, for a fixed bathymetry we get
            <disp-formula id="Ch1.E9" content-type="numbered"><label>9</label><mml:math id="M33" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mi>k</mml:mi><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>U</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          which reduces to
            <disp-formula id="Ch1.E10" content-type="numbered"><label>10</label><mml:math id="M34" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></disp-formula>
          for a stationary current <inline-formula><mml:math id="M35" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, since we consider ambient currents that vary slowly compared to a characteristic wave period. Thus, the absolute wave frequency is constant. Summarized, we have obtained the wave ray equations in one horizontal dimension as

                <disp-formula specific-use="gather" content-type="numbered"><mml:math id="M36" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E11"><mml:mtd><mml:mtext>11</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>x</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mi>U</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E12"><mml:mtd><mml:mtext>12</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>k</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mfenced open="(" close=")"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="italic">σ</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mi>k</mml:mi><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>U</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mrow></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E13"><mml:mtd><mml:mtext>13</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            The wave ray equations constitute a set of coupled ordinary differential equations (ODEs) that define a characteristic curve in space and time. They can be solved as an initial value problem if defined with a starting point of <inline-formula><mml:math id="M37" display="inline"><mml:mrow><mml:msup><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup><mml:mo>≡</mml:mo><mml:mi>x</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and an initial wave period of <inline-formula><mml:math id="M38" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mi>T</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> by using the dispersion relation from  Eq. (<xref ref-type="disp-formula" rid="Ch1.E2"/>). In deep water, where the wavelength <inline-formula><mml:math id="M39" display="inline"><mml:mrow><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>≪</mml:mo><mml:mi>d</mml:mi><mml:mo>/</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>, the first term on the right-hand side of Eq. (<xref ref-type="disp-formula" rid="Ch1.E12"/>) vanishes since <inline-formula><mml:math id="M40" display="inline"><mml:mrow><mml:mi>tanh⁡</mml:mi><mml:mo>(</mml:mo><mml:mi>k</mml:mi><mml:mi>d</mml:mi><mml:mo>)</mml:mo><mml:mo>→</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E2"/>). Under such conditions the evolution of <inline-formula><mml:math id="M41" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> is only a function of the horizontal gradients in the ambient current.</p>
</sec>
<sec id="Ch1.S2.SS2">
  <label>2.2</label><title>The two-dimensional problem</title>
      <p id="d1e1338">In 2D we denote the position vector <inline-formula><mml:math id="M42" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and the ambient current vector <inline-formula><mml:math id="M43" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi>U</mml:mi><mml:mo>,</mml:mo><mml:mi>V</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. We define the horizontal gradient operator as
            <disp-formula id="Ch1.E14" content-type="numbered"><label>14</label><mml:math id="M44" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi mathvariant="normal">h</mml:mi></mml:msub><mml:mo>≡</mml:mo><mml:mover accent="true"><mml:mi mathvariant="bold">i</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mover accent="true"><mml:mi mathvariant="bold">j</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M45" display="inline"><mml:mover accent="true"><mml:mi mathvariant="bold">i</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover></mml:math></inline-formula> and <inline-formula><mml:math id="M46" display="inline"><mml:mover accent="true"><mml:mi mathvariant="bold">j</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover></mml:math></inline-formula> denote the unit vectors for <inline-formula><mml:math id="M47" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M48" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula>, respectively. Now, the absolute angular frequency,
            <disp-formula id="Ch1.E15" content-type="numbered"><label>15</label><mml:math id="M49" display="block"><mml:mrow><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="normal">Ω</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>+</mml:mo><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo>⋅</mml:mo><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          and the wave ray equations for a stationary current field become

                <disp-formula specific-use="gather" content-type="numbered"><mml:math id="M50" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E16"><mml:mtd><mml:mtext>16</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E17"><mml:mtd><mml:mtext>17</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi mathvariant="normal">h</mml:mi></mml:msub><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>h</mml:mi></mml:msub><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E18"><mml:mtd><mml:mtext>18</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula></p>
      <?pagebreak page6518?><p id="d1e1616">In the context of spectral wave modeling, the dynamical evolution of the wave field is governed by the wave action balance equation,
            <disp-formula id="Ch1.E19" content-type="numbered"><label>19</label><mml:math id="M51" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>N</mml:mi></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi mathvariant="normal">h</mml:mi></mml:msub><mml:mo>⋅</mml:mo><mml:mo mathsize="1.5em">(</mml:mo><mml:mover accent="true"><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mi>N</mml:mi><mml:mo mathsize="1.5em">)</mml:mo><mml:mo>+</mml:mo><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>k</mml:mi></mml:msub><mml:mo>⋅</mml:mo><mml:mo mathsize="1.5em">(</mml:mo><mml:mover accent="true"><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mi>N</mml:mi><mml:mo mathsize="1.5em">)</mml:mo><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mi>S</mml:mi><mml:mi mathvariant="italic">σ</mml:mi></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Here, <inline-formula><mml:math id="M52" display="inline"><mml:mrow><mml:mi>N</mml:mi><mml:mo>≡</mml:mo><mml:mi>E</mml:mi><mml:mo>/</mml:mo><mml:mi mathvariant="italic">σ</mml:mi></mml:mrow></mml:math></inline-formula> is the wave action density, which is a conserved quantity in the presence of currents <xref ref-type="bibr" rid="bib1.bibx5" id="paren.12"/>. The wave action density contains the wave variance density <inline-formula><mml:math id="M53" display="inline"><mml:mi>E</mml:mi></mml:math></inline-formula>, which is <inline-formula><mml:math id="M54" display="inline"><mml:mrow><mml:mo>∝</mml:mo><mml:msup><mml:mi>a</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>. The right-hand side of Eq. (<xref ref-type="disp-formula" rid="Ch1.E19"/>) represents sources and sinks of wave action. The wave number gradient operator is
            <disp-formula id="Ch1.E20" content-type="numbered"><label>20</label><mml:math id="M55" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi mathvariant="normal">k</mml:mi></mml:msub><mml:mo>≡</mml:mo><mml:mover accent="true"><mml:mi mathvariant="bold">i</mml:mi><mml:mo mathvariant="normal" stretchy="false">^</mml:mo></mml:mover><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>+</mml:mo><mml:mover accent="true"><mml:mi mathvariant="bold">j</mml:mi><mml:mo stretchy="false" mathvariant="normal">^</mml:mo></mml:mover><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The wave ray equations (Eqs. <xref ref-type="disp-formula" rid="Ch1.E16"/>–<xref ref-type="disp-formula" rid="Ch1.E17"/>) model the terms written (for brevity) with overdots in Eq. (<xref ref-type="disp-formula" rid="Ch1.E19"/>), i.e.,

                <disp-formula specific-use="gather" content-type="numbered"><mml:math id="M56" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E21"><mml:mtd><mml:mtext>21</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mover accent="true"><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>≡</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E22"><mml:mtd><mml:mtext>22</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mover accent="true"><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover><mml:mo>≡</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">d</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            There is thus a connection between the wave field dynamics and kinematics where <inline-formula><mml:math id="M57" display="inline"><mml:mover accent="true"><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover></mml:math></inline-formula> represents the advection of wave action in physical space and <inline-formula><mml:math id="M58" display="inline"><mml:mover accent="true"><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mo mathvariant="normal">˙</mml:mo></mml:mover></mml:math></inline-formula> represents the refraction (“advection” in <inline-formula><mml:math id="M59" display="inline"><mml:mi mathvariant="bold-italic">k</mml:mi></mml:math></inline-formula> space). The wave action balance (Eq. <xref ref-type="disp-formula" rid="Ch1.E19"/>) is solved by third-generation spectral wave models but then discretized either by wave number <inline-formula><mml:math id="M60" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> or frequency <inline-formula><mml:math id="M61" display="inline"><mml:mi>f</mml:mi></mml:math></inline-formula> and direction <inline-formula><mml:math id="M62" display="inline"><mml:mi mathvariant="italic">θ</mml:mi></mml:math></inline-formula> <xref ref-type="bibr" rid="bib1.bibx21" id="paren.13"/>.</p>
</sec>
</sec>
<sec id="Ch1.S3">
  <label>3</label><title>Numerical implementation</title>
<sec id="Ch1.S3.SS1">
  <label>3.1</label><title>Finite-difference discretization</title>
      <p id="d1e1920">The wave ray equations (Eqs. <xref ref-type="disp-formula" rid="Ch1.E16"/>–<xref ref-type="disp-formula" rid="Ch1.E17"/>) are well suited for numerical integration. The <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat> module offers two finite-difference numerical schemes: a fourth-order Runge–Kutta scheme and a forward Euler scheme through its <preformat preformat-type="code"><![CDATA[solver]]></preformat> method. For readability, the latter is used here to present the discretization of the wave ray equations. The advection (Eq. <xref ref-type="disp-formula" rid="Ch1.E16"/>) becomes

                <disp-formula specific-use="gather" content-type="numbered"><mml:math id="M63" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E23"><mml:mtd><mml:mtext>23</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><?xmltex \hack{\hbox\bgroup\fontsize{9}{9}\selectfont$\displaystyle}?><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>=</mml:mo><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>+</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">x</mml:mi></mml:msub><mml:mfenced close=")" open="("><mml:mrow><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>y</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mfenced><mml:mo>,</mml:mo><?xmltex \hack{$\egroup}?></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E24"><mml:mtd><mml:mtext>24</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><?xmltex \hack{\hbox\bgroup\fontsize{9}{9}\selectfont$\displaystyle}?><mml:msubsup><mml:mi>y</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>=</mml:mo><mml:msubsup><mml:mi>y</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>+</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">x</mml:mi></mml:msub><mml:mfenced close=")" open="("><mml:mrow><mml:msubsup><mml:mi>x</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>y</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mfenced><mml:mo>.</mml:mo><?xmltex \hack{$\egroup}?></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            Here <inline-formula><mml:math id="M64" display="inline"><mml:mi>n</mml:mi></mml:math></inline-formula> denotes the discrete time index, with <inline-formula><mml:math id="M65" display="inline"><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>,</mml:mo><mml:mi>N</mml:mi></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M66" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mi>n</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. Discrete horizontal indices are given by <inline-formula><mml:math id="M67" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>; <inline-formula><mml:math id="M68" display="inline"><mml:mrow><mml:mi>j</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>; and <inline-formula><mml:math id="M69" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>l</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M70" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>y</mml:mi><mml:mi>l</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>. The <inline-formula><mml:math id="M71" display="inline"><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">x</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is a function of the group velocity and ambient current and becomes (skipping time and horizontal indices for readability)
            <disp-formula id="Ch1.E25" content-type="numbered"><label>25</label><mml:math id="M72" display="block"><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">x</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi>U</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable columnspacing="1em" rowspacing="0.2ex" class="cases" columnalign="left" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mfenced open="(" close=")"><mml:mrow><mml:mi>k</mml:mi><mml:mo>,</mml:mo><mml:mi>d</mml:mi><mml:mo>[</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>]</mml:mo></mml:mrow></mml:mfenced><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow><mml:mi>k</mml:mi></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>+</mml:mo><mml:mi>U</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mtext>in</mml:mtext><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>x</mml:mi><mml:mtext> direction</mml:mtext><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mfenced close=")" open="("><mml:mrow><mml:mi>k</mml:mi><mml:mo>,</mml:mo><mml:mi>d</mml:mi><mml:mo>[</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>]</mml:mo></mml:mrow></mml:mfenced><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow><mml:mi>k</mml:mi></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>+</mml:mo><mml:mi>V</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mtext>in</mml:mtext><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>y</mml:mi><mml:mtext> direction</mml:mtext><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced></mml:mrow></mml:math></disp-formula>
          The evolution in wave number (Eq. <xref ref-type="disp-formula" rid="Ch1.E17"/>) becomes

                <disp-formula specific-use="gather" content-type="numbered"><mml:math id="M73" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E26"><mml:mtd><mml:mtext>26</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mtable class="split" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mo>=</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>+</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:msub><mml:mfenced open="(" close=""><mml:mrow><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd/><mml:mtd><mml:mrow><mml:mfenced open="" close=")"><mml:mrow><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msub><mml:mi>d</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E27"><mml:mtd><mml:mtext>27</mml:mtext></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mtable class="split" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mo>=</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>+</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:msub><mml:mfenced close="" open="("><mml:mrow><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mrow></mml:mfenced></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd/><mml:mtd><mml:mrow><mml:mfenced close=")" open=""><mml:mrow><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:msub><mml:mi>d</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>,</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mo>∂</mml:mo><mml:mrow><mml:mo>∂</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            Here, <inline-formula><mml:math id="M74" display="inline"><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is a function of the horizontal derivatives of <inline-formula><mml:math id="M75" display="inline"><mml:mi mathvariant="italic">σ</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M76" display="inline"><mml:mi mathvariant="bold-italic">U</mml:mi></mml:math></inline-formula>. Horizontal derivatives are discretized using a central difference scheme, such that <inline-formula><mml:math id="M77" display="inline"><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> becomes
            <disp-formula id="Ch1.E28" content-type="numbered"><label>28</label><mml:math id="M78" display="block"><mml:mrow><mml:msub><mml:mi>f</mml:mi><mml:mi mathvariant="bold-italic">k</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi>U</mml:mi><mml:mo>,</mml:mo><mml:mi>V</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable class="cases" rowspacing="0.2ex" columnspacing="1em" columnalign="left" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:mo>-</mml:mo><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msubsup><mml:mi mathvariant="italic">σ</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>-</mml:mo><mml:msubsup><mml:mi mathvariant="italic">σ</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>-</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>-</mml:mo><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>-</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>-</mml:mo><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>,</mml:mo><mml:mtext>in</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>x</mml:mi><mml:mtext> direction</mml:mtext><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mo>-</mml:mo><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msubsup><mml:mi mathvariant="italic">σ</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>-</mml:mo><mml:msubsup><mml:mi mathvariant="italic">σ</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>-</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>-</mml:mo><mml:msubsup><mml:mi>U</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>-</mml:mo><mml:msubsup><mml:mi>k</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="false"><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mrow><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>-</mml:mo><mml:msubsup><mml:mi>V</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mstyle><mml:mo>,</mml:mo><mml:mtext>in</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>y</mml:mi><mml:mtext> direction</mml:mtext><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced></mml:mrow></mml:math></disp-formula></p>
</sec>
<sec id="Ch1.S3.SS2">
  <label>3.2</label><title>Stability condition</title>
      <p id="d1e3541">A constraint for hyperbolic equations in finite-difference numerical schemes is the Courant–Friedrichs–Lewy (CFL) condition, which for a process with advection velocity <inline-formula><mml:math id="M79" display="inline"><mml:mi>W</mml:mi></mml:math></inline-formula> demands that the non-dimensional Courant number be defined as
            <disp-formula id="Ch1.E29" content-type="numbered"><label>29</label><mml:math id="M80" display="block"><mml:mrow><mml:mi>C</mml:mi><mml:mo>≡</mml:mo><mml:mi>W</mml:mi><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi></mml:mrow><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>r</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>≤</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M81" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>r</mml:mi><mml:mo>=</mml:mo><mml:msqrt><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msup><mml:mi>x</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>+</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:msup><mml:mi>y</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:msqrt></mml:mrow></mml:math></inline-formula>. If  <inline-formula><mml:math id="M82" display="inline"><mml:mrow><mml:mi>C</mml:mi><mml:mo>&gt;</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>, the process will advect a distance larger than the grid point resolution over a period <inline-formula><mml:math id="M83" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:math></inline-formula>, leading to instabilities in the numerical solution. A dedicated method, <preformat preformat-type="code"><![CDATA[check_CFL]]></preformat>, is implemented in the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> class and added to the  <preformat preformat-type="code"><![CDATA[set_initial_condition]]></preformat> method (Fig. <xref ref-type="fig" rid="Ch1.F2"/>). The Courant number is written to the log file as
            <disp-formula id="Ch1.E30" content-type="numbered"><label>30</label><mml:math id="M84" display="block"><mml:mrow><mml:msub><mml:mi>C</mml:mi><mml:mi mathvariant="normal">logfile</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable class="cases" rowspacing="0.2ex" columnspacing="1em" columnalign="left left" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:mi mathvariant="normal">info</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mtext>if</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>C</mml:mi><mml:mo>≤</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mi mathvariant="normal">warning</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mtext>if</mml:mtext><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>C</mml:mi><mml:mo>&gt;</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced></mml:mrow></mml:math></disp-formula>
          The advection velocity (the absolute group velocity as seen from a fixed point) in Eq. (<xref ref-type="disp-formula" rid="Ch1.E29"/>) is implemented as
            <disp-formula id="Ch1.E31" content-type="numbered"><label>31</label><mml:math id="M85" display="block"><mml:mrow><mml:mi>W</mml:mi><mml:mo>=</mml:mo><mml:mo movablelimits="false">max⁡</mml:mo><mml:mo>(</mml:mo><mml:mo>|</mml:mo><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>|</mml:mo><mml:mo>)</mml:mo><mml:mo>+</mml:mo><mml:mo movablelimits="false">max⁡</mml:mo><mml:mo>(</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">c</mml:mi><mml:mi mathvariant="normal">g</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msubsup><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          which is a good proxy for the magnitude of the maximum advection speed. It may, however, exceed <inline-formula><mml:math id="M86" display="inline"><mml:mi>W</mml:mi></mml:math></inline-formula> for <inline-formula><mml:math id="M87" display="inline"><mml:mrow><mml:mi>n</mml:mi><mml:mo>&gt;</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> for waves starting in shallow water and propagating towards deeper water. In the <preformat preformat-type="code"><![CDATA[check_CFL]]></preformat>, <inline-formula><mml:math id="M88" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>r</mml:mi><mml:mo>=</mml:mo><mml:mo>min⁡</mml:mo><mml:mo>(</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>.</p><?xmltex \floatpos{t}?><boxed-text content-type="algorithm" position="float" id="Ch1.Prog1" specific-use="star"><?xmltex \currentcnt{1}?><label>Algorithm 1</label><caption><p id="d1e3801">Generic workflow code example.</p></caption><disp-quote content-type="algorithmic" specific-use="numbering{0}"><list>

    <list-item>

      <p id="d1e3808" specific-use="STATE"><monospace>import numpy as np</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3815" specific-use="STATE"><monospace>import maplotlib.pyplot as plt</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3822" specific-use="STATE"><monospace>from ocean_wave_tracing import Wave_tracing</monospace></p>
            </list-item>

    <list-item>

            <p specific-use="STATE"/></list-item>

    <list-item>

      <p id="d1e3832" specific-use="STATE"><monospace># Defining some properties of the medium</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3840" specific-use="STATE"><monospace>nx = 100; ny = 100 # number of grid points in x- and y-direction</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3847" specific-use="STATE"><monospace>x = np.linspace(0,2000,nx) # size x-domain [m]</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3854" specific-use="STATE"><monospace>y = np.linspace(0,3500,ny) # size y-domain [m]</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3861" specific-use="STATE"><monospace>T = 250 # simulation time [s]</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3868" specific-use="STATE"><monospace>U=np.zeros((nx,ny))</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3875" specific-use="STATE"><monospace>U[nx//2:,:]=1</monospace></p>
            </list-item>

    <list-item>

            <p specific-use="STATE"/></list-item>

    <list-item>

      <p id="d1e3886" specific-use="STATE"><monospace># Define a wave tracing object</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3893" specific-use="STATE"><monospace>wt = Wave_tracing(U=U,V=np.zeros((ny,nx)),</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3900" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>nx=nx, ny=ny, nt=150,T=T,</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3908" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>dx=x[1]-x[0],dy=y[1]-y[0],</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3916" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>nb_wave_rays=20,</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3925" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>domain_X0=x[0], domain_XN=x[-1],</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3933" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>domain_Y0=y[0], domain_YN=y[-1],</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3941" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>)</monospace></p>
            </list-item>

    <list-item>

            <p specific-use="STATE"/></list-item>

    <list-item>

      <p id="d1e3952" specific-use="STATE"><monospace># Set initial conditions</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3959" specific-use="STATE"><monospace>wt.set_initial_condition(wave_period=10,</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3967" specific-use="STATE"><?xmltex \hack{\hspace*{4mm}}?><monospace>theta0=np.pi/8)</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3975" specific-use="STATE"><monospace># Solve</monospace></p>
            </list-item>

    <list-item>

      <p id="d1e3982" specific-use="STATE"><monospace>wt.solve()</monospace></p>
            </list-item>
          </list></disp-quote></boxed-text>
</sec>
<sec id="Ch1.S3.SS3">
  <label>3.3</label><title>Model simulation workflow</title>
      <?pagebreak page6519?><p id="d1e3996">The wave ray equations are implemented in Python 3 in the <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat> module available on GitHub at <uri>https://github.com/hevgyrt/ocean_wave_tracing</uri> (last access: 6 November 2023) under a GPL v.3 license. It is based on common native Python libraries and open-source projects. Key open-source projects include <italic>numpy</italic> (numerical Python – <uri>https://numpy.org/</uri>, last access: 6 November 2023), <italic>matplotlib</italic> (<uri>https://matplotlib.org/</uri>, last access: 6 November 2023), and <italic>xarray</italic> (<uri>https://docs.xarray.dev/en/stable/</uri>, last access: 6 November 2023). The latter library is a large project, which has become a de facto standard in geophysical sciences for analyzing and dealing with multi-dimensional data. The wave ray tracing tool is a class instance, and the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> object contains multiple auxiliary methods before and after performing the numerical integration. Here, we will focus on the workflow, input fields, implementation, and the ancillary methods enclosing the wave ray tracing <preformat preformat-type="code"><![CDATA[solver]]></preformat> method.</p>
<sec id="Ch1.S3.SS3.SSS1">
  <label>3.3.1</label><title>Operating conditions</title>
      <p id="d1e4037">A set of fixed conditions are specified for the <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat> module. The most important conditions include the following: <list list-type="bullet"><list-item>
      <p id="d1e4045">The model domain must be rectangular and in Cartesian coordinates with a uniform horizontal resolution in each direction.</p></list-item><list-item>
      <p id="d1e4049">Units must follow the SI system with length scale units of meters (<inline-formula><mml:math id="M89" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow></mml:math></inline-formula>) and seconds (<inline-formula><mml:math id="M90" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula>). The angular units are radians (<inline-formula><mml:math id="M91" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">rad</mml:mi></mml:mrow></mml:math></inline-formula>). Wave propagation direction <inline-formula><mml:math id="M92" display="inline"><mml:mi mathvariant="italic">θ</mml:mi></mml:math></inline-formula> follows a right handed coordinate system with <inline-formula><mml:math id="M93" display="inline"><mml:mrow><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> being parallel to the <inline-formula><mml:math id="M94" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis and propagating in the positive <inline-formula><mml:math id="M95" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> direction.</p></list-item><list-item>
      <p id="d1e4111">Variable names, structures, and metadata are, to a large extent, based on the Climate and Forecast (CF) metadata convention (<uri>https://cfconventions.org/</uri>, last access: 6 November 2023).</p></list-item></list></p>
</sec>
<sec id="Ch1.S3.SS3.SSS2">
  <label>3.3.2</label><title>Ray tracing model initialization</title>
      <p id="d1e4125">A flowchart of the model simulation workflow is given in Fig. <xref ref-type="fig" rid="Ch1.F2"/> and an associated code example in Alg. <xref ref-type="other" rid="Ch1.Prog1"/>. Firstly, a wave ray tracing object <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> is initialized by an <preformat preformat-type="code"><![CDATA[__init__]]></preformat> method. The input variables define the ambient conditions and include</p>
      <p id="d1e4138"><list list-type="bullet">
              <list-item>

      <p id="d1e4143">the ambient current <preformat preformat-type="code"><![CDATA[U,V]]></preformat> = <inline-formula><mml:math id="M96" display="inline"><mml:mi mathvariant="bold-italic">U</mml:mi></mml:math></inline-formula>;</p>
              </list-item>
              <list-item>

      <p id="d1e4159">the bathymetry <preformat preformat-type="code"><![CDATA[depth]]></preformat> (optional);</p>
              </list-item>
              <list-item>

      <p id="d1e4168">the boundaries <preformat preformat-type="code"><![CDATA[X0,XN,Y0]]></preformat>, and <preformat preformat-type="code"><![CDATA[YN]]></preformat> and horizontal resolution <preformat preformat-type="code"><![CDATA[dx]]></preformat> and <preformat preformat-type="code"><![CDATA[dy]]></preformat> of the domain;</p>
              </list-item>
              <list-item>

      <p id="d1e4186">the number of time steps <preformat preformat-type="code"><![CDATA[nt]]></preformat> and total duration time for wave propagation <preformat preformat-type="code"><![CDATA[T]]></preformat>;</p>
              </list-item>
              <list-item>

      <p id="d1e4198">the number of wave rays <preformat preformat-type="code"><![CDATA[nb_wave_rays]]></preformat>.</p>
              </list-item>
            </list>The current is allowed to vary in time by setting <preformat preformat-type="code"><![CDATA[temporal_evolution=True]]></preformat>, but it is up to the user to make sure that <inline-formula><mml:math id="M97" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is not violating Eq. (<xref ref-type="disp-formula" rid="Ch1.E18"/>) by <inline-formula><mml:math id="M98" display="inline"><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>t</mml:mi><mml:mo>≃</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>. If the bathymetry is not specified, the model assumes deep-water waves and sets a fixed uniform depth at <inline-formula><mml:math id="M99" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">5</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M100" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow></mml:math></inline-formula>. Depth values are defined as positive, implying that negative values will be treated as land if both negative and positive values are present through a dedicated bathymetry checker (<preformat preformat-type="code"><![CDATA[check_bathymetry]]></preformat>), which is invoked within <preformat preformat-type="code"><![CDATA[__init__]]></preformat>. Furthermore, the input velocity field is checked and <italic>xarray</italic> datasets are created for the bathymetry and velocity field as class variables following the CF convention.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F2" specific-use="star"><?xmltex \currentcnt{2}?><?xmltex \def\figurename{Figure}?><label>Figure 2</label><caption><p id="d1e4281">Flowchart of the workflow from initializing a ray tracing object to solving the wave ray tracing equations. The left column denotes the most important steps in the workflow, and the right column highlights the most important parameters and supporting methods under each step.</p></caption>
            <?xmltex \igopts{width=341.433071pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f02.png"/>

          </fig>

</sec>
<?pagebreak page6520?><sec id="Ch1.S3.SS3.SSS3">
  <label>3.3.3</label><title>Setting the initial conditions</title>
      <p id="d1e4298">Before the numerical integration, initial conditions for the ODEs are specified in a dedicated <preformat preformat-type="code"><![CDATA[set_initial_condition()]]></preformat> method (Alg. <xref ref-type="other" rid="Ch1.Prog1"/>, Fig. <xref ref-type="fig" rid="Ch1.F2"/>). Here the initial wave period <inline-formula><mml:math id="M101" display="inline"><mml:mrow><mml:msup><mml:mi>T</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, wave propagation direction <inline-formula><mml:math id="M102" display="inline"><mml:mrow><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mi mathvariant="italic">θ</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, and initial position <inline-formula><mml:math id="M103" display="inline"><mml:mrow><mml:mi mathvariant="bold">r</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msup><mml:mi>x</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup><mml:mo>,</mml:mo><mml:msup><mml:mi>y</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> are specified. By utilizing the rectangular model domain, the initial position can most easily be given as one of the sides of the domain, i.e., <preformat preformat-type="code"><![CDATA[top, bottom, left]]></preformat>, or <preformat preformat-type="code"><![CDATA[right]]></preformat>, where <preformat preformat-type="code"><![CDATA[left]]></preformat> is default (see Alg. <xref ref-type="other" rid="Ch1.Prog1"/>). In such cases, the number of wave rays is spread uniformly on the selected boundary. Another option is to specify initial grid points <preformat preformat-type="code"><![CDATA[ipx]]></preformat> and <preformat preformat-type="code"><![CDATA[ipy]]></preformat> for each wave ray. Similarly, <inline-formula><mml:math id="M104" display="inline"><mml:mrow><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>=</mml:mo><mml:msup><mml:mi mathvariant="italic">θ</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> can also be specified for each ray, or a single uniform direction can be given for all rays. Such examples are provided later.</p>
      <p id="d1e4434">The model is solved for a single wave frequency, dictated by the initial wave period <inline-formula><mml:math id="M105" display="inline"><mml:mrow><mml:msup><mml:mi>T</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>. The wave number <inline-formula><mml:math id="M106" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> is retrieved from <inline-formula><mml:math id="M107" display="inline"><mml:mrow><mml:msup><mml:mi>T</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> using Eq. (<xref ref-type="disp-formula" rid="Ch1.E2"/>), which in intermediate depths requires an iterative solver. Using the approximation by <xref ref-type="bibr" rid="bib1.bibx10" id="text.14"/>, the error in <inline-formula><mml:math id="M108" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> is less than 5 % <xref ref-type="bibr" rid="bib1.bibx15" id="paren.15"/>.</p>
</sec>
<sec id="Ch1.S3.SS3.SSS4">
  <label>3.3.4</label><title>Numerical integration</title>
      <p id="d1e4501">Numerical integration of Eqs. (<xref ref-type="disp-formula" rid="Ch1.E23"/>)–(<xref ref-type="disp-formula" rid="Ch1.E28"/>) is initiated by invoking the <preformat preformat-type="code"><![CDATA[solver]]></preformat> method. Here, <inline-formula><mml:math id="M109" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>h</mml:mi></mml:msub><mml:mi mathvariant="bold-italic">U</mml:mi></mml:mrow></mml:math></inline-formula> is computed prior to the integration using the <italic>numpy gradient</italic> method. The integration is performed iteratively in a Lagrangian sense by computing the next position <inline-formula><mml:math id="M110" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold">r</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> from the current position <inline-formula><mml:math id="M111" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold">r</mml:mi><mml:mi>n</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> for each wave ray. Thus, the <preformat preformat-type="code"><![CDATA[solver]]></preformat> keeps track of the horizontal indices <inline-formula><mml:math id="M112" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M113" display="inline"><mml:mi>j</mml:mi></mml:math></inline-formula> for every time step and for each wave ray in the model domain. Hence, the numerical integration for the wave rays can follow a vectorized approach, which is conceptually visualized in Fig. <xref ref-type="fig" rid="Ch1.F3"/>. For a given position <inline-formula><mml:math id="M114" display="inline"><mml:mi mathvariant="bold">r</mml:mi></mml:math></inline-formula>, the properties of the ambient medium, i.e., the current and bathymetry, are selected using a nearest-neighbor approach.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F3" specific-use="star"><?xmltex \currentcnt{3}?><?xmltex \def\figurename{Figure}?><label>Figure 3</label><caption><p id="d1e4584">A conceptual figure highlighting the workflow strategy of the model. Here, depth refraction of a <inline-formula><mml:math id="M115" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M116" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave propagating from left with an initial angle <inline-formula><mml:math id="M117" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="italic">θ</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0.1</mml:mn></mml:mrow></mml:math></inline-formula> rad is shown for seven different rays (black lines). The propagation path for each wave ray is computed simultaneously through vectorization. The lower panels denote the change in depth, evolution in <inline-formula><mml:math id="M118" display="inline"><mml:mi mathvariant="bold-italic">k</mml:mi></mml:math></inline-formula>, and corresponding wave propagation direction, <inline-formula><mml:math id="M119" display="inline"><mml:mi mathvariant="italic">θ</mml:mi></mml:math></inline-formula>, in time along one of the rays. As expected, the wave rays deflect towards shallower regions due to the increase in the <inline-formula><mml:math id="M120" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> wave number component.</p></caption>
            <?xmltex \igopts{width=426.791339pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f03.png"/>

          </fig>

      <p id="d1e4659">Even though <inline-formula><mml:math id="M121" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>h</mml:mi></mml:msub><mml:mi mathvariant="bold-italic">U</mml:mi></mml:mrow></mml:math></inline-formula> is static for each model field, <inline-formula><mml:math id="M122" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="normal">∇</mml:mi><mml:mi mathvariant="normal">h</mml:mi></mml:msub><mml:mi mathvariant="italic">σ</mml:mi></mml:mrow></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>) must be computed for each iteration <inline-formula><mml:math id="M123" display="inline"><mml:mi>n</mml:mi></mml:math></inline-formula> since the wave number <inline-formula><mml:math id="M124" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> evolves in time. Furthermore, for each iteration of <inline-formula><mml:math id="M125" display="inline"><mml:mi>n</mml:mi></mml:math></inline-formula>, the wave propagation direction <inline-formula><mml:math id="M126" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="italic">θ</mml:mi><mml:mi>n</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> is computed from <inline-formula><mml:math id="M127" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold-italic">k</mml:mi><mml:mi>n</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> using the <italic>numpy atan2</italic> function.</p>
      <p id="d1e4738">After a successful call of the <preformat preformat-type="code"><![CDATA[solve()]]></preformat> function, the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> object will have populated its class variables for the wave rays being (<preformat preformat-type="code"><![CDATA[ray_x,ray_y]]></preformat>), (<preformat preformat-type="code"><![CDATA[ray_kx,ray_ky]]></preformat>), <preformat preformat-type="code"><![CDATA[ray_k]]></preformat>, <preformat preformat-type="code"><![CDATA[ray_theta]]></preformat>, <preformat preformat-type="code"><![CDATA[ray_cg]]></preformat>, and (<preformat preformat-type="code"><![CDATA[ray_U,ray_V]]></preformat>), which are the horizontal position vector, wave number vector, wave number, wave propagation direction, wave group velocity, and ambient current vector, respectively. All of the aforementioned class variables have the dimensions <preformat preformat-type="code"><![CDATA[number_of_wave_rays]]></preformat><inline-formula><mml:math id="M128" display="inline"><mml:mrow><mml:mo>×</mml:mo><mml:mi>N</mml:mi></mml:mrow></mml:math></inline-formula>.</p>
      <p id="d1e4778">The numerical scheme used in the <preformat preformat-type="code"><![CDATA[solver]]></preformat> method is configurable by the user, and the default is a fourth-order Runge–Kutta scheme. That is, the numerical scheme is generic and detached from the wave ray equations. The schemes are available in a separate utility function <preformat preformat-type="code"><![CDATA[util_solvers]]></preformat>, which contains (currently two) numerical schemes which are defined Python classes in a hierarchy with a generic ODE solver as the top node. That is, each sub-class has its own <italic>advance</italic> method, which corresponds to the numerical scheme. This approach is to a large extent built on material from <xref ref-type="bibr" rid="bib1.bibx23" id="text.16"/>. Furthermore, the <preformat preformat-type="code"><![CDATA[util_solvers]]></preformat> also contain the advection and wave number evolution functions in Eq. (<xref ref-type="disp-formula" rid="Ch1.E25"/>) and Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>), respectively.</p>
</sec>
</sec>
<sec id="Ch1.S3.SS4">
  <label>3.4</label><title>Ancillary methods and testing</title>
<sec id="Ch1.S3.SS4.SSS1">
  <label>3.4.1</label><title>Ancillary functions</title>
      <p id="d1e4817">Ancillary functions include methods which are considered useful for the user community. The current version has four methods, three within the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> object and one outside the object.</p>
      <?pagebreak page6521?><p id="d1e4823">The method outside the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> object is targeted for data preparation before model initialization. It is not strictly a Python method, but it is a generic workflow for data retrieval. More specifically, since the ray tracing model is focused on ocean currents and bathymetry, it is natural to exploit variable fields from ocean circulation models. It is common for oceanographic centers to disseminate model results under a free and open data policy and to enable the Open-source Project for a Network Data Access Protocol (OPeNDAP – <uri>https://www.opendap.org/</uri>, last access: 6 November 2023) on the data distribution server (e.g., THREDDS – <uri>https://www.unidata.ucar.edu/software/tds/current/</uri>, last access: 6 November 2023 or HYRAX – <uri>https://www.opendap.org/software/hyrax-data-server</uri>, last access: 6 November 2023). The OPeNDAP enables spatio-temporal subsetting to be carried out on the server side and thus avoids the problem of downloading huge amounts of data prior to use. Such user-defined subsets can be accessed directly via data streaming by using common netCDF4 readers (<uri>https://www.unidata.ucar.edu/software/netcdf/</uri>, last access: 6 November 2023), which are available in <italic>xarray</italic>. The ancillary method, or workflow, is provided in the Jupyter notebook <preformat preformat-type="code"><![CDATA[extract_ocean_model_data.ipynb]]></preformat>. Here, the user can plot and check the user-defined area and temporal extent prior to writing the subset to disk or initiating the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> object directly. It is common for ocean circulation models to have output variable fields with hourly temporal resolution such that <inline-formula><mml:math id="M129" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is unlikely to violate Eq. (<xref ref-type="disp-formula" rid="Ch1.E18"/>). However, it is up to the user to understand the limitations of the model if simulating wave rays for very long shallow-water waves like tsunamis and tidal waves.</p>
      <p id="d1e4871">The first of the three class methods within the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> object is a transformation method from projection coordinates to latitude and longitude values, which is called <preformat preformat-type="code"><![CDATA[to_latlon()]]></preformat> (see Fig. <xref ref-type="fig" rid="Ch1.F2"/>). That is, when using ocean-circulation-model field variables as input data, it is not readily possible to compare the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> output with other sources of data since ocean-model field variables are most often in a specific projection. In this context, using latitude and longitude coordinates is often much more convenient. The method requires the <italic>proj4</italic> string of the ocean-model domain and performs coordinate transformation using the <italic>pyproj</italic> (<uri>https://pyproj4.github.io/pyproj/stable/</uri>, last access: 6 November 2023) library in Python. Even if not required, it is common that the <italic>proj4</italic> string is listed in the <preformat preformat-type="code"><![CDATA[grid_mapping]]></preformat> variable in a CF-compliant ocean-model dataset.</p>
      <p id="d1e4901">The second ancillary function is based on the wave ray density method by <xref ref-type="bibr" rid="bib1.bibx29" id="text.17"/> and is called <preformat preformat-type="code"><![CDATA[ray_density()]]></preformat>. It computes the relative number of wave rays within user-defined grid boxes, which can be considered proportional to the wave height and thus the horizontal wave height variability. The method returns a 2D grid and the associated ray density variable.</p>
      <p id="d1e4911">The third method takes care of converting all the characteristic <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> class variables into an <italic>xarray</italic> dataset, including latitude and longitude if the <italic>proj4</italic> string is given as input. The method is called <preformat preformat-type="code"><![CDATA[to_ds()]]></preformat>. The output <italic>xarray</italic> dataset follows the CF convention for metadata. Thus, the data can utilize all the functionality within <italic>xarray</italic>, including the plotting and writing of data to disk. Examples using all the methods listed above will be shown later in Sect. <xref ref-type="sec" rid="Ch1.S5"/>.</p>
</sec>
<sec id="Ch1.S3.SS4.SSS2">
  <label>3.4.2</label><title>Tests</title>
      <p id="d1e4943">The <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat> repository is equipped with unit tests written in the framework of Pythons <preformat preformat-type="code"><![CDATA[pytest]]></preformat>. Unit tests are tailored for the methods within and used by the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> class and typically check the numerical implementation against known solutions. For instance, the computation of wave celerity for deep and shallow water is tested against analytical solutions.</p>
      <?pagebreak page6522?><p id="d1e4955">For integration tests, a set of example scripts running the entire chain of operations is embedded in the <preformat preformat-type="code"><![CDATA[test]]></preformat> folder. Such tests are also implicitly inherent in the scripts provided in the <preformat preformat-type="code"><![CDATA[notebooks]]></preformat> and <preformat preformat-type="code"><![CDATA[verification]]></preformat> folders, since these notebooks run the entire chain. Moreover, continuous integration tests are embedded in the repository utilizing the <italic>poetry</italic> project (<uri>https://python-poetry.org/</uri>, last access: 6 November 2023).</p><?xmltex \hack{\newpage}?>
</sec>
</sec>
</sec>
<sec id="Ch1.S4">
  <label>4</label><title>Model validation</title>
      <p id="d1e4984">Here we verify the output of the <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> solver against analytical solutions for idealized cases for depth- and current-induced refraction. Model differences are given as the absolute relative difference between the analytical solution <inline-formula><mml:math id="M130" display="inline"><mml:mi mathvariant="normal">A</mml:mi></mml:math></inline-formula> and the numerical model solution <inline-formula><mml:math id="M131" display="inline"><mml:mi mathvariant="normal">B</mml:mi></mml:math></inline-formula> for an arbitrary variable <inline-formula><mml:math id="M132" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> as
          <disp-formula id="Ch1.E32" content-type="numbered"><label>32</label><mml:math id="M133" display="block"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:mi>z</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mfenced close="|" open="|"><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>z</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>z</mml:mi><mml:mi mathvariant="normal">B</mml:mi></mml:msub></mml:mrow><mml:mrow><mml:msub><mml:mi>z</mml:mi><mml:mi mathvariant="normal">A</mml:mi></mml:msub></mml:mrow></mml:mfrac></mml:mstyle></mml:mfenced><mml:mo>×</mml:mo><mml:mn mathvariant="normal">100</mml:mn><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
        given in the units of percentage.</p>
<sec id="Ch1.S4.SS1">
  <label>4.1</label><title>Snell's law</title>
      <?pagebreak page6523?><p id="d1e5062">When only considering the bathymetry, Snell's law,
            <disp-formula id="Ch1.E33" content-type="numbered"><label>33</label><mml:math id="M134" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub></mml:mrow><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          applies for parallel depth contours <xref ref-type="bibr" rid="bib1.bibx15" id="paren.18"><named-content content-type="pre">see Note 7A,</named-content><named-content content-type="post">p. 207</named-content></xref>. Here, subscripts <inline-formula><mml:math id="M135" display="inline"><mml:mn mathvariant="normal">1</mml:mn></mml:math></inline-formula> and <inline-formula><mml:math id="M136" display="inline"><mml:mn mathvariant="normal">2</mml:mn></mml:math></inline-formula>  indicate the properties of the wave and medium before and after being transmitted through an interface, which here are lines of different bathymetry, and <inline-formula><mml:math id="M137" display="inline"><mml:mi>c</mml:mi></mml:math></inline-formula> is the phase speed. The <inline-formula><mml:math id="M138" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> denotes the incidence angle between the wave ray and the normal to the interface, and <inline-formula><mml:math id="M139" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> is the angle of refraction after the interaction.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F4" specific-use="star"><?xmltex \currentcnt{4}?><?xmltex \def\figurename{Figure}?><label>Figure 4</label><caption><p id="d1e5168">Verifying the analytical solutions of Snell's law against the wave ray tracing solver for cases with idealized bathymetry (Eq. <xref ref-type="disp-formula" rid="Ch1.E33"/>) <bold>(a)</bold> and a shear current (Eq. <xref ref-type="disp-formula" rid="Ch1.E34"/>) <bold>(b)</bold>. The relative differences in <inline-formula><mml:math id="M140" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> (Eq. <xref ref-type="disp-formula" rid="Ch1.E32"/>) are given as insert text for both cases.</p></caption>
          <?xmltex \igopts{width=398.338583pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f04.png"/>

        </fig>

      <p id="d1e5203">In the presence of ambient currents, Snell's law can be written for a horizontally sheared current <inline-formula><mml:math id="M141" display="inline"><mml:mrow><mml:mi>V</mml:mi><mml:mo>=</mml:mo><mml:mi>V</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> <xref ref-type="bibr" rid="bib1.bibx19" id="paren.19"/>,
            <disp-formula id="Ch1.E34" content-type="numbered"><label>34</label><mml:math id="M142" display="block"><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>(</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>-</mml:mo><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mi>V</mml:mi><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>)</mml:mo><mml:msup><mml:mo>)</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Verification of the wave ray tracing model results against Eqs. (<xref ref-type="disp-formula" rid="Ch1.E33"/>) and (<xref ref-type="disp-formula" rid="Ch1.E34"/>) is shown in the upper and lower panels of Fig. <xref ref-type="fig" rid="Ch1.F4"/>, respectively. For the idealized bathymetry, the wave ray tracing was performed for a shallow-water wave with wavelength <inline-formula><mml:math id="M143" display="inline"><mml:mrow><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mn mathvariant="normal">000</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M144" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow></mml:math></inline-formula> propagating towards a stepwise shallower region.</p>
      <p id="d1e5326">Here, <inline-formula><mml:math id="M145" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi mathvariant="italic">ϕ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> was computed for each new depth regime (upper panel Fig. <xref ref-type="fig" rid="Ch1.F4"/>a). For the horizontally sheared current (Fig. <xref ref-type="fig" rid="Ch1.F4"/>b), a <inline-formula><mml:math id="M146" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M147" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period deep-water wave propagated through the current field where
            <disp-formula id="Ch1.E35" content-type="numbered"><label>35</label><mml:math id="M148" display="block"><mml:mrow><mml:mi>V</mml:mi><mml:mo>(</mml:mo><mml:mi>X</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable rowspacing="0.2ex" columnspacing="1em" class="cases" columnalign="left left" framespacing="0em"><mml:mtr><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd><mml:mtd><mml:mrow><mml:mtext>if</mml:mtext><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>X</mml:mi><mml:mo>&lt;</mml:mo><mml:mn mathvariant="normal">2000</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mo>,</mml:mo><mml:mi mathvariant="normal">m</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi mathvariant="normal">s</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mtext>if</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>X</mml:mi><mml:mo>≥</mml:mo><mml:mn mathvariant="normal">2000</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced></mml:mrow></mml:math></disp-formula>
          The relative differences in both the idealized bathymetry and horizontally sheared current cases listed above were <inline-formula><mml:math id="M149" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub><mml:mo>)</mml:mo><mml:mo>∼</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="italic">%</mml:mi></mml:mrow></mml:math></inline-formula> (Fig. <xref ref-type="fig" rid="Ch1.F4"/>). The script producing Fig. <xref ref-type="fig" rid="Ch1.F4"/> and computing the analytical results is available as a Jupyter notebook under <preformat preformat-type="code"><![CDATA[verification/snells_law.ipynb]]></preformat>.</p>
</sec>
<sec id="Ch1.S4.SS2">
  <label>4.2</label><title>Wave deflection</title>
      <p id="d1e5488">For deep-water waves, there is a direct relation between wave ray curvature and the vertical vorticity (henceforth vorticity) <inline-formula><mml:math id="M150" display="inline"><mml:mrow><mml:mi mathvariant="italic">ζ</mml:mi><mml:mo>=</mml:mo><mml:mo>∂</mml:mo><mml:mi>v</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>x</mml:mi><mml:mo>-</mml:mo><mml:mo>∂</mml:mo><mml:mi>u</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula> <xref ref-type="bibr" rid="bib1.bibx19 bib1.bibx9" id="paren.20"/>:
            <disp-formula id="Ch1.E36" content-type="numbered"><label>36</label><mml:math id="M151" display="block"><mml:mrow><mml:mi mathvariant="italic">ν</mml:mi><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mi mathvariant="italic">ζ</mml:mi><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          valid for <inline-formula><mml:math id="M152" display="inline"><mml:mrow><mml:mo>|</mml:mo><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>|</mml:mo><mml:mo>/</mml:mo><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub><mml:mo>≪</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>. Here, positive vorticity will deflect a wave to the left relative to its wave propagation direction and to the right for negative vorticity. The ratio with the wave group velocity also entails that shorter waves will deflect more compared with longer waves.</p>
      <p id="d1e5572">An approximate wave deflection angle can be computed from Eq. (<xref ref-type="disp-formula" rid="Ch1.E36"/>) by adding a characteristic <inline-formula><mml:math id="M153" display="inline"><mml:mrow><mml:mi mathvariant="italic">ζ</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="italic">ζ</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> and length scale <inline-formula><mml:math id="M154" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula> such that <xref ref-type="bibr" rid="bib1.bibx11" id="paren.21"/>
            <disp-formula id="Ch1.E37" content-type="numbered"><label>37</label><mml:math id="M155" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mi mathvariant="italic">ν</mml:mi></mml:msub><mml:mo>≃</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi mathvariant="italic">ζ</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mi>l</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>c</mml:mi><mml:mi mathvariant="normal">g</mml:mi></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          We use the idealized horizontally sheared current,
            <disp-formula id="Ch1.E38" content-type="numbered"><label>38</label><mml:math id="M156" display="block"><mml:mrow><mml:mi>U</mml:mi><mml:mo>(</mml:mo><mml:mi>X</mml:mi><mml:mo>,</mml:mo><mml:mi>Y</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable class="cases" rowspacing="0.2ex" columnspacing="1em" columnalign="left left" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mtext>if</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>X</mml:mi><mml:mo>&lt;</mml:mo><mml:mn mathvariant="normal">2500</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mi mathvariant="italic">α</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mtext>if</mml:mtext><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>X</mml:mi><mml:mo>≥</mml:mo><mml:mn mathvariant="normal">2500</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M157" display="inline"><mml:mi mathvariant="italic">α</mml:mi></mml:math></inline-formula> increases linearly from <inline-formula><mml:math id="M158" display="inline"><mml:mrow><mml:mi mathvariant="italic">α</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> at <inline-formula><mml:math id="M159" display="inline"><mml:mrow><mml:mi>y</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> to <inline-formula><mml:math id="M160" display="inline"><mml:mrow><mml:mi mathvariant="italic">α</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">m</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi mathvariant="normal">s</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> at <inline-formula><mml:math id="M161" display="inline"><mml:mrow><mml:mi>y</mml:mi><mml:mo>=</mml:mo><mml:mi>Y</mml:mi></mml:mrow></mml:math></inline-formula> such that <inline-formula><mml:math id="M162" display="inline"><mml:mi mathvariant="italic">ζ</mml:mi></mml:math></inline-formula> values are constant within the regions. An assessment of <inline-formula><mml:math id="M163" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mi mathvariant="italic">ν</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> for a <inline-formula><mml:math id="M164" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M165" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period deep-water wave propagated through Eq. (<xref ref-type="disp-formula" rid="Ch1.E38"/>) is shown in Fig. <xref ref-type="fig" rid="Ch1.F5"/>. Here, the solution in the lower panel also uses Eq. (<xref ref-type="disp-formula" rid="Ch1.E38"/>) but with a minus sign in front of <inline-formula><mml:math id="M166" display="inline"><mml:mi mathvariant="italic">α</mml:mi></mml:math></inline-formula>. Relative differences between the model and analytical solution are <inline-formula><mml:math id="M167" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mi mathvariant="italic">ν</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>∼</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">0</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> %. The difference is a sum of the numerical errors together with the approximate equality in Eq. (<xref ref-type="disp-formula" rid="Ch1.E37"/>). Furthermore, the difference between the simulation of the negative and positive vorticity <inline-formula><mml:math id="M168" display="inline"><mml:mi mathvariant="italic">ζ</mml:mi></mml:math></inline-formula> is also due to the advection of the current. Furthermore, the deflection direction for negative and positive <inline-formula><mml:math id="M169" display="inline"><mml:mi mathvariant="italic">ζ</mml:mi></mml:math></inline-formula> is readily seen in Fig. <xref ref-type="fig" rid="Ch1.F5"/>. The full analysis is available in the <preformat preformat-type="code"><![CDATA[verification/wave_deflection.ipynb]]></preformat> notebook in the GitHub repository.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F5" specific-use="star"><?xmltex \currentcnt{5}?><?xmltex \def\figurename{Figure}?><label>Figure 5</label><caption><p id="d1e5876">Verifying the approximate solutions of wave deflection (Eq. <xref ref-type="disp-formula" rid="Ch1.E37"/>) against the wave ray tracing output for cases with idealized negative <bold>(a)</bold> and positive vorticity <inline-formula><mml:math id="M170" display="inline"><mml:mi mathvariant="italic">ζ</mml:mi></mml:math></inline-formula> <bold>(b)</bold>. The associated velocity field <inline-formula><mml:math id="M171" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">U</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi>U</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> at <inline-formula><mml:math id="M172" display="inline"><mml:mrow><mml:mi>X</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">1</mml:mn></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> is given in the left column plots. The relative differences <inline-formula><mml:math id="M173" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mi mathvariant="italic">ν</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> [Eq. <xref ref-type="disp-formula" rid="Ch1.E32"/>] using <inline-formula><mml:math id="M174" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">2500</mml:mn></mml:mrow></mml:math></inline-formula> m are given for both cases (see insert text). Yellow lines denote the wave rays.</p></caption>
          <?xmltex \igopts{width=426.791339pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f05.png"/>

        </fig>

</sec>
<sec id="Ch1.S4.SS3">
  <label>4.3</label><title>Numerical convergence</title>
      <p id="d1e5989">The numerical convergence for decreasing values of the CFL number <inline-formula><mml:math id="M175" display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula> is tested for the conservation of absolute frequency <inline-formula><mml:math id="M176" display="inline"><mml:mi mathvariant="italic">ω</mml:mi></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E18"/>). For the idealized case of a deep-water wave propagating in the <inline-formula><mml:math id="M177" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> direction from a region with <inline-formula><mml:math id="M178" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> to a region with an opposing current <inline-formula><mml:math id="M179" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">m</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi mathvariant="normal">s</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, Eq. (<xref ref-type="disp-formula" rid="Ch1.E18"/>) requires
            <disp-formula id="Ch1.E39" content-type="numbered"><label>39</label><mml:math id="M180" display="block"><mml:mrow><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>+</mml:mo><mml:mi>k</mml:mi><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mtext>const.</mml:mtext><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="italic">ω</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where subscript <inline-formula><mml:math id="M181" display="inline"><mml:mn mathvariant="normal">0</mml:mn></mml:math></inline-formula> denotes the region with <inline-formula><mml:math id="M182" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>. For deep water, the phase speed <inline-formula><mml:math id="M183" display="inline"><mml:mrow><mml:mi>c</mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="italic">σ</mml:mi><mml:mo>/</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:math></inline-formula> such that Eq. (<xref ref-type="disp-formula" rid="Ch1.E39"/>) can be rearranged and
            <disp-formula id="Ch1.E40" content-type="numbered"><label>40</label><mml:math id="M184" display="block"><mml:mrow><mml:mi>k</mml:mi><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:msub><mml:mi>c</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow><mml:mrow><mml:mi>U</mml:mi><mml:mo>+</mml:mo><mml:mi>c</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          In our example, <inline-formula><mml:math id="M185" display="inline"><mml:mrow><mml:mi>k</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0.046</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M186" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow></mml:math></inline-formula><inline-formula><mml:math id="M187" display="inline"><mml:msup><mml:mi/><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:math></inline-formula> for a <inline-formula><mml:math id="M188" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M189" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave propagating into the region <inline-formula><mml:math id="M190" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">m</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi mathvariant="normal">s</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>. The numerical convergence for Eq. (<xref ref-type="disp-formula" rid="Ch1.E18"/>) is shown in Fig. <xref ref-type="fig" rid="Ch1.F6"/>. Here, the error <inline-formula><mml:math id="M191" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi mathvariant="italic">ω</mml:mi></mml:mrow></mml:math></inline-formula> decreases with decreasing <inline-formula><mml:math id="M192" display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula> due to the increasing number of time steps <inline-formula><mml:math id="M193" display="inline"><mml:mi>N</mml:mi></mml:math></inline-formula>. The error does not decrease monotonically, however, since <inline-formula><mml:math id="M194" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> must be solved sufficiently many times within the region where <inline-formula><mml:math id="M195" display="inline"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>U</mml:mi><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi>x</mml:mi><mml:mo>≠</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> to obtain its correct value. Nevertheless, the solution converges to the analytical solution with decreasing <inline-formula><mml:math id="M196" display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula> (see <inline-formula><mml:math id="M197" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mi mathvariant="normal">an</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> in Fig. <xref ref-type="fig" rid="Ch1.F6"/>). The test on the numerical convergence is available in the GitHub repository in the <preformat preformat-type="code"><![CDATA[verification/numerical_convergence_]]></preformat> <preformat preformat-type="code"><![CDATA[omega.ipynb]]></preformat> notebook.</p>
</sec>
</sec>
<sec id="Ch1.S5">
  <label>5</label><title>Examples of usage</title>
      <p id="d1e6328">Here we provide some use examples of the wave ray tracing model, which include simulations under idealized current and bathymetry fields and ambient conditions retrieved from an ocean circulation model. The code for running the tool is similar to the generic example given in Alg. <xref ref-type="other" rid="Ch1.Prog1"/> but with different ambient and initial conditions. The idealized current fields are part of the repository as a netCDF4 file and reproducible in the <preformat preformat-type="code"><![CDATA[notebooks/create_idealized_current_and_]]></preformat> <preformat preformat-type="code"><![CDATA[bathymetry.ipynb]]></preformat> notebook. The examples include<?pagebreak page6524?> specifying different initial conditions as well as utilizing the ancillary functions described in Sect. <xref ref-type="sec" rid="Ch1.S3.SS4.SSS1"/>.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F6" specific-use="star"><?xmltex \currentcnt{6}?><?xmltex \def\figurename{Figure}?><label>Figure 6</label><caption><p id="d1e6343">The numerical convergence tested for conservation of absolute frequency <inline-formula><mml:math id="M198" display="inline"><mml:mi mathvariant="italic">ω</mml:mi></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E18"/>). The convergence is tested for an increasing number of discrete time indices <inline-formula><mml:math id="M199" display="inline"><mml:mi>n</mml:mi></mml:math></inline-formula> with an accompanied decreasing Courant number <inline-formula><mml:math id="M200" display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula>. Here, a domain with velocity field <inline-formula><mml:math id="M201" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> for <inline-formula><mml:math id="M202" display="inline"><mml:mrow><mml:mi>X</mml:mi><mml:mo>&lt;</mml:mo><mml:mn mathvariant="normal">2000</mml:mn></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M203" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula> for <inline-formula><mml:math id="M204" display="inline"><mml:mrow><mml:mi>X</mml:mi><mml:mo>≧</mml:mo><mml:mn mathvariant="normal">2000</mml:mn></mml:mrow></mml:math></inline-formula>, where <inline-formula><mml:math id="M205" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>X</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">100</mml:mn></mml:mrow></mml:math></inline-formula> m (see dashed vertical lines), was used. The analytical value <inline-formula><mml:math id="M206" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mi mathvariant="normal">an</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is obtained from Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>). The relative error <inline-formula><mml:math id="M207" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ω</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>-</mml:mo><mml:mi mathvariant="italic">ω</mml:mi><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:msub><mml:mi mathvariant="italic">ω</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> decreases with <inline-formula><mml:math id="M208" display="inline"><mml:mi>C</mml:mi></mml:math></inline-formula>. The results here are obtained by using the RK4 scheme, but similar results are obtained using the FE (not shown). </p></caption>
        <?xmltex \igopts{width=426.791339pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f06.png"/>

      </fig>

<sec id="Ch1.S5.SS1">
  <label>5.1</label><title>Idealized cases</title>
      <p id="d1e6498">Cases with depth-induced refraction are shown in Fig. <xref ref-type="fig" rid="Ch1.F7"/>. Here the idealized cases show the expected veering of wave rays towards shallower regions when the deep-water limit <inline-formula><mml:math id="M209" display="inline"><mml:mrow><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>/</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>≫</mml:mo><mml:mi>d</mml:mi></mml:mrow></mml:math></inline-formula> is no longer applicable. The examples also show how the initial position <inline-formula><mml:math id="M210" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold">r</mml:mi><mml:mrow><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula> can be set differently using the different sides of the domain (i.e., <preformat preformat-type="code"><![CDATA[left]]></preformat> and <preformat preformat-type="code"><![CDATA[bottom]]></preformat> in Fig. <xref ref-type="fig" rid="Ch1.F7"/>a, c, d) and from a single point with the initial propagation angle uniformly distributed in a sector (Fig. <xref ref-type="fig" rid="Ch1.F7"/>b).</p>

      <?xmltex \floatpos{p}?><fig id="Ch1.F7" specific-use="star"><?xmltex \currentcnt{7}?><?xmltex \def\figurename{Figure}?><label>Figure 7</label><caption><p id="d1e6548">Examples of depth refraction of a long crested 10 <inline-formula><mml:math id="M211" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave using various initial positions and initial propagation directions (red arrows), for two different depth profiles in the upper <bold>(a, b)</bold> and lower panels <bold>(c, d)</bold>. Waves with <inline-formula><mml:math id="M212" display="inline"><mml:mrow><mml:mstyle displaystyle="false"><mml:mfrac style="text"><mml:mi mathvariant="italic">λ</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:mfrac></mml:mstyle><mml:mo>≪</mml:mo><mml:mi>d</mml:mi></mml:mrow></mml:math></inline-formula> (<inline-formula><mml:math id="M213" display="inline"><mml:mrow><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">156</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M214" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow></mml:math></inline-formula> on deep water, white contour lines) will not “feel” the bottom and thus not be refracted.</p></caption>
          <?xmltex \igopts{width=412.564961pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f07.png"/>

        </fig>

      <?xmltex \floatpos{p}?><fig id="Ch1.F8" specific-use="star"><?xmltex \currentcnt{8}?><?xmltex \def\figurename{Figure}?><label>Figure 8</label><caption><p id="d1e6610">Examples of current-induced refraction under different flow regimes and initial propagation directions (blue lines). Panel <bold>(a)</bold> denotes the evolution of the wave crest (orange lines) as it rides along a current jet (see current profile <inline-formula><mml:math id="M215" display="inline"><mml:mrow><mml:mi>U</mml:mi><mml:mo>(</mml:mo><mml:mi>y</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> in <bold>b</bold>). In panel <bold>(b)</bold> the current jet is opposing the waves, inducing focal points in the middle of the jet. Panel <bold>(c)</bold> shows how a characteristic current whirl impacts the wave propagation paths, and <bold>(d)</bold> denotes the relation between deflection angle and the vorticity, <inline-formula><mml:math id="M216" display="inline"><mml:mi mathvariant="italic">ζ</mml:mi></mml:math></inline-formula>. </p></caption>
          <?xmltex \igopts{width=412.564961pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f08.png"/>

        </fig>

      <p id="d1e6657">Cases with current-induced refraction in deep water are shown in Fig. <xref ref-type="fig" rid="Ch1.F8"/>. Examples of wave trains both following and opposing a horizontally sheared current are provided (Fig. <xref ref-type="fig" rid="Ch1.F8"/>a, b). The ambient current causes areas of converging and crossing wave rays, which are known as caustics or focal points. Furthermore, an example of waves propagating through an idealized oceanic eddy is shown (Figs. <xref ref-type="fig" rid="Ch1.F8"/>c, d).</p>
      <p id="d1e6666">The joint effect of current- and depth-induced refraction at intermediate depth is shown in Fig. <xref ref-type="fig" rid="Ch1.F9"/>. Here, the <preformat preformat-type="code"><![CDATA[ray_density]]></preformat> method is used to highlight the different focal points obtained in deep water and when the waves are also influenced by the bathymetry.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F9" specific-use="star"><?xmltex \currentcnt{9}?><?xmltex \def\figurename{Figure}?><label>Figure 9</label><caption><p id="d1e6676">The impact of depth and current refraction on horizontal wave height variability as seen through wave ray density plots. Panel <bold>(a)</bold> shows results using the wave ray density method for a current whirl on deep water (see Fig. <xref ref-type="fig" rid="Ch1.F8"/>c). Panel <bold>(b)</bold> shows the impact on wave ray density for the same current whirl but on intermediate depths, i.e., adding the bathymetry in Fig. <xref ref-type="fig" rid="Ch1.F7"/>c. Panel <bold>(c)</bold> denotes the difference in the wave ray paths between the two cases.</p></caption>
          <?xmltex \igopts{width=426.791339pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f09.png"/>

        </fig>

      <p id="d1e6698">All the examples listed above are available in the <preformat preformat-type="code"><![CDATA[notebooks/idealized_examples.ipynb]]></preformat> notebook.</p>
</sec>
<sec id="Ch1.S5.SS2">
  <label>5.2</label><title>Ocean-model output</title>
      <p id="d1e6713">Examples of using surface currents and bathymetry extracted from the operational coastal ocean circulation model at the Norwegian Meteorological Institute <xref ref-type="bibr" rid="bib1.bibx1" id="paren.22"/> as input in wave tracing simulations are shown for different regions in Fig. <xref ref-type="fig" rid="Ch1.F10"/>. Here, the <preformat preformat-type="code"><![CDATA[to_latlon()]]></preformat> method has been used together with <preformat preformat-type="code"><![CDATA[to_ds()]]></preformat> in order to visualize the output on a georeferenced map. Figure <xref ref-type="fig" rid="Ch1.F10"/>b denotes the refraction due to currents and bathymetry (red rays), compared with bathymetry only (yellow rays). There are clear differences between the wave rays with and without currents. The current field used here spanned four model output time steps with an hourly temporal resolution. Figure <xref ref-type="fig" rid="Ch1.F10"/>c and d show how the wave kinematics are affected by a barotropic tidal current under two characteristic cycles. In the lower left panel, the tidal current gives rise to a focal point and crossing wave rays. Cases similar to the latter two were investigated in <xref ref-type="bibr" rid="bib1.bibx13" id="text.23"/>, comparing the results with output from a spectral wave model (Eq. <xref ref-type="disp-formula" rid="Ch1.E19"/>). The examples provided here are available in the <preformat preformat-type="code"><![CDATA[notebooks/ocean_model_example.ipynb]]></preformat> notebook.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F10" specific-use="star"><?xmltex \currentcnt{10}?><?xmltex \def\figurename{Figure}?><label>Figure 10</label><caption><p id="d1e6742">The impact of currents and bathymetry on wave propagation paths using current and bathymetry fields from an 800 <inline-formula><mml:math id="M217" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">m</mml:mi></mml:mrow></mml:math></inline-formula> resolution Regional Ocean Modeling System (ROMS) model in Northern Norway <bold>(a)</bold>. <bold>(b)</bold> Subset in the red rectangle in <bold>(a)</bold>; it shows how time-varying surface currents (i.e., four model time steps) impact the wave propagation paths for a <inline-formula><mml:math id="M218" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M219" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave (red rays) when compared to refraction due to bathymetry only (yellow rays). <bold>(c, d)</bold> Subset in the orange rectangle in <bold>(a)</bold>; panels <bold>(c)</bold> and <bold>(d)</bold> show the impact of a tidal current on the wave propagation paths for a <inline-formula><mml:math id="M220" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M221" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave <bold>(c)</bold> and a <inline-formula><mml:math id="M222" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">7</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M223" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave <bold>(d)</bold>. Here, arrows denote the direction of the ambient current.</p></caption>
          <?xmltex \igopts{width=398.338583pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f10.png"/>

        </fig>

      <?pagebreak page6528?><p id="d1e6848">The famous textbook example of trapped waves in the Agulhas Current east of South Africa is shown in Fig. <xref ref-type="fig" rid="Ch1.F11"/>. Here, the wave tracing simulations used the surface current from the ESA's GlobCurrent project (<uri>https://data.marine.copernicus.eu/product/MULTIOBS_GLO_PHY_REP_015_004/description</uri>, last access: 6 November 2023). The particular point in time for the simulation is the same as used in <xref ref-type="bibr" rid="bib1.bibx22" id="text.24"/> (i.e., 4 January 2016, see their Figs. 14–15) but here with an apparently coarser horizontal resolution in the current forcing.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F11" specific-use="star"><?xmltex \currentcnt{11}?><?xmltex \def\figurename{Figure}?><label>Figure 11</label><caption><p id="d1e6862">Focusing of wave rays by the Agulhas Current. Here, surface current data from the GlobCurrent project are used from 4 January 2016 <bold>(a)</bold>. The data are originally given in spherical latitude and longitude coordinates but are approximated here in the area of interest to equidistant Cartesian coordinates with 22 and 28 km spatial resolution in the <inline-formula><mml:math id="M224" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M225" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula> directions, respectively. The famous trapping of wave rays within the branch of the Agulhas Current is shown in <bold>(b)</bold> using a <inline-formula><mml:math id="M226" display="inline"><mml:mrow><mml:mi>T</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">10</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M227" display="inline"><mml:mrow class="unit"><mml:mi mathvariant="normal">s</mml:mi></mml:mrow></mml:math></inline-formula> period wave. The duration of the run was 62 h, and 18 consecutive model output times (temporal resolution of 3 h) were used.</p></caption>
          <?xmltex \igopts{width=483.69685pt}?><graphic xlink:href="https://gmd.copernicus.org/articles/16/6515/2023/gmd-16-6515-2023-f11.png"/>

        </fig>

</sec>
</sec>
<sec id="Ch1.S6" sec-type="conclusions">
  <label>6</label><title>Discussion and concluding remarks</title>
      <p id="d1e6921">We have presented a Python-based, open-source, finite-difference ray tracing model for arbitrary depths at variable currents. The <preformat preformat-type="code"><![CDATA[Wave_tracing]]></preformat> module has been tested and verified against analytical solutions and tested for numerical convergence. The solver comes with a set of ancillary functions aimed at supporting relevant workflows for data retrieval, transformation, and visualization in the scientific community as well as being compatible with the standardized Climate and Forecast (CF) metadata conventions. Such workflows have been documented and are available in the repository as examples for the end users.</p>
      <p id="d1e6927">To the best of our knowledge, no such modeling tool is openly available in a high-level computing language despite its usefulness for the investigation and quantification of the impact of  ambient currents and bathymetry on the wave field <xref ref-type="bibr" rid="bib1.bibx30 bib1.bibx31 bib1.bibx2 bib1.bibx26 bib1.bibx7 bib1.bibx13 bib1.bibx32 bib1.bibx34 bib1.bibx11 bib1.bibx29 bib1.bibx22 bib1.bibx6" id="paren.25"><named-content content-type="pre">e.g.,</named-content></xref>.</p>
      <p id="d1e6935">The solver is applicable to waves in finite depth, which is in contrast to previously reported models which handle only current-induced refraction in deep water <xref ref-type="bibr" rid="bib1.bibx6 bib1.bibx7 bib1.bibx27 bib1.bibx19 bib1.bibx29 bib1.bibx22" id="paren.26"><named-content content-type="pre">e.g.,</named-content></xref>. For intermediate depths, the joint effect of current- and depth-induced refraction can be very important for the wave height variability (Fig. <xref ref-type="fig" rid="Ch1.F9"/>). Such examples were presented in <xref ref-type="bibr" rid="bib1.bibx13" id="text.27"/> and <xref ref-type="bibr" rid="bib1.bibx31" id="text.28"/>, where the combined refraction of wave rays due to the ambient current and bathymetry caused focusing, which led to a significant increase in the local wave height (see Fig. 11 in <xref ref-type="bibr" rid="bib1.bibx13" id="altparen.29"/> and Fig. 14 in <xref ref-type="bibr" rid="bib1.bibx31" id="altparen.30"/>).</p>
      <p id="d1e6958">The effect of vertically sheared currents is usually neglected in coupled wave model simulations since it is a second-order effect. However, in strong baroclinic environments, such shear may strongly affect the absolute angular frequency <xref ref-type="bibr" rid="bib1.bibx36" id="paren.31"/>. In <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat>, the impact of vertically sheared currents can be accounted for by computing an effective depth-integrated current <xref ref-type="bibr" rid="bib1.bibx20" id="paren.32"><named-content content-type="pre">e.g.,</named-content></xref>. Such an extension is easy to add as an optional method in the ray tracing model initialization due to the class structure (see Sect. <xref ref-type="sec" rid="Ch1.S3.SS3.SSS2"/>), given that the input ambient current field is three-dimensional. However, and as shown by <xref ref-type="bibr" rid="bib1.bibx8" id="text.33"/>, care should be taken since numerical errors can be introduced in the computation of an effective current from horizontally varying 3D sheared currents with coarse vertical resolution. An implementation of the effective current is planned as a future extension in <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat>.</p>
      <p id="d1e6982">The <preformat preformat-type="code"><![CDATA[ocean_wave_tracing]]></preformat> module does not support wave reflection. Such processes are complex but could be added later. This means that wave rays can essentially propagate through land and out of the model domain. Such effects are, however, circumvented by using <italic>numpy</italic>'s masked arrays and not-a-number (NaN) values. For instance in the <preformat preformat-type="code"><![CDATA[bathymetry_checker]]></preformat>, negative bathymetry values will be treated as land and set to a <italic>numpy</italic> NaN. When plotting, <preformat preformat-type="code"><![CDATA[NaN]]></preformat> values do not appear. Furthermore, masked values are often standard in ocean circulation models, and thus wave rays “stop” when entering land grid points (see Fig. <xref ref-type="fig" rid="Ch1.F10"/>).</p>
      <p id="d1e7003">Solving the ray equation using a high-level language such as Python gives added execution time and memory usage compared to lower-level languages. However, execution times are normally on the order of <inline-formula><mml:math id="M228" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> s but will obviously increase with the number of time steps <preformat preformat-type="code"><![CDATA[nt]]></preformat>. It is possible to further speed up the code by utilizing other modules and by making the code base more dense in terms of reducing the amount of code. However, the objective of the wave ray tracing tool described here is neither to create a substitute to wave models nor to optimize it for large and/or long simulations. It is rather to provide a framework that is easy to understand and simple to run. In addition, a comprehensible code base makes the tool suitable for further development by other contributors. Furthermore, best practices like vectorization have been used in order to speed up the solver, without loss of general readability of the code.</p>
</sec>

      
      </body>
    <back><notes notes-type="codedataavailability"><title>Code and data availability</title>

      <p id="d1e7024">The source code is available at <uri>https://github.com/hevgyrt/ocean_wave_tracing</uri> (last access: 6 November 2023) under a GPL v.3 license with DOI <ext-link xlink:href="https://doi.org/10.5281/zenodo.7602540" ext-link-type="DOI">10.5281/zenodo.7602540</ext-link> <xref ref-type="bibr" rid="bib1.bibx14" id="paren.34"/>. ROMS data from MET Norway is available on under a free an open data policy at <uri>https://thredds.met.no/thredds/fou-hi/norkyst800v2.html?dataset=norkyst800m_1h_be</uri> <xref ref-type="bibr" rid="bib1.bibx1" id="paren.35"/>. This study has been conducted using E.U. Copernicus Marine Service Information, specifically using the ESA GlobCurrent dataset;  <ext-link xlink:href="https://doi.org/10.48670/moi-00050" ext-link-type="DOI">10.48670/moi-00050</ext-link> <xref ref-type="bibr" rid="bib1.bibx12" id="paren.36"/>.</p>
  </notes><app-group>
        <supplementary-material position="anchor"><p id="d1e7049">The supplement related to this article is available online at: <inline-supplementary-material xlink:href="https://doi.org/10.5194/gmd-16-6515-2023-supplement" xlink:title="pdf">https://doi.org/10.5194/gmd-16-6515-2023-supplement</inline-supplementary-material>.</p></supplementary-material>
        </app-group><notes notes-type="authorcontribution"><title>Author contributions</title>

      <p id="d1e7058">TH designed and implemented the software, including the formal analysis and model validation, and wrote the manuscript draft. GH supported the development and GitHub integration. GH, KHC, and ØB reviewed and edited the manuscript.</p>
  </notes><notes notes-type="competinginterests"><title>Competing interests</title>

      <?pagebreak page6529?><p id="d1e7064">The contact author has declared that none of the authors has any competing interests.</p>
  </notes><notes notes-type="disclaimer"><title>Disclaimer</title>

      <p id="d1e7070">Publisher’s note: Copernicus Publications remains neutral with regard to jurisdictional claims made in the text, published maps, institutional affiliations, or any other geographical representation in this paper. While Copernicus Publications makes every effort to include appropriate place names, the final responsibility lies with the authors.</p>
  </notes><ack><title>Acknowledgements</title><p id="d1e7076">This research was partly funded by the Research Council of Norway through the project MATNOC (grant no. 308796). Trygve Halsne and Øyvind Breivik are grateful for additional support from the Research Council of Norway through the StormRisk project (grant no. 300608).</p></ack><notes notes-type="financialsupport"><title>Financial support</title>

      <p id="d1e7081">This  research has been supported by the Norges Forskningsråd (grant nos. MATNOC 308796 and Stormrisk 300608).</p>
  </notes><notes notes-type="reviewstatement"><title>Review statement</title>

      <p id="d1e7088">This paper was edited by P. N. Vinayachandran and reviewed by Leonel Romero and one anonymous referee.</p>
  </notes><ref-list>
    <title>References</title>

      <ref id="bib1.bibx1"><?xmltex \def\ref@label{{Albretsen et~al.(2011)}}?><label>Albretsen et al.(2011)</label><?label data?><mixed-citation>Albretsen, J., Sperrevik, A. K., Staalstrøm, A., Sandvik, A. D., Vikebø, F., and Asplin, L.: NorKyst-800 report no. 1: User manual and technical descriptions, Tech. Rep. 2, Institute of Marine Research, Bergen, Norway, <uri>https://www.hi.no/en/hi/nettrapporter/fisken-og-havet/2011/fh_2-2011_til_web</uri> (last access: 6 November 2023), 2011.</mixed-citation></ref>
      <ref id="bib1.bibx2"><?xmltex \def\ref@label{{Ardhuin et~al.(2012)Ardhuin, Roland, Dumas, Bennis, Sentchev, Forget,
Wolf, Girard, Osuna, and Benoit}}?><label>Ardhuin et al.(2012)Ardhuin, Roland, Dumas, Bennis, Sentchev, Forget, Wolf, Girard, Osuna, and Benoit</label><?label ardhuin_numerical_2012?><mixed-citation>Ardhuin, F., Roland, A., Dumas, F., Bennis, A.-C., Sentchev, A., Forget, P., Wolf, J., Girard, F., Osuna, P., and Benoit, M.: Numerical Wave Modeling in Conditions with Strong Currents: Dissipation, Refraction, and Relative Wind, J. Phys. Oceanogr., 42, 2101–2120,  <ext-link xlink:href="https://doi.org/10.1175/JPO-D-11-0220.1" ext-link-type="DOI">10.1175/JPO-D-11-0220.1</ext-link>, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx3"><?xmltex \def\ref@label{{Ardhuin et~al.(2017)Ardhuin, Gille, Menemenlis, Rocha, Rascle,
Chapron, Gula, and Molemaker}}?><label>Ardhuin et al.(2017)Ardhuin, Gille, Menemenlis, Rocha, Rascle, Chapron, Gula, and Molemaker</label><?label ardhuin_small-scale_2017?><mixed-citation>Ardhuin, F., Gille, S. T., Menemenlis, D., Rocha, C. B., Rascle, N., Chapron, B., Gula, J., and Molemaker, J.: Small-scale open ocean currents have large effects on wind wave heights, J. Geophys. Res.-Oceans, 122, 4500–4517, <ext-link xlink:href="https://doi.org/10.1002/2016JC012413" ext-link-type="DOI">10.1002/2016JC012413</ext-link>, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx4"><?xmltex \def\ref@label{{Babanin et~al.(2017)Babanin, van~der Weshuijsen, Chalikov, and
Rogers}}?><label>Babanin et al.(2017)Babanin, van der Weshuijsen, Chalikov, and Rogers</label><?label babanin_advanced_2017?><mixed-citation>Babanin, A. V., van der Weshuijsen, A., Chalikov, D., and Rogers, W. E.: Advanced wave modeling, including wave-current interaction, J. Mar. Res., 75, 239–262, <ext-link xlink:href="https://doi.org/10.1357/002224017821836798" ext-link-type="DOI">10.1357/002224017821836798</ext-link>, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx5"><?xmltex \def\ref@label{{Bretherton and Garrett(1968)}}?><label>Bretherton and Garrett(1968)</label><?label bretherton_wavetrains_1968?><mixed-citation> Bretherton, F. P. and Garrett, C. J. R.: Wavetrains in Inhomogeneous Moving Media, P. Roy. Soc. Lond. A Mat., 302, 529–554, ISSN 0080-4630, 1968.</mixed-citation></ref>
      <ref id="bib1.bibx6"><?xmltex \def\ref@label{{Bôas and Young(2020)}}?><label>Bôas and Young(2020)</label><?label boas_directional_2020?><mixed-citation>Bôas, A. B. V. and Young, W. R.: Directional diffusion of surface gravity wave action by ocean macroturbulence, J. Fluid Mech., 890, 1469–7645, <ext-link xlink:href="https://doi.org/10.1017/jfm.2020.116" ext-link-type="DOI">10.1017/jfm.2020.116</ext-link>, 2020.</mixed-citation></ref>
      <ref id="bib1.bibx7"><?xmltex \def\ref@label{{Bôas et~al.(2020)Bôas, Cornuelle, Mazloff, Gille, and
Ardhuin}}?><label>Bôas et al.(2020)Bôas, Cornuelle, Mazloff, Gille, and Ardhuin</label><?label boas_wave-current_2020?><mixed-citation>Bôas, A. B. V., Cornuelle, B. D., Mazloff, M. R., Gille, S. T., and Ardhuin, F.: Wave-Current Interactions at Meso- and Submesoscales: Insights from Idealized Numerical Simulations, J. Phys. Oceanogr., 50, 3483–3500, <ext-link xlink:href="https://doi.org/10.1175/JPO-D-20-0151.1" ext-link-type="DOI">10.1175/JPO-D-20-0151.1</ext-link>, 2020.</mixed-citation></ref>
      <ref id="bib1.bibx8"><?xmltex \def\ref@label{{Calvino et~al.(2022)Calvino, Dabrowski, and
Dias}}?><label>Calvino et al.(2022)Calvino, Dabrowski, and Dias</label><?label calvino_theoretical_2022?><mixed-citation>Calvino, C., Dabrowski, T., and Dias, F.: Theoretical and applied considerations in depth-integrated currents for third-generation wave models, AIP Adv., 12, 015017,  <ext-link xlink:href="https://doi.org/10.1063/5.0077871" ext-link-type="DOI">10.1063/5.0077871</ext-link>, 2022.</mixed-citation></ref>
      <ref id="bib1.bibx9"><?xmltex \def\ref@label{{Dysthe(2001)}}?><label>Dysthe(2001)</label><?label dysthe_refraction_2001?><mixed-citation>Dysthe, K. B.: Refraction of gravity waves by weak current gradients, J. Fluid Mech., 442, 157–159, <ext-link xlink:href="https://doi.org/10.1017/S0022112001005237" ext-link-type="DOI">10.1017/S0022112001005237</ext-link>, 2001.</mixed-citation></ref>
      <?pagebreak page6530?><ref id="bib1.bibx10"><?xmltex \def\ref@label{{Eckart(1952)}}?><label>Eckart(1952)</label><?label eckart_propagation_1952?><mixed-citation>Eckart, C.: The propagation of gravity waves from deep to shallow water, <uri>https://ui.adsabs.harvard.edu/abs/1952grwa.conf..165E</uri> (last access: 6 November 2023), U. S. National Bureau of Standards, 1952.</mixed-citation></ref>
      <ref id="bib1.bibx11"><?xmltex \def\ref@label{{Gallet and Young(2014)}}?><label>Gallet and Young(2014)</label><?label gallet_refraction_2014?><mixed-citation>Gallet, B. and Young, W. R.: Refraction of swell by surface currents, J. Mar. Res., 72, 105–126, <ext-link xlink:href="https://doi.org/10.1357/002224014813758959" ext-link-type="DOI">10.1357/002224014813758959</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx12"><?xmltex \def\ref@label{{GlobCurrent E.U. Copernicus Marine Service Information(2022)}}?><label>GlobCurrent E.U. Copernicus Marine Service Information(2022)</label><?label datanew?><mixed-citation>GlobCurrent E.U. Copernicus Marine Service Information (CMEMS): Global Total Surface and 15m Current (COPERNICUS-GLOBCURRENT) from Altimetric Geostrophic Current  and Modeled Ekman Current Reprocessing, Marine Data Store (MDS) [data set], <ext-link xlink:href="https://doi.org/10.48670/moi-00050" ext-link-type="DOI">10.48670/moi-00050</ext-link>, 2022.</mixed-citation></ref>
      <ref id="bib1.bibx13"><?xmltex \def\ref@label{{Halsne et~al.(2022)Halsne, Bohlinger, Christensen, Carrasco, and
Breivik}}?><label>Halsne et al.(2022)Halsne, Bohlinger, Christensen, Carrasco, and Breivik</label><?label halsne_resolving_2022?><mixed-citation>Halsne, T., Bohlinger, P., Christensen, K. H., Carrasco, A., and Breivik, Ø.: Resolving regions known for intense wave–current interaction using spectral wave models: A case study in the energetic flow fields of Northern Norway, Ocean Model., 176, 102071, <ext-link xlink:href="https://doi.org/10.1016/j.ocemod.2022.102071" ext-link-type="DOI">10.1016/j.ocemod.2022.102071</ext-link>, 2022.</mixed-citation></ref>
      <ref id="bib1.bibx14"><?xmltex \def\ref@label{{Halsne et~al.(2023)}}?><label>Halsne et al.(2023)</label><?label code?><mixed-citation>Halsne, T., Christensen, K. H., Hope, G., and Breivik, Ø.: Model repository, Zenodo [code], <ext-link xlink:href="https://doi.org/10.5281/zenodo.7602540" ext-link-type="DOI">10.5281/zenodo.7602540</ext-link>, 2023.</mixed-citation></ref>
      <ref id="bib1.bibx15"><?xmltex \def\ref@label{{Holthuijsen(2007)}}?><label>Holthuijsen(2007)</label><?label holthuijsen_waves_2007?><mixed-citation>Holthuijsen, L. H.: Waves in Oceanic and Coastal Waters, Cambridge University Press, <ext-link xlink:href="https://doi.org/10.1017/CBO9780511618536" ext-link-type="DOI">10.1017/CBO9780511618536</ext-link>, 2007.</mixed-citation></ref>
      <ref id="bib1.bibx16"><?xmltex \def\ref@label{{Irvine and Tilley(1988)}}?><label>Irvine and Tilley(1988)</label><?label irvine_ocean_1988?><mixed-citation>Irvine, D. E. and Tilley, D. G.: Ocean wave directional spectra and wave-current interaction in the Agulhas from the Shuttle Imaging Radar-B synthetic aperture radar, J. Geophys. Res.-Oceans, 93, 15389–15401, <ext-link xlink:href="https://doi.org/10.1029/JC093iC12p15389" ext-link-type="DOI">10.1029/JC093iC12p15389</ext-link>, 1988.</mixed-citation></ref>
      <ref id="bib1.bibx17"><?xmltex \def\ref@label{{Johnson(1947)}}?><label>Johnson(1947)</label><?label johnson_refraction_1947?><mixed-citation>Johnson, J. W.: The refraction of surface waves by currents, Eos, Transactions American Geophysical Union, 28, 867–874, <ext-link xlink:href="https://doi.org/10.1029/TR028i006p00867" ext-link-type="DOI">10.1029/TR028i006p00867</ext-link>, 1947.</mixed-citation></ref>
      <ref id="bib1.bibx18"><?xmltex \def\ref@label{{Jones(2000)}}?><label>Jones(2000)</label><?label jones_numerical_2000?><mixed-citation>Jones, B.: A Numerical Study of Wave Refraction in Shallow Tidal Waters, Estuar. Coast. Shelf Sci., 51, 331–347, <ext-link xlink:href="https://doi.org/10.1006/ecss.2000.0679" ext-link-type="DOI">10.1006/ecss.2000.0679</ext-link>, 2000.</mixed-citation></ref>
      <ref id="bib1.bibx19"><?xmltex \def\ref@label{{Kenyon(1971)}}?><label>Kenyon(1971)</label><?label kenyon_wave_1971?><mixed-citation>Kenyon, K. E.: Wave refraction in ocean currents, Deep-Sea Res., 18, 1023–1034, <ext-link xlink:href="https://doi.org/10.1016/0011-7471(71)90006-4" ext-link-type="DOI">10.1016/0011-7471(71)90006-4</ext-link>, 1971.</mixed-citation></ref>
      <ref id="bib1.bibx20"><?xmltex \def\ref@label{{Kirby and Chen(1989)}}?><label>Kirby and Chen(1989)</label><?label kirby_surface_1989?><mixed-citation>Kirby, J. T. and Chen, T.-M.: Surface waves on vertically sheared flows: Approximate dispersion relations, J. Geophys. Res.-Oceans, 94, 1013–1027,  <ext-link xlink:href="https://doi.org/10.1029/JC094iC01p01013" ext-link-type="DOI">10.1029/JC094iC01p01013</ext-link>, 1989.</mixed-citation></ref>
      <ref id="bib1.bibx21"><?xmltex \def\ref@label{{Komen et~al.(1994)Komen, Cavaleri, Doneland, Hasselmann, Hasselmann,
and Janssen}}?><label>Komen et al.(1994)Komen, Cavaleri, Doneland, Hasselmann, Hasselmann, and Janssen</label><?label komen_dynamics_1994?><mixed-citation>Komen, G. J., Cavaleri, L., Doneland, M., Hasselmann, K., Hasselmann, S., and Janssen, P. A. E. M. (Eds.): Dynamics and Modelling of Ocean Waves, Cambridge Univeristy Press, <ext-link xlink:href="https://doi.org/10.1017/CBO9780511628955" ext-link-type="DOI">10.1017/CBO9780511628955</ext-link>, 1994.</mixed-citation></ref>
      <ref id="bib1.bibx22"><?xmltex \def\ref@label{{Kudryavtsev et~al.(2017)Kudryavtsev, Yurovskaya, Chapron, Collard,
and Donlon}}?><label>Kudryavtsev et al.(2017)Kudryavtsev, Yurovskaya, Chapron, Collard, and Donlon</label><?label kudryavtsev_sun_2017-1?><mixed-citation> Kudryavtsev, V., Yurovskaya, M., Chapron, B., Collard, F., and Donlon, C.: Sun glitter imagery of surface waves. Part 2: Waves transformation on ocean currents, J. Geophys. Res.-Oceans, 122, 1384–1399, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx23"><?xmltex \def\ref@label{{Langtangen(2016)}}?><label>Langtangen(2016)</label><?label langtangen_primer_2016?><mixed-citation>Langtangen, H. P.: A Primer on Scientific Programming with Python, vol. 6 of Texts in Computational Science and Engineering, Springer, Berlin, Heidelberg, ISBN 978-3-662-49886-6 978-3-662-49887-3, <ext-link xlink:href="https://doi.org/10.1007/978-3-662-49887-3" ext-link-type="DOI">10.1007/978-3-662-49887-3</ext-link>, 2016.</mixed-citation></ref>
      <ref id="bib1.bibx24"><?xmltex \def\ref@label{{Liu et~al.(1994)Liu, Peng, and Schumacher}}?><label>Liu et al.(1994)Liu, Peng, and Schumacher</label><?label liu_wave-current_1994?><mixed-citation>Liu, A. K., Peng, C. Y., and Schumacher, J. D.: Wave-current interaction study in the Gulf of Alaska for detection of eddies by synthetic aperture radar, J. Geophys. Res.-Oceans, 99, 10075–10085,  <ext-link xlink:href="https://doi.org/10.1029/94JC00422" ext-link-type="DOI">10.1029/94JC00422</ext-link>, 1994.</mixed-citation></ref>
      <ref id="bib1.bibx25"><?xmltex \def\ref@label{{Mapp et~al.(1985)Mapp, Welch, and Munday}}?><label>Mapp et al.(1985)Mapp, Welch, and Munday</label><?label mapp_wave_1985?><mixed-citation>Mapp, G. R., Welch, C. S., and Munday, J. C.: Wave refraction by warm core rings, J. Geophys. Res., 90, 7153, <ext-link xlink:href="https://doi.org/10.1029/JC090iC04p07153" ext-link-type="DOI">10.1029/JC090iC04p07153</ext-link>, 1985.</mixed-citation></ref>
      <ref id="bib1.bibx26"><?xmltex \def\ref@label{{Masson(1996)}}?><label>Masson(1996)</label><?label masson_case_1996?><mixed-citation>Masson, D.: A Case Study of Wave–Current Interaction in a Strong Tidal Current, J. Phys. Oceanogr., 26, 359–372,  <ext-link xlink:href="https://doi.org/10.1175/1520-0485(1996)026&lt;0359:ACSOWI&gt;2.0.CO;2" ext-link-type="DOI">10.1175/1520-0485(1996)026&lt;0359:ACSOWI&gt;2.0.CO;2</ext-link>, 1996.</mixed-citation></ref>
      <ref id="bib1.bibx27"><?xmltex \def\ref@label{{Mathiesen(1987)}}?><label>Mathiesen(1987)</label><?label mathiesen_wave_1987?><mixed-citation>Mathiesen, M.: Wave refraction by a current whirl, J. Geophys. Res.-Oceans, 92, 3905–3912, <ext-link xlink:href="https://doi.org/10.1029/JC092iC04p03905" ext-link-type="DOI">10.1029/JC092iC04p03905</ext-link>, 1987. </mixed-citation></ref><?xmltex \hack{\newpage}?>
      <ref id="bib1.bibx28"><?xmltex \def\ref@label{{Phillips(1977)}}?><label>Phillips(1977)</label><?label phillips_dynamics_1977?><mixed-citation>Phillips, O. M.: The Dynamics of the Upper Ocean, Cambridge University Press, Cambridge, 2 edn., <ext-link xlink:href="https://doi.org/10.1002/zamm.19790590714" ext-link-type="DOI">10.1002/zamm.19790590714</ext-link>, 1977.</mixed-citation></ref>
      <ref id="bib1.bibx29"><?xmltex \def\ref@label{{Rapizo et~al.(2014)Rapizo, Babanin, Gramstad, and
Ghantous}}?><label>Rapizo et al.(2014)Rapizo, Babanin, Gramstad, and Ghantous</label><?label rapizo_wave_2014?><mixed-citation> Rapizo, H., Babanin, A., Gramstad, O., and Ghantous, M.: Wave Refraction on Southern Ocean Eddies, in: 19th Australasian Fluid Mechanics Conference, Melbourne, Australia, 8–11 December 2014, 18, 46–50, ISBN 978-1-5108-2684-7, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx30"><?xmltex \def\ref@label{{Romero et~al.(2017)Romero, Lenain, and
Melville}}?><label>Romero et al.(2017)Romero, Lenain, and Melville</label><?label romero_observations_2017?><mixed-citation>Romero, L., Lenain, L., and Melville, W. K.: Observations of Surface Wave–Current Interaction, J. Phys. Oceanogr., 47, 615–632,  <ext-link xlink:href="https://doi.org/10.1175/JPO-D-16-0108.1" ext-link-type="DOI">10.1175/JPO-D-16-0108.1</ext-link>, 2017.</mixed-citation></ref>
      <ref id="bib1.bibx31"><?xmltex \def\ref@label{{Romero et~al.(2020)Romero, Hypolite, and
McWilliams}}?><label>Romero et al.(2020)Romero, Hypolite, and McWilliams</label><?label romero_submesoscale_2020?><mixed-citation>Romero, L., Hypolite, D., and McWilliams, J. C.: Submesoscale current effects on surface waves, Ocean Model., 153, 101662, <ext-link xlink:href="https://doi.org/10.1016/j.ocemod.2020.101662" ext-link-type="DOI">10.1016/j.ocemod.2020.101662</ext-link>, 2020.</mixed-citation></ref>
      <ref id="bib1.bibx32"><?xmltex \def\ref@label{{Saetra et~al.(2021)Saetra, Halsne, Carrasco, Breivik, Pedersen, and
Christensen}}?><label>Saetra et al.(2021)Saetra, Halsne, Carrasco, Breivik, Pedersen, and Christensen</label><?label saetra_intense_2021?><mixed-citation>Saetra, Ø., Halsne, T., Carrasco, A., Breivik, Ø., Pedersen, T., and Christensen, K. H.: Intense interactions between ocean waves and currents observed in the Lofoten Maelstrom, J. Phys. Oceanogr., 51, 3461–3476, <ext-link xlink:href="https://doi.org/10.1175/JPO-D-20-0290.1" ext-link-type="DOI">10.1175/JPO-D-20-0290.1</ext-link>, 2021.</mixed-citation></ref>
      <ref id="bib1.bibx33"><?xmltex \def\ref@label{{Segtnan(2014)}}?><label>Segtnan(2014)</label><?label segtnan_wave_2014?><mixed-citation>Segtnan, O. H.: Wave Refraction Analyses at the Coast of Norway for Offshore Applications, Energy Proced., 53, 193–201, <ext-link xlink:href="https://doi.org/10.1016/j.egypro.2014.07.228" ext-link-type="DOI">10.1016/j.egypro.2014.07.228</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx34"><?xmltex \def\ref@label{{Sun et~al.(2022)Sun, Villas~Bôas, Subramanian, Cornuelle, Mazloff,
Miller, Langodan, and Hoteit}}?><label>Sun et al.(2022)Sun, Villas Bôas, Subramanian, Cornuelle, Mazloff, Miller, Langodan, and Hoteit</label><?label sun_focusing_2022?><mixed-citation>Sun, R., Villas Bôas, A. B., Subramanian, A. C., Cornuelle, B. D., Mazloff, M. R., Miller, A. J., Langodan, S., and Hoteit, I.: Focusing and Defocusing of Tropical Cyclone Generated Waves by Ocean Current Refraction, J. Geophys. Res.-Oceans, 127, e2021JC018112, <ext-link xlink:href="https://doi.org/10.1029/2021JC018112" ext-link-type="DOI">10.1029/2021JC018112</ext-link>, 2022.</mixed-citation></ref>
      <ref id="bib1.bibx35"><?xmltex \def\ref@label{{Wang et~al.(1994)Wang, Liu, Peng, and
Meindl}}?><label>Wang et al.(1994)Wang, Liu, Peng, and Meindl</label><?label wang_wave-current_1994?><mixed-citation>Wang, D. W., Liu, A. K., Peng, C. Y., and Meindl, E. A.: Wave-current interaction near the Gulf Stream during the Surface Wave Dynamics Experiment, J. Geophys. Res.-Oceans, 99, 5065–5079, <ext-link xlink:href="https://doi.org/10.1029/93JC02714" ext-link-type="DOI">10.1029/93JC02714</ext-link>, 1994.</mixed-citation></ref>
      <ref id="bib1.bibx36"><?xmltex \def\ref@label{{Zippel and Thomson(2017)}}?><label>Zippel and Thomson(2017)</label><?label zippel_surface_2017?><mixed-citation>Zippel, S. and Thomson, J.: Surface wave breaking over sheared currents: Observations from the Mouth of the Columbia River, J. Geophys. Res.-Oceans, 122, 3311–3328, <ext-link xlink:href="https://doi.org/10.1002/2016JC012498" ext-link-type="DOI">10.1002/2016JC012498</ext-link>, 2017.</mixed-citation></ref>

  </ref-list></back>
    <!--<article-title-html>Ocean wave tracing v.1: a numerical solver of the wave ray equations for ocean waves on variable currents at arbitrary depths</article-title-html>
<abstract-html/>
<ref-html id="bib1.bib1"><label>Albretsen et al.(2011)</label><mixed-citation>
      
Albretsen, J., Sperrevik, A. K., Staalstrøm, A., Sandvik, A. D., Vikebø, F., and Asplin, L.: NorKyst-800 report no. 1: User manual and technical descriptions, Tech. Rep. 2, Institute of Marine Research, Bergen, Norway, <a href="https://www.hi.no/en/hi/nettrapporter/fisken-og-havet/2011/fh_2-2011_til_web" target="_blank"/> (last access: 6 November 2023),
2011.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib2"><label>Ardhuin et al.(2012)Ardhuin, Roland, Dumas, Bennis, Sentchev, Forget,
Wolf, Girard, Osuna, and Benoit</label><mixed-citation>
      
Ardhuin, F., Roland, A., Dumas, F., Bennis, A.-C., Sentchev, A., Forget, P.,
Wolf, J., Girard, F., Osuna, P., and Benoit, M.: Numerical Wave Modeling
in Conditions with Strong Currents: Dissipation, Refraction, and
Relative Wind, J. Phys. Oceanogr., 42, 2101–2120,  <a href="https://doi.org/10.1175/JPO-D-11-0220.1" target="_blank">https://doi.org/10.1175/JPO-D-11-0220.1</a>,
2012.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib3"><label>Ardhuin et al.(2017)Ardhuin, Gille, Menemenlis, Rocha, Rascle,
Chapron, Gula, and Molemaker</label><mixed-citation>
      
Ardhuin, F., Gille, S. T., Menemenlis, D., Rocha, C. B., Rascle, N., Chapron,
B., Gula, J., and Molemaker, J.: Small-scale open ocean currents have large
effects on wind wave heights, J. Geophys. Res.-Oceans, 122,
4500–4517, <a href="https://doi.org/10.1002/2016JC012413" target="_blank">https://doi.org/10.1002/2016JC012413</a>,
2017.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib4"><label>Babanin et al.(2017)Babanin, van der Weshuijsen, Chalikov, and
Rogers</label><mixed-citation>
      
Babanin, A. V., van der Weshuijsen, A., Chalikov, D., and Rogers, W. E.:
Advanced wave modeling, including wave-current interaction, J. Mar.
Res., 75, 239–262, <a href="https://doi.org/10.1357/002224017821836798" target="_blank">https://doi.org/10.1357/002224017821836798</a>, 2017.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib5"><label>Bretherton and Garrett(1968)</label><mixed-citation>
      
Bretherton, F. P. and Garrett, C. J. R.: Wavetrains in Inhomogeneous Moving
Media, P. Roy. Soc. Lond. A Mat., 302, 529–554, ISSN 0080-4630,
1968.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib6"><label>Bôas and Young(2020)</label><mixed-citation>
      
Bôas, A. B. V. and Young, W. R.: Directional diffusion of surface gravity wave
action by ocean macroturbulence, J. Fluid Mech., 890, 1469–7645, <a href="https://doi.org/10.1017/jfm.2020.116" target="_blank">https://doi.org/10.1017/jfm.2020.116</a>,
2020.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib7"><label>Bôas et al.(2020)Bôas, Cornuelle, Mazloff, Gille, and
Ardhuin</label><mixed-citation>
      
Bôas, A. B. V., Cornuelle, B. D., Mazloff, M. R., Gille, S. T., and Ardhuin,
F.: Wave-Current Interactions at Meso- and Submesoscales: Insights
from Idealized Numerical Simulations, J. Phys. Oceanogr.,
50, 3483–3500, <a href="https://doi.org/10.1175/JPO-D-20-0151.1" target="_blank">https://doi.org/10.1175/JPO-D-20-0151.1</a>,
2020.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib8"><label>Calvino et al.(2022)Calvino, Dabrowski, and
Dias</label><mixed-citation>
      
Calvino, C., Dabrowski, T., and Dias, F.: Theoretical and applied
considerations in depth-integrated currents for third-generation wave models,
AIP Adv., 12, 015017,  <a href="https://doi.org/10.1063/5.0077871" target="_blank">https://doi.org/10.1063/5.0077871</a>,
2022.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib9"><label>Dysthe(2001)</label><mixed-citation>
      
Dysthe, K. B.: Refraction of gravity waves by weak current gradients, J. Fluid Mech., 442, 157–159,
<a href="https://doi.org/10.1017/S0022112001005237" target="_blank">https://doi.org/10.1017/S0022112001005237</a>,
2001.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib10"><label>Eckart(1952)</label><mixed-citation>
      
Eckart, C.: The propagation of gravity waves from deep to shallow water,
<a href="https://ui.adsabs.harvard.edu/abs/1952grwa.conf..165E" target="_blank"/> (last access: 6 November 2023), U. S. National Bureau of Standards,
1952.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib11"><label>Gallet and Young(2014)</label><mixed-citation>
      
Gallet, B. and Young, W. R.: Refraction of swell by surface currents, J.
Mar. Res., 72, 105–126, <a href="https://doi.org/10.1357/002224014813758959" target="_blank">https://doi.org/10.1357/002224014813758959</a>, 2014.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib12"><label>GlobCurrent E.U. Copernicus Marine Service Information(2022)</label><mixed-citation>
      
GlobCurrent E.U. Copernicus Marine Service Information (CMEMS): Global Total Surface and 15m Current (COPERNICUS-GLOBCURRENT) from Altimetric Geostrophic Current  and Modeled Ekman Current Reprocessing, Marine Data Store (MDS) [data set], <a href="https://doi.org/10.48670/moi-00050" target="_blank">https://doi.org/10.48670/moi-00050</a>, 2022.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib13"><label>Halsne et al.(2022)Halsne, Bohlinger, Christensen, Carrasco, and
Breivik</label><mixed-citation>
      
Halsne, T., Bohlinger, P., Christensen, K. H., Carrasco, A., and Breivik,
Ø.: Resolving regions known for intense wave–current interaction using
spectral wave models: A case study in the energetic flow fields of
Northern Norway, Ocean Model., 176, 102071,
<a href="https://doi.org/10.1016/j.ocemod.2022.102071" target="_blank">https://doi.org/10.1016/j.ocemod.2022.102071</a>,
2022.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib14"><label>Halsne et al.(2023)</label><mixed-citation>
      
Halsne, T., Christensen, K. H., Hope, G., and Breivik, Ø.: Model repository, Zenodo [code], <a href="https://doi.org/10.5281/zenodo.7602540" target="_blank">https://doi.org/10.5281/zenodo.7602540</a>, 2023.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib15"><label>Holthuijsen(2007)</label><mixed-citation>
      
Holthuijsen, L. H.: Waves in Oceanic and Coastal Waters, Cambridge
University Press, <a href="https://doi.org/10.1017/CBO9780511618536" target="_blank">https://doi.org/10.1017/CBO9780511618536</a>, 2007.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib16"><label>Irvine and Tilley(1988)</label><mixed-citation>
      
Irvine, D. E. and Tilley, D. G.: Ocean wave directional spectra and
wave-current interaction in the Agulhas from the Shuttle Imaging
Radar-B synthetic aperture radar, J. Geophys. Res.-Oceans, 93, 15389–15401, <a href="https://doi.org/10.1029/JC093iC12p15389" target="_blank">https://doi.org/10.1029/JC093iC12p15389</a>,
1988.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib17"><label>Johnson(1947)</label><mixed-citation>
      
Johnson, J. W.: The refraction of surface waves by currents, Eos, Transactions
American Geophysical Union, 28, 867–874,
<a href="https://doi.org/10.1029/TR028i006p00867" target="_blank">https://doi.org/10.1029/TR028i006p00867</a>,
1947.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib18"><label>Jones(2000)</label><mixed-citation>
      
Jones, B.: A Numerical Study of Wave Refraction in Shallow Tidal
Waters, Estuar. Coast. Shelf Sci., 51, 331–347,
<a href="https://doi.org/10.1006/ecss.2000.0679" target="_blank">https://doi.org/10.1006/ecss.2000.0679</a>,
2000.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib19"><label>Kenyon(1971)</label><mixed-citation>
      
Kenyon, K. E.: Wave refraction in ocean currents, Deep-Sea Res., 18, 1023–1034,
<a href="https://doi.org/10.1016/0011-7471(71)90006-4" target="_blank">https://doi.org/10.1016/0011-7471(71)90006-4</a>,
1971.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib20"><label>Kirby and Chen(1989)</label><mixed-citation>
      
Kirby, J. T. and Chen, T.-M.: Surface waves on vertically sheared flows:
Approximate dispersion relations, J. Geophys. Res.-Oceans,
94, 1013–1027,  <a href="https://doi.org/10.1029/JC094iC01p01013" target="_blank">https://doi.org/10.1029/JC094iC01p01013</a>,
1989.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib21"><label>Komen et al.(1994)Komen, Cavaleri, Doneland, Hasselmann, Hasselmann,
and Janssen</label><mixed-citation>
      
Komen, G. J., Cavaleri, L., Doneland, M., Hasselmann, K., Hasselmann, S., and
Janssen, P. A. E. M. (Eds.): Dynamics and Modelling of Ocean Waves,
Cambridge Univeristy Press, <a href="https://doi.org/10.1017/CBO9780511628955" target="_blank">https://doi.org/10.1017/CBO9780511628955</a>, 1994.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib22"><label>Kudryavtsev et al.(2017)Kudryavtsev, Yurovskaya, Chapron, Collard,
and Donlon</label><mixed-citation>
      
Kudryavtsev, V., Yurovskaya, M., Chapron, B., Collard, F., and Donlon, C.: Sun
glitter imagery of surface waves. Part 2: Waves transformation on ocean
currents, J. Geophys. Res.-Oceans, 122, 1384–1399,
2017.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib23"><label>Langtangen(2016)</label><mixed-citation>
      
Langtangen, H. P.: A Primer on Scientific Programming with Python,
vol. 6 of Texts in Computational Science and Engineering,
Springer, Berlin, Heidelberg, ISBN 978-3-662-49886-6 978-3-662-49887-3,
<a href="https://doi.org/10.1007/978-3-662-49887-3" target="_blank">https://doi.org/10.1007/978-3-662-49887-3</a>,
2016.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib24"><label>Liu et al.(1994)Liu, Peng, and Schumacher</label><mixed-citation>
      
Liu, A. K., Peng, C. Y., and Schumacher, J. D.: Wave-current interaction study
in the Gulf of Alaska for detection of eddies by synthetic aperture
radar, J. Geophys. Res.-Oceans, 99, 10075–10085,  <a href="https://doi.org/10.1029/94JC00422" target="_blank">https://doi.org/10.1029/94JC00422</a>,
1994.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib25"><label>Mapp et al.(1985)Mapp, Welch, and Munday</label><mixed-citation>
      
Mapp, G. R., Welch, C. S., and Munday, J. C.: Wave refraction by warm core
rings, J. Geophys. Res., 90, 7153,
<a href="https://doi.org/10.1029/JC090iC04p07153" target="_blank">https://doi.org/10.1029/JC090iC04p07153</a>,
1985.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib26"><label>Masson(1996)</label><mixed-citation>
      
Masson, D.: A Case Study of Wave–Current Interaction in a Strong
Tidal Current, J. Phys. Oceanogr., 26, 359–372,  <a href="https://doi.org/10.1175/1520-0485(1996)026&lt;0359:ACSOWI&gt;2.0.CO;2" target="_blank">https://doi.org/10.1175/1520-0485(1996)026&lt;0359:ACSOWI&gt;2.0.CO;2</a>,
1996.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib27"><label>Mathiesen(1987)</label><mixed-citation>
      
Mathiesen, M.: Wave refraction by a current whirl, J. Geophys.
Res.-Oceans, 92, 3905–3912,
<a href="https://doi.org/10.1029/JC092iC04p03905" target="_blank">https://doi.org/10.1029/JC092iC04p03905</a>,
1987.


    </mixed-citation></ref-html>
<ref-html id="bib1.bib28"><label>Phillips(1977)</label><mixed-citation>
      
Phillips, O. M.: The Dynamics of the Upper Ocean, Cambridge University
Press, Cambridge, 2 edn., <a href="https://doi.org/10.1002/zamm.19790590714" target="_blank">https://doi.org/10.1002/zamm.19790590714</a>, 1977.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib29"><label>Rapizo et al.(2014)Rapizo, Babanin, Gramstad, and
Ghantous</label><mixed-citation>
      
Rapizo, H., Babanin, A., Gramstad, O., and Ghantous, M.: Wave Refraction on
Southern Ocean Eddies, in: 19th Australasian Fluid Mechanics
Conference, Melbourne, Australia,
8–11 December 2014,
18,
46–50,
ISBN 978-1-5108-2684-7, 2014.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib30"><label>Romero et al.(2017)Romero, Lenain, and
Melville</label><mixed-citation>
      
Romero, L., Lenain, L., and Melville, W. K.: Observations of Surface
Wave–Current Interaction, J. Phys. Oceanogr., 47,
615–632,  <a href="https://doi.org/10.1175/JPO-D-16-0108.1" target="_blank">https://doi.org/10.1175/JPO-D-16-0108.1</a>,
2017.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib31"><label>Romero et al.(2020)Romero, Hypolite, and
McWilliams</label><mixed-citation>
      
Romero, L., Hypolite, D., and McWilliams, J. C.: Submesoscale current effects
on surface waves, Ocean Model., 153, 101662,
<a href="https://doi.org/10.1016/j.ocemod.2020.101662" target="_blank">https://doi.org/10.1016/j.ocemod.2020.101662</a>,
2020.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib32"><label>Saetra et al.(2021)Saetra, Halsne, Carrasco, Breivik, Pedersen, and
Christensen</label><mixed-citation>
      
Saetra, Ø., Halsne, T., Carrasco, A., Breivik, Ø., Pedersen, T., and
Christensen, K. H.: Intense interactions between ocean waves and currents
observed in the Lofoten Maelstrom, J. Phys. Oceanogr., 51, 3461–3476, <a href="https://doi.org/10.1175/JPO-D-20-0290.1" target="_blank">https://doi.org/10.1175/JPO-D-20-0290.1</a>,
2021.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib33"><label>Segtnan(2014)</label><mixed-citation>
      
Segtnan, O. H.: Wave Refraction Analyses at the Coast of Norway for
Offshore Applications, Energy Proced., 53, 193–201,
<a href="https://doi.org/10.1016/j.egypro.2014.07.228" target="_blank">https://doi.org/10.1016/j.egypro.2014.07.228</a>,
2014.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib34"><label>Sun et al.(2022)Sun, Villas Bôas, Subramanian, Cornuelle, Mazloff,
Miller, Langodan, and Hoteit</label><mixed-citation>
      
Sun, R., Villas Bôas, A. B., Subramanian, A. C., Cornuelle, B. D., Mazloff,
M. R., Miller, A. J., Langodan, S., and Hoteit, I.: Focusing and Defocusing
of Tropical Cyclone Generated Waves by Ocean Current
Refraction, J. Geophys. Res.-Oceans, 127, e2021JC018112,
<a href="https://doi.org/10.1029/2021JC018112" target="_blank">https://doi.org/10.1029/2021JC018112</a>, 2022.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib35"><label>Wang et al.(1994)Wang, Liu, Peng, and
Meindl</label><mixed-citation>
      
Wang, D. W., Liu, A. K., Peng, C. Y., and Meindl, E. A.: Wave-current
interaction near the Gulf Stream during the Surface Wave Dynamics
Experiment, J. Geophys. Res.-Oceans, 99, 5065–5079,
<a href="https://doi.org/10.1029/93JC02714" target="_blank">https://doi.org/10.1029/93JC02714</a>,
1994.

    </mixed-citation></ref-html>
<ref-html id="bib1.bib36"><label>Zippel and Thomson(2017)</label><mixed-citation>
      
Zippel, S. and Thomson, J.: Surface wave breaking over sheared currents:
Observations from the Mouth of the Columbia River, J.
Geophys. Res.-Oceans, 122, 3311–3328,
<a href="https://doi.org/10.1002/2016JC012498" target="_blank">https://doi.org/10.1002/2016JC012498</a>, 2017.

    </mixed-citation></ref-html>--></article>
