\documentclass[preprint]{sigplanconf}

\usepackage{graphicx}
\usepackage{comment}
\usepackage{amsmath}
\usepackage{xspace}
\usepackage{amssymb}
\usepackage{stmaryrd}
\usepackage{proof}
\usepackage{multicol}
\usepackage[nodayofweek]{datetime}
\usepackage{etex}
\usepackage[all, cmtip]{xy}
\usepackage{xcolor}
\usepackage{listings}
\usepackage{multicol}
\newcommand\hmmax{0} % default \newcommand\bmmax{0} % default 4
\usepackage{bm}
\usepackage{cmll}

\newcommand{\fname}[1]{\ulcorner #1 \urcorner}
\newcommand{\fconame}[1]{\llcorner #1 \lrcorner}

\newcommand{\xcomment}[2]{\textbf{#1:~\textsl{#2}}}
\newcommand{\amr}[1]{\xcomment{Amr}{#1}}
\newcommand{\roshan}[1]{\xcomment{Roshan}{#1}}

\newcommand{\asterix}[0]{*}

\newcommand{\ie}{\textit{i.e.}\xspace}
\newcommand{\eg}{\textit{e.g.}\xspace}

\newcommand{\lcal}{\ensuremath{\lambda}-calculus\xspace}
\newcommand{\G}{\ensuremath{\mathcal{G}}\xspace}

\newcommand{\code}[1]{\lstinline[basicstyle=\small]{#1}\xspace}
\newcommand{\name}[1]{\code{#1}}

\def\newblock{}

\newenvironment{floatrule}
    {\hrule width \hsize height .33pt \vspace{.5pc}}
    {\par\addvspace{.5pc}}

\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{proposition}[theorem]{Proposition}
\newenvironment{proof}[1][Proof.]{\begin{trivlist}\item[\hskip \labelsep {\bfseries #1}]}{\end{trivlist}}

\newcommand{\arrow}[1]{\mathtt{#1}}

\newcommand{\dgm}[2][0.95]{
\begin{center}
\scalebox{#1}{
\includegraphics{diagrams/#2.pdf}
}
\end{center}
}

%subcode-inline{bnf-inline} name langRev
%! swap+ = \mathit{swap}^+
%! swap* = \mathit{swap}^*
%! dagger =  ^{\dagger}
%! assocl+ = \mathit{assocl}^+
%! assocr+ = \mathit{assocr}^+
%! assocl* = \mathit{assocl}^*
%! assocr* = \mathit{assocr}^*
%! identr* = \mathit{uniti}
%! identl* = \mathit{unite}
%! dist = \mathit{distrib}
%! factor = \mathit{factor}
%! eta = \eta
%! eps = \epsilon
%! eta+ = \eta^+
%! eps+ = \epsilon^+
%! eta* = \eta^{\times}
%! eps* = \epsilon^{\times}
%! trace+ = trace^+
%! trace* = trace^{\times}
%! ^^^ = ^{-1}
%! (o) = \circ
%! (;) = \fatsemi
%! (*) = \times
%! (+) = +
%! LeftP = L^+
%! RightP = R^+
%! LeftT = L^{\times}
%! RightT = R^{\times}
%! alpha = \alpha
%! bool = \textit{bool}
%! color = \textit{color}
%! Gr = G

%subcode-inline{bnf-inline} regex \{\{(((\}[^\}])|[^\}])*)\}\} name main include langRev
%! Gx = \Gamma^{\times}
%! G = \Gamma
%! [] = \Box
%! |-->* = \mapsto^{\asterix}
%! |-->> = \mapsto_{\ggg}
%! |--> = \mapsto
%! <--| = \mapsfrom
%! |- = \vdash
%! <><> = \approx
%! ==> = \Longrightarrow
%! <== = \Longleftarrow
%! <=> = \Longleftrightarrow
%! <-> = \leftrightarrow
%! ~> = \leadsto
%! -o+ = \multimap^{+}
%! -o* = \multimap^{\times}
%! -o = \multimap
%! ::= = &::=&
%! /= = \neq
%! @@ = \mu
%! [^ = \lceil
%! ^] = \rceil
%! forall = \forall
%! exists = \exists
%! empty = \epsilon
%! Pi = \Pi
%! Pi0 = \Pi^{o}
%! PiEE* = \Pi^{\eta\epsilon}_{*}
%! PiEE+ = \Pi^{\eta\epsilon}_{+}
%! PiEE = \Pi^{\eta\epsilon}
%! CatSet = \textbf{Set}
%! theseus = Theseus
%! sqrt(x) = \sqrt{#x}
%! surd(p,x) = \sqrt[#p]{#x}
%! inv(x) = \frac{1}{#x}
%! frac(x,y) = \frac{#x}{#y}
%! * = \times

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}

\conferenceinfo{POPL'13}{}
\CopyrightYear{}
\copyrightdata{}
\titlebanner{}
\preprintfooter{}

\title{Negative and Fractional Types}

\authorinfo{Roshan P. James}
           {Indiana University}
           {rpjames@indiana.edu}
\authorinfo{Zachary Sparks}
           {Indiana University}
           {zasparks@indiana.edu}
\authorinfo{Jacques Carette}
           {McMaster University}
           {carette@mcmaster.ca}
\authorinfo{Amr Sabry}
           {Indiana University}
           {sabry@indiana.edu}

\maketitle

\begin{abstract}

\end{abstract}

\category{D.3.1}{Formal Definitions and Theory}{}
\category{F.3.2}{Semantics of Programming Languages}{}
\category{F.3.3}{Studies of Program Constructs}{Type structure}

\terms
Languages, Theory

\keywords continuations, information flow, linear logic, logic programming,
quantum computing, reversible logic, symmetric monoidal categories, compact
closed categories.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Introduction}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{The Core Reversible Language: {{Pi}} }
\label{sec:pi}

We review our reversible language {{Pi}}: the presentation in this
section differs from the one in our previous paper~\cite{infeffects} in two
aspects. First, we add the empty type {{0}} which is necessary to express the
additive duality. Second, instead of explaining evaluation using a natural
semantics, we give a small-step operational semantics that is more
appropriate for the connections with continuations explored in this paper.

%%%%%%%%%%%%%%%%%%%%
\subsection{Syntax and Types}
\label{sec:pi-syntax}

Unlike the traditional situation with the $\lambda$-calculus, in {{Pi}},
there is a sharp distinction between data and programs.

\paragraph*{Data.} The sets of values and their types include:
%subcode{bnf} include main
% value types, b ::= 0 | 1 | b + b | b * b
% values, v ::= () | left v | right v | (v, v)
Types include the empty type {{0}}, the unit type {{1}}, sum types {{b1+b2}},
and products types {{b1*b2}}.  Values includes {{()}} which is the only value
of type {{1}}, {{left v}} and {{right v}} which inject {{v}} into a sum type,
and {{(v1,v2)}} which builds a value of product type. There are no values of
type {{0}}.

\paragraph*{Programs.} All the programs of {{Pi}} are special maps of type
{{v \rightarrow v}}. Specifically, they are witnesses to the following type
isomorphisms:
%subcode{bnf} include main
%! columnStyle = r@{\hspace{-0.5pt}}c@{\hspace{-0.5pt}}l
%zeroe :&  0 + b <-> b &: zeroi
%swap+ :&  b1 + b2 <-> b2 + b1 &: swap+
%assocl+ :&  b1 + (b2 + b3) <-> (b1 + b2) + b3 &: assocr+
%identl* :&  1 * b <-> b &: identr*
%swap* :&  b1 * b2 <-> b2 * b1 &: swap*
%assocl* :&  b1 * (b2 * b3) <-> (b1 * b2) * b3 &: assocr*
%dist0 :& 0 * b <-> 0 &: factor0
%dist :&~ (b1 + b2) * b3 <-> (b1 * b3) + (b2 * b3)~ &: factor
Each line of the above table introduces one or two combinators that witness
the isomorphism in the middle. Collectively the isomorphisms state that the
structure {{(b,+,0,*,1)}} is a \emph{commutative semiring}, i.e., that each
of {{(b,+,0)}} and {{(b,*,1)}} is a commutative monoid and that
multiplication distributes over addition. The isomorphisms are extended to
form a congruence relation by adding the following constructors that witness
equivalence and compatible closure:
%subcode{proof} include main
%@  ~
%@@ id : b <-> b
%
%@ c : b1 <-> b2
%@@ sym c : b2 <-> b1
%
%@ c1 : b1 <-> b2
%@ c2 : b2 <-> b3
%@@ c1(;)c2 : b1 <-> b3
%---
%@ c1 : b1 <-> b3
%@ c2 : b2 <-> b4
%@@ c1 (+) c2 : b1 + b2 <-> b3 + b4
%
%@ c1 : b1 <-> b3
%@ c2 : b2 <-> b4
%@@ c1 (*) c2 : b1 * b2 <-> b3 * b4

\noindent
To summarize, the syntax of {{Pi}} is given as follows.

\begin{definition}{(Syntax of {{Pi}})}
\label{def:Pi}
We collect our types, values, and combinators, to get the full language
definition.
%subcode{bnf} include main
% value types, b ::= 0 | 1 | b+b | b*b
% values, v ::= () | left v | right v | (v,v)
%
% comb.~types, t ::= b <-> b
% iso ::= zeroe | zeroi
%     &|& swap+ | assocl+ | assocr+
%     &|& identl* | identr*
%     &|& swap* | assocl* | assocr*
%     &|& dist0 | factor0 | dist | factor
% comb., c ::= iso | id | sym c | c (;) c | c (+) c | c (*) c
\end{definition}

\paragraph*{Adjoint.}
An important property of the language is that every combinator {{c}} has an
adjoint {{c{dagger}}} that reverses the action of {{c}}. This is evident by
construction for the primitive isomorphisms. For the closure combinators, the
adjoint is homomorphic except for the case of sequencing in which the order
is reversed, i.e., {{(c1 (;) c2){dagger} = (c2{dagger}) (;) (c1{dagger}) }}.

\begin{definition}[Size of a type]
\label{def:size}
The size of a type {{b}}, denoted by {{[^ b ^]}}, is a numeric value
and is defined to be:
\vspace{-20pt}
\begin{multicols}{2}
%subcode{opsem} include main
% [^ b1 + b2 ^] '= [^ b1 ^] + [^ b2 ^]
% [^ b1 * b2 ^] '= [^ b1 ^] * [^ b2 ^]

%subcode{opsem} include main
% [^ 0 ^] '= 0
% [^ 1 ^] '= 1
\end{multicols}

where {{+}} is numeric addition and {{*}} is numeric multiplication.

\end{definition}
\noindent
In the setting of {{Pi}} the \emph{size}, {{[^ b ^]}}, may be simply thought of as
the number of inhabitants (an arity) of the type. This intuition will
however become tenuous in the presence of negative and fractional
types.

%%%%%%%%%%%%%%%%%%%
\subsection{Graphical Language}

The syntactic notation above is often obscure and hard to read.
Following the tradition established for monoidal
categories~\cite{springerlink:10.1007/978-3-642-12821-94}, we present
a graphical language that conveys the intuitive semantics of the
language (which is formalized in the next section).

The general idea of the graphical notation is that combinators are modeled by
``wiring diagrams'' or ``circuits'' and that values are modeled as
``particles'' or ``waves'' that may appear on the wires. Evaluation therefore
is modeled by the flow of waves and particles along the wires.

\begin{itemize}
\item The simplest sort of diagram is the {{id : b <-> b}} combinator which
  is simply represented as a wire labeled by its type {{b}}, as shown on the
  left. In more complex diagrams, if the type of a wire is obvious from the
  context, it may be omitted. When tracing a computation, one might imagine a
  value {{v}} of type {{b}} on the wire, as shown on the right.

  \begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/b-wire.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/b-wire-value.pdf}
}
\end{center}
  \end{multicols}

\item The product type {{b1*b2}} may be represented using either one wire
  labeled {{b1*b2}} or two parallel wires labeled {{b1}} and {{b2}}. In the
  case of products represented by a pair of wires, when tracing execution
  using particles, one should think of one particle on each wire or
  alternatively as in folklore in the literature on monoidal categories as a
  ``wave.''
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/pair-one-wire.pdf]
\includegraphics{diagrams/thesis/product-one-wire.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/product-one-wire-value.pdf}
}
\end{center}
\end{multicols}
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%%subcode-line{pdfimage}[diagrams/thesis/pair-of-wires.pdf]
\includegraphics{diagrams/thesis/product-two-wires.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/product-two-wires-value.pdf}
}
\end{center}
\end{multicols}

\item Sum types may similarly be represented by one wire or using
  parallel wires with a {{+}} operator between them. When tracing the
  execution of two additive wires, a value can reside on only one of the two
  wires.
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/sum-one-wire.pdf]
\includegraphics{diagrams/thesis/sum-one-wire.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/sum-two-wires-left-value.pdf}
}
\end{center}
\end{multicols}
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/sum-of-wires.pdf]
\includegraphics{diagrams/thesis/sum-two-wires.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/sum-two-wires-right-value.pdf}
}
\end{center}
\end{multicols}

\item Associativity is implicit in the graphical language. Three parallel
  wires represent {{b1*(b2*b3)}} or {{(b1*b2)*b3}}, based on the context.
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/associate.pdf]
\includegraphics{diagrams/thesis/assoc.pdf}
}
\end{center}

\item Commutativity is represented by crisscrossing wires.
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/swap-pair.pdf]
\includegraphics{diagrams/thesis/swap_times.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/swap-sum.pdf]
\includegraphics{diagrams/thesis/swap_plus.pdf}
}
\end{center}
\end{multicols}

By visually tracking the flow of particles on the wires, one can
verify that the expected types for commutativity are satisfied.

\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/swap_times_value.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
\includegraphics{diagrams/thesis/swap_plus_value.pdf}
}
\end{center}
\end{multicols}

\item The morphisms that witness that {{0}} and {{1}} are the additive and
  multiplicative units are represented as shown below. Note that since there
  is no value of type 0, there can be no particle on a wire of type {{0}}.
  Also since the monoidal units can be freely introduced and eliminated, in
  many diagrams they are omitted and dealt with explicitly only when they are
  of special interest.
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/identr1.pdf]
\includegraphics{diagrams/thesis/uniti.pdf}
}
\end{center}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/identl1.pdf]
\includegraphics{diagrams/thesis/unite.pdf}
}
\end{center}
\end{multicols}
\begin{multicols}{2}
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/identr0.pdf]
\includegraphics{diagrams/thesis/zeroi.pdf}
}
\end{center}
\columnbreak
\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/identl0.pdf]
\includegraphics{diagrams/thesis/zeroe.pdf}
}
\end{center}
\end{multicols}

\item Finally, distributivity and factoring are represented using the dual
  boxes shown below:
\begin{multicols}{2}
\begin{center}
  \includegraphics{diagrams/thesis/dist.pdf}
\end{center}
\begin{center}
  \includegraphics{diagrams/thesis/factor.pdf}
\end{center}
\end{multicols}

Distributivity and factoring are interesting because they represent
interactions between sum and pair types. Distributivity should
essentially be thought of as a multiplexer that redirects the flow of
{{v:b}} depending on what value inhabits the type {{b1+b2}}, as shown
below. Factoring is the corresponding adjoint operation.

\begin{multicols}{2}
\begin{center}
  \includegraphics{diagrams/thesis/dist-wire-value1.pdf}
\end{center}
\begin{center}
  \includegraphics{diagrams/thesis/dist-wire-value2.pdf}
\end{center}
\end{multicols}

\item Composition TODO.

  \begin{multicols}{2}
\dgm{c1c2_par_sum}
\dgm{c1c2_par_times}
  \end{multicols}
\dgm{c1c2_seq}

\end{itemize}

\noindent
\textit{Example.}  We use the type {{bool}} as a shorthand to denote
the type {{1+1}} and use {{left ()}} to be {{true}} and {{right ()}}
to be {{false}}. The following combinator is represented by the given
diagram:

{{c : b * bool <-> b + b}}

{{c = swap* (;) dist (;) (identl* (+) identl*)}}

\begin{center}
\scalebox{0.95}{
%%subcode-line{pdfimage}[diagrams/thesis/example1-crop.pdf]
\includegraphics{diagrams/thesis/example1.pdf}
}
\end{center}

%%%%%%%%%%%%%%%%%%%
\subsection{Semantics}

The operational semantics of {{Pi}} is summarized below (also see
\cite{infeffects}).  The semantics of the primitive combinators is
given by the following single-step reductions below. Since there are
no values of type {{0}}, the rules omit the impossible cases:
\begin{scriptsize}
%subcode{opsem} include main
%! columnStyle = rlcl
% swap+ & (left v) &|-->& right v
% swap+ & (right v) &|-->& left v
% assocl+ & (left v1) &|-->& left (left v1)
% assocl+ & (right (left v2)) &|-->& left (right v2)
% assocl+ & (right (right v3)) &|-->& right v3
% assocr+ & (left (left v1)) &|-->& left v1
% assocr+ & (left (right v2)) &|-->& right (left v2)
% assocr+ & (right v3) &|-->& right (right v3)
% identl* & ((), v) &|-->& v
% identr* & v &|-->& ((), v)
% swap* & (v1, v2) &|-->& (v2, v1)
% assocl* & (v1, (v2, v3)) &|-->& ((v1, v2), v3)
% assocr* & ((v1, v2), v3) &|-->& (v1, (v2, v3))
% dist & (left v1, v3) &|-->& left (v1, v3)
% dist & (right v2, v3) &|-->& right (v2, v3)
% factor & (left (v1, v3)) &|-->& (left v1, v3)
% factor & (right (v2, v3)) &|-->& (right v2, v3)
\end{scriptsize}
The operational semantics of the closure conditions are presented in
the usual big-step style.
\begin{scriptsize}
%subcode{proof} include main
%@ ~
%@@ id v |--> v
%
%@ c{dagger} v1 |--> v2
%@@ (sym c) v1 |--> v2
%
%@ c1  v1 |--> v
%@ c2  v |--> v2
%@@ (c1(;)c2)  v1 |--> v2
%---
%@ c1  v1 |--> v2
%@@ (c1 (+) c2)  (left v1) |--> left v2
%
%@ c2  v1 |--> v2
%@@ (c1 (+) c2)  (right v1) |--> right v2
%---
%@ c1  v1 |--> v3
%@ c2  v2 |--> v4
%@@ (c1 (*) c2)  (v1, v2) |--> (v3, v4)
\end{scriptsize}

The type safety of {{Pi}} follows directly from the correspondence
between inductive definitions of the types and the big-step
semantics. Previous work also established the following properties:

\begin{proposition}[Strong Normalizing]
\label{prop:termination-pi}
{{Pi}} computations always terminate.

{{forall. c:b1<->b2, v:b1, exists v':b2.}}
{{c v |--> v'}}
\end{proposition}

\begin{proposition}[Logical Reversibility]
\label{prop:logrev}
{{c v |--> v'}} iff
{{ c{dagger} v' |--> v}}
\end{proposition}

%%%%%%%%%%%%%%%%%%%
\subsection{Constructions}

\paragraph*{Booleans and Conditionals.}
Given any combinator {{c : b <-> b}} we can construct a combinator called
{{if_c : bool*b <->bool*b}} in terms of {{c}}, where {{if_c}} behaves like a
one-armed $\mathit{if}$-expression. If the supplied boolean is {{true}} then
the combinator {{c}} is used to transform the value of type~{{b}}. If the
boolean is {{false}}, then the value of type {{b}} remains unchanged. We can
write down the combinator for {{if_c}} in terms of {{c}} as
{{ dist (;) ((id (*) c) (+) id) (;) factor }}.

\noindent The diagram below shows the input value of type {{(1+1)*b}}
processed by the distribute operator {{dist}}, which converts it into a value
of type {{(1*b)+(1*b)}}. In the {{left}} branch, which corresponds to the
case when the boolean is {{true}} (i.e. the value was {{left ()}}), the
combinator~{{c}} is applied to the value of type~{{b}}. The right branch
which corresponds to the boolean being {{false}} passes along the value of
type {{b}} unchanged.

\begin{center}
\scalebox{1.0}{
%%subcode-line{pdfimage}[diagrams/if_c.pdf]
\includegraphics{diagrams/thesis/cnot.pdf}
}
\end{center}

The combinator {{if_{not} }} has type {{bool*bool<->bool*bool}} and
negates its second argument if the first argument is {{true}}. This
gate {{if_{not} }} is often referred to as the {{cnot}} gate. An
equivalent construction that is useful is {{else_{not} }} where we
negate the second argument only if the first is {{false}}.

Similarly, we can iterate the construction of {{if_c}} to check several
bits. The gate {{if_{cnot} }}, which we may also write as {{if^2_{not} }},
checks two booleans and negates the result wire only if they are both
{{true}}. The gate {{if^2_{not} }} is well known as the Toffoli gate and is a
universal reversible gate. We can generalize this construction to
{{if^n_{not} }} which checks {{n}} bits and negates the result wire only if
they are all {{true}}.

\paragraph*{Cloning.}
Although cloning is generally not allowed in reversible languages, it is
possible at the cost of having additional constant inputs. For example,
consider the gate {{else_{not} }}. Generally, the gate maps
{{(false,a)}} to {{(false,not a)}} and {{(true,a)}} to {{(true,a)}}. Focusing
on the cases in which the second input is {{true}}, we get that the gate maps
{{(false,true)}} to {{(false,false)}} and {{(true,true)}} to {{(true,true)}},
i.e., the gate clones the first input. A circuit of {{n}} parallel
{{else_{not} }} gates can hence clone {{n}} bits.  They also consume {{n}}
{{true}} inputs in the process.  Let us call this construction
{{clone^n_{bool} }}.

%%%%%%%%%%%%%%%%%
\subsection{Categorical Structure}

For the purpose of establishing equivalence of morphisms in the
categorical presentation we use the following notion of equality:

\begin{lemma}[{{c1  = c2}}]
We say {{c1 = c2}} if {{c1:b1<->b2}} and {{c2:b1<->b2}} and for all
{{v1:b}}, we have {{c1 v1 |--> v2}} iff {{c2 v1 |--> v2}} and {{v2:b2}}.
\end{lemma}

We present the categorical structure with minimum commentary. More
details may be found in excellent references such as Barr and Wells
[CITE] and Selinger \cite{springerlink:10.1007/978-3-642-12821-94}.

\begin{lemma}[{{Pi}} is a category]
  The category {{Pi}} has the types {{b}} as objects and equivalence
  classes of well-typed combinators {{b1<->b2}} as morphisms. One can
  check:
  \begin{enumerate}
  \item Every object {{b}} has an identity morphism {{id : b <->b}}.
  \item Composition {{g (o) f}} of morphisms {{f:b1 <->b2}} and
    {{g:b2<->b3}} is given by sequencing {{f (;) g}}.
  \item Associativity of composition follows from operational
    equivalence of {{f(;)(g(;)h)}} and {{(f(;)g)(;)h}} (where
    {{h:b3<->b4}}).

    Assuming {{v1:b1}}, {{v2:b2}}, {{v3:b3}}, {{v4:b4}},
    {{f~v1|-->v2}}, {{g v2 |--> v3}} and {{h~v3 |--> v4}}, one can
    check:

\vspace{-20pt}
    \begin{multicols}{2}
      \begin{scriptsize}

%subcode{proof} include main
%@@ f v1 |--> v2
%@ g v2 |--> v3
%@ h v3 |--> v4
%@@ g (;) h  v2 |--> v4
%@@@ f (;) (g (;) h) v1 |--> v4
~
%subcode{proof} include main
%@ f v1 |--> v2
%@ g v2 |--> v3
%@@ f (;) g v1 |--> v3
%@@ h v3 |--> v4
%@@@ (f (;) g) (;) h v1 |--> v4

      \end{scriptsize}
    \end{multicols}

  \item Composition respects identity: {{id (;) f = f}} and {{g(;)id=g}}.
  \end{enumerate}
\end{lemma}

\begin{lemma}[Dagger]
  {{Pi}} is a dagger category, where every morphism {{f : b1<->b2}}
  has the adjoint {{f^{dagger}:b2 <->b1}}. The following properties
  hold (where {{g : b2 <-> b3}}):
  \begin{enumerate}
  \item {{id^{dagger} = id : b <-> b}}.
  \item {{(f (;) g)^{dagger} = g^{dagger} (;) f^{dagger}: b3 <-> b1}}.
  \item {{f^{dagger dagger} = f : b1 <-> b2}}.
  \end{enumerate}
\end{lemma}

\begin{lemma}[Symmetric Monoidal (+, 0)]
  {{Pi}} is a symmetric monoidal category with tensor {{+}} and
  monoidal unit {{0}}. The monoidal operation on morphisms is the
  additive composition of combinators {{c1 (+) c2}}.

  \begin{proof}
    To establish that category is monoidal one must show isomorphisms
    \begin{enumerate}
    \item {{b1 + (b2 + b3) <-> (b1 +b2) + b3}} given by {{assocl+}}.
    \item {{0 + b <-> b}} given by {{zeroe}}.
    \item {{b + 0 <-> b}} given by {{swap+ (;) zeroe}}.
    \item We need to check that {{+}} is a bifunctor.
      \begin{enumerate}
      \item {{id_{b1<->b1}(+)id_{b2<->b2} = id_{b1+b2<->b1+b2} }}.
      \item {{(f(+)g)(;)(j(+)k) = (f (;) j) (+) (g (;) k)}}.
      \end{enumerate}
    \item We need to check the naturality of {{assocl+}}, {{zeroe}} and
      {{swap+(;)zeroe}}.
      \begin{enumerate}
      \item {{assocl+ (;) ((f (+)g) (+) h) = (f (+)(g (+) h)) (;) assocl+}}.
      \item {{zeroe (;) f = (id (+) f) (;) zeroe}}.
      \item {{(swap+ (;) zeroe) (;) f = (f (+) id) (;) (swap+ (;) zeroe)}}.
      \end{enumerate}
    \item Satisfy certain coherence conditions which are usually
      called the ``pentagon'' and ``triangle'' axioms (see Sec 3.1
      \cite{springerlink:10.1007/978-3-642-12821-94})
    \end{enumerate}

    The last three points require checking equality of combinators by
    writing out their derivation trees as we did in the case of
    associativity of sequential composition. To show symmetry, we need
    a braiding operation {{b1+b2 <-> b2+b1}} which is given by
    {{swap+}} (see Sec. 3.3 and 3.5
    \cite{springerlink:10.1007/978-3-642-12821-94}).

    \begin{enumerate}
    \item The braiding must satisfy two ``hexagon'' axioms.
    \item The braiding is self inverse,
      {{swap+_{b1+b2}=(swap+_{b2+b1})^{dagger} }}.
    \end{enumerate}

  \end{proof}

\end{lemma}

\begin{lemma}[Symmetric Monoidal {{(*, 1)}}]
  {{Pi}} is a symmetric monoidal category over the tensor {{*}} and
  unit {{1}}. The details mirror those of the {{(0, +)}} monoid.
\end{lemma}

\noindent
Some technical and pedantic comments are due at this point.

\begin{itemize}
\item We have established the categorical structure of {{Pi}} as a
  dagger symmetric monoidal category with two monoidal structures,
  {{(0, +)}} and {{(*, 1)}}. In Sec. \ref{sec:int} we will see that a
  {{trace}} operator can be admitted in this category without any
  change of expressiveness.

\item To be pedantic, what we have shown is that the ``term model'' of
  {{Pi}} that follows from the extensional operational equality of
  combinators has the requisite categorical structure. A consequence
  is that the ``wiring diagrams'' of {{Pi}} correspond closely with ``string
  diagrams'' developed for categories.

  To establish the later rigorously, we will need to show when it is
  valid to slide one wire over the other and that equivalent diagrams
  for syntactically different combinators such as
  {{(f(+)g)(;)(j(+)k)}} and {{(f(;)j)(+)(g(;)k)}} do respect
  operational equivalence.  We don't formalize the graphical notation
  in this work. Joyal et. al's work on ``planar isotopy'' and
  Selinger's survey \cite{springerlink:10.1007/978-3-642-12821-94}
  show how this has been addressed before in the categorical
  setting. In the absence of any prior knowledge of category theory
  however, our wiring diagrams may be read as the ``flow of types'' in
  a combinator-circuit.

\item By definition, in {{Pi}} every morphism is an isomorphism --
  this makes {{Pi}} a groupoid.

\item The category {{Pi}} has no initial and terminal objects. The
  objects {{0}} and {{1}} would be initial and terminal if we admitted
  all functions (as in the category {{CatSet}}).

\item The category {{Pi}} has neither categorical products, nor
  categorical co-products, i.e. {{*}} and {{+}} are merely monoidal
  tensors. This follows from the fact that injection and projection
  maps are not isomorphisms.
\end{itemize}

While we don't do so in this work, if we extend {{Pi}} with products
and co-products (say through the addition of information effects) it
is conceivable that part of its structure collapses. This sort of
collapse, while catastrophic for algebraic structures (effectively
trivializing them), still retains some interest in computing, because
in computing we are interested in the specific operational nature (the
computational content, so to speak) of the morphisms. Anecdotal evidence
follows from the fact several real-world programming language have
inconsistent type systems. blah blah blah...

%%%%%%%%%%%%%
\subsection{Small Step Semantics}

The reductions for the primitive isomorphisms above are exactly the same as
have been presented before~\cite{infeffects}. The reductions for the closure
combinators are however presented in a small-step operational style using the
following definitions of evaluation contexts and machine states:

\begin{scriptsize}
%subcode{bnf} include main
% Combinator Contexts, C = [] | Fst C c | Snd c C
%                  &|& LeftT C c v | RightT c v C
%                  &|& LeftP C c | RightP c C
% Machine states = <c, v, C> | {[c, v, C]}
% Start state = <c, v, []>
% Stop State = {[c, v, []]}
\end{scriptsize}
The machine transitions below track the flow of particles through a
circuit. The start machine state, {{<c,v,[]>}}, denotes the
particle~{{v}} about to be evaluated by the circuit {{c}}. The end
machine state, {{[c, v, [] ]}}, denotes the situation where the particle
{{v}} has exited the circuit {{c}}.

\begin{scriptsize}
%subcode{opsem} include main
%! columnStyle = rclr
% <iso, v, C> &|-->& {[iso, v', C]} & (1)
% & & where iso v |--> v' &
% <c1(;)c2, v, C> &|-->& <c1, v, Fst C c2> & (2)
% {[c1, v, Fst C c2]} &|-->& <c2, v, Snd c1 C> & (3)
% {[c2, v, Snd c1 C]} &|-->& {[ c1(;)c2, v, C ]} & (4)
% <c1(+)c2, left v, C> &|-->& <c1, v, LeftP C c2> & (5)
% {[ c1, v, LeftP C c2 ]} &|-->& {[c1 (+) c2, left v, C ]} & (6)
% <c1(+)c2, right v, C> &|-->& <c2, v, RightP c1 C> & (7)
% {[ c2, v, RightP c1 C ]} &|-->& {[c1 (+) c2, right v, C ]} & (8)
% <c1(*)c2, (v1, v2), C> &|-->& <c1, v1, LeftT C c2 v2> & (9)
% {[ c1, v1, LeftT C c2 v2 ]} &|-->& <c2, v2, RightT c1 v1 C> & (10)
% {[ c2, v2, RightT c1 v1 C ]} &|-->& {[ c1 (*) c2, (v1, v2), C ]} & (11)
\end{scriptsize}
Rule (1) describes evaluation by a primitive isomorphism. Rules (2), (3) and
(4) deal with sequential evaluation. Rule (2) says that for the value {{v}}
to flow through the sequence {{c1 (;) c2}}, it should first flow through
{{c1}} with {{c2}} pending in the context ({{Fst C c2}}). Rule (3) says the
value {{v}} that exits from {{c1}} should proceed to flow
through~{{c2}}. Rule (4) says that when the value {{v}} exits {{c2}}, it also
exits the sequential composition {{c1(;)c2}}. Rules (5) to (8) deal with
{{c1 (+) c2}} in the same way. In the case of sums, the shape of the value,
i.e., whether it is tagged with {{left}} or {{right}}, determines whether
path {{c1}} or path {{c2}} is taken. Rules (9), (10) and (11) deal with
{{c1 (*) c2}} similarly. In the case of products the value should have the
form {{(v1, v2)}} where {{v1}} flows through {{c1}} and {{v2}} flows through
{{c2}}. Both these paths are entirely independent of each other and we could
evaluate either first, or evaluate both in parallel. In this presentation we
have chosen to follow {{c1}} first, but this choice is entirely arbitrary.

The interesting thing about the semantics is that it represents a reversible
abstract machine. In other words, we can compute the start state from the
stop state by changing the reductions {{|-->}} to run backwards
{{<--|}}. When running backwards, we use the isomorphism represented by a
combinator {{c}} in the reverse direction, i.e., we use the adjoint
{{c{dagger}}}.

\begin{proposition}[Correspondence]
  Evaluation in the small-step evaluator corresponds to evaluation in
  the natural semantics.

  {{c v |--> v'}} iff {{<c, v, []> |-->* [c', v', [] ]}}
\end{proposition}
\begin{proof}
  To prove the above, we first show that a more general lemma holds,
  namely that: {{c v |--> v'}} iff {{<c, v, C> |-->* [c', v', C ]}}.

  To show the left-to-right direction we proceed by induction on the
  derivation of {{c v |--> v'}}. In the case of primitive isomorphisms
  the condition holds trivially. In the case of composition, we work
  out the case of {{c1+c2}} as an example. Given {{c1 +c2 v |--> v'}}
  we have to show that there is a small step derivation sequence that
  matches it. Here {{v:b1+b2}} can be of the form {{left v1}} or
  {{right v2}}. Assuming {{left v1}}, we have:

%subcode{proof} include main
%@ c1 v1 |--> v1' ==> <c1, v1, C'> |-->* {[c1',v1',C']}
%@@ c1+c2 (left v1) |--> left v1' ==> ?

Choosing {{C' =Lft c2 C}}, we have the required derivation sequence:
{{ <c1+c2, left v1, C> |--> <c1,v1,LeftP c2 C> |-->* {[c1',v1', LeftP c2 C]} |--> {[c1'+c2,left v1',C]} }}. The proof follows similarly for the {{right v2}} case.

To show the right-to-left direction we proceed by induction of the
sequence of {{|-->*}} derivations. Again the case for primtive
isomorphisms follows trivially. Taking the case of {{c1+c2}} we are
required to show that given a sequence
{{<c1+c2,v,C> |-->* {[c', v', C]} }} there is a derviation tree for
{{c1+c2 v |--> v'}}. In the case that {{v:v1+b2}} has the form
{{left~v1}}, this follows by observing that the given sequence must have the form
{{ <c1+c2, left v1, C> |--> <c1,v1,LeftP c2 C> |-->* {[c1',v1', LeftP c2 C]} |--> {[c1'+c2,left v1',C]} }}.
For the strictly smaller inner subsequence by induction we have
{{c1~v1 |--> v1'}} which lets us complete the derivation of
{{c1+c2~(left v1) |--> left v1'}}. The {{right v2}} follows similarly.

\end{proof}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{small}
\bibliographystyle{abbrvnat}
\bibliography{cites}
\end{small}

\end{document}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%


\documentclass[a4paper,oneside,11pt]{report}
\usepackage[cm]{fullpage}
\usepackage{lmodern,amsmath,amssymb}
\usepackage{a4wide}
\setlength{\marginparwidth}{3cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}
\title{Modeling Durotaxis using Mechanical Bidomain model}
\author{Prof Brad Roth, Debabrata Auddya}
%\usepackage{etoolbox}
%\preto\equation{\setcounter{equation}{0}}
%\makeatletter
%\pretocmd\start@gather{\setcounter{equation}{0}}{}{}
%\pretocmd\start@align{\setcounter{equation}{0}}{}{}
%\pretocmd\start@multline{\setcounter{equation}{0}}{}{}
%\makeatother
\usepackage{listings}
\usepackage{color}
\usepackage{dsfont}
\usepackage{footmisc}
\usepackage{verbatim}
\usepackage{smartdiagram}
\setlength{\marginparwidth}{0cm}
\setlength{\topmargin}{0cm}
\setlength{\voffset}{0cm}
\setlength{\headsep}{0cm}
\definecolor{dkgreen}{rgb}{0,0.6,0}
\definecolor{gray}{rgb}{0.5,0.5,0.5}
\definecolor{mauve}{rgb}{0.58,0,0.82}

\lstset{frame=tb,
	language=Java,
	aboveskip=3mm,
	belowskip=3mm,
	showstringspaces=false,
	columns=flexible,
	basicstyle={\small\ttfamily},
	numbers=none,
	numberstyle=\tiny\color{gray},
	keywordstyle=\color{blue},
	commentstyle=\color{dkgreen},
	stringstyle=\color{mauve},
	breaklines=true,
	breakatwhitespace=true,
	tabsize=3
}
\begin{document}
\maketitle
\section*{Analytical treatment - 10/03/2018}
The equations formulated below consider a gradient in the extracellular stiffness in a 1-d strand of tissue using the mechanical bidomain model. \\

Consider $u_{x}$ and $w_{x}$ as the intra- and extra-cellular displacements of the bidomain layer. x being the principal direction of the one-dimensional tissue strand, T being the tension, p and q being the intra- and extra-cellular pressure contributions arising mostly from hydrostatic forces. \\

The standard equations of the bidomain model are as follows \cite{roth2012}:
\begin{align}
-\frac{\partial p}{\partial x} + \nu(\frac{\partial^{2}u_x}{\partial x^2} + \frac{\partial^{2}u_x}{\partial y^2} ) + \gamma\frac{\partial^{2}u_x}{\partial x^2} + \frac{\partial T}{\partial x} = K(u_x - w_x) \\
-\frac{\partial q}{\partial x} + \mu(\frac{\partial^{2}w_x}{\partial x^2} + \frac{\partial^{2}w_x}{\partial y^2} ) = -K(u_x - w_x)
\end{align}
For this problem we consider:
\begin{itemize}
\item $\mu = \mu_0 + gx$
\item No contributions along the y axis
\item p,q and T are constant and hence their gradients are zero along the x axis
\item Slope of $\mu$ is a constant
\item K is same for intra- and extra-cellular displacements
\end{itemize}
\begin{align}
    \nu\frac{\partial^{2}u_x}{\partial x^2} + \gamma\frac{\partial^{2}u_x}{\partial x^2} = K(u_x - w_x)  \\
    \mu_0\frac{\partial^{2}w_x}{\partial x^2} + gx\frac{\partial^{2}w_x}{\partial x^2} = -K(u_x - w_x)
\end{align}
Simplifying the above expression, replacing $u_x$ in equation (2) from (1):
\begin{align}
   u_x = w_x + \frac{\nu}{K}\frac{\partial^{2}u_x}{\partial x^2} + \frac{\gamma}{K}\frac{\partial^{2}u_x}{\partial x^2} + \gamma\frac{\partial^{2}u_x}{\partial x^2} \\
   \therefore \frac{\mu_0}{K}\frac{\partial^{2}w_x}{\partial x^2} + x\frac{g}{k}\frac{\partial^{2}w_x}{\partial x^2} = - ( \frac{\nu}{K}\frac{\partial^{2}u_x}{\partial x^2} + \frac{\gamma}{K}\frac{\partial^{2}u_x}{\partial x^2} )
\end{align}
Final form the equation can be written as:
\begin{align}
\frac{\partial^{2}w_x}{\partial x^2} (\frac{\mu_0}{K} + \frac{gx}{K}) + \frac{\partial^{2}u_x}{\partial x^2} (\frac{\nu}{K} + \frac{\gamma}{K} ) = 0
\end{align}
\clearpage
\section*{Analytical treatment - 10/04/2018}
The equations formulated below consider a gradient in the extracellular stiffness in a 1-d strand of tissue using the mechanical bidomain model. \\

Consider $u_{x}$ and $w_{x}$ as the intra- and extra-cellular displacements of the bidomain layer. x being the principal direction of the one-dimensional tissue strand, T being the tension, p and q being the intra- and extra-cellular pressure contributions arising mostly from hydrostatic forces. \\

The intra and extra-cellular stresses arising in the 1-d strand of tissue can be expressed as \cite{roth2015}:
\begin{align}
\tau_{ix} = -p + 2\nu\epsilon_{ix} + T \\
\tau_{ex} = -q + 2\mu(x)\epsilon_{ex}
\end{align}
Relationship between the strains and displacement can be written as:
\begin{align}
\frac{\partial\tau_{ix}}{\partial x} = K (u_x - w_x) \\
\frac{\partial\tau_{ex}}{\partial x} = - K (u_x - w_x)
\end{align}
Using equation (8) and (9) in (10) and (11) the resulting intra- and extra-cellular equations are:
\begin{align}
\frac{\partial}{\partial x}(-p + 2\nu\frac{\partial u_x}{\partial x}) = K (u_x - w_x) \\
\frac{\partial}{\partial x}(-q + 2\mu (x) \frac{\partial w_x}{\partial x}) = -K (u_x - w_x)
\end{align}
For the problem we have assumed $\mu = \mu_0 + gx$ , where g is a constant. Rewriting (12) and (13) we have:
\begin{align}
- \frac{\partial p}{\partial x} + 2\nu\frac{\partial^{2}u_x}{\partial x^2} = K (u_x - w_x) \\
- \frac{\partial q}{\partial x} + 2(g\frac{\partial w_x}{\partial x} + \frac{\partial^{2}w_x}{\partial x^2} \mu(x)) = -K(u_x - w_x)
\end{align}
\clearpage
\section*{Analytical treatment - 11/13/2018}
In order to obtain an analytical solution for the problem initially we consider g = 0. The boundary limits of the 1-dimensional problem assume the length of the domain spanning form x=-L to x=+L. The stresses are taken to be zero at each of the boundaries. We begin by implementing a trial solution for $u_x$ and $w_x$.
\begin{align}
u_x = Ax + Bsinh \Big ( \frac{x}{\sigma} \Big )\\
w_x = Cx + Dsinh \Big ( \frac{x}{\sigma} \Big )
\end{align}
For estimating the values of A,B,C,D we assume additionally p=q=0.
Rewriting (12):
\begin{align}
2\nu\frac{\partial^{2}}{\partial x^2}\Big ( Ax + Bsinh\Big ( \frac{x}{\sigma} \Big ) \Big ) = K \Big ( Ax + Bsinh \Big ( \frac{x}{\sigma} \Big ) - Cx - Dsinh \Big ( \frac{x}{\sigma} \Big )  \Big )\\
2\nu\frac{\partial}{\partial x} \Big ( A + \frac{B}{\sigma}cosh\Big ( \frac{x}{\sigma} \Big ) \Big ) = K \Big ((A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big ) )\\
2\nu\frac{B}{\sigma^2} sinh\Big ( \frac{x}{\sigma} \Big ) = K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )
\end{align}
and (13)
\begin{align}
2\mu(x)\frac{\partial^{2}}{\partial x^2}\Big ( Cx + Dsinh\Big ( \frac{x}{\sigma} \Big ) \Big ) = -K \Big ( Ax + Bsinh \Big ( \frac{x}{\sigma} \Big ) - Cx - Dsinh \Big ( \frac{x}{\sigma} \Big )  \Big )\\
2\mu(x)\frac{\partial}{\partial x} \Big ( C + \frac{D}{\sigma}cosh\Big ( \frac{x}{\sigma} \Big ) \Big ) = -K \Big ((A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big ) )\\
2\mu(x)\frac{D}{\sigma^2} sinh\Big ( \frac{x}{\sigma} \Big ) = -K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )
\end{align}
From (20) and (23) we have:
\begin{align}
D = -\frac{\nu}{\mu(x)} B
\end{align}
Comparing coefficients of hyperbolic sine terms we see that (20) and (23) is satisfied only when the coefficient of the linear term is zero. Therefore,
\begin{align}
A = C
\end{align}
Hence the length constant\footnote{This might also be a variable since $\mu$ is a function of x for the problem} $\sigma$ has the value\footnote{$\mu(x)$ is also written as $\mu$}
\begin{equation}
\begin{aligned}
\sigma = \sqrt{\frac{2\nu\mu}{K(\nu + \mu)}}
\end{aligned}
\end{equation}
To obtain the values of the unknown parameters B and C, we impose boundary conditions. At the edge (x = $\pm$L) we have, normal stresses $\tau_{ix}$ and $\tau_{ex}$ as zero. As a result we get,
\begin{align}
C + \frac{D}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) = 0\\
A + \frac{B}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) = -\frac{T}{2\nu}
\end{align}
Solving (27) and (28) using (24)-(26) we have:
\begin{align}
A = C = -\frac{T}{2(\nu + \mu)}\\
B = -\frac{T}{2\nu}\Big ( \frac{\mu}{\nu + \mu} \Big )\frac{\sigma}{cosh(\frac{L}{\sigma})}\
, D = \frac{T}{2(\mu + \nu)}\frac{\sigma}{cosh(\frac{L}{\sigma})}
\end{align}
Using this we get the intra and extracellular displacement in terms of T as:
\begin{align}
u_x = -\frac{T}{2(\nu + \mu)} \Big ( x + \frac{\mu}{\nu} \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )\\
w_x = -\frac{T}{2(\nu + \mu)} \Big ( x - \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )
\end{align}
Since $\mu$ is variable for the problem we now write it as: $\mu = \mu_0 + gx$. Remaining derivation of $u_x$ and $w_x$ along with its derivatives and double derivatives has been attached separately.
\newpage
\section*{Analytical treatment - 12/22/2018}
We are considering plane stress conditions for the model. Nothing depends on y.
\begin{align*}
\tau_{exx} = -q + 2\mu\epsilon_{exx} \\
\tau_{eyy} = -q \\
\tau_{ezz} = -q + 2\mu\epsilon_{ezz} \\
\end{align*}
Since $\tau_{ezz}$  = 0 so
\begin{align*}
-q + 2\mu\epsilon_{ezz} = 0
\end{align*}
or, $q=2\mu\epsilon_{ezz}$, but, $\epsilon_{exx} + \epsilon_{ezz} = 0$, so
\begin{align*}
q=-2\mu\epsilon_{exx}
\end{align*}
Therefore the stresses along the principal directions can be written as:
\begin{align*}
\tau_{exx} = 4\mu\epsilon_{exx} \hspace{0.5cm} \tau_{eyy} = 2\mu\epsilon_{exx}\hspace{0.5cm} \tau_{ezz}=0\hspace{0.5cm}\tau_{exy}=0
\end{align*}
The final partial differential form of the equations look like:
\begin{align*}
\frac{\partial\tau_{exx}}{\partial x} + \frac{\partial\tau_{exy}}{\partial y} = -K(u_x - w_x) \\
or, \hspace{0.5cm}4\Big ( \frac{\partial \mu}{\partial x}\epsilon_{exx}  + \mu \frac{\partial \epsilon_{exx}}{\partial x}\Big ) = -K(u_x - w_x)
\end{align*}
For the intracellular layer the principal stress is the same except that Tension T along the principal direction (x) is also taken into account. Thus the final set of working equations are, considering $\mu$ has a gradient along x and $\nu$ is a constant for the problem.
\[\boxed{\!\begin{aligned}
	&4\mu\frac{\partial^2 w}{\partial x^2} + 4\frac{\partial w}{\partial x}\frac{\partial \mu}{\partial x} = -K(u_x - w_x) \\
 &4\nu\frac{\partial^2 u}{\partial x^2} = K(u_x - w_x)
\end{aligned}
}
\]
\section*{$\mu$ = constant }
\[\boxed{\!\begin{aligned}
	&4\mu\frac{\partial^2 w}{\partial x^2} = -K(u_x - w_x) \\
	&4\nu\frac{\partial^2 u}{\partial x^2} = K(u_x - w_x)
	\end{aligned}
}
\]
The stresses are taken to be zero at each of the boundaries. We begin by implementing a trial solution for $u_x$ and $w_x$.
\begin{align*}
u_x = Ax + Bsinh \Big ( \frac{x}{\sigma} \Big )\\
w_x = Cx + Dsinh \Big ( \frac{x}{\sigma} \Big )
\end{align*}
For estimating the values of A,B,C,D we assume:
Rewriting (12):
\begin{align*}
4\nu\frac{\partial^{2}}{\partial x^2}\Big ( Ax + Bsinh\Big ( \frac{x}{\sigma} \Big ) \Big ) = K \Big ( Ax + Bsinh \Big ( \frac{x}{\sigma} \Big ) - Cx - Dsinh \Big ( \frac{x}{\sigma} \Big )  \Big )\\
4\nu\frac{\partial}{\partial x} \Big ( A + \frac{B}{\sigma}cosh\Big ( \frac{x}{\sigma} \Big ) \Big ) = K \Big ((A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big ) )\\
4\nu\frac{B}{\sigma^2} sinh\Big ( \frac{x}{\sigma} \Big ) = K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )
\end{align*}
and (13)
\begin{align*}
4\mu(x)\frac{\partial^{2}}{\partial x^2}\Big ( Cx + Dsinh\Big ( \frac{x}{\sigma} \Big ) \Big ) = -K \Big ( Ax + Bsinh \Big ( \frac{x}{\sigma} \Big ) - Cx - Dsinh \Big ( \frac{x}{\sigma} \Big )  \Big )\\
4\mu(x)\frac{\partial}{\partial x} \Big ( C + \frac{D}{\sigma}cosh\Big ( \frac{x}{\sigma} \Big ) \Big ) = -K \Big ((A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big ) )\\
4\mu(x)\frac{D}{\sigma^2} sinh\Big ( \frac{x}{\sigma} \Big ) = -K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )
\end{align*}
From (20) and (23) we have:
\begin{align}
D = -\frac{\nu}{\mu} B
\end{align}
Comparing coefficients of hyperbolic sine terms we see that (20) and (23) is satisfied only when the coefficient of the linear term is zero. Therefore,
\begin{align}
A = C
\end{align}
Length constant $\sigma$ remains as:
\begin{align}
	\sigma = \sqrt{\frac{4\nu\mu}{K(\nu + \mu)}}
\end{align}
To obtain the values of the unknown parameters B and C, we impose boundary conditions. At the edge (x = $\pm$L) we have, normal stresses $\tau_{ix}$ and $\tau_{ex}$ as zero. As a result we get,
\begin{align}
C + \frac{D}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) = 0\\
A + \frac{B}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) = -\frac{T}{4\nu}
\end{align}
Solving the equations using given by (33) - (35) and using them in (36) and (37) we have:
Solving (27) and (28) using (24)-(26) we have:
\begin{align}
A = C = -\frac{T}{4(\nu + \mu)}\\
B = -\frac{T}{4\nu}\Big ( \frac{\mu}{\nu + \mu} \Big )\frac{\sigma}{cosh(\frac{L}{\sigma})}\
, D = \frac{T}{4(\mu + \nu)}\frac{\sigma}{cosh(\frac{L}{\sigma})}
\end{align}
Using this we get the intra and extracellular displacement in terms of T as:
\begin{align}
u_x = -\frac{T}{4(\nu + \mu)} \Big ( x + \frac{\mu}{\nu} \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )\\
w_x = -\frac{T}{4(\nu + \mu)} \Big ( x - \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )
\end{align}
\section*{$\mu = \mu_0$ + gx }
For this condition the set of equations which we need to consider for obtaining an analytical solution are:
\begin{align}
4\mu\frac{\partial^2 w}{\partial x^2} + 4\frac{\partial w}{\partial x}\frac{\partial \mu}{\partial x} = -K(u_x - w_x) \\
4\nu\frac{\partial^2 u}{\partial x^2} = K(u_x - w_x)
\end{align}
Replacing unknowns term by term from the previous solutions and given data we have an expression for the difference between $u_x$ and $w_x$:
%\begin{align*}
\[\boxed{\frac{-4}{K}(\mu_0 + gx )\frac{\partial^2}{\partial x^2}\Bigg( -\frac{T}{4(\nu + \mu)} \Big ( x - \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )\Bigg) - \frac{4g}{K}\frac{\partial}{\partial x}\Bigg( -\frac{T}{4(\nu + \mu)} \Big ( x - \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )\Bigg)}\]
%\end{align*}
\section*{Mathematica Code}
The code below returns the value of the above expression. f(x) returns the value of $u_x - w_x$
\begin{lstlisting}
sigma[x_] = ((4*(muz + gx)*nu)/(K*(nu+muz+gx)))^0.5
g[x_] = -(Tx/(4*(nu+muz+gx))) + ((T*sigma[x_]*sinh[x/sigma[x]])/(4*(nu+muz+gx)*cosh[L/sigma[x]]))
g'[x_]
g''[x_]
f[x_] = (-4/K)*(muz+gx)*g''[x] + (-4*g/K)*g'[x]
\end{lstlisting}
\newpage
\section*{Analytical treatment - 12/28/2018}
We assume the trial solution for $u_x$ and $w_x$ for the given problem as:
\begin{align}
u_x = Ax + Bsinh \Big ( \frac{x}{\sigma} \Big )\\
w_x = Cx + Dsinh \Big ( \frac{x}{\sigma} \Big )
\end{align}
Additionally the extracellular gradient is taken as $\mu = \mu_0 + gx$. The final set of working equations are taken as:
\[\boxed{\!\begin{aligned}
	&4\mu\frac{\partial^2 w}{\partial x^2} + 4\frac{\partial w}{\partial x}\frac{\partial \mu}{\partial x} = -K(u_x - w_x) \\
	&4\nu\frac{\partial^2 u}{\partial x^2} = K(u_x - w_x)
	\end{aligned}
}
\]
Replacing the values for u and w with that of (44)-(45) we have
\begin{align}
4(\mu_0 + gx)\frac{D}{\sigma^2}sinh(\frac{x}{\sigma}) + 4g(C + \frac{D}{\sigma}cosh(\frac{x}{\sigma})) = -K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )\\
4\nu\frac{B}{\sigma^2}sinh(\frac{x}{\sigma}) = K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )
\end{align}
Using boundary conditions on $\epsilon_{exx} = 0$ at x=L (Since we have $\tau_{exx} = 0$ at x=$\pm$L )
\begin{align*}
\frac{\partial w}{\partial x} = 0\\
\therefore \hspace{0.5cm}
C + \frac{D}{\sigma}cosh(\frac{x}{\sigma}) = 0\\
\end{align*}
Plugging the above result in equation (46) and (47) we have:
\begin{align*}
(\mu_0 + gx)\frac{D}{\sigma^2}sinh(\frac{L}{\sigma}) = -\nu\frac{B}{\sigma^2}sinh(\frac{L}{\sigma})
\end{align*}
\[\boxed{
D = -\frac{\nu}{\mu_0 + gL} B
}
\]
For finding relation between A and C we manipulate equation (47) with the relationship between B and D
\begin{align*}
4\nu\frac{B}{\sigma^2}sinh(\frac{x}{\sigma}) = K \Big ( (A - C)x + (B - D)sinh\Big ( \frac{x}{\sigma} \Big )\Big )\\
\textit{or,} \hspace{0.35cm} 4\nu\frac{B}{\sigma^2}sinh\Big (\frac{x}{\sigma} \Big ) - K (B - D)sinh\Big ( \frac{x}{\sigma} \Big ) = K (A - C)x \\
\textit{or,} \hspace{0.35cm} sinh \Big( \frac{x}{\sigma}\Big ) \Big( \frac{4\nu B}{\sigma^2 } - K(B + \frac{B\nu}{\mu_0 + gL}) \Big ) = K (A - C)x
\end{align*}
\[\boxed{
A - C = \frac{B}{Kx} sinh \Big( \frac{x}{\sigma}\Big ) \Big( \frac{4\nu }{\sigma^2 } - K(1+ \frac{\nu}{\mu_0 + gL}) \Big )
}
\]
To obtain the values of the unknown parameters B and C, we impose boundary conditions. At the edge (x = $\pm$L) we have, normal stresses $\tau_{ix}$ and $\tau_{ex}$ as zero. Rewriting it, we have,
\begin{align}
C + \frac{D}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) = 0\\
A + \frac{B}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) = -\frac{T}{4\nu}
\end{align}
Subtracting (49) - (48) we have:
\begin{align}
(A - C) + (\frac{B - D}{\sigma})cosh\Big ( \frac{L}{\sigma} \Big ) = -\frac{T}{4\nu}
\end{align}
Plugging in A - C and B,D relationship in the equation we have:
\begin{align*}
\frac{B}{Kx} sinh \Big( \frac{x}{\sigma}\Big ) \Big( \frac{4\nu }{\sigma^2 } - K(1+ \frac{\nu}{\mu_0 + gL}) \Big ) + \frac{1}{\sigma}\Big (B + \frac{B\nu}{\mu_0 + gL}\Big )cosh\Big ( \frac{L}{\sigma} \Big ) = -\frac{T}{4\nu}
\end{align*}
However we have to replace x in the above equation with L as we have been using boundary conditions in (48) - (49). The final form is: (taking out B common in the expression)
\begin{align}
\textbf{B} = -\frac{T}{4\nu} \Bigg ( \frac{1}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma^2 L} - \frac{K}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big (  \frac{1}{\sigma} (1+ \frac{\nu}{\mu_0 + gL}) \Big )} \Bigg)
\end{align}
The value of D can be computed using its relationship with B which is $D = -\frac{\nu}{\mu_0 + gL} B$
\begin{align}
\textbf{D} = \frac{T}{4(\mu_0 + gL)} \Bigg ( \frac{1}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma^2 L} - \frac{K}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big (  \frac{1}{\sigma} (1+ \frac{\nu}{\mu_0 + gL}) \Big )} \Bigg)
\end{align}
The value of C can be computed from (48) as $C = -\frac{D}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big )$
\begin{align}
\textbf{C} = -\frac{T}{4(\mu_0 + gL)} \Bigg ( \frac{cosh\Big ( \frac{L}{\sigma} \Big )}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( 1+ \frac{\nu}{\mu_0 + gL} \Big )} \Bigg)
\end{align}
The value of A can be obtained from (49) as $A = -\frac{B}{\sigma}cosh\Big ( \frac{L}{\sigma} \Big ) -\frac{T}{4\nu}$
\begin{align*}
\textbf{A} = -\frac{T}{4(\nu)} \Bigg ( 1 - \frac{cosh\Big ( \frac{L}{\sigma} \Big )}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( 1+ \frac{\nu}{\mu_0 + gL} \Big )} \Bigg)
\end{align*}
\begin{align}
\therefore \hspace{0.35cm}
\textbf{A} = -\frac{T}{4\nu} \Bigg ( \frac{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( \frac{\nu}{\mu_0 + gL} \Big )}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( 1+ \frac{\nu}{\mu_0 + gL} \Big )} \Bigg)
\end{align}
Thus the value of of $u_x$ is:
\begin{align*}
u_x = -\frac{T}{4(\nu)} \Bigg ( \frac{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( \frac{\nu}{\mu_0 + gL} \Big )}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( 1+ \frac{\nu}{\mu_0 + gL} \Big )} \Bigg)\textbf{x} \\ -\frac{T}{4\nu} \Bigg ( \frac{1}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma^2 L} - \frac{K}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big (  \frac{1}{\sigma} (1+ \frac{\nu}{\mu_0 + gL}) \Big )} \Bigg) \textbf{sinh} \Big ( \frac{x}{\sigma} \Big )\\
\end{align*}
The value of $w_x$ is:
\begin{align*}
w_x = -\frac{T}{4(\mu_0 + gL)} \Bigg ( \frac{cosh\Big ( \frac{L}{\sigma} \Big )}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma L} - \frac{K \sigma}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big ( 1+ \frac{\nu}{\mu_0 + gL} \Big )} \Bigg)\textbf{x} + \\
\frac{T}{4(\mu_0 + gL)} \Bigg ( \frac{1}{sinh \Big( \frac{L}{\sigma}\Big ) \Big ( \frac{4\nu}{\sigma^2 L} - \frac{K}{L} (1+ \frac{\nu}{\mu_0 + gL}) \Big ) + cosh\Big ( \frac{L}{\sigma} \Big ) \Big (  \frac{1}{\sigma} (1+ \frac{\nu}{\mu_0 + gL}) \Big )} \Bigg)\textbf{sinh} \Big ( \frac{x}{\sigma} \Big )
\end{align*}
\section*{Issues}
Need some insights for calculating the length constant $\sigma$
\newpage
\section*{Perturbation Theory - 1/22/2019}
The following result has been obtained using first order perturbation to obtain approximate analytical solutions.\\
\begin{align*}
u_0 = -\frac{T}{4(\nu + \mu)} \Big ( x + \frac{\mu}{\nu} \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )\\
w_0 = -\frac{T}{4(\nu + \mu)} \Big ( x - \sigma \frac{sinh(\frac{x}{\sigma})}{cosh(\frac{L}{\sigma})}\Big )\\
u_1 = c_1 e^{\sqrt{\phi_1}x} + c_2 e^{-\sqrt{\phi_1}x} - \frac{\phi_2 e^{-\sqrt{\phi_1}x}(e^{2\sqrt{\phi_1}x}Ei(-\sqrt{\phi_1 x}) + Ei(\sqrt{\phi_1 x}) - 2e^{\sqrt{\phi_1}x} ln(x))}{2\phi_1}\\
w_1 = c_3 ln(x)\\
Ei(x) = -\int_{-x}^{\infty} \frac{e^{-t}}{t} dx
\end{align*}
where Ei(x) is the Exponential Integral Function.
However this is different from the proposed guess for  $u_1$ which involved  consisting of sinh and cosh terms only.
\begin{thebibliography}{9}
	\bibitem{roth2012}
	Bradley J Roth
	\textit{The Mechanical Bidomain Model: A Review}
	ISRN Tissue Eng. 2013
	\bibitem{roth2015}
	 Sharma, Kharananda; Al-Asuoad, Nofe; Shillor, Meir; Roth, Bradley J.
	\textit{Intracellular, extracellular, and membrane forces in remodeling and mechanotransduction: The mechanical bidomain model}
	Journal of Coupled Systems and Multiscale Dynamics, Volume 3, Number 3, September 2015, pp. 200-207(8)
\end{thebibliography}
\end{document}


\subsection{gammapy.modeling}
\label{ssec:gammapy-modeling}
\todo{Quentin Remy}

gammapy.modeling contains all the functionality related to modeling and fitting
data. This includes spectral, spatial and temporal model classes, as well as
the fit and parameter API.

\subsubsection{Models}
\label{ssec:models}

The models are grouped into the following categories:

\begin{itemize}
	\item SpectralModel: models to describe spectral shapes of sources
	\item SpatialModel: models to describe spatial shapes (morphologies) of sources
	\item TemporalModel: models to describe temporal flux evolution of sources, such as
	      light and phase curves

\end{itemize}

The models follow a naming scheme which contains the category as a suffix to
the class name.

The  Spectral Models include a special class of Normed models, which have a
dimension-less normalisation. These spectral models feature a norm parameter
instead of amplitude and are named using the NormSpectralModel suffix. They
must be used along with another spectral model, as a multiplicative correction
factor according to their spectral shape. They can be typically used for
adjusting template based models, or adding a EBL correction to some analytic
model. The analytic Spatial models are all normalized such as they integrate to
unity over the sky but the template Spatial models may not, so in that special
case they have to be combined with a NormSpectralModel.

The SkyModel is a factorised model that combine the spectral, spatial and
temporal model components (by default the spatial and temporal components are
optional). SkyModel objects represents additive emission components, usually
sources or diffuse emission, although a single source can also be modeled by
multiple components. To handle list of multiple SkyModel components, Gammapy
has a Models class.

The model gallery provides a visual overview of the available models in
Gammapy. Most of the analytic models  commonly used in gamma-ray astronomy are
built-in. We also offer a wrapper to radiative models implemented in the Naima
package~\cite{naima}. The modeling framework can be easily extended with
user-defined models. For example agnpy models that describe leptonic radiative
processes in jetted Active Galactic Nuclei (AGN) can wrapped into
gammapy~\citep[see section3.5 of ][]{2021arXiv211214573N} .

\begin{figure}
	\import{code-examples/generated/}{gp_models}
	\caption{Using gammapy.modeling.models}
	\label{fig*:minted:gp_models}
\end{figure}

\subsubsection{Fit}
\label{ssec:fit}

The Fit class provides methods to fit i.e., optimise parameters and estimate
parameter errors and correlations. It interfaces with a Datasets object, which
in turn is connected to a Models object containing the model parameters in its
Parameters object. Models can be unique for a given dataset, or contribute to
multiple datasets and thus provide links, allowing e.g., to do a joint fit to
multiple IACT datasets, or to a joint IACT and \textit{Fermi}-LAT dataset. Many
examples are given in the tutorials.

The Fit class provides a uniform interface to multiple fitting backends:
“minuit”~\citep{iminuit}, “scipy”,~\citep{2020SciPy-NMeth}, and
“sherpa”~\citep{sherpa-2005,sherpa-2011}. Note that, for now, covariance matrix
and errors are computed only for the fitting with MINUIT. However depending on
the problem other optimizers can better perform, so sometimes it can be useful
to run a pre-fit with alternative optimization methods. In future we plan to
extend the supported Fit backend, including for example MCMC solutions.
\footnote{a prototype is available in gammapy-recipes,
	\url{https://gammapy.github.io/gammapy-recipes/_build/html/notebooks/mcmc-sampling-emcee/mcmc_sampling.html}
}


%Prelim, Chapter 1
% by Rachel Slaybaugh

\chapter{Introduction}
\label{sec:Chp1}

Nuclear technology plays an important role in society, particularly within the field of energy generation. More nuclear reactors are being constructed, existing designs are being refined, and new plants are being developed. For progress to continue in these areas, the modeling of nuclear systems must also progress.

The neutron transport equation describes ``where all the neutrons are'' in a nuclear system. The more accurately this is known, the more accurately new systems can be developed. This means that solutions to the transport equation are needed in high-fidelity in all parts of phase space. Very large computers are now available to perform such high-fidelity calculations, but most existing solution methods are not able to take full advantage of new computer architectures and converge slowly for some kinds of problems.

The goal of this research is to accelerate transport calculations with methods that use new computers fully and effectively, facilitating the design of better nuclear systems. Three complimentary methods have been implemented that accomplish this goal. In the chapters that follow this one, background information, past work, mathematics and implementation, and results will be discussed for each method in turn.

This introductory chapter is intended to provide the foundation of this document. The types of neutron transport problems that have been, are, and could be solved are discussed first, including why such problems matter. This is followed by a presentation of the transport equation and its discretization. Finally, the way each method contributes to meeting the overall goal of this work is outlined.

%--------------------------------------------------------------------------------
%--------------------------------------------------------------------------------
\section{Motivation}
The problems typically of interest in the nuclear engineering community are of large scale, with many independent variables representing the pertinent nuclear physics. Some of the most important applications are finding reactor core power distributions for cooling and safety needs, determining the criticality state of the reactor, and predicting isotope depletion. All of these applications require high-resolution neutron flux spectra, where flux is the number of particles per unit length squared per second in some portion of phase of space. Commercial light water reactors can have core heights of three to four meters and contain anywhere from 700 to 1200 fuel bundles \cite{Fennern2006}. Geometrically large shielding applications are commonly of interest as well. To obtain the needed quantities with sufficient precision and resolution, the size of required calculations can become quite large.

Solving the full steady-state transport equation, which depends on location, energy, and solid angle, is computationally intensive. For a reasonable discretization of reactor-type calculations, $10^{8}$ coupled algebraic equations could easily be required. In the past, such large calculations were generally intractable because of computer hardware limitations: lack of memory and processing capability. There was simply not enough space to store all of the required data, and it would take too long to conduct the number of floating point operations (flops) needed. Calculations with fine enough discretizations to get high-resolution answers were impossible to perform using the transport equation \cite{Duderstadt1976}.

Accordingly, simplifying approximations were used to solve problems in practice. Approximations include modeling reactor geometries in one or two dimensions rather than three; approximating neutron sources as isotropic; approximating neutron scattering as isotropic; eliminating the angular component of the solution through the diffusion approximation (discussed in Appendix \ref{sec:AppendixA}); physically truncating geometries by taking advantage of geometric symmetries or near symmetries, particularly for reactor cores with repeated lattice structures; and suppressing energy dependence or using very few energy groups \cite{Duderstadt1976}.

While all such approximations can be appropriate and give good results in some situations, they are generally not as accurate as solving the full, finely discretized transport equation. The way the nuclear industry has compensated for approximate answers is by building conservative margins into designs by using thicker shields, lower operating powers, larger safety margins, and so on. All of this costs money, which is of crucial import since economic competitiveness may be the largest barrier to the construction of new nuclear plants and, correspondingly, provision of emissions-free energy. Having higher-fidelity neutron fluxes could influence design bases and have a meaningful impact on current reactor operations and new reactor designs.

%--------------------------------------------------------------------------------
\subsection{Problems of Interest}
To get more accurate fluxes, typical transport problems today are three-dimensional, have up to thousands $\times$ thousands $\times$ thousands of mesh points, use up to $\sim$150 energy groups, include accurate expansions of scattering terms, and are solved over many directions. Some examples of problems solved recently using discrete ordinates codes on parallel machines are shown next. The exact meaning of the expansions will become clear in the next section.
\begin{itemize}
  \item In 1998, 30 million unknowns\footnote{In each example the number of unknowns assumes one spatial unknown per cell; some spatial discretizations result in more than one spatial unknown per cell.}: a 3-D time dependent shielding problem where a 10 $\times$ 10 $\times$ 10 cm innermost region containing water and a uniform source is surrounded by 10 cm of iron, which is surrounded by 30 more cm of water. Three energy groups, a 50 $\times$ 50 $\times$ 50 Cartesian mesh, $S_{8}$ scattering quadrature, $P_{0}$ scattering expansion, and the adaptive weighted diamond difference method were used \cite{Alcouffe1998}.
  \item In 2004, 1.62 million unknowns: a cylinder with a 3.5 cm radius and 9 cm length containing layers of boron-10, water, and highly enriched uranium was solved with 13,500 cells, $S_{4}$ Chebyshev-Legendre quadrature, and five energy groups \cite{Warsa2004a}.
  \item In 2010, 78.5 billion unknowns: a Pressurized Water Reactor (PWR)-900 with two groups, a 578 $\times$ 578 $\times$ 700 mesh, using $S_{16}$ level-symmetric quadrature, and with $P_{0}$ scattering was solved \cite{Davidson2010}.
\end{itemize}
%
The size and scope of problems of interest have been increasing as larger computer resources have made it possible to solve them.

The next phase of challenging problems are even more highly refined. High-fidelity, coupled, multi-physics calculations are the new ``grand challenge'' problems for reactor analysis. Of particular interest in nuclear systems is feedback between neutronics and thermal-hydraulics. A recent INCITE grant was awarded to spatially quantify data uncertainties in 3-D Boiling Water Reactor assembly calculations. When neutron transport is coupled to a fluid dynamics code it is important to know whether or not homogenizing the materials in the subchannels being analyzed will have a large impact. Such uncertainty studies will require spatial meshes exceeding 500 million elements \cite{Evans2009a}. Calculations of this detail present the next generation of challenges for computational neutronics.

%--------------------------------------------------------------------------------
\subsection{Enabling Technology}
Nuclear transport computation began in the age of run tapes and punch cards with widely used codes being written in advanced programming languages such as FORTRAN IV \cite{Fortran1998}. Computer technology has evolved quickly and radically since that time. Now there are machines like Jaguar, which consists of two partitioned machines, the Cray XT4 and the Cray XT5. Jaguar has 84 XT4 cabinets containing 7,832 quad-core Opteron 1354 "Budapest" processors, each with eight gigabytes of DDR2-800 memory. The 200 XT5 cabinets have 37,376 six-core Opteron 2435 "Istanbul" processors with 16 gigabytes of memory per node. The machine has a total of 362 terabytes of high-speed memory \cite{Sciences2010}. A table of machine parameters can be seen in Figure~\ref{fig:jaguar}.

\begin{figure}[!h]
  \begin{center}
    \includegraphics [width=0.55\textwidth, height=0.35\textheight ] {jaguarSpecs09}
  \end{center}
  \caption{Jaguar Machine Specifications \cite{Sciences2010}}
  \label{fig:jaguar}
\end{figure}

While the fastest computer in the world in 2010 may not be the best example of what is standard, machines on which parallel codes can be run are widely available and are becoming faster over time. Access to such machines has changed the landscape of the types of neutron transport problems that can be solved practically.

Whenever an equation is being mathematically approximated, errors can be introduced that are inherent in the approximation. These errors are present regardless of machine roundoff, phase space discretization, etc. and cannot be changed without changing the approximation. Accepting this mathematical limit as a given, the factor that can be changed to improve calculations is machine architecture. This means that the quality of calculations for a given method is ultimately limited by computers. The research presented here is intended to provide methods that can take full advantage of these new computers, pushing back the frontier of limiting calculations.

%--------------------------------------------------------------------------------
%--------------------------------------------------------------------------------
\section{The Transport Equation}
To understand the methods that were developed for this work and how they will enable the use of leadership-class hardware, the mathematical details of the transport equation must be discussed first. This section does this for neutrons in steady-state systems.

Neutrons can have many different kinds of interactions that influence a system's behavior. These interactions are described by cross sections, which reflect the likelihood of a particular interaction occurring and are given in units of inverse length. Of particular interest is the total cross section, $\Macro$, which includes all possible interactions; the scattering cross section, $\Macro_{s}$, where scattering can change the momentum and kinetic energy of a neutron; and the fission cross section, $\Macro_{f}$.

Fission is the process through which a nucleus splits into (typically two) smaller atoms. \\Through this process a relatively large amount of energy is released along with several neutrons. These neutron are available to go on to cause other fissions, creating a chain reaction. The quantity $\nu$ is the average number of neutrons released per fission. Most of the energy released from fission is kinetic, which creates the heat used to make electricity \cite{Lewis1993}.

If fission is occurring, it is often of interest to know the asymptotic behavior of the system. A reactor is called ``critical'' if the chain reaction is self-sustaining and time-independent. If the system is not in equilibrium then the asymptotic neutron distribution, or the fundamental mode, will grow or decay exponentially over time. A convenient way to capture this behavior is to assume $\nu$ can be adjusted to obtain a time-independent solution by replacing it with $\frac{\nu}{k}$, where $k$ is the parameter expressing the deviation from critical.

This substitution changes the transport equation into an eigenvalue problem. A spectrum of eigenvalues can be found, but at long times only the non-negative solution corresponding to the largest real eigenvalue will dominate. The eigenproblem can be written as:
%
\begin{align}
   [\hat{\Omega} \cdot \nabla + \Macro(\vec{r}, E)] \psi(\vec{r}, \hat{\Omega}, E)  &=  \int dE' \int d\hat{\Omega'} \:\Macro_{s}(\vec{r}, E' \to E, \hat{\Omega'} \cdot \hat{\Omega}) \psi(\vec{r}, \hat{\Omega'}, E') \nonumber \\
&+\frac{ \chi(E)}{k} \int dE' \:\nu \Macro_{f}(\vec{r}, E') \int d\hat{\Omega'} \:\psi(\vec{r}, \hat{\Omega'}, E') \:,
\label{eq:neutron transport}
\end{align}
%
\noindent where the quantities are at location $\vec{r}$, traveling in directions $\hat{\Omega}$, and at energy E and are defined as:
\begin{list}{}{\hspace{2em}}
  \item $\psi(\vec{r}, \hat{\Omega}, E)$ is the angular neutron flux in neutrons per unit length squared per steradian and expresses where all the neutrons are in phase space,
  \item $\chi(E)$ is the fission spectrum and specifies the energy distribution of neutrons born from fission,
  \item $k$ can be thought of as the asymptotic ratio of the number of neutrons in one generation to the number in the next \cite{Lewis1993}.
\end{list}

If fission is not present the transport equation becomes a fixed source rather than eigenvalue problem. The term containing $k$ is replaced by an external source, $q_{ex}(\vec{r}, \hat{\Omega}, E)$, and the equation becomes a standard linear system.

A brief aside about some properties of the transport equation will aid in understanding the challenge of finding solution techniques that work in all cases. In a void, the transport equation is like a hyperbolic wave equation. For highly-scattering regions where $\Macro_{s}$ is close to $\Macro$, the equation becomes elliptic for the steady-state case. If the scattering is forward-peaked then the equation is parabolic. All of these classes of equations have different solution strategies. The equation is linear, though non-linearities can be introduced if temperature-dependence of cross sections and other similar physics are considered \cite{Adams2002}.  The non-linear considerations are beyond the scope of this work and only the linear case is considered here.

To numerically solve Equation \eqref{eq:neutron transport} it is discretized in space, angle, and energy. This work uses the multigroup approximation, the scattering term is expanded in Legendre polynomials, and discrete ordinates are used to treat direction of neutron travel. There are many spatial differencing methods available, the discussion of which are beyond the scope of this document as the proposed work is not dependent upon the spatial discretization employed. To ensure the new methods apply to the most general cases it will be assumed that the matrices resulting from discretization are not necessarily symmetric.

%--------------------------------------------------------------------------------
\subsection{Multigroup Approximation}
The first variable to discretize is energy. In the multigroup approximation, the energy range of interest is broken into $G$ groups. The neutron flux is constant in energy over each group. The groups are ordered such that the highest energy group bound corresponds with $g = 0$, meaning group 1 is defined over $E_{1}$ to $E_{0}$, and the lowest energy bound corresponds with $g = G$. On this grid the group angular flux is defined as:
%
\begin{equation}
  \psi_{g}(\vec{r},\hat{\Omega}) = \int_{g} dE \:\psi(\vec{r}, \hat{\Omega}, E) = \int_{E_{g}}^{E_{g-1}}dE \:\psi(\vec{r}, \hat{\Omega}, E) \:.
\end{equation}

Justification of this definition comes from assuming the angular flux within each energy group can be approximated by the product of the group flux and a known function: $\psi(\vec{r}, \hat{\Omega}, E) \approx f(E)  \psi_{g}(\vec{r},\hat{\Omega})$ for $E_{g} < E \le E_{g-1}$. The function is normalized for a specific group $g$ such that $\int_{g' = g} dE \:f(E) = 1$ and $\int_{g' \ne g} dE \:f(E) = 0$. The details of $f$ are isotope-dependent and can be garnered from nuclear data \cite{Lewis1993}. With this notation, group quantities are defined as:

\indent $\Macro_{g}(\vec{r}) = \int_{g} dE \:\Macro(\vec{r}, E) f(E)$, \\
\indent $\nu \Macro_{fg}(\vec{r}) = \int_{g} dE \:\nu \Macro_{f}(\vec{r}, E) f(E)$, \\
\indent $\Macro_s^{gg'}(\vec{r}, \hat{\Omega'} \cdot \hat{\Omega}) = \int_{g} dE \:\int_{g'} dE' \:\Macro_{s}(\vec{r}, E' \to E, \hat{\Omega'} \cdot \hat{\Omega})  f(E')$ is the scattering from $g'$ into $g$, \\
\indent $\chi_{g} = \int_{g} dE \:\chi(E)$, and \\
\indent $q^{e}_{g}(\vec{r}, \vOmega) = \int_{g} dE \:q_{ex}(\vec{r}, \hat{\Omega}, E)$.

\noindent Using these terms, the eigenvalue form of Equation \eqref{eq:neutron transport} can be rewritten for each group $g$ as seen in \eqref{eq:group-transport} \cite{Lewis1993}. Using more energy groups represents the physics in the cross sections more accurately, but also increases the cost of a calculation in terms of both operations and storage.
%
\begin{align}
   [\hat{\Omega} \cdot \nabla + \Macro_{g}(\vec{r})] \psi_{g}(\vec{r}, \hat{\Omega})  &=  \sum_{g'=1}^{G} \int d\hat{\Omega'} \:\Macro_s^{gg'}(\vec{r}, \hat{\Omega'} \cdot \hat{\Omega}) \psi_{g'}(\vec{r}, \hat{\Omega'})  \nonumber \\
&+ \frac{\chi_{g}}{k}   \sum_{g'=1}^{G} \nu \Macro_{fg'}(\vec{r}) \int d\hat{\Omega'} \:\psi_{g'}(\vec{r}, \hat{\Omega'})
\label{eq:group-transport}
\end{align}

%--------------------------------------------------------------------------------
\subsection{Scattering Discretization}
In Equation \eqref{eq:group-transport} the scattering cross section is a complicated function of angle. Simplifying this term will make the system easier to solve. Because of rotational symmetry of nuclear collisions, $\Macro_{s}$ is only a function of the cosine between the incoming and outgoing angles. This allows the scattering cross section to be written as a series expansion of Legendre polynomials as follows, where the the spatial variable has been supressed:
%
\begin{equation}
  \sigg{}(\vOmega' \cdot \vOmega) = \sum_{l=0}^{N} \frac{2l+1}{4\pi} P_{l}(\vOmega' \cdot \vOmega)\sigg{l} \:.
\end{equation}

The addition theorem of spherical harmonics can be used to evaluate the Legendre function, $P_{l}(\vOmega' \cdot \vOmega)$, with spherical harmonic terms, $Y_{lm}$. These can then be expanded into real and imaginary components. The imaginary components must be zero since scattering must be real. All of this gives:
%
\begin{equation}
  P_l(\vOmega' \cdot \vOmega) = \frac{4\pi}{2l+1} \Bigl[ Y^e_{l0}(\vOmega) Y^e_{l0}(\vOmega') + \sum_{m=1}^l \bigl( Y^e_{lm}(\vOmega) Y^e_{lm}(\vOmega') + Y^o_{lm}(\vOmega) Y^o_{lm}(\vOmega') \bigr) \Bigr]\:.
\end{equation}
%
The $Y^e$ and $Y^o$ terms obey the following orthogonality relationships: $\int d\vOmega \:Y^{e}_{lm}(\vOmega)Y^{e}_{l'm'}(\vOmega) = \frac{1}{2}(1 + \delta_{m0})\delta_{ll'}\delta_{mm'}$ and $\int d\vOmega \:Y^{o}_{lm}(\vOmega)Y^{o}_{l'm'}(\vOmega) = \frac{1}{2}(1 - \delta_{m0})\delta_{ll'}\delta_{mm'}$. The spherical harmonics therefore form an orthonormal basis in which the Legendre polynomials are expressed \cite{Evans2009}, \cite{Lewis1993}.

By putting all of this information together, the scattering source can be expressed as:
%
\begin{equation}
  q^g_{s} (\vec{r}, \vOmega) = \sum_{g'=1}^G \sum_{l=0}^N \sigg{l}(\vec{r}) \Bigl[ Y^e_{l0}(\vOmega) \evenp_{l0}(\vec{r}) + \sum_{m=1}^l \bigl( Y^e_{lm}(\vOmega) \evenp_{lm}(\vec{r}) + Y^o_{lm}(\vOmega) \oddp_{lm}(\vec{r}) \bigr) \Bigr]\:.
   \label{eq:mg-scattering-source}
\end{equation}
%
In Equation \eqref{eq:mg-scattering-source} two terms, called the even and odd flux moments, have been used:
%
\begin{alignat}{3}
  \even_{lm} &= \int_{4\pi} d\vOmega' \:Y^e_{lm}(\vOmega') \psi^g(\vOmega') \:, \quad& m\ge 0\:,\qquad \text{even} \:, \label{eq:even-flux}\\
  %
  \odd_{lm} &= \int_{4\pi} d\vOmega' \:Y^o_{lm}(\vOmega')\psi^g(\vOmega') \:, \quad& m>0 \:,  \qquad \text{odd} \label{eq:odd-flux} \:.
\end{alignat}
%
The external source can be similarly discretized if desired, making the two sources consistent with one another. The full details of these expansions and bases can be found in \cite{Evans2009}.

The multigroup, anisotropic scattering source found in Equation \eqref{eq:mg-scattering-source} is characterized by the order of Legendre scattering, $P_{N}$. For a given Legendre expansion there are $(N + 1)^{2}$ flux moments. Using more moments represents scattering more accurately, but increases the cost of calculation \cite{Evans2009}.

%--------------------------------------------------------------------------------
\subsection{Discrete Ordinates Approximation}
The next area of phase space to discretize is direction. The discrete ordinates or \Sn approximation is a collocation method that is used to express the transport equation on a discrete set of $n$ ordinates, where the ordinates are described by angles and represent direction of neutron travel. A collocation method represents a continuous function on a finite set of collocation points using a linear combination of basis functions. The approximate solution must satisfy the differential equation at those collocation points \cite{Heath2002}.

For the transport equation, the basis functions are the angular fluxes along specific directions and the collocation points are the angle sets. The linear combination is done by weighting the basis functions using a quadrature set.

To implement this, the transport equation is written for neutrons traveling in $d\vOmega$ about direction $\vOmega_{a}$. Now $\psi^{g}_{a}$ can be defined as $\psi^{g}(\vOmega_{a})$, and the angular flux can be related to the scalar flux as $\phi^{g} = \sum_{a=1}^{n}\psi^{g}_{a}w_{a}$. Using these terms, including the discretized scattering source and suppressing spatial dependence, Equation \eqref{eq:group-transport} becomes:
%
\begin{align}
 \bigl( \vOmega_{a} \cdot \nabla + \Macro_{g} \bigr) \psig_{a} = \sum_{g' = 1}^{G} \sum_{l=0}^{N} \sigg{l} \bigl[ Y^{e}_{l0}(\vOmega_{a}) \evenp_{l0} &+ \sum_{m=1}^{l} \bigl( Y^{e}_{lm}(\vOmega_{a}) \evenp_{lm} + Y^{o}_{lm}(\vOmega_{a}) \oddp_{lm} \bigr) \bigr] \nonumber \\
 &+ \frac{\chi^{g}}{k} \sum_{g'=1}^{G} \nu \Macro_{f}^{g'}\phi^{g'} \:,
  \label{eq:mg-sn-transport}
\end{align}

The quadrature weights, $w_{a}$, are defined such that $\int_{4 \pi} d\vOmega =  \sum_{a=1}^{n}w_{a} = 4 \pi$. One of the choices in the \Sn approximation is what quadrature set to use. The number of unknowns contributed by discretization of direction is determined by the quadrature set. For example, level-symmetric quadrature gives $n = N(N+2)$ unknowns for an \Sn approximation. The scalar flux is also collocated on the ordinates using the desired quadrature set to linearly combine the angular flux basis functions \cite{Evans2009}. This results in the flux moments:
%
\begin{align}
  \even_{lm} &= \sum_{a=1}^{n}Y^e_{lm}(\vOmega'_a)\psi^g_a w_a\:,
  \label{eq:even-flux-quad-int}\\
  \odd_{lm} &= \sum_{a=1}^{n}Y^o_{lm}(\vOmega'_a)\psi^g_a w_a\:.
  \label{eq:odd-flux-quad-int}
\end{align}

%--------------------------------------------------------------------------------
\subsection{Operator Form}
Now that the transport equation has been discretized, it can be expressed in operator notation. Using the operator form of the transport equation will facilitate the presentation of the solution techniques discussed in the remainder of this document. In general, uppercase bolded letters will indicate matrices and lowercase italicized letters will indicate vectors and scalars. The following operators are used to express the transport equation:\\
%
\indent $\mathbf{L} = \vOmega \cdot \nabla + \Macro$ is the transport operator, \\
\indent $\mathbf{M}$ is the operator that converts harmonic moments into discrete angles, \\
\indent $\mathbf{S}$ is the scattering matrix, \\
\indent $f$ contains the fission source, $\nu \Macro_{f}$; $\mathbf{F} =\mathbf{\chi} f^{T}$, \\
\indent $\mathbf{D} = \ve{M^{T}}\ve{W} = \sum_{a=1}^{n}Y^{e/o}_{lm}w_{a}$ is the discrete-to-moment operator.

With this notation Equation \eqref{eq:mg-sn-transport} can be written as \eqref{eq:operator-form}; it can be formulated as a fixed source problem by replacing the fission term with $\ve{M}q_{e}$. This has two unknowns, the angular flux and the moments, which are related by the discrete-to-moment operator as seen in Equation \eqref{eq:moments}.
%
\begin{align}
  \mathbf{L} \psi &= \mathbf{MS}\phi + \frac{1}{k}\mathbf{MF}\phi \label{eq:operator-form}\\
  \phi &= \mathbf{D}\psi
  \label{eq:moments}
\end{align}
The typical strategy for solving Equation \eqref{eq:operator-form} is to combine it with \eqref{eq:moments} and form one equation involving only the moments, where $Q$ is comprised of the fixed or fission source:
\begin{equation}
   (\ve{I} - \ve{DL}^{-1}\ve{MS})\phi = Q \:.
\end{equation}
This is solved for $\phi$ from which $\psi$ can be determined at the end of the calculation.

The size of the operators can be defined in terms of the granularity of discretization: \\
%
\indent $G$ = number of energy groups, \\
\indent $t$ = number of moments, \\
\indent $n$ = number of angular unknowns, \\
\indent $c$ = number of cells, \\
\indent $u$ = number of unknowns per cell, which is determined by spatial discretization. \\
%
These can be combined to define $a = G \times n \times c \times u$ and $f = G \times t \times c \times u$. Using $a$ and $f$, Equation \eqref{eq:operator-form} can be presented in terms of operator size: $(a \times a)(a \times 1) = (a \times f) (f \times f) (f \times 1) + (a \times f) (f \times f) (f \times 1)$. The index variables, their meaning, and their ranges are shown in Table \ref{table:index}.
%
\begin{table}[!h]
\caption{Meaning and Range of Indices Used in Transport Discretization}
\begin{center}
\begin{tabular}{l c c c c}
\hline
Variable & Symbol & First & Last \\[0.5ex]
\hline
Energy & g & 1 & G \\
Solid Angle & a & 1 & n \\
Space & suppressed & n/a & n/a \\
Legendre moment ($P_{N}$) & $l$ & 0 & N \\
Spherical harmonic moment ($Y$) & m & 0 & $l$ \\
\hline
\end{tabular}
\end{center}
\label{table:index}
\end{table}
%

The structures of the vectors and matrices are shown in the next few equations as this will make some of the proposed methods easier to understand and visualize \cite{Evans2009}. The angular flux vector is explicitly written first, where for each discrete angle, $a$, and energy group, $g$, the set of angular fluxes, $ \psi^g_a$, includes all spatial unknowns.
%
 \begin{align}
    \psi &=     \begin{pmatrix}
    [\psi]_{1} & [\psi]_2 & \cdots & [\psi]_g & \cdots [\psi]_{G}
  \end{pmatrix}^T  \:, \qquad \text{and} \nonumber \\
  %
    [\psi]_g &= \begin{pmatrix}
    \psi^g_1 & \psi^g_2& \cdots & \psi^g_a & \cdots \psi^g_n
  \end{pmatrix}^T \:.  \nonumber
\end{align}
%
\begin{alignat}{2}
  \mathbf{M} &=    \begin{pmatrix}
      [\ve{M}]_{11} & 0 & 0 & \cdots & 0 \\
      0 & [\ve{M}]_{22} & 0 & \cdots & 0 \\
      0 & 0 & [\ve{M}]_{33} & \cdots & 0 \\
      \vdots & \vdots & \vdots & \ddots   & \vdots \\
      0 & 0 & 0 & \cdots & [\ve{M}]_{GG} \\
    \end{pmatrix} \nonumber  \:,& \qquad
    %
  \mathbf{S}  =     \begin{pmatrix}
      [\ve{S}]_{11} & [\ve{S}]_{12} & [\ve{S}]_{13} & \cdots &
      [\ve{S}]_{1G} \\
      [\ve{S}]_{21} & [\ve{S}]_{22} & [\ve{S}]_{23} & \cdots &
      [\ve{S}]_{2G} \\
      [\ve{S}]_{31} & [\ve{S}]_{32} & [\ve{S}]_{33} & \cdots &
      [\ve{S}]_{3G} \\
      \vdots & \vdots & \vdots & \ddots & \vdots \\
      [\ve{S}]_{G1} & [\ve{S}]_{G2} & [\ve{S}]_{G3} & \cdots &
      [\ve{S}]_{GG}
    \end{pmatrix} \nonumber  \:,
 \end{alignat}
 %
 \begin{alignat}{2}
      \mathbf{F}  &=     \begin{pmatrix}
     \chi^{1}[\nu\Macro_{f}]^{1} &\chi^{1}[\nu\Macro_{f}]^{2} & \cdots &
      \chi^{1}[\nu\Macro_{f}]^{G} \\
      \chi^{2}[\nu\Macro_{f}]^{1} &\chi^{2}[\nu\Macro_{f}]^{2} & \cdots &
      \chi^{2}[\nu\Macro_{f}]^{G}\\
      \vdots & \vdots & \ddots & \vdots \\
      \chi^{G}[\nu\Macro_{f}]^{1} &\chi^{G}[\nu\Macro_{f}]^{2} & \cdots &
      \chi^{G}[\nu\Macro_{f}]^{G}\\
    \end{pmatrix} \:, \nonumber & \qquad
    %
  [\ve{S}]_{gg'} = \begin{pmatrix}
    \sigg{0} & 0 & \cdots & 0  \\
    0 & \sigg{1} & \cdots & 0 \\
    \vdots & 0 & \ddots  & \vdots \\
     0 & 0 & \cdots & \sigg{N}
  \end{pmatrix}\:, \nonumber
 \end{alignat}
    %
\begin{equation}
   [\ve{M}]_{gg} = \begin{pmatrix}
    \Ye{00}{1} & \Ye{10}{1} & \Yo{11}{1} & \Ye{11}{1} &
    \Ye{20}{1} & \cdots & \Yo{NN}{1} & \Ye{NN}{1} \\
    \Ye{00}{2} & \Ye{10}{2} & \Yo{11}{2} & \Ye{11}{2} &
    \Ye{20}{2} & \cdots & \Yo{NN}{2} & \Ye{NN}{2} \\
    \Ye{00}{3} & \Ye{10}{3} & \Yo{11}{3} & \Ye{11}{3} &
    \Ye{20}{3} & \cdots & \Yo{NN}{3} & \Ye{NN}{3} \\
    \vdots     & \vdots     & \vdots     & \vdots     &
    \vdots     &  \ddots    & \vdots     & \vdots     \\
    \Ye{00}{n} & \Ye{10}{n} & \Yo{11}{n} & \Ye{11}{n} &
    \Ye{20}{n} & \cdots & \Yo{NN}{n} & \Ye{NN}{n}
  \end{pmatrix}\:. \nonumber \\
\end{equation}

\noindent Note that $[\ve{M}]_{11} = [\ve{M}]_{22} =  \hdots = [\ve{M}]_{GG} = [\ve{M}]$. These are written with subscripts to simplify the visualization of which blocks correspond to which equations and multiply which other blocks.

%--------------------------------------------------------------------------------
\subsection{Solution Procedure}
Once the matrices are multiplied together, a series of single-group equations that are each only a function of space and angle result:
%
\begin{equation}
  \begin{aligned}
    \ve{L}[\psi]_1 &= [\ve{M}]\bigl([\ve{S}]_{11}[\phi]_1 +
    [\ve{S}]_{12}[\phi]_2 + \ldots + [\ve{S}]_{1G}[\phi]_G\bigr) +
    \frac{1}{k}[\ve{M}]\sum_{i=1}^{G}[\ve{F}]_{1i}[\phi]_{i} \:, \\
    %%
    \ve{L}[\psi]_2 &= [\ve{M}]\bigl([\ve{S}]_{21}[\phi]_1 +
    [\ve{S}]_{22}[\phi]_2 + \ldots + [\ve{S}]_{2G}[\phi]_G\bigr) +
     \frac{1}{k}[\ve{M}]\sum_{i=1}^{G}[\ve{F}]_{2i}[\phi]_{i} \:, \\
    %%
    &\vdots\\
    %%
    \ve{L}[\psi]_G &= [\ve{M}]\bigl([\ve{S}]_{G1}[\phi]_1 +
    [\ve{S}]_{G2}[\phi]_2 + \ldots + [\ve{S}]_{GG}[\phi]_G\bigr) +
     \frac{1}{k}[\ve{M}]\sum_{i=1}^{G}[\ve{F}]_{Gi}[\phi]_{i} \:.
  \end{aligned}
  \label{eq:group-equations}
\end{equation}
%
Each ``within-group'' equation is solved for that group's flux. If the groups are coupled together, as they often are, then multiple ``multigroup'' solves over the coupled portion of the energy range may be required. If the eigenvalue is desired an additional ``eigenvalue'' solve is needed as well \cite{Evans2009}. The details of these steps will be discussed later as they relate to the new methods.

%--------------------------------------------------------------------------------
%--------------------------------------------------------------------------------
\section{Meeting the Goal}
The fully discretized steady-state transport equation can become very large when trying to solve ``grand challenge'' types of problems. The continued improvement of computational resources has enabled the invention of massively parallel codes designed to work on leadership-class computers. The goal of this work is to develop and implement methods that will accelerate transport calculations by efficiently taking advantage of cutting-edge computer architectures.

The code being used in this work is Denovo \cite{Evans2009}, a massively parallel discrete ordinates code being developed at Oak Ridge National Laboratory (ORNL). The code allows multiple combinations of spatial discretizations, quadrature sets, and solution methodologies. Denovo is three-dimensional; uses a non-uniform, structured, Cartesian grid; has a flexible front end; and is capable of writing and reading input parameters rapidly for high performance computing.

At the outset of this work, Denovo could be decomposed for parallel computation in five of the six dimensions of phase space over which the steady-state transport equation is solved. The nature of the decomposition dictated how many cores Denovo could use efficiently. Studies presented in Chapter \ref{sec:Chp2} illustrate that this number of cores was not sufficient to solve real problems of interest.

The original suite of solvers in Denovo included Source Iteration (SI) and Krylov methods as within group solvers, Gauss Seidel (GS) as a multigroup solver, and power iteration (PI) as an eigenvalue solver. These solvers have some significant limitations in many cases. Each method and its associated challenges will be described in detail in following chapters.

Acceleration of Denovo has been accomplished by implementing three complimentary solution strategies. The first is a multigroup solver that allows Denovo to be decomposed in energy for fixed source problems such that multigroup solves can be parallelized in the energy dimension. This addition lets Denovo take advantage of many more cores without significantly degrading the scaling. The \emph{multigroup Krylov solver} also converges more quickly than Gauss Seidel. This work is discussed in Chapter~\ref{sec:Chp2}.

The second strategy was to add an eigenvalue method with properties that can be superior to power iteration, particularly for loosely coupled problems. \emph{Rayleigh Quotient Iteration} (RQI) applies a shift to the equations that improves the eigenvalue convergence properties. The shift also increases the degree of effective group-to-group coupling. The multigroup Krylov solver enables RQI because it solves coupled groups efficiently and decomposes those coupled groups for energy parallelization. The details of this work are discussed in Chapter~\ref{sec:Chp3}.

The third step was to add a new physics-based preconditioner that is a multigrid method in energy. This capitalizes on the energy decomposition added by the first method. Since energy groups can be treated independently, they can be combined and re-separated in a multigrid fashion very easily. The preconditioner is applicable to both fixed source problems and eigenvalue calculations, and it reduces the number of iterations required for convergence. The \emph{multigrid-in-energy preconditioner} is discussed in Chapter~\ref{sec:Chp4}.

Fast and scalable codes are necessary for solving truly large and challenging neutron transport problems. This work developed methods that accelerate an existing transport code by allowing it to scale to hundreds of thousands of cores and converge in fewer iterations than its previous methods, thus enabling the development of new and useful nuclear energy systems. These methods may also be beneficial for the larger computational community.

\separatorpage{}