94 ASSERTL0(
m_session->MatchSolverInfo(
"Projection",
"DisContinuous"),
"Pulse solver only set up for Discontinuous projections");
96 ASSERTL0(
m_graph->GetMeshDimension() == 1,
"Pulse wave solver only set up for expansion dimension equal to 1");
104 const std::vector<SpatialDomains::CompositeMap> domain =
m_graph->GetDomain();
110 bool SetToOneSpaceDimension =
true;
112 if(
m_session->DefinesCmdLineArgument(
"SetToOneSpaceDimension"))
114 std::string cmdline =
m_session->GetCmdLineArgument<std::string>(
"SetToOneSpaceDimension");
115 if(boost::to_upper_copy(cmdline) ==
"FALSE")
117 SetToOneSpaceDimension =
false;
129 SetToOneSpaceDimension);
148 Array<OneD, NekDouble> coeffs(totcoeffs,0.0);
149 Array<OneD, NekDouble> phys(totphys,0.0);
150 Array<OneD, NekDouble> tmpcoeffs,tmpphys;
152 m_vessels[n]->SetCoeffsArray(coeffs);
153 m_vessels[n]->SetPhysArray(phys);
155 int cnt = m_vessels[n]->GetNcoeffs();
156 int cnt1 = m_vessels[n]->GetTotPoints();
160 m_vessels[i*m_nVariables+n]->SetCoeffsArray(tmpcoeffs = coeffs + cnt);
161 m_vessels[i*m_nVariables+n]->SetPhysArray (tmpphys = phys + cnt1);
162 cnt += m_vessels[i*m_nVariables+n]->GetNcoeffs();
163 cnt1 += m_vessels[i*m_nVariables+n]->GetTotPoints();
216 for (
int omega = 0; omega <
m_nDomains; omega++)
218 nq = m_vessels[2*omega]->GetNpoints();
221 m_beta[omega] = Array<OneD, NekDouble>(nq);
224 m_A_0[omega] = Array<OneD, NekDouble>(nq);
229 m_beta_trace[omega] = Array<OneD, NekDouble>(nqTrace);
232 m_A_0_trace[omega] = Array<OneD, NekDouble>(nqTrace);
233 m_fields[0]->ExtractTracePhys(m_A_0[omega],m_A_0_trace[omega]);
236 if(SetToOneSpaceDimension)
238 m_trace_fwd_normal[omega] = Array<OneD, NekDouble>(nqTrace,0.0);
241 int nelmt_trace = trace->GetExpSize();
243 Array<OneD, Array<OneD, NekDouble> > normals(nelmt_trace);
245 for(
int i = 0 ; i < nelmt_trace; ++i)
247 normals[i] = m_trace_fwd_normal[omega]+i;
252 trace->GetExp(0)->GetGeom()->SetCoordim(1);
254 trace->GetNormals(normals);
264 map<int,std::vector<InterfacePointShPtr> > VidToDomain;
265 map<int,std::vector<InterfacePointShPtr> >
::iterator iter;
271 for(
int omega = 0; omega <
m_nDomains; ++omega)
275 for(
int i = 0; i < 2; ++i)
280 int vid =
m_vessels[vesselID]->UpdateBndCondExpansion(i)->GetExp(0)->GetGeom()->GetVid(0);
281 cout<<
"Shared vertex id: "<<vid<<endl;
287 for(
int n = 0; n <
m_vessels[vesselID]->GetExpSize(); ++n)
289 for(
int p = 0; p < 2; ++p)
293 int eid =
m_vessels[vesselID]->GetTraceMap()->GetElmtToTrace()[n][p]->GetElmtId();
295 int tid =
m_vessels[vesselID]->GetTrace()->GetCoeff_Offset(eid);
298 cout<<
"Global Vid of interface point: "<<vid<<endl;
299 cout<<
"Domain interface point belongs to: "<<omega<<endl;
300 cout<<
"Element id of vertex: "<<n<<endl;
301 cout<<
"Vertex id within local element: "<<p<<endl;
302 cout<<
"Element id within the trace: "<<tid<<endl;
303 cout<<
"Position of boundary condition in region: "<<i<<endl;
315 VidToDomain[vid].push_back(Ipt);
318 m_vessels[vesselID]->GetBndConditions()[i]
321 m_vessels[vesselID+1]->GetBndConditions()[i]
328 for(iter = VidToDomain.begin(); iter != VidToDomain.end(); ++iter)
330 if(iter->second.size() == 2)
334 else if(iter->second.size() == 3)
343 for(
int i = 0; i < 3; ++i)
345 if(iter->second[i]->m_elmtVert == 0)
359 if(iter->second[0]->m_elmtVert == 1)
368 if(iter->second[1]->m_elmtVert == 1)
371 iter->second[0] = iter->second[1];
374 else if (iter->second[2]->m_elmtVert == 1)
377 iter->second[0] = iter->second[2];
386 if(iter->second[0]->m_elmtVert == 0)
395 if(iter->second[1]->m_elmtVert == 0)
398 iter->second[0] = iter->second[1];
401 else if (iter->second[2]->m_elmtVert == 0)
404 iter->second[0] = iter->second[2];
414 ASSERTL0(
false,
"Unknown junction type");
430 if (
m_session->GetComm()->GetRank() == 0)
432 cout <<
"Initial Conditions:" << endl;
437 for (
int omega = 0; omega <
m_nDomains; omega++)
442 if (
m_session->GetComm()->GetRank() == 0)
444 cout <<
"Subdomain = " <<omega<<endl;
477 Array<OneD, Array<OneD,NekDouble> > fields(
m_nVariables);
502 cout <<
"Steps: " << n+1
504 <<
"\t Time-step: " <<
m_timestep <<
"\t" << endl;
513 for (
int omega = 0; omega <
m_nDomains; omega++)
515 m_vessels[omega*m_nVariables+i]->FwdTrans(fields[i]+cnt,
516 m_vessels[omega*m_nVariables+i]->UpdateCoeffs());
517 cnt +=
m_vessels[omega*m_nVariables+i]->GetTotPoints();
531 cout <<
"Time-integration timing : "
532 << IntegrationTime <<
" s" << endl << endl;
538 const Array<
OneD,
const Array<OneD, NekDouble> >&fields,
542 int omega, traceId, eid, vert, phys_offset, vesselID;
547 traceId = I->m_traceId;
549 vert = I->m_elmtVert;
552 phys_offset =
m_vessels[vesselID]->GetPhys_Offset(eid);
566 Array<OneD, NekDouble> Au(3),uu(3),beta(3),A_0(3);
573 Au[0],uu[0],beta[0],A_0[0]);
575 Au[1],uu[1],beta[1],A_0[1]);
577 Au[2],uu[2],beta[2],A_0[2]);
583 for(
int i = 0; i < 3; ++i)
597 Au[0],uu[0],beta[0],A_0[0]);
599 Au[1],uu[1],beta[1],A_0[1]);
601 Au[2],uu[2],beta[2],A_0[2]);
607 for(
int i = 0; i < 3; ++i)
620 Au[0],uu[0],beta[0],A_0[0]);
622 Au[1],uu[1],beta[1],A_0[1]);
627 for(
int i = 0; i < 2; ++i)
653 Array<OneD, NekDouble> &beta, Array<OneD, NekDouble> &A_0)
656 Array<OneD, NekDouble> W(3);
657 Array<OneD, NekDouble> W_Au(3);
658 Array<OneD, NekDouble> P_Au(3);
659 Array<OneD, NekDouble> f(6);
660 Array<OneD, NekDouble> g(6);
661 Array<OneD, NekDouble> tmp(6);
662 Array<OneD, Array<OneD, NekDouble> > inv_J(6);
663 for (
int i=0; i<6; i++)
665 inv_J[i] = Array<OneD, NekDouble> (6);
677 W[0] = uu[0] + 4*sqrt(beta[0]/(2*rho))*(sqrt(sqrt(Au[0])) - sqrt(sqrt(A_0[0])));
678 W[1] = uu[1] - 4*sqrt(beta[1]/(2*rho))*(sqrt(sqrt(Au[1])) - sqrt(sqrt(A_0[1])));
679 W[2] = uu[2] - 4*sqrt(beta[2]/(2*rho))*(sqrt(sqrt(Au[2])) - sqrt(sqrt(A_0[2])));
685 while ((proceed) && (iter < MAX_ITER))
692 W_Au[0] = 4*sqrt(beta[0]/(2*rho))*(sqrt(sqrt(Au[0])) - sqrt(sqrt(A_0[0])));
693 W_Au[1] = 4*sqrt(beta[1]/(2*rho))*(sqrt(sqrt(Au[1])) - sqrt(sqrt(A_0[1])));
694 W_Au[2] = 4*sqrt(beta[2]/(2*rho))*(sqrt(sqrt(Au[2])) - sqrt(sqrt(A_0[2])));
696 P_Au[0] = beta[0]*(sqrt(Au[0]) - sqrt(A_0[0]));
697 P_Au[1] = beta[1]*(sqrt(Au[1]) - sqrt(A_0[1]));
698 P_Au[2] = beta[2]*(sqrt(Au[2]) - sqrt(A_0[2]));
700 f[0] = uu[0] + W_Au[0] - W[0];
701 f[1] = uu[1] - W_Au[1] - W[1];
702 f[2] = uu[2] - W_Au[2] - W[2];
703 f[3] = Au[0]*uu[0] - Au[1]*uu[1] - Au[2]*uu[2];
704 f[4] = uu[0]*uu[0] + 2.0/rho*P_Au[0] - uu[1]*uu[1] - 2.0/rho*P_Au[1];
705 f[5] = uu[0]*uu[0] + 2.0/rho*P_Au[0] - uu[2]*uu[2] - 2.0/rho*P_Au[2];
708 NekDouble c1 = sqrt(beta[0]/(2*rho))*sqrt(sqrt(Au[0]));
709 NekDouble c2 = sqrt(beta[1]/(2*rho))*sqrt(sqrt(Au[1]));
710 NekDouble c3 = sqrt(beta[2]/(2*rho))*sqrt(sqrt(Au[2]));
714 k = c1*Au[1]*c3+Au[0]*c3*c2+Au[2]*c1*c2;
716 inv_J[0][0] = (-c2*uu[0]*c3*Au[0]+Au[2]*c2*c1*c1+Au[1]*c1*c1*c3)/k1;
717 inv_J[0][1] = Au[1]*(c2-uu[1])*c1*c3/k1;
718 inv_J[0][2] = Au[2]*(c3-uu[2])*c1*c2/k1;
719 inv_J[0][3] = c1*c2*c3/k1;
720 inv_J[0][4] = -0.5*c1*Au[1]*c3/k1;
721 inv_J[0][5] = -0.5*Au[2]*c1*c2/k1;
724 inv_J[1][0] = Au[0]*(c1+uu[0])*c2*c3/k2;
725 inv_J[1][1] = (c1*uu[1]*c3*Au[1]+Au[2]*c1*c2*c2+c3*c2*c2*Au[0])/k2;
726 inv_J[1][2] = -Au[2]*(c3-uu[2])*c1*c2/k2;
727 inv_J[1][3] = -c1*c2*c3/k2;
728 inv_J[1][4] = -0.5*(c1*Au[2]+Au[0]*c3)*c2/k2;
729 inv_J[1][5] = 0.5*Au[2]*c1*c2/k2;
732 inv_J[2][0] = Au[0]*(c1+uu[0])*c2*c3/k3;
733 inv_J[2][1] = -Au[1]*(c2-uu[1])*c1*c3/k3;
734 inv_J[2][2] = (c1*c2*uu[2]*Au[2]+c1*Au[1]*c3*c3+c2*c3*c3*Au[0])/k3;
735 inv_J[2][3] = -c1*c2*c3/k3;
736 inv_J[2][4] = 0.5*c1*Au[1]*c3/k3;
737 inv_J[2][5] = -0.5*(Au[1]*c1+c2*Au[0])*c3/k3;
739 inv_J[3][0] = Au[0]*(Au[0]*c3*c2-uu[0]*c3*Au[1]-uu[0]*c2*Au[2])/k1;
740 inv_J[3][1] = -Au[0]*Au[1]*(c2-uu[1])*c3/k1;
741 inv_J[3][2] = -Au[0]*Au[2]*(c3-uu[2])*c2/k1;
742 inv_J[3][3] = -Au[0]*c3*c2/k1;
743 inv_J[3][4] = 0.5*Au[0]*Au[1]*c3/k1;
744 inv_J[3][5] = 0.5*Au[0]*c2*Au[2]/k1;
746 inv_J[4][0] = Au[0]*Au[1]*(c1+uu[0])*c3/k2;
747 inv_J[4][1] = -Au[1]*(c1*Au[1]*c3+c1*uu[1]*Au[2]+c3*uu[1]*Au[0])/k2;
748 inv_J[4][2] = -Au[2]*Au[1]*(c3-uu[2])*c1/k2;
749 inv_J[4][3] = -c1*Au[1]*c3/k2;
750 inv_J[4][4] = -0.5*Au[1]*(c1*Au[2]+Au[0]*c3)/k2;
751 inv_J[4][5] = 0.5*Au[2]*Au[1]*c1/k2;
753 inv_J[5][0] = Au[0]*Au[2]*(c1+uu[0])*c2/k3;
754 inv_J[5][1] = -Au[2]*Au[1]*(c2-uu[1])*c1/k3;
755 inv_J[5][2] = -Au[2]*(Au[2]*c1*c2+c1*uu[2]*Au[1]+c2*uu[2]*Au[0])/k3;
756 inv_J[5][3] = -Au[2]*c1*c2/k3;
757 inv_J[5][4] = 0.5*Au[2]*Au[1]*c1/k3;
758 inv_J[5][5] = -0.5*Au[2]*(Au[1]*c1+c2*Au[0])/k3;
763 for (
int j=0; j<6; j++)
769 for (
int j=0; j<6; j++)
771 for (
int i=0; i<6; i++)
773 tmp[j] = inv_J[j][i]*f[i];
779 uu[0] = uu[0] - g[0];
780 uu[1] = uu[1] - g[1];
781 uu[2] = uu[2] - g[2];
782 Au[0] = Au[0] - g[3];
783 Au[1] = Au[1] - g[4];
784 Au[2] = Au[2] - g[5];
787 if ((g[0]*g[0] + g[1]*g[1] + g[2]*g[2] + g[3]*g[3]+ g[4]*g[4] + g[5]*g[5]) < Tol)
793 if (iter >= MAX_ITER)
795 ASSERTL0(
false,
"Riemann solver for Bifurcation did not converge");
814 Array<OneD, NekDouble> W(3);
815 Array<OneD, NekDouble> W_Au(3);
816 Array<OneD, NekDouble> P_Au(3);
817 Array<OneD, NekDouble> f(6);
818 Array<OneD, NekDouble> g(6);
819 Array<OneD, NekDouble> tmp(6);
820 Array<OneD, Array<OneD, NekDouble> > inv_J(6);
822 for (
int i=0; i<6; i++)
824 inv_J[i] = Array<OneD, NekDouble> (6);
837 W[0] = uu[0] - 4*sqrt(beta[0]/(2*rho))*(sqrt(sqrt(Au[0])) - sqrt(sqrt(A_0[0])));
838 W[1] = uu[1] + 4*sqrt(beta[1]/(2*rho))*(sqrt(sqrt(Au[1])) - sqrt(sqrt(A_0[1])));
839 W[2] = uu[2] + 4*sqrt(beta[2]/(2*rho))*(sqrt(sqrt(Au[2])) - sqrt(sqrt(A_0[2])));
845 while ((proceed) && (iter < MAX_ITER))
852 W_Au[0] = 4*sqrt(beta[0]/(2*rho))*(sqrt(sqrt(Au[0])) - sqrt(sqrt(A_0[0])));
853 W_Au[1] = 4*sqrt(beta[1]/(2*rho))*(sqrt(sqrt(Au[1])) - sqrt(sqrt(A_0[1])));
854 W_Au[2] = 4*sqrt(beta[2]/(2*rho))*(sqrt(sqrt(Au[2])) - sqrt(sqrt(A_0[2])));
856 P_Au[0] = beta[0]*(sqrt(Au[0]) - sqrt(A_0[0]));
857 P_Au[1] = beta[1]*(sqrt(Au[1]) - sqrt(A_0[1]));
858 P_Au[2] = beta[2]*(sqrt(Au[2]) - sqrt(A_0[2]));
860 f[0] = uu[0] - W_Au[0] - W[0];
861 f[1] = uu[1] + W_Au[1] - W[1];
862 f[2] = uu[2] + W_Au[2] - W[2];
863 f[3] = Au[0]*uu[0] - Au[1]*uu[1] - Au[2]*uu[2];
864 f[4] = uu[0]*uu[0] + 2.0/rho*P_Au[0] - uu[1]*uu[1] - 2.0/rho*P_Au[1];
865 f[5] = uu[0]*uu[0] + 2.0/rho*P_Au[0] - uu[2]*uu[2] - 2.0/rho*P_Au[2];
868 NekDouble c1 = sqrt(beta[0]/(2*rho))*sqrt(sqrt(Au[0]));
869 NekDouble c2 = sqrt(beta[1]/(2*rho))*sqrt(sqrt(Au[1]));
870 NekDouble c3 = sqrt(beta[2]/(2*rho))*sqrt(sqrt(Au[2]));
873 k = c1*Au[1]*c3+Au[0]*c3*c2+Au[2]*c1*c2;
875 inv_J[0][0] = (c2*uu[0]*c3*Au[0]+Au[2]*c2*c1*c1+Au[1]*c1*c1*c3)/k1;
876 inv_J[0][1] = Au[1]*(c2+uu[1])*c1*c3/k1;
877 inv_J[0][2] = Au[2]*(c3+uu[2])*c1*c2/k1;
878 inv_J[0][3] = c1*c2*c3/k1;
879 inv_J[0][4] = 0.5*Au[1]*c1*c3/k1;
880 inv_J[0][5] = 0.5*Au[2]*c1*c2/k1;
883 inv_J[1][0] = Au[0]*(c1-uu[0])*c2*c3/k2;
884 inv_J[1][1] = (-c1*uu[1]*c3*Au[1]+Au[2]*c1*c2*c2+c3*c2*c2*Au[0])/k2;
885 inv_J[1][2] = -Au[2]*(c3+uu[2])*c1*c2/k2;
886 inv_J[1][3] = -c1*c2*c3/k2;
887 inv_J[1][4] = 0.5*(c1*Au[2]+Au[0]*c3)*c2/k2;
888 inv_J[1][5] = -0.5*Au[2]*c1*c2/k2;
891 inv_J[2][0] = Au[0]*(c1-uu[0])*c2*c3/k3;
892 inv_J[2][1] = -Au[1]*(c2+uu[1])*c1*c3/k3;
893 inv_J[2][2] = -(c1*uu[2]*c2*Au[2]-Au[1]*c1*c3*c3-c2*c3*c3*Au[0])/k3;
894 inv_J[2][3] = -c1*c2*c3/k3;
895 inv_J[2][4] = -0.5*Au[1]*c1*c3/k3;
896 inv_J[2][5] = 0.5*(Au[1]*c1+Au[0]*c2)*c3/k3;
898 inv_J[3][0] = -Au[0]*(Au[0]*c3*c2+uu[0]*c3*Au[1]+uu[0]*c2*Au[2])/k1;
899 inv_J[3][1] = Au[0]*Au[1]*(c2+uu[1])*c3/k1;
900 inv_J[3][2] = Au[0]*Au[2]*(c3+uu[2])*c2/k1;
901 inv_J[3][3] = Au[0]*c3*c2/k1;
902 inv_J[3][4] = 0.5*Au[0]*Au[1]*c3/k1;
903 inv_J[3][5] = 0.5*Au[0]*c2*Au[2]/k1;
905 inv_J[4][0] = -Au[0]*Au[1]*(c1-uu[0])*c3/k2;
906 inv_J[4][1] = Au[1]*(Au[1]*c1*c3-c1*uu[1]*Au[2]-c3*uu[1]*Au[0])/k2;
907 inv_J[4][2] = Au[2]*Au[1]*(c3+uu[2])*c1/k2;
908 inv_J[4][3] = Au[1]*c1*c3/k2;
909 inv_J[4][4] = -0.5*Au[1]*(c1*Au[2]+Au[0]*c3)/k2;
910 inv_J[4][5] = 0.5*Au[2]*Au[1]*c1/k2;
912 inv_J[5][0] = -Au[0]*Au[2]*(c1-uu[0])*c2/k3;
913 inv_J[5][1] = Au[2]*Au[1]*(c2+uu[1])*c1/k3;
914 inv_J[5][2] = Au[2]*(Au[2]*c1*c2-c1*uu[2]*Au[1]-c2*uu[2]*Au[0])/k3;
915 inv_J[5][3] = Au[2]*c1*c2/k3;
916 inv_J[5][4] = 0.5*Au[2]*Au[1]*c1/k3;
917 inv_J[5][5] = -0.5*Au[2]*(Au[1]*c1+Au[0]*c2)/k3;
921 for (
int j=0; j<6; j++)
927 for (
int j=0; j<6; j++)
929 for (
int i=0; i<6; i++)
931 tmp[j] = inv_J[j][i]*f[i];
937 uu[0] = uu[0] - g[0];
938 uu[1] = uu[1] - g[1];
939 uu[2] = uu[2] - g[2];
940 Au[0] = Au[0] - g[3];
941 Au[1] = Au[1] - g[4];
942 Au[2] = Au[2] - g[5];
945 if ((g[0]*g[0] + g[1]*g[1] + g[2]*g[2] + g[3]*g[3]+ g[4]*g[4] + g[5]*g[5]) < Tol)
951 if (iter >= MAX_ITER)
953 ASSERTL0(
false,
"Riemann solver for Merging Flow did not converge");
969 Array<OneD, NekDouble> &beta, Array<OneD, NekDouble> &A_0)
972 Array<OneD, NekDouble> W(2);
973 Array<OneD, NekDouble> W_Au(2);
974 Array<OneD, NekDouble> P_Au(2);
975 Array<OneD, NekDouble> f(4);
976 Array<OneD, NekDouble> g(4);
977 Array<OneD, NekDouble> tmp(4);
978 Array<OneD, Array<OneD, NekDouble> > inv_J(4);
979 for (
int i=0; i<4; i++)
981 inv_J[i] = Array<OneD, NekDouble> (4);
993 W[0] = uu[0] + 4*sqrt(beta[0]/(2*rho))*(sqrt(sqrt(Au[0])) - sqrt(sqrt(A_0[0])));
994 W[1] = uu[1] - 4*sqrt(beta[1]/(2*rho))*(sqrt(sqrt(Au[1])) - sqrt(sqrt(A_0[1])));
996 while((proceed) && (iter < MAX_ITER))
1003 W_Au[0] = 4*sqrt(beta[0]/(2*rho))*(sqrt(sqrt(Au[0])) - sqrt(sqrt(A_0[0])));
1004 W_Au[1] = 4*sqrt(beta[1]/(2*rho))*(sqrt(sqrt(Au[1])) - sqrt(sqrt(A_0[1])));
1006 P_Au[0] = beta[0]*(sqrt(Au[0]) - sqrt(A_0[0]));
1007 P_Au[1] = beta[1]*(sqrt(Au[1]) - sqrt(A_0[1]));
1009 f[0] = uu[0] + W_Au[0] - W[0];
1010 f[1] = uu[1] - W_Au[1] - W[1];
1011 f[2] = Au[0]*uu[0] - Au[1]*uu[1];
1012 f[3] = uu[0]*uu[0] + 2.0/rho*P_Au[0] - uu[1]*uu[1] - 2.0/rho*P_Au[1];
1015 NekDouble cl = sqrt(beta[0]/(2*rho))*sqrt(sqrt(Au[0]));
1016 NekDouble cr = sqrt(beta[1]/(2*rho))*sqrt(sqrt(Au[1]));
1019 k = (cl*Au[1]+Au[0]*cr);
1021 inv_J[0][0] = (Au[1]*cl*cl-cr*uu[0]*Au[0])/k1;
1022 inv_J[0][1] = Au[1]*(cr-uu[1])*cl/k1;
1023 inv_J[0][2] = cl*cr/k1;
1024 inv_J[0][3] = -0.5*cl*Au[1]/k1;
1027 inv_J[1][0] = Au[0]*(cl+uu[0])*cr/k2;
1028 inv_J[1][1] = (cl*uu[1]*Au[1]+cr*cr*Au[0])/k2;
1029 inv_J[1][2] = -cl*cr/k2;
1030 inv_J[1][3] = -0.5*Au[0]*cr/k2;
1032 inv_J[2][0] = Au[0]*(Au[0]*cr-uu[0]*Au[1])/k1;
1033 inv_J[2][1] = -Au[0]*Au[1]*(cr-uu[1])/k1;
1034 inv_J[2][2] = -Au[0]*cr/k1;
1035 inv_J[2][3] = 0.5*Au[1]*Au[0]/k1;
1037 inv_J[3][0] = Au[0]*Au[1]*(cl+uu[0])/k2;
1038 inv_J[3][1] = -Au[1]*(cl*Au[1]+uu[1]*Au[0])/k2;
1039 inv_J[3][2] = -cl*Au[1]/k2;
1040 inv_J[3][3] = -0.5*Au[1]*Au[0]/k2;
1044 for (
int j=0; j<4; j++)
1050 for (
int j=0; j<4; j++)
1052 for (
int i=0; i<4; i++)
1054 tmp[j] = inv_J[j][i]*f[i];
1066 if((g[0]*g[0] + g[1]*g[1] + g[2]*g[2] + g[3]*g[3]) < Tol)
1070 if(iter >= MAX_ITER)
1072 ASSERTL0(
false,
"Riemann solver for Junction did not converge");
1100 std::stringstream outname;
1114 std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef;
1115 std::vector<std::string> variables =
m_session->GetVariables();
1122 std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
1124 int nFieldDefPerDomain = FieldDef.size()/
m_nDomains;
1131 for(
int i = 0; i < nFieldDefPerDomain; ++i)
1133 cnt = n*nFieldDefPerDomain+i;
1134 FieldDef[cnt]->m_fields.push_back(variables[j]);
1158 const Array<OneD, NekDouble> &exactsoln,
1167 for (
int omega = 0; omega <
m_nDomains; omega++)
1171 if(
m_vessels[vesselid]->GetPhysState() ==
false)
1177 if(exactsoln.num_elements())
1183 else if (
m_session->DefinesFunction(
"ExactSolution"))
1188 =
m_session->GetFunction(
"ExactSolution",field,omega);
1203 L2error += L2error_dom*L2error_dom;
1205 if(Normalised ==
true)
1209 Vol +=
m_vessels[vesselid]->PhysIntegral(one);
1220 if(Normalised ==
true)
1224 L2error = sqrt(L2error/Vol);
1228 L2error = sqrt(L2error);
1242 const Array<OneD, NekDouble> &exactsoln)
1244 NekDouble LinferrorDom, Linferror = -1.0;
1246 for (
int omega = 0; omega <
m_nDomains; omega++)
1252 if(
m_vessels[vesselid]->GetPhysState() ==
false)
1258 if(exactsoln.num_elements())
1260 LinferrorDom =
m_vessels[vesselid]->Linf(
1264 else if (
m_session->DefinesFunction(
"ExactSolution"))
1271 LinferrorDom =
m_vessels[vesselid]->Linf(
1280 Linferror = (Linferror > LinferrorDom)? Linferror:LinferrorDom;
1285 ASSERTL0(
false,
"ErrorExtraPoints not allowed for this solver");
1293 int nq =
m_vessels[omega]->GetTotPoints();
1294 Array<OneD, NekDouble> A =
m_vessels[omega]->UpdatePhys();
1295 Array<OneD, NekDouble> u =
m_vessels[omega+1]->UpdatePhys();
1296 Array<OneD, NekDouble> c(nq);