Changeset 5923


Ignore:
Timestamp:
09/21/10 14:32:03 (15 years ago)
Author:
seroussi
Message:

keep working on coupling

File:
1 edited

Legend:

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

    r5922 r5923  
    20782078ElementMatrix* Penta::CreateKMatrixCouplingPattynStokes(void){
    20792079
    2080         int        i,j;
    2081         /* node data: */
    2082         const int  numdofp=NDOF2*NUMVERTICES;
    2083         const int  numdofs=NDOF4*NUMVERTICES;
    2084         int*       doflistp=NULL;
    2085         int*       doflists=NULL;
    2086 
    2087         /*Matrices*/
    2088         double Kestokes_gg[24][24];
    2089         double Kepattyn_gg[12][12];
    2090         double Keps_gg[12][24]={0.0};
    2091         double Kesp_gg[24][12]={0.0};
    2092 
    2093         /*Get Pattyn and Stokes doflist*/
    2094         GetDofList(&doflistp,PattynApproximationEnum,GsetEnum); //Pattyn dof list
    2095         GetDofList(&doflists,StokesApproximationEnum,GsetEnum); //Stokes dof list
    2096 
    2097         ISSMERROR("not supported yet");
    2098 //      /*Get CreateKMatrixDiagnosticStokes*/
    2099 //      Kestokes_gg=CreateKMatrixDiagnosticStokes;
    2100 //     
    2101 //      /*Modify it and plug in into Kgg*/
    2102 //      for( i=0; i<numdofs; i++){
    2103 //              for(j=0;j<NUMVERTICES; j++){
    2104 //                      Kesp_gg[i][(j-1)*NDOF2+0]+=Kestokes_gg[i][(j-1)*NDOF4+0];
    2105 //                      Kesp_gg[i][(j-1)*NDOF2+1]+=Kestokes_gg[i][(j-1)*NDOF4+1];
    2106 //              }
    2107 //      }
    2108 //      MatSetValues(Kgg,numdofs,doflists,numdofp,doflistp,(const double*)Kesp_gg,ADD_VALUES);
    2109 //
    2110 //      /*Get CreateKMatrixDiagnosticPattyn*/
    2111 //      Kepattyn_gg=CreateKMatrixDiagnosticPattyn;
    2112 //
    2113 //      /*Modify it and plug in into Kgg*/
    2114 //      for( i=0; i<numdofp; i++){
    2115 //              for(j=0;j<NUMVERTICES; j++){
    2116 //                      Kesp_gg[i][(j-1)*NDOF4+0]+=Kestokes_gg[i][(j-1)*NDOF2+0];
    2117 //                      Kesp_gg[i][(j-1)*NDOF4+1]+=Kestokes_gg[i][(j-1)*NDOF2+1];
    2118 //              }
    2119 //      }
    2120 //      MatSetValues(Kgg,numdofp,doflistp,numdofs,doflists,(const double*)Keps_gg,ADD_VALUES);
    2121 
     2080        /*compute all stiffness matrices for this element*/
     2081        ElementMatrix* Ke1=NewElementMatrix(this->nodes,NUMVERTICES,this->parameters,PattynApproximationEnum);
     2082        ElementMatrix* Ke2=NewElementMatrix(this->nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
     2083        ElementMatrix* Ke=new ElementMatrix(Ke1,Ke2);
     2084        delete Ke1;
     2085        delete Ke2;
     2086        Ke1=CreateKMatrixDiagnosticPattyn();
     2087        Ke2=CreateKMatrixDiagnosticStokes();
     2088
     2089        /*Constants*/
     2090        const int    numdofp=2*NUMVERTICES;
     2091        const int    numdofs=4*NUMVERTICES;
     2092        const int    numdoftotal=(4+2)*NUMVERTICES;
     2093        int          i,j;
     2094
     2095        for(i=0;i<numdofs;i++) for(j=0;j<NUMVERTICES;j++){
     2096                Ke->values[(i+numdofp)*numdoftotal+NDOF2*j+0]+=Ke2->values[i*numdofs+NDOF4*j+0];
     2097                Ke->values[(i+numdofp)*numdoftotal+NDOF2*j+1]+=Ke2->values[i*numdofs+NDOF4*j+1];
     2098        }
     2099        for(i=0;i<numdofp;i++) for(j=0;j<NUMVERTICES;j++){
     2100                Ke->values[i*numdoftotal+numdofp+NDOF4*j+0]+=Ke1->values[i*numdofp+NDOF2*j+0];
     2101                Ke->values[i*numdoftotal+numdofp+NDOF4*j+1]+=Ke1->values[i*numdofp+NDOF2*j+1];
     2102        }
     2103
     2104        /*clean-up and return*/
     2105        delete Ke1;
     2106        delete Ke2;
     2107        return Ke;
    21222108}
    21232109/*}}}*/
     
    25292515        /*If on water or not Stokes, skip stiffness: */
    25302516        inputs->GetParameterValue(&approximation,ApproximationEnum);
    2531         if(IsOnWater() || approximation!=StokesApproximationEnum) return NULL;
     2517        if(IsOnWater() || (approximation!=StokesApproximationEnum && approximation!=PattynStokesApproximationEnum)) return NULL;
    25322518        ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
    25332519
     
    26102596        /*If on water or not Stokes, skip stiffness: */
    26112597        inputs->GetParameterValue(&approximation,ApproximationEnum);
    2612         if(IsOnWater() || IsOnShelf() || !IsOnBed() || approximation!=StokesApproximationEnum) return NULL;
     2598        if(IsOnWater() || IsOnShelf() || !IsOnBed() || (approximation!=StokesApproximationEnum && approximation!=PattynStokesApproximationEnum)) return NULL;
    26132599        ElementMatrix* Ke=NewElementMatrix(nodes,NUMVERTICES,this->parameters,StokesApproximationEnum);
    26142600
     
    42054191
    42064192        /*Get dof list: */
    4207         GetDofList(&doflist,NoneApproximationEnum,GsetEnum);
     4193        GetDofList(&doflist,StokesApproximationEnum,GsetEnum);
    42084194        Input* vx_input=inputs->GetInput(VxEnum);       ISSMASSERT(vx_input);
    42094195        Input* vy_input=inputs->GetInput(VyEnum);       ISSMASSERT(vy_input);
Note: See TracChangeset for help on using the changeset viewer.