<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Aither CFD</title>
    <description>An open source structured multi-block CFD code.</description>
    <link>http://mnucci32.github.io/aither/</link>
    <atom:link href="http://mnucci32.github.io/aither/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Wed, 25 Jul 2018 05:47:33 +0000</pubDate>
    <lastBuildDate>Wed, 25 Jul 2018 05:47:33 +0000</lastBuildDate>
    <generator>Jekyll v3.7.3</generator>
    
      <item>
        <title>Dissociating Shock Tube</title>
        <description>&lt;h2 id=&quot;problem-description&quot;&gt;Problem Description&lt;/h2&gt;
&lt;p&gt;Version &lt;a href=&quot;https://github.com/mnucci32/aither/releases/tag/v0.9.0&quot;&gt;v0.9.0&lt;/a&gt; of
Aither added a finite rate reacting flow capability. To test this capability and
to compare the effect of finite-rate chemistry to frozen chemistry and 
equilibrium chemistry, a test case for dissociating &lt;script type=&quot;math/tex&quot;&gt;O_2&lt;/script&gt; in a shock tube was 
added to the Aither &lt;strong&gt;testCases/dissociation&lt;/strong&gt; directory. The simulation 
follows the description in Luke [1].&lt;/p&gt;

&lt;h3 id=&quot;initial-conditions&quot;&gt;Initial Conditions&lt;/h3&gt;
&lt;p&gt;The shock tube is initialized with two separate flow states. The left side is
initialized with a high temperature, high pressure, equilibrium mixture of
&lt;script type=&quot;math/tex&quot;&gt;O_2&lt;/script&gt; and &lt;script type=&quot;math/tex&quot;&gt;O&lt;/script&gt;. Within this state there is already a significant amount of
dissociation. The right state is intialized with a low temperature, low
pressure, equilibrium mixture. This state has comparatively minimal 
dissociation. The flow states are shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;left: pressure=1e6 Pa, temperature=3000 K, mass fractions=[O2=0.9824, O=0.0176]
right: pressure=1e5 Pa, temperature=2000 K, mass fractions=[O2=0.9997, O=0.0003]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;chemistry-mechanisms&quot;&gt;Chemistry Mechanisms&lt;/h3&gt;
&lt;p&gt;The shock tube simulation was run with three separate chemistry mechanisms for
comparison. A frozen chemistry model, a finite-rate model, and an equilibrium
model were used. Each of these models are present in Aither as of v0.9.0.&lt;/p&gt;

&lt;h4 id=&quot;frozen-chemistry&quot;&gt;Frozen Chemistry&lt;/h4&gt;
&lt;p&gt;For the frozen chemistry simulation, no reactions were present. This is the 
default chemistry model for Aither. In can be explicitly selected by setting
the &lt;strong&gt;chemistryModel&lt;/strong&gt; to &lt;strong&gt;none&lt;/strong&gt; or &lt;strong&gt;frozen&lt;/strong&gt; in the input file as shown 
below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;chemistryModel: none
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;finite-rate-chemistry&quot;&gt;Finite-Rate Chemistry&lt;/h4&gt;
&lt;p&gt;The finite-rate reacting chemistry model can be selected by setting the 
&lt;strong&gt;chemistryModel&lt;/strong&gt; to &lt;strong&gt;reacting&lt;/strong&gt; in the input file. This simulation used a
two species, two reaction chemistry mechanism (O2_2s2r) that comes with Aither. 
All chemistry mechanisms that come with Aither are installed to the 
&lt;strong&gt;${AITHER_INSTALL_DIRECTORY}/chemistryMechanisms&lt;/strong&gt; folder. This model and 
mechanism can be selected as shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;chemistryModel: reacting
chemistryMechanism: O2_2s2r
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The chemistry mechanism is defined in Luke [1], but the rates have been 
converted to use &lt;script type=&quot;math/tex&quot;&gt;mol&lt;/script&gt; instead of &lt;script type=&quot;math/tex&quot;&gt;kmol&lt;/script&gt;. The two reactions used in the 
mechanism are shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;2 O2 &amp;lt;=&amp;gt; 2 O + O2
O2 + O &amp;lt;=&amp;gt; 3 O
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h4 id=&quot;equilibrium-chemistry&quot;&gt;Equilibrium Chemistry&lt;/h4&gt;
&lt;p&gt;Aither doesn’t contain an explicit equilibrium chemistry model, but equilibrium
chemistry can be simulated by increasing the reaction rates. The setup for the
equilibrium chemistry simulation is identical to the the setup for the 
finite-rate simulation as shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;chemistryModel: reacting
chemistryMechanism: O2_2s2r
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The reaction rates are increased by three orders of magnitude by copying the
&lt;strong&gt;${AITHER_INSTALL_DIRECTORY}/chemistryMechanisms/O2_2s2r.mch&lt;/strong&gt; file into the
run directory and increasing the &lt;strong&gt;C&lt;/strong&gt; parameter in the Arrhenius fit by three
orders of magnitude. Aither will first look for the mechanism file in the run
directory before checking the installation directory, so this altered mechanism
takes precedence over the version that comes with Aither.&lt;/p&gt;

&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;
&lt;p&gt;The simulations were run in a time accurate manner using a time step of 2e-7
seconds for a total time of 2.4e-4 seconds. The plots below show the temperature
and degree of dissociation in the shock tube at the end of the simulation. For 
this simple mechanism the degree of dissociation is just the mass fraction of
&lt;script type=&quot;math/tex&quot;&gt;O&lt;/script&gt; present. The temperature plot clearly shows the effect of finite-rate
chemistry in the region behind the shock. The plots also show that the 
finite-rate solution is bounded by the frozen and equilibrium solutions. These
results from Aither show excellent agreement with those in Luke [1].&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/dissociating-temperature.png&quot; alt=&quot;Dissociating-Temperature&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Temperature in shock tube for frozen, finite-rate, and equilibrium chemistry mechansims.&lt;/center&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/dissociation.png&quot; alt=&quot;Dissociation&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Degree of dissociation in shock tube for frozen, finite-rate, and equilibrium chemistry mechansims.&lt;/center&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;[1] Luke, E. A. “A Rule-Based Specification System for Computational Fluid
Dynamics”. Ph. D. Thesis. 1999.&lt;/p&gt;

</description>
        <pubDate>Fri, 15 Jun 2018 14:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2018/06/15/dissociating-shock-tube.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2018/06/15/dissociating-shock-tube.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>equilibrium</category>
        
        <category>finite-rate</category>
        
        <category>chemsitry</category>
        
        <category>reactions</category>
        
        <category>dissociation</category>
        
        <category>O2</category>
        
        <category>shock</category>
        
        
      </item>
    
      <item>
        <title>Reacting Flow</title>
        <description>&lt;h2 id=&quot;finite-rate-chemistry-in-aither&quot;&gt;Finite Rate Chemistry in Aither&lt;/h2&gt;
&lt;p&gt;As of &lt;a href=&quot;https://github.com/mnucci32/aither/releases/tag/v0.9.0&quot;&gt;v0.9.0&lt;/a&gt; Aither 
has a finite rate reacting flow capability. This post will detail how the 
chemistry source terms are calculated in Aither. The governing equations for 
multispecies reacting flow are given below.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\frac{\partial}{\partial t}\int_V W\,dV\ +
\int_{A} \left[ \frac{\partial F_i(W)}{\partial x_j} - \frac{\partial F_v(W)}{\partial x_j} \right]\,dA\
= \int_V S\,dV\&lt;/script&gt;

&lt;p&gt;In order to calculate the source term &lt;script type=&quot;math/tex&quot;&gt;S&lt;/script&gt; due to chemical reactions, some
information about each species in the simulation is needed. In Aither the
fluid database specifies the enthalpy of formation &lt;script type=&quot;math/tex&quot;&gt;h_f&lt;/script&gt;, molar mass &lt;script type=&quot;math/tex&quot;&gt;M&lt;/script&gt;,
vibrational temperatures &lt;script type=&quot;math/tex&quot;&gt;T_v&lt;/script&gt;, and the linear component of internal energy
&lt;script type=&quot;math/tex&quot;&gt;n&lt;/script&gt;. The fluid database also supplies reference properties for pressure
&lt;script type=&quot;math/tex&quot;&gt;p_{ref}&lt;/script&gt;, temperature &lt;script type=&quot;math/tex&quot;&gt;T_{ref}&lt;/script&gt;, and entropy &lt;script type=&quot;math/tex&quot;&gt;s_{ref}&lt;/script&gt;. It is possible
to add to Aither’s fluid database by specifying these properties for a new 
species. This information can be found in a variety of sources, including the
&lt;a href=&quot;https://webbook.nist.gov&quot;&gt;NIST Chemistry WebBook&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;chemistry-source-terms&quot;&gt;Chemistry Source Terms&lt;/h2&gt;
&lt;p&gt;Reacting flow simulations differ from nonreacting simulations in that the 
species mass equations have a source term, &lt;script type=&quot;math/tex&quot;&gt;S_s&lt;/script&gt;. This source term is
calculated via the law of mass action. In the equation below 
&lt;script type=&quot;math/tex&quot;&gt;\nu_{s,r}^{''}&lt;/script&gt; represents the stoichiometric coefficient on the product 
side of the reaction for species &lt;script type=&quot;math/tex&quot;&gt;s&lt;/script&gt; in reaction &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt;. Similarly, 
&lt;script type=&quot;math/tex&quot;&gt;\nu_{s,r}^{'}&lt;/script&gt; represents the stoichiometric coefficient on the reactant
side of the reaction for species &lt;script type=&quot;math/tex&quot;&gt;s&lt;/script&gt; in reaction &lt;script type=&quot;math/tex&quot;&gt;r&lt;/script&gt;.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;S_s = M_s \sum_{r=1}^{NR} \left( \nu_{s,r}^{''} - \nu_{s,r}^{'} \right)
   \left[ k_{f,r} \prod_{i=1}^{NS} \left(\frac{\rho_i}{M_i} \right)^{\nu_{i,r}^{'}} - 
   k_{b,r} \prod_{i=1}^{NS} \left(\frac{\rho_i}{M_i} \right)^{\nu_{i,r}^{''}} \right]&lt;/script&gt;

&lt;p&gt;The source term depends on the forward and backward reaction rates. These rates
are functions of temparature only. In Aither the forward reaction rate 
&lt;script type=&quot;math/tex&quot;&gt;k_f&lt;/script&gt; is calculated using an Arrhenius curve fit. The backward reaction 
rate &lt;script type=&quot;math/tex&quot;&gt;k_b&lt;/script&gt; is calculated from thermodynamic properties using the 
equilibrium rate &lt;script type=&quot;math/tex&quot;&gt;k_e&lt;/script&gt;. The units of the forward rate are 
&lt;script type=&quot;math/tex&quot;&gt;\frac{1}{s} \left( \frac{mol}{m^3} \right)^{1 - \sum_{s=1}^{NS} \nu_s^{'}}&lt;/script&gt;
and the units of the backward rate are
&lt;script type=&quot;math/tex&quot;&gt;\frac{1}{s} \left( \frac{mol}{m^3} \right)^{1 - \sum_{s=1}^{NS} \nu_s^{''}}&lt;/script&gt;.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;k_{f,r} = C T^{\eta} e^{\frac{T_a}{T}} \qquad
 k_{b,r} = \frac{k_{f,r}}{k_{e,r}}&lt;/script&gt;

&lt;h2 id=&quot;calculation-of-equilibrium-rate&quot;&gt;Calculation of Equilibrium Rate&lt;/h2&gt;
&lt;p&gt;The equilibrium rate of the reaction is calculated via the minimization of the
Gibbs free energy [1]. For a thermally perfect gas using the vibrational 
equilibrium model in Aither, the Gibbs free energy for a given species is shown 
below. In the equations below &lt;script type=&quot;math/tex&quot;&gt;NV&lt;/script&gt; represents the number of vibrational modes
for a given species.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;G_s = H_s - T S_s = h_{f,s} + \int_0^T c_{p,s} \left( t \right) dt - 
T \int_0^T \frac{c_{p,s} \left( t \right)}{t} dt - T s_{0,s}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;G_s = h_{f,s} + \int_0^T R_s \left( n + 1 + 
\sum_{v=1}^{NV} \left[ \frac{T_{v,s}}{2 t \cdot sinh \left( \frac{T_{v,s}}{2t} \right)} \right] ^ 2 \right) dt - 
T \int_0^T \frac{R_s}{t} \left( n + 1 + 
\sum_{v=1}^{NV} \left[ \frac{T_{v,s}}{2 t \cdot sinh \left( \frac{T_{v,s}}{2t} \right)} \right] ^ 2 \right) dt - T s_{0,s}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;G_s = h_{f,s} + R_s T \left( n + 1 \right) + R_s
\sum_{v=1}^{NV} \frac{T_{v,s}}{e^{\frac{T_{v,s}}{T}} - 1} - 
R_s T \left( n + 1 \right) ln \left( T \right) - T R_s
\int_0^T \sum_{v=1}^{NV} \left[ \frac{T_{v,s}}{2 t \cdot sinh \left( \frac{T_{v,s}}{2t} \right)} \right] ^ 2 dt - T s_{0,s}&lt;/script&gt;

&lt;p&gt;The remaining integral represents the vibrational contribution to the entropy
term. It can be solved with integration by parts.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\int_0^T \left[ \frac{T_v}{2 t \cdot sinh \left( \frac{T_v}{2t} \right)} \right] ^ 2 dt =
\frac{1}{T} \frac{T_v}{e^{\frac{T_v}{T}} - 1} -
\int_0^T \frac{T_v}{e^{\frac{T_v}{t}} - 1} \frac{-1}{t^2} dt =
\frac{T_v}{T \cdot \left( e^{\frac{T_v}{T}} - 1 \right)} - 
ln \left( e^{\frac{T_v}{T}} - 1 \right) +
\frac{T_v}{T}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\frac{T_v}{T \cdot \left( e^{\frac{T_v}{T}} - 1 \right)} - 
ln \left( e^{\frac{T_v}{T}} - 1 \right) +
\frac{T_v}{T} =
\frac{T_v}{T \cdot \left( e^{\frac{T_v}{T}} - 1 \right)} - 
ln \left( 1 - e^{\frac{-T_v}{T}} \right)&lt;/script&gt;

&lt;p&gt;Substituting this expression back into Gibbs free energy equation yields the 
following.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;G_s = h_{f,s} + R_s T \left( n + 1 \right) + R_s
\sum_{v=1}^{NV} \frac{T_{v,s}}{e^{\frac{T_{v,s}}{T}} - 1} - 
R_s T \left( n + 1 \right) ln \left( T \right) - R_s
\sum_{v=1}^{NV} \left[ \frac{T_{v,s}}{e^{\frac{T_{v,s}}{T}} - 1} - T
ln \left( 1 - e^{\frac{-T_{v,s}}{T}} \right) \right] - T s_{0,s}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;G_s = h_{f,s} + R_s T \left( n + 1 \right) \left[ 1 - ln \left( T \right) \right] -
R_s T \sum_{v=1}^{NV} ln \left( 1 - e^{\frac{-T_{v,s}}{T}} \right) - T s_{0,s}&lt;/script&gt;

&lt;p&gt;Where &lt;script type=&quot;math/tex&quot;&gt;s_{0,s}&lt;/script&gt; is a constant to account for any difference between the
given reference entropy of the species and the calculated entropy at the 
species’ reference temperature.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;s_{0,s} = s_{ref,s} - R_s \left( n + 1 \right) ln \left( T_{ref} \right) -
\sum_{v=1}^{NV} \frac{T_{v,s}}{T_{ref} \cdot \left( e^{\frac{T_{v,s}}{T_{ref}}} - 1 \right)} - ln \left( 1 - e^{\frac{-T_{v,s}}{T_{ref}}} \right)&lt;/script&gt;

&lt;p&gt;From this the equilibrium rate can be calculated as shown below.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;k_{e,r} = \left( \frac{p_{ref}}{\tilde{R} T} \right) 
^{\sum_{s=1}^{NS} \nu_{s,r}^{''} - \nu_{s,r}^{'}}
e^{-\sum_{s=1}^{NS} \frac{G_s}{R_s T} \left( \nu_{s,r}^{''} - \nu_{s,r}^{'} \right)}&lt;/script&gt;

&lt;h2 id=&quot;implicit-treatment&quot;&gt;Implicit Treatment&lt;/h2&gt;
&lt;p&gt;For the implicit solvers in Aither the chemistry jacobian and/or spectral 
radius of the jacobian are needed. The analytical chemistry jacobian is very 
complicated and somewhat expensive to calculate. For this reason Aither uses
a numerical jacobian. The derivative of the chemistry source terms is needed 
with respect to &lt;script type=&quot;math/tex&quot;&gt;\rho_s&lt;/script&gt; and &lt;script type=&quot;math/tex&quot;&gt;\rho E&lt;/script&gt;. This is done by perturbing the 
conserved variable of interest by a small amount &lt;script type=&quot;math/tex&quot;&gt;\epsilon&lt;/script&gt;, while keeping
the other conserved variables constant, and recalucuating the chemistry source 
terms.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\frac{\partial S}{\partial \rho_s} = 
\frac{S\left( \rho_s + \epsilon \right) - S \left( \rho_s \right)}{\epsilon}&lt;/script&gt;

&lt;p&gt;For the scalar matrix implicit solvers in Aither (LU-SGS and DPLUR) only the 
spectral radius of the chemistry jacobian is needed. This is approximated using
the procedure in [2] where only the negative terms that would increase the
diagonal dominance of the implicit matrix are treated implicitly.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\lambda_{chem} = min \left( \frac{S_s^{-}}{Y_s} \right)&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;S_s^{-} = M_s \sum_{r=1}^{NR} \left( \nu_{s,r}^{''} - \nu_{s,r}^{'} \right)
\left[ - k_{b,r} \prod_{i=1}^{NS} \left(\frac{\rho_i}{M_i} \right)^{\nu_{i,r}^{''}} \right]&lt;/script&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;[1] Luke, E. A. “A Rule-Based Specification System for Computational Fluid
Dynamics”. Ph. D. Thesis. 1999.&lt;/p&gt;

&lt;p&gt;[2] Savard, B. et al. “A Computationally-Efficient Semi-Implicit Iterative
Method for the Time Integration of Reacting Flows with Stiff Chemistry”. 
Journal of Computational Physics. 2015.&lt;/p&gt;

</description>
        <pubDate>Mon, 21 May 2018 08:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2018/05/21/reacting-flow.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2018/05/21/reacting-flow.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>finite-rate</category>
        
        <category>chemsitry</category>
        
        <category>reactions</category>
        
        
      </item>
    
      <item>
        <title>Nonreflecting Outlet Boundary Condition</title>
        <description>&lt;h2 id=&quot;subsonic-outflow&quot;&gt;Subsonic Outflow&lt;/h2&gt;
&lt;p&gt;At a subsonic outflow there are four characteristics leaving the domain and one characteristic entering the domain. This means that the flow state on the boundary can be calculated from the interior cell’s state for four of the five primative variables. Typically density and the three components of velocity are calculated from the interior cell’s state. This leaves pressure to specified using other information supplied by the user. This user supplied data is used with the incoming characteristic to determine the pressure on the boundary. The incoming 1D characteristic equation, with characteristic variable &lt;script type=&quot;math/tex&quot;&gt;w&lt;/script&gt; is shown below.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\frac{\partial w}{\partial t} = \frac{\partial u}{\partial t} - \frac{1}{\rho c} \frac{\partial p}{\partial t}&lt;/script&gt;

&lt;h2 id=&quot;standard-pressure-outlet&quot;&gt;Standard Pressure Outlet&lt;/h2&gt;
&lt;p&gt;With a standard pressure outlet, the implementation in most codes to to set the boundary pressure to a user defined value (shown below). This means that in the above characteristic equation &lt;script type=&quot;math/tex&quot;&gt;\frac{\partial p}{\partial t} = 0&lt;/script&gt; which shows that there is a reflection of intensity &lt;script type=&quot;math/tex&quot;&gt;\frac{\partial u}{\partial t}&lt;/script&gt;. This reflection can delay convergence as well as corrupt simulations where acoustic pressure fluctuations are important. Some such simulations would be aeroacoustic simulations and/or large eddy simulations.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;p_b = p_{ref}&lt;/script&gt;

&lt;h2 id=&quot;nonreflecting-outlet&quot;&gt;Nonreflecting Outlet&lt;/h2&gt;
&lt;p&gt;For a truly nonreflecting outlet &lt;script type=&quot;math/tex&quot;&gt;\frac{\partial w}{\partial t} = 0&lt;/script&gt;. However using this boundary condition can cause difficulty with setting the pressure on the boundary. When this boundary condition is used, the boundary pressure tends to float [1]. For this reason a relaxation coefficient &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt; is typically used. Rudy and Strikwerda [2] suggested &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt; in the form shown below where &lt;script type=&quot;math/tex&quot;&gt;M_{max}&lt;/script&gt; is the maximum Mach number on the boundary. The boundary condition proposed by Rudy and Strikwerda uses the locally one-dimensional inviscid (LODI) assumption. Many researchers have extended this approach to account for multi-dimensional flow at the outlet boundary by including the effect of transverse terms, &lt;script type=&quot;math/tex&quot;&gt;T&lt;/script&gt; [3]. The nonreflecting boundary condition is shown below where superscripts represent the time level of the variables.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;p_{b}^{n+1} = \frac{ p^n + \rho^n c^n \left( \overrightarrow{v}^{n+1} - \overrightarrow{v}^{n} \right) 
\cdot \overrightarrow{n} + \Delta t \kappa p_{ref} - \Delta t \beta T} {1 + \Delta t \kappa}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\kappa = \frac{\sigma c^n \left( 1 - M_{max}^{2} \right)}{l}&lt;/script&gt;

&lt;p&gt;The transverse terms are shown below. Here the subscript &lt;script type=&quot;math/tex&quot;&gt;t&lt;/script&gt; represents the transverse direction, and the subscript &lt;script type=&quot;math/tex&quot;&gt;n&lt;/script&gt; represents the boundary normal direction. For the &lt;script type=&quot;math/tex&quot;&gt;\beta&lt;/script&gt; calculation, the Mach number used is the average Mach number on the boundary.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\beta = M_{avg}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;T = -0.5 \left[ \overrightarrow{v}_{t}^{n} \cdot \left( \overrightarrow{\nabla}_{t} p^n - \rho^n c^2 \overrightarrow{\nabla}_{t} \overrightarrow{v}_{n}^{n} \right) + \gamma p^n \overrightarrow{\nabla}_{t} \cdot \overrightarrow{v}_{t}^{n} \right]&lt;/script&gt;

&lt;h2 id=&quot;convecting-lamb-oseen-vortex&quot;&gt;Convecting Lamb-Oseen Vortex&lt;/h2&gt;
&lt;p&gt;A common test case for nonreflecting boundary conditions is a vortex convecting through an outlet boundary [1]. Ideally the vortex leaves the domain and there are no pressure waves reflected back into the domain. With a standard pressure outlet implementation, this will not be the case. Nonreflecting boundary conditions can significantly reduce the reflections at the boundary.&lt;/p&gt;

&lt;p&gt;A test case was added to Aither for a convecting vortex corresponding to Case C in [1]. This simulation involves &lt;script type=&quot;math/tex&quot;&gt;N_2&lt;/script&gt; with a nominal pressure of 101300 Pascals and temperature of 288 Kelvin. The freestream flow is 100 meters per second with a Lamb-Oseen vortex with strength of 0.11 &lt;script type=&quot;math/tex&quot;&gt;\frac{m^2}{s}&lt;/script&gt; centered at the middle of the domain superimposed on the freestream flow. The radius of the vortex is one tenth the length of the domain. Results for the standard outlet and nonreflecting outlet are shown below in terms of the nondimensional pressure &lt;script type=&quot;math/tex&quot;&gt;p^{*}&lt;/script&gt;. Note that the &lt;script type=&quot;math/tex&quot;&gt;p^{*}&lt;/script&gt; used in the plot is the opposite that used in [1]. This is because it is more intuitive that the vortex core be shown as having low pressure.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;p^{*} = \left(p - p_{ref} \right) \frac{2 R^2}{\rho \Gamma^2}&lt;/script&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/convectingVortex.gif&quot; alt=&quot;ConvectingVortex&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Comparison of standard pressure outlet with nonreflecting pressure outlet.&lt;/center&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;[1] Granet, Victor, et al. “Comparison of Nonreflecting Outlet Boundary Conditions for Compressible Solvers on Unstructured Grids”. 2010.&lt;/p&gt;

&lt;p&gt;[2] Rudy, David and Strikwerda, John. “A Nonreflecting Outflow Boundary Condition for Subsonic Navier-Stokes Calculations”. Journal of Computational Physics. Vol 36, pp 55-70. 1980.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www-personal.umich.edu/~hgim/PDF/CTM06-BC.pdf&quot;&gt;[3]&lt;/a&gt; Yoo, C. S. and Im, H. G. “Characteristic Boundary Conditions for Simulations of Compressible Reacting Flows with Multi-Dimensional, Viscous, and Reaction Effects”. June 29, 2006.&lt;/p&gt;

</description>
        <pubDate>Sun, 27 Aug 2017 11:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2017/08/27/nonreflecting-bcs.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2017/08/27/nonreflecting-bcs.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>nonreflecting</category>
        
        <category>NRBC</category>
        
        <category>characteristic</category>
        
        <category>outlet</category>
        
        
      </item>
    
      <item>
        <title>Version 0.7.0 Released</title>
        <description>&lt;h2 id=&quot;release-notes&quot;&gt;Release Notes&lt;/h2&gt;
&lt;p&gt;The 0.7.0 release of Aither is available on 
&lt;a href=&quot;https://github.com/mnucci32/aither/releases&quot;&gt;Github&lt;/a&gt;. This release adds 
a thermally perfect gas model, the ability to assign initial conditions from a
cloud of points, and the AUSMPW+ inviscid flux scheme. These options can be 
invoked in the input file as shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;thermodynamicModel: thermallyPerfect
initialConditions: &amp;lt;icState(tag=-1; file=cloudOfPoints.dat)&amp;gt;
inviscidFlux: ausm
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;features-added&quot;&gt;Features Added&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Thermally perfect gas model&lt;/li&gt;
  &lt;li&gt;Ability to assign initial conditions from file&lt;/li&gt;
  &lt;li&gt;AUSMPW+ inviscid flux&lt;/li&gt;
  &lt;li&gt;Test cases
    &lt;ul&gt;
      &lt;li&gt;Thermally perfect supersonic flow over ramp&lt;/li&gt;
      &lt;li&gt;Uniform flow testing interblock orientations&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

</description>
        <pubDate>Tue, 13 Jun 2017 22:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2017/06/13/version-0-7-0.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2017/06/13/version-0-7-0.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>thermally perfect gas</category>
        
        <category>initial conditions</category>
        
        <category>AUSM</category>
        
        <category>AUSMPW+</category>
        
        
      </item>
    
      <item>
        <title>Thermally Perfect Thermodynamic Model</title>
        <description>&lt;h2 id=&quot;calorically-perfect-gas&quot;&gt;Calorically Perfect Gas&lt;/h2&gt;
&lt;p&gt;The default thermodynamic model in Aither is the calorically perfect gas model. 
Calorically perfect gases have constant specific heats 
&lt;script type=&quot;math/tex&quot;&gt;\left( c_p, c_v \right)&lt;/script&gt;, and therefore a constant &lt;script type=&quot;math/tex&quot;&gt;\gamma&lt;/script&gt;. In general 
the calorically perfect gas model is a good assumption for air at lower 
temperatures. The molecules of a calorically perfect gas are assumed to be rigid
so there is no vibrational component of internal energy. The equations below
show the implementation of the calorically perfect gas thermodynamic model in
Aither.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;e = e_{translational} + e_{rotational} + e_{vibrational} = c_v T&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;e_{translational} =  \left( n - 1 \right)  R T 
\,\,\,\,\,\,\,
 e_{rotational} = R T 
\,\,\,\,\,\,\,
 e_{vibrational} = 0&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;h = c_p T&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;c_v = n R
\,\,\,\,\,\,\,
c_p = \left( n + 1 \right) R
\,\,\,\,\,\,\,
\gamma = \frac{c_p}{c_v} = \frac{1}{n} + 1&lt;/script&gt;

&lt;h2 id=&quot;thermally-perfect-gas&quot;&gt;Thermally Perfect Gas&lt;/h2&gt;
&lt;p&gt;As the temperature of a gas increases the vibrational modes of its molecules 
are activated [1,2]. This means that some of the energy of the gas will move 
into these vibrational modes instead of raising the temperature of the gas. 
Therefore at higher temperatures where the vibrational modes are activated 
a thermally perfect gas will have a cooler temperature than a calorically 
perfect gas. The temperature at which the vibrational modes become significant 
is determined by the vibrational temperature &lt;script type=&quot;math/tex&quot;&gt;T_v&lt;/script&gt; of the gas. As the 
temperature of the gas approaches this value the vibrational component of 
internal energy becomes more and more significant.&lt;/p&gt;

&lt;p&gt;The activiation of vibrational modes also means the the specific heats are no
longer constant. Instead they are assumed to be functions of temperature only.
The equations below show the implementation of the thermally perfect 
thermodynamic model in Aither.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;e = e_{translational} + e_{rotational} + e_{vibrational} = 
\int_0^T c_v \left( t \right) dt 
\,\,\,\,\,\,\,
e_{vibrational} = \frac{R T_v}{e^{\frac{T_v}{T}} - 1}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;h = \int_0^T c_p \left( t \right) dt&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;c_v = \frac{\partial e}{\partial t} = 
R \left( n + \left[ \frac{\theta_v}{sinh \left( \theta_v \right)} \right] 
^ 2 \right) 
\,\,\,\,\,\,\,
c_p = \frac{\partial h}{\partial t} = 
R \left( n + 1 + \left[ \frac{\theta_v}{sinh \left( \theta_v \right)} \right]
 ^ 2 \right) 
\,\,\,\,\,\,\,
\theta_v = \frac{T_v}{2 T}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;\gamma = \frac{c_p \left( t \right)}{c_v \left( t \right)}&lt;/script&gt;

&lt;p&gt;In Aither the thermally perfect thermodynamic model can be activated as shown
below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;fluids: &amp;lt;fluid(name=air; n=2.5; molarMass=0.02897; vibrationalTemperature=3056)&amp;gt;
thermodynamicModel: thermallyPerfect
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;example-problem&quot;&gt;Example Problem&lt;/h2&gt;
&lt;p&gt;An example problem of when the thermally perfect model is needed is now a part
of the test cases that come with the Aither repository. It is currently only 
available on the &lt;strong&gt;develop&lt;/strong&gt; branch, but will be available on &lt;strong&gt;master&lt;/strong&gt; after 
the next release. The test case involves hot supersonic flow over a 20 degree 
ramp. The freestream conditions of the flow are Mach 3, static temperature of 
2000 K, and static pressure of 229,600 Pa.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/cpg_tpg.png&quot; alt=&quot;ThermallyPerfect&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Comparison of calorically perfect and thermally perfect thermodynamic
models.&lt;/center&gt;

&lt;p&gt;The results show that behind the shocks the thermally perfect gas model predicts
a cooler flow than the calorically perfect gas model. This is expected as with
the thermally perfect model some of the energy goes into the vibrational modes
of the gas molecules.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;http://www.donnerflug.de/thesis/Lampe_MS_Thesis.pdf&quot;&gt;[1]&lt;/a&gt;
Lampe, Dietrich Rudolf. “Thermally Perfect, Calorically Imperfect 
Taylor-Maccoll Flow”. 1994.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Hypersonic-High-Temperature-Dynamics-Second-
Education/dp/1563477807/ref=asap_bc?ie=UTF8&quot;&gt;[2]&lt;/a&gt; 
Anderson, John. “Hypersonic and High Temperature Gas Dynamics”. 2nd Edition. 
AIAA. 2006.&lt;/p&gt;

</description>
        <pubDate>Sat, 20 May 2017 17:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2017/05/20/thermally-perfect.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2017/05/20/thermally-perfect.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>thermally perfect</category>
        
        <category>calorically perfect</category>
        
        <category>ideal gas</category>
        
        <category>thermodynamics</category>
        
        
      </item>
    
      <item>
        <title>Version 0.6.0 Released</title>
        <description>&lt;h2 id=&quot;release-notes&quot;&gt;Release Notes&lt;/h2&gt;
&lt;p&gt;The 0.6.0 release of Aither is available on 
&lt;a href=&quot;https://github.com/mnucci32/aither/releases&quot;&gt;Github&lt;/a&gt;. This release adds 
periodic boundary conditions and wall functions for turbulent flow. Wall 
variables can now be output to Plot3D meta files as well. Additional test cases
have been added for Couette flow and wall functions. The wall functions are 
available for the k-&lt;script type=&quot;math/tex&quot;&gt;\omega&lt;/script&gt; Wilcox, SST, SST-DES, and WALE turbulence models.
The wall functions are implemented in the way described by Nichols &amp;amp; Nelson [1].
If the first cell off the wall is in the log layer, the wall shear stress is 
prescribed by the wall of the law.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;u^+ = \frac{1}{\kappa} ln \left( y^+ \right) + B&lt;/script&gt;

&lt;p&gt;If the first cell off the wall results in a &lt;script type=&quot;math/tex&quot;&gt;y^+&lt;/script&gt; less than 10, the 
boundary condition automatically switches back to the low Reynolds number
formulation.&lt;/p&gt;

&lt;p&gt;Wall variable output can be requested by assigning a list of variables to the
&lt;strong&gt;wallOutputVariables&lt;/strong&gt; input. Wall functions can be turned on by setting the
&lt;strong&gt;wallTreatment&lt;/strong&gt; option for a &lt;strong&gt;viscousWall&lt;/strong&gt; to &lt;strong&gt;wallLaw&lt;/strong&gt; as shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;wallOutputVariables: &amp;lt;yplus, heatFlux, shearStress, frictionVelocity&amp;gt;
boundaryStates: &amp;lt;viscousWall(tag=1; wallTreatment=wallLaw)&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;features-added&quot;&gt;Features Added&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;Periodic boundary conditions&lt;/li&gt;
  &lt;li&gt;Wall functions for turbulent flow&lt;/li&gt;
  &lt;li&gt;Wall variables output&lt;/li&gt;
  &lt;li&gt;Test cases
    &lt;ul&gt;
      &lt;li&gt;Couette flow&lt;/li&gt;
      &lt;li&gt;Flat plate wall functions&lt;/li&gt;
    &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;[1] Nichols, R. H. &amp;amp; Nelson, C. C. 
“Wall Function Boundary Conditions Including Heat Transfer and Compressibility”.
AIAA Journal, Vol 42, No 6, June 2004.&lt;/p&gt;

</description>
        <pubDate>Mon, 01 May 2017 20:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2017/05/01/version-0-6-0.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2017/05/01/version-0-6-0.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>couette</category>
        
        <category>periodic</category>
        
        <category>isothermal</category>
        
        <category>wall law</category>
        
        <category>wall function</category>
        
        
      </item>
    
      <item>
        <title>Couette Flow &amp; New Boundary Conditions</title>
        <description>&lt;h2 id=&quot;couette-flow&quot;&gt;Couette Flow&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://en.wikipedia.org/wiki/Couette_flow&quot;&gt;Couette flow&lt;/a&gt; is viscous laminar flow
between two parallel plates, one of which is moving relative to the other. Due to its
simple nature and the existance of an analytical solution, it is a common validation
case for CFD codes. An example validation case is shown in Hirsch [1]. Couette flow
results in a constant shear stress which has a linear velocity profile and a parabolic
temperature profile as shown below.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;v(y) = \frac{y}{L} v_{wall}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;P_r E_c = \frac{\mu v^2_{wall}}{k \Delta T}&lt;/script&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;T(y) = T_{low} + \Delta T \frac{y}{L} \left[1 + \frac{1}{2} P_r E_c \left(1 - \frac{y}{L} \right) \right]&lt;/script&gt;

&lt;p&gt;Three of the newer features in Aither are periodic boundary conditions, moving walls,
and isothermal walls. A couette flow simulation can make use of all of these features,
so it makes a great addition to the test cases suite.&lt;/p&gt;

&lt;h2 id=&quot;problem-setup&quot;&gt;Problem Setup&lt;/h2&gt;
&lt;p&gt;The parallel plates are placed a distance of 0.001 meters apart. The bottom plate is
held at a temperature of 288 K and is stationary. The top plate is held at a temperature
of 289 K and is moving at 75.4 m/s. For this setup, the product of the Prandtl and Eckert
numbers is 4. This means that for the temperature profile, the maximum temperature will
not be at the plate, but in the flow instead. The exact solution dictates that the
maximum temperature should be three fourths of the way between the cold and hot plates.&lt;/p&gt;

&lt;p&gt;The CFD domain is a rectangular prism with the top and bottom modeled as viscous walls,
the sides as slip walls, and the front / back as periodic. Isothermal walls can be
specified in Aither by adding the &lt;strong&gt;temperature&lt;/strong&gt; parameter to the boundary state list.
Similarly moving walls can be specified by adding the &lt;strong&gt;velocity&lt;/strong&gt; parameter. Periodic
boundary conditions are specified by indicating which boundary condition tags should be
paired as periodic. This is done through the &lt;strong&gt;startTag&lt;/strong&gt; and &lt;strong&gt;endTag&lt;/strong&gt; parameters. For
each periodic boundary condition a transformation must be done to get from one periodic
face to the other. Currently a translation can be specified by adding the &lt;strong&gt;translation&lt;/strong&gt;
parameter which is a vector specifying how the boundary at the &lt;strong&gt;startTag&lt;/strong&gt; should be
translated to get to the boundary at the &lt;strong&gt;endTag&lt;/strong&gt;. Alternatively a rotation can be
specified by using the &lt;strong&gt;axis&lt;/strong&gt;, &lt;strong&gt;point&lt;/strong&gt;, and &lt;strong&gt;rotation&lt;/strong&gt; parameters. The &lt;strong&gt;axis&lt;/strong&gt;
parameter is a vector defining the axis of rotation. The &lt;strong&gt;point&lt;/strong&gt; parameter is a vector
defining a point about which to rotate. The &lt;strong&gt;rotation&lt;/strong&gt; parameter is a scalar defining
the rotation angle in radians. An example of these new boundary condition options is
shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;boundaryStates: &amp;lt;periodic(startTag=4; endTag=5; translation=[0.01, 0, 0]),
                 viscousWall(tag=1; temperature=288),
		 viscousWall(tag=2; temperature=289; velocity=[75.4, 0, 0])&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;results-and-summary&quot;&gt;Results and Summary&lt;/h2&gt;
&lt;p&gt;The results from Aither show a linear velocity profile and a parabolic temperature
profile as expected. The results agree very well with the exact solution. These results
can be reproduced by running the &lt;a href=&quot;https://github.com/mnucci32/aither&quot;&gt;Aither&lt;/a&gt; code. The
grid and input file for the couette flow case can be found in the &lt;strong&gt;testCases&lt;/strong&gt; directory
of the repository.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/couette.png&quot; alt=&quot;Couette&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Velocity and temperature profiles for Couette flow.&lt;/center&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Numerical-Computation-Internal-External-Flows/dp/0750665947&quot;&gt;[1]&lt;/a&gt;
Hirsch, Charles. “Numerical Computation of Internal and External Flows”. 2nd Edition.
Butterworth-Heinemann. 2006.&lt;/p&gt;

</description>
        <pubDate>Sat, 04 Mar 2017 17:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2017/03/04/couette-flow.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2017/03/04/couette-flow.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>couette</category>
        
        <category>periodic</category>
        
        <category>isothermal</category>
        
        
      </item>
    
      <item>
        <title>Sod's Shock Tube</title>
        <description>&lt;h2 id=&quot;sods-shock-tube&quot;&gt;Sod’s Shock Tube&lt;/h2&gt;
&lt;p&gt;Sod’s shock tube [1] is a 1D canonical problem used to test the accuracy of CFD codes. The problem
consists of a fluid in a tube divided by a diaphragm. The fluid on the left side of the diaphragm
is at a high pressure, and the fluid on the right side of the diaphragm is at a lower pressure. 
At time &lt;em&gt;t = 0&lt;/em&gt;, the diaphragm is punctured and the fluid is allowed to mix. This results in a
right moving shock wave and contact discontinuity, and a left moving expansion wave. Numerically
this can be simulated by solving the Euler equations. The exact solution can be determined
analytically and used to compare to the CFD simulation result. Anderson’s book [2] describes
the process for computing the analytical solution.&lt;/p&gt;

&lt;p&gt;Typically the flow variables are normalized by the high pressure state, so that the initial
conditions of the simulation are as shown.&lt;/p&gt;

&lt;script type=&quot;math/tex; mode=display&quot;&gt;Q_l = \left[ \begin{array}{c}
\rho_l \\
v_{x_l} \\
v_{y_l} \\
v_{z_l} \\
P_l \\
\end{array} \right] 
=
\left[ \begin{array}{c}
1.0 \\
0.0 \\
0.0 \\
0.0 \\
1.0 \\
\end{array} \right] 
;
Q_r = \left[ \begin{array}{c}
\rho_r \\
v_{x_r} \\
v_{y_r} \\
v_{z_r} \\
P_r \\
\end{array} \right] 
=
\left[ \begin{array}{c}
0.125 \\
0.0 \\
0.0 \\
0.0 \\
0.1 \\
\end{array} \right]&lt;/script&gt;

&lt;h2 id=&quot;reconstruction-schemes&quot;&gt;Reconstruction Schemes&lt;/h2&gt;
&lt;p&gt;In the cell-centered finite volume method, the volume averaged flow variables are stored at the
centroid of the cell. To calculate the fluxes at the cell faces, the flow variables are needed
at the cell faces. The solution therefore must be reconstructed from the cell centroids to the
cell faces. How this is done can greatly effect the accuracy of the simulation. The Sod’s shock
tube problem was run using three of the reconstruction methods available in Aither: &lt;em&gt;constant&lt;/em&gt;,
&lt;em&gt;thirdOrder&lt;/em&gt; (MUSCL), and &lt;em&gt;weno&lt;/em&gt;.&lt;/p&gt;

&lt;h4 id=&quot;constant-reconstruction&quot;&gt;Constant Reconstruction&lt;/h4&gt;
&lt;p&gt;Constant reconstruction is a zeroth order reconstruction that results in a first order accurate
simulation. In this method the flow variables at the cell face are set equal to the flow
variables at the adjacent cell center. While very robust, this method is quite dissipative. It
typically results in a solution that is not accurate enough for engineering purposes, as
important flow features such as shocks are smeared.&lt;/p&gt;

&lt;h4 id=&quot;muscl-reconstruction&quot;&gt;MUSCL Reconstruction&lt;/h4&gt;
&lt;p&gt;MUSCL schemes were originally developed by van Leer. The stencil for this family of schemes uses
the flow variables at two cell centers upwind, and one downwind of the cell face. The MUSCL
schemes vary the weights of the flow variables in the stencil via a parameter &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt;. For
most values of &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt; the scheme results in a piecewise linear reconstruction which in turn
results in a second order accurate simulation. However, when &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt; is set equal to one third,
the scheme results in a piecewise parabolic reconstruction that is third order accurate. However,
due to the assumption that the flux is constant over the cell face, the simulation is still
second order accurate. The solution error for a simulation with &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt; equal to a third will
typically be lower than for other values of &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt;.&lt;/p&gt;

&lt;p&gt;The MUSCL scheme by itself as with all higer order accurate schemes suffers from spurious
oscillations around discontinuities. In practice the reconstruction is limited through the use of
a slope limiter. This means that near discontinuities the order of accuracy of the reconstruction
is dropped to avoid the spurious oscillations.&lt;/p&gt;

&lt;h4 id=&quot;weno-reconstruction&quot;&gt;WENO Reconstruction&lt;/h4&gt;
&lt;p&gt;Weighted essentially non-oscillatory (WENO) schemes [3] were originally developed by Shu. The
stencil for this family of schemes uses the flow variables at three cell centers upwind, and two
downwind of the cell face. The WENO scheme uses the piecewise parabolic reconstruction of the
MUSCL scheme with &lt;script type=&quot;math/tex&quot;&gt;\kappa&lt;/script&gt; equal to one third over three candidate substencils. The first of the
three substencils consists of the three upwind cells. The second consists of two upwind cells
and one downwind cell. The third substencil consists of one upwind cell and two downwind cells.
These three substencils are then weighted and combined to produce a fifth order accurate
reconstruction in smooth regions of the flow. In areas near discontinuties, the substencils
containing discontinuities are weighted to not contribute to the reconstruction which drops the
order of accuracy. Even though the reconstruction can be fifth order accurate, the simulation will
still be limited to second order accuracy due to the assumption of a constant flux on the cell
face.&lt;/p&gt;

&lt;h2 id=&quot;results&quot;&gt;Results&lt;/h2&gt;
&lt;p&gt;The results at nondimensionalized time &lt;em&gt;t = 0.1&lt;/em&gt; are shown below. Near the discontinuities, the
excessive dissipation of the constant reconstruction can be seen. As expected, the MUSCL and
WENO schemes do much better.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/sod.png&quot; alt=&quot;Sod&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Shock tube results for constant, MUSCL, and WENO reconstructions.&lt;/center&gt;

&lt;p&gt;It is tough to tell the difference between the MUSCL and WENO results, so a zoomed in view of the
normalized density is shown below. In the picture below is can be seen that the WENO scheme does
slightly better in that it is a bit sharper near the discontinuities. This is due to its higher
order accuracy in the reconstruction.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/downloads/sod_zoom.png&quot; alt=&quot;Sod_Zoom&quot; class=&quot;center-image&quot; /&gt;&lt;/p&gt;

&lt;center&gt;Detail view of density showing expansion, contact, and shock waves.&lt;/center&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;The WENO scheme provides the most accurate simulation of Sod’s shock tube problem. The constant
reconstruction method provides the most dissipative solution. These results can be reproduced by
running the &lt;a href=&quot;https://github.com/mnucci32/aither&quot;&gt;Aither&lt;/a&gt; code. The grid and input file for
the shock tube case can be found in the &lt;strong&gt;testCases&lt;/strong&gt; directory of the repository. The python
script used to compare the results to the exact simulation can be found
&lt;a href=&quot;https://github.com/mnucci32/SodShockTube&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;p&gt;[1] Sod, G. A. “A Survey of Several Finite Difference Methods for Systems of Nonlinear Hyperbolic 
Conservation Laws”, Journal of Computational Physics, Vol 27, pp 1-31. 1978.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://www.amazon.com/Modern-Compressible-Flow-Historical-Perspective/dp/0072424435&quot;&gt;[2]&lt;/a&gt;
Anderson, J. “Modern Compressible Flow with Historical Perspective”. McGraw-Hill Education, 2002.&lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19980007543.pdf&quot;&gt;[3]&lt;/a&gt; Shu, C. “Essentially 
Non-Oscillatory and Weighted Essentially Non-Oscillatory Schemes for Hyperbolic Conservation 
Laws”. NASA CR-97-206253. ICASE Report No. 97-65. 1997.&lt;/p&gt;
</description>
        <pubDate>Sun, 29 Jan 2017 17:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2017/01/29/sod-shock-tube.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2017/01/29/sod-shock-tube.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>shock tube</category>
        
        <category>sod</category>
        
        <category>weno</category>
        
        <category>weno-z</category>
        
        <category>muscl</category>
        
        
      </item>
    
      <item>
        <title>New Input File Syntax: Vectors, States, &amp; Lists</title>
        <description>&lt;h2 id=&quot;new-input-file-syntax&quot;&gt;New Input File Syntax&lt;/h2&gt;
&lt;p&gt;There is a new input file syntax for Aither now in use in the &lt;strong&gt;develop&lt;/strong&gt; branch of the code. This
syntax makes it easy to specify initial conditions by grid block, and boundary conditions by
boundary condtion tag. This is a huge upgrade in usability as it now allows for problems such as
Sod’s shock tube to be simulated. It also allows for easy implementation of various &lt;strong&gt;viscousWall&lt;/strong&gt;
boundary conditions such as &lt;em&gt;adiabatic&lt;/em&gt;, &lt;em&gt;isothermal&lt;/em&gt;, and &lt;em&gt;constant heat flux&lt;/em&gt;. The new input file
syntax is based off of three new objects (&lt;strong&gt;vectors&lt;/strong&gt;, &lt;strong&gt;lists&lt;/strong&gt;, &amp;amp; &lt;strong&gt;states&lt;/strong&gt;) which will be 
discussed in detail below.&lt;/p&gt;

&lt;h3 id=&quot;vectors&quot;&gt;Vectors&lt;/h3&gt;
&lt;p&gt;Vectors are now input in a comma separated list enclosed in brackets like below. Vectors must be
defined entirely on one line in the input file.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;velocityRef: [1.0, 0.0, 0.0]
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Valid vector inputs have three components. If three components are not specified, Aither will throw
and error. Vector inputs are now used wherever vector quantities are needed such as for velocity
(above), or specifiying a direction as is done with the &lt;strong&gt;stagnationInlet&lt;/strong&gt; boundary condition.&lt;/p&gt;

&lt;h3 id=&quot;states&quot;&gt;States&lt;/h3&gt;
&lt;p&gt;States are a group of properties that apply to an initial condition state or a boundary condtion
state. States are identified by name, enclosed in parenthesis, and individual properties within a
state are assigned with the equals operator and separated by semicolons. States must be defined
entirely on one line in the input file. Below is an example of &lt;em&gt;icState&lt;/em&gt; which is used to specify
a flow state for initial condtions.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;icState(tag=0; pressure=101325; density=1.225; velocity=[100, 0, 0])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The supported properties depend on the type of state. There are optional turbulence properities
&lt;em&gt;tubulenceIntensity&lt;/em&gt; and &lt;em&gt;eddyViscosityRatio&lt;/em&gt; that may be specified for states used for inflow
boundary conditions or &lt;em&gt;icState&lt;/em&gt;. If either of the optional turbulence properties are specified,
both must be specified. For &lt;em&gt;icState&lt;/em&gt; the &lt;em&gt;tag&lt;/em&gt; property is special. It refers to the block
number in which the &lt;em&gt;icState&lt;/em&gt; will be applied. A value of -1 functions as the default state in
the event that there is not an &lt;em&gt;icState&lt;/em&gt; with a tag pointing to a given block. An explicity
specified tag takes precedence over the default state. For example for a four block grid with
two &lt;em&gt;icState&lt;/em&gt;s defined, one with a tag of -1, and another with a tag of 0, blocks 1-3 will use 
the default &lt;em&gt;icState&lt;/em&gt; with tag -1, and block 0 will use the &lt;em&gt;icState&lt;/em&gt; with the tag of 0.&lt;/p&gt;

&lt;p&gt;In addition to initial conditions, states are used for boundary conditions that may require
additional information. An example of each such boundary condition is shown below. For boundary
conditions, the tag property in each state refers to the boundary surface tag that is specified
in the boundary condition definition.&lt;/p&gt;

&lt;p&gt;Inflow boundary conditions. These may optionally specify the turbulence properties.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;characteristic(tag=0; pressure=101325; density=1.225; velocity=[100, 0, 0])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;stagnationInlet(tag=0; p0=101325; t0=300; direction=[1, 0, 0])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;supersonicInflow(tag=0; pressure=101325; density=1.225; velocity=[100, 0, 0])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;subsonicInflow(tag=0; density=1.225; velocity=[100, 0, 0])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Outflow boundary conditions.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;pressureOutlet(tag=0; pressure=101325)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;subsonicOutflow(tag=0; pressure=101325)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Wall boundary condtions. One of &lt;em&gt;heatFlux&lt;/em&gt; or &lt;em&gt;temperature&lt;/em&gt; may be specified. The default behavior is zero
velocity and zero heat flux which corresponds to a stationary adiabatic wall.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;viscousWall(tag=0; heatFlux=100)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;viscousWall(tag=0; temperature=400)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;viscousWall(tag=0; velocity=[10, 0, 0])
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;lists&quot;&gt;Lists&lt;/h3&gt;
&lt;p&gt;Lists are a comma separated group of properties that are enclosed in angle brackets. Lists may be specified
across multiple lines. Lists are most commonly used to specify the variables to output, the initial condition
states, and the boundary condition states. Examples are shown below.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;outputVariables: &amp;lt;density, vel_x, vel_y, vel_z, pressure, temperature, mach&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;initialConditions: &amp;lt;icState(tag=0; pressure=101325; density=1.225; velocity=[0, 0, 0]),
                    icState(tag=1; pressure=10132.5; density=0.153125; velocity=[0, 0, 0])&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;boundaryStates: &amp;lt;characteristic(tag=0; pressure=101325; density=1.225; velocity=[100, 0, 0]),
                 viscousWall(tag=1; velocity=[10, 0, 0])&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;summary&quot;&gt;Summary&lt;/h2&gt;
&lt;p&gt;The new input syntax in Aither is more intuitive and now allows for a wider variety of problems to
easily be simulated. All of the test cases in the &lt;strong&gt;develop&lt;/strong&gt; branch have been updated to support this
new syntax. Grab the &lt;strong&gt;develop&lt;/strong&gt; branch from Github and try it out today. This will be merging into the
&lt;strong&gt;master&lt;/strong&gt; branch shortly.&lt;/p&gt;

</description>
        <pubDate>Mon, 26 Dec 2016 02:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2016/12/26/new-input-syntax.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2016/12/26/new-input-syntax.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>develop</category>
        
        <category>vectors</category>
        
        <category>states</category>
        
        <category>lists</category>
        
        <category>input</category>
        
        <category>syntax</category>
        
        
      </item>
    
      <item>
        <title>Using Travis CI For Regression Tests</title>
        <description>&lt;h2 id=&quot;why-use-a-continuous-integration-service&quot;&gt;Why Use A Continuous Integration Service?&lt;/h2&gt;
&lt;p&gt;Continuous integration services allow code updates to be built and tested on a variety of platforms. This saves the developer
a lot of time by not having to manually test the code. As Aither grows larger it becomes more and more beneficial to use a
continuous integration service. For example, say a more efficient way to calculate the inviscid flux was found, and a new
branch was created to refactor the invisicid flux code to use this new method. This change should result in the same solution,
but should take less time to complete. To be thorough, before merging the code back into the &lt;strong&gt;develop&lt;/strong&gt; branch, unit tests
covering all of the code’s various functionality should be completed. These tests should still show that the solution is the
same as it was prior to the refactor. It can be tedious and time consuming to manually run these tests, not to mention
the tests should be run on different operating systems, and with different compilers as well. This is where continuous
integration saves the day! A continuous integration service will automatically build the most updated code on a variety of
operating systems with a variety of compilers, and can be made to run regression tests. This way it can easily be determined
if the refactor introduced any bugs.&lt;/p&gt;

&lt;h2 id=&quot;aithers-requirements-for-continuous-integration&quot;&gt;Aither’s Requirements For Continuous Integration&lt;/h2&gt;
&lt;p&gt;Ok, so it is clear that continuous integration is a good thing, but which service should be used? Ideally, a continuous integration
service would provide the following:&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Free (Aither is not a money making venture after all)&lt;/li&gt;
  &lt;li&gt;Testing on multiple operating systems (Aither is cross platform)&lt;/li&gt;
  &lt;li&gt;Testing with multiple compilers&lt;/li&gt;
  &lt;li&gt;Ability to use modern C++ (Aither uses C++14)&lt;/li&gt;
  &lt;li&gt;Support for required dependencies (Aither requires an MPI implementation and Cmake)&lt;/li&gt;
  &lt;li&gt;Ability to run regression tests in parallel&lt;/li&gt;
  &lt;li&gt;Easy to use within &lt;a href=&quot;https://github.com&quot;&gt;Github&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After a brief survery of available options, Aither recently started using &lt;a href=&quot;https://travis-ci.org&quot;&gt;Travis CI&lt;/a&gt; for continuous
integration. Travis CI meets all of the above requirements. It is free for open source projects, widely used in the Github 
community (i.e. &lt;a href=&quot;https://github.com/su2code/SU2&quot;&gt;SU2&lt;/a&gt;), and supports builds on Ubuntu and macOS.&lt;/p&gt;

&lt;h2 id=&quot;using-travis-ci&quot;&gt;Using Travis CI&lt;/h2&gt;
&lt;p&gt;Once an account has been created with Travis CI it is easy to integrate with Github. All that is required is to add a &lt;strong&gt;.travis.yml&lt;/strong&gt; file
to the repository. This file instructs Travis CI on how to build the code and run any regression tests. For Aither, a matrix of five
builds is setup (Ubuntu/gcc-5, Ubuntu/gcc-6, Ubuntu/clang, macOS/gcc-6, macOS/clang). These builds are setup under the &lt;code class=&quot;highlighter-rouge&quot;&gt;matrix&lt;/code&gt; data
field of the &lt;strong&gt;.travis.yml&lt;/strong&gt; file. An abbreviated build matrix is shown below; each of the builds is marked by the &lt;code class=&quot;highlighter-rouge&quot;&gt;- os:&lt;/code&gt; line.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# set up build matrix&lt;/span&gt;
&lt;span class=&quot;na&quot;&gt;matrix&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;include&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# build for Ubuntu/gcc-6&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;linux&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;dist&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;trusty&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;sudo&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;required&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;compiler&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;gcc&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# add toolchains for newer, C++14 supporting gcc-6&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;addons&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;na&quot;&gt;apt&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;sources&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;ubuntu-toolchain-r-test&lt;/span&gt;
          &lt;span class=&quot;na&quot;&gt;packages&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
            &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;g++-6 gcc-6 libstdc++-6-dev&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# change default compiler to newer gcc-6&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;CXX_COMPILER=g++-6&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;C_COMPILER=gcc-6&lt;/span&gt;
    &lt;span class=&quot;c1&quot;&gt;# build for macOS/clang&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;na&quot;&gt;os&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;osx&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;osx_image&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;xcode8&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;compiler&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;clang&lt;/span&gt;
      &lt;span class=&quot;c1&quot;&gt;# change defualt and homebrew compilers to clang&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;env&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;CXX_COMPILER=clang++&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;C_COMPILER=clang&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HOMEBREW_CC=clang&lt;/span&gt;
        &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;HOMEBREW_CXX=clang++&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;installing-mpi&quot;&gt;Installing MPI&lt;/h3&gt;
&lt;p&gt;During the build matrix setup, environment variables for the C/C++ compilers are changed to reflect the newer C++14 supporting
compiler to be used in the build. Travis CI only offers Ubuntu 14.04 as its newest linux offering. Since this version of the
operating systems is a few years old, updated compilers are needed for the latest C++ standard. However, when the Ubuntu
package manager is used, it installs binaries that were created with the system C/C++ compilers. For compatability purposes,
it would be best if Aither used a version of MPI that was compiled with the same compiler that will be used to compile
Aither itself. For this reason OpenMPI is compiled from source using the updated compilers.&lt;/p&gt;

&lt;p&gt;For macOS, things are a little different. The macOS virtual machines from Travis CI come preinstalled with the 
&lt;a href=&quot;http://brew.sh&quot;&gt;homebrew&lt;/a&gt; package manager. With homebrew the &lt;code class=&quot;highlighter-rouge&quot;&gt;HOMEBREW_CC&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;HOMEBREW_CXX&lt;/code&gt; environment variables
control the compiler that new packages are built with. This means that installing MPI is easier because the package
manager can do it automatically.&lt;/p&gt;

&lt;p&gt;This means that the &lt;strong&gt;.travis.yml&lt;/strong&gt; script has to tell Travis CI to install MPI in a different way depending on which
operating system the build is happening on. This can easily be done with a simple bash script as shown below.&lt;/p&gt;

&lt;div class=&quot;language-bash highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c&quot;&gt;#!/bin/bash&lt;/span&gt;

&lt;span class=&quot;c&quot;&gt;# for macOS builds use OpenMPI from homebrew&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TRAVIS_OS_NAME&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;osx&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
    &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;openmpi
    &lt;span class=&quot;c&quot;&gt;# check to see if OpenMPI is cached from previous build&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;bin/mpirun&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
	&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Using cached OpenMPI&quot;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else
        &lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Installing OpenMPI with homebrew&quot;&lt;/span&gt;
	&lt;span class=&quot;nv&quot;&gt;HOMEBREW_TEMP&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TRAVIS_BUILD_DIR&lt;/span&gt;/openmpi
        brew install open-mpi
    &lt;span class=&quot;k&quot;&gt;fi
else&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# for Ubuntu builds install OpenMPI from source&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# check to see if OpenMPI is cached from previous build&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;openmpi/bin/mpirun&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;[&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-f&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;openmpi-2.0.1/config.log&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;]&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;then
	&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Using cached OpenMPI&quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Configuring OpenMPI&quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;openmpi-2.0.1
	./configure &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TRAVIS_BUILD_DIR&lt;/span&gt;/openmpi &lt;span class=&quot;nv&quot;&gt;CC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$C_COMPILER&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;CXX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CXX_COMPILER&lt;/span&gt; &amp;amp;&amp;gt; openmpi.configure
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
        &lt;span class=&quot;c&quot;&gt;# install OpenMPI from source&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Downloading OpenMPI Source&quot;&lt;/span&gt;
	wget https://www.open-mpi.org/software/ompi/v2.0/downloads/openmpi-2.0.1.tar.gz
	&lt;span class=&quot;nb&quot;&gt;tar &lt;/span&gt;zxf openmpi-2.0.1.tar.gz
	&lt;span class=&quot;nb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;Configuring and building OpenMPI&quot;&lt;/span&gt;
	&lt;span class=&quot;nb&quot;&gt;cd &lt;/span&gt;openmpi-2.0.1
	./configure &lt;span class=&quot;nt&quot;&gt;--prefix&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$TRAVIS_BUILD_DIR&lt;/span&gt;/openmpi &lt;span class=&quot;nv&quot;&gt;CC&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$C_COMPILER&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;CXX&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;$CXX_COMPILER&lt;/span&gt; &amp;amp;&amp;gt; openmpi.configure
	make &lt;span class=&quot;nt&quot;&gt;-j4&lt;/span&gt; &amp;amp;&amp;gt; openmpi.make
	make install &amp;amp;&amp;gt; openmpi.install
	&lt;span class=&quot;nb&quot;&gt;cd&lt;/span&gt; ..
    &lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
    &lt;span class=&quot;c&quot;&gt;# recommended by Travis CI documentation to unset these for MPI builds&lt;/span&gt;
    &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CC&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unset &lt;/span&gt;CC
    &lt;span class=&quot;nb&quot;&gt;test&lt;/span&gt; &lt;span class=&quot;nt&quot;&gt;-n&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;$CXX&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;unset &lt;/span&gt;CXX
&lt;span class=&quot;k&quot;&gt;fi&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h3 id=&quot;caching-dependencies&quot;&gt;Caching Dependencies&lt;/h3&gt;
&lt;p&gt;Builds can be sped up on Travis CI by caching dependencies. Aither depends on MPI which can take a while to build from
source. However, this really only needs to be done once if the MPI installation can be cached and retrieved from build
to build. Fortunately, Travis CI allows this capability even for their free tier of services. To cache the MPI install
directory is simple. Only the following few lines need to be added to the &lt;strong&gt;.travis.yml&lt;/strong&gt; file. This caches the OpenMPI
source code directory, as well as the installation directory.&lt;/p&gt;

&lt;div class=&quot;language-yaml highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;na&quot;&gt;cache&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
  &lt;span class=&quot;na&quot;&gt;directories&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;openmpi&lt;/span&gt;
    &lt;span class=&quot;pi&quot;&gt;-&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;openmpi-2.0.1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;regression-tests&quot;&gt;Regression Tests&lt;/h2&gt;
&lt;p&gt;Once the build completes Travis CI will run the Aither regression tests. The regression tests are located in the &lt;strong&gt;testCases&lt;/strong&gt;
directory of the repository. Travis CI will run each case for 100 iterations and compare the residuals to some “truth” values.
If the residuals differ by less than a given ammount (1% for Aither), the test passes. The idea is that the regression tests
cover most or all of the code’s functionality. On Ubuntu builds there are two processors available, so the tests are run in
parallel. On macOS there is only one processor available, so the tests are run in serial. The Aither repository includes a
python script to automate the running of these regression tests. After Travis CI builds the code, the script is invoked to
run the tests.&lt;/p&gt;

&lt;h2 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h2&gt;
&lt;p&gt;Travis CI is now used by Aither to test builds on Ubuntu and macOS using gcc-5, gcc-6, and clang. Regression tests are run for
all of Aither’s test cases to ensure that no existing functionality is broken with changes to the code. For more information on
how the whole thing is set up, visit the &lt;a href=&quot;https://github.com/mnucci32/aither&quot;&gt;repository&lt;/a&gt; and check out the &lt;strong&gt;.travis.yml&lt;/strong&gt; and
&lt;strong&gt;travis/installMPI&lt;/strong&gt; files.&lt;/p&gt;
</description>
        <pubDate>Sat, 03 Dec 2016 12:00:00 +0000</pubDate>
        <link>http://mnucci32.github.io/aither/2016/12/03/using-travisci.html</link>
        <guid isPermaLink="true">http://mnucci32.github.io/aither/2016/12/03/using-travisci.html</guid>
        
        <category>CFD</category>
        
        <category>Aither</category>
        
        <category>C++</category>
        
        <category>v0.4.0</category>
        
        <category>travis</category>
        
        <category>continuous integration</category>
        
        <category>travisci</category>
        
        <category>regression</category>
        
        <category>C++11</category>
        
        <category>C++14</category>
        
        <category>Cmake</category>
        
        
      </item>
    
  </channel>
</rss>
