44 RegisterCreatorFunction(
"APEUpwind", APEUpwindSolver::create,
"APE Upwind solver");
53 APEUpwindSolver::APEUpwindSolver() :
65 const Array<
OneD,
const Array<OneD, NekDouble> > &Fwd,
66 const Array<
OneD,
const Array<OneD, NekDouble> > &Bwd,
67 Array<
OneD, Array<OneD, NekDouble> > &flux)
73 const Array<OneD, const Array<OneD, NekDouble> > normals =
75 const Array<OneD, const Array<OneD, NekDouble> > vecLocs =
77 const Array<OneD, const Array<OneD, NekDouble> > basefield =
80 int nFields = Fwd .num_elements();
81 int nPts = Fwd[0].num_elements();
85 for (
int i = 0; i < nDim + 1; i++)
89 Array<OneD, Array<OneD, NekDouble> > baseVecLocs(1);
90 baseVecLocs[0] = Array<OneD, NekDouble>(nDim);
91 for (
int i = 0; i < nDim; ++i)
93 baseVecLocs[0][i] = 1+i;
101 for (
int i = 0; i < 3; ++i)
104 Array<OneD, Array<OneD, NekDouble> >(nFields);
105 for (
int j = 0; j < nFields; ++j)
124 const Array<
OneD,
const Array<OneD, NekDouble> > &Fwd,
125 const Array<
OneD,
const Array<OneD, NekDouble> > &Bwd,
126 Array<
OneD, Array<OneD, NekDouble> > &flux)
134 const Array<OneD, const Array<OneD, NekDouble> > normals =
m_vectors[
"N"]();
135 const Array<OneD, const Array<OneD, NekDouble> > basefield =
m_rotBasefield;
137 int dim = normals.num_elements();
139 ASSERTL1(Fwd.num_elements() == nvar,
"Fwd malformed.");
140 ASSERTL1(Bwd.num_elements() == nvar,
"Bwd malformed.");
142 int nTracePts = Fwd[0].num_elements();
144 Array<OneD, Array<OneD, NekDouble> > upphysfield(2);
145 for (
int i = 0; i < 2; i++)
147 upphysfield[i] = Array<OneD, NekDouble>(nTracePts);
150 for (
int i = 0; i < nTracePts; i++)
162 Array<OneD, NekDouble> characteristic(4);
163 Array<OneD, NekDouble> W(2);
164 Array<OneD, NekDouble> lambda(2);
167 lambda[0]=u0 + sqrt(p0*gamma*rho)/rho;
168 lambda[1]=u0 - sqrt(p0*gamma*rho)/rho;
172 characteristic[0] = pL/2 + uL*sqrt(p0*gamma*rho)/2;
173 characteristic[1] = pL/2 - uL*sqrt(p0*gamma*rho)/2;
175 characteristic[2] = pR/2 + uR*sqrt(p0*gamma*rho)/2;
176 characteristic[3] = pR/2 - uR*sqrt(p0*gamma*rho)/2;
179 for (
int j = 0; j < 2; j++)
183 W[j]=characteristic[j];
187 W[j]=characteristic[j+2];
192 upphysfield[0][i] = W[0]+W[1];
194 if (p0*gamma*rho != 0)
196 upphysfield[1][i] = (W[0]-W[1])/sqrt(p0*gamma*rho);
200 upphysfield[1][i] = 0.0;
207 Vmath::Smul(nTracePts, gamma, basefield[0], 1, flux[0], 1);
208 Vmath::Vmul(nTracePts, upphysfield[1], 1, flux[0], 1, flux[0], 1);
209 Vmath::Vvtvp(nTracePts, basefield[1], 1, upphysfield[0], 1, flux[0], 1, flux[0], 1);
212 Vmath::Smul(nTracePts, 1/rho, upphysfield[0], 1, flux[1], 1);
213 Vmath::Vvtvp(nTracePts, basefield[1], 1, upphysfield[1], 1, flux[1], 1, flux[1], 1);
214 for (
int j = 2; j < nvar; j++)
217 Vmath::Vvtvp(nTracePts, basefield[j], 1, Fwd[j], 1, flux[1], 1, flux[1], 1);