Ejemplo n.º 1
0
//---------------------------------------------------------
DMat& NDG2D::Lift2D()
//---------------------------------------------------------
{
  // function [LIFT] = Lift2D()
  // Purpose  : Compute surface to volume lift term for DG formulation

  DMat V1D,massEdge1,massEdge2,massEdge3;  DVec faceR,faceS;
  Index1D J1(1,Nfp), J2(Nfp+1,2*Nfp), J3(2*Nfp+1,3*Nfp);

  DMat Emat(Np, Nfaces*Nfp);

  // face 1
  faceR = r(Fmask(All,1));
  V1D = Vandermonde1D(N, faceR); 
  massEdge1 = inv(V1D*trans(V1D));
  Emat(Fmask(All,1), J1) = massEdge1;

  // face 2
  faceR = r(Fmask(All,2));
  V1D = Vandermonde1D(N, faceR);
  massEdge2 = inv(V1D*trans(V1D));
  Emat(Fmask(All,2), J2) = massEdge2;

  // face 3
  faceS = s(Fmask(All,3));
  V1D = Vandermonde1D(N, faceS);
  massEdge3 = inv(V1D*trans(V1D));
  Emat(Fmask(All,3), J3) = massEdge3;

  // inv(mass matrix)*\I_n (L_i,L_j)_{edge_n}
  LIFT = V*(trans(V)*Emat);
  return LIFT;
}
Ejemplo n.º 2
0
//---------------------------------------------------------
DMat& NDG3D::Lift3D()
//---------------------------------------------------------
{
  // function [LIFT] = Lift3D(N, r, s, t)
  // Purpose  : Compute 3D surface to volume lift operator used in DG formulation

  DMat Emat(Np, Nfaces*Nfp),VFace,massFace; 
  DVec faceR,faceS; IVec idr;  Index1D JJ;

  for (int face=1; face<=Nfaces; ++face) {
    // process face
    if      (1==face) {faceR = r(Fmask(All,1)); faceS = s(Fmask(All,1));}
    else if (2==face) {faceR = r(Fmask(All,2)); faceS = t(Fmask(All,2));}
    else if (3==face) {faceR = s(Fmask(All,3)); faceS = t(Fmask(All,3));}
    else if (4==face) {faceR = s(Fmask(All,4)); faceS = t(Fmask(All,4));}
    
    VFace = Vandermonde2D(N, faceR, faceS);
    massFace = inv(VFace*trans(VFace));

    idr = Fmask(All,face);
  //idc    = (face-1)*Nfp+1: face*Nfp;
    JJ.reset((face-1)*Nfp+1, face*Nfp);

  //Emat(idr, JJ) = Emat(idr, JJ) + massFace;
    Emat(idr, JJ) = massFace;  // TW: += -> =
  }

  // inv(mass matrix)*\I_n (L_i,L_j)_{edge_n}
  LIFT = V*(trans(V)*Emat);
  return LIFT;
}
Ejemplo n.º 3
0
startUp1d::startUp1d(int N,int K) {
    NODETOL=1e-10;

    r = JacobiGL(0,0,N);
    Np = N+1;
    Nfp = 1;
    Nfaces =2;

    V = Vandermonde1D(N,r);
    Dr = Dmatrix1D(N,r,V);
    invV = V.inverse();
    MatrixXd Emat(Np,Nfaces*Nfp);

    Emat.setZero(Np,2);
    Emat(0,0)=1.0;
    Emat(Np-1,1)=1.0;
    LIFT = V*V.transpose()*Emat;
    EToV.setZero(K,2);
    VX.setZero(K+1);
    EToV = meshGen(0.0,1.0,K,Nv,VX);

    ArrayXi va,vb;
    va = EToV.col(0);
    vb=EToV.col(1);
    VectorXd v1(K),v2(K);
    {   int  temp=0;
        for(int i=0; i<K; i++)
        {   temp = va(i);
            v1(i)= VX(temp-1);
            temp = vb(i);
            v2(i)= VX(temp-1);
        }

    }

    VectorXd temp1;
    temp1.setOnes(N+1,1);
    x =temp1*v1.transpose()+ 0.5*((r.array()+1).matrix())*(v2-v1).transpose();


    J = Dr*x;
    rx = 1.0/J.array();

    Fmask.setZero(2);
    Fmask(0)=0;
    Fmask(1)=Np-1;

    std::cout<<"Fx"<<Fmask<<"\n";

    Fx.setZero(2,K);
    Fx.row(0)=x.row(0);
    Fx.row(1)=x.row(Np-1);
    std::cout<<"Fx"<<Fx<<"\n";

    nx=Normals1D(Nfp,Nfaces,K);
    Fscale.setZero(2,K);
    Fscale.row(0)=J.row(0);
    Fscale.row(1)=J.row(Np-1);

    Fscale = 1.0/Fscale.array();


    EToEF = Connect1DEToE(EToV);


    std::cout<<"Fscale "<<"\n"<<Fscale<<"\n";


    std::cout<<"Fscale "<<"\n"<<EToEF<<"\n";






}
Ejemplo n.º 4
0
double omxFreeVar::getCurValue(omxState *os)
{
	omxFreeVarLocation &loc = locations[0];
	EigenMatrixAdaptor Emat(os->matrixList[loc.matrix]);
	return Emat(loc.row, loc.col);
}