xref: /honee/qfunctions/blasius.h (revision e0d1a4dfdb0f42aa761b1f9bd0a13b235fd41f2a)
1bb8a0c61SJames Wright // Copyright (c) 2017-2022, Lawrence Livermore National Security, LLC and other CEED contributors.
2bb8a0c61SJames Wright // All Rights Reserved. See the top-level LICENSE and NOTICE files for details.
3bb8a0c61SJames Wright //
4bb8a0c61SJames Wright // SPDX-License-Identifier: BSD-2-Clause
5bb8a0c61SJames Wright //
6bb8a0c61SJames Wright // This file is part of CEED:  http://github.com/ceed
7bb8a0c61SJames Wright 
8bb8a0c61SJames Wright /// @file
9bb8a0c61SJames Wright /// Operator for Navier-Stokes example using PETSc
10bb8a0c61SJames Wright 
11bb8a0c61SJames Wright 
12bb8a0c61SJames Wright #ifndef blasius_h
13bb8a0c61SJames Wright #define blasius_h
14bb8a0c61SJames Wright 
15bb8a0c61SJames Wright #include <ceed.h>
16*e0d1a4dfSLeila Ghaffari #include "newtonian_state.h"
1715a3537eSJed Brown #include "newtonian_types.h"
18704b8bbeSJames Wright #include "utils.h"
19bb8a0c61SJames Wright 
20bb8a0c61SJames Wright typedef struct BlasiusContext_ *BlasiusContext;
21bb8a0c61SJames Wright struct BlasiusContext_ {
22bb8a0c61SJames Wright   bool       implicit; // !< Using implicit timesteping or not
232acc7cbcSKenneth E. Jansen   bool       weakT;    // !< flag to set Temperature weakly at inflow
24bb8a0c61SJames Wright   CeedScalar delta0;   // !< Boundary layer height at inflow
25bb8a0c61SJames Wright   CeedScalar Uinf;     // !< Velocity at boundary layer edge
26*e0d1a4dfSLeila Ghaffari   CeedScalar Tinf;     // !< Temperature at boundary layer edge
27*e0d1a4dfSLeila Ghaffari   CeedScalar T_wall;   // !< Temperature at the wall
28bb8a0c61SJames Wright   CeedScalar P0;       // !< Pressure at outflow
29bb8a0c61SJames Wright   CeedScalar theta0;   // !< Temperature at inflow
30ef2c71fdSJames Wright   CeedScalar x_inflow; // !< Location of inflow in x
31*e0d1a4dfSLeila Ghaffari   CeedScalar n_cheb;   // !< Number of Chebyshev terms
32*e0d1a4dfSLeila Ghaffari   CeedScalar *X;       // !< Chebyshev polynomial coordinate vector
33*e0d1a4dfSLeila Ghaffari   CeedScalar eta_max;  // !< Maximum eta in the domain
34*e0d1a4dfSLeila Ghaffari   CeedScalar *Tf_cheb; // !< Chebyshev coefficient for f
35*e0d1a4dfSLeila Ghaffari   CeedScalar *Th_cheb; // !< Chebyshev coefficient for h
36bb8a0c61SJames Wright   struct NewtonianIdealGasContext_ newtonian_ctx;
37bb8a0c61SJames Wright };
38bb8a0c61SJames Wright 
39*e0d1a4dfSLeila Ghaffari // *****************************************************************************
40*e0d1a4dfSLeila Ghaffari // This helper function evaluates Chebyshev polynomials with a set of
41*e0d1a4dfSLeila Ghaffari //  coefficients with all their derivatives represented as a recurrence table.
42*e0d1a4dfSLeila Ghaffari // *****************************************************************************
43*e0d1a4dfSLeila Ghaffari CEED_QFUNCTION_HELPER void ChebyshevEval(int N, const double *Tf, double x,
44*e0d1a4dfSLeila Ghaffari     double eta_max, double *f) {
45*e0d1a4dfSLeila Ghaffari   double dX_deta   = 2 / eta_max;
46*e0d1a4dfSLeila Ghaffari   double table[4][3] = {
47*e0d1a4dfSLeila Ghaffari     // Chebyshev polynomials T_0, T_1, T_2 of the first kind in (-1,1)
48*e0d1a4dfSLeila Ghaffari     {1, x, 2*x *x - 1}, {0, 1, 4*x}, {0, 0, 4}, {0, 0, 0}
49*e0d1a4dfSLeila Ghaffari   };
50*e0d1a4dfSLeila Ghaffari   for (int i=0; i<4; i++) {
51*e0d1a4dfSLeila Ghaffari     // i-th derivative of f
52*e0d1a4dfSLeila Ghaffari     f[i] = table[i][0] * Tf[0] + table[i][1] * Tf[1] + table[i][2] * Tf[2];
53*e0d1a4dfSLeila Ghaffari   }
54*e0d1a4dfSLeila Ghaffari   for (int i=3; i<N; i++) {
55*e0d1a4dfSLeila Ghaffari     // T_n(x) = 2xT_{n-1}(x) - T_{n-2}(x)
56*e0d1a4dfSLeila Ghaffari     table[0][i%3] = 2 * x * table[0][(i-1) % 3] - table[0][(i-2)%3];
57*e0d1a4dfSLeila Ghaffari     // Differentiate Chebyshev polynomials with the recurrence relation
58*e0d1a4dfSLeila Ghaffari     for (int j=1; j<4; j++) {
59*e0d1a4dfSLeila Ghaffari       // T'_{n}(x)/n = 2T_{n-1}(x) + T'_{n-2}(x)/n-2
60*e0d1a4dfSLeila Ghaffari       table[j][i%3] = i * (2 * table[j-1][(i-1) % 3] + table[j][(i-2)%3] / (i-2));
61*e0d1a4dfSLeila Ghaffari     }
62*e0d1a4dfSLeila Ghaffari     for (int j=0; j<4; j++) {
63*e0d1a4dfSLeila Ghaffari       f[j] += table[j][i%3] * Tf[i];
64bb8a0c61SJames Wright     }
65bb8a0c61SJames Wright   }
66*e0d1a4dfSLeila Ghaffari   for (int i=1; i<4; i++) {
67*e0d1a4dfSLeila Ghaffari     // Transform derivatives from Chebyshev [-1, 1] to [0, eta_max].
68*e0d1a4dfSLeila Ghaffari     for (int j=0; j<i; j++) f[i] *= dX_deta;
69*e0d1a4dfSLeila Ghaffari   }
70bb8a0c61SJames Wright }
71bb8a0c61SJames Wright 
72*e0d1a4dfSLeila Ghaffari // *****************************************************************************
73*e0d1a4dfSLeila Ghaffari // This helper function computes the Blasius boundary layer solution.
74*e0d1a4dfSLeila Ghaffari // *****************************************************************************
75*e0d1a4dfSLeila Ghaffari State CEED_QFUNCTION_HELPER(BlasiusSolution)(const BlasiusContext blasius,
76*e0d1a4dfSLeila Ghaffari     const CeedScalar x[3], const CeedScalar x0, const CeedScalar x_inflow,
77*e0d1a4dfSLeila Ghaffari     const CeedScalar rho, CeedScalar *t12) {
78*e0d1a4dfSLeila Ghaffari   CeedInt    N    = blasius->n_cheb;
79*e0d1a4dfSLeila Ghaffari   CeedScalar nu   = blasius->newtonian_ctx.mu / rho;
80*e0d1a4dfSLeila Ghaffari   CeedScalar eta  = x[1]*sqrt(blasius->Uinf/(nu*(x0+x[0]-x_inflow)));
81*e0d1a4dfSLeila Ghaffari   CeedScalar X    = 2 * (eta / blasius->eta_max) - 1.;
82*e0d1a4dfSLeila Ghaffari   CeedScalar Uinf = blasius->Uinf;
83*e0d1a4dfSLeila Ghaffari   CeedScalar Rd   = GasConstant(&blasius->newtonian_ctx);
84*e0d1a4dfSLeila Ghaffari 
85*e0d1a4dfSLeila Ghaffari   CeedScalar f[4], h[4];
86*e0d1a4dfSLeila Ghaffari   ChebyshevEval(N, blasius->Tf_cheb, X, blasius->eta_max, f);
87*e0d1a4dfSLeila Ghaffari   ChebyshevEval(N-1, blasius->Th_cheb, X, blasius->eta_max, h);
88*e0d1a4dfSLeila Ghaffari 
89*e0d1a4dfSLeila Ghaffari   *t12 = rho*nu*Uinf*f[2]*sqrt(Uinf/(nu*(x0+x[0]-x_inflow)));
90*e0d1a4dfSLeila Ghaffari 
91*e0d1a4dfSLeila Ghaffari   CeedScalar Y[5];
92*e0d1a4dfSLeila Ghaffari   Y[1] = Uinf * f[1];
93*e0d1a4dfSLeila Ghaffari   Y[2] = 0.5*sqrt(nu*Uinf/(x0+x[0]-x_inflow))*(eta*f[1] - f[0]);
94*e0d1a4dfSLeila Ghaffari   Y[3] = 0.;
95*e0d1a4dfSLeila Ghaffari   Y[4] = blasius->Tinf * h[0];
96*e0d1a4dfSLeila Ghaffari   Y[0] = rho * Rd * Y[4];
97*e0d1a4dfSLeila Ghaffari   return StateFromY(&blasius->newtonian_ctx, Y, x);
98bb8a0c61SJames Wright }
99bb8a0c61SJames Wright 
100bb8a0c61SJames Wright // *****************************************************************************
101bb8a0c61SJames Wright // This QFunction sets a Blasius boundary layer for the initial condition
102bb8a0c61SJames Wright // *****************************************************************************
103bb8a0c61SJames Wright CEED_QFUNCTION(ICsBlasius)(void *ctx, CeedInt Q,
104bb8a0c61SJames Wright                            const CeedScalar *const *in, CeedScalar *const *out) {
105bb8a0c61SJames Wright   // Inputs
106bb8a0c61SJames Wright   const CeedScalar (*X)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[0];
107bb8a0c61SJames Wright 
108bb8a0c61SJames Wright   // Outputs
109bb8a0c61SJames Wright   CeedScalar (*q0)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0];
110bb8a0c61SJames Wright 
111bb8a0c61SJames Wright   const BlasiusContext context = (BlasiusContext)ctx;
112bb8a0c61SJames Wright   const CeedScalar cv         = context->newtonian_ctx.cv;
113bb8a0c61SJames Wright   const CeedScalar mu         = context->newtonian_ctx.mu;
114bb8a0c61SJames Wright   const CeedScalar theta0     = context->theta0;
115bb8a0c61SJames Wright   const CeedScalar P0         = context->P0;
116bb8a0c61SJames Wright   const CeedScalar delta0     = context->delta0;
117bb8a0c61SJames Wright   const CeedScalar Uinf       = context->Uinf;
118ef2c71fdSJames Wright   const CeedScalar x_inflow   = context->x_inflow;
119*e0d1a4dfSLeila Ghaffari   const CeedScalar gamma      = HeatCapacityRatio(&context->newtonian_ctx);
120bb8a0c61SJames Wright   const CeedScalar e_internal = cv * theta0;
121bb8a0c61SJames Wright   const CeedScalar rho        = P0 / ((gamma - 1) * e_internal);
122bb8a0c61SJames Wright   const CeedScalar x0         = Uinf*rho / (mu*25/(delta0*delta0));
123*e0d1a4dfSLeila Ghaffari   CeedScalar t12;
124bb8a0c61SJames Wright 
125bb8a0c61SJames Wright   // Quadrature Point Loop
126bb8a0c61SJames Wright   CeedPragmaSIMD
127bb8a0c61SJames Wright   for (CeedInt i=0; i<Q; i++) {
128*e0d1a4dfSLeila Ghaffari     const CeedScalar x[3] = {X[0][i], X[1][i], 0.};
129*e0d1a4dfSLeila Ghaffari     State s = BlasiusSolution(context, x, x0, x_inflow, rho, &t12);
130*e0d1a4dfSLeila Ghaffari     CeedScalar q[5] = {0};
131*e0d1a4dfSLeila Ghaffari     UnpackState_U(s.U, q);
132*e0d1a4dfSLeila Ghaffari     for (CeedInt j=0; j<5; j++) q0[j][i] = q[j];
133bb8a0c61SJames Wright 
134bb8a0c61SJames Wright   } // End of Quadrature Point Loop
135bb8a0c61SJames Wright   return 0;
136bb8a0c61SJames Wright }
137bb8a0c61SJames Wright 
138bb8a0c61SJames Wright // *****************************************************************************
139bb8a0c61SJames Wright CEED_QFUNCTION(Blasius_Inflow)(void *ctx, CeedInt Q,
140bb8a0c61SJames Wright                                const CeedScalar *const *in,
141bb8a0c61SJames Wright                                CeedScalar *const *out) {
142bb8a0c61SJames Wright   // *INDENT-OFF*
143bb8a0c61SJames Wright   // Inputs
144bb8a0c61SJames Wright   const CeedScalar (*q)[CEED_Q_VLA]          = (const CeedScalar(*)[CEED_Q_VLA])in[0],
145dd64951cSJames Wright                    (*q_data_sur)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2],
146dd64951cSJames Wright                    (*X)[CEED_Q_VLA]          = (const CeedScalar(*)[CEED_Q_VLA])in[3];
147bb8a0c61SJames Wright 
148bb8a0c61SJames Wright   // Outputs
149bb8a0c61SJames Wright   CeedScalar (*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0];
150bb8a0c61SJames Wright   // *INDENT-ON*
151bb8a0c61SJames Wright   const BlasiusContext context = (BlasiusContext)ctx;
152bb8a0c61SJames Wright   const bool implicit       = context->implicit;
153bb8a0c61SJames Wright   const CeedScalar mu       = context->newtonian_ctx.mu;
154bb8a0c61SJames Wright   const CeedScalar cv       = context->newtonian_ctx.cv;
155*e0d1a4dfSLeila Ghaffari   const CeedScalar Rd       = GasConstant(&context->newtonian_ctx);
156*e0d1a4dfSLeila Ghaffari   const CeedScalar gamma    = HeatCapacityRatio(&context->newtonian_ctx);
157bb8a0c61SJames Wright   const CeedScalar theta0   = context->theta0;
158bb8a0c61SJames Wright   const CeedScalar P0       = context->P0;
159bb8a0c61SJames Wright   const CeedScalar delta0   = context->delta0;
160bb8a0c61SJames Wright   const CeedScalar Uinf     = context->Uinf;
161ef2c71fdSJames Wright   const CeedScalar x_inflow = context->x_inflow;
1622acc7cbcSKenneth E. Jansen   const bool       weakT    = context->weakT;
163bb8a0c61SJames Wright   const CeedScalar rho_0    = P0 / (Rd * theta0);
164704b8bbeSJames Wright   const CeedScalar x0       = Uinf*rho_0 / (mu*25/ Square(delta0));
165bb8a0c61SJames Wright 
166bb8a0c61SJames Wright   CeedPragmaSIMD
167bb8a0c61SJames Wright   // Quadrature Point Loop
168bb8a0c61SJames Wright   for (CeedInt i=0; i<Q; i++) {
169bb8a0c61SJames Wright     // Setup
170bb8a0c61SJames Wright     // -- Interp-to-Interp q_data
171bb8a0c61SJames Wright     // For explicit mode, the surface integral is on the RHS of ODE q_dot = f(q).
172bb8a0c61SJames Wright     // For implicit mode, it gets pulled to the LHS of implicit ODE/DAE g(q_dot, q).
173bb8a0c61SJames Wright     // We can effect this by swapping the sign on this weight
174bb8a0c61SJames Wright     const CeedScalar wdetJb  = (implicit ? -1. : 1.) * q_data_sur[0][i];
175bb8a0c61SJames Wright 
1762acc7cbcSKenneth E. Jansen     // Calculate inflow values
177*e0d1a4dfSLeila Ghaffari     const CeedScalar x[3] = {X[0][i], X[1][i], 0.};
178bb8a0c61SJames Wright     CeedScalar t12;
179*e0d1a4dfSLeila Ghaffari     State s = BlasiusSolution(context, x, x0, x_inflow, rho_0, &t12);
180bb8a0c61SJames Wright 
1812acc7cbcSKenneth E. Jansen     // enabling user to choose between weak T and weak rho inflow
1822acc7cbcSKenneth E. Jansen     CeedScalar rho,E_internal, P, E_kinetic;
1832acc7cbcSKenneth E. Jansen     if (weakT) {
1842acc7cbcSKenneth E. Jansen       // rho should be from the current solution
1852acc7cbcSKenneth E. Jansen       rho = q[0][i];
1862acc7cbcSKenneth E. Jansen       // Temperature is being set weakly (theta0) and for constant cv this sets E_internal
1872acc7cbcSKenneth E. Jansen       E_internal = rho * cv * theta0;
1882acc7cbcSKenneth E. Jansen       // Find pressure using
1892acc7cbcSKenneth E. Jansen       P = rho*Rd*theta0; // interior rho with exterior T
190*e0d1a4dfSLeila Ghaffari       E_kinetic = .5 * rho * Dot3(s.Y.velocity, s.Y.velocity);
1912acc7cbcSKenneth E. Jansen     } else {
1922acc7cbcSKenneth E. Jansen       //  Fixing rho weakly on the inflow to a value consistent with theta0 and P0
1932acc7cbcSKenneth E. Jansen       rho =  rho_0;
194*e0d1a4dfSLeila Ghaffari       E_kinetic = .5 * rho * Dot3(s.Y.velocity, s.Y.velocity);
1952acc7cbcSKenneth E. Jansen       E_internal = q[4][i] - E_kinetic; // uses set rho and u but E from solution
1962acc7cbcSKenneth E. Jansen       P = E_internal * (gamma - 1.);
1972acc7cbcSKenneth E. Jansen     }
1982acc7cbcSKenneth E. Jansen     const CeedScalar E = E_internal + E_kinetic;
199bb8a0c61SJames Wright     // ---- Normal vect
200bb8a0c61SJames Wright     const CeedScalar norm[3] = {q_data_sur[1][i],
201bb8a0c61SJames Wright                                 q_data_sur[2][i],
202bb8a0c61SJames Wright                                 q_data_sur[3][i]
203bb8a0c61SJames Wright                                };
204bb8a0c61SJames Wright 
205bb8a0c61SJames Wright     // The Physics
206bb8a0c61SJames Wright     // Zero v so all future terms can safely sum into it
207493642f1SJames Wright     for (CeedInt j=0; j<5; j++) v[j][i] = 0.;
208bb8a0c61SJames Wright 
209*e0d1a4dfSLeila Ghaffari     const CeedScalar u_normal = Dot3(norm, s.Y.velocity);
2109abe94a0SJed Brown     const CeedScalar viscous_flux[3] = {-t12 *norm[1], -t12 *norm[0], 0};
211bb8a0c61SJames Wright 
212bb8a0c61SJames Wright     // The Physics
213bb8a0c61SJames Wright     // -- Density
214bb8a0c61SJames Wright     v[0][i] -= wdetJb * rho * u_normal; // interior rho
215bb8a0c61SJames Wright 
216bb8a0c61SJames Wright     // -- Momentum
217493642f1SJames Wright     for (CeedInt j=0; j<3; j++)
218*e0d1a4dfSLeila Ghaffari       v[j+1][i] -= wdetJb * (rho * u_normal * s.Y.velocity[j] // interior rho
2199abe94a0SJed Brown                              + norm[j] * P // mixed P
2209abe94a0SJed Brown                              + viscous_flux[j]);
221bb8a0c61SJames Wright 
222bb8a0c61SJames Wright     // -- Total Energy Density
223*e0d1a4dfSLeila Ghaffari     v[4][i] -= wdetJb * (u_normal * (E + P) + Dot3(viscous_flux, s.Y.velocity));
224bb8a0c61SJames Wright 
225bb8a0c61SJames Wright   } // End Quadrature Point Loop
226bb8a0c61SJames Wright   return 0;
227bb8a0c61SJames Wright }
228bb8a0c61SJames Wright 
229*e0d1a4dfSLeila Ghaffari // *****************************************************************************
230f0b65372SJed Brown CEED_QFUNCTION(Blasius_Inflow_Jacobian)(void *ctx, CeedInt Q,
231f0b65372SJed Brown                                         const CeedScalar *const *in,
232f0b65372SJed Brown                                         CeedScalar *const *out) {
233f0b65372SJed Brown   // *INDENT-OFF*
234f0b65372SJed Brown   // Inputs
235f0b65372SJed Brown   const CeedScalar (*dq)[CEED_Q_VLA]         = (const CeedScalar(*)[CEED_Q_VLA])in[0],
23668ae065aSJames Wright                    (*q_data_sur)[CEED_Q_VLA] = (const CeedScalar(*)[CEED_Q_VLA])in[2],
23768ae065aSJames Wright                    (*X)[CEED_Q_VLA]          = (const CeedScalar(*)[CEED_Q_VLA])in[3];
238f0b65372SJed Brown 
239f0b65372SJed Brown   // Outputs
240f0b65372SJed Brown   CeedScalar (*v)[CEED_Q_VLA] = (CeedScalar(*)[CEED_Q_VLA])out[0];
241f0b65372SJed Brown   // *INDENT-ON*
242f0b65372SJed Brown   const BlasiusContext context = (BlasiusContext)ctx;
243f0b65372SJed Brown   const bool implicit     = context->implicit;
244f0b65372SJed Brown   const CeedScalar mu     = context->newtonian_ctx.mu;
245f0b65372SJed Brown   const CeedScalar cv     = context->newtonian_ctx.cv;
246*e0d1a4dfSLeila Ghaffari   const CeedScalar Rd     = GasConstant(&context->newtonian_ctx);
247*e0d1a4dfSLeila Ghaffari   const CeedScalar gamma  = HeatCapacityRatio(&context->newtonian_ctx);
248f0b65372SJed Brown   const CeedScalar theta0 = context->theta0;
249f0b65372SJed Brown   const CeedScalar P0     = context->P0;
250f0b65372SJed Brown   const CeedScalar delta0 = context->delta0;
251f0b65372SJed Brown   const CeedScalar Uinf   = context->Uinf;
252f0b65372SJed Brown   const bool       weakT  = context->weakT;
253f0b65372SJed Brown   const CeedScalar rho_0  = P0 / (Rd * theta0);
254f0b65372SJed Brown   const CeedScalar x0     = Uinf*rho_0 / (mu*25/ (delta0*delta0));
255f0b65372SJed Brown 
256f0b65372SJed Brown   CeedPragmaSIMD
257f0b65372SJed Brown   // Quadrature Point Loop
258f0b65372SJed Brown   for (CeedInt i=0; i<Q; i++) {
259f0b65372SJed Brown     // Setup
260f0b65372SJed Brown     // -- Interp-to-Interp q_data
261f0b65372SJed Brown     // For explicit mode, the surface integral is on the RHS of ODE q_dot = f(q).
262f0b65372SJed Brown     // For implicit mode, it gets pulled to the LHS of implicit ODE/DAE g(q_dot, q).
263f0b65372SJed Brown     // We can effect this by swapping the sign on this weight
264f0b65372SJed Brown     const CeedScalar wdetJb  = (implicit ? -1. : 1.) * q_data_sur[0][i];
265f0b65372SJed Brown 
266f0b65372SJed Brown     // Calculate inflow values
267*e0d1a4dfSLeila Ghaffari     const CeedScalar x[3] = {X[0][i], X[1][i], 0.};
268f0b65372SJed Brown     CeedScalar t12;
269*e0d1a4dfSLeila Ghaffari     State s = BlasiusSolution(context, x, x0, 0, rho_0, &t12);
270f0b65372SJed Brown 
271f0b65372SJed Brown     // enabling user to choose between weak T and weak rho inflow
272f0b65372SJed Brown     CeedScalar drho, dE, dP;
273f0b65372SJed Brown     if (weakT) {
274f0b65372SJed Brown       // rho should be from the current solution
275f0b65372SJed Brown       drho = dq[0][i];
276f0b65372SJed Brown       CeedScalar dE_internal = drho * cv * theta0;
277*e0d1a4dfSLeila Ghaffari       CeedScalar dE_kinetic = .5 * drho * Dot3(s.Y.velocity, s.Y.velocity);
278f0b65372SJed Brown       dE = dE_internal + dE_kinetic;
279f0b65372SJed Brown       dP = drho * Rd * theta0; // interior rho with exterior T
280f0b65372SJed Brown     } else { // rho specified, E_internal from solution
281f0b65372SJed Brown       drho = 0;
282f0b65372SJed Brown       dE = dq[4][i];
283f0b65372SJed Brown       dP = dE * (gamma - 1.);
284f0b65372SJed Brown     }
285f0b65372SJed Brown     const CeedScalar norm[3] = {q_data_sur[1][i],
286f0b65372SJed Brown                                 q_data_sur[2][i],
287f0b65372SJed Brown                                 q_data_sur[3][i]
288f0b65372SJed Brown                                };
289f0b65372SJed Brown 
290*e0d1a4dfSLeila Ghaffari     const CeedScalar u_normal = Dot3(norm, s.Y.velocity);
291f0b65372SJed Brown 
292f0b65372SJed Brown     v[0][i] = - wdetJb * drho * u_normal;
293f0b65372SJed Brown     for (int j=0; j<3; j++)
294*e0d1a4dfSLeila Ghaffari       v[j+1][i] = -wdetJb * (drho * u_normal * s.Y.velocity[j] + norm[j] * dP);
295f0b65372SJed Brown     v[4][i] = - wdetJb * u_normal * (dE + dP);
296f0b65372SJed Brown   } // End Quadrature Point Loop
297f0b65372SJed Brown   return 0;
298f0b65372SJed Brown }
299f0b65372SJed Brown 
300bb8a0c61SJames Wright #endif // blasius_h
301