void EigenValuesAdvection::v_NumericalFlux(Array<OneD, Array<OneD, NekDouble> > &physfield, Array<OneD, Array<OneD, NekDouble> > &numflux) { int i; int nTraceNumPoints = GetTraceNpoints(); int nvel = m_spacedim; //m_velocity.num_elements(); Array<OneD, NekDouble > Fwd(nTraceNumPoints); Array<OneD, NekDouble > Bwd(nTraceNumPoints); Array<OneD, NekDouble > Vn (nTraceNumPoints,0.0); //Get Edge Velocity - Could be stored if time independent for(i = 0; i < nvel; ++i) { m_fields[0]->ExtractTracePhys(m_velocity[i], Fwd); Vmath::Vvtvp(nTraceNumPoints,m_traceNormals[i],1,Fwd,1,Vn,1,Vn,1); } for(i = 0; i < numflux.num_elements(); ++i) { m_fields[i]->GetFwdBwdTracePhys(physfield[i],Fwd,Bwd); m_fields[i]->GetTrace()->Upwind(Vn,Fwd,Bwd,numflux[i]); // calculate m_fields[i]*Vn Vmath::Vmul(nTraceNumPoints,numflux[i],1,Vn,1,numflux[i],1); } }
/** * Calculates the third term of the weak form (1): numerical flux * at boundary \f$ \left[ \mathbf{\psi}^{\delta} \cdot \{ * \mathbf{F}^u - \mathbf{F}(\mathbf{U}^{\delta}) \} * \right]_{x_e^l}^{x_eû} \f$ */ void PulseWavePropagation::v_NumericalFlux(Array<OneD, Array<OneD, NekDouble> > &physfield, Array<OneD, Array<OneD, NekDouble> > &numflux) { int i; int nTracePts = GetTraceTotPoints(); Array<OneD, Array<OneD, NekDouble> > Fwd(m_nVariables); Array<OneD, Array<OneD, NekDouble> > Bwd(m_nVariables); for (i = 0; i < m_nVariables; ++i) { Fwd[i] = Array<OneD, NekDouble>(nTracePts); Bwd[i] = Array<OneD, NekDouble>(nTracePts); } // Get the physical values at the trace for (i = 0; i < m_nVariables; ++i) { m_vessels[m_currentDomain*m_nVariables+ i]-> GetFwdBwdTracePhys(physfield[i],Fwd[i],Bwd[i]); } // Solve the upwinding Riemann problem within one arterial // segment by calling the upwinding Riemann solver implemented // in this file NekDouble Aflux, uflux; for (i = 0; i < nTracePts; ++i) { switch(m_upwindTypePulse) { case eUpwindPulse: { RiemannSolverUpwind(Fwd[0][i],Fwd[1][i],Bwd[0][i],Bwd[1][i], Aflux, uflux, m_A_0_trace[m_currentDomain][i], m_beta_trace[m_currentDomain][i], m_trace_fwd_normal[m_currentDomain][i]); } break; default: { ASSERTL0(false,"populate switch statement for upwind flux"); } break; } numflux[0][i] = Aflux; numflux[1][i] = uflux; } }
void DiffusionLDG::v_NumFluxforVector( const Array<OneD, MultiRegions::ExpListSharedPtr> &fields, const Array<OneD, Array<OneD, NekDouble> > &ufield, Array<OneD, Array<OneD, Array<OneD, NekDouble> > > &qfield, Array<OneD, Array<OneD, NekDouble> > &qflux) { int i, j; int nTracePts = fields[0]->GetTrace()->GetTotPoints(); int nvariables = fields.num_elements(); int nDim = qfield.num_elements(); NekDouble C11 = 0.0; Array<OneD, NekDouble > Fwd(nTracePts); Array<OneD, NekDouble > Bwd(nTracePts); Array<OneD, NekDouble > Vn (nTracePts, 0.0); Array<OneD, NekDouble > qFwd (nTracePts); Array<OneD, NekDouble > qBwd (nTracePts); Array<OneD, NekDouble > qfluxtemp(nTracePts, 0.0); Array<OneD, NekDouble > uterm(nTracePts); /* // Setting up the normals m_traceNormals = Array<OneD, Array<OneD, NekDouble> >(nDim); for(i = 0; i < nDim; ++i) { m_traceNormals[i] = Array<OneD, NekDouble> (nTracePts); } fields[0]->GetTrace()->GetNormals(m_traceNormals); */ // Get the normal velocity Vn for(i = 0; i < nDim; ++i) { Vmath::Svtvp(nTracePts, 1.0, m_traceNormals[i], 1, Vn, 1, Vn, 1); } // Evaulate upwind flux: // qflux = \hat{q} \cdot u = q \cdot n - C_(11)*(u^+ - u^-) for (i = 0; i < nvariables; ++i) { qflux[i] = Array<OneD, NekDouble> (nTracePts, 0.0); for (j = 0; j < nDim; ++j) { // Compute Fwd and Bwd value of ufield of jth direction fields[i]->GetFwdBwdTracePhys(qfield[j][i], qFwd, qBwd); // if Vn >= 0, flux = uFwd, i.e., // edge::eForward, if V*n>=0 <=> V*n_F>=0, pick // qflux = qBwd = q+ // edge::eBackward, if V*n>=0 <=> V*n_B<0, pick // qflux = qBwd = q- // else if Vn < 0, flux = uBwd, i.e., // edge::eForward, if V*n<0 <=> V*n_F<0, pick // qflux = qFwd = q- // edge::eBackward, if V*n<0 <=> V*n_B>=0, pick // qflux = qFwd = q+ fields[i]->GetTrace()->Upwind(/*m_traceNormals[j]*/Vn, qBwd, qFwd, qfluxtemp); Vmath::Vmul(nTracePts, m_traceNormals[j], 1, qfluxtemp, 1, qfluxtemp, 1); // Generate Stability term = - C11 ( u- - u+ ) fields[i]->GetFwdBwdTracePhys(ufield[i], Fwd, Bwd); Vmath::Vsub(nTracePts, Fwd, 1, Bwd, 1, uterm, 1); Vmath::Smul(nTracePts, -1.0 * C11, uterm, 1, uterm, 1); // Flux = {Fwd, Bwd} * (nx, ny, nz) + uterm * (nx, ny) Vmath::Vadd(nTracePts, uterm, 1, qfluxtemp, 1, qfluxtemp, 1); // Imposing weak boundary condition with flux if (fields[0]->GetBndCondExpansions().num_elements()) { v_WeakPenaltyforVector(fields, i, j, qfield[j][i], qfluxtemp, C11); } // q_hat \cdot n = (q_xi \cdot n_xi) or (q_eta \cdot n_eta) // n_xi = n_x * tan_xi_x + n_y * tan_xi_y + n_z * tan_xi_z // n_xi = n_x * tan_eta_x + n_y * tan_eta_y + n_z*tan_eta_z Vmath::Vadd(nTracePts, qfluxtemp, 1, qflux[i], 1, qflux[i], 1); } } }