<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE article PUBLIC "-//NLM//DTD Journal Publishing with OASIS Tables v3.0 20080202//EN" "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" dtd-version="3.0"><?xmltex \makeatother\@nolinetrue\makeatletter?>
  <front>
    <journal-meta>
<journal-id journal-id-type="publisher">ANGEO</journal-id>
<journal-title-group>
<journal-title>Annales Geophysicae</journal-title>
<abbrev-journal-title abbrev-type="publisher">ANGEO</abbrev-journal-title>
<abbrev-journal-title abbrev-type="nlm-ta">Ann. Geophys.</abbrev-journal-title>
</journal-title-group>
<issn pub-type="epub">1432-0576</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/angeo-35-613-2017</article-id><title-group><article-title><?xmltex \hack{\vspace*{-2mm}}?>Estimating a planetary magnetic field with time-dependent global MHD simulations using an adjoint approach</article-title>
      </title-group><?xmltex \runningtitle{Estimating a planetary magnetic field with MHD simulations}?><?xmltex \runningauthor{C. Nabert et al.}?>
      <contrib-group>
        <contrib contrib-type="author" corresp="yes" rid="aff1">
          <name><surname>Nabert</surname><given-names>Christian</given-names></name>
          <email>c.nabert@tu-bs.de</email>
        </contrib>
        <contrib contrib-type="author" corresp="no" rid="aff1">
          <name><surname>Othmer</surname><given-names>Carsten</given-names></name>
          
        </contrib>
        <contrib contrib-type="author" corresp="no" rid="aff1 aff2">
          <name><surname>Glassmeier</surname><given-names>Karl-Heinz</given-names></name>
          
        </contrib>
        <aff id="aff1"><label>1</label><institution>Institut für Geophysik und extraterrestrische Physik, Technische
Universität Braunschweig, Mendelssohnstr. 3,<?xmltex \hack{\newline}?> 38106
Braunschweig, Germany</institution>
        </aff>
        <aff id="aff2"><label>2</label><institution>Max-Planck-Institut für Sonnensystemforschung, Justus-von-Liebig-Weg 3, 37077 Göttingen, Germany</institution>
        </aff>
      </contrib-group>
      <author-notes><corresp id="corr1">Christian Nabert (c.nabert@tu-bs.de)</corresp></author-notes><pub-date><day>9</day><month>May</month><year>2017</year></pub-date>
      
      <volume>35</volume>
      <issue>3</issue>
      <fpage>613</fpage><lpage>628</lpage>
      <history>
        <date date-type="received"><day>6</day><month>December</month><year>2016</year></date>
           <date date-type="rev-recd"><day>14</day><month>March</month><year>2017</year></date>
           <date date-type="accepted"><day>12</day><month>April</month><year>2017</year></date>
      </history>
      <permissions>
<license license-type="open-access">
<license-p>This work is licensed under a Creative Commons Attribution 3.0 Unported License. To view a copy of this license, visit <ext-link ext-link-type="uri" xlink:href="http://creativecommons.org/licenses/by/3.0/">http://creativecommons.org/licenses/by/3.0/</ext-link></license-p>
</license>
</permissions><self-uri xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017.html">This article is available from https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017.html</self-uri>
<self-uri xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017.pdf">The full text article is available as a PDF file from https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017.pdf</self-uri>


      <abstract>
    <p>The interaction of the solar wind with a planetary magnetic field causes
electrical currents that modify the magnetic field distribution around the
planet. We present an approach to estimating the planetary magnetic field from
in situ spacecraft data using a magnetohydrodynamic (MHD) simulation
approach. The method is developed with respect to the upcoming BepiColombo
mission to planet Mercury aimed at determining the planet's
magnetic field and its interior electrical conductivity distribution. In
contrast to the widely used empirical models, global MHD simulations allow
the
calculation of the strongly time-dependent interaction process of the solar wind
with the planet. As a first approach, we use a simple MHD simulation code
that includes time-dependent solar wind and magnetic field parameters. The
planetary parameters are estimated by minimizing the misfit of spacecraft
data and simulation results with a gradient-based optimization. As the
calculation of gradients with respect to many parameters is usually very
time-consuming, we investigate the application of an adjoint MHD model. This
adjoint MHD model is generated by an automatic differentiation tool to
compute the gradients efficiently. The computational cost for determining
the gradient with an adjoint approach is nearly independent of the number of
parameters. Our method is validated by application to THEMIS (Time History of
Events and Macroscale Interactions during Substorms) magnetosheath data to
estimate Earth's dipole moment.</p>
  </abstract>
      <kwd-group>
        <kwd>Magnetospheric physics (magnetosheath; planetary magnetospheres; solar wind–magnetosphere interactions)</kwd>
      </kwd-group>
    </article-meta>
  </front>
<body>
      

      <?xmltex \hack{\newpage}?>
<sec id="Ch1.S1" sec-type="intro">
  <title>Introduction</title>
      <p>Planets with an intrinsically generated magnetic field, such as Earth or
Mercury, interact with the solar wind. This causes electrical currents that
modify the planetary magnetic field. The properties of the interaction not
only depend on the planetary magnetic field but also on the continuously
varying solar wind conditions. A spacecraft orbiting a planet in such a
highly variable environment measures the modified magnetic field
distribution.</p>
      <p>In 2025 the BepiColombo mission <xref ref-type="bibr" rid="bib1.bibx3" id="paren.1"/> of the ESA and the Japan Aerospace Exploration Agency (JAXA) is expected to
reach planet Mercury. In contrast to the previous MESSENGER (Mercury Surface,
Space Environment, Geochemistry, and Ranging) mission
<xref ref-type="bibr" rid="bib1.bibx33" id="paren.2"/>, two spacecraft will simultaneously measure the
magnetic field distribution around the planet. The planetary magnetic field
at Mercury is about 100 times weaker than the field of Earth.
Therefore, the magnetosheath is much closer to the surface of the planet. As
a consequence, the magnetic field of the electric currents of the interaction
is not negligible, even in the immediate proximity of the planet
<xref ref-type="bibr" rid="bib1.bibx11" id="paren.3"><named-content content-type="pre">e.g.,</named-content></xref>. Furthermore, electromagnetic induction effects
within the planet might be important <xref ref-type="bibr" rid="bib1.bibx14 bib1.bibx17" id="paren.4"><named-content content-type="pre">e.g.,</named-content></xref>. To
estimate the planetary magnetic field precisely, the time-dependent
interaction needs to be determined. With its two spacecraft, the BepiColombo
mission is most suitable for determining the interaction because of
simultaneous observations of the magnetic field distribution in the
magnetosphere and the solar wind. If both spacecraft are within the
interaction region, the solar wind reconstruction method by
<xref ref-type="bibr" rid="bib1.bibx26" id="text.5"/> can be used to estimate the time-varying solar wind
conditions from the observations of one spacecraft. Then the data of the
other spacecraft provide still observations within the interaction region
while the solar wind conditions are known.</p>
      <p>So far, the planetary magnetic field of Mercury has been determined using
empirical models of the interaction between the solar wind and the planetary
magnetic field with spacecraft data from MESSENGER or Mariner 10
<xref ref-type="bibr" rid="bib1.bibx19 bib1.bibx1 bib1.bibx18" id="paren.6"><named-content content-type="pre">e.g.,</named-content></xref>. The electrical current
density of the interaction in empirical models is parametrized by
pre-described functional relations. Typically, the current system is described
as a superposition of localized electrical currents such as the magnetopause
current, which is parametrized by its subsolar location and ellipsoidal shape.
Taking only a few parameters into account, these prescribed functional
relations do not include, for example, effects such as magnetic pile-up, which correspond
to a distribution of the magnetopause current within the entire
magnetosheath. Furthermore, the parameters are distinguished between only a few
discrete solar wind scenarios such as strong and weak solar wind pressure. If
more parameters or solar wind scenarios are considered to parametrize the
current system more accurately, it is not always possible to determine all
parameters with small statistical error due to the finite data coverage.
This is especially true if strongly time-dependent nonlinear phenomena occur.</p>
      <p>Mercury's magnetic field close to the subsolar magnetopause has a strength of about
60 <inline-formula><mml:math id="M1" display="inline"><mml:mi mathvariant="normal">nT</mml:mi></mml:math></inline-formula> <xref ref-type="bibr" rid="bib1.bibx18" id="paren.7"/>. Using an average solar wind velocity of
430 <inline-formula><mml:math id="M2" display="inline"><mml:mrow><mml:mi mathvariant="normal">km</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>, this
corresponds to a gyroradius of the interaction of about 37.5 <inline-formula><mml:math id="M3" display="inline"><mml:mi mathvariant="normal">km</mml:mi></mml:math></inline-formula>.
Compared to global structures of the interaction, such as a subsolar
magnetosheath thickness of about 1220 <inline-formula><mml:math id="M4" display="inline"><mml:mi mathvariant="normal">km</mml:mi></mml:math></inline-formula> <xref ref-type="bibr" rid="bib1.bibx37" id="paren.8"/>, a magnetohydrodynamic
(MHD)
approximation seems to be a valid approximation. The inverse gyrofrequency is
about 0.5 <inline-formula><mml:math id="M5" display="inline"><mml:mi mathvariant="normal">s</mml:mi></mml:math></inline-formula>, which limits the time resolution for this approximation.
In regions dominated by heavy ions, a kinetic approach might be necessary.
Here, we restrict our considerations to the MHD approximation. Taking the observations of the two spacecraft of the BepiColombo
mission into account, the interaction can be calculated as fully time-dependent
with a MHD model. We investigate a procedure to estimate the planetary
magnetic field in a strongly modified magnetic environment of the planet
using a global MHD simulation. In contrast to empirical models, a MHD
simulation requires only parameters of the solar wind conditions, planetary
magnetic field, and plasma properties. This approach calculates the
interaction self-consistently and does not contain parameters to fit
electrical currents. Note that such a model also allows taking a
conductivity distribution of the planet into account. Then, the parameters of
the planet's interior conductivity can be estimated in addition to the
planetary magnetic field parameters in a further step.</p>
      <p>As a first approach, we consider a simple MHD simulation code based on the
MHD code presented by <xref ref-type="bibr" rid="bib1.bibx28" id="text.9"/> to examine our method. A cost
function quantifies the misfit of the spacecraft observations in the
magnetosphere to the corresponding MHD simulation results. The cost function
needs to be minimized with respect to the planetary magnetic field parameter
to estimate these planetary parameters. Different methods can be used to
minimize the cost function. Methods such as downhill simplex or Markov chain
Monte Carlo algorithms are usually used if derivatives of the cost function
cannot be calculated directly. If the gradient can be calculated,
gradient-based minimization algorithms can be used, which often offers faster
convergence speed. However, these methods are restricted to find a local
minimum in parameter space instead of the global minimum. Here, we expect a
global minimum, which is not superposed by local minima, so that a
gradient-based optimization procedure is considered. The gradient-based
methods can provide fast convergence only if the gradient can be determined
quickly. However, the calculation of the gradient with respect to several
parameters using, for example, finite difference quotients can be very
time-consuming. Thus, an adjoint approach is considered, which can
theoretically compute gradients nearly independent of the number of
parameters <xref ref-type="bibr" rid="bib1.bibx16 bib1.bibx10" id="paren.10"><named-content content-type="pre">e.g.,</named-content></xref>.</p>
      <p>In this paper we investigate the applicability of an adjoint approach to a MHD simulation code using automatic
differentiation <xref ref-type="bibr" rid="bib1.bibx36" id="paren.11"/>.
Although the adjoint approach can be much faster than using finite
differences, it requires larger memory capacities. An adjoint approach using
automatic differentiation was successfully applied to a reduced MHD model,
the magnetosheath model by <xref ref-type="bibr" rid="bib1.bibx25" id="text.12"/>, to estimate the solar wind
parameters of the model <xref ref-type="bibr" rid="bib1.bibx26" id="paren.13"/>. The reduced MHD model uses
series expansions along the bow shock and magnetopause geometry of the MHD
quantities. This transfers the stationary partial differential MHD equations
into a set of ordinary differential equations. Close to the stagnation
streamline, only low-order series expansions are necessary to obtain a valid
representation of the interaction. Not only the numerical effort for solving the
corresponding ordinary differential equations is significantly lower compared
to solving the full MHD system, the required storage capacity is also much
lower. Therefore, the automatic differentiation procedure could be applied
without regarding memory limitations. Here, an automatic differentiation
tool is applied to a full MHD simulation code and thus special emphasis
needs to be put on memory consumptions.</p>
      <p>Our approach to estimating planetary parameters using data from a
multi-spacecraft mission is validated with the THEMIS (Time History of Events
and Macroscale Interactions during Substorms) mission
<xref ref-type="bibr" rid="bib1.bibx2" id="paren.14"/> at Earth with its well-known planetary
magnetic field. The five spacecraft of the mission (THA, THB, THC, THD, and THE) provide simultaneous
observations of the interaction region and the solar wind. However, in
contrast to the situation at Mercury, the interaction of the solar wind near
the planet's surface is negligible at Earth. Due to the weak magnetic
field at Mercury, the interaction region of the solar wind is much closer to
the planet <xref ref-type="bibr" rid="bib1.bibx37" id="paren.15"/>. In particular, the subsolar bow shock
distance to the center of the planet is on average about 1.89 <inline-formula><mml:math id="M6" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>M</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>
at Mercury and 13 <inline-formula><mml:math id="M7" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> at Earth
(<inline-formula><mml:math id="M8" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">6371</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M9" display="inline"><mml:mi mathvariant="normal">km</mml:mi></mml:math></inline-formula>). The average distance of the subsolar
magnetopause at Mercury is 1.45 <inline-formula><mml:math id="M10" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>M</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and 10 <inline-formula><mml:math id="M11" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> at Earth. As a consequence, only close to the magnetosheath region,
are the modifications of Earth's magnetic field comparable to the strong
modifications throughout the magnetosphere of Mercury. To validate our
procedure with respect to the future measurements of the BepiColombo mission,
THEMIS data from the terrestrial magnetosheath is used. However, in its final
application for the BepiColombo mission, spacecraft data of the entire
interaction region including the magnetosphere will be taken into account to
estimate the planetary magnetic field.</p>
</sec>
<sec id="Ch1.S2">
  <title>MHD simulation code</title>
      <p>The interaction of the planetary magnetic field with the solar wind is
computed by a MHD simulation code. The MHD simulation has to be efficient to
perform the time-consuming estimation procedure of the planetary parameters.
Furthermore, the simulation code should be simple in its numerical
implementation structure to simplify the application of the adjoint approach
using automatic differentiation. For these reasons, as a first approach, a
simple MHD simulation code is developed, which is based on the simulation code
described by <xref ref-type="bibr" rid="bib1.bibx28" id="text.16"/>. The MHD simulation code described by
<xref ref-type="bibr" rid="bib1.bibx28" id="text.17"/> was already used in studies of magnetospheric
convection, for example, depending on the solar wind magnetic field <xref ref-type="bibr" rid="bib1.bibx29" id="paren.18"/> or
field-aligned currents <xref ref-type="bibr" rid="bib1.bibx27" id="paren.19"/>. The code is modified and extended
for the application to the parameter estimation process as explained in the
following paragraphs. Furthermore, some details about the numerical implementation of the
simulation code are summarized to understand the application of the adjoint
method via automatic differentiation, which is explained in the next section.</p>
<sec id="Ch1.S2.SS1">
  <title>Planetary magnetic field</title>
      <p>The magnetic field in the simulation code by <xref ref-type="bibr" rid="bib1.bibx28" id="text.20"/> is restricted
to a dipole along the planet's axis of rotation. Here, a more general
representation of the magnetic field is required. The planetary magnetic
field can be represented by a multipole expansion using a spherical harmonic
analysis <xref ref-type="bibr" rid="bib1.bibx8 bib1.bibx12" id="paren.21"/>. Note that this part of the
magnetic field does not contain contributions due to the interaction with the
solar wind such as induction or magnetopause currents. As a consequence, the
planetary magnetic field outside the planet can be represented by a scalar
potential <inline-formula><mml:math id="M12" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mtext>pot</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>:
            <disp-formula id="Ch1.E1" content-type="numbered"><mml:math id="M13" display="block"><mml:mrow><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="normal">∇</mml:mi><mml:msub><mml:mi>V</mml:mi><mml:mtext>pot</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Thereby, the scalar potential <inline-formula><mml:math id="M14" display="inline"><mml:mrow><mml:msub><mml:mi>V</mml:mi><mml:mtext>pot</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> satisfies a Laplace equation.
Using spherical coordinates <inline-formula><mml:math id="M15" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, the solution outside the planet
<inline-formula><mml:math id="M16" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>&gt;</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, where <inline-formula><mml:math id="M17" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> denotes the planet's radius, is given by

                <disp-formula specific-use="align"><mml:math id="M18" display="block"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>V</mml:mi><mml:mtext>pot</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>r</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:munderover><mml:mo movablelimits="false">∑</mml:mo><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mi mathvariant="normal">∞</mml:mi></mml:munderover><mml:munderover><mml:mo movablelimits="false">∑</mml:mo><mml:mrow><mml:mi>m</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow><mml:mi>l</mml:mi></mml:munderover><mml:msup><mml:mfenced open="(" close=")"><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow><mml:mi>r</mml:mi></mml:mfrac></mml:mstyle></mml:mfenced><mml:mrow><mml:mi>l</mml:mi><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mo mathsize="1.5em">(</mml:mo><mml:msubsup><mml:mi>g</mml:mi><mml:mi>l</mml:mi><mml:mi>m</mml:mi></mml:msubsup><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:mi>m</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>+</mml:mo><mml:msubsup><mml:mi>h</mml:mi><mml:mi>l</mml:mi><mml:mi>m</mml:mi></mml:msubsup><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:mi>m</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="italic">λ</mml:mi><mml:mo>)</mml:mo><mml:mo mathsize="1.5em">)</mml:mo><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msubsup><mml:mi>P</mml:mi><mml:mi>l</mml:mi><mml:mi>m</mml:mi></mml:msubsup><mml:mo>(</mml:mo><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>

            with the Gauss coefficients <inline-formula><mml:math id="M19" display="inline"><mml:mrow><mml:msubsup><mml:mi>g</mml:mi><mml:mi>l</mml:mi><mml:mi>m</mml:mi></mml:msubsup></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M20" display="inline"><mml:mrow><mml:msubsup><mml:mi>h</mml:mi><mml:mi>l</mml:mi><mml:mi>m</mml:mi></mml:msubsup></mml:mrow></mml:math></inline-formula> and the Schmidt semi-normalized
associated Legendre polynomials <inline-formula><mml:math id="M21" display="inline"><mml:mrow><mml:msubsup><mml:mi>P</mml:mi><mml:mi>l</mml:mi><mml:mi>m</mml:mi></mml:msubsup><mml:mo>(</mml:mo><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, e.g., <inline-formula><mml:math id="M22" display="inline"><mml:mrow><mml:msubsup><mml:mi>P</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> or <inline-formula><mml:math id="M23" display="inline"><mml:mrow><mml:msubsup><mml:mi>P</mml:mi><mml:mn mathvariant="normal">2</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:msqrt><mml:mn mathvariant="normal">3</mml:mn></mml:msqrt><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>)</mml:mo><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="italic">θ</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>
<xref ref-type="bibr" rid="bib1.bibx20 bib1.bibx4" id="paren.22"><named-content content-type="pre">e.g.,</named-content></xref>.</p>
      <p>The lowest-order coefficients for <inline-formula><mml:math id="M24" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula> are associated with the dipole moment
corresponding to the magnetic field vector <inline-formula><mml:math id="M25" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>dipole</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The
simulation code uses a Cartesian representation of the magnetic field. For
the dipole moment, this is
            <disp-formula id="Ch1.E2" content-type="numbered"><mml:math id="M26" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>dipole</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mn mathvariant="normal">3</mml:mn><mml:mfenced open="(" close=")"><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mo>⋅</mml:mo><mml:mi mathvariant="bold-italic">m</mml:mi></mml:mfenced><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mo>-</mml:mo><mml:msup><mml:mi>r</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="bold-italic">m</mml:mi></mml:mrow><mml:mrow><mml:msup><mml:mi>r</mml:mi><mml:mn mathvariant="normal">5</mml:mn></mml:msup></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Here, <inline-formula><mml:math id="M27" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">m</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> is the vector of the dipole moment,
which is related to the Gauss coefficients via
            <disp-formula id="Ch1.E3" content-type="numbered"><mml:math id="M28" display="block"><mml:mtable rowspacing="0.2ex" class="aligned" columnspacing="1em" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi>m</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:msubsup><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext><mml:mn mathvariant="normal">3</mml:mn></mml:msubsup><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msubsup><mml:mi>g</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi>m</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:msubsup><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext><mml:mn mathvariant="normal">3</mml:mn></mml:msubsup><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msubsup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:msubsup><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext><mml:mn mathvariant="normal">3</mml:mn></mml:msubsup><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msubsup><mml:mi>g</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">0</mml:mn></mml:msubsup><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
          The Gauss coefficients for Earth's magnetic field in 2010 were published
using the International Geomagnetic Reference Field (IGRF) by <xref ref-type="bibr" rid="bib1.bibx7" id="text.23"/>.
Thereby, the geographic coordinate system, a body-fixed coordinate system, is
used, with its <inline-formula><mml:math id="M29" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> axis along the axis of rotation. Magnetic field data of
spacecraft close to Earth's surface as well as ground stations were used
to determine the coefficients. The influence of external currents due to the
interaction of the solar wind with the planetary magnetic field was
neglected. The magnetic field of Earth outside the planet is dominated by
the dipole coefficients, which are summarized in Table <xref ref-type="table" rid="Ch1.T1"/>. Note
that a similar estimation procedure at Mercury leads to large errors because
of insufficient data coverage in the southern hemisphere of the planet.
Furthermore, the solar wind interaction has a strong influence on the
magnetic field distribution.</p>

<?xmltex \floatpos{t}?><table-wrap id="Ch1.T1"><caption><p>Dipole coefficients of the IGRF in 2010. On the left side are the
Gauss coefficients according to <xref ref-type="bibr" rid="bib1.bibx7" id="text.24"/>. On the right side are
the corresponding dipole vectors using Eq. (<xref ref-type="disp-formula" rid="Ch1.E3"/>).</p></caption><oasis:table frame="topbot"><oasis:tgroup cols="2">
     <oasis:colspec colnum="1" colname="col1" align="left"/>
     <oasis:colspec colnum="2" colname="col2" align="left"/>
     <oasis:tbody>
       <oasis:row>  
         <oasis:entry colname="col1"><inline-formula><mml:math id="M30" display="inline"><mml:mrow><mml:msubsup><mml:mi>g</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">0</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">29</mml:mn><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mn mathvariant="normal">496.5</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M31" display="inline"><mml:mi mathvariant="normal">nT</mml:mi></mml:math></inline-formula></oasis:entry>  
         <oasis:entry colname="col2"><inline-formula><mml:math id="M32" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.41</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">15</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M33" display="inline"><mml:mrow><mml:mi mathvariant="normal">T</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi mathvariant="normal">m</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1"><inline-formula><mml:math id="M34" display="inline"><mml:mrow><mml:msubsup><mml:mi>g</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1585.9</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M35" display="inline"><mml:mi mathvariant="normal">nT</mml:mi></mml:math></inline-formula></oasis:entry>  
         <oasis:entry colname="col2"><inline-formula><mml:math id="M36" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mn mathvariant="normal">1.28</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">15</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M37" display="inline"><mml:mrow><mml:mi mathvariant="normal">T</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi mathvariant="normal">m</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
       <oasis:row>  
         <oasis:entry colname="col1"><inline-formula><mml:math id="M38" display="inline"><mml:mrow><mml:msubsup><mml:mi>h</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mn mathvariant="normal">4945.1</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">nT</mml:mi></mml:mrow></mml:math></inline-formula></oasis:entry>  
         <oasis:entry colname="col2"><inline-formula><mml:math id="M39" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">7.63</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">15</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M40" display="inline"><mml:mrow><mml:mi mathvariant="normal">T</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi mathvariant="normal">m</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula></oasis:entry>
       </oasis:row>
     </oasis:tbody>
   </oasis:tgroup></oasis:table></table-wrap>

      <p>Similar to the dipole, higher-order moments of the planetary magnetic field
can be taken into account. Thereby, the tensor structure of the Cartesian
representation becomes more complex for higher orders. For example, the
quadrupole can be expressed by a symmetric, traceless matrix <inline-formula><mml:math id="M41" display="inline"><mml:mi mathvariant="bold">Q</mml:mi></mml:math></inline-formula>,
which is defined by <xref ref-type="bibr" rid="bib1.bibx35 bib1.bibx34" id="paren.25"><named-content content-type="pre">e.g.,</named-content></xref>
            <disp-formula id="Ch1.E4" content-type="numbered"><mml:math id="M42" display="block"><mml:mrow><mml:mi mathvariant="bold">Q</mml:mi><mml:mo>:=</mml:mo><mml:mfenced close=")" open="("><mml:mtable class="matrix" columnalign="center center center" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mo>-</mml:mo><mml:mfenced close=")" open="("><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub></mml:mfenced></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The magnetic field related to the quadrupole can be expressed as
            <disp-formula id="Ch1.E5" content-type="numbered"><mml:math id="M43" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>quadrupole</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="bold">Q</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi>r</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>-</mml:mo><mml:mn mathvariant="normal">5</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>Q</mml:mi><mml:mtext>sp</mml:mtext></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="bold-italic">r</mml:mi></mml:mrow><mml:mrow><mml:mn mathvariant="normal">2</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi>r</mml:mi><mml:mn mathvariant="normal">7</mml:mn></mml:msup></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          with <inline-formula><mml:math id="M44" display="inline"><mml:mrow><mml:msub><mml:mi>Q</mml:mi><mml:mtext>sp</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> defined by

                <disp-formula specific-use="align"><mml:math id="M45" display="block"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi>Q</mml:mi><mml:mtext>sp</mml:mtext></mml:msub><mml:mo>:</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi>x</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>x</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>y</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi>y</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>x</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>z</mml:mi></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>y</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>z</mml:mi><mml:mo>-</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi>z</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula></p>
      <p>The simulation code according to <xref ref-type="bibr" rid="bib1.bibx28" id="text.26"/> uses normalizations for the physical quantities.
The normalization constants for the additional magnetic field parameters are
            <disp-formula id="Ch1.E6" content-type="numbered"><mml:math id="M46" display="block"><mml:mrow><?xmltex \hack{\hbox\bgroup\fontsize{9.2}{9.2}\selectfont$\displaystyle}?><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable columnspacing="1em" class="cases" rowspacing="0.2ex" columnalign="left left" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:mn mathvariant="normal">8.07</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">15</mml:mn></mml:msup><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">T</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi mathvariant="normal">m</mml:mi><mml:mn mathvariant="normal">3</mml:mn></mml:msup><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mtext>for a dipole component,</mml:mtext></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mn mathvariant="normal">5.14</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">22</mml:mn></mml:msup><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">T</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi mathvariant="normal">m</mml:mi><mml:mn mathvariant="normal">4</mml:mn></mml:msup><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mtext>for a quadrupole component.</mml:mtext></mml:mtd></mml:mtr></mml:mtable></mml:mfenced><?xmltex \hack{$\egroup}?></mml:mrow></mml:math></disp-formula>
          The simulations take the dipole and quadrupole moments into account.
Thus, the resulting planetary magnetic field is
            <disp-formula id="Ch1.E7" content-type="numbered"><mml:math id="M47" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>Planet</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>dipole</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>quadrupole</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula></p>
</sec>
<sec id="Ch1.S2.SS2">
  <title>MHD equations and boundary conditions</title>
      <p>The interaction of the solar wind with the planetary magnetic field is
calculated by solving the MHD equations. Thereby, these equations are solved
within a box sketched in Fig. <xref ref-type="fig" rid="Ch1.F1"/>. The simulation uses a
model solar wind planet (MSP) coordinate system, whereby the origin is in the
planet's center. The <inline-formula><mml:math id="M48" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis is along the unperturbed solar wind velocity
vector, the <inline-formula><mml:math id="M49" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> axis is parallel to the rotation axis, and the <inline-formula><mml:math id="M50" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula> axis
completes a right-handed coordinate system. The length of the simulation box
is in <inline-formula><mml:math id="M51" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> direction <inline-formula><mml:math id="M52" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mtext>L</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, in <inline-formula><mml:math id="M53" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula> direction <inline-formula><mml:math id="M54" display="inline"><mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mtext>L</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, and in
<inline-formula><mml:math id="M55" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> direction <inline-formula><mml:math id="M56" display="inline"><mml:mrow><mml:msub><mml:mi>z</mml:mi><mml:mtext>L</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
      <p>The MHD equations provide solutions for the mass density <inline-formula><mml:math id="M57" display="inline"><mml:mi mathvariant="italic">ρ</mml:mi></mml:math></inline-formula>, the plasma
velocity <inline-formula><mml:math id="M58" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>:=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>, the pressure <inline-formula><mml:math id="M59" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula>, and the magnetic field
<inline-formula><mml:math id="M60" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mo>:=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>. The solutions are summarized in the vector
            <disp-formula id="Ch1.E8" content-type="numbered"><mml:math id="M61" display="block"><mml:mrow><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mo>:=</mml:mo><mml:msup><mml:mfenced open="(" close=")"><mml:mi mathvariant="italic">ρ</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi>p</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mi>z</mml:mi></mml:msub></mml:mfenced><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The following representation of the MHD equations is solved by the MHD
simulation code:

                <disp-formula specific-use="align" content-type="numbered"><mml:math id="M62" display="block"><mml:mtable displaystyle="true"><mml:mlabeledtr id="Ch1.E9"><mml:mtd/><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:msub><mml:mi mathvariant="italic">ρ</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>⋅</mml:mo><mml:mo>(</mml:mo><mml:mi mathvariant="italic">ρ</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>)</mml:mo><mml:mo>+</mml:mo><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="italic">ρ</mml:mi></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi mathvariant="normal">∇</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mi mathvariant="italic">ρ</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E10"><mml:mtd/><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:msub><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mfenced close=")" open="("><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>⋅</mml:mo><mml:mi mathvariant="normal">∇</mml:mi></mml:mfenced><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>-</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mi mathvariant="italic">ρ</mml:mi></mml:mfrac></mml:mstyle><mml:mfenced open="(" close=")"><mml:mi mathvariant="normal">∇</mml:mi><mml:mi>p</mml:mi><mml:mo>-</mml:mo><mml:mi mathvariant="bold-italic">j</mml:mi><mml:mo>×</mml:mo><mml:mi mathvariant="bold-italic">B</mml:mi></mml:mfenced><mml:mo>+</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mtext>v</mml:mtext></mml:msub></mml:mrow><mml:mi mathvariant="italic">ρ</mml:mi></mml:mfrac></mml:mstyle><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msup><mml:mi mathvariant="normal">∇</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E11"><mml:mtd/><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:msub><mml:mi>p</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mfenced close=")" open="("><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>⋅</mml:mo><mml:mi mathvariant="normal">∇</mml:mi></mml:mfenced><mml:mi>p</mml:mi><mml:mo>-</mml:mo><mml:mi mathvariant="italic">γ</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>p</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">∇</mml:mi><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>+</mml:mo><mml:msub><mml:mi>D</mml:mi><mml:mi>p</mml:mi></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msup><mml:mi mathvariant="normal">∇</mml:mi><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mi>p</mml:mi><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr><mml:mlabeledtr id="Ch1.E12"><mml:mtd/><mml:mtd><mml:mstyle class="stylechange" displaystyle="true"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mo>=</mml:mo><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mfenced open="(" close=")"><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo>×</mml:mo><mml:mi mathvariant="bold-italic">B</mml:mi></mml:mfenced><mml:mo>-</mml:mo><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mfenced close=")" open="("><mml:msub><mml:mi>D</mml:mi><mml:mi>B</mml:mi></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mi mathvariant="bold-italic">B</mml:mi></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mlabeledtr></mml:mtable></mml:math></disp-formula>

            Here, <inline-formula><mml:math id="M63" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi mathvariant="italic">ρ</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M64" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mtext>v</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M65" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi>p</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M66" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi>B</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> are diffusion
coefficients of the density, the velocity, the pressure, and the magnetic
field, respectively. The magnetic diffusion coefficient is related to the
electrical resistivity <inline-formula><mml:math id="M67" display="inline"><mml:mi mathvariant="italic">η</mml:mi></mml:math></inline-formula> by <inline-formula><mml:math id="M68" display="inline"><mml:mrow><mml:msub><mml:mi>D</mml:mi><mml:mi>B</mml:mi></mml:msub><mml:mo>:=</mml:mo><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>, with the vacuum
permeability <inline-formula><mml:math id="M69" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">μ</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>:=</mml:mo><mml:mn mathvariant="normal">4</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="italic">π</mml:mi><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">7</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>. The current density <inline-formula><mml:math id="M70" display="inline"><mml:mi mathvariant="bold-italic">j</mml:mi></mml:math></inline-formula> is
calculated with Ampere's law, neglecting the displacement current:
            <disp-formula id="Ch1.E13" content-type="numbered"><mml:math id="M71" display="block"><mml:mrow><mml:mi mathvariant="bold-italic">j</mml:mi><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mn mathvariant="normal">1</mml:mn><mml:mrow><mml:msub><mml:mi mathvariant="italic">μ</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula></p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F1"><caption><p>The simulation box contains the planet with its magnetic field. The
origin of the coordinate system is in the planet's center and the <inline-formula><mml:math id="M72" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis is
along the unperturbed solar wind velocity.</p></caption>
          <?xmltex \igopts{width=204.859843pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f01.pdf"/>

        </fig>

      <p>According to <xref ref-type="bibr" rid="bib1.bibx28" id="text.27"/>, the MHD equations are solved using a two-step
Lax–Wendroff method <xref ref-type="bibr" rid="bib1.bibx21" id="paren.28"/>, which has an accuracy of second order in
space and time. This numerical scheme uses finite difference approximations,
which require the solution to be described on a discrete grid. The
discretization of the MSP coordinates <inline-formula><mml:math id="M73" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mi>z</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is related to the indices
<inline-formula><mml:math id="M74" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, with <inline-formula><mml:math id="M75" display="inline"><mml:mi>i</mml:mi></mml:math></inline-formula> for <inline-formula><mml:math id="M76" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula>, <inline-formula><mml:math id="M77" display="inline"><mml:mi>j</mml:mi></mml:math></inline-formula> for <inline-formula><mml:math id="M78" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula>, and <inline-formula><mml:math id="M79" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula> for <inline-formula><mml:math id="M80" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula>. Thereby, valid
values for the indices are <inline-formula><mml:math id="M81" display="inline"><mml:mrow><mml:mi>i</mml:mi><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>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>;
<inline-formula><mml:math id="M82" display="inline"><mml:mrow><mml:mi>j</mml:mi><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>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>; and <inline-formula><mml:math id="M83" display="inline"><mml:mrow><mml:mi>k</mml:mi><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>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>. The
number of spatial grid points <inline-formula><mml:math id="M84" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>grid</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> is given by
            <disp-formula id="Ch1.E14" content-type="numbered"><mml:math id="M85" display="block"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>grid</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mfenced open="(" close=")"><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mfenced><mml:mo>⋅</mml:mo><mml:mfenced close=")" open="("><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mfenced><mml:mo>⋅</mml:mo><mml:mfenced close=")" open="("><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The boundaries of the simulation box along the <inline-formula><mml:math id="M86" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> direction are located at
<inline-formula><mml:math id="M87" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M88" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. Along the <inline-formula><mml:math id="M89" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula> direction, the
boundaries are located at <inline-formula><mml:math id="M90" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M91" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>
and along the <inline-formula><mml:math id="M92" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> direction at <inline-formula><mml:math id="M93" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and
<inline-formula><mml:math id="M94" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. The distance between grid points is
<inline-formula><mml:math id="M95" 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:mtext>L</mml:mtext></mml:msub><mml:mo>/</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> in <inline-formula><mml:math id="M96" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> direction, <inline-formula><mml:math id="M97" 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:mtext>L</mml:mtext></mml:msub><mml:mo>/</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> in
<inline-formula><mml:math id="M98" display="inline"><mml:mi>y</mml:mi></mml:math></inline-formula> direction, and <inline-formula><mml:math id="M99" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>z</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>z</mml:mi><mml:mtext>L</mml:mtext></mml:msub><mml:mo>/</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> in
<inline-formula><mml:math id="M100" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> direction. Within the
grid, the planet is located at <inline-formula><mml:math id="M101" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>,
with <inline-formula><mml:math id="M102" display="inline"><mml:mrow><mml:msub><mml:mi>i</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>,
<inline-formula><mml:math id="M103" display="inline"><mml:mrow><mml:msub><mml:mi>j</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M104" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:math></inline-formula>.
The grid points <inline-formula><mml:math id="M105" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> are related to a position <inline-formula><mml:math id="M106" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mi>z</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> by
            <disp-formula id="Ch1.E15" content-type="numbered"><mml:math id="M107" display="block"><mml:mtable class="aligned" columnspacing="1em" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mi>x</mml:mi></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0.5</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi><mml:mfenced close=")" open="("><mml:mn mathvariant="normal">2</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>i</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mi>y</mml:mi></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0.5</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi><mml:mfenced close=")" open="("><mml:mn mathvariant="normal">2</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>j</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mi>z</mml:mi></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0.5</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>z</mml:mi><mml:mfenced close=")" open="("><mml:mn mathvariant="normal">2</mml:mn><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>k</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
          The time <inline-formula><mml:math id="M108" display="inline"><mml:mi>t</mml:mi></mml:math></inline-formula> is discretized by the index <inline-formula><mml:math id="M109" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula> with
<inline-formula><mml:math id="M110" 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:mi mathvariant="normal">…</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, whereby <inline-formula><mml:math id="M111" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> is related to <inline-formula><mml:math id="M112" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> and
<inline-formula><mml:math id="M113" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> to <inline-formula><mml:math id="M114" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>t</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. This corresponds to a constant time
step of <inline-formula><mml:math id="M115" 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:mtext>E</mml:mtext></mml:msub><mml:mo>/</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The spatial and
time-dependent solution of the MHD equations <inline-formula><mml:math id="M116" 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>x</mml:mi><mml:mo>,</mml:mo><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mi>z</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> defined by
Eq. (<xref ref-type="disp-formula" rid="Ch1.E8"/>) can be represented by <inline-formula><mml:math id="M117" display="inline"><mml:mrow><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup></mml:mrow></mml:math></inline-formula>, whereby
<inline-formula><mml:math id="M118" display="inline"><mml:mrow><mml:mi>n</mml:mi><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:mtext>var</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> refers to a component of the vector <inline-formula><mml:math id="M119" display="inline"><mml:mi mathvariant="bold-italic">u</mml:mi></mml:math></inline-formula>.
Here, the number of the MHD variables is <inline-formula><mml:math id="M120" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>var</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">8</mml:mn></mml:mrow></mml:math></inline-formula>.</p>
      <p>Boundary conditions are required to solve the MHD equations. The inflow
boundary conditions at <inline-formula><mml:math id="M121" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> are determined by the solar wind
conditions. The solar wind velocity vector is restricted to the <inline-formula><mml:math id="M122" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis,
perpendicular to the planet's rotation axis. In contrast to the more simple
inflow boundary conditions of <xref ref-type="bibr" rid="bib1.bibx28" id="text.29"/>, we use time-varying solar
wind conditions:

                <disp-formula specific-use="align"><mml:math id="M123" display="block"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>:</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">ρ</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mfenced open="." close=""><mml:msub><mml:mi>p</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo></mml:mfenced></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msup><mml:mfenced close=")" open="."><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mfenced><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>

            Instead of using the mass density, the ion density <inline-formula><mml:math id="M124" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="italic">ρ</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>/</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> can be used as well, with the proton mass
<inline-formula><mml:math id="M125" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1.672621898</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">27</mml:mn></mml:mrow></mml:msup><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">kg</mml:mi></mml:mrow></mml:math></inline-formula>. In general, the
physical properties at grid points at <inline-formula><mml:math id="M126" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> can be replaced by the
solar wind conditions in every time step. The solar wind vector discretized
in time is <inline-formula><mml:math id="M127" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mrow><mml:mtext>SW</mml:mtext><mml:mo>,</mml:mo><mml:mi>l</mml:mi></mml:mrow></mml:msub><mml:mo>:=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. All
other outer boundaries are outflow boundaries according to <xref ref-type="bibr" rid="bib1.bibx28" id="text.30"/>.</p>
      <p>In addition to the boundary conditions, our simulation requires initial
conditions. Therefore, at time step <inline-formula><mml:math id="M128" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>, the physical quantities have to be
determined in the entire simulation domain. The velocity <inline-formula><mml:math id="M129" display="inline"><mml:mi mathvariant="bold-italic">v</mml:mi></mml:math></inline-formula> is assumed
to be zero, so that <inline-formula><mml:math id="M130" display="inline"><mml:mrow><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mn mathvariant="normal">3</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mn mathvariant="normal">4</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula>. The
density <inline-formula><mml:math id="M131" display="inline"><mml:mi mathvariant="italic">ρ</mml:mi></mml:math></inline-formula> and pressure <inline-formula><mml:math id="M132" display="inline"><mml:mi>p</mml:mi></mml:math></inline-formula> are initialized by their solar wind values,
<inline-formula><mml:math id="M133" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">ρ</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M134" display="inline"><mml:mrow><mml:msub><mml:mi>p</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>, respectively. Thus,
<inline-formula><mml:math id="M135" display="inline"><mml:mrow><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="italic">ρ</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M136" display="inline"><mml:mrow><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mn mathvariant="normal">5</mml:mn></mml:msubsup><mml:mo>=</mml:mo><mml:msub><mml:mi>p</mml:mi><mml:mtext>SW</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> are
used. The initial values of the magnetic field are determined by the
planetary magnetic field. Taking only the dipole and the quadrupole moments
into account, the planetary magnetic field can be calculated by
Eq. (<xref ref-type="disp-formula" rid="Ch1.E7"/>) with Eqs. (<xref ref-type="disp-formula" rid="Ch1.E2"/>) and (<xref ref-type="disp-formula" rid="Ch1.E5"/>). The
initial conditions determine a stationary solution at a certain time step
<inline-formula><mml:math id="M137" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> with <inline-formula><mml:math id="M138" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The solar wind
conditions for <inline-formula><mml:math id="M139" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> are set to the values at <inline-formula><mml:math id="M140" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. For
<inline-formula><mml:math id="M141" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>&gt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, time-dependent solar wind conditions from spacecraft
observations are applied in the simulation and the results are compared to
spacecraft observations.</p>
      <p>The extended magnetic field geometry, especially the arbitrarily aligned
dipole moment, can cause a complex motion of the plasma in the magnetosphere
due to co-rotation of the plasma or magnetic reconnection, for example. Therefore,
different from the simulation described by <xref ref-type="bibr" rid="bib1.bibx28" id="text.31"/>, the simulation
requires appropriate inner boundary conditions to allow a stable simulation
for long time intervals. The planetary surface is approximated by a spherical
surface with the distance <inline-formula><mml:math id="M142" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> to the planet's center. The distance
of a grid point <inline-formula><mml:math id="M143" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> to the center is defined by
            <disp-formula id="Ch1.E16" content-type="numbered"><mml:math id="M144" display="block"><mml:mrow><?xmltex \hack{\hbox\bgroup\fontsize{8.8}{8.8}\selectfont$\displaystyle}?><mml:msub><mml:mi>r</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:msub><mml:mo>:=</mml:mo><mml:msqrt><mml:mrow><mml:mo>(</mml:mo><mml:mo>(</mml:mo><mml:mi>i</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>)</mml:mo><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>x</mml:mi><mml:msup><mml:mo>)</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>+</mml:mo><mml:mo>(</mml:mo><mml:mo>(</mml:mo><mml:mi>j</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>y</mml:mi><mml:msup><mml:mo>)</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>+</mml:mo><mml:mo>(</mml:mo><mml:mo>(</mml:mo><mml:mi>k</mml:mi><mml:mo>-</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>z</mml:mi><mml:msup><mml:mo>)</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:msqrt><mml:mo>.</mml:mo><?xmltex \hack{$\egroup}?></mml:mrow></mml:math></disp-formula>
          The velocity of the plasma inside the planet, i.e., <inline-formula><mml:math id="M145" display="inline"><mml:mrow><mml:msub><mml:mi>r</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:msub><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, is
            <disp-formula id="Ch1.E17" content-type="numbered"><mml:math id="M146" display="block"><mml:mrow><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mi>l</mml:mi><mml:mo>,</mml:mo><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow><mml:mi>n</mml:mi></mml:msubsup><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mo>,</mml:mo><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mtext>for</mml:mtext><mml:mspace linebreak="nobreak" width="0.25em"/><mml:msub><mml:mi>r</mml:mi><mml:mrow><mml:mi>i</mml:mi><mml:mo>,</mml:mo><mml:mi>j</mml:mi><mml:mo>,</mml:mo><mml:mi>k</mml:mi></mml:mrow></mml:msub><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>,</mml:mo><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mi>n</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">3</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">4</mml:mn><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          It is also possible to set only the normal component of the velocity to zero.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F2"><caption><p>Density and pressure gradients across the planetary surface are
related to forces if the MHD equations are solved within the entire
simulation box. To minimize this interaction, the density and the pressure at
the planetary surface are set to the values outside the planet.</p></caption>
          <?xmltex \igopts{width=204.859843pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f02.pdf"/>

        </fig>

      <p>Density and pressure gradients between the planet's interior and the plasma
outside must not cause forces on the plasma. However, the MHD equations are
solved within the entire simulation domain. This can lead to an interaction
as sketched in Fig. <xref ref-type="fig" rid="Ch1.F2"/>. The values at grid points inside
the planet, which have at least one neighboring grid point outside, are replaced
in every time step by average values of the surrounding neighboring grid points
outside the planet, i.e., the non-boundary neighbors. Neighboring grid
points of a grid point <inline-formula><mml:math id="M147" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> are <inline-formula><mml:math id="M148" display="inline"><mml:mrow><mml:mo mathvariant="italic">{</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>i</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>±</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>±</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>±</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo><mml:mo mathvariant="italic">}</mml:mo></mml:mrow></mml:math></inline-formula>. This procedure
suppresses the interaction of density and pressure gradients across the
planet.</p>
      <p>In contrast to the density and gas pressure, the magnetic field can interact
with the planet due to electromagnetic induction, which is additionally implemented. Time-dependent variations in the magnetic field inside the
planet are calculated by Eq. (<xref ref-type="disp-formula" rid="Ch1.E12"/>). We assume the velocity
inside the planet to be zero, not considering the detailed time-dependent
dynamo action. This is justified due to the very different timescales of
magnetospheric and dynamo action. Concerning a possible coupling between
magnetosphere and dynamo, see <xref ref-type="bibr" rid="bib1.bibx13" id="text.32"/> and <xref ref-type="bibr" rid="bib1.bibx15" id="text.33"/>.
Thus, the induction equation simplifies to the diffusion equation
            <disp-formula id="Ch1.E18" content-type="numbered"><mml:math id="M149" display="block"><mml:mrow><mml:msub><mml:mo>∂</mml:mo><mml:mi>t</mml:mi></mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mfenced close=")" open="("><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mi mathvariant="italic">η</mml:mi><mml:mrow><mml:msub><mml:mi mathvariant="italic">μ</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">∇</mml:mi><mml:mo>×</mml:mo><mml:mi mathvariant="bold-italic">B</mml:mi></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The resistivity distribution in the simulation box is modeled by
            <disp-formula id="Ch1.E19" content-type="numbered"><mml:math id="M150" display="block"><mml:mrow><mml:mi mathvariant="italic">η</mml:mi><mml:mo>=</mml:mo><mml:mfenced open="{" close=""><mml:mtable columnspacing="1em" class="cases" rowspacing="0.2ex" columnalign="left left" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi mathvariant="italic">η</mml:mi><mml:mtext>Core</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mi>r</mml:mi><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mtext>Core</mml:mtext></mml:msub></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi mathvariant="italic">η</mml:mi><mml:mtext>Mantle</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>Core</mml:mtext></mml:msub><mml:mo>≤</mml:mo><mml:mi>r</mml:mi><mml:mo>≤</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:msub><mml:mi mathvariant="italic">η</mml:mi><mml:mtext>A</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mtext>otherwise</mml:mtext></mml:mtd></mml:mtr></mml:mtable></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Thereby, the planet's interior consists of two regions with different
resistivity, a core with <inline-formula><mml:math id="M151" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">η</mml:mi><mml:mtext>Core</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:msub><mml:mi mathvariant="italic">σ</mml:mi><mml:mtext>Core</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and a
mantle with <inline-formula><mml:math id="M152" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">η</mml:mi><mml:mtext>Mantle</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>/</mml:mo><mml:msub><mml:mi mathvariant="italic">σ</mml:mi><mml:mtext>Mantle</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The resistivity
outside the planet is assumed to be constant with <inline-formula><mml:math id="M153" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">η</mml:mi><mml:mtext>A</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. As a
consequence, the interaction due to diffusion is allowed depending on the
electrical resistivity of the planet. This is of particular importance if
Mercury is considered; however, it is of minor importance for Earth.</p>
</sec>
<sec id="Ch1.S2.SS3">
  <title>Using spacecraft data</title>
      <p>The simulation uses solar wind parameters as boundary conditions. With
respect to the two spacecraft in mission BepiColombo, simultaneous observations
of the solar wind as well as the magnetic field close to the planet will be
available in the future. Thereby, the solar wind conditions can be determined
either directly by in situ measurements or by using the reconstruction method
by <xref ref-type="bibr" rid="bib1.bibx26" id="text.34"/> from data within the interaction region. This allows a
precise determination with a high time resolution of the solar wind
conditions. The THEMIS mission provides data from similar spacecraft
constellations at Earth. The solar wind conditions observed by a
spacecraft need to be transferred to the inflow boundary of the simulation
box. Therefore, the solar wind data are shifted by <inline-formula><mml:math id="M154" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>t</mml:mi><mml:mtext>SC/in</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>,
which is given by
            <disp-formula id="Ch1.E20" content-type="numbered"><mml:math id="M155" display="block"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>t</mml:mi><mml:mtext>SC/in</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">n</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>⋅</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC/in</mml:mtext></mml:msub></mml:mrow><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">n</mml:mi><mml:mtext>P</mml:mtext></mml:msub><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mtext>SW</mml:mtext></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M156" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">n</mml:mi><mml:mtext>P</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> is the solar wind's phase plane normal vector,
<inline-formula><mml:math id="M157" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC/in</mml:mtext></mml:msub><mml:mo>:=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>in</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> is
the distance vector between the spacecraft's position <inline-formula><mml:math id="M158" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>,
with the center of the inflow boundary <inline-formula><mml:math id="M159" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>in</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
      <p>For a comparison between simulation results and spacecraft data, the data
need to be transferred into MSP coordinates. Therefore, the THEMIS
data are first transferred into geographic (GEO) coordinates. Vectors in these
coordinates can be transferred into MSP coordinates by rotation matrices
<inline-formula><mml:math id="M160" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M161" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. These matrices
are defined by
            <disp-formula id="Ch1.E21" content-type="numbered"><mml:math id="M162" display="block"><mml:mtable class="aligned" columnspacing="1em" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi mathvariant="bold">R</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:mfenced open="(" close=")"><mml:mtable class="matrix" columnalign="center center center" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd><mml:mtd><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd><mml:mtd><mml:mn mathvariant="normal">1</mml:mn></mml:mtd><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mo>-</mml:mo><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd><mml:mtd><mml:mrow><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi mathvariant="bold">R</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>=</mml:mo><mml:mfenced close=")" open="("><mml:mtable class="matrix" columnalign="center center center" framespacing="0em"><mml:mtr><mml:mtd><mml:mrow><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mo>-</mml:mo><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd><mml:mtd><mml:mn mathvariant="normal">0</mml:mn></mml:mtd><mml:mtd><mml:mn mathvariant="normal">1</mml:mn></mml:mtd></mml:mtr></mml:mtable></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
          The rotation angles <inline-formula><mml:math id="M163" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M164" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> are
determined by the solar wind velocity vector:
            <disp-formula id="Ch1.E22" content-type="numbered"><mml:math id="M165" display="block"><mml:mrow><?xmltex \hack{\hbox\bgroup\fontsize{9.2}{9.2}\selectfont$\displaystyle}?><mml:mtable class="aligned" columnspacing="1em" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>v</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:mo>|</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:mo>|</mml:mo></mml:mrow></mml:mfrac></mml:mstyle><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi>arccos⁡</mml:mi><mml:mfenced open="(" close=")"><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>v</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub></mml:mrow><mml:msqrt><mml:mrow><mml:msubsup><mml:mi>v</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup><mml:mo>+</mml:mo><mml:msubsup><mml:mi>v</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup></mml:mrow></mml:msqrt></mml:mfrac></mml:mstyle></mml:mfenced><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub></mml:mrow><mml:mrow><mml:mo>|</mml:mo><mml:msub><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:mo>|</mml:mo></mml:mrow></mml:mfrac></mml:mstyle><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mi>arccos⁡</mml:mi><mml:mfenced close=")" open="("><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub></mml:mrow><mml:msqrt><mml:mrow><mml:msubsup><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup><mml:mo>+</mml:mo><mml:msubsup><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup></mml:mrow></mml:msqrt></mml:mfrac></mml:mstyle></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable><?xmltex \hack{$\egroup}?></mml:mrow></mml:math></disp-formula>
          Here,
<inline-formula><mml:math id="M166" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mtext>SW,GEO</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>v</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>
is the solar wind velocity vector using GEO coordinates and
<inline-formula><mml:math id="M167" display="inline"><mml:mrow><mml:msub><mml:mover accent="true"><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mtext>SW,GEO</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> is defined by

                <disp-formula specific-use="align"><mml:math id="M168" display="block"><mml:mtable displaystyle="true"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msub><mml:mover accent="true"><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mtext>SW,GEO</mml:mtext></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>:=</mml:mo><mml:msup><mml:mfenced open="(" close=")"><mml:msub><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mover accent="true"><mml:mi>v</mml:mi><mml:mo mathvariant="normal">̃</mml:mo></mml:mover><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>SW,GEO</mml:mtext></mml:mrow></mml:msub></mml:mfenced><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle class="stylechange" displaystyle="true"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>:=</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi mathvariant="bold-italic">v</mml:mi><mml:mtext>SW,GEO</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>

            Then, a vector in GEO coordinates <inline-formula><mml:math id="M169" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mtext>GEO</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> can be transferred
into a vector in MSP coordinates <inline-formula><mml:math id="M170" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mtext>MSP</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> by
            <disp-formula id="Ch1.E23" content-type="numbered"><mml:math id="M171" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mtext>MSP</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>R</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>R</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mtext>GEO</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Applying the coordinate transformation, the solar wind velocity becomes
parallel to the <inline-formula><mml:math id="M172" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis.</p>
      <p>For the validation of the code, the known planetary dipole moment components
of Earth according to Table <xref ref-type="table" rid="Ch1.T1"/> with the normalization
constant of Eq. (<xref ref-type="disp-formula" rid="Ch1.E6"/>) can be used:
            <disp-formula id="Ch1.E24" content-type="numbered"><mml:math id="M173" display="block"><mml:mtable rowspacing="0.2ex" class="aligned" columnspacing="1em" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi>m</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.051</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi>m</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mn mathvariant="normal">0.158</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.945</mml:mn><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
          To include the rotation of the planetary magnetic field due to the planet's
rotation, the magnetic moments of the magnetic field are modified according
to Eq. (<xref ref-type="disp-formula" rid="Ch1.E23"/>). The angles of the transformation will continuously vary
along the spacecraft's trajectory. The rotation of the planetary magnetic
field is performed every 200 time steps by subtracting the planetary field
contribution from the total magnetic field at the time step considered and
adding the planetary magnetic field corresponding to the new angles
<inline-formula><mml:math id="M174" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">θ</mml:mi><mml:mtext>K</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M175" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="italic">λ</mml:mi><mml:mtext>K</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
</sec>
<sec id="Ch1.S2.SS4">
  <title>Validation of the simulation code</title>
      <p>To validate the modified simulation code, we compare a simulation using the
known dipole moment of Earth according to Table <xref ref-type="table" rid="Ch1.T1"/> with
THEMIS magnetosheath data from 24 August 2008 measured by THC
<xref ref-type="bibr" rid="bib1.bibx2" id="paren.35"/>. Solar wind conditions are observed by THB during
the magnetosheath transition. The size of the simulation box is
<inline-formula><mml:math id="M176" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mtext>L</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">50.0</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M177" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M178" display="inline"><mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mtext>L</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">60.0</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M179" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, and
<inline-formula><mml:math id="M180" display="inline"><mml:mrow><mml:msub><mml:mi>z</mml:mi><mml:mtext>L</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">60.0</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M181" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, with the planet in the center. The simulation
uses a grid with <inline-formula><mml:math id="M182" display="inline"><mml:mrow><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">200</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M183" display="inline"><mml:mrow><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">150</mml:mn></mml:mrow></mml:math></inline-formula>, and
<inline-formula><mml:math id="M184" display="inline"><mml:mrow><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">150</mml:mn></mml:mrow></mml:math></inline-formula>. Furthermore, the values of the diffusion coefficients were
chosen according to <xref ref-type="bibr" rid="bib1.bibx28" id="text.36"/> for a stable simulation at Earth.
The data and corresponding simulation results on the spacecraft's trajectory
are presented in Fig. <xref ref-type="fig" rid="Ch1.F3"/>.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F3"><caption><p>THC magnetosheath data (blue) observed on 24 August 2008 and the
corresponding MHD simulation results (black) using the solar wind
observations of THB (red). </p></caption>
          <?xmltex \igopts{width=241.848425pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f03.pdf"/>

        </fig>

      <p>The bow shock is observed at about 00:30 UT and the magnetopause at about
03:30 UT in accordance with the simulation results. Most physical quantities
show a good agreement between actual observations and simulation results.
Only the ion density in the magnetosheath is observed to be higher than in
the simulation. Furthermore, the magnetic field in the magnetosphere is about
15 <inline-formula><mml:math id="M185" display="inline"><mml:mi mathvariant="normal">nT</mml:mi></mml:math></inline-formula> weaker than measured by the spacecraft. The magnetopause
thickness is observed to be smaller than in the simulation, which is related
to the diffusion coefficients required for a stable simulation. These
differences between simulation result and data are mainly caused by numerical
errors. This can impact an estimation of the planetary magnetic field. The
lower magnetospheric magnetic field will tend to overestimate the planetary
magnetic field strength. However, this overestimation is limited due to the
magnetopause location. A much stronger dipole moment will increase the
magnetopause distance and the magnetic field will increase in the
magnetosheath, which is not in accord with the observations. In general, the
MHD simulation results agree well with the observations made. In a future
step, the simulation code might be improved to reduce differences between
simulation results and observations. An adaptive mesh refinement should be
introduced to enhance the accuracy close to the magnetopause and reduce
numerical errors.</p>
</sec>
</sec>
<sec id="Ch1.S3">
  <title>Data assimilation</title>
<sec id="Ch1.S3.SS1">
  <title>Cost function and its minimization</title>
      <p>In the previous section, spacecraft data were qualitatively compared to the
results of the MHD simulation. To quantify the deviations, a cost function is
introduced. Therefore, the method of least squares is used. The sum of
squared residuals, FQ, of <inline-formula><mml:math id="M186" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>-measured values <inline-formula><mml:math id="M187" display="inline"><mml:mrow><mml:msub><mml:mi>y</mml:mi><mml:mi>m</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> at points
<inline-formula><mml:math id="M188" display="inline"><mml:mrow><mml:msub><mml:mi>x</mml:mi><mml:mi>m</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> with a model <inline-formula><mml:math id="M189" display="inline"><mml:mi>f</mml:mi></mml:math></inline-formula> depending on the parameters <inline-formula><mml:math id="M190" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula> is
            <disp-formula id="Ch1.E25" content-type="numbered"><mml:math id="M191" display="block"><mml:mrow><mml:mi mathvariant="normal">FQ</mml:mi><mml:mo>:=</mml:mo><mml:munderover><mml:mo movablelimits="false">∑</mml:mo><mml:mrow><mml:mi>m</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:munderover><mml:msup><mml:mfenced open="(" close=")"><mml:msub><mml:mi>y</mml:mi><mml:mi>m</mml:mi></mml:msub><mml:mo>-</mml:mo><mml:mi>f</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi>x</mml:mi><mml:mi>m</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mfenced><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The parameters <inline-formula><mml:math id="M192" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula> of the MHD model are related to a vector space <inline-formula><mml:math id="M193" display="inline"><mml:mi mathvariant="script">P</mml:mi></mml:math></inline-formula>.
Here, for simplification, we consider only the planetary magnetic field parameters of the dipole and quadrupole.
Thus, the parameters are
            <disp-formula id="Ch1.E26" content-type="numbered"><mml:math id="M194" display="block"><mml:mrow><?xmltex \hack{\hbox\bgroup\fontsize{9.2}{9.2}\selectfont$\displaystyle}?><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">m</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">Q</mml:mi><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>,</mml:mo><?xmltex \hack{$\egroup}?></mml:mrow></mml:math></disp-formula>
          with <inline-formula><mml:math id="M195" display="inline"><mml:mrow><mml:mi mathvariant="bold-italic">Q</mml:mi><mml:mo>:=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>x</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>Q</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mi>z</mml:mi></mml:mrow></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>. The
vector space corresponding to these parameters is named
<inline-formula><mml:math id="M196" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="script">P</mml:mi><mml:mtext>D,Q</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The parameters of the model <inline-formula><mml:math id="M197" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula> are
estimated by minimizing the sum of squared residuals FQ. Transferred to the
magnetic field observations
<inline-formula><mml:math id="M198" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>data</mml:mtext></mml:msub><mml:mo>:=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>data</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>data</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>data</mml:mtext></mml:mrow></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>
and MHD simulation results
<inline-formula><mml:math id="M199" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>simu</mml:mtext></mml:msub><mml:mo>:=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>simu</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>simu</mml:mtext></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>simu</mml:mtext></mml:mrow></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>
with the spacecraft's position in the orbit <inline-formula><mml:math id="M200" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>, the cost
function <inline-formula><mml:math id="M201" display="inline"><mml:mi>K</mml:mi></mml:math></inline-formula> is
            <disp-formula id="Ch1.E27" content-type="numbered"><mml:math id="M202" display="block"><mml:mrow><?xmltex \hack{\hbox\bgroup\fontsize{9.5}{9.5}\selectfont$\displaystyle}?><mml:mtable rowspacing="0.2ex" class="aligned" columnspacing="1em" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msubsup><mml:mo>∑</mml:mo><mml:mrow><mml:mi>m</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:msubsup><mml:mo mathsize="1.5em">(</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msup><mml:mfenced open="(" close=")"><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>data</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>simu</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mfenced><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>+</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msup><mml:mfenced close=")" open="("><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>data</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>simu</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mfenced><mml:mn mathvariant="normal">2</mml:mn></mml:msup></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>+</mml:mo></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msup><mml:mfenced close=")" open="("><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>data</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:msub><mml:mi>B</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>simu</mml:mtext></mml:mrow></mml:msub><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mrow><mml:mtext>SC</mml:mtext><mml:mo>,</mml:mo><mml:mi>m</mml:mi></mml:mrow></mml:msub><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mfenced><mml:mn mathvariant="normal">2</mml:mn></mml:msup><mml:mo mathsize="1.5em">)</mml:mo><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable><?xmltex \hack{$\egroup}?></mml:mrow></mml:math></disp-formula></p>
      <p>A gradient-based optimization can be used to minimize the cost function with
respect to the parameters of the model <inline-formula><mml:math id="M203" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula>. Starting from a point
<inline-formula><mml:math id="M204" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> in parameter space, new points
<inline-formula><mml:math id="M205" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mi>k</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">m</mml:mi><mml:mi>k</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">Q</mml:mi><mml:mi>k</mml:mi></mml:msub><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> are determined with every <inline-formula><mml:math id="M206" display="inline"><mml:mi>k</mml:mi></mml:math></inline-formula>th
gradient calculation. This optimization problem is without constraints and
can be solved using a quasi-Newton method. We use the
Broyden–Fletcher–Goldfarb–Shanno (BFGS) algorithm <xref ref-type="bibr" rid="bib1.bibx32" id="paren.37"/> to
minimize the cost function.</p>
      <p>The algorithm requires the gradient of the cost function <inline-formula><mml:math id="M207" display="inline"><mml:mi>K</mml:mi></mml:math></inline-formula> with respect to
the parameters of the model at points <inline-formula><mml:math id="M208" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mi>k</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> in parameter space. There
are different possibilities to compute these gradients. For example, the
gradient can be approximated by difference quotients:
            <disp-formula id="Ch1.E28" content-type="numbered"><mml:math id="M209" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:msub><mml:mi mathvariant="normal" mathsize="2.0em">|</mml:mi><mml:mrow><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mi>k</mml:mi></mml:msub></mml:mrow></mml:msub><mml:mo>≈</mml:mo><mml:munderover><mml:mo movablelimits="false">∑</mml:mo><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub></mml:mrow></mml:munderover><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mi>k</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>s</mml:mi><mml:mi>l</mml:mi></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>l</mml:mi></mml:msub><mml:mo>)</mml:mo><mml:mo>-</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mi>k</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>s</mml:mi><mml:mi>l</mml:mi></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>l</mml:mi></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          where <inline-formula><mml:math id="M210" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>l</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> denotes the <inline-formula><mml:math id="M211" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula>th unit vector and <inline-formula><mml:math id="M212" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>s</mml:mi><mml:mi>l</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> is the
corresponding step size in parameter space <inline-formula><mml:math id="M213" display="inline"><mml:mi mathvariant="script">P</mml:mi></mml:math></inline-formula>. The sum of
Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>) includes all dimensions in parameter space
<inline-formula><mml:math id="M214" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub><mml:mo>:=</mml:mo><mml:mtext>dim</mml:mtext><mml:mo>(</mml:mo><mml:mi mathvariant="script">P</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. Note that the gradient
<inline-formula><mml:math id="M215" display="inline"><mml:mrow><mml:msub><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:msub><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is used as a column vector. The step sizes
<inline-formula><mml:math id="M216" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>s</mml:mi><mml:mi>l</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> need to be adequately small to approximate the gradient
sufficiently well.</p>
</sec>
<sec id="Ch1.S3.SS2">
  <title>Automatic differentiation and adjoint method</title>
      <p>Each calculation of the cost function for a certain set of parameters
requires a full global MHD simulation of the data along the spacecraft's
trajectory. Thus, <inline-formula><mml:math id="M217" display="inline"><mml:mrow><mml:mo>(</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> simulations have to be performed in
the calculation of the gradient according to Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>). In
general, the calculation is extremely time-consuming because of the
nonlinearity of the MHD equations.</p>
      <p>Another possibility to calculate the gradient <inline-formula><mml:math id="M218" display="inline"><mml:mrow><mml:msub><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:msub><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the differentiation using analytical expressions, as explained
in detail in the following. The solution of the MHD simulation depending on
space and time coordinates <inline-formula><mml:math id="M219" 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> can be represented by a
vector <inline-formula><mml:math id="M220" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> on a numerical grid. This vector contains the
solution at all time steps and discrete positions in space for all physical
quantities in its components. Thus, the number of components of the vector
<inline-formula><mml:math id="M221" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> is</p>
      <p><disp-formula id="Ch1.E29" content-type="numbered"><mml:math id="M222" display="block"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>var</mml:mtext></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>N</mml:mi><mml:mtext>grid</mml:mtext></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          with the constants as defined in the previous chapter. The simulation code
calculates the time- and spatially dependent solution of the MHD quantities
<inline-formula><mml:math id="M223" 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> iteratively. The iteration is implemented by a time loop
in the simulation code, whereby <inline-formula><mml:math id="M224" 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>l</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><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 computed
from the results of the previous time step <inline-formula><mml:math id="M225" 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:mo>(</mml:mo><mml:mi>l</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><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> and the boundary conditions. Equivalently, the time iteration of
<inline-formula><mml:math id="M226" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula> can be considered as an iteration that steadily improves the approximation
of the final solution vector <inline-formula><mml:math id="M227" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> , sketched in
Fig. <xref ref-type="fig" rid="Ch1.F4"/>. Thereby, after the <inline-formula><mml:math id="M228" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula>th iteration step, the vector
<inline-formula><mml:math id="M229" display="inline"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mi>l</mml:mi></mml:msubsup></mml:mrow></mml:math></inline-formula> contains the valid solution for all time steps that
satisfy <inline-formula><mml:math id="M230" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>≤</mml:mo><mml:mi>l</mml:mi><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mi mathvariant="normal">Δ</mml:mi><mml:mi>t</mml:mi></mml:mrow></mml:math></inline-formula>. The final solution
<inline-formula><mml:math id="M231" display="inline"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> is obtained
after <inline-formula><mml:math id="M232" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> iteration steps. At the 0th iteration step, the
simulation needs to be initialized. The simulation code calculates the
solution in the <inline-formula><mml:math id="M233" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula>th iteration step from the previous approximation by a
function <inline-formula><mml:math id="M234" display="inline"><mml:mi>F</mml:mi></mml:math></inline-formula>. Thus, the <inline-formula><mml:math id="M235" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula>th iteration step can be expressed by
            <disp-formula id="Ch1.E30" content-type="numbered"><mml:math id="M236" display="block"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mi>l</mml:mi></mml:msubsup><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi>F</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:mi>l</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The cost function <inline-formula><mml:math id="M237" display="inline"><mml:mrow><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> depends
implicitly on the parameters <inline-formula><mml:math id="M238" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula>. With respect to the nested
dependences of the solution in Eq. (<xref ref-type="disp-formula" rid="Ch1.E30"/>), the gradient of the
cost function can be expressed by the chain rule:
            <disp-formula id="Ch1.E31" content-type="numbered"><mml:math id="M239" display="block"><mml:mtable columnspacing="1em" class="aligned" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:mfrac></mml:mstyle></mml:mrow></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup></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:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>⋅</mml:mo><mml:mi mathvariant="normal">…</mml:mi></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mo>⋅</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mn mathvariant="normal">1</mml:mn></mml:msubsup></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mn mathvariant="normal">0</mml:mn></mml:msubsup></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:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mn mathvariant="normal">0</mml:mn></mml:msubsup><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mspace linebreak="nobreak" width="0.125em"/><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula>
          This expression contains the stationary solution at <inline-formula><mml:math id="M240" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> because
<inline-formula><mml:math id="M241" display="inline"><mml:mrow><mml:mn mathvariant="normal">0</mml:mn><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub><mml:mo>&lt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. Although the cost function is evaluated
only after the stationary state has been obtained, i.e. <inline-formula><mml:math id="M242" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>&gt;</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>st</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, the
cost function also depends implicitly on prior time steps because the
stationary solution emerges from the initial state. The magnetic field
components of the initial state vector <inline-formula><mml:math id="M243" display="inline"><mml:mrow><mml:msubsup><mml:mi>u</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi>x</mml:mi></mml:mrow><mml:mn mathvariant="normal">0</mml:mn></mml:msubsup></mml:mrow></mml:math></inline-formula> depend on the parameters
<inline-formula><mml:math id="M244" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula> because the initial magnetic field distribution in the
simulation is created by the dipole and quadrupole parameters.
Equation (<xref ref-type="disp-formula" rid="Ch1.E31"/>) can be written as</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F4"><caption><p>The left column sketches the time iteration of the MHD simulation
code starting from the initial state at <inline-formula><mml:math id="M245" display="inline"><mml:mrow><mml:mi>t</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> determined by the planetary
magnetic field parameters <inline-formula><mml:math id="M246" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula>. At a certain time step, a stationary
solution <inline-formula><mml:math id="M247" display="inline"><mml:mrow><mml:msub><mml:mi>u</mml:mi><mml:mrow><mml:mtext>st</mml:mtext><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> is obtained and time iteration continues
using time-dependent solar wind conditions until the simulation ends at
<inline-formula><mml:math id="M248" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">u</mml:mi><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mtext>E</mml:mtext></mml:msub><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula>. In the middle column, the corresponding
interpretation of updating the complete time- and spatially dependent solution
vector <inline-formula><mml:math id="M249" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> is presented. The cost function <inline-formula><mml:math id="M250" display="inline"><mml:mi>K</mml:mi></mml:math></inline-formula> is
calculated from the final vector. On the right side, the automatic
differentiation gradient calculation is presented, starting from the bottom
and multiplying each factor according to Eq. (<xref ref-type="disp-formula" rid="Ch1.E31"/>). </p></caption>
          <?xmltex \igopts{width=236.157874pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f04.pdf"/>

        </fig>

      <p><disp-formula id="Ch1.E32" content-type="numbered"><mml:math id="M251" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:msup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>⋅</mml:mo><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>⋅</mml:mo><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>⋅</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>⋅</mml:mo><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>⋅</mml:mo><mml:mi mathvariant="bold">L</mml:mi></mml:mrow></mml:math></disp-formula>
          using the following abbreviations:
            <disp-formula id="Ch1.E33" content-type="numbered"><mml:math id="M252" display="block"><mml:mtable class="aligned" columnspacing="1em" rowspacing="0.2ex" displaystyle="true" columnalign="right left"><mml:mtr><mml:mtd><mml:mstyle class="stylechange" displaystyle="true"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle class="stylechange" displaystyle="true"/><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mi>l</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>:=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mi>l</mml:mi></mml:msubsup></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:mi>l</mml:mi><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:mfrac></mml:mstyle><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mo>,</mml:mo><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace width="0.25em" linebreak="nobreak"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mspace linebreak="nobreak" width="0.25em"/><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">2</mml:mn><mml:mo>,</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>,</mml:mo><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle displaystyle="true" class="stylechange"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:msup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>:=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>,</mml:mo></mml:mrow></mml:mtd></mml:mtr><mml:mtr><mml:mtd><mml:mstyle class="stylechange" displaystyle="true"/></mml:mtd><mml:mtd><mml:mrow><mml:mstyle displaystyle="true" class="stylechange"/><mml:mi mathvariant="bold">L</mml:mi><mml:mo>:=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mn mathvariant="normal">0</mml:mn></mml:msubsup><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:mtd></mml:mtr></mml:mtable></mml:math></disp-formula></p>
      <p>The function <inline-formula><mml:math id="M253" display="inline"><mml:mi>F</mml:mi></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E30"/>) is determined by the Lax–Wendroff
scheme of the differential equations, which is related to the MHD equations
and the boundary conditions. Therefore, the derivatives of the matrices in
Eq. (<xref ref-type="disp-formula" rid="Ch1.E31"/>) can be determined by analytical expressions. The time
iteration of the simulation code starts at <inline-formula><mml:math id="M254" display="inline"><mml:mrow><mml:mi>l</mml:mi><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0</mml:mn></mml:mrow></mml:math></inline-formula> and ends at
<inline-formula><mml:math id="M255" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. After the <inline-formula><mml:math id="M256" display="inline"><mml:mi>l</mml:mi></mml:math></inline-formula>th iteration step, the corresponding matrix
<inline-formula><mml:math id="M257" display="inline"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mi>l</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:math></inline-formula> can be calculated. Starting from a unit matrix, the
matrix containing the derivatives is multiplied after every time step to the
left side. Finally, after <inline-formula><mml:math id="M258" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> iterations, the gradient <inline-formula><mml:math id="M259" display="inline"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:math></inline-formula> is obtained.</p>
      <p>This procedure is called forward differentiation because the gradient is
calculated parallel to the execution of the time loop in the simulation code.
The advantage over the computation of the gradient using difference quotients
according to Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>) is that no errors due to finite step
sizes occur. Forward differentiation can be applied by hand to the simulation
code, or alternatively, by an automatic differentiation (AD) tool
<xref ref-type="bibr" rid="bib1.bibx36" id="paren.38"/>. Therefore, the cost function <inline-formula><mml:math id="M260" display="inline"><mml:mi>K</mml:mi></mml:math></inline-formula> and its dependent
parameters <inline-formula><mml:math id="M261" display="inline"><mml:mi mathvariant="bold-italic">s</mml:mi></mml:math></inline-formula> need to be declared in the code. The AD tool identifies
all implicit dependences. The required analytical expressions for the
derivations are taken from a library of the AD tool and inserted at the
correct positions in the code. Note that the library contains elementary
analytical derivations of all important expressions such as <inline-formula><mml:math id="M262" display="inline"><mml:mrow><mml:msub><mml:mo>∂</mml:mo><mml:mi>x</mml:mi></mml:msub><mml:mi>sin⁡</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mi>cos⁡</mml:mi><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. According to Eq. (<xref ref-type="disp-formula" rid="Ch1.E31"/>), the inserted
expressions are related to each other such that the required gradient is
computed. Several different AD tools were developed during the last decades.
Here, the Transformation of Algorithms in Fortran (TAF) tool
<xref ref-type="bibr" rid="bib1.bibx9" id="paren.39"/> from the company FastOpt was used
(<uri>http://www.FastOpt.com</uri>).</p>
      <p>An AD tool is able to differentiate a numerical code automatically, i.e., the
tool can be applied without considering details of the implementation.
However, for complex numerical codes, such as MHD simulation codes, problems
might occur. For example, codes using parallel computing function calls by
the message-passing interface (MPI), as they are also used for our simulation
code, usually need further treatment. The analytical forward differentiation
with an AD tool is also called automatic forward differentiation.</p>
      <p>The computational costs for the calculation of the gradient with difference
quotients or using automatic forward differentiation do not differ much.
However, the latter procedure leads to a more efficient approach, the adjoint
method. The adjoint method is extensively used for optimization problems in
fluid dynamics, e.g., drag minimization by variations in surface geometry
<xref ref-type="bibr" rid="bib1.bibx16 bib1.bibx30 bib1.bibx31 bib1.bibx24" id="paren.40"><named-content content-type="pre">e.g.,</named-content></xref> or in
seismology <xref ref-type="bibr" rid="bib1.bibx6" id="paren.41"><named-content content-type="pre">e.g.,</named-content></xref>.</p>
      <p>The adjoint method can be introduced with systems of linear equations, as
described briefly in the following
<xref ref-type="bibr" rid="bib1.bibx10 bib1.bibx23 bib1.bibx26" id="paren.42"><named-content content-type="pre">e.g.,</named-content></xref>. The symbols used for
variables, vectors, and matrices refer to the previous considerations and
will be marked by an asterisk as an index for distinction. We consider the
following system of equations
            <disp-formula id="Ch1.E34" content-type="numbered"><mml:math id="M263" display="block"><mml:mrow><mml:msub><mml:mi mathvariant="bold">A</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>,</mml:mo></mml:mrow></mml:math></disp-formula>
          with the matrices of the coefficients <inline-formula><mml:math id="M264" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">A</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>, the solution <inline-formula><mml:math id="M265" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>, and the inhomogeneity <inline-formula><mml:math id="M266" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>.
All elements of the matrices are real numbers.
The scalar product of a vector <inline-formula><mml:math id="M267" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> with the matrix <inline-formula><mml:math id="M268" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> should be calculated using the following equation:
            <disp-formula id="Ch1.E35" content-type="numbered"><mml:math id="M269" display="block"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:mi mathvariant="normal">?</mml:mi><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          This scalar product can be computed by solving Eq. (<xref ref-type="disp-formula" rid="Ch1.E34"/>) first, and then calculating the product of vector <inline-formula><mml:math id="M270" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> with the solution <inline-formula><mml:math id="M271" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>.
This approach is called forward calculation.</p>
      <p>Another possibility is to use the adjoint method. To deduce the method, the
product of a vector <inline-formula><mml:math id="M272" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> with both sides of the system of linear
Eq. (<xref ref-type="disp-formula" rid="Ch1.E34"/>) is considered:
            <disp-formula id="Ch1.E36" content-type="numbered"><mml:math id="M273" display="block"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">A</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The vector <inline-formula><mml:math id="M274" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> is defined by
            <disp-formula id="Ch1.E37" content-type="numbered"><mml:math id="M275" display="block"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">A</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          This equation is transposed, which leads to the adjoint system of equations
            <disp-formula id="Ch1.E38" content-type="numbered"><mml:math id="M276" display="block"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Using Eqs. (<xref ref-type="disp-formula" rid="Ch1.E36"/>) and (<xref ref-type="disp-formula" rid="Ch1.E37"/>), the scalar product (Eq. <xref ref-type="disp-formula" rid="Ch1.E35"/>) can be written as
            <disp-formula id="Ch1.E39" content-type="numbered"><mml:math id="M277" display="block"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">A</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>=</mml:mo><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          If the adjoint system of Eq. (<xref ref-type="disp-formula" rid="Ch1.E38"/>) is solved,
<inline-formula><mml:math id="M278" display="inline"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> can be computed, which is nothing
other than
the scalar product (Eq. <xref ref-type="disp-formula" rid="Ch1.E35"/>) as seen in Eq. (<xref ref-type="disp-formula" rid="Ch1.E39"/>).</p>
      <p>The computational costs are mainly determined by the number of multiplications
and differ for both possibilities of calculating the scalar
product (Eq. <xref ref-type="disp-formula" rid="Ch1.E35"/>). Only in case of a column vector inhomogeneity
<inline-formula><mml:math id="M279" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>, is the number of multiplications equal. If the matrix
<inline-formula><mml:math id="M280" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> consists of <inline-formula><mml:math id="M281" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mrow><mml:mo>*</mml:mo><mml:mo>,</mml:mo><mml:mi mathvariant="script">P</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> column vectors,
<inline-formula><mml:math id="M282" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mrow><mml:mo>*</mml:mo><mml:mo>,</mml:mo><mml:mi mathvariant="script">P</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> systems of linear equations with a vector inhomogeneity
need to be solved in the forward calculation. The adjoint method is
independent of <inline-formula><mml:math id="M283" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mrow><mml:mo>*</mml:mo><mml:mo>,</mml:mo><mml:mi mathvariant="script">P</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> and only a single system of linear
equations needs to be solved. Therefore, the latter approach requires
<inline-formula><mml:math id="M284" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mrow><mml:mo>*</mml:mo><mml:mo>,</mml:mo><mml:mi mathvariant="script">P</mml:mi></mml:mrow></mml:msub></mml:mrow></mml:math></inline-formula> times fewer multiplications.</p>
      <p>The adjoint approach can be applied to the calculation of the gradient in
Eq. (<xref ref-type="disp-formula" rid="Ch1.E32"/>). If the product of all matrices
<inline-formula><mml:math id="M285" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mo>:=</mml:mo><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup><mml:mo>⋅</mml:mo><mml:mi mathvariant="normal">…</mml:mi><mml:mo>⋅</mml:mo><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mn mathvariant="normal">1</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:math></inline-formula> in Eq. (<xref ref-type="disp-formula" rid="Ch1.E32"/>) is substituted, this leads
to
            <disp-formula id="Ch1.E40" content-type="numbered"><mml:math id="M286" display="block"><mml:mrow><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mo>∂</mml:mo><mml:mi>K</mml:mi><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mo>)</mml:mo></mml:mrow><mml:mrow><mml:mo>∂</mml:mo><mml:mi mathvariant="bold-italic">s</mml:mi></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>=</mml:mo><mml:msup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>⋅</mml:mo><mml:msup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mo>⋅</mml:mo><mml:mi mathvariant="bold">L</mml:mi><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The second product on the right side of Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>) can be substituted by
            <disp-formula id="Ch1.E41" content-type="numbered"><mml:math id="M287" display="block"><mml:mrow><mml:mi mathvariant="bold">X</mml:mi><mml:mo>:=</mml:mo><mml:msup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup><mml:mo>⋅</mml:mo><mml:mi mathvariant="bold">L</mml:mi><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          This equation can be related to the system of linear Eq. (<xref ref-type="disp-formula" rid="Ch1.E34"/>) by
identifying the quantities with an asterisk as an index.</p>
      <p>During the analytical forward differentiation, the gradient is computed
successively using chain rule from the right to the left. This corresponds to
a procedure, where, at first, the system of linear Eq. (<xref ref-type="disp-formula" rid="Ch1.E34"/>) is
solved with respect to <inline-formula><mml:math id="M288" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold">X</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula> and then, the scalar product
(Eq. <xref ref-type="disp-formula" rid="Ch1.E35"/>) is calculated. If the matrix products of Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>)
are computed from left to right, at first, the product
            <disp-formula id="Ch1.E42" content-type="numbered"><mml:math id="M289" display="block"><mml:mrow><mml:msup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>:=</mml:mo><mml:msup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>⋅</mml:mo><mml:msup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></disp-formula>
          is determined. This corresponds to solving the adjoint
Eq. (<xref ref-type="disp-formula" rid="Ch1.E38"/>) with respect to <inline-formula><mml:math id="M290" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>. The scalar product
(Eq. <xref ref-type="disp-formula" rid="Ch1.E35"/>) is determined by <inline-formula><mml:math id="M291" display="inline"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mo>*</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msubsup><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold">L</mml:mi><mml:mo>*</mml:mo></mml:msub></mml:mrow></mml:math></inline-formula>, which is
related to the multiplication of <inline-formula><mml:math id="M292" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold-italic">y</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>⋅</mml:mo><mml:mi mathvariant="bold">L</mml:mi></mml:mrow></mml:math></inline-formula> to determine
the cost function. Thus, the adjoint method for the gradient calculation of
the cost function can be identified with the execution of the multiplications
from the left to the right in Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>).</p>
      <p>The dimensions of the vectors and matrices involved are <inline-formula><mml:math id="M293" display="inline"><mml:mrow><mml:mtext>dim</mml:mtext><mml:mo>(</mml:mo><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub><mml:mo>×</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M294" display="inline"><mml:mrow><mml:mtext>dim</mml:mtext><mml:mo>(</mml:mo><mml:mi mathvariant="bold">L</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub><mml:mo>×</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M295" display="inline"><mml:mrow><mml:mtext>dim</mml:mtext><mml:mo>(</mml:mo><mml:mi mathvariant="bold">A</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub><mml:mo>×</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The calculation of the gradient by computing the matrices from
the right to the left in Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>) requires <inline-formula><mml:math id="M296" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>rl</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>
multiplications of components, whereby
            <disp-formula id="Ch1.E43" content-type="numbered"><mml:math id="M297" display="block"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>rl</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msubsup><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub><mml:mfenced open="(" close=")"><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          If the gradient is calculated from the left to the right in Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>), <inline-formula><mml:math id="M298" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>lr</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> multiplications of components are performed:
            <disp-formula id="Ch1.E44" content-type="numbered"><mml:math id="M299" display="block"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>lr</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msubsup><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext><mml:mn mathvariant="normal">2</mml:mn></mml:msubsup><mml:mspace width="0.125em" linebreak="nobreak"/><mml:mfenced close=")" open="("><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub><mml:mo>+</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub></mml:mfenced><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The limit <inline-formula><mml:math id="M300" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:math></inline-formula> leads to <inline-formula><mml:math id="M301" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>rl</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>lr</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.
Usually, one can assume <inline-formula><mml:math id="M302" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub><mml:mo>≪</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>v</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> because the number
of grid points exceeds the dimensions of parameter space, which is eight for the
dipole and quadrupole parameters. Then, Eq. (<xref ref-type="disp-formula" rid="Ch1.E44"/>) simplifies to
            <disp-formula id="Ch1.E45" content-type="numbered"><mml:math id="M303" display="block"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>lr</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>N</mml:mi><mml:mtext>rl</mml:mtext></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Thus, the multiplication of the matrices in Eq. (<xref ref-type="disp-formula" rid="Ch1.E40"/>) from the
left to the right, the adjoint approach, is more efficient for many
parameters and requires about <inline-formula><mml:math id="M304" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mi mathvariant="script">P</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> times fewer multiplications.
The evaluation procedure for the simulation code is depicted in
Fig. <xref ref-type="fig" rid="Ch1.F4"/>.</p>
      <p>However, the numerical implementation of the adjoint method is more difficult
than the analytical forward differentiation. As described, the calculation of
the gradient with the analytical forward differentiation is parallel to the
execution of the time loop in the simulation code. In contrast, the solution
at the last time iteration <inline-formula><mml:math id="M305" display="inline"><mml:mrow><mml:msubsup><mml:mi mathvariant="bold-italic">q</mml:mi><mml:mrow><mml:mi>t</mml:mi><mml:mo>,</mml:mo><mml:mi mathvariant="bold-italic">x</mml:mi></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:msubsup></mml:mrow></mml:math></inline-formula> has to be
known to calculate <inline-formula><mml:math id="M306" display="inline"><mml:mrow><mml:msup><mml:mi mathvariant="bold-italic">g</mml:mi><mml:mi mathvariant="normal">T</mml:mi></mml:msup><mml:mo>⋅</mml:mo><mml:msubsup><mml:mi mathvariant="bold">A</mml:mi><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msubsup></mml:mrow></mml:math></inline-formula>. Thus,
at first, the simulation needs to be performed once, whereby all calculation
results that are required for the matrix multiplications are stored
temporarily. Then, the gradient can be computed according to the adjoint
approach.</p>
      <p>There are AD tools that can derive codes not only according to forward
differentiation but also according to the adjoint method. However, the
available memory on a computer is often too small to store all the required
results in the central memory. The memory consumption <inline-formula><mml:math id="M307" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>Memory</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> can
be estimated by multiplying the number of grid points of the simulation box
<inline-formula><mml:math id="M308" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>grid</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> according to Eq. (<xref ref-type="disp-formula" rid="Ch1.E14"/>) with the number of time
steps <inline-formula><mml:math id="M309" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, the number of MHD variables <inline-formula><mml:math id="M310" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>var</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, and the
size of a MHD variable <inline-formula><mml:math id="M311" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>var</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>:
            <disp-formula id="Ch1.E46" content-type="numbered"><mml:math id="M312" display="block"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>Memory</mml:mtext></mml:msub><mml:mo>≈</mml:mo><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>N</mml:mi><mml:mtext>grid</mml:mtext></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mspace width="0.125em" linebreak="nobreak"/><mml:msub><mml:mi>N</mml:mi><mml:mtext>var</mml:mtext></mml:msub><mml:mspace linebreak="nobreak" width="0.125em"/><mml:msub><mml:mi>M</mml:mi><mml:mtext>var</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The number of variables of the MHD simulation is <inline-formula><mml:math id="M313" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>var</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">8</mml:mn></mml:mrow></mml:math></inline-formula> and the
size of such a variable is <inline-formula><mml:math id="M314" display="inline"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>var</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M315" display="inline"><mml:mi mathvariant="normal">bytes</mml:mi></mml:math></inline-formula> if a float
variable is assumed. This gives a memory consumption of about
1600 <inline-formula><mml:math id="M316" display="inline"><mml:mi mathvariant="normal">GB</mml:mi></mml:math></inline-formula> for a simulation grid
<inline-formula><mml:math id="M317" display="inline"><mml:mrow><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">100</mml:mn></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M318" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">5</mml:mn><mml:mo>×</mml:mo><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mn mathvariant="normal">5</mml:mn></mml:msup></mml:mrow></mml:math></inline-formula>. The central memory is often much smaller, so that a certain
portion of the variables needs to be stored on the hard disk. However, the
seek time of the central memory is much smaller, and thus, the runtime of the
algorithm becomes longer by storing data on the hard disk.</p>
      <p>To minimize the access to the hard disk, checkpointing can be used.
Thereby, the main iteration loop of the algorithm is split at certain checkpoints into smaller loops.
Then, the smaller loop iterates over <inline-formula><mml:math id="M319" display="inline"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>loop,check</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> iterations instead of the complete time loop with <inline-formula><mml:math id="M320" display="inline"><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> iterations.
This reduces the memory requirements for such a loop to
            <disp-formula id="Ch1.E47" content-type="numbered"><mml:math id="M321" display="block"><mml:mrow><mml:msub><mml:mi>M</mml:mi><mml:mtext>Memory,check</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:msub><mml:mi>N</mml:mi><mml:mtext>loop,check</mml:mtext></mml:msub></mml:mrow><mml:mrow><mml:msub><mml:mi>l</mml:mi><mml:mtext>max</mml:mtext></mml:msub></mml:mrow></mml:mfrac></mml:mstyle><mml:msub><mml:mi>M</mml:mi><mml:mtext>Memory</mml:mtext></mml:msub><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          The variables during a calculation of such a smaller loop can be stored
within the central memory. After the execution of the smaller loop, the
results are stored to the hard disk to combine all results of the smaller
loop. However, using smaller loops, the adjoint method can only be applied
within these smaller loops. Thus, checkpointing reduces the seek time of the
memory, but the adjoint approach is restricted to a smaller part of the
algorithm. In total, this reduces the runtime of the algorithm, but the
performance is below the theoretical possible performance of the adjoint
approach with unlimited central memory space.</p>
      <p>Note that instead of using only observations of a single spacecraft,
simultaneous measurements from multiple spacecraft at different locations can
be calculated in Eq. (<xref ref-type="disp-formula" rid="Ch1.E27"/>) as well. This can be done without
additional computational costs and memory capacity because the solution of
the MHD simulation is calculated in the entire simulation domain and stored
anyway.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F5" specific-use="star"><caption><p>The relative errors for gradients determined by difference quotients
and the adjoint method for the dipole components. Thereby, on the left side,
different points in parameter space are considered. On the right side, the
dependence of the error on a different number of time iteration steps is
shown.</p></caption>
          <?xmltex \igopts{width=298.753937pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f05.pdf"/>

        </fig>

      <?xmltex \floatpos{t}?><fig id="Ch1.F6" specific-use="star"><caption><p>The runtime of calculating gradients using the adjoint method
<inline-formula><mml:math id="M322" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mtext>Adj</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and using difference quotients <inline-formula><mml:math id="M323" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mtext>DQ</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. On the left
side, the dependence on the number of time iteration steps is presented. On
the right side, the ratio of the runtimes is shown.</p></caption>
          <?xmltex \igopts{width=298.753937pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f06.pdf"/>

        </fig>

</sec>
<sec id="Ch1.S3.SS3">
  <title>Adjoint MHD simulation code</title>
      <p>The AD tool applied for an automatic backward differentiation transfers a
numerical code for the calculation of a cost function into an adjoint code,
which can compute the gradient according to the adjoint approach. This was
done for the MHD simulation code presented in the previous chapter by the TAF
tool of the company FastOpt. Thereby, the parameter space of the dipole and
quadrupole parameters <inline-formula><mml:math id="M324" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="script">P</mml:mi><mml:mtext>D,Q</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> was considered. Thus, the
adjoint code computes the gradient of the cost function (<xref ref-type="disp-formula" rid="Ch1.E27"/>) with
respect to the parameters (<xref ref-type="disp-formula" rid="Ch1.E26"/>).</p>
      <p>To validate the adjoint MHD simulation code, the gradients produced by the
adjoint code are compared to those calculated by difference quotients
according to Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>). Therefore, at first, the interaction of
the solar wind with the planetary magnetic field is neglected and the
planetary magnetic field represented by its dipole and quadrupole moments is
only taken into account. Gradients at certain points
<inline-formula><mml:math id="M325" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> in parameter space are considered. Thereby,
the <inline-formula><mml:math id="M326" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> component varies between 0.7 and 1.2 <inline-formula><mml:math id="M327" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> with a
step size of 0.1 <inline-formula><mml:math id="M328" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. The spacecraft data
<inline-formula><mml:math id="M329" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> on a trajectory <inline-formula><mml:math id="M330" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, required to
calculate the cost function, are generated synthetically along the <inline-formula><mml:math id="M331" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis
between 20.2 and 9 <inline-formula><mml:math id="M332" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> with a step size of 0.42 <inline-formula><mml:math id="M333" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.
The gradient of the cost function is calculated using difference quotients
<inline-formula><mml:math id="M334" display="inline"><mml:mrow><mml:msub><mml:mo>∂</mml:mo><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:msub><mml:msub><mml:mi>K</mml:mi><mml:mtext>DQ</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and the adjoint method
<inline-formula><mml:math id="M335" display="inline"><mml:mrow><mml:msub><mml:mo>∂</mml:mo><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:msub><mml:msub><mml:mi>K</mml:mi><mml:mtext>Adj</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> for different <inline-formula><mml:math id="M336" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>. The
relative error of the <inline-formula><mml:math id="M337" display="inline"><mml:mi>i</mml:mi></mml:math></inline-formula>th component of the gradient is defined by
            <disp-formula id="Ch1.E48" content-type="numbered"><mml:math id="M338" display="block"><mml:mrow><mml:mtext>rel. error</mml:mtext><mml:mo>:=</mml:mo><mml:mstyle displaystyle="true"><mml:mfrac style="display"><mml:mrow><mml:mfenced close=")" open="("><mml:msub><mml:mo>∂</mml:mo><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:msub><mml:msub><mml:mi>K</mml:mi><mml:mtext>DQ</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mo>∂</mml:mo><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:msub><mml:msub><mml:mi>K</mml:mi><mml:mtext>Adj</mml:mtext></mml:msub></mml:mfenced><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow><mml:mrow><mml:mtext>max</mml:mtext><mml:mo>(</mml:mo><mml:msub><mml:mo>∂</mml:mo><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:msub><mml:msub><mml:mi>K</mml:mi><mml:mtext>DQ</mml:mtext></mml:msub><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>,</mml:mo><mml:msub><mml:mo>∂</mml:mo><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:msub><mml:msub><mml:mi>K</mml:mi><mml:mtext>Adj</mml:mtext></mml:msub><mml:mo>⋅</mml:mo><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>i</mml:mi></mml:msub><mml:mo>)</mml:mo></mml:mrow></mml:mfrac></mml:mstyle><mml:mo>.</mml:mo></mml:mrow></mml:math></disp-formula>
          Here, The result of the maximum function <inline-formula><mml:math id="M339" display="inline"><mml:mrow><mml:mo>max⁡</mml:mo><mml:mo>(</mml:mo><mml:mi>a</mml:mi><mml:mo>,</mml:mo><mml:mi>b</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula> is the larger value of <inline-formula><mml:math id="M340" display="inline"><mml:mi>a</mml:mi></mml:math></inline-formula> and <inline-formula><mml:math id="M341" display="inline"><mml:mi>b</mml:mi></mml:math></inline-formula> and
<inline-formula><mml:math id="M342" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">e</mml:mi><mml:mi>i</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> defines the <inline-formula><mml:math id="M343" display="inline"><mml:mi>i</mml:mi></mml:math></inline-formula> unit vector. The relative error of the dipole
moment for different <inline-formula><mml:math id="M344" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> is depicted in Fig. <xref ref-type="fig" rid="Ch1.F5"/>. The
error is smaller than <inline-formula><mml:math id="M345" display="inline"><mml:mrow><mml:msup><mml:mn mathvariant="normal">10</mml:mn><mml:mrow><mml:mo>-</mml:mo><mml:mn mathvariant="normal">4</mml:mn></mml:mrow></mml:msup></mml:mrow></mml:math></inline-formula>, i.e., both gradients agree for different
values of <inline-formula><mml:math id="M346" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
      <p>Now, the interaction of the planet with the solar wind is taken into account.
Thereby, the gradients calculated by the adjoint method can be compared to
gradients computed by difference quotients for a different number of time
iterations. The corresponding relative errors of the dipole components of the
gradient are shown in Fig. <xref ref-type="fig" rid="Ch1.F5"/> on the right side. It is seen
that the gradients agree very well.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F7" specific-use="star"><caption><p>Estimation of planetary moments neglecting the interaction with the
solar wind and using synthetic data. The reconstructions shown in the upper
panels take only a dipole moment into account. These two results consider a
different spacecraft trajectory, with a trajectory closer to the planet
corresponding to the left figure. All reconstructions presented use the same
dipole moment for calculating the synthetic spacecraft data. However, in the
lower panels, an additional quadrupole component was introduced. The
reconstructions in the lower panels use a different choice of the initial
parameters for the estimation.</p></caption>
          <?xmltex \igopts{width=298.753937pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f07.pdf"/>

        </fig>

      <p>To determine the runtime of the adjoint code, the gradient calculations are
performed on a test computer for different numbers of time iteration steps.
The test computer uses 64 GB of central memory and has an Intel Xeon E5
processor with 12 cores and 24 threads at 2.5 GHz. The results are
shown in Fig. <xref ref-type="fig" rid="Ch1.F6"/> on the left side. The runtime of calculating
the gradients increases linearly with the number of iteration steps
performed,
as expected. The plot on the right side presents the ratio of the runtime of
the adjoint code <inline-formula><mml:math id="M347" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mtext>Adj</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> and the runtime using difference quotients
<inline-formula><mml:math id="M348" display="inline"><mml:mrow><mml:msub><mml:mi>t</mml:mi><mml:mtext>DQ</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. On the test computer, the adjoint method calculates the
gradient about 33 % faster than using the difference quotients. According
to the previous argumentation, eight parameters require nine MHD simulation calls
to determine the gradient with difference quotients of
Eq. (<xref ref-type="disp-formula" rid="Ch1.E28"/>). The adjoint method needs to run the simulation once
to store all necessary results and another simulation run to calculate the
gradient. In Fig. <xref ref-type="fig" rid="Ch1.F4"/>, the first simulation run is shown on the
left side from top to bottom, storing all results in vector representation
presented in the middle. Using these results, the automatic differentiation
procedure calculates the gradient as sketched on the right from bottom to
top,
which corresponds to another simulation run. Thus, in theory, the adjoint
method can be up to 78 % faster than the difference quotient calculation.
However, our adjoint code uses checkpointing because the central memory is
too small, which increases the runtime.</p>
      <p>Consequently, the test computer configuration is not optimal to achieve the
best performance. The performance can be improved by using a computer cluster
with distributed memory space. Then, each core can access its own memory
space and checkpointing can be avoided. This can increase the performance.
Furthermore, it should be noted that without additional computational costs and
memory requirements, more parameters can be introduced in the estimation
process of the adjoint approach, such as octupole planetary magnetic field
parameters.</p>
</sec>
</sec>
<sec id="Ch1.S4">
  <title>Estimation of planetary magnetic field parameters</title>
<sec id="Ch1.S4.SS1">
  <title>Using synthetic data</title>
      <p>At first, the results of data assimilation using synthetically produced data
are considered, neglecting the interaction of the planetary magnetic field. The
simulation box has a length of 60.2 <inline-formula><mml:math id="M349" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> in every dimension with
the planet in its center. The number of grid points is <inline-formula><mml:math id="M350" display="inline"><mml:mrow><mml:msub><mml:mi>i</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>j</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:msub><mml:mi>k</mml:mi><mml:mtext>max</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">300</mml:mn></mml:mrow></mml:math></inline-formula>. Synthetic spacecraft data
<inline-formula><mml:math id="M351" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> are calculated from the magnetic field distributions of
certain dipole and quadrupole parameters <inline-formula><mml:math id="M352" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mtext>Planet</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> along a
trajectory <inline-formula><mml:math id="M353" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo></mml:mrow></mml:math></inline-formula>. The initialization <inline-formula><mml:math id="M354" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> for the
estimation procedure of the planetary parameters differ from these moments.
Starting from this initialization, the cost function is minimized.</p>
      <p>The first trajectory considered here is <inline-formula><mml:math id="M355" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mn mathvariant="normal">10.1</mml:mn><mml:mspace linebreak="nobreak" width="0.25em"/><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>, which is diagonal within the
<inline-formula><mml:math id="M356" display="inline"><mml:mrow><mml:mi>x</mml:mi><mml:mi>y</mml:mi></mml:mrow></mml:math></inline-formula> plane. The spacecraft's magnetic field data <inline-formula><mml:math id="M357" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> are
generated by a dipole along the <inline-formula><mml:math id="M358" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> axis, i.e.,
<inline-formula><mml:math id="M359" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mtext>Planet</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><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:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M360" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. In
parameter space, the starting point of the estimation procedure is
<inline-formula><mml:math id="M361" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M362" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, which is
nothing other than a dipole along the <inline-formula><mml:math id="M363" display="inline"><mml:mi>x</mml:mi></mml:math></inline-formula> axis. The BFGS algorithm iteratively computes
new gradients in which direction the cost
function (<xref ref-type="disp-formula" rid="Ch1.E27"/>) is minimized. The corresponding dipole parameters
during the minimization, depending on the iteration step of calculating new
gradients, are presented in Fig. <xref ref-type="fig" rid="Ch1.F7"/> in the top left panel. The vector of
the dipole moment <inline-formula><mml:math id="M364" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mtext>Planet</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> is reconstructed very well after
15 iteration steps.</p>
      <p>Next, a different trajectory is considered to produce the synthetic data:
<inline-formula><mml:math id="M365" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mn mathvariant="normal">30.1</mml:mn><mml:mspace linebreak="nobreak" width="0.25em"/><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula>. This orbit is
farther away from the planet than the previous trajectory. The results of the
estimation process are depicted in Fig. <xref ref-type="fig" rid="Ch1.F7"/> in the top right panel.
Again, the dipole vector was reconstructed very well, however, about twice as
many iterations were required. This is related to the variations in the
magnetic field strength, with a smaller percentage ratio of the variations on
the trajectory farther out.</p>

      <?xmltex \floatpos{t}?><fig id="Ch1.F8" specific-use="star"><caption><p>Estimation of Earth's dipole moment from magnetosheath data of
THC on 24 August 2008 using the THB solar wind observations, which are presented
in Fig. <xref ref-type="fig" rid="Ch1.F3"/>.
The variations in the dipole moment during the iteration process (top left) and the corresponding values of the cost function (top right) are shown.
The values of the dipole moment of Earth are sketched as dashed lines.
The plot on the bottom shows the iterative assimilation of the MHD simulation to the THC data (blue) before the first iteration (black) and after the 13th iteration (red).</p></caption>
          <?xmltex \igopts{width=298.753937pt}?><graphic xlink:href="https://angeo.copernicus.org/articles/35/613/2017/angeo-35-613-2017-f08.pdf"/>

        </fig>

      <p>The simultaneous estimation of dipole and quadrupole parameters is considered
as well by using magnetic field data <inline-formula><mml:math id="M366" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">B</mml:mi><mml:mtext>data</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> generated by
<inline-formula><mml:math id="M367" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mtext>Planet</mml:mtext></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><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:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M368" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.
Thereby, the trajectory <inline-formula><mml:math id="M369" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">r</mml:mi><mml:mtext>SC</mml:mtext></mml:msub><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>)</mml:mo><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mn mathvariant="normal">10.1</mml:mn><mml:mspace linebreak="nobreak" width="0.25em"/><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub><mml:mo>-</mml:mo><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> is used. The reconstruction of the
planetary magnetic field, starting from
<inline-formula><mml:math id="M370" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M371" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>, is shown in
Fig. <xref ref-type="fig" rid="Ch1.F7"/> in the bottom left panel. Additionally, the estimation process
from a different point in parameter space
<inline-formula><mml:math id="M372" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">1</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M373" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> is realized.
The results are presented in Fig. <xref ref-type="fig" rid="Ch1.F7"/> in the bottom right panel. In both
situations, the moments <inline-formula><mml:math id="M374" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mtext>Planet</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> were correctly determined.
Thereby, the estimation starting in parameter space farther away from the
solution required 15 more iteration steps. Altogether, it is seen that the
dipole as well as the quadrupole parameters can be reconstructed from
synthetic data, whereby larger magnetic field variations along the trajectory
or a starting point <inline-formula><mml:math id="M375" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> closer to the minimum speed up the estimation
process.</p>
</sec>
<sec id="Ch1.S4.SS2">
  <title>Using THEMIS data</title>
      <p>After proving the general functionality of the algorithm, it is applied using
THEMIS spacecraft data at Earth. Thereby, data from the magnetosheath, a
region strongly influenced by the interaction process of the solar wind, is
considered. Different to the situation at Earth, spacecraft magnetic field
observations in Mercury's magnetosphere are strongly modified due to the
magnetosphere's small size. Here, we restrict our approach to Earth's
magnetosheath data to consider a strongly disturbed magnetic environment
comparable to the situation at Mercury. However, in final application,
magnetospheric data will be used as well to reduce errors. Due to the weak
components of the quadrupole at Earth, their influence is negligible
close to the magnetopause. The largest quadrupole moment corresponds to a
magnetic field of <inline-formula><mml:math id="M376" display="inline"><mml:mrow><mml:mo>&lt;</mml:mo><mml:mn mathvariant="normal">0.1</mml:mn></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M377" display="inline"><mml:mi mathvariant="normal">nT</mml:mi></mml:math></inline-formula> at 10 <inline-formula><mml:math id="M378" display="inline"><mml:mrow><mml:msub><mml:mi>R</mml:mi><mml:mtext>E</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>. This is very small
compared to the contribution of the dipole's <inline-formula><mml:math id="M379" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> component of about
30 <inline-formula><mml:math id="M380" display="inline"><mml:mi mathvariant="normal">nT</mml:mi></mml:math></inline-formula>. Thus, only the dipole moment is considered in the estimation
at Earth. The estimation process starts from
<inline-formula><mml:math id="M381" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mn mathvariant="normal">0.25</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1.2</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M382" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula> in
parameter space. Subsequently, the cost function is minimized iteratively,
whereby every new calculation of a gradient denotes a new iteration step.</p>
      <p>The magnetosheath transition observed by THC on 24 August 2008, presented in
Fig. <xref ref-type="fig" rid="Ch1.F3"/>, is used as a first estimation of the dipole
parameters. Thereby, the solar wind measurements of the THB spacecraft
determine the inflow boundary conditions of the MHD simulations. The results
of the estimation process are depicted in Fig. <xref ref-type="fig" rid="Ch1.F8"/>. Thereby, the
values of the dipole moment as well as the cost function are shown. The
dipole components vary mainly during the first iterations. The value of the
cost function is strongly reduced from iteration steps 0 to 1 and 6 to 7.
After the eighth iteration step, the cost function and the components of
the dipole moment do not change much. Finally, the solution vector after 13
iteration steps is
<inline-formula><mml:math id="M383" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">13</mml:mn></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.072</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0.084</mml:mn><mml:mo>,</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">1.078</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">0</mml:mn><mml:msup><mml:mo>)</mml:mo><mml:mi mathvariant="normal">T</mml:mi></mml:msup></mml:mrow></mml:math></inline-formula> <inline-formula><mml:math id="M384" display="inline"><mml:mrow><mml:msub><mml:mi>m</mml:mi><mml:mtext>norm</mml:mtext></mml:msub></mml:mrow></mml:math></inline-formula>.
Thereby, all components are closer to the value of the dipole moment of Earth according to Eq. (<xref ref-type="disp-formula" rid="Ch1.E24"/>) than the initial values. The relative
errors for the dipole components are <inline-formula><mml:math id="M385" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>m</mml:mi><mml:mi>x</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>s</mml:mi><mml:mrow><mml:mn mathvariant="normal">13</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">1</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>E</mml:mtext></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mrow><mml:mi>x</mml:mi><mml:mo>,</mml:mo><mml:mtext>E</mml:mtext></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.44</mml:mn></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M386" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>m</mml:mi><mml:mi>y</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>s</mml:mi><mml:mrow><mml:mn mathvariant="normal">13</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">2</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>E</mml:mtext></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mrow><mml:mi>y</mml:mi><mml:mo>,</mml:mo><mml:mtext>E</mml:mtext></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:mo>-</mml:mo><mml:mn mathvariant="normal">0.47</mml:mn></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M387" display="inline"><mml:mrow><mml:mi mathvariant="normal">Δ</mml:mi><mml:msub><mml:mi>m</mml:mi><mml:mi>z</mml:mi></mml:msub><mml:mo>=</mml:mo><mml:mo>(</mml:mo><mml:msub><mml:mi>s</mml:mi><mml:mrow><mml:mn mathvariant="normal">13</mml:mn><mml:mo>,</mml:mo><mml:mn mathvariant="normal">3</mml:mn></mml:mrow></mml:msub><mml:mo>-</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>E</mml:mtext></mml:mrow></mml:msub><mml:mo>)</mml:mo><mml:mo>/</mml:mo><mml:msub><mml:mi>m</mml:mi><mml:mrow><mml:mi>z</mml:mi><mml:mo>,</mml:mo><mml:mtext>E</mml:mtext></mml:mrow></mml:msub><mml:mo>=</mml:mo><mml:mn mathvariant="normal">0.14</mml:mn></mml:mrow></mml:math></inline-formula>. The relative error of the
<inline-formula><mml:math id="M388" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> component is the smallest because Earth's dipole is mainly along the
<inline-formula><mml:math id="M389" display="inline"><mml:mi>z</mml:mi></mml:math></inline-formula> direction. Considering the magnitude, the relative error is 0.13. The panels showing <inline-formula><mml:math id="M390" display="inline"><mml:mrow><mml:msub><mml:mi>B</mml:mi><mml:mi>x</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, <inline-formula><mml:math id="M391" display="inline"><mml:mrow><mml:msub><mml:mi>B</mml:mi><mml:mi>y</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula>, and <inline-formula><mml:math id="M392" display="inline"><mml:mrow><mml:msub><mml:mi>B</mml:mi><mml:mi>z</mml:mi></mml:msub></mml:mrow></mml:math></inline-formula> in Fig. 8 show the magnetic field distribution of
the MHD simulation, which corresponds to <inline-formula><mml:math id="M393" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">0</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula> and <inline-formula><mml:math id="M394" display="inline"><mml:mrow><mml:msub><mml:mi mathvariant="bold-italic">s</mml:mi><mml:mn mathvariant="normal">13</mml:mn></mml:msub></mml:mrow></mml:math></inline-formula>.</p>
</sec>
</sec>
<sec id="Ch1.S5" sec-type="conclusions">
  <title>Conclusions</title>
      <p>We introduced an approach to estimating planetary parameters using global MHD
simulations of the interaction of the solar wind with a planet. A simple MHD
simulation code was introduced and prepared for an automatic differentiation
tool to obtain an adjoint MHD simulation code. The differences of spacecraft
data and corresponding simulation results are quantified by a cost function,
which is minimized by a gradient-based optimization. The adjoint code
computes the gradient with lower computational effort compared to a
difference quotient calculation.</p>
      <p>Our approach is designed to estimate planetary magnetic fields, especially if
the field strength is weak so that the interaction strongly modifies the
magnetic field of the planet's environment. We used THEMIS data of Earth's magnetosheath to simulate such an environment to test our approach.
The results of the estimation process can be affected by statistical and systematic errors. Therefore, statistical errors will not contribute to the
mean values of the estimated planetary magnetic field if a sufficiently large
number of magnetosheath transitions are considered. For example, the solar
wind density can be measured incorrectly due to a spacecraft potential
<xref ref-type="bibr" rid="bib1.bibx22" id="paren.43"/>. However, the density is usually equally overestimated
and underestimated. Considering a single magnetosheath transition, the
estimated dipole magnitude of Earth differs about 13 % from the
expected value. Based on this approach, further transitions can be considered
to minimize the errors. Note that including magnetospheric data at Mercury
will further reduce the statistical error. The runtime of the parameter
estimation using the test computer is about 1 week using the 5 h
magnetosheath data. This fast calculation procedure allows taking a lot more
data into account, especially if supercomputers are used.</p>
      <p>We used a simple MHD simulation code to investigate the automatic
differentiation procedure. As a next step, the simulation code needs to be
improved, e.g., by an adaptive mesh refinement, to reduce numerical errors.
Also, kinetic or hybrid simulation codes can be considered and treated with
an automatic differentiation tool. The limiting factor for applying the
automatic differentiation is not the complexity of the code but the memory
consumption. Using our test computer, the adjoint approach was about 33 %
faster than a finite difference approach. Although the adjoint MHD code
does not calculate the gradient very much faster than using difference quotients,
it has the advantage that further parameters such as higher-order magnetic
field moments or parameters of the planet's conductivity can be included with
nearly no additional computational costs. Nonetheless, the performance of the
adjoint code is, related to memory limitations of our test computer, much
lower than expected from theory. Thus, as a further step, the test computer
configuration needs to be modified to increase performance. It is beneficial
for the adjoint approach that each core has access to its own memory, which is
different from our test computer. Thus, instead of using traditional
supercomputers with fewer more powerful computers, a computer cluster using
many commoditized computers with their own memory should be considered. These
computer configurations recently became very popular in big data analysis
using Google's well-known MapReduce technique <xref ref-type="bibr" rid="bib1.bibx5" id="paren.44"/>. A similar
configuration might be more suitable for the adjoint code and increase its
performance. The ability of our approach to perform on clusters with many
cores depends on the parallelization of the MHD simulation code. Although this
can be limited to a certain number of cores, another possibility to
parallelize the estimation process is to split the data into subsets and
perform the calculation of these subsets in parallel. Each data set will
provide an individual estimator of the planetary parameters that can be
applied in an ensemble averaging technique to reduce errors.</p>
</sec>

      
      </body>
    <back><notes notes-type="dataavailability">

      <p>Data from the THEMIS mission are publicly available and can
be obtained from <uri>http://themis.ssl.berkeley.edu/data/themis</uri> from the
University of California Berkeley (<xref ref-type="bibr" rid="bib1.bibx2" id="altparen.45"/>).</p>
  </notes><notes notes-type="competinginterests">

      <p>The authors declare that they have no conflict of
interest.</p>
  </notes><ack><title>Acknowledgements</title><p>This work is financially supported by the German Ministerium für Wirtschaft
und Energie and the German DLR under grants 50OC1403 and 50QW1501. We
acknowledge NASA contract NAS5-02099 and V. Angelopoulos for use of data from
the THEMIS mission. We specifically thank C. W. Carlson and J. P. McFadden for use of
ESA data. We thank T. Ogino and K. Fukazawa for providing a version of their
MHD simulation code. Furthermore, we thank FastOpt (R. Giering and T. Kaminski)
for applying their TAF tool for the automatic differentiation
procedure.<?xmltex \hack{\newline}?><?xmltex \hack{\hspace*{4mm}}?> The topical editor, M.
Palmroth, thanks I. Honkonen and the anonymous referee for help in evaluating
this paper.</p></ack><ref-list>
    <title>References</title>

      <ref id="bib1.bibx1"><label>Alexeev et al.(2010)Alexeev, Belenkaya, Slavin, Korth,
Anderson, Baker, Boardsen, Johnson, Purucker, Sarantos, and
Solomon</label><mixed-citation>Alexeev, I. I., Belenkaya, E. S., Slavin, J. A., Korth, H.,
Anderson,
B. J., Baker, D. N., Boardsen, S. A., Johnson, C. L., Purucker,
M. E., Sarantos, M., and Solomon, S. C.: Mercury's magnetospheric
magnetic field after the first two MESSENGER flybys, Icarus, 209, 23–39,
<ext-link xlink:href="http://dx.doi.org/10.1016/j.icarus.2010.01.024" ext-link-type="DOI">10.1016/j.icarus.2010.01.024</ext-link>, 2010.</mixed-citation></ref>
      <ref id="bib1.bibx2"><label>Angelopoulos(2008)</label><mixed-citation>Angelopoulos, V.: The THEMIS Mission, Space Sci. Rev., 141, 5–34,
<ext-link xlink:href="http://dx.doi.org/10.1007/s11214-008-9336-1" ext-link-type="DOI">10.1007/s11214-008-9336-1</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx3"><label>Benkhoff et al.(2010)Benkhoff, van Casteren, Hayakawa,
Fujimoto, Laakso, Novara, Ferri, Middleton, and
Ziethe</label><mixed-citation>Benkhoff, J., van Casteren, J., Hayakawa, H., Fujimoto, M., Laakso,
H., Novara, M., Ferri, P., Middleton, H. R., and Ziethe, R.:
BepiColombo – Comprehensive exploration of Mercury: Mission overview and
science goals, Planet. Space Sci., 58, 2–20,
<ext-link xlink:href="http://dx.doi.org/10.1016/j.pss.2009.09.020" ext-link-type="DOI">10.1016/j.pss.2009.09.020</ext-link>, 2010.</mixed-citation></ref>
      <ref id="bib1.bibx4"><label>Clauser(2016)</label><mixed-citation>
Clauser, C.: Einführung in die Geophysik, Springer Spektrum, Berlin
Heidelberg, 2016.</mixed-citation></ref>
      <ref id="bib1.bibx5"><label>Dean and Ghemawat(2004)</label><mixed-citation>
Dean, J. and Ghemawat, S.: MapReduce: Simplified data processing on
large
clusters, in: Proceedings of Operating Systems Design and Implementation,
137–150, San Francisco, 2004.</mixed-citation></ref>
      <ref id="bib1.bibx6"><label>Fichtner et al.(2006)Fichtner, Bunge, and
Igel</label><mixed-citation>Fichtner, A., Bunge, H.-P., and Igel, H.: The adjoint method in
seismology: I – Theory, Phys. Earth  Planet. In., 157,
86–104, <ext-link xlink:href="http://dx.doi.org/10.1016/j.pepi.2006.03.016" ext-link-type="DOI">10.1016/j.pepi.2006.03.016</ext-link>, 2006.</mixed-citation></ref>
      <ref id="bib1.bibx7"><label>Finlay et al.(2010)Finlay, Maus, Beggan, Bondar,
Chambodut, Chernova, Chulliat, Golovkov, Hamilton, Hamoudi,
Holme, Hulot, Kuang, Langlais, Lesur, Lowes, Lühr,
MacMillan, Mandea, McLean, Manoj, Menvielle, Michaelis, Olsen,
Rauberg, Rother, Sabaka, Tangborn, Tøffner-Clausen,
Thébault, Thomson, Wardinski, Wei, and Zvereva</label><mixed-citation>Finlay, C. C., Maus, S., Beggan, C. D., Bondar, T. N., Chambodut,
A.,
Chernova, T. A., Chulliat, A., Golovkov, V. P., Hamilton, B.,
Hamoudi, M., Holme, R., Hulot, G., Kuang, W., Langlais, B.,
Lesur, V., Lowes, F. J., Lühr, H., MacMillan, S., Mandea, M.,
McLean, S., Manoj, C., Menvielle, M., Michaelis, I., Olsen, N.,
Rauberg, J., Rother, M., Sabaka, T. J., Tangborn, A.,
Tøffner-Clausen, L., Thébault, E., Thomson, A. W. P.,
Wardinski, I., Wei, Z., and Zvereva, T. I.: International Geomagnetic
Reference Field: the eleventh generation, Geophys. J. Int.,
183, 1216–1230, <ext-link xlink:href="http://dx.doi.org/10.1111/j.1365-246X.2010.04804.x" ext-link-type="DOI">10.1111/j.1365-246X.2010.04804.x</ext-link>, 2010.</mixed-citation></ref>
      <ref id="bib1.bibx8"><label>Gauss(1839)</label><mixed-citation>
Gauss, C. F.: Allgemeine Theorie des Erdmagnetismus, in: Resultate aus
den
Beobachtungen des Magnetischen Vereins im Jahre 1838, edited by: Gauss,
C. F. and Weber, W., 1–59, Göttinger Magnetischer Verein, Leipzig,
1839.</mixed-citation></ref>
      <ref id="bib1.bibx9"><label>Giering and Kaminski(2003)</label><mixed-citation>
Giering, R. and Kaminski, T.: Applying
TAF to generate efficient derivative
code of Fortran 77–95 programs, Proceedings in Applied Mathematics and
Mechanics, 2, 54–57, 2003.</mixed-citation></ref>
      <ref id="bib1.bibx10"><label>Giles and Pierce(2000)</label><mixed-citation>Giles, M. B. and Pierce, N. A.: An Introduction to the Adjoint Approach
to
Design, Flow  Turbul. Combust., 65, 393–415,
<ext-link xlink:href="http://dx.doi.org/10.1007/s11214-008-9365-9" ext-link-type="DOI">10.1007/s11214-008-9365-9</ext-link>, 2000.</mixed-citation></ref>
      <ref id="bib1.bibx11"><label>Glassmeier(2000)</label><mixed-citation>
Glassmeier, K.-H.: Currents in Mercury's Magnetosphere, in:
Magnetospheric
Current Systems, Geophysical Monograph 118, 371–380, American
Geophysical Union, Washington DC, 2000.</mixed-citation></ref>
      <ref id="bib1.bibx12"><label>Glassmeier and Tsurutani(2014)</label><mixed-citation>Glassmeier, K.-H. and Tsurutani, B. T.: Carl Friedrich Gauss – General
Theory of Terrestrial Magnetism – a revised translation of the German text,
History of Geo- and Space Sciences, 5, 11–62, <ext-link xlink:href="http://dx.doi.org/10.5194/hgss-5-11-2014" ext-link-type="DOI">10.5194/hgss-5-11-2014</ext-link>,
2014.</mixed-citation></ref>
      <ref id="bib1.bibx13"><label>Glassmeier et al.(2007)Glassmeier, Grosser, Auster,
Constantinescu, Narita, and Stellmach</label><mixed-citation>Glassmeier, K.-H., Grosser, J., Auster, U., Constantinescu, D.,
Narita, Y., and Stellmach, S.: Electromagnetic Induction Effects and
Dynamo Action in the Hermean System, Space Sci. Rev., 132, 511–527,
<ext-link xlink:href="http://dx.doi.org/10.1007/s11214-007-9244-9" ext-link-type="DOI">10.1007/s11214-007-9244-9</ext-link>, 2007.</mixed-citation></ref>
      <ref id="bib1.bibx14"><label>Grosser et al.(2004)Grosser, Glassmeier, and
Stadelmann</label><mixed-citation>Grosser, J., Glassmeier, K.-H., and Stadelmann, A.: Induced magnetic
field effects at planet Mercury, Planet. Space Sci., 52,
1251–1260, <ext-link xlink:href="http://dx.doi.org/10.1016/j.pss.2004.08.005" ext-link-type="DOI">10.1016/j.pss.2004.08.005</ext-link>, 2004.</mixed-citation></ref>
      <ref id="bib1.bibx15"><label>Heyner et al.(2011)Heyner, Wicht, Gómez-Pérez,
Schmitt, Auster, and Glassmeier</label><mixed-citation>Heyner, D., Wicht, J., Gómez-Pérez, N., Schmitt, D.,
Auster,
H.-U., and Glassmeier, K.-H.: Evidence from Numerical Experiments for a
Feedback Dynamo Generating Mercury's Magnetic Field, Science, 334,
1690–1693, <ext-link xlink:href="http://dx.doi.org/10.1126/science.1207290" ext-link-type="DOI">10.1126/science.1207290</ext-link>, 2011.</mixed-citation></ref>
      <ref id="bib1.bibx16"><label>Jameson(1988)</label><mixed-citation>Jameson, A.: Aerodynamic Design via Control Theory, J. Sci.
Comput., 3, 233–260, <ext-link xlink:href="http://dx.doi.org/10.1007/BF01061285" ext-link-type="DOI">10.1007/BF01061285</ext-link>, 1988.</mixed-citation></ref>
      <ref id="bib1.bibx17"><label>Jia et al.(2015)Jia, Slavin, Gombosi, Daldorff, Toth, and
Holst</label><mixed-citation>Jia, X., Slavin, J. A., Gombosi, T. I., Daldorff, L. K. S., Toth,
G., and Holst, B.: Global MHD simulations of Mercury's magnetosphere with
coupled planetary interior: Induction effect of the planetary conducting core
on the global interaction, J. Geophys. Res.-Space,
120, 4763–4775, <ext-link xlink:href="http://dx.doi.org/10.1002/2015JA021143" ext-link-type="DOI">10.1002/2015JA021143</ext-link>, 2015.</mixed-citation></ref>
      <ref id="bib1.bibx18"><label>Johnson et al.(2012)Johnson, Purucker, Korth, Anderson,
Winslow, Al Asad, Slavin, Alexeev, Phillips, Zuber, and
Solomon</label><mixed-citation>Johnson, C. L., Purucker, M. E., Korth, H., Anderson, B. J.,
Winslow,
R. M., Al Asad, M. M. H., Slavin, J. A., Alexeev, I. I., Phillips,
R. J., Zuber, M. T., and Solomon, S. C.: MESSENGER observations of
Mercury's magnetic field structure, J. Geophys. Res.-Planet., 117, E00L14, <ext-link xlink:href="http://dx.doi.org/10.1029/2012JE004217" ext-link-type="DOI">10.1029/2012JE004217</ext-link>, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx19"><label>Korth et al.(2004)Korth, J. Anderson, Acuña, Slavin,
Tsyganenko, Solomon, and McNutt</label><mixed-citation>Korth, H., J. Anderson, B., Acuña, M. H., Slavin, J. A.,
Tsyganenko, N. A., Solomon, S. C., and McNutt, R. L.: Determination of
the properties of Mercury's magnetic field by the MESSENGER mission,
Planet. Space Sci., 52, 733–746, <ext-link xlink:href="http://dx.doi.org/10.1016/j.pss.2003.12.008" ext-link-type="DOI">10.1016/j.pss.2003.12.008</ext-link>,
2004.</mixed-citation></ref>
      <ref id="bib1.bibx20"><label>Langel(1987)</label><mixed-citation>
Langel, R. A.: The main field, in: Geomagnetism, edited by: Jacobs,
J. A., 249–512, Academic Press, London, 1987.</mixed-citation></ref>
      <ref id="bib1.bibx21"><label>Lax and Wendroff(1960)</label><mixed-citation>Lax, P. and Wendroff, B.: Systems of conservation laws, Commun. Pur.
Appl. Math., 13, 217–237, <ext-link xlink:href="http://dx.doi.org/10.1002/cpa.3160130205" ext-link-type="DOI">10.1002/cpa.3160130205</ext-link>, 1960.</mixed-citation></ref>
      <ref id="bib1.bibx22"><label>McFadden et al.(2008)McFadden, Carlson, Larson, Ludlam,
Abiad, Elliott, Turin, Marckwordt, and Angelopoulos</label><mixed-citation>McFadden, J. P., Carlson, C. W., Larson, D., Ludlam, M., Abiad, R.,
Elliott, B., Turin, P., Marckwordt, M., and Angelopoulos, V.: The
THEMIS ESA Plasma Instrument and In-flight Calibration, Space Sci.
Rev., 141, 277–302, <ext-link xlink:href="http://dx.doi.org/10.1007/s11214-008-9440-2" ext-link-type="DOI">10.1007/s11214-008-9440-2</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx23"><label>McNamara et al.(2004)McNamara, Treuille, Popović, and
Stam</label><mixed-citation>McNamara, A., Treuille, A., Popović, Z., and Stam, J.: Fluid Control
Using
the Adjoint Method, ACM T. Graphic., 23, 449–456,
<ext-link xlink:href="http://dx.doi.org/10.1145/1015706.1015744" ext-link-type="DOI">10.1145/1015706.1015744</ext-link>, 2004.</mixed-citation></ref>
      <ref id="bib1.bibx24"><label>Meader and Martins(2012)</label><mixed-citation>Meader, C. A. and Martins, J. R. R. A.: Derivatives for Time-Spectral
Computational Fluid Dynamics Using an Automatic Differentiation Adjoint, The
American Institute of Aeronautics and Astronautics Journal, 50, 2809–2819,
<ext-link xlink:href="http://dx.doi.org/10.2514/1.J051658" ext-link-type="DOI">10.2514/1.J051658</ext-link>, 2012.</mixed-citation></ref>
      <ref id="bib1.bibx25"><label>Nabert et al.(2013)Nabert, Glassmeier, and
Plaschke</label><mixed-citation>Nabert, C., Glassmeier, K.-H., and Plaschke, F.: A new method for solving the
MHD equations in the magnetosheath, Ann. Geophys., 31, 419–437,
<ext-link xlink:href="http://dx.doi.org/10.5194/angeo-31-419-2013" ext-link-type="DOI">10.5194/angeo-31-419-2013</ext-link>, 2013.</mixed-citation></ref>
      <ref id="bib1.bibx26"><label>Nabert et al.(2015)Nabert, Othmer, and
Glassmeier</label><mixed-citation>Nabert, C., Othmer, C., and Glassmeier, K.-H.: Solar wind reconstruction from
magnetosheath data using an adjoint approach, Ann. Geophys., 33, 1513–1524,
<ext-link xlink:href="http://dx.doi.org/10.5194/angeo-33-1513-2015" ext-link-type="DOI">10.5194/angeo-33-1513-2015</ext-link>, 2015.</mixed-citation></ref>
      <ref id="bib1.bibx27"><label>Ogino(1986)</label><mixed-citation>Ogino, T.: A three-dimensional MHD simulation of the interaction of the
solar wind with the earth's magnetosphere – The generation of field-aligned
currents, J. Geophys. Res., 91, 6791–6806,
<ext-link xlink:href="http://dx.doi.org/10.1029/JA091iA06p06791" ext-link-type="DOI">10.1029/JA091iA06p06791</ext-link>, 1986.</mixed-citation></ref>
      <ref id="bib1.bibx28"><label>Ogino(1993)</label><mixed-citation>
Ogino, T.: Two-Dimensional MHD Code, in: Computer Space Plasma Physics:
Simulation Techniques and Software, edited by: Matsumoto, H. and Omura,
Y., 161–207, Terra Scientific Publishing Company, Tokyo, 1993.</mixed-citation></ref>
      <ref id="bib1.bibx29"><label>Ogino et al.(1985)Ogino, Walker, Ashour-Abdalla, and
Dawson</label><mixed-citation>Ogino, T., Walker, R. J., Ashour-Abdalla, M., and Dawson, J. M.: An
MHD simulation of By-dependent magnetospheric convection and field-aligned
currents during northward IMF, J. Geophys. Res., 90,
10835–10842, <ext-link xlink:href="http://dx.doi.org/10.1029/JA090iA11p10835" ext-link-type="DOI">10.1029/JA090iA11p10835</ext-link>, 1985.</mixed-citation></ref>
      <ref id="bib1.bibx30"><label>Othmer(2008)</label><mixed-citation>Othmer, C.: A continuous adjoint formulation for the computation of
topological and surface sensitivities of ducted flows, International Journal
for Numerical Methods in Fluids, 58, 861–877, <ext-link xlink:href="http://dx.doi.org/10.1002/fld.1770" ext-link-type="DOI">10.1002/fld.1770</ext-link>, 2008.</mixed-citation></ref>
      <ref id="bib1.bibx31"><label>Othmer(2014)</label><mixed-citation>Othmer, C.: Adjoint methods for car aerodynamics, Journal of Mathematics
in Industry, 4, 6, <ext-link xlink:href="http://dx.doi.org/10.1186/2190-5983-4-6" ext-link-type="DOI">10.1186/2190-5983-4-6</ext-link>, 2014.</mixed-citation></ref>
      <ref id="bib1.bibx32"><label>Press et al.(1992)Press, Teukolsky, Vetterling, and
Flannery</label><mixed-citation>
Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery,
B. P.:
Numerical recipes in FORTRAN, Cambridge University Press, Cambridge, 1992.</mixed-citation></ref>
      <ref id="bib1.bibx33"><label>Solomon et al.(2001)Solomon, McNutt, Gold, Acuña,
Baker, Boynton, Chapman, Cheng, Gloeckler, Head, Krimigis,
McClintock, Murchie, Peale, Phillips, Robinson, Slavin, Smith,
Strom, Trombka, and Zuber</label><mixed-citation>Solomon, S. C., McNutt, R. L., Gold, R. E., Acuña, M. H.,
Baker,
D. N., Boynton, W. V., Chapman, C. R., Cheng, A. F., Gloeckler, G.,
Head, III, J. W., Krimigis, S. M., McClintock, W. E., Murchie, S. L.,
Peale, S. J., Phillips, R. J., Robinson, M. S., Slavin, J. A.,
Smith, D. E., Strom, R. G., Trombka, J. I., and Zuber, M. T.: The
MESSENGER mission to Mercury: scientific objectives and implementation,
Planet. Space Sci., 49, 1445–1465,
<ext-link xlink:href="http://dx.doi.org/10.1016/S0032-0633(01)00085-X" ext-link-type="DOI">10.1016/S0032-0633(01)00085-X</ext-link>, 2001.</mixed-citation></ref>
      <ref id="bib1.bibx34"><label>Stadelmann et al.(2010)Stadelmann, Vogt, Glassmeier,
Kallenrode, and Voigt</label><mixed-citation>Stadelmann, A., Vogt, J., Glassmeier, K.-H., Kallenrode, M.-B., and
Voigt, G.-H.: Cosmic ray and solar energetic particle flux in
paleomagnetospheres, Earth Planets Space, 62, 333–345,
<ext-link xlink:href="http://dx.doi.org/10.5047/eps.2009.10.002" ext-link-type="DOI">10.5047/eps.2009.10.002</ext-link>, 2010.
</mixed-citation></ref><?xmltex \hack{\newpage}?>
      <ref id="bib1.bibx35"><label>Vogt and Glassmeier(2000)</label><mixed-citation>Vogt, J. and Glassmeier, K. H.: On the location of trapped particle
populations in quadrupole magnetospheres, J. Geophys. Res.,
105, 13063–13072, <ext-link xlink:href="http://dx.doi.org/10.1029/2000JA900006" ext-link-type="DOI">10.1029/2000JA900006</ext-link>, 2000.</mixed-citation></ref>
      <ref id="bib1.bibx36"><label>Wengert(1964)</label><mixed-citation>
Wengert, R. E.: A simple automatic derivative evaluation program,
Commun. ACM, 7, 463–464, 1964.</mixed-citation></ref>
      <ref id="bib1.bibx37"><label>Winslow et al.(2013)Winslow, Anderson, Johnson, Slavin,
Korth, Purucker, Baker, and Solomon</label><mixed-citation>Winslow, R. M., Anderson, B. J., Johnson, C. L., Slavin, J. A.,
Korth, H., Purucker, M. E., Baker, D. N., and Solomon, S. C.:
Mercury's magnetopause and bow shock from MESSENGER Magnetometer
observations, J. Geophys. Res.-Space, 118,
2213–2227, <ext-link xlink:href="http://dx.doi.org/10.1002/jgra.50237" ext-link-type="DOI">10.1002/jgra.50237</ext-link>, 2013.</mixed-citation></ref>

  </ref-list><app-group content-type="float"><app><title/>

    </app></app-group></back>
    <!--<article-title-html>Estimating a planetary magnetic field with time-dependent global MHD simulations using an adjoint approach</article-title-html>
<abstract-html><p class="p">The interaction of the solar wind with a planetary magnetic field causes
electrical currents that modify the magnetic field distribution around the
planet. We present an approach to estimating the planetary magnetic field from
in situ spacecraft data using a magnetohydrodynamic (MHD) simulation
approach. The method is developed with respect to the upcoming BepiColombo
mission to planet Mercury aimed at determining the planet's
magnetic field and its interior electrical conductivity distribution. In
contrast to the widely used empirical models, global MHD simulations allow
the
calculation of the strongly time-dependent interaction process of the solar wind
with the planet. As a first approach, we use a simple MHD simulation code
that includes time-dependent solar wind and magnetic field parameters. The
planetary parameters are estimated by minimizing the misfit of spacecraft
data and simulation results with a gradient-based optimization. As the
calculation of gradients with respect to many parameters is usually very
time-consuming, we investigate the application of an adjoint MHD model. This
adjoint MHD model is generated by an automatic differentiation tool to
compute the gradients efficiently. The computational cost for determining
the gradient with an adjoint approach is nearly independent of the number of
parameters. Our method is validated by application to THEMIS (Time History of
Events and Macroscale Interactions during Substorms) magnetosheath data to
estimate Earth's dipole moment.</p></abstract-html>
<ref-html id="bib1.bib1"><label>Alexeev et al.(2010)Alexeev, Belenkaya, Slavin, Korth,
Anderson, Baker, Boardsen, Johnson, Purucker, Sarantos, and
Solomon</label><mixed-citation>
Alexeev, I. I., Belenkaya, E. S., Slavin, J. A., Korth, H.,
Anderson,
B. J., Baker, D. N., Boardsen, S. A., Johnson, C. L., Purucker,
M. E., Sarantos, M., and Solomon, S. C.: Mercury's magnetospheric
magnetic field after the first two MESSENGER flybys, Icarus, 209, 23–39,
<a href="http://dx.doi.org/10.1016/j.icarus.2010.01.024" target="_blank">doi:10.1016/j.icarus.2010.01.024</a>, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib2"><label>Angelopoulos(2008)</label><mixed-citation>
Angelopoulos, V.: The THEMIS Mission, Space Sci. Rev., 141, 5–34,
<a href="http://dx.doi.org/10.1007/s11214-008-9336-1" target="_blank">doi:10.1007/s11214-008-9336-1</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib3"><label>Benkhoff et al.(2010)Benkhoff, van Casteren, Hayakawa,
Fujimoto, Laakso, Novara, Ferri, Middleton, and
Ziethe</label><mixed-citation>
Benkhoff, J., van Casteren, J., Hayakawa, H., Fujimoto, M., Laakso,
H., Novara, M., Ferri, P., Middleton, H. R., and Ziethe, R.:
BepiColombo – Comprehensive exploration of Mercury: Mission overview and
science goals, Planet. Space Sci., 58, 2–20,
<a href="http://dx.doi.org/10.1016/j.pss.2009.09.020" target="_blank">doi:10.1016/j.pss.2009.09.020</a>, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib4"><label>Clauser(2016)</label><mixed-citation>
Clauser, C.: Einführung in die Geophysik, Springer Spektrum, Berlin
Heidelberg, 2016.
</mixed-citation></ref-html>
<ref-html id="bib1.bib5"><label>Dean and Ghemawat(2004)</label><mixed-citation>
Dean, J. and Ghemawat, S.: MapReduce: Simplified data processing on
large
clusters, in: Proceedings of Operating Systems Design and Implementation,
137–150, San Francisco, 2004.
</mixed-citation></ref-html>
<ref-html id="bib1.bib6"><label>Fichtner et al.(2006)Fichtner, Bunge, and
Igel</label><mixed-citation>
Fichtner, A., Bunge, H.-P., and Igel, H.: The adjoint method in
seismology: I – Theory, Phys. Earth  Planet. In., 157,
86–104, <a href="http://dx.doi.org/10.1016/j.pepi.2006.03.016" target="_blank">doi:10.1016/j.pepi.2006.03.016</a>, 2006.
</mixed-citation></ref-html>
<ref-html id="bib1.bib7"><label>Finlay et al.(2010)Finlay, Maus, Beggan, Bondar,
Chambodut, Chernova, Chulliat, Golovkov, Hamilton, Hamoudi,
Holme, Hulot, Kuang, Langlais, Lesur, Lowes, Lühr,
MacMillan, Mandea, McLean, Manoj, Menvielle, Michaelis, Olsen,
Rauberg, Rother, Sabaka, Tangborn, Tøffner-Clausen,
Thébault, Thomson, Wardinski, Wei, and Zvereva</label><mixed-citation>
Finlay, C. C., Maus, S., Beggan, C. D., Bondar, T. N., Chambodut,
A.,
Chernova, T. A., Chulliat, A., Golovkov, V. P., Hamilton, B.,
Hamoudi, M., Holme, R., Hulot, G., Kuang, W., Langlais, B.,
Lesur, V., Lowes, F. J., Lühr, H., MacMillan, S., Mandea, M.,
McLean, S., Manoj, C., Menvielle, M., Michaelis, I., Olsen, N.,
Rauberg, J., Rother, M., Sabaka, T. J., Tangborn, A.,
Tøffner-Clausen, L., Thébault, E., Thomson, A. W. P.,
Wardinski, I., Wei, Z., and Zvereva, T. I.: International Geomagnetic
Reference Field: the eleventh generation, Geophys. J. Int.,
183, 1216–1230, <a href="http://dx.doi.org/10.1111/j.1365-246X.2010.04804.x" target="_blank">doi:10.1111/j.1365-246X.2010.04804.x</a>, 2010.
</mixed-citation></ref-html>
<ref-html id="bib1.bib8"><label>Gauss(1839)</label><mixed-citation>
Gauss, C. F.: Allgemeine Theorie des Erdmagnetismus, in: Resultate aus
den
Beobachtungen des Magnetischen Vereins im Jahre 1838, edited by: Gauss,
C. F. and Weber, W., 1–59, Göttinger Magnetischer Verein, Leipzig,
1839.
</mixed-citation></ref-html>
<ref-html id="bib1.bib9"><label>Giering and Kaminski(2003)</label><mixed-citation>
Giering, R. and Kaminski, T.: Applying
TAF to generate efficient derivative
code of Fortran 77–95 programs, Proceedings in Applied Mathematics and
Mechanics, 2, 54–57, 2003.
</mixed-citation></ref-html>
<ref-html id="bib1.bib10"><label>Giles and Pierce(2000)</label><mixed-citation>
Giles, M. B. and Pierce, N. A.: An Introduction to the Adjoint Approach
to
Design, Flow  Turbul. Combust., 65, 393–415,
<a href="http://dx.doi.org/10.1007/s11214-008-9365-9" target="_blank">doi:10.1007/s11214-008-9365-9</a>, 2000.
</mixed-citation></ref-html>
<ref-html id="bib1.bib11"><label>Glassmeier(2000)</label><mixed-citation>
Glassmeier, K.-H.: Currents in Mercury's Magnetosphere, in:
Magnetospheric
Current Systems, Geophysical Monograph 118, 371–380, American
Geophysical Union, Washington DC, 2000.
</mixed-citation></ref-html>
<ref-html id="bib1.bib12"><label>Glassmeier and Tsurutani(2014)</label><mixed-citation>
Glassmeier, K.-H. and Tsurutani, B. T.: Carl Friedrich Gauss – General
Theory of Terrestrial Magnetism – a revised translation of the German text,
History of Geo- and Space Sciences, 5, 11–62, <a href="http://dx.doi.org/10.5194/hgss-5-11-2014" target="_blank">doi:10.5194/hgss-5-11-2014</a>,
2014.
</mixed-citation></ref-html>
<ref-html id="bib1.bib13"><label>Glassmeier et al.(2007)Glassmeier, Grosser, Auster,
Constantinescu, Narita, and Stellmach</label><mixed-citation>
Glassmeier, K.-H., Grosser, J., Auster, U., Constantinescu, D.,
Narita, Y., and Stellmach, S.: Electromagnetic Induction Effects and
Dynamo Action in the Hermean System, Space Sci. Rev., 132, 511–527,
<a href="http://dx.doi.org/10.1007/s11214-007-9244-9" target="_blank">doi:10.1007/s11214-007-9244-9</a>, 2007.
</mixed-citation></ref-html>
<ref-html id="bib1.bib14"><label>Grosser et al.(2004)Grosser, Glassmeier, and
Stadelmann</label><mixed-citation>
Grosser, J., Glassmeier, K.-H., and Stadelmann, A.: Induced magnetic
field effects at planet Mercury, Planet. Space Sci., 52,
1251–1260, <a href="http://dx.doi.org/10.1016/j.pss.2004.08.005" target="_blank">doi:10.1016/j.pss.2004.08.005</a>, 2004.
</mixed-citation></ref-html>
<ref-html id="bib1.bib15"><label>Heyner et al.(2011)Heyner, Wicht, Gómez-Pérez,
Schmitt, Auster, and Glassmeier</label><mixed-citation>
Heyner, D., Wicht, J., Gómez-Pérez, N., Schmitt, D.,
Auster,
H.-U., and Glassmeier, K.-H.: Evidence from Numerical Experiments for a
Feedback Dynamo Generating Mercury's Magnetic Field, Science, 334,
1690–1693, <a href="http://dx.doi.org/10.1126/science.1207290" target="_blank">doi:10.1126/science.1207290</a>, 2011.
</mixed-citation></ref-html>
<ref-html id="bib1.bib16"><label>Jameson(1988)</label><mixed-citation>
Jameson, A.: Aerodynamic Design via Control Theory, J. Sci.
Comput., 3, 233–260, <a href="http://dx.doi.org/10.1007/BF01061285" target="_blank">doi:10.1007/BF01061285</a>, 1988.
</mixed-citation></ref-html>
<ref-html id="bib1.bib17"><label>Jia et al.(2015)Jia, Slavin, Gombosi, Daldorff, Toth, and
Holst</label><mixed-citation>
Jia, X., Slavin, J. A., Gombosi, T. I., Daldorff, L. K. S., Toth,
G., and Holst, B.: Global MHD simulations of Mercury's magnetosphere with
coupled planetary interior: Induction effect of the planetary conducting core
on the global interaction, J. Geophys. Res.-Space,
120, 4763–4775, <a href="http://dx.doi.org/10.1002/2015JA021143" target="_blank">doi:10.1002/2015JA021143</a>, 2015.
</mixed-citation></ref-html>
<ref-html id="bib1.bib18"><label>Johnson et al.(2012)Johnson, Purucker, Korth, Anderson,
Winslow, Al Asad, Slavin, Alexeev, Phillips, Zuber, and
Solomon</label><mixed-citation>
Johnson, C. L., Purucker, M. E., Korth, H., Anderson, B. J.,
Winslow,
R. M., Al Asad, M. M. H., Slavin, J. A., Alexeev, I. I., Phillips,
R. J., Zuber, M. T., and Solomon, S. C.: MESSENGER observations of
Mercury's magnetic field structure, J. Geophys. Res.-Planet., 117, E00L14, <a href="http://dx.doi.org/10.1029/2012JE004217" target="_blank">doi:10.1029/2012JE004217</a>, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib19"><label>Korth et al.(2004)Korth, J. Anderson, Acuña, Slavin,
Tsyganenko, Solomon, and McNutt</label><mixed-citation>
Korth, H., J. Anderson, B., Acuña, M. H., Slavin, J. A.,
Tsyganenko, N. A., Solomon, S. C., and McNutt, R. L.: Determination of
the properties of Mercury's magnetic field by the MESSENGER mission,
Planet. Space Sci., 52, 733–746, <a href="http://dx.doi.org/10.1016/j.pss.2003.12.008" target="_blank">doi:10.1016/j.pss.2003.12.008</a>,
2004.
</mixed-citation></ref-html>
<ref-html id="bib1.bib20"><label>Langel(1987)</label><mixed-citation>
Langel, R. A.: The main field, in: Geomagnetism, edited by: Jacobs,
J. A., 249–512, Academic Press, London, 1987.
</mixed-citation></ref-html>
<ref-html id="bib1.bib21"><label>Lax and Wendroff(1960)</label><mixed-citation>
Lax, P. and Wendroff, B.: Systems of conservation laws, Commun. Pur.
Appl. Math., 13, 217–237, <a href="http://dx.doi.org/10.1002/cpa.3160130205" target="_blank">doi:10.1002/cpa.3160130205</a>, 1960.
</mixed-citation></ref-html>
<ref-html id="bib1.bib22"><label>McFadden et al.(2008)McFadden, Carlson, Larson, Ludlam,
Abiad, Elliott, Turin, Marckwordt, and Angelopoulos</label><mixed-citation>
McFadden, J. P., Carlson, C. W., Larson, D., Ludlam, M., Abiad, R.,
Elliott, B., Turin, P., Marckwordt, M., and Angelopoulos, V.: The
THEMIS ESA Plasma Instrument and In-flight Calibration, Space Sci.
Rev., 141, 277–302, <a href="http://dx.doi.org/10.1007/s11214-008-9440-2" target="_blank">doi:10.1007/s11214-008-9440-2</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib23"><label>McNamara et al.(2004)McNamara, Treuille, Popović, and
Stam</label><mixed-citation>
McNamara, A., Treuille, A., Popović, Z., and Stam, J.: Fluid Control
Using
the Adjoint Method, ACM T. Graphic., 23, 449–456,
<a href="http://dx.doi.org/10.1145/1015706.1015744" target="_blank">doi:10.1145/1015706.1015744</a>, 2004.
</mixed-citation></ref-html>
<ref-html id="bib1.bib24"><label>Meader and Martins(2012)</label><mixed-citation>
Meader, C. A. and Martins, J. R. R. A.: Derivatives for Time-Spectral
Computational Fluid Dynamics Using an Automatic Differentiation Adjoint, The
American Institute of Aeronautics and Astronautics Journal, 50, 2809–2819,
<a href="http://dx.doi.org/10.2514/1.J051658" target="_blank">doi:10.2514/1.J051658</a>, 2012.
</mixed-citation></ref-html>
<ref-html id="bib1.bib25"><label>Nabert et al.(2013)Nabert, Glassmeier, and
Plaschke</label><mixed-citation>
Nabert, C., Glassmeier, K.-H., and Plaschke, F.: A new method for solving the
MHD equations in the magnetosheath, Ann. Geophys., 31, 419–437,
<a href="http://dx.doi.org/10.5194/angeo-31-419-2013" target="_blank">doi:10.5194/angeo-31-419-2013</a>, 2013.
</mixed-citation></ref-html>
<ref-html id="bib1.bib26"><label>Nabert et al.(2015)Nabert, Othmer, and
Glassmeier</label><mixed-citation>
Nabert, C., Othmer, C., and Glassmeier, K.-H.: Solar wind reconstruction from
magnetosheath data using an adjoint approach, Ann. Geophys., 33, 1513–1524,
<a href="http://dx.doi.org/10.5194/angeo-33-1513-2015" target="_blank">doi:10.5194/angeo-33-1513-2015</a>, 2015.
</mixed-citation></ref-html>
<ref-html id="bib1.bib27"><label>Ogino(1986)</label><mixed-citation>
Ogino, T.: A three-dimensional MHD simulation of the interaction of the
solar wind with the earth's magnetosphere – The generation of field-aligned
currents, J. Geophys. Res., 91, 6791–6806,
<a href="http://dx.doi.org/10.1029/JA091iA06p06791" target="_blank">doi:10.1029/JA091iA06p06791</a>, 1986.
</mixed-citation></ref-html>
<ref-html id="bib1.bib28"><label>Ogino(1993)</label><mixed-citation>
Ogino, T.: Two-Dimensional MHD Code, in: Computer Space Plasma Physics:
Simulation Techniques and Software, edited by: Matsumoto, H. and Omura,
Y., 161–207, Terra Scientific Publishing Company, Tokyo, 1993.
</mixed-citation></ref-html>
<ref-html id="bib1.bib29"><label>Ogino et al.(1985)Ogino, Walker, Ashour-Abdalla, and
Dawson</label><mixed-citation>
Ogino, T., Walker, R. J., Ashour-Abdalla, M., and Dawson, J. M.: An
MHD simulation of By-dependent magnetospheric convection and field-aligned
currents during northward IMF, J. Geophys. Res., 90,
10835–10842, <a href="http://dx.doi.org/10.1029/JA090iA11p10835" target="_blank">doi:10.1029/JA090iA11p10835</a>, 1985.
</mixed-citation></ref-html>
<ref-html id="bib1.bib30"><label>Othmer(2008)</label><mixed-citation>
Othmer, C.: A continuous adjoint formulation for the computation of
topological and surface sensitivities of ducted flows, International Journal
for Numerical Methods in Fluids, 58, 861–877, <a href="http://dx.doi.org/10.1002/fld.1770" target="_blank">doi:10.1002/fld.1770</a>, 2008.
</mixed-citation></ref-html>
<ref-html id="bib1.bib31"><label>Othmer(2014)</label><mixed-citation>
Othmer, C.: Adjoint methods for car aerodynamics, Journal of Mathematics
in Industry, 4, 6, <a href="http://dx.doi.org/10.1186/2190-5983-4-6" target="_blank">doi:10.1186/2190-5983-4-6</a>, 2014.
</mixed-citation></ref-html>
<ref-html id="bib1.bib32"><label>Press et al.(1992)Press, Teukolsky, Vetterling, and
Flannery</label><mixed-citation>
Press, W. H., Teukolsky, S. A., Vetterling, W. T., and Flannery,
B. P.:
Numerical recipes in FORTRAN, Cambridge University Press, Cambridge, 1992.
</mixed-citation></ref-html>
<ref-html id="bib1.bib33"><label>Solomon et al.(2001)Solomon, McNutt, Gold, Acuña,
Baker, Boynton, Chapman, Cheng, Gloeckler, Head, Krimigis,
McClintock, Murchie, Peale, Phillips, Robinson, Slavin, Smith,
Strom, Trombka, and Zuber</label><mixed-citation>
Solomon, S. C., McNutt, R. L., Gold, R. E., Acuña, M. H.,
Baker,
D. N., Boynton, W. V., Chapman, C. R., Cheng, A. F., Gloeckler, G.,
Head, III, J. W., Krimigis, S. M., McClintock, W. E., Murchie, S. L.,
Peale, S. J., Phillips, R. J., Robinson, M. S., Slavin, J. A.,
Smith, D. E., Strom, R. G., Trombka, J. I., and Zuber, M. T.: The
MESSENGER mission to Mercury: scientific objectives and implementation,
Planet. Space Sci., 49, 1445–1465,
<a href="http://dx.doi.org/10.1016/S0032-0633(01)00085-X" target="_blank">doi:10.1016/S0032-0633(01)00085-X</a>, 2001.
</mixed-citation></ref-html>
<ref-html id="bib1.bib34"><label>Stadelmann et al.(2010)Stadelmann, Vogt, Glassmeier,
Kallenrode, and Voigt</label><mixed-citation>
Stadelmann, A., Vogt, J., Glassmeier, K.-H., Kallenrode, M.-B., and
Voigt, G.-H.: Cosmic ray and solar energetic particle flux in
paleomagnetospheres, Earth Planets Space, 62, 333–345,
<a href="http://dx.doi.org/10.5047/eps.2009.10.002" target="_blank">doi:10.5047/eps.2009.10.002</a>, 2010.

</mixed-citation></ref-html>
<ref-html id="bib1.bib35"><label>Vogt and Glassmeier(2000)</label><mixed-citation>
Vogt, J. and Glassmeier, K. H.: On the location of trapped particle
populations in quadrupole magnetospheres, J. Geophys. Res.,
105, 13063–13072, <a href="http://dx.doi.org/10.1029/2000JA900006" target="_blank">doi:10.1029/2000JA900006</a>, 2000.
</mixed-citation></ref-html>
<ref-html id="bib1.bib36"><label>Wengert(1964)</label><mixed-citation>
Wengert, R. E.: A simple automatic derivative evaluation program,
Commun. ACM, 7, 463–464, 1964.
</mixed-citation></ref-html>
<ref-html id="bib1.bib37"><label>Winslow et al.(2013)Winslow, Anderson, Johnson, Slavin,
Korth, Purucker, Baker, and Solomon</label><mixed-citation>
Winslow, R. M., Anderson, B. J., Johnson, C. L., Slavin, J. A.,
Korth, H., Purucker, M. E., Baker, D. N., and Solomon, S. C.:
Mercury's magnetopause and bow shock from MESSENGER Magnetometer
observations, J. Geophys. Res.-Space, 118,
2213–2227, <a href="http://dx.doi.org/10.1002/jgra.50237" target="_blank">doi:10.1002/jgra.50237</a>, 2013.
</mixed-citation></ref-html>--></article>
