Changeset 10277


Ignore:
Timestamp:
10/24/11 16:04:31 (13 years ago)
Author:
Mathieu Morlighem
Message:

Added SU

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r10143 r10277  
    501501        int        stabilization;
    502502        int        i,j,ig,dim;
    503         double     Jdettria,DL_scalar,dt;
    504         double     vx,vy,dvxdx,dvydy;
     503        double     Jdettria,DL_scalar,dt,h;
     504        double     vel,vx,vy,dvxdx,dvydy;
    505505        double     dvx[2],dvy[2];
    506506        double     v_gauss[2]={0.0};
     
    533533                vyaverage_input=inputs->GetInput(VyAverageEnum); _assert_(vyaverage_input);
    534534        }
    535 
    536         //Create Artificial diffusivity once for all if requested
    537         if(stabilization==1){
    538                 gauss=new GaussTria();
    539                 gauss->GaussCenter();
    540                 GetJacobianDeterminant2d(&Jdettria, &xyz_list[0][0],gauss);
    541                 delete gauss;
    542 
    543                 vxaverage_input->GetInputAverage(&v_gauss[0]);
    544                 vyaverage_input->GetInputAverage(&v_gauss[1]);
    545 
    546                 K[0][0]=pow(Jdettria,(double).5)/2.0*fabs(v_gauss[0]);
    547                 K[1][1]=pow(Jdettria,(double).5)/2.0*fabs(v_gauss[1]);
    548         }
     535        h=sqrt(2*this->GetArea());
    549536
    550537        /* Start  looping on the number of gaussian points: */
     
    591578                                        &Ke->values[0],1);
    592579
    593                 if(stabilization==1){
     580                if(stabilization==2){
     581                        /*Streamline upwinding*/
     582                        vel=sqrt(pow(vx,2.)+pow(vy,2.));
     583                        K[0][0]=h/(2*vel)*vx*vx;
     584                        K[1][0]=h/(2*vel)*vy*vx;
     585                        K[0][1]=h/(2*vel)*vx*vy;
     586                        K[1][1]=h/(2*vel)*vy*vy;
     587                }
     588                else if(stabilization==1){
     589                        /*MacAyeal*/
     590                        vxaverage_input->GetInputAverage(&vx);
     591                        vyaverage_input->GetInputAverage(&vy);
     592                        K[0][0]=h/2.0*fabs(vx) /sqrt(2*sqrt(3)); // the second part should not be there
     593                        K[0][1]=0.;
     594                        K[1][0]=0.;
     595                        K[1][1]=h/2.0*fabs(vy) /sqrt(2*sqrt(3)); // the second part should not be there
     596                }
     597                if(stabilization==1 || stabilization==2){
    594598                        KDL[0][0]=DL_scalar*K[0][0];
     599                        KDL[1][0]=DL_scalar*K[1][0];
     600                        KDL[0][1]=DL_scalar*K[0][1];
    595601                        KDL[1][1]=DL_scalar*K[1][1];
    596 
    597602                        TripleMultiply( &Bprime[0][0],2,numdof,1,
    598603                                                &KDL[0][0],2,2,0,
     
    10781083        x3=xyz_list[2][0]; y3=xyz_list[2][1];
    10791084 
     1085        _assert_(x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1>0);
    10801086        return (x2*y3 - y2*x3 + x1*y2 - y1*x2 + x3*y1 - y3*x1)/2;
    10811087}
Note: See TracChangeset for help on using the changeset viewer.