A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL, COMPRESSIBLE NAVIER–STOKES EQUATIONS...

7
A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL, COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY RHYS ULERICH Abstract. A time-varying manufactured solution is presented for the nondimensional, compressible Navier– Stokes equations under the assumption of a constant Prandtl number, Newtonian perfect gas obeying a power law viscosity. The chosen nondimensionalization employs a reference density, length, velocity, and temper- ature. The solution form includes waveforms with adjustable phase offsets and mixed partial derivatives to bolster code coverage. Temperature, rather than pressure, is selected to have a simple analytic form to aid verifying codes having temperature-based boundary conditions. Suggested verification tests for isothermal channel and flat plate codes are provided. A C++ implementation of the manufactured solution and the forcing it requires is provided. Tests are included to ensure the implementation matches the solution form to within acceptable floating point loss. 1. Mathematical model Under common assumptions the nondimensional Navier–Stokes equations may take the form ∂t ρ = -∇ · ρ~u + Q ρ ∂t ρ~u = -∇ · (~u ρ~u) - 1 Ma 2 p + 1 Re ∇· τ + ~ Q ρu ∂t ρe = -∇ · ρe~u -∇· p~u -∇· ~ q + Ma 2 Re ∇· τ~u + Q ρe aided by the auxiliary relations p =(γ - 1) ρe - Ma 2 ρ ~u · ~u 2 T = γ p ρ μ = T β λ = α - 2 3 μ τ = μ ~u + ~u T + λ (∇· ~u) I ~ q = - 1 RePr (γ - 1) μT where the nondimensional quantities Re = ρ 0 u 0 l 0 μ 0 Ma = u 0 a 0 Pr = μ 0 C p κ 0 γ = C p C v are the constant Reynolds number, Mach number, and Prandtl number, and ratio of specific heats, respec- tively. The fluid’s nondimensional dynamic viscosity follows a power law in temperature with exponent β. The fluid’s bulk viscosity is a constant multiple α of the dynamic viscosity. Setting α = 0 is equivalent to Stokes’ hypothesis that the bulk viscosity is zero. Here e denotes the specific total energy and that later we will refer to the components of ~u as the scalars u, v, and w. The arbitrary forcing terms Q ρ , ~ Q ρu , and Q ρe will be used to obtain the desired manufactured solution. 1

description

Abstract. A time-varying manufactured solution is presented for the nondimensional, compressible Navier–Stokes equations under the assumption of a constant Prandtl number, Newtonian perfect gas obeying a powerlaw viscosity. The chosen nondimensionalization employs a reference density, length, velocity, and temper-ature. The solution form includes waveforms with adjustable phase offsets and mixed partial derivatives tobolster code coverage. Temperature, rather than pressure, is selected to have a simple analytic form to aidverifying codes having temperature-based boundary conditions. Suggested verification tests for isothermalchannel and flat plate codes are provided. A C++ implementation of the manufactured solution and theforcing it requires is provided. Tests are included to ensure the implementation matches the solution formto within acceptable floating point loss.

Transcript of A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL, COMPRESSIBLE NAVIER–STOKES EQUATIONS...

Page 1: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,

COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

RHYS ULERICH

Abstract. A time-varying manufactured solution is presented for the nondimensional, compressible Navier–

Stokes equations under the assumption of a constant Prandtl number, Newtonian perfect gas obeying a power

law viscosity. The chosen nondimensionalization employs a reference density, length, velocity, and temper-ature. The solution form includes waveforms with adjustable phase offsets and mixed partial derivatives to

bolster code coverage. Temperature, rather than pressure, is selected to have a simple analytic form to aidverifying codes having temperature-based boundary conditions. Suggested verification tests for isothermal

channel and flat plate codes are provided. A C++ implementation of the manufactured solution and the

forcing it requires is provided. Tests are included to ensure the implementation matches the solution formto within acceptable floating point loss.

1. Mathematical model

Under common assumptions the nondimensional Navier–Stokes equations may take the form

∂tρ = −∇ · ρ~u+Qρ

∂tρ~u = −∇ · (~u⊗ ρ~u)− 1

Ma2∇p+

1

Re∇ ·↔τ + ~Qρu

∂tρe = −∇ · ρe~u−∇ · p~u−∇ · ~q +

Ma2

Re∇ ·↔τ~u+Qρe

aided by the auxiliary relations

p = (γ − 1)

(ρe−Ma2ρ

~u · ~u2

)T = γ

p

ρ

µ = T β λ =

(α− 2

3

↔τ = µ

(∇~u+∇~uT

)+ λ (∇ · ~u) I ~q = − 1

RePr (γ − 1)µ∇T

where the nondimensional quantities

Re =ρ0u0l0µ0

Ma =u0a0

Pr =µ0Cpκ0

γ =CpCv

are the constant Reynolds number, Mach number, and Prandtl number, and ratio of specific heats, respec-tively. The fluid’s nondimensional dynamic viscosity follows a power law in temperature with exponent β.The fluid’s bulk viscosity is a constant multiple α of the dynamic viscosity. Setting α = 0 is equivalent toStokes’ hypothesis that the bulk viscosity is zero. Here e denotes the specific total energy and that later we

will refer to the components of ~u as the scalars u, v, and w. The arbitrary forcing terms Qρ, ~Qρu, and Qρewill be used to obtain the desired manufactured solution.

1

Page 2: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

2. Manufactured solution

For all φ ∈ {ρ, u, v, w, T} we select analytical solutions of the form

φ(x, y, z, t) =aφ0 cos(fφ0 t+gφ0

)(2)

+ aφx cos(bφx 2πxL−1x +cφx

)cos

(fφx t+gφx

)+ aφxy cos

(bφxy2πxL−1x +cφxy

)cos

(dφxy2πyL−1y +eφxy

)cos

(fφxyt+gφxy

)+ aφxz cos

(bφxz2πxL−1x +cφxz

)cos

(dφxz2πzL−1z +eφxz

)cos

(fφxzt+gφxz

)+ aφy cos

(bφy 2πyL−1y +cφy

)cos

(fφy t+gφy

)+ aφyz cos

(bφyz2πyL−1y +cφyz

)cos

(dφyz2πzL−1z +eφyz

)cos

(fφyz t+gφyz

)+ aφz cos

(bφz 2πzL−1z +cφz

)cos

(fφz t+gφz

)where a, b, c, d, e, f , and g are constant coefficient collections indexed by φ and one or more directions. Toaid in providing reusable, physically realizable coefficients for Cartesian domains of arbitrary size, domainextents Lx, Ly, Lz have been introduced. Partial derivatives φt, φx, φy, φz, φxx, φxy, φxz, φyy, φyz, and φzzmay be computed directly from the chosen solutions.

Though they increase the solution’s complexity significantly, mixed partial spatial derivatives are includedto improve code coverage. Each term has an adjustable amplitude, frequency, and phase for all spatialdimensions. Cosines were chosen so all terms can be “turned off” by employing zero coefficients. It issuggested that users gradually “turn on” the more complicated features of the solution (i.e. use non-zerocoefficients) after ensuring simpler usage has been successful.

The Python-based computer algebra system SymPy (http://sympy.org) can both compute the deriva-tives and output C code for computing these values at some x, y, z, and t:

1 #!/ usr/bin/env python# Using sympy , construct a des ired ana l y t i c a l so lu t i on for some quant i ty \phi .# Compute the ana l y t i c a l d e r i v a t i v e s of \phi and output them as C code . This# l o g i c w i l l be used to compute the manufactured so lu t i ons rho , u , v , w, and T.

6 from sympy import ∗

# Coordinatesvar ( ’ x y z t ’ , r e a l=True )

11 # Solut ion parameters used in the form of the ana l y t i c a l so lu t i onvar (””” a 0 a x a xy a xz a y a yz a z

b x b xy b xz b y b yz b zc x c xy c xz c y c yz c z

d xy d xz d yz16 e xy e xz e yz

f 0 f x f x y f x z f y f y z f zg 0 g x g xy g xz g y g yz g z ””” , r e a l=True )

# Exp l i c i t l y keep (2 ∗ pi / L) terms toge ther as i n d i v i s i b l e tokens21 var ( ’ twopi invLx twopi invLy twopi invLz ’ , r e a l=True )

# Form the ana l y t i c a l so lu t i on and i t s d e r i v a t i v e sphi = (

a 0 ∗ cos ( f 0 ∗ t + g 0 )26 + a x ∗ cos ( b x ∗ twopi invLx∗x + c x ) ∗ cos ( f x ∗ t + g x )

+ a xy ∗ cos ( b xy∗ twopi invLx∗x + c xy )∗ cos ( d xy∗ twopi invLy∗y + e xy )∗ cos ( f xy ∗ t + g xy )+ a xz ∗ cos ( b xz∗ twopi invLx∗x + c xz )∗ cos ( d xz∗ twopi invLz ∗z + e xz )∗ cos ( f x z ∗ t + g xz )+ a y ∗ cos ( b y ∗ twopi invLy∗y + c y ) ∗ cos ( f y ∗ t + g y )+ a yz ∗ cos ( b yz∗ twopi invLy∗y + c yz )∗ cos ( d yz∗ twopi invLz ∗z + e yz )∗ cos ( f y z ∗ t + g yz )

31 + a z ∗ cos ( b z ∗ twopi invLz ∗z + c z ) ∗ cos ( f z ∗ t + g z ))ph i t = phi . d i f f ( t )ph i x = phi . d i f f ( x )phi y = phi . d i f f ( y )

36 ph i z = phi . d i f f ( z )phi xx = phi x . d i f f ( x )phi xy = phi x . d i f f ( y )ph i xz = phi x . d i f f ( z )

2

Page 3: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

phi yy = phi y . d i f f ( y )41 phi yz = phi y . d i f f ( z )

ph i z z = ph i z . d i f f ( z )

# Save these r e s u l t s to f i l e s ’ so ln . c ’ and ’ so ln . h ’ as C codefrom sympy . u t i l i t i e s . codegen import codegen

46 codegen ( (( ” phi ” , phi ) ,( ” ph i t ” , ph i t ) ,( ” phi x ” , ph i x ) ,( ” phi xx ” , phi xx ) ,

51 ( ” phi xy ” , phi xy ) ,( ” ph i xz ” , ph i xz ) ,( ” phi y ” , ph i y ) ,( ” phi yy ” , phi yy ) ,( ” ph i yz ” , ph i yz ) ,

56 ( ” ph i z ” , ph i z ) ,( ” ph i z z ” , ph i z z ) ,

) ,”C” , ” so ln ” , header=False , t o f i l e s=True )

3. Forcing terms

The solutions given in § 2 may be plugged into the model from § 1 and solved for the forcing terms Qρ,~Qρu, and Qρe. However, solving for these complete terms entirely within the context of a computer algebrasystem causes an unwieldy explosion of terms. As the fully expanded forcing terms are too large to be usablein any meaningful way, they are not shown.

Instead, starting from the solution and its the analytic derivatives, we use basic calculus followed byalgebraic operations performed in floating point to obtain the necessary forcing at runtime. The errorsarising in this process behave like standard floating point truncation issues. Many of the computations areindependent of the constitutive relations used and could be employed for other manufactured solutions.

Computing the forcing terms looks as follows:

1 # Assuming tha t we are given# rho , rho t , rho x , rho xx , rho xy , rho xz , rho y , rho yy , rho yz , rho z , rho zz# u , u t , u x , u xx , u xy , u xz , u y , u yy , u yz , u z , u zz# v , v t , v x , v xx , v xy , v xz , v y , v yy , v yz , v z , v z z# w, w t , w x , w xx , w xy , w xz , w y , w yy , w yz , w z , w zz

6 # T, T t , T x , T xx , T xy , T xz , T y , T yy , T yz , T z , T zz# and the c o e f f i c i e n t s# alpha , beta , gamma, Ma, Pr , Re# compute the source terms# Q rho , Q rhou , Q rhov , Q rhow , Q rhoe

11 # necessary to force the so lu t i on rho , u , v , w, and T.

# Computations stemming from the con s t i t u t i v e r e l a t i on sh i p se = T / gamma / (gamma − 1) + Ma ∗ Ma ∗ (u∗u + v∗v + w∗w ) / 2e x = T x / gamma / (gamma − 1) + Ma ∗ Ma ∗ (u∗u x + v∗v x + w∗w x )

16 e y = T y / gamma / (gamma − 1) + Ma ∗ Ma ∗ (u∗u y + v∗v y + w∗w y )e z = T z / gamma / (gamma − 1) + Ma ∗ Ma ∗ (u∗u z + v∗ v z + w∗w z )e t = T t / gamma / (gamma − 1) + Ma ∗ Ma ∗ (u∗ u t + v∗ v t + w∗w t )p = ( rho ∗ T ) / gammap x = ( rho x ∗ T + rho ∗ T x ) / gamma

21 p y = ( rho y ∗ T + rho ∗ T y ) / gammap z = ( rho z ∗ T + rho ∗ T z ) / gammamu = pow(T, beta )mu x = beta ∗ pow(T, beta − 1) ∗ T xmu y = beta ∗ pow(T, beta − 1) ∗ T y

26 mu z = beta ∗ pow(T, beta − 1) ∗ T zlambda = (3 ∗ alpha − 2) ∗ mu / 3 # ”lambda” i s a Python keywordlambda x = (3 ∗ alpha − 2) ∗ mu x / 3 # Strange order of operat ions a l lows . . .lambda y = (3 ∗ alpha − 2) ∗ mu y / 3 # . . . a rb i t ra ry prec i s ion l i b r a r y to . . .lambda z = (3 ∗ alpha − 2) ∗ mu z / 3 # . . . handle ( alpha−2/3) fac tor co r r e c t l y

31 qx = − 1 / Re / Pr / (gamma − 1) ∗ mu ∗ T xqy = − 1 / Re / Pr / (gamma − 1) ∗ mu ∗ T yqz = − 1 / Re / Pr / (gamma − 1) ∗ mu ∗ T zqx x = − 1 / Re / Pr / (gamma − 1) ∗ (mu x ∗ T x + mu ∗ T xx )qy y = − 1 / Re / Pr / (gamma − 1) ∗ (mu y ∗ T y + mu ∗ T yy )

36 qz z = − 1 / Re / Pr / (gamma − 1) ∗ (mu z ∗ T z + mu ∗ T zz )

# Computations stemming from the compressib le , Newtonian f l u i d modelrhou = rho ∗ urhov = rho ∗ v

3

Page 4: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

41 rhow = rho ∗ wrhoe = rho ∗ erhou x = rho x ∗ u + rho ∗ u xrhov y = rho y ∗ v + rho ∗ v yrhow z = rho z ∗ w + rho ∗ w z

46 rhou t = rho t ∗ u + rho ∗ u trhov t = rho t ∗ v + rho ∗ v trhow t = rho t ∗ w + rho ∗ w trhoe t = rho t ∗ e + rho ∗ e t

51 rhouu x = ( rho x ∗ u ∗ u) + ( rho ∗ u x ∗ u) + ( rho ∗ u ∗ u x )rhouv y = ( rho y ∗ u ∗ v ) + ( rho ∗ u y ∗ v ) + ( rho ∗ u ∗ v y )rhouw z = ( rho z ∗ u ∗ w) + ( rho ∗ u z ∗ w) + ( rho ∗ u ∗ w z )rhouv x = ( rho x ∗ u ∗ v ) + ( rho ∗ u x ∗ v ) + ( rho ∗ u ∗ v x )rhovv y = ( rho y ∗ v ∗ v ) + ( rho ∗ v y ∗ v ) + ( rho ∗ v ∗ v y )

56 rhovw z = ( rho z ∗ v ∗ w) + ( rho ∗ v z ∗ w) + ( rho ∗ v ∗ w z )rhouw x = ( rho x ∗ u ∗ w) + ( rho ∗ u x ∗ w) + ( rho ∗ u ∗ w x )rhovw y = ( rho y ∗ v ∗ w) + ( rho ∗ v y ∗ w) + ( rho ∗ v ∗ w y )rhoww z = ( rho z ∗ w ∗ w) + ( rho ∗ w z ∗ w) + ( rho ∗ w ∗ w z )rhoue x = ( rho x ∗ u ∗ e ) + ( rho ∗ u x ∗ e ) + ( rho ∗ u ∗ e x )

61 rhove y = ( rho y ∗ v ∗ e ) + ( rho ∗ v y ∗ e ) + ( rho ∗ v ∗ e y )rhowe z = ( rho z ∗ w ∗ e ) + ( rho ∗ w z ∗ e ) + ( rho ∗ w ∗ e z )

tauxx = mu ∗ ( u x + u x ) + lambda ∗ ( u x + v y + w z )tauyy = mu ∗ ( v y + v y ) + lambda ∗ ( u x + v y + w z )

66 tauzz = mu ∗ ( w z + w z ) + lambda ∗ ( u x + v y + w z )tauxy = mu ∗ ( u y + v x )tauxz = mu ∗ ( u z + w x )tauyz = mu ∗ ( v z + w y )

71 tauxx x = ( mu x ∗ ( u x + u x ) + lambda x ∗ ( u x + v y + w z )+ mu ∗ ( u xx + u xx ) + lambda ∗ ( u xx + v xy + w xz ) )

tauyy y = ( mu y ∗ ( v y + v y ) + lambda y ∗ ( u x + v y + w z )+ mu ∗ ( v yy + v yy ) + lambda ∗ ( u xy + v yy + w yz ) )

tauzz z = ( mu z ∗ ( w z + w z ) + lambda z ∗ ( u x + v y + w z )76 + mu ∗ ( w zz + w zz ) + lambda ∗ ( u xz + v yz + w zz ) )

tauxy x = mu x ∗ ( u y + v x ) + mu ∗ ( u xy + v xx )tauxy y = mu y ∗ ( u y + v x ) + mu ∗ ( u yy + v xy )tauxz x = mu x ∗ ( u z + w x ) + mu ∗ ( u xz + w xx )

81 tauxz z = mu z ∗ ( u z + w x ) + mu ∗ ( u zz + w xz )tauyz y = mu y ∗ ( v z + w y ) + mu ∗ ( v yz + w yy )tauyz z = mu z ∗ ( v z + w y ) + mu ∗ ( v zz + w yz )

pu x = p x ∗ u + p ∗ u x86 pv y = p y ∗ v + p ∗ v y

pw z = p z ∗ w + p ∗ w zutauxx x = u x ∗ tauxx + u ∗ tauxx xvtauxy x = v x ∗ tauxy + v ∗ tauxy xwtauxz x = w x ∗ tauxz + w ∗ tauxz x

91 utauxy y = u y ∗ tauxy + u ∗ tauxy yvtauyy y = v y ∗ tauyy + v ∗ tauyy ywtauyz y = w y ∗ tauyz + w ∗ tauyz yutauxz z = u z ∗ tauxz + u ∗ tauxz zvtauyz z = v z ∗ tauyz + v ∗ tauyz z

96 wtauzz z = w z ∗ tauzz + w ∗ tauzz z

Q rho = rho t + rhou x + rhov y + rhow zQ rhou = ( rhou t + rhouu x + rhouv y + rhouw z

+ p x / (Ma ∗ Ma)101 − (1 / Re) ∗ ( tauxx x + tauxy y + tauxz z ) )

Q rhov = ( rhov t + rhouv x + rhovv y + rhovw z+ p y / (Ma ∗ Ma)− (1 / Re) ∗ ( tauxy x + tauyy y + tauyz z ) )

Q rhow = ( rhow t + rhouw x + rhovw y + rhoww z106 + p z / (Ma ∗ Ma)

− (1 / Re) ∗ ( tauxz x + tauyz y + tauzz z ) )Q rhoe = ( rhoe t + rhoue x + rhove y + rhowe z

+ pu x + pv y + pw z + qx x + qy y + qz z− (Ma ∗ Ma / Re) ∗ ( utauxx x + vtauxy x + wtauxz x

111 + utauxy y + vtauyy y + wtauyz y+ utauxz z + vtauyz z + wtauzz z ) )

4

Page 5: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

4. Suggested coefficients for isothermal channels and flat plates

Employing the manufactured solution requires fixing the more than two hundred coefficients appearingin equations (1) and (2). Selecting usable values is not difficult but it can be time consuming. We thereforepresent reasonable coefficient choices for testing channel and flat plate codes.

In both geometries the streamwise, wall-normal, and spanwise directions are labeled x, y, and z respec-tively. Both x and z are periodic while y ∈ {0, Ly} is not. Transient tests should likely take place withinthe duration 0 ≤ t ≤ 1/10 nondimensional time units as the time phase offsets (e.g. gTyz) have been chosenfor appreciable transients to occur throughout this time window.

For isothermal channel flow code verification we recommend testing using

bρy = buy = bvy = bwy = bTy =1

2

and the coefficients given in Table 1. With these choices the manufactured solution satisfies isothermal,no-slip conditions at y = 0, Ly. For isothermal flat plate code verification we recommend testing using

bρy = buy = bvy = bwy = bTy =1

4

and the coefficients given in Table 1. With these choices the manufactured solution satisfies an isothermal,no-slip condition at y = 0.

5. Reference Implementation

A templated, precision-agnostic C++ implementation for evaluating the manufactured solution and itsassociated forcing is included. Also included is a high precision test case which ensures the implementationcomputes exactly what is described in this documentation. The test can do so because it executes the samePython source files used to generate this document.

One can ensure the implementation files match this documentation by comparing against the followingMD5 checksums:

862eedb4f095ac3e7a772f39e74fa953 soln.py

436b0690a11dd4e0ae596eb0fab9aa50 forcing.py

a3a5e76fc6338e3784aa5a5f34990486 nsctpl_rholut_fwd.hpp

7114fc79c9424e39f248f5a67a8090f9 nsctpl_rholut.hpp

More details on the implementation and tests can be found in the solution’s README:

How to review this manufactured solution:

1) Assuming you have make, md5sum, g++, pdflatex, Python, SymPy,

and SWIG installed, you can build the PDF documentation, a test

program called ’check’, and a Python module by running ’make’.

2) Review the generated ’writeup.pdf’ to familiarize yourself with the

solution.

3) Run ’check’ and review the relative errors shown to convince yourself

the C++ code in nsctpl_rholut_fwd.hpp and nsctpl_rholut.hpp correctly

implements the manufactured solution and the associated manufactured

forcing as presented in ’writeup.pdf’. Results are shown for float,

double, and long double computations.

How to use this manufactured solution in your C++ flow solver:

1) Use nsctpl_rholut_fwd.hpp and nsctpl_rholut.hpp in your code by

#include-ing them. See the top of nsctpl_rholut_fwd.hpp for some

#include prerequisites and check.cpp for how you might instantiate

and use the provided classes.

2) At time zero, initialize your code’s state to contain the exact

manufactured solution.

5

Page 6: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

3) At each time step, add the appropriate manufactured forcing to each

equation within your flow solver.

4) After advancing for some time, compare the approximate state

fields your flow solver has computed with the exact solution.

Documentation:

README: This file

writeup.tex: Discussion of the model and the manufactured solution

soln.py: Generates C code for the solution and its derivatives

Included by writeup.tex

forcing.py: Step-by-step details of computing the necessary forcing

Included by writeup.tex

Reference Implementation:

Makefile: A GNU Makefile for building the LaTeX

documentation, C++ implementation and tests,

and a Python module.

nsctpl_rholut_fwd.hpp: C++ header file with forward declarations for the

manufactured solution. Code written to allow

#include-ing from some other file, possibly

within an anonymous namespace.

nsctpl_rholut.hpp: C++ header file containing templated

implementation details for nsctpl_rholut.hpp

based upon output of running soln.py.

Similar #include-related comments apply.

nsctpl_rholut.i: SWIG (http://www.swig.org/) declarations

for building a Python module named

’nsctpl_rholut’ exposing the C++ implementation.

setup.py: Python distutils script used to build

’nsctpl_rholut’ module. See Makefile for more

build-related details.

vizcoeffs.py: A Mayavi- and matplotlib-based script to visualize

the effect of making different coefficient choices.

Tests:

test.py: Using Sympy, computes high precision results for

a particular set of solution coefficients using

’soln.py’ and ’forcing.py’. Results saved into

test.hpp and employed in check.cpp.

check.cpp: Very simple driver used to ensure nsctpl_rholut.hpp

compiles at several different precisions and behaves

sanely. Checks that ensure C++ implementation matches

writeup.tex/soln.py/forcing.py to acceptable tolerance.

6

Page 7: A TRANSIENT MANUFACTURED SOLUTION FOR THE NONDIMENSIONAL,  COMPRESSIBLE NAVIER–STOKES EQUATIONS WITH A POWER LAW VISCOSITY

α = 0

β = 2/3

γ = 1.4

Ma = 1.15

Pr = 0.7

Re = 100

Lx = 4π

Ly = 2

Lz = 4π/3

aρ0 = 1

aρxy = 1/11

bρxy = 3

dρxy = 3

fρxy = 3

gρxy = π/4

aρy = 1/7

bρy = see § 4fρy = 1

gρy = π/4− 1/20

aρyz = 1/31

bρyz = 2

dρyz = 2

fρyz = 2

gρyz = π/4 + 1/20

auxy = 37/251

buxy = 3

cuxy = −π/2duxy = 3

euxy = −π/2fuxy = 3

guxy = π/4

auy = 1

buy = see § 4

cuy = −π/2fuy = 1

guy = π/4− 1/20

auyz = 41/257

buyz = 2

cuyz = −π/2duyz = 2

euyz = −π/2fuyz = 2

guyz = π/4 + 1/20

avxy = 3/337

bvxy = 3

cvxy = −π/2dvxy = 3

evxy = −π/2fvxy = 3

gvxy = π/4

avy = 2/127

bvy = see § 4cvy = −π/2fvy = 1

gvy = π/4− 1/20

avyz = 5/347

bvyz = 2

cvyz = −π/2dvyz = 2

evyz = −π/2fvyz = 2

gvyz = π/4 + 1/20

awxy = 11/409

bwxy = 3

cwxy = −π/2dwxy = 3

ewxy = −π/2

fwxy = 3

gwxy = π/4

awy = 7/373

bwy = see § 4cwy = −π/2fwy = 1

gwy = π/4− 1/20

awyz = 13/389

bwyz = 2

cwyz = −π/2dwyz = 2

ewyz = −π/2fwyz = 2

gwyz = π/4 + 1/20

aT0 = 1

aTxy = 1/17

bTxy = 3

cTxy = −π/2dTxy = 3

eTxy = −π/2fTxy = 3

gTxy = π/4

aTy = 1/13

bTy = see § 4cTy = −π/2fTy = 1

gTy = π/4− 1/20

aTyz = 1/37

bTyz = 2

cTyz = −π/2dTyz = 2

eTyz = −π/2fTyz = 2

gTyz = π/4 + 1/20

Table 1. Coefficient recommendations from section 4. Unlisted coefficients should be setto zero.

7