\section{Standard Model}
\begin{itemize}
\item All fundamental particles and their interactions are described by quantum field theory known as the Standard Model.
\item The Standard Model is a gauge theory based on the symmetry group \mbox{SU$(3)_{c}$ $\otimes$ SU$(2)_{L}$ $\otimes$ U$(1)_{Y}$}.
\item This group structure is broken by the vacuum, which triggers the spontaneous breaking of the SU$(2)_{L}$ $\otimes$ U$(1)_{Y}$ group. It is believed that the Higgs mechanism is responsible for the spontaneous symmetry breaking. This mechanism generates masses for the weak gauge bosons (W and Z) as well as generating mass for all fermions. To achieve the symmetry breaking a neutral scalar boson must be introduced into the theory. This particle is called the Higgs boson and to date has not yet been observed.
\item This model describes the interactions of the strong, weak, and electromagnetic forces.
\item There are two types of particles in the SM: fermions (particles with fractional) and bosons (particles with integer spin).
\item Within the fermions, there are two more fundamental categories: quarks and leptons.
\item The first generation of the quarks and leptons are stable (do not decay) and makes up all the matter in the world. The second and third generations are not stable and will decay into the first generation.
\item Each quark generation comes in a doublet with one quark having a charge $+\frac{2}{3}$e and the other having charge $-\frac{1}{3}$e. The quarks with charge $+\frac{2}{3}$e are commonly called the up-type quarks and quarks with charge $-\frac{1}{3}$e are called the down-type quarks.
\item Each lepton generation also comes in a doublet, but this time one of the particles has unit charge and the other has no charge. The particles with unit charge are the electron, muon, and tau lepton. The particles with no charge are the associated neutrino for the previously listed leptons.
\item Particles with integer spin are the force carries within the SM framework. The four known spin 1 bosons in the SM: the photon, the gluon, and the W and Z particles. The photon is the carrier of the electromagnetic force which couples to particles with electromagnetic charge, such as the electron or the up quark. The gluon is the carrier of the strong force which couples particles with color charge which includes all the quarks as well as the gluon itself. The W and Z bosons are the carriers of the weak force which couples particles with weak charge, which is all quarks and leptons.
\item Within the SM framework, neutrinos required to have exactly zero mass; however recent experiments have shown that at least two the neutrinos must have a non-zero mass. There is no mechanism within the SM to give neutrinos mass and therefore this is evidence that the SM of particle interactions is not a complete theory. Even though the SM is not the full underlying theory of all particles and their interactions, it has been an extremely successful tool used to compute cross sections for particle collisions which is essential in high energy physics.
\item There are three types of interactions described in the SM: the strong interaction between objects with color such as quarks and gluons, the weak interaction between particles with weak charge, and electromagnetic interaction between charged particles.
\item The weak interaction is mediated by the charged W boson and the neutral Z boson. Interactions involving the Z boson are called neutral current interactions and only occur between members of the same family or generation. In contrast, interactions involving the charged W boson can  occur between members of the same generation, but also between generations. One interesting feature of the Standard Model Lagrangian is that the mass matrix and the weak matrix are can not be simultaneously diagnolized for weakly interacting particles. This mean that the weakly interacting fermions described in the Table.~\ref{fermions} are not the same as the fermions that interact with the W boson. The relationship between the weak and mass eigenstates of the Standard Model Lagrangian is summarized by the Cabbibo-Kobayahski-Maskawa (CKM) unitary quark mixing matrix. The parameters in the CKM matrix can not calculated from first principles and must be determined from experiment.
\item The mass or strong eigenstates can be rotated into the weak eigenstates by the unitary CKM mixing matrix as shown in Eq.~\ref{ckm}.
\item The magnitudes of the CKM matrix elements as determined from experiment can be found in Eq.~\ref{ckmval}.
\item The strong interaction is mediated by 8 massless and neutral gauge bosons called gluons. Gluons interact with any particle that carries strong charge called color. In the Standard Model only quarks and gluons carry color charge. In the Standard Model there are three different color commonly called red (R), blue (B), and green (G). One interesting property of the strong interaction at low energies is that bare quarks can not travel long distances when they carry color charge. Instead, colored quarks combine with other quarks to form colorless bound states called mesons (q$\bar{q}^{'}$) or baryons (qqq) depending on the number of constituent quarks. This phenomenon is called comfinement. Examples of mesons are pions (up and down quarks) and kaons (up and strange quarks) and examples of baryons are the proton (two up quarks and down quark) and the neutron (two down and one up quark). At higher energies the strong interaction becomes relatively weak and quarks are allowed to break their confined states and travel as a bare color charge. As the quark begins to propagate, it polarizes the vacuum until enough energy is built up to create a quark-antiquark pair. This process, called hadronization, can repeat itself many times and will produce many new strongly interacting particles. The effect of hadronization is the production of a large number of hadrons in the same direction as the originating colored quark or gluon. The top quark, discussed in the next section, is the only quark that does not undergo hadronization due its extremely short lifetime.
\end{itemize}

The electromagnetic (EM) interaction arises from the requirement that the EM Lagrangian is invariant under an arbitrary phase rotation (\mbox{$\Psi^{'}(x) \rightarrow e^{i\alpha\Theta(x)}\Psi(x)$}) of any particle wave function. This requirement means that EM Lagrangian obeys a U(1) local gauge symmetry. To make the Lagrangian invariant under this rotation, a new gauge field is added to the EM Lagrangian. This new field is interpreted as the photon field and mediates interactions between particles with electromagnetic charge with strength $\alpha$. The weak interaction arises in a similar fashion except that the arbitrary phase, $\Theta(x)$, is replace with a vector, $\vec{\sigma}(x)$. The requirement that the weak Lagrangian is invariant means that it obeys SU(2) local gauge symmetry. Similarly to the U(1) case, the weak Lagrangian is modified by the addition of the new gauge bosons, $\vec{W}$, to preserve the SU(2) symmetry. The weak interactions are special in that they have been observed to maximally violate parity and thus are constructed in the Standard Model to only interact with left handed particles and right handed anti-particles.

The electromagnetic and weak interactions can be unified into a \mbox{SU(2)$_{L}$ $\otimes$ U(1)$_{Y}$} gauge group, where the subscript, L, refers to the left handed nature of the weak interactions and the subscript, Y, is called the weak hypercharge and is related to the electric charge. This unification produces the correct interaction structure of the electromagnetic and weak forces, however it fails to give masses to the gauge bosons of the weak interactions, the W and Z bosons, as well as the quarks and leptons. Therefore, the \mbox{SU(2)$_{L}$ $\otimes$ U(1)$_{Y}$} gauge group is said to be spontaneously broken. One possible solution to break electroweak symmetry is the Higgs mechanism. This mechanism generates masses for all quarks and leptons as well as the W and Z bosons by requiring a new scalar field, the Higgs field, in the Standard Model Lagrangian. To date, the Higgs particle has not been observed in any experiment designed for it's detection.

The strength of the particles interaction with the Higgs field determ

Finally, the strong force arises from the requirement that strongly interacting particles, such as quarks, be invariant under a rotation by a unitary matrix (\mbox{$\vec{q_{f}}(x) \rightarrow e^{i\lambda_{\alpha}\Theta^{\alpha}(x)}\vec{q_{f}}(x)$}), where $\lambda_{\alpha}$ is one of the Gellman matrices. This requirement means that the strong interaction obeys SU(3) local gauge symmetry.

\subsection{Higgs Mechanism and Particle Masses}
The Standard Model is a gauge theory based on the symmetry group \mbox{SU$(3)_{c}$ $\otimes$ SU$(2)_{L}$ $\otimes$ U$(1)_{Y}$}. This group structure is broken by the vacuum, which triggers the spontaneous breaking of the SU$(2)_{L}$ $\otimes$ U$(1)_{Y}$ group. It is believed that the Higgs mechanism is responsible for the spontaneous symmetry breaking. This mechanism generates masses for the weak gauge bosons (W and Z) as well as generating mass for all fermions. To achieve the symmetry breaking a neutral scalar boson must be introduced into the theory. This particle is called the Higgs boson and to date has not yet been observed.

In the Standard Model all particle interactions are mediated by spin=1 guage bosons. There are three types of particle interactions described in this model that are mediated by four gauge bosons: the photon, the gluon, and the W and Z particles. The photon is the carrier of the electromagnetic force which couples to particles with electromagnetic charge, such as the electron or the up quark. The gluon is the carrier of the strong force which couples particles with color charge which includes all the quarks as well as the gluon itself. The W and Z bosons are the carriers of the weak force which couples particles with weak charge, which includes all quarks and leptons. A summary of the gauge bosons can be found in Table ~\ref{bosons}

\begin{table}[!h!tbp]
\begin{center}
\begin{tabular}{c|c|c|c}
\multicolumn{4}{c}
{\underline{Summary of Fermion Gauge Interactions}} \\
$1^{\rm{st}}$ Generation		&	$2^{\rm{nd}}$ Generation		&	$3^{\rm{rd}}$ Generation		&	Gauge Interactions	\\
\hline
Up (u)					&	Charm (c)					&	Top (t)					&	Strong, Weak, Electromagnetic	\\
Down (d)					&	Strange (s)				&	Bottom (b)					&	Strong, Weak, Electromagnetic	\\
Electron ($e$)				&	Muon ($\mu$)				&	Tau ($\tau$)				&	Weak, Electromagnetic	\\
Electron neutrino ($\nu_{e}$)	&	Muon neutrino ($\nu_{\mu}$)	&	Tau neutrino ($\nu_{\tau}$)	&	Weak	\\
\end{tabular}
\vspace{-0.1 in}
\caption[interactions]{Summary of Fermion Gauge Interactions}
\label{interactions}
\end{center}
\end{table}

One interesting feature of the Standard Model Lagrangian is that the mass matrix and the weak matrix are can not be simultaneously diagnolized for weakly interacting particles. This mean that the weakly interacting fermions described in the Table.~\ref{fermions} are not the same as the fermions that interact with the W boson. The relationship between the weak and mass eigenstates of the Standard Model Lagrangian is summarized by the Cabbibo-Kobayahski-Maskawa (CKM) unitary quark mixing matrix. The parameters in the CKM matrix can not calculated from first principles and must be determined from experiment.

The mass or strong eigenstates can be rotated into the weak eigenstates by the unitary CKM mixing matrix as shown in Eq.~\ref{ckm}.


\subsubsection{\stid{3.13} CLOVER Sub-project Ginkgo} \label{subsubsect:peeks}
\paragraph{Overview}
Ginkgo~\footnote{\url{https://github.com/ginkgo-project/ginkgo}} is a modern
linear algebra library engineered towards performance portability, and
productivity. To achieve these goals, the library design is guided by combining
ecosystem extensibility with heavy, architecture-specific kernel optimization
using the platform-native languages CUDA (NVIDIA GPUs), HIP (AMD GPUs), DPC++
(Intel GPUs) and OpenMP (Intel/AMD/ARM multicore). Ginkgo is part of the
extreme-scale Software development Kit (xSDK), part of the Extreme-Scale
Scientific Software Stack (E4S), and has already been integrated as a backend
into simulation libraries like deal.II, MFEM, and HyTeG.
% SUNDIALS, and XGC.

\paragraph{Key Challenges}
% There is a list of challenges to meet with the development of sparse linear
% algebra functionality for the US flagship supercomputers deployed in ECP:
\begin{enumerate}
  \item The extreme levels of hardware concurrency available in the
		GPU-accelerated nodes need to be reflected in fine-grain parallelism in
		the numerical building blocks.
  \item An increasing variety of hardware designs and hardware-native
		programming languages requires a library design that enables platform
		portability without sacrificing performance.
  \item The arithmetic performance of processors growing much faster than the
		memory bandwidth and interconnect speed requires exploring innovative
		strategies for reducing the pressure on all cache/memory levels.
  \item Applications that build upon the fast solution of many independent
		moderate-sized sparse linear systems require batched sparse linear
		algebra functionality.
  \item Applications building upon matrix-free methods requires the flexibility
		to compose linear solvers out of library-native and customized external
		functionality.
\end{enumerate}

\begin{figure}[!h]
\centering
\includegraphics[width=.8\columnwidth]{projects/2.3.3-MathLibs/2.3.3.13-CLOVER/ginkgo_portability_crop}
\caption{\label{fig:ginkgoportability}The portability design of the Ginkgo math
  library enables high performance kernel implementations in the vendor-supported
  programming language.}
\end{figure}

\paragraph{Solution Strategy}

The Ginkgo team is addressing these challenges by striving for platform
portability, modularity, extensibility, and hardware-aware algorithm design.

\begin{enumerate}
  \item \textbf{Architecture-portable software design:}
		Ginkgo~\cite{anzt2020ginkgo} employs a design that decouples the
		algorithm implementations from the hardware-specific kernel
		implementations, thereby acknowledging the importance of platform
		portability and allowing for architecture-specific kernel optimization
		in the vendor language, see Figure~\ref{fig:ginkgoportability}.
  \item \textbf{Modularity, flexibility, and extensibility:} Ginkgo employs a
		``linear operator'' abstraction for all functionality, which allows for
		flexibility in combining functionality and interfacing external
		operators.
  \item \textbf{Sustainability efforts:} Ginkgo adheres the Better Scientific
		Software (BSSw) design principles~\cite{betterscientificsoftware} that
		ensure production-quality code by featuring unit testing, automated
		configuration and installation, Doxygen code documentation, as well as a
		continuous integration and continuous benchmarking
		framework~\cite{pasc_anzt}. Ginkgo is an open source effort licensed
		under the BSD 3-clause and included in the xSDK and E4S software
		packages.
  \item \textbf{Fine-grain parallelism:} Ginkgo features linear algebra
		building blocks and advanced algorithms for preconditioning and solving
		linear systems that can efficiently leverage the concurrency of modern
		GPUs, including (incomplete) parallel factorizations, parallel sparse
		triangular solves, parallel matrix operations, and parallel iterative
		methods.
  \item \textbf{Mixed precision methods:} Ginkgo features a memory accessor
		that encapsulates on-the-fly compression for decoupling the memory
		precision from the arithmetic precision. This allows accelerating
		memory-bound algorithms that can compensate or tolerate some information
		loss in the memory operations. The memory accessor can also be used to
		increase the result accuracy of memory-bound kernels that benefit from
		using a more complex precision format in the arithmetic operations
		without performance loss.
  \item \textbf{Batched preconditioned iterative solvers:} Ginkgo contains high
		performance batched iterative solvers that handle the concurrent
		solution of a set of independent sparse linear systems of moderate size.
		The batched iterative solvers allow for some flexibility in terms of the
		preconditioner and monitor the system-individual convergence without
		performance degradation.
\end{enumerate}

\paragraph{Recent Progress}
\begin{enumerate}
  \item The Ginkgo library realized native support for Intel GPUs (via
		DPC++)~\cite{tsai2021porting}.
  \item MFEM treating Ginkgo as numerical backend allows accelerating MFEM
		simulations with AMD GPUs, Intel GPUs, and NVIDIA GPUs.
  \item The Ginkgo library has been expanded with new advanced preconditioners
		such as ISAI and Multigrid, also supporting mixed-precision capabilities~\cite{10.1007/978-3-030-85665-6_34}.
  \item Based on the memory accessor, the Ginkgo team deployed a Compressed
		Basis GMRES (CB-GMRES) solver that outperforms the standard GMRES solver
		by storing the Krylov basis vectors in lower precision, therewith
		accelerating the memory access~\cite{DBLP:journals/corr/abs-2009-12101}.
  \item The Ginkgo team successfully employed the batched iterative solvers for
		the hydrodynamic problems arising in the PeleLM
		simulations and the gyrokinetic problems arising in the
		XGC simulations.
\end{enumerate}

\paragraph{Next Steps}
Our next efforts are:
\begin{enumerate}
  \item \textbf{Deployment of multi-node functionality:} Ginkgo already has
		experimental support for multi-node execution via an executor-agnostic
		MPI layer. We will extend the support and make it production-ready.
  \item \textbf{Deployment of GPU-resident spare direct solvers:} In response to
		an urgent need of national power grid simulations, we will develop
		GPU-resident sparse direct solvers.
  \item \textbf{Block-versions of the parallel Incomplete factorization
		preconditioner:} To better reflect the properties of the ECP application
		projects, we will deploy blocked versions of the ParILU and ParILUT
		parallel ILU and parallel threshold ILU preconditioners in the Ginkgo
		software library.
  \item \textbf{Problem-specific preconditioners for MFEM:} In collaboration
		with the ECP CEED cluster, we will design problem-specific mixed
		precision preconditioners for matrix-free finite element simulations.
\end{enumerate}


\section{Shock wave simulation}
We studied the evolution of moderately relativistic shocks and spectrum of accelerated particles. We chose relativistic shocks with a low Lorentz factor because the maximum energy of the produced cosmic rays increases with the shock wave Lorentz factor, while the efficiency of acceleration decreases,
because it is more difficult for particle to cross fast moving front many times
%
\cite{Ellison2013}. So we assume that the intermediate case of moderately relativistic shocks provides the most efficient acceleration.

We developed the implicit particle-in-cell (PIC) code, presented in our previous paper \cite{Romansky2016}, based on the scheme suggested by Lapenta et al.~\cite{Lapenta2006} and improved for the relativistic case by Noguchi et al.\cite{Noguchi2007}.
Our code is fully three-dimensional and parallelized with MPI technology, which is adapted for distributed computing and can be executed on a wide class of computers. We use
%cleaning divergence of electric field
the electric field divergence correction
after every several time steps and
%Fourier filtering of shortwave harmonics
the shortwave harmonics Fourier filtering
to suppress the numerical Cherenkov instability and improve the energy conservation.

In the modeling setup the homogeneous plasma flows in the simulation box through the right boundary
and collides with the reflecting superconducting wall on the left boundary, launching the shock wave. It is a common way to initialize a shock wave, because the initialization using the Rankine–Hugoniot conditions does not take into account the microscopic distribution, and the shock wave, created in such way, will probably fall apart into several discontinuities.

\begin{figure}[h!]
	\centering
	\includegraphics[width=1.0\textwidth]{fig/protons.eps}
	\caption{Distribution of protons in the relativistic shock wave with Lorentz factor 1.5 with different inclination angle.}
	\label{protons}
\end{figure}

The simulations are one-dimensional and have the following parameters: the initial flow Lorentz factor $\gamma = 1.5$, the number densities $n_e = 10^{-4} \rm{cm}^{-3}$, $n_p = 10^{-4} \rm{cm}^{-3}$ , the temperature $5\cdot10^8 \rm{K}$, the magnetic field $B = 10^{-4} \rm{G}$, the full size of the box $L = 2\cdot10^{12} \rm{cm}$, the number of cells $N=2\cdot10^4$. The electron mass is reduced to $m_e = \frac{m_p}{20}$. The full time of simulation is $T = 5000 {\omega_p}^{-1}$.This values gives the dimensionless parameter magnetization $\sigma = \frac{B^2}{4\pi\gamma (n_p m_p + n_e m_e) c^2} = 0.003$. Inclination angle $\theta$ is the angle between the flow velocity and the magnetic field. We present the results for the particle spectrum in several simulations with different $\theta$. The stable shock waves formed in all simulations and the total energy deviation is less than $3\%$, and it proves that our code provides correct model of the shock waves.

\begin{figure}[h!]
	\centering
	\includegraphics[width=1.0\textwidth]{fig/electrons.eps}
	\caption{Distribution of electrons in the relativistic shock wave with Lorentz factor 1.5 with different inclination angle.}
	\label{electrons}
\end{figure}

One can see in Figures \ref{protons} and \ref{electrons} the particle spectrum for different angles $\theta$. The spectra consist of three parts - the narrow peak of cold but fast moving initial flow, the wide peak of hot downstream and the non-thermal accelerated component. Figures show that the spectrum of accelerated particles strongly depends on angle $\theta$. If $\theta$ is less than critical value, defined by the equation $c\cdot \cos(\theta_{crit})=v_{shock}$, where all values are measured in the upstream rest frame, particles can escape from the front and cross it several times to gain more energy (see, e.g., \cite{Pelletier2017}). It is difficult to evaluate the critical angle a priori, because the compression relation of the shock wave which will be created in the simulation is unknown. However the estimation for case of a strong wave (the compression relation equals $4$) provides $\theta_{crit}=45^{\circ}$ in the downstream frame, which is consistent with the results of our simulations.

Also, one can see that for the angles less then the critical one, the particle spectra are higher and longer for larger $\theta$. The spectrum of non-thermal component is about 10 times higher for protons than for electrons at the same energy. It is consistent with other Particle-in-cell simulations of the shock waves {\cite{Sironi2011}}.

The results show some interesting effects for angles close to the critical value (black and yellow lines)- electrons are still accelerating while protons are not. It can be explained by electrons acceleration in the short-wavelength turbulence of the shock wave precursor. Due to the small gyroradius of electrons in initial flow, short-wavelength turbulence scatter them more efficiently than protons. However, further research is necessary in order to study this phenomena in detail.


\documentclass[a4paper]{article}

\usepackage{amsmath, amssymb}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{dcolumn}
\usepackage{graphicx}
\usepackage{siunitx}
\usepackage{pgfplots}
\usepackage{pgfplotstable}

\def\mean#1{\left< #1 \right>}

\title{Investigating the Fracturing of Raw Spaghetti}
\date{1 September 2015}
\author{Tarik Onalan}

\begin{document}
    \maketitle
    \section{Introduction}
        \subsection{Purpose}
            To understand how the separation of the applied forces on the spaghetti affect
            the length of the secondary fracture.
        \subsection{Hypothesis/Prediction}
            I predict that as the distance between the two forces decreases, the length of
            the broken spaghetti pieces will decrease, as there will be less space for a
            cascading fracture to take place.
        \subsection{Variables}
            \textbf{Independent Variable}
            \begin{itemize}
                \item Width between forces [\si\cm]
            \end{itemize}
            \textbf{Dependent Variables}
            \begin{itemize}
                \item Length of broken spaghetti pieces [\si\cm]
            \end{itemize}
            \textbf{Controlled Variables}
            \begin{itemize}
                \item Length of starting spaghetti [\SI{25.0}{\cm}]
                \item Width of starting spaghetti [\SI{0.2}{\cm}]
                \item Mass of starting spaghetti [\SI{5.4}{\g}]
            \end{itemize}
    \section{Materials}
        \begin{itemize}
            \item Spaghetti $\cdot 20$
            \item Rotatable clamps $\cdot 2$
            \item Ruler $\cdot 1$
            \item Scale $\cdot 1$
        \end{itemize}
    \section{Procedure}
        \begin{enumerate}
            \item (CONTROL) Measure length of spaghetti
            \item (CONTROL) Measure width of spaghetti
            \item (CONTROL) Measure mass of spaghetti
            \item Pick a spaghetti, check it is within margin of error (\SI{0.05}{\cm})
            \item Measure distance between clamps (25, 20, 15, and \SI{10}{\cm})
            \item Clamp spaghetti
            \item Turn clamps at the same speed until spaghetti breaks
            \item Measure length of broken spaghetti pieces, if any (else record \SI{0.0}{\cm})
            \item Repeat steps 4-8 as necessary for data collection
            \item Repeat step 9 with remaining distances
        \end{enumerate}
        \resizebox{\linewidth}{!}{
            \includegraphics{./figure.png}
        }
    \section{Data}
        \resizebox{\linewidth}{!}{
            \pgfplotstabletypeset[
                multicolumn names,
                display columns/0/.style={
                    column name=Separation,
                    column type={S},string type},
                display columns/1/.style={
                    column name=Trial 1,
                    column type={S},string type},
                display columns/2/.style={
                    column name=Trial 2,
                    column type={S},string type},
                display columns/3/.style={
                    column name=Trial 3,
                    column type={S}, string type},
                display columns/4/.style={
                    column name=Trial 4,
                    column type={S}, string type},
                display columns/5/.style={
                    column name=Trial 5,
                    column type={S}, string type},
                display columns/6/.style={
                    column name=Average,
                    column type={S}, string type},
                columns/t1/.append style={
                    postproc cell content/.append style={
                        /pgfplots/table/@cell content/.add={}{$\pm0.05$}
                    }
                },
                columns/t2/.append style={
                    postproc cell content/.append style={
                        /pgfplots/table/@cell content/.add={}{$\pm0.05$}
                    }
                },
                columns/t3/.append style={
                    postproc cell content/.append style={
                        /pgfplots/table/@cell content/.add={}{$\pm0.05$}
                    }
                },
                columns/t4/.append style={
                    postproc cell content/.append style={
                        /pgfplots/table/@cell content/.add={}{$\pm0.05$}
                    }
                },
                columns/t5/.append style={
                    postproc cell content/.append style={
                        /pgfplots/table/@cell content/.add={}{$\pm0.05$}
                    }
                },
                columns/avg/.append style={
                    postproc cell content/.append style={
                        /pgfplots/table/@cell content/.add={}{$\pm0.05$}
                    }
                },
                every head row/.style={
                    before row={\toprule},
                    after row={
                        \si\cm & \si\cm & \si\cm & \si\cm & \si\cm & \si\cm & \si\cm\\
                        \midrule}
                },
                every last row/.style={after row=\bottomrule}
            ]{data.dat}
        }

        \begin{tikzpicture}
            \begin{axis}[
                title={Length of Spaghetti Piece Relative to Breaking Force Separation},
                scale=1.75,
                xlabel={Separation [\si\cm]},
                ylabel={Length [\si\cm]},
                xmin=9.0, xmax=26.0,
                ymin=0.0, ymax=3.0,
                x dir=reverse,
                legend pos=north east,
                ymajorgrids=true,
                grid style=dashed
            ]
                \addplot [
                    color=blue,
                    only marks
                ] plot [
                    error bars/.cd,
                        x dir=both,
                        y dir=both,
                        x explicit,
                        y explicit,
                        x fixed=0.05,
                        y fixed=0.05,
                ] table [
                    x=sep,
                    y=avg,
                ]{data.dat};

                \addplot [thick, red] table [y={create col/linear regression={y=avg}}]{data.dat};

                \draw (axis cs:24.95,2.45) -- (axis cs:10.05,-0.05);
                \draw (axis cs:25.05,2.35) -- (axis cs:9.95,0.05);

                \addlegendentry{Average}
                \addlegendentry{$\pgfmathprintnumber{\pgfplotstableregressiona} \cdot x \pgfmathprintnumber[print sign]{\pgfplotstableregressionb}$}
            \end{axis}
        \end{tikzpicture}
    \section{Explanations}
        \subsection{Uncertainty}
            There are uncertainty bars for both $x$ and $y$ axes, though they are difficult
            to see on the $x$ axis due to scaling issues. Uncertainty was assumed to be
            \SI{0.05}{\cm}, as the ruler used could only measure within the nearest
            \SI{0.1}{\cm}, meaning that the \SI{0.1}{\cm} region that was $50\%$ offset
            from the ruler would be least certain.
        \subsection{Intercepts}
            There is only one intercept on the graph, and that is when, at a separation of
            \SI{10.0}{\cm}, the spaghetti does not fracture into any extra pieces during any
            of the five trials.
        \subsection{Slope}
            The slope is positive ($0.15$), meaning that as the width between the two clamps
            increases, the length of the secondary broken spaghetti piece will also increase.
    \section{Calculations}
        \subsection{Average}
            \begin{equation}
                \mean{x_i^*}
            \end{equation}
            \begin{equation}
                \frac{\displaystyle\sum_i{x_i}}{i}
            \end{equation}
            \begin{equation}
                \frac{x_1+x_2+...+x_{i-1}+x_i}{i}
            \end{equation}
        \subsection{Error and Minimization for Line of Best Fit}
            \centerline{Error was calculated using sum squared error, which is defined as follows:}
            \begin{equation}
                E=\displaystyle\sum_{i=1}^n{(y_i-f(x_i))^2}
            \end{equation}
            \begin{center}
                While a program carried out the minimization of the function, the basic
                premise of minimization is to ``follow the gradient,'' so to speak. The
                program follows the gradient
            \end{center}
            \begin{equation}
                E'=\frac{\partial}{\partial x}(\displaystyle\sum_{i=1}^n{(y_i-f(x_i))^2})
            \end{equation}
            \begin{center}
                similar to Euler's method for solving differential equations. Minimizing
                the function is simply following the ``negative'' slope to the local minima
                of the function.
            \end{center}
    \section{Conclusion}
        My hypothesis, that the length of the secondary break will shorten as the separation of
        the applied forces on the spaghetti was reduced, was supported by the data. When the separation
        was \SI{25.0}{\cm}, the secondary break averaged a length of \SI{2.4}{\cm}. At \SI{20.0}{\cm},
        the average dropped to \SI{0.4}{\cm}. \SI{15.0}{\cm} had an average of \SI{0.2}{\cm}, and,
        the smallest separation, \SI{10.0}{\cm}, produced an average of \SI{0.0}{\cm}, meaning that
        no secondary pieces were produced from the breaking of the spaghetti through the five trials.
        This makes sense, as when the distance between the two clamps was decreased, there was less
        ``spaghetti'' available for a cascading fracture to take place. A cascading fracture, in this
        case, is the secondary fracturing of the spaghetti due to regions (namely the centre region)
        of the spaghetti straightening before other regions (like the bases). In regards to the data,
        however, I believe there is too much random error at play to make an outright statement of the
        validity of my hypothesis. Spaghetti has too much inherent randomness to make it a reliable
        object of measurement. A spaghetti could have microscopic weaknesses that predispose it to
        breaking from certain locations: perhaps another spaghetti was slightly more dense; it would
        have been impossible to tell with my measuring devices. Additionally, as I was the one turning
        the clamps, I was introducing error into the measurements; humans are not precise. However,
        because the data shows such an overwhelming trend in support of my hypothesis, I believe I can
        claim that my hypothesis is valid.

        The design of the investigation was not incredible by any stretch of the mind, but given that
        it was quite simple, the implementation, I believe, was up-to-par with the standards I had in
        mind. That said, I was not impressed by the error accrued throughout the investigation. As I
        said before, the spaghetti was a central source of randomness throughout the investigation.
        A particular with my investigation, the clamps, also introduced randomness, but this was the
        product of a compromise instead of ignorance. As I was investigating the secondary breakage
        of spaghetti (around the centre), I wanted to make sure that I was avoiding contact with the
        centre region of the spaghetti at the time of breakage. As a result, I had to resort to rotating
        clamps as a compromise, as even though I still control their movement, I felt that they would
        provide a more consistent torque than my hands would. The error introduced by both sources, in
        the end, were mostly random; the results could essentially have gone either way.

        One improvement that comes to mind is replacing the spaghetti with thin plastic sticks; the
        material would be more uniform (mass, dimensions, elasticity), and would thus introduce less
        random error into test results. However, this would undoubtedly be more expensive, so whether
        or not it would be feasible is unknown.
\end{document}


\notocchapter{Additional Plots}
\section{Viscosities of all CESM Experiments}
\label{sec:viscosity-all}
\vfill
\begin{whole}
	\centering\importpgf{figures/appendix/visc-all-x3/}{visc-all-x3.pgf}
\end{whole}
\figcaption{Perpendicular viscosity parameter $B$ for all \grid{x3} runs.\label{fig:viscosity-all-x3}}
\vfill
\clearpage
\null
\vfill
{
	\centering\importpgf{figures/appendix/visc-all-x1/}{visc-all-x1.pgf}\par
}
\figcaption[Perpendicular viscosity parameter \(B\) for all \grid{x1} runs.]{Perpendicular viscosity parameter \(B\) for all \grid{x1} runs. Note the changed scale from \figref{fig:viscosity-all-x3}.\label{fig:viscosity-all-x1}}
\vfill

\notocchapter{An Equatorial Shallow-Water Model (cont.)}
\label{appendix:shallow-water}
The following sections describe some technical aspects of the shallow water model used in \secref{sec:equatorial-shallow-water}. \secref{sec:appendix-sw-implementation} gives a summary of the numerical implementation of the model, while \secref{sec:appendix-sw-verification} focuses on the reproduction of some results found in literature (\cite{killworth} \cite{greatbatch}), in order to verify the consistency of the model, and to allow for the detection of obvious errors in the implementation. Although no quantitative analysis is made, my shallow water model succeeds in reproducing the structure of each solution.

\section{Numerical Implementation}
\label{sec:appendix-sw-implementation}
When implementing numerical models, oceanographers often apply a low-level approach, by explicitly discretizing the model equations using finite differences (see \eg \cite{kaempf}). These implementations are usually very efficient, but on the flip side quite static --- adding additional terms is cumbersome, since the numerical properties of the chosen scheme have to be preserved, and many methods work on regular meshes only.

Because it was important to me that my model supported an \enquote{agile} development style allowing for quick prototyping, I have decided not to implement it from scratch using finite differences, but rather make use of the FiPy software package \citep{fipy}, a finite volume solver framework that is accessed via the Python programming language. FiPy pre-defines finite-volume implementations for the most common terms that appear in \acp{PDE}. On their homepage\sidenote{\url{http://www.ctcms.nist.gov/fipy/}}, the FiPy developers summarize the capabilities of FiPy:

\q{\slshape The solution of coupled sets of PDEs is ubiquitous to the numerical simulation of science problems. Numerous PDE solvers exist, using a variety of languages and numerical approaches. Many are proprietary, expensive and difficult to customize. As a result, scientists spend considerable resources repeatedly developing limited tools for specific problems. Our approach, combining the FV method and Python, provides a tool that is extensible, powerful and freely available. A significant advantage to Python is the existing suite of tools for array calculations, sparse matrices and data rendering.

The FiPy framework includes terms for transient diffusion, convection and standard sources, enabling the solution of arbitrary combinations of coupled elliptic, hyperbolic and parabolic PDEs.}

Using FiPy, the actual formulation of the model equations becomes much easier (\listingref{lst:fipy-equations}) and, for the most part, does not depend on the actual numerical implementation of the various terms. This way, I could explore a wide range of problems with different formulations of the model equations and model grids. The FiPy solutions also tended to be quite stable, since most of the terms are solved implicitly\sidenote[-1]{Unfortunately, FiPy does not allow to formulate the shallow-water equations in a fully implicit manner (since the face velocities need to appear as explicit sources).}. However, this comes of course at a computational cost --- by choosing FiPy, I accepted higher run times in exchange for a lower implementation time, which seemed adequate for a project that is as time constrained as a Master's thesis.

\begin{listing}[p]
	\caption[Equation setup for the shallow-water model in FiPy.]{Equation setup for the shallow-water model in FiPy. The cell-centered variables of the model are called \texttt{height}, \texttt{xVelocity}, and \texttt{yVelocity}. Some terms use the rank 1 \texttt{FaceVariable} \texttt{fVelocity}, which is the linearly interpolated velocity at cell faces. \texttt{A} and \texttt{B} are \texttt{CellVariable}s holding the parallel and perpendicular viscosities, respectively. \texttt{WaterSourceBoundary} represents the forcing of the model (Gaussian in the north-western corner of the domain).}
	\label{lst:fipy-equations}
		\begin{listingsbox}{pythoncode}
			diffCoeffX = FaceVariable(mesh=mesh, rank=1)
			diffCoeffX[0] = A.faceValue
			diffCoeffX[1] = B.faceValue
			diffCoeffY = FaceVariable(mesh=mesh, rank=1)
			diffCoeffY[0] = B.faceValue
			diffCoeffY[1] = A.faceValue

			fDiv = faceVelocity.divergence
			waterSourceInterior = \
			  (ImplicitSourceTerm(coeff=1.,var=height)-1) / \
			  dampening_scale

			xVelocityEq = TransientTerm(var=xVelocity) \
			+ ConvectionTerm(coeff=fVelocity,var=xVelocity) \
			- ImplicitSourceTerm(coeff=fDiv, var=xVelocity) \
			- ImplicitSourceTerm(var=yVelocity,coeff=.5*mesh.y) \
			== \
			- height.grad.dot((1.,0.)) \
			+ DiffusionTerm(diffCoeffX,var=xVelocity)

			yVelocityEq = TransientTerm(var=yVelocity) \
			+ ConvectionTerm(coeff=fVelocity,var=yVelocity) \
			- ImplicitSourceTerm(coeff=fDiv, var=yVelocity) \
			+ ImplicitSourceTerm(var=xVelocity,coeff=.5*mesh.y) \
			== \
			- height.grad.dot((0.,1.)) \
			+ DiffusionTerm(diffCoeffY,var=yVelocity)

			heightEq = TransientTerm(var=height) \
			+ ConvectionTerm(coeff=fVelocity, var=height) \
			== \
			waterSourceBoundary - waterSourceInterior

			# couple equations
			swEquations = xVelocityEq & yVelocityEq & heightEq
		\end{listingsbox}
\end{listing}

\section{Verification}
\label{sec:appendix-sw-verification}

\subsection{\cite{killworth}}

As%
\sidetable[Parameters used in the first verification run.]{Parameters used in the first verification run. Definitions as in \cite{killworth}.}[tab:killworth-parameters]{%
	\footnotesize%
\begin{align}
	L_x &= \SI{4000}{\kilo\metre}& \\
	L_y &= \SI{2000}{\kilo\metre}& \\
	g &= \SI{0.01}{\metre\per\second\squared}& \\
	\beta &= \SI{2e-11}{\per\second\per\metre}& \\
	H &= \SI{400}{\metre}& \\
	A_h &= \SI{e4}{\metre\squared\per\second}& \\
	Y &= \SI{-75}{\kilo\metre}&
\end{align}
\vspace*{-2\baselineskip}
}[2]%
%
a first step, I have used my shallow-water model to qualitatively reproduce the figures shown in the second part of \cite{killworth}. For this purpose, I have deactivated all forcing (\(\lambda = Q = 0\)), and integrated the model forward for \SI{100}{\day} starting with a dam-break scenario, using parameters as in \tabref{tab:killworth-parameters}\sidenote[-4]{An animation of the adjustment process may be found at \url{https://vimeo.com/145881146}.}, which are the same as used by \citeauthor{killworth}. During the integration, the expected features such as Kelvin waves traveling along the boundaries of the domain are visible.

The final state after \SI{100}{\day} bears a striking resemblance with the corresponding figure from \cite{killworth} (\figref{fig:killworth-comp}). The height field, which coincides with stream lines in high latitudes, shows the same two large circulation cells in the western half of the basin with a comparable magnitude. The velocity field reveals that water predominantly crosses the equator in a western boundary current, from where it either enters the circulation far north, or re-circulates into the southern hemisphere in the interior.

Considering how similar the resulting figures look, given that the two models are implemented using entirely different numerical schemes (finite volume method vs.\ finite differences on a Arakawa C-grid\sidenote[-2]{The Arakawa grids were first introduced by \citet{arakawa}, and are still widely used in geophysical fluid dynamics due to their computational efficiency and conservation properties.}), and presumably use different resolutions (used resolution not reported in \cite{killworth}), I assume my shallow water model to be working correctly for this application.

\begin{figure}
		\subbottom[My model]{%
			\raisebox{.15\totalheight}{\importpgf{figures/appendix/killworth-comp}{killworth-comp.pgf}}%
		}%
		\hfill%
		\subbottom[From \cite{killworth}]{%
			\includegraphics[width=.45\textwidth]{appendix/killworth-sol}%
		}
		\caption[Comparison between a geostrophic adjustment solution from \cite{killworth}, and one created with my own shallow-water model.]{Comparison between a geostrophic adjustment solution from \cite{killworth}, and one created with my own shallow-water model (identical parameters, as in \tabref{tab:killworth-parameters}).}
		\label{fig:killworth-comp}
\end{figure}

\subsection{\cite{greatbatch}}
\cite{greatbatch} contains an interesting study of the \cite{kawase} model, giving a range of numerical solutions for different damping timescales. Since the implementation and used parameters are well described, this publication is a valuable resource to verify my model with a forced reference. However, since the Kawase model equations differ slightly from the ones I have used in my model\sidenote[-3]{\citeauthor{kawase} (and thus \citeauthor{greatbatch}) uses full spherical coordinates, and the \(h\)-equation has been linearized. See also \secref{sec:sw-equations}.}, a comparison has to remain qualitative.

Since we are only interested in the low damping regime\sidenote{Otherwise, deeply penetrating cross-equatorial flow becomes impossible.}, I have used a damping time scale of \SI{1}{\year} for my experiments. Comparing the steady state solution of a high viscosity run with the corresponding figure given in \cite{greatbatch} (\figref{fig:greatbatch-comp}) reveals another striking similarity. In the steady state, the interior height field is symmetric around the equator, with a narrow western boundary current and a wide interior circulation. During spin-up, the same features as described by \citeauthor{greatbatch} can be observed, such as the formation of a swift eastward jet along the equator, that splits up into two branches as a Kelvin wave is emitted by the eastern boundary that arrests the flow at the equator (not shown).

\begin{figure}
		\subbottom[My model]{%
			\raisebox{1.5ex}{\importpgf{figures/appendix/greatbatch-comp}{greatbatch-comp.pgf}}%
		}
		\subbottom[From \cite{greatbatch}]{%
			\includegraphics[width=.75\textwidth]{appendix/greatbatch-sol}%
		}
	\caption{Comparison between a steady-state solution from \cite{greatbatch}, and one created with my own shallow-water model.}
	\label{fig:greatbatch-comp}
\end{figure}


\section{Vaccination history stratification}
% Referring to the immunity stratification as the vaccination stratification here, for the Bhutan application
History of vaccination is captured by stratifying all model compartments by vaccination status.
Two vaccination strata are included to represent those who have received at least two doses of a COVID-19 vaccine,
and those who have not.
The following are not considered in this approach to simulating vaccination:
\begin{itemize}
    \item Any effect of receiving a single dose of vaccine
    \item Waning of vaccine-induced immunity
    \item Any additional effect from receiving additional vaccine doses following the second dose
\end{itemize}
The effect of vaccination on transmission is to partially reduce the rate of infection for all persons at-risk of infection in the vaccinated stratum.
This includes both fully susceptible (never previously infected) persons,
as well as recovered persons who are at risk of reinfection.
Emerging variants of concern (VoCs) may escape this immunity, as described further below.
% To illustrate this further, the next steps would be to display the population distribution by stratum,
% and/or to explain the implementation of the dynamic proportions code

\section{Immunity-strain interaction}
The strains/VoCs implemented in the model may escape both vaccine-induced and natural immunity, as follows.

\subsection{Application to first infection}
The first infection episode with SARS-CoV-2 is represented through the transition from the susceptible
to the first latent compartment.
The susceptible compartment is not stratified by strain,
because these persons have no infection history.
Therefore, for infection of persons never previously infected,
only the vaccination-induced immunity status is relevant.
The rate of infection for a particular vaccination status and infecting strain is adjusted by the factor:
\[1 - p_{i} \times s_{j}\]
Where \(p_{i}\) represents the protection afforded by vaccination stratum \(_{i}\),
and \(s_{j}\) represents the degree of immune escape against vaccine-induced immunity for strain \(_{j}\).
Note that this assumes that the extent of immune escape for a given strain is the same
for all vaccination strata.

\subsection{Application to re-infection}
Persons who have recovered from previous infection episodes remain in a compartment that is stratified
according to the last infecting strain.
The recovered compartment is replicated into early and late stages,
which can afford different levels of protection against re-infection.
The extent of protection must be explicitly specified for each strain-stage combination.
The rate of reinfection is adjusted by the factor:
\[(1 - p_{i} \times s_{j})\times (1 - n_{i,k,l})\]
Where the additional term \(n_{k,l,m}\) represents the cross protection
afforded by past infection with strain \(_{k}\)
against infecting strain \(_{l}\)
in vaccination stratum \(_{i}\).

\subsection{Adjusting age-specific severity parameters for immunity}
We use inputs for the age-specific case fatality rate and the age-specific hospitalisation rate from Nyberg et al.,
which provides estimates of these quantities in a population that already had substantial vaccine-induced immunity.
We therefore adjust these quantities for pre-existing immunity, to account for protection against death and hospitalisation.
We apply the following method to ensure that after adjusting the parameters for a specific age bracket for immunity,
the average parameter value would be equal to that reported by Nyberg et al. if weights were applied according to the
distribution of immunity in the population that was described in this study.
To do this, we estimate the proportion of the population in each of the three modelled immunity categories
in the United Kingdom around the mid-point of the study,
and the protection afforded by each of the immunity classes (see Table \ref{tab:immunity_weighting}).

\begin{table}
    \begin{threeparttable}
    \begin{tabularx}{\textwidth}{| X | X | X |}
        \hline
        \textbf{Immunity category} & \textbf{Proportion of population} \tnote{a} & \textbf{Estimated protection} \tnote{b} \\
        \hline
        No immunity, unvaccinated & 0.312 & 0 \\
        \hline
        Low immunity, vaccinated with two doses & 0.302 & 0.5 \\
        \hline
        High immunity, vaccinated with three doses & 0.386 & 0.85 \\
        \hline
	\end{tabularx}
	\caption{Values used to re-weight the severity estimates provided in Nyberg et al. to separate immunity classes.}
	\label{tab:immunity_weighting}
    \begin{tablenotes}
        \item[a] Estimated population distribution as at 16th December 2021 (study mid-point),
        taken from Our World In Data.
        \item[b] Estimated protection against hospitalisation or death following Omicron infection.
    \end{tablenotes}
    \end{threeparttable}
\end{table}


\chapter{Related Works}\label{ch2}
Previously there have been many researches conducted on knowledge graphs. They share some common as well
as different approaches.
Let us discuss them one by one.
 \section{Knowledge Graph Identification}
In the paper `Knowledge Graph Identification' ~\cite{ref0kgi}, the authors collected two different data sets.
In both of them, they extracted uncertain entities and their relations to create an `extraction graph'.
The resulting extraction graph was full of noise, missing information. So they removed noise,
added missing informations. After that, they needed to find candidate facts.
Reasoning jointly about candidate facts, extracting their confidence, identifying coreferences,
 imposing ontological constraints, removing duplicate entities, resolving ontological conflicts
 were some of the other tasks. Let us take an example.

 ``We can use \textbf{Binary Search Tree}, for fast lookup, addition and deletion of an item''.
Usually, the word \textbf{tree} means something related to plants. But in this case, \textbf{tree}
refers to a data structure because the words \textbf{binary}, \textbf{search} are imposing ontological
constraints. Therefore we can distinguish between the two meanings and disambiguate them. Next, they needed to
create edges between the nodes.
 To relate a concept with similar concept,
the researchers have used Probabilistic Soft Logic (PSL) ~\cite{ref0psl}  ontological constraints,
identify coreferences etc.
\subsection{Probabilistic Soft Logic(PSL)}
We know, that boolean variables have only two values: $True$ and $False$ or $1$ and $0$. So boolean
logics can tell only between 2 choices. In real world problems, this is not always usable.
This is where PSL comes innto play. PSL assigns a value in range $[0,1]$. For example, the word
 \textbf{tree} is not always related to plants. So, we cannot assign $0$ or $1$ to it.
  Instead, we can assign \textbf{tree} with a value, say $0.8$ with the meaning \textbf{plan}
  and $0.2$ with the meaning

PSL has some advantages. We can represent models using first order logic syntaxes.
We can have continuously valued random variables that is convenient with uncertainty or probability.
Using weights, we can control the importance of model rules.

\section{Link Detection}
One common problem in building a Knowledge Graph is to find appropriate links between various
concepts. Mihalcea annd Csomai et al ~\cite{ref3LinkWikipedia} have worked on link detection. They used
machine learning on a wikipedia dump to link a concept(article) with its corresponding mention.
There they have also calculated
link probability of various phrases or mentions. Define link probability of a phrase as the
number of wikipedia articles that use the phrase as anchor divided by  number of articles that mention the phrase at all.
% \begin{equation}
%   $$ link probability of a phrase = \frac{number of wikipedia articles that use the phrase as anchor}{ number of articles that mention the phrase at all } $$
% \end{equation}
% link probability of a phrase = \frac{number of wikipedia articles that use itthe phrases anchor}{ number of }
Next they disambiguated links by taking help of the surrounding words
( the words themselves and their parts of speech). Here a problem occurs on which meaning to select.
The best method is to take the most common meaning first. Then calculate the relatedness
with the context. Define $ relatedness(a,b) = \frac{log(max(|A|, |B|)) - log(|AB|)}{log|W|-log(min(|A|, |B|))} $,
where $a$,$b$ are the Article of interest, $A$ , $B$ are sets of all articles linking to $a$,$b$ respectively and $W$
is the set of all articles.

After that, by comparing
the  common meaning with the relatedness, the correct link was found.
For example, the word `tree' has a common meaning `plant' and so 97\% of the time, it will link to a page on plants.
But if we find `binary tree' in a document, the relatedness of `tree' to `binary' suggests that this
phrase is related to data structure. That is how almost everyone disambiguates links. Followed by this, they
did Topic indexing which aims to identify the most significant topics, summarize the document and organize it
into various categories, and to answer queries fast. In topic indexing, the key problem is to find the correct significant
terms and disambiguate them to appropriate topic.

%After that, in order to organize the documents, they have used topic indexing.
%In order to make link detection efficient, Mihalcea annd Csomai et al used
%(a) commonness (prior probability of each sense) and (b) how the sense relate with the nearby context.

The Next work deals with a semi-supervised graph regularization method on
twitter data wikification ~\cite{ref4tw-wiki}. There the authores described the problems as unlinkability
( absense of a valid concept from knowledge base), ambiguity and prominence. Some more major problem for working
with twitter data are informal writing style, shortness and noisiness. To deal with these problems, the authors
developed a graph-based semi-supervised learning algorithm for wikification. Their model at the same time, detects
mentions and disambiguates them at both local and global levels. They have also developed meta path-based unified framework
to detect relevant mentions. Their method works in this way: given a set of tweets $<t_1,t_2,... ,t_n>$ ,
first find candidate concept mentions $<m,c1,c2,...,ck>$. From there, we find the most probable concept $c$
related to  mention $m$ and so we get $<m,c>$ . After that , they constructed a relational graph $G= <V,E>$ .

Here set of nodes $V = <v_1,...,v_n>$, and set of edges $E = <e_1,...,v_e>$. Here $v_i = <m_i, c_i>$.
\section{A Deep Neural Networking Approach}
Finally, we have an important work of Larry Heck and Hongzhao Huang ~\cite{ref1DeepLearning}.
First they developed a robust way to represent concepts.
 Many NLP tools use string concatenation to represent ideas.
But most of the time it fails to represent appropriate concepts. For example `Madrid' is a place, `Real'
 means
something authentic or true, but `Real Madrid' refers to a football club.
This is a counter example where string concatenation fails.
A possible alternative is to use \textit{Word Hashing} with $n$-gram ( tri-gram in this case)
word representation. This way turns words into concept-vectors. This representation is
robust because it can be used even for unseen words.
So for example, \textit{dog} is a word. First put \# before and after the word, so it becomes \textit{\#dog\#}.
Then we get these trigrams: \#do , dog , og\#.
  Thus $ \vec(m) = \vec(\#dog\#) = \widehat(\#do) + \widehat(dog) + \widehat(og\#)$.
  Since tweets donot have adequate data, one needs external source of knowledge to  make sense of
  the tweets. In this case, they took a wikipedia dump, converted the documents into concept vectors
   $\vec(c)$ and simply took a dot product of the $ \vec(m) $ and $ \vec(c) $. If the tweet and the concept
   are similar, the two vectors will have smaller angle, ie, $ \cos(\theta) = \vec(m).\vec(c)/mc $ .
This is defined as the semantic relatedness of two concepts, $R(m,c) $.
 After that they did neural embedding of knowledge
 graph.
 To do so, they tracked a concept and its corresponding subgraph, encode the knowledge as featured
 vector.
 then they trained Deep Neural Network to get semantic relationships among various concepts.
After that, they took tweets and used their deep neural network on those tweets.
\endinput


\documentclass[12pt]{article}
\usepackage{geometry}
\geometry{margin=1in}
\geometry{a4paper}

\usepackage{textcomp}
\usepackage{booktabs}
\usepackage{array}
\usepackage{paralist}
\usepackage{verbatim}
\usepackage{subfigure}
\usepackage{graphicx,caption}
\usepackage{placeins}
\usepackage{lipsum}
\usepackage{xcolor}
\usepackage{dcolumn}
\usepackage{sectsty}
\allsectionsfont{\sffamily\mdseries\upshape}
\usepackage{gensymb,amsmath,mathtools,amssymb}
\usepackage{flafter}
%\usepackage{parskip}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{tocbibind}
\usepackage[toc,page]{appendix}
\captionsetup{width=\linewidth}
\usepackage{bm}
\usepackage{url}

\usepackage{pdflscape}

\newcommand{\half}{\frac{1}{2}}

\graphicspath{{./figs/}}

\title{Initial Sizing of 2020 ICLR hybrid rocket}
\author{Devansh Agrawal}
%\date{}

\begin{document}

\maketitle

\section{Introduction}

This document provides an overview of the sizing analysis and results for the 10k SRAD hybrid entry by Imperial College London Rocketry.

This is a working document, and as more information is fed into the system, the parameters may be updated.

\section{Flight performance requirement}

The first challenge was to estimate the performance requirements of the hybrid rocket to able to attain the target altitude with some margin. A separate document details the analysis, but a summary is provided here.

We assume the rocket follows a bang-off control scheme - the rocket thrusts at its main engine's max thrust, $F_{max}$~Newtons for $t_{burn}$~seconds and then coasts the remaining part of the journey. In this scenario, the final altitude of the rocket, $h_f = \hat h_f c^2/g$, is entirely dependent on four non-dimensional parameters\footnote{Assumes exponential atmosphere, constant drag coefficient, perfectly vertical flight}:

\begin{enumerate}
\item The thrust to initial weight ratio, $\hat F = (F_{max})/(m_0 g)$

\item A drag parameter defined as\footnote{Note: This parameter is like the drag to weight ratio (except it uses $c$ as the velocity and $m_0$ as the mass)}, $ x \equiv (\half \rho c^2 c_d A)/(m_0 g)$

\item Propellant mass fraction, $MR \equiv m_p/m_0$

\item Atmosphere parameter, $\hat \beta = \beta c^2/g$

\end{enumerate}

Plugging in suitable parameters, we find the required propellant mass fraction as a function of the thrust to weight ratio, as in figure~\ref{fig:PMF}.

%\FloatBarrier
\begin{figure}[htbp]
   \centering
   \includegraphics[width=0.8\linewidth]{perf_req.eps}
   \caption{Required thrust to weight ratio as a function of the propellant mass fraction}
   \label{fig:PMF}
\end{figure}
%FloatBarrier

From this, we can see that we need a propellant mass fraction of approximate 17\%. The fact that the lines are near vertical above $T/W>2$ suggests that a slow, low thrust burn is roughly equivalent to a fast, high thrust burn. Therefore, since we have the ability to control our burn during the flight, a long, slow burn allows us to turn off the thrust closer to apogee, and with greater certainty of success.

\textbf{For design purposes, and to give ourselves some flexibility, we can therefore design our rocket to have a $T/W>2$ and a propellant mass fraction of at least 20\%. }

Detailed analysis with accurate drag coefficients, the mach dependence, and optimal control should be performed next to ensure these performance targets are sufficient and robust to future design changes.

\section{Vehicle Architecture}

The chosen system breakdown of the rocket is:

\begin{enumerate}

\item Payload
\begin{itemize}
\item 4~kg payload
\item 4.5~kg allocated, to allow for mounting
\end{itemize}

\item Avionics
\begin{itemize}
\item Includes all flight computers and sensing equipment, switchboards and mounting hardware
\item Includes interface wiring to other components with electronics
\item Does not include mass of electronics for other subsystems
\item Allocated 2~kg, based on previous IREC reports.
\end{itemize}

\item Recovery System
\begin{itemize}
\item Includes main and drogue parachute, parachute lines and deployment mechanism mass
\item includes mass of black powder and associated electronics.
\item Allocated 3~kg, based on previous IREC reports.
\end{itemize}

\item Main Engine
\begin{itemize}
\item Includes oxidiser tank, fuel tank
\item ox mass, fuel mass,
\item valves assembly with electronics (allocated 1~kg), and nozzle assembly (allocated 1~kg)
\item Detailed engine sizing was not performed, and needs to be throughly verified.
\end{itemize}

\item Boosters
\begin{itemize}
\item Since the $T/W$ of the main engine is around 2, it is not enough to clear the launch rail with the required speed. As such, solid boosters are to be used launch the rocket, sized to provide $T/W = 10$ for the duration needed to clear the launch rails.
\item Includes motor dry mass, but not mounting structural mass
\end{itemize}

\item Structures
\begin{itemize}
\item Includes nose cone (allocated 0.5 kg)
\item fins (1.2~kg)
\item body tube with internal bulkheads and couplers (4~kg)
\item booster mounting structure (0.3~kg)
\item overall structural mass allowed is 6~kg.
\end{itemize}

\end{enumerate}

\section{Sizing approach}

GPkit\footnote{\url{https://gpkit.readthedocs.io/en/latest/}} was used to perform the sizing study. GPkit allows the user to define variables describing the vehicle, the constraints relating the variables (either due to physics, performance requirements or due to design requirements), and an objective function to optimise. It will then perform a global optimisation and return the optimised parameters of the design. GPkit also allows for easy compartmentalisation, by allowing the user to define these variables within classes, and thus separating the different parts of the design.

I have created a basic framework that should be general enough to allow more detail to be added into the model, as we develop it.

At the top level, a \texttt{rocket} class is defined. The six components above are created, each defined in a separate python file. These classes inherit from \texttt{gpkit.Model} which allows gpkit to interpret the variables and the constraints, and exposes a \texttt{solve} method to perform the optimisation.

For ease of visualisation and interpretation, a jupyter notebook instantiates the \texttt{rocket} and calls the signomial solver, \texttt{localsolve}. Due to the structure of the rocket unfortunately, the geometric globally optimal solver cannot be called, but a local signomial solver must be used. That said, in most scenarios, this solver is sufficiently robust to return a good, and viable solution.

The jupyter notebook also has result printing code blocks to allow for easy debugging of models.

Note, when there are changes to the python files where the relationships are described, jupyter must re-import the classes. The best way to ensure this is accurately done is by clicking the \texttt{Restart \& Run-All} button.

The most important relationships used in this sizing are listed at the end of the document, but the most up-to-date relationships are only available in the python files.

\section{Sizing results}

The solve  took 5 GP solves, and 1.54 seconds.

\textbf{Total rocket mass: 27.89 kg}

The results are more easily interpreted in the form of a diagram, on the last page.

\begin{landscape}

\begin{verbatim}
SORTED BY LINEAGE, SENSITIVITY (solved on 05-11 19:18) NOTE: ENGINE IS POORLY SIZED.
+----------------+---------------------+----------+--------+--------+---------------------------------------+
|            key |             lineage |    value |   unit |   sens |                           Description |
+----------------+---------------------+----------+--------+--------+---------------------------------------+
|            PMF |              Rocket |    0.220 |      - |  0.814 |     Propellant Mass Fraction required |
|     v_{launch} |              Rocket |   30.000 |    m/s |  0.125 |              Velocity off launch rail |
|     L_{launch} |              Rocket |    5.200 |      m | -0.029 |                 Length of launch rail |
|              g |              Rocket |    9.810 |  m/s^2 |  0.011 |           Acceleration due to gravity |
|     a_{launch} |              Rocket |   86.538 |  m/s^2 |      * |          Acceleration off launch rail |
|              m |              Rocket |   27.891 |     kg |      * |                        Mass of Rocket |
| TW_{main, min} |              Rocket |    2.500 |      - |  0.000 | Main engine thrust to take off weight |
|          min_a |              Rocket |   86.538 |  m/s^2 |      * |           minimum launch acceleration |
|              m |     Rocket/Avionics |    1.000 |     kg |  0.069 |                      Mass of Avionics |
|            DMF |     Rocket/Boosters |    0.700 |      - |  0.157 |         Dry mass fraction of boosters |
|              c |     Rocket/Boosters | 2000.000 |    m/s | -0.067 |                boosters exhaust speed |
|              m |     Rocket/Boosters |    0.975 |     kg |      * |                      Mass of Boosters |
|       m_{prop} |     Rocket/Boosters |    0.292 |     kg |      * |           Propellant mass of boosters |
|        m_{dry} |     Rocket/Boosters |    0.682 |     kg |      * |                  Dry mass of boosters |
|       t_{burn} |     Rocket/Boosters |    0.347 |      s |      * |                     Booster burn time |
|              F |     Rocket/Boosters | 1687.261 |      N |      * |            Boosters cumulative thrust |
|              m |      Rocket/Payload |    4.000 |     kg |  0.275 |                       Mass of Payload |
|              m |     Rocket/Recovery |    3.500 |     kg |  0.241 |                      Mass of Recovery |
| \rho_{ox, tank}| Rocket/SimpleEngine | 8000.000 | kg/m^3 |  0.391 |             Density of ox tank, steel |
|         Tank P | Rocket/SimpleEngine |   60.000 |    bar |  0.391 |                  Max Ox Tank pressure |
|             SF | Rocket/SimpleEngine |    3.000 |      - |  0.391 |          Wall thickness safety factor |
|   \sigma_{max} | Rocket/SimpleEngine |  585.000 |    MPa | -0.391 |             Max stress of tank, steel |
|       rho_{ox} | Rocket/SimpleEngine |  650.000 | kg/m^3 | -0.282 |          density of liquid ox *ROUGH* |
|      rho_{wax} | Rocket/SimpleEngine |  900.000 | kg/m^3 | -0.109 |                       Density of fuel |
|     m_{valves} | Rocket/SimpleEngine |    1.000 |     kg |  0.069 |           Mass of valves and plumbing |
|     m_{nozzle} | Rocket/SimpleEngine |    1.000 |     kg |  0.069 |               Mass of nozzle assembly |
|             OF | Rocket/SimpleEngine |    7.500 |      - | -0.063 |                      Ox to fuel ratio |
|              F | Rocket/SimpleEngine | 1000.000 |      N | -0.040 |                         Engine thrust |
|              m | Rocket/SimpleEngine |   13.816 |     kg |      * |                        Mass of Engine |
| m_{grain tank} | Rocket/SimpleEngine |    1.580 |     kg |      * |            Mass of combustion chamber |
|    m_{ox tank} | Rocket/SimpleEngine |    4.101 |     kg |      * |                       Mass of ox tank |
|       m_{prop} | Rocket/SimpleEngine |    6.136 |     kg |      * |                    Mass of Propellant |
|        m_{dry} | Rocket/SimpleEngine |    7.680 |     kg |      * |                    Dry mass of engine |
|         m_{ox} | Rocket/SimpleEngine |    5.414 |     kg |      * |                               ox mass |
|       m_{fuel} | Rocket/SimpleEngine |    0.722 |     kg |      * |                             fuel mass |
|           d_ox | Rocket/SimpleEngine |    6.000 |     in |  0.000 |                   Diameter of ox tank |
|       t_{wall} | Rocket/SimpleEngine |    2.345 |     mm |      * |             Wall Thickness of ox tank |
|         L_{ox} | Rocket/SimpleEngine |    0.457 |      m |      * |                     Length of ox tank |
|       v_{fuel} | Rocket/SimpleEngine |  802.096 |   cm^3 |      * |                        Volume of fuel |
|      L_{grain} | Rocket/SimpleEngine |    0.176 |      m |      * |                   Length of the grain |
|         V_{ox} | Rocket/SimpleEngine | 8329.458 |   cm^3 |      * |                     Volume of ox tank |
|      A_{grain} | Rocket/SimpleEngine |   45.581 |   cm^2 |      * |           cross section area of grain |
|              m |   Rocket/Structures |    4.600 |     kg |  0.317 |                    Mass of Structures |
+----------------+---------------------+----------+--------+--------+---------------------------------------+
\end{verbatim}

Note, the sensitivity is the logarithmic sensitivity, ie, $\text{sensitivity} = \frac{d \log(\text{cost})}{d\log(\text{var})}$. A positive number indicates that increasing the variable will increase the cost. Note, the star indicates a zero sensitivity, since this is a variable that gpkit has solved for. As such, it represents the minima of the function and thus has zero sensitivity, similar to how a function has zero gradient wrt to a variable when it is optimized.

\end{landscape}

\section{Next steps}
\begin{itemize}
\item Verify structural mass allocations
\item Verify stability requirements - ie, ensure fins are large enough
\item Perform detailed drag accounting
\item Perform detailed controls analysis
\item more accurate tank sizing needed, especially considering manufacturability, source-ability, cost.
\item tank ullage not accounted for
\item very simplified thrust curve needs to be improved
\end{itemize}

Design modification if the engine performance is poorer than expected: bigger boosters. Therefore, the booster mounts need to be flexible enough to allow different booster designs. Could look into dropping boosters after their work is done, but this is complicated.

%\bibliographystyle{unsrt}
%\bibliography{biblio}

\section{Sizing relationships used}

\emph{NOTE: the values in this section are probably wrong, the method should be roughly accurate. Consult the github for the values used.}

Most constraints are fairly straightforward. Here are the key ones

\begin{itemize}
\item m = sum of mass of components
\item propellant mass fraction $>$ 20\%
\item Launch requirements:
\begin{itemize}
\item v off launch rail $>$ 30m/s
\item launch accel = (booster thrust + main engine thrust - mg)/m
\item launch accel $>$ min accel = (launch v)$^2$/(2 launch rail L)
\item booster burn time such that burn out occurs at 5 m/s
\end{itemize}
\item Components:
\begin{itemize}
\item Payload: m = 4.5 kg
\item Avionics: m = 2 kg
\item Recovery: m = 3 kg
\item Engine:
\begin{itemize}
\item OF = 6
\item m fuel, m ox based on m prop and OF
\item d = 150 mm
\item P tank $<$ 60 bar
\item wall thickness based on hoop stress and safety factor of 5, assumes Al-7075 due to high yield strength (double of Al 6061), sealing and welding to be determined more thoroughly
\item ox is fully liquid, at critical density of 490 kg/m3 $\rightarrow$ determine length of ox tank
\item mass of ox tank based on cylinder material thickness, end caps not accounted for
\item grain tank is similarly sized, assumes the grain is only occupied in half the cross sectional area (needs to be refined), and same wall thickness as ox tank. No liner material considered. Carbon overwrap of tank tube would save lots of mass if possible.
\item \emph{regression rates, motor dynamics, etc not accounted for}
\item m valves = 1 kg
\item m nozzle = 1 kg
\item assumed F= 1000 N
\item c = 1800 m/s (needs to be verified)
\end{itemize}
\item Boosters:
\begin{itemize}
\item propellant mass such that total impulse can be delivered
\item dry mass fraction is 70\%. Needs to be refined by picking a motor, assumed c = 2000m/s
\end{itemize}
\item Structures:
\begin{itemize}
\item m = sum of components
\item m fins = 1.2 kg
\item m nose cone = 0.5 kg
\item m tube = 4 kg
\item m  booster struc = 0.3 kg
\end{itemize}
\end{itemize}

\end{itemize}

\FloatBarrier
\begin{figure}[htbp]
   \centering
   \includegraphics[width=\linewidth]{sizing_result_Nov_5.eps}
   \caption{Summary of Sizing results}
   \label{fig:}
\end{figure}
%FloatBarrier

\end{document}


\section{Conclusion}

In conclusion, we find that Parareal is indeed capable of providing significant
speedup to our general numerical methods for ordinary differential equations.
however, it's difficult to determine what's the correct choice of $\fine$ and
$\coarse$, since the stability function is not easy to analyze in general, and
because there's an unfomfortable optimization problem between wanting $\coarse$
to be as accurate as possible, while making sure that the ratio $T_f/T_g$ is as
large as possible. In addition, for systems with strong requirements on $\Delta
t$, such as for the heat equation, we might have no choice but to make $\Delta
t$ small, and thus making $T_g$ large with respect to $T_f$. This implies that
for these system, there might be better approaches to parallelism.

Some points to personally reflect on this project:
\begin{itemize}
  \item I should not have used OpenMP to implement parareal. In the end, I was
    limited in the number of processors I could test on due to it, and the
    pipelined efficient implementation was just mimicing MPI-like behavior
    anyway. If I had to do this again, I would use a combination of MPI and
    OpenMP, MPI would split the domain over different compute nodes, and OpenMP
    would internally handle the parallel computation of the fine integrations
    assigned to that node.
\item I ran out of time to test implicit integrators, and how their stability
  regions functioned. I found it difficult to implement them, since the way I
  had written my code isolated the actual $f$ of the ODE $u' = f(t,u)$, and
  thus if I wanted implicit solvers, I had to solve a nonlinear optimization
  problem, which was too much trouble.
\item I wanted to look at generalizations and improvements of parareal, such as
  PFASST, which takes a spectral deffered corrections approach to the iteration,
  and another which adapts it to a multigrid scheme, but I ran out of time.
\end{itemize}


\documentclass[main.tex]{subfiles}
\begin{document}

\subsection{The physical effects of Comptonization}

\marginpar{Thursday\\ 2020-8-27, \\ compiled \\ \today}

As we have said it is hard to find numerical solutions to the Kompaneets equation, however there is an interesting quantity whose evolution we can study analytically: the photon energy density.
The energy density can be calculated as
%
\begin{align}
u = \int \dd[3]{p} h \nu \frac{N}{ \dd[3]{p}\dd[3]{x}}
= \int \dd[3]{p} h \nu   \frac{2 n}{h^3}
= \frac{8 \pi (k_B T)^{4}}{h^3c^3} \int_0^{\infty } \dd{x} x^3 n
\,,
\end{align}
%
where, as usual, \(x = h \nu / k_B T\), and the last equality comes about by substituting this and \(\dd[3]{p} = p^2 \dd{p} \dd{\Omega }\) and assuming isotropy.

In order to see how it changes in the first stage of the Comptonization, when the photon energy is low compared to the electron temperature, let us differentiate this energy density with respect to time (rescaled, as in the Kompaneets equation, by the mean time between two scatterings):
%
\begin{align}
\dv{u}{t_s}
= \frac{8 \pi (k_B T)^{4}}{h^3c^3} \int_0^{\infty } \dd{x} x^3 \pdv{n}{t_s}
= \frac{8 \pi (k_B T)^{4}}{h^3c^3} \int_0^{\infty } \dd{x} x^3 \frac{\Theta}{x^2} \pdv{}{x} \qty[x^{4 } (n' + n + n^2)]
\marginnote{Used the Kompaneets equation.}
\,.
\end{align}

Now, let us suppose that \(n\) is very small, so that we can neglect \(n\) and \(n^2\) inside the derivative, keeping \(n'\): this yields
% \todo[inline]{Not super clear why \(n \ll n'\) if \(n\) is small should hold\dots }
%
\begin{align}
\dv{u}{t_s} \approx \frac{8 \pi (k_B T)^{4}}{h^3 c^3} \Theta \int_0^{\infty } \dd{x} x \pdv{[x^{4} n']}{x}
\,.
\end{align}

We integrate by parts twice and assume that \(x^{k} n' \to 0 \) for \(k> 3\): this give us
%
\begin{align}
\dv{u}{t_s} \approx \frac{8 \pi (k_B T)^{4}}{h^3 c^3} 4 \Theta \int_0^{\infty } \dd{x} x^3 n = 4 \Theta u
\,.
\end{align}

The solution to this is an exponential:
%
\begin{align}
u(t_s) = u(0 ) \exp( 4 \Theta t_s) = u(0 ) \exp( t / t_c )
\,,
\end{align}
%
where \(t_c = 1/ (4 \Theta n \sigma _T c)\) is called the Compton time.
This means that the radiative energy density increases \textbf{exponentially fast}, over a characteristic time of the order \(t_c\).

\todo[inline]{So, to see if I understand correctly: the contributions \(n + n^2\) are relevant as we move closer to equilibrium, while the \(n'\) term dominates the first stage of the evolution; and the exponential describes the first stage of an evolution which is shaped like some kind of sigmoid?}

\subsection{Relativistic Kompaneets equation}

We made the hypotheses that \(\Theta \ll 1\) and \(\epsilon \ll 1\) at the start: the electrons and photons were nonrelativistic.
If we keep all the other hypotheses (isotropy, homogeneity, small fractional energy change and so on) can we generalize the Kompaneets equation to relativistic particles?

We will need to use a relativistic Maxwellian (Jüttner distribution) instead of a Maxwellian, and the Klein-Nishina cross section instead of the Thomson one. This will allow us to deal with generic \(\Theta \) and \(\epsilon \): the result is
%
\begin{align}
\pdv{n}{t} = \frac{1}{\epsilon^2} \pdv{}{\epsilon } \qty[ \alpha (\epsilon , \Theta ) \qty(\Theta \pdv{n}{\epsilon } + n + n^2)]
\,,
\end{align}
%
where \(\alpha \) is a certain known function,
%
\begin{align}
\alpha (\epsilon , \Theta ) = \frac{\epsilon^4}{2 K_2 (1 / \Theta )} \int_0^{\infty } \dd{z} z^2 \alpha_0 (\epsilon z) \exp( - \frac{z + 1/z}{2 \Theta })
\,,
\end{align}
%
where \(\alpha_0\) is a known analytical function, whose expression is omitted here.

The form of the relativistic Kompaneets equation is very similar to the nonrelativistic one.

The shape of \(\alpha \) is quite similar to \(\epsilon^4\), its nonrelativistic counterpart, for low photon energies; while for high photon energies \(\alpha \) is lower than \(\epsilon^4\).

The take-away, here, is that if we were to need the relativistic form of the equation we can find it in the literature and apply it to our problem.

\subsection{The emerging spectrum}

In astrophysical (non-cosmological) settings we will not find infinite homogeneous media; instead, we need to treat clouds of finite size.
However, we cannot simply use the Kompaneets equation for them.

What is the spectrum we expect to observe at infinity?
Let us suppose we have a source inside a spherical cloud of radius \(R\); this source will emit a pulse of radiation at a time \(t\), so that the density at a time \(t_0 \) is
%
\begin{align}
n(\nu , t_0 ) = n_0 (\nu ) \delta (t_0  - t )
\,.
\end{align}

Photons will propagate and scatter in the cloud, until finally they are emitted and some of them can be observed. What will be the spectral distribution of these?

Roughly speaking, we can express the observed number density as
%
\begin{align}
n _{\text{obs}}(\epsilon ) = \sum _{i} p_i n(\epsilon , t_i)
\,,
\end{align}
%
where \(t_i\) are different times after \(t_0 \), \(n(\epsilon, t_i)\) are solutions of the Kompaneets equation at these times, and \(p_i\) are the probabilities that a photon emitted at \(t\) will exit the cloud at \(t_i\).
Properly speaking this should be an integral, but we are just giving the rough idea. We will turn it into an integral later.

The escape probability will satisfy
%
\begin{align}
p(t) \dd{t} = \frac{ \dd{n}}{n}
\,,
\end{align}
%
so that it describes the fraction of photons (\(\dd{n} / n\)) which escape the medium in a time \(\dd{t}\).
The observed intensity will then be
%
\begin{align}
n _{\text{obs}}(\epsilon ) = \int_0^{\infty } p(\tau) n(\epsilon , \tau ) \dd{\tau }
\,.
\end{align}

The typical timescale for a photon to leave the cloud will be given by the mean number of scatterings times the typical time per scattering: if the medium is assumed to be optically thick we get
%
\begin{align}
t _{\text{esc}} \sim N_s t_s \sim \max \frac{\qty(\tau,\tau^2) }{n \sigma _T c} \sim \frac{\tau^2 R}{nR \sigma _T c} \sim \frac{\tau R}{c}
\,,
\end{align}
%
since \(n R \sigma _T = \tau \).
This result makes sense: it is the light travel time \(R / c\) times the optical depth.

The form of \(p(t)\) depends on the shape of the cloud; for example in our spherical cloud we have
%
\begin{align}
p(t) = \frac{1}{\tau } \sum _{n=1}^{\infty } \lambda_n \sin \lambda_n \exp( - \frac{\lambda _n^2}{3} \frac{t}{ t _{\text{esc}}})
\,,
\end{align}
%
where the coefficients \(\lambda _n\) are the solutions of \(\tan \lambda _n  = \lambda _n / (1 - 3 \tau / 2)\).

It is important to apply this procedure instead of blindly plugging the distribution inside the Kompaneets equation: we know that in that case the photons will eventually thermalize, which is not of physical interest in most situations.

\subsubsection{Unsaturated Comptonization and power-law tails}

Let us consider a phenomenologically-motivated modified Kompaneets equation, which accounts for the injection and escape of photons in a finite medium:
%
\begin{align}
\dot{H} - \dot{S} = \frac{\Theta}{x^2} \pdv{[x^{4} (n' + n + n^2)]}{x}
\,,
\end{align}
%
where \(\dot{S} = Q(x)\) quantifies the photons gained per unit time, while \(\dot{H} = n / \max(\tau , \tau^2)\) quantifies the photons lost per unit time.

\todo[inline]{Are the signs of the \(\dot{S}\) and \(\dot{H}\) not the other way around?}

\todo[inline]{How does this work dimensionally? Are \(\dot{H}\) and \(\dot{S}\) not supposed to be inverse times?}

Suppose that the input is \emph{soft}, that is, low-energy.
This means that we will have \(Q(x)\) different from zero only for \(x\) smaller than a certain threshold, \(x< x_s \ll 1\).
We then look at the high-energy tail in emissions, \(x \gg 1\).

We will neglect the \(n^2\) term. The equation  will then read
%
\begin{align}
0 = \frac{\Theta}{x^2} \pdv{[x^{4}(n' + n)]}{x} + \underbrace{Q(x) - \frac{n}{\max (\tau , \tau^2)}}_{\text{vanish in the high \(x\) regime}}
\,,
\end{align}
%
so we are left with \(n' + n = \const\), meaning that \(n \sim \exp(- x)\).
This means that at very high energies the decay of the emission is exponential.

\todo[inline]{Why does the term proportional to \(n\) vanish?}

Now, instead, we look for mid-energy solutions, in the range between the threshold for the emission \(x_s\) and 1. We will suppose that \(x_s \ll x \ll 1\).
We will then neglect the \(n\) and \(n^2\) terms, meaning that we can ignore \(Q(x)\) but not the escape term, so we have
%
\begin{align}
0 = \frac{\Theta}{x^2} \pdv{[x^{4} (n')]}{x} - \frac{n}{\max (\tau , \tau^2)}
\,.
\end{align}

If we take a powerlaw ansatz, \(n \propto x^{m}\), we find that the equation for \(m\) becomes
%
\begin{align}
m(m+3) - \frac{4}{4 \Theta \max (\tau, \tau^2)}= 0
\,,
\end{align}
%
where we recognize the Compton parameter \(4 \Theta \max (\tau , \tau^2) = y\), which quantifies how much the scatterings affect the spectrum.
The second-order equation for \(m\) then becomes
%
\begin{align}
m = \frac{-3 \pm \sqrt{9 + 16 / y^2}}{2}
\,.
\end{align}

If we take the positive solution it will be \(m_+>0\), so the spectrum will increase at high energies, which is unphysical.
So, we consider the negative solution: expanding the square root under the assumption that \(y < 1\)\footnote{As \(a\) and \(b\) get further from one another in magnitude, the approximation \(\sqrt{a + b} = \sqrt{a} + \sqrt{b}\) gets closer to being true. For small \(y\) we have quite a good result, while for \(y\) closer to 1 the exponent is slowly-varying anyway.} we get
%
\begin{align}
m_- \approx -3 - \frac{2}{y}
\,.
\end{align}

This is then a powerlaw spectrum: for any soft photon input, then, we have found a qualitative result. It is a powerlaw for medium photon energies and an exponential for high photon energies.
This then gives a typical signature for the observational spectrum we observe in Compton scattering.

Note that, like in the Planck function, the spectrum of the observed intensity scales like \(I_\nu \sim n \nu^3\), so we expect to see \(I_\nu \sim \nu^{3+m} \sim \nu^{-2/y}\) for medium energies, and \(I_\nu \sim \nu^3 e^{-x}\).

\subsubsection{Dynamical Comptonization}

We have so far discussed the effects of repeated scattering of photons onto electrons which are moving due to thermal motion. This is however not the only reason electrons may move!

An interesting situation is one in which the temperature \(T\) of the electrons is low, but the bulk velocity of the plasma \(\vec{v}\) is high, so that interaction with photons is still capable of causing inverse Compton scattering.

Suppose we have a flow of electrons moving with a uniform \(\vec{v}\), constant for all of them. Then, the Electron Rest Frame is the same for all the electrons.

So, in order to deal with the first scattering we must boost to the ERF, but then we are done: we can stay in that frame for all subsequent scatterings.
The energy the photon will emerge with will be \(\epsilon_2 \approx \gamma^2 \epsilon_1 \) regardless of the number of scatterings.

If, on the other hand, the velocity is not uniform we need to insert a relative \(\gamma \) factor for each new electron.
This effect will build up for each scattering.
So, dynamical Comptonization requires a nonvanishing velocity gradient to work.

\todo[inline]{He writes \(\nabla \cdot \vec{v} \neq 0\), which is not the same\dots why would the \emph{divergence} not vanishing specifically be the condition? what about the curl, or the other components of \(\partial_{i} v_j\) anyway?}

This is similar to \emph{second-order Fermi acceleration.}
\todo[inline]{what is that?}

\end{document}


\section{Time scale}\label{sec:time_scale}

In Sect. \ref{subsec:time_definition} we describe the physical time scale and
the trade time scale. In Sect. \ref{subsec:trade_time} and Sect.
\ref{subsec:physical_time} we define the trade and the physical time scales,
respectively.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Time definition}\label{subsec:time_definition}

Due to the nature of the data, there are several options to define time for
analyzing data. In general, the time series are labeled in calendar time
(hours, minutes, seconds, milliseconds).Moreover, tick-by-tick data available
on financial markets all over the world are time stamped up to the nanosecond
\cite{xetra}, but the order of magnitude of the guaranteed precision is much
larger, usually one second or a few hundreds of milliseconds
\cite{market_digest,empirical_facts}. In several papers are used different time
definitions (calendar time, physical time, event time, trade time, tick time)
\cite{empirical_facts,sampling_returns,market_making}. The spot foreign
exchange market data used in the analysis only has the quotes. In consequence,
we have to infer the trades during the market time. As we have tick-by-tick
resolution, we can use either trade time scale or physical time scale.

The trade time scale increases by one unit each time a transaction happens,
which in our case is every time the quotes change. The advantage of this count
is that limit orders far away in the order book do not increase the time by one
unit. The main outcome of trade time scale is its ``smoothing" of data and the
aggregational normality \cite{empirical_facts}.

The physical time scale is increased by one unit each time a second passes.
This means that computing the responses in this scale involves sampling
\cite{Wang_2016_cross,sampling_returns}, which has to be done carefully when
dealing for example with several stocks with different liquidity. This sampling
is made in the trade signs and in the midpoint prices.

We use these two definitions of time scale to compute the price response
function. Between these two scales, there is not a judgment which is better or
worse.Their use directly depends on the application. Thus, our aim is to
present how the price response function behaves under these two different time
scales.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Trade time scale}\label{subsec:trade_time}

As a first approximation, we use the trade sign classification in trade time
scale proposed in Ref. \cite{Wang_2016_cross} and used in Refs.
\cite{my_paper_response_financial,Wang_2016_avg,Wang_2017,Wang_2018_copulas}
that reads
\begin{equation}\label{eq:trade_signs_trade}
    \varepsilon^{\left(\textrm{t}\right)}\left(t,n\right)=\left\{
    \begin{array}{cc}
    \text{sgn}\left(m\left(t,n\right)-m\left(t,n-1\right)\right),
    & \text{if }\\ m\left(t,n\right) \ne m\left(t,n-1\right)\\
    \varepsilon^{\left(\textrm{t}\right)}\left(t,n-1\right),
    & \text{otherwise}
    \end{array}\right..
\end{equation}
Here, $t$ distinguish each second where one or more trades can happen.
$\varepsilon^{\left(\textrm{t}\right)}\left( t,n \right) = +1$ implies a
trade triggered by a market order to buy, and a value
$\varepsilon^{\left(\textrm{t}\right)}\left( t,n \right) = -1$ indicates a
trade triggered by a market order to sell.

In the second case of Eq. (\ref{eq:trade_signs_trade}), if two consecutive
trades with the same trading direction do not exhaust all the available volume
at the best quote, the trades would have the same price, and they will thus
have the same trade sign.

With this classification we obtain trade signs for every single trade in the
data set. According to Ref. \cite{Wang_2016_cross}, the average accuracy of the
classification is $85\%$ for the trade time scale.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Physical time scale}\label{subsec:physical_time}

We use the trade sign definition in physical time scale proposed in Ref.
\cite{Wang_2016_cross} and used in Refs.
\cite{Wang_2016_avg,Wang_2017}, that depends on the classification in
Eq. (\ref{eq:trade_signs_trade}) and reads
\begin{equation}\label{eq:trade_signs_physical}
    \varepsilon^{\left(\textrm{p}\right)}\left(t\right)=\left\{
    \begin{array}{cc}
    \text{sgn}\left(\sum_{n=1}^{N\left(t\right)}
    \varepsilon^{\left(\textrm{t}\right)} \left(t,n\right)\right),
    & \text{If }N \left(t\right)>0\\
    0, & \text{If }N\left(t\right)=0
    \end{array}\right. ,
\end{equation}
where $N \left(t \right)$ is the number of trades in an interval of one second
following t. Here, $\varepsilon^{\left(\textrm{p}\right)}\left( t \right) = +1$
implies that the imbalance of trades in the second $t$ are triggered by a
market order to buy, and a value
$\varepsilon^{\left(\textrm{p}\right)}\left( t \right) = -1$ indicates an
imbalance of sell market orders. In this definition, there are two ways to
obtain $\varepsilon^{\left(\textrm{p}\right)}\left( t \right) = 0$.  First,
there are no trades in a particular second and thus no trade sign. Second, the
sum of the trade signs in a given second amounts to zero, indicating an exact
balance of buy and sell market orders.

Market orders show opposite trade directions as compared to limit orders
executed simultaneously. An executed sell limit order corresponds to a
buyer-initiated market order. An executed buy limit order corresponds to a
seller-initiated market order. In this case we do not compare every single
trade sign in a second, but the net trade sign obtained for every second with
the definition, see Eq. (\ref{eq:trade_signs_physical}). According to Ref.
\cite{Wang_2016_cross}, this definition has an average accuracy up to $82\%$ in
the physical time scale.