42 std::string AverageSolver::solverName =
45 AverageSolver::create,
46 "Average Riemann solver");
73 const Array<
OneD,
const Array<OneD, NekDouble> > &Fwd,
74 const Array<
OneD,
const Array<OneD, NekDouble> > &Bwd,
75 Array<
OneD, Array<OneD, NekDouble> > &flux)
79 int expDim = Fwd.num_elements()-2;
82 for (j = 0; j < Fwd[0].num_elements(); ++j)
85 Array<OneD, NekDouble> Ufwd(expDim);
86 Array<OneD, NekDouble> Ubwd(expDim);
88 for (i = 0; i < expDim; ++i)
90 Ufwd[i] = Fwd[i+1][j]/Fwd[0][j];
91 Ubwd[i] = Bwd[i+1][j]/Bwd[0][j];
92 tmp1 += Ufwd[i]*Fwd[i+1][j];
93 tmp2 += Ubwd[i]*Bwd[i+1][j];
96 NekDouble Pfwd = (gamma - 1.0) * (Fwd[expDim+1][j] - 0.5 * tmp1);
97 NekDouble Pbwd = (gamma - 1.0) * (Bwd[expDim+1][j] - 0.5 * tmp2);
100 flux[0][j] = 0.5 * (Fwd[1][j] + Bwd[1][j]);
101 flux[expDim+1][j] = 0.5 * (Ufwd[0] * (Fwd[expDim+1][j] + Pfwd) +
102 Ubwd[0] * (Bwd[expDim+1][j] + Pbwd));
104 for (i = 0; i < expDim; ++i)
106 flux[i+1][j] = 0.5 * (Fwd[0][j] * Ufwd[0] * Ufwd[i] +
107 Bwd[0][j] * Ubwd[0] * Ubwd[i]);
111 flux[1][j] += 0.5 * (Pfwd + Pbwd);