Changeset 15642


Ignore:
Timestamp:
07/26/13 11:31:45 (12 years ago)
Author:
Mathieu Morlighem
Message:

CHG: extending higher order elements to other solutions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/PentaRef.cpp

    r15640 r15642  
    144144         * We assume B has been allocated already, of size: 5x(NDOF2*numnodes)
    145145         */
    146 
    147146
    148147        /*Fetch number of nodes for this finite element*/
     
    531530         */
    532531
    533         /*Same thing in the actual coordinate system: */
    534         IssmDouble basis[6];
    535 
    536         /*Get dh1dh2dh3 in actual coordinates system : */
    537         GetNodalFunctionsP1(basis, gauss);
    538 
    539         /*Build B': */
    540         for(int i=0;i<NUMNODESP1;i++){
    541                 B_advec[NDOF1*NUMNODESP1*0+NDOF1*i] = basis[i];
    542                 B_advec[NDOF1*NUMNODESP1*1+NDOF1*i] = basis[i];
    543                 B_advec[NDOF1*NUMNODESP1*2+NDOF1*i] = basis[i];
    544         }
     532        /*Fetch number of nodes for this finite element*/
     533        int numnodes = this->NumberofNodes();
     534
     535        /*Get nodal functions derivatives*/
     536        IssmDouble* basis=xNew<IssmDouble>(numnodes);
     537        GetNodalFunctions(basis,gauss);
     538
     539        /*Build B: */
     540        for(int i=0;i<numnodes;i++){
     541                B_advec[numnodes*0+i] = basis[i];
     542                B_advec[numnodes*1+i] = basis[i];
     543                B_advec[numnodes*2+i] = basis[i];
     544        }
     545
     546        /*Clean-up*/
     547        xDelete<IssmDouble>(basis);
    545548}
    546549/*}}}*/
     
    555558         * where h is the interpolation function for node i.
    556559         *
    557          * We assume B has been allocated already, of size: 3x(NDOF1*NUMNODESP1)
    558          */
    559 
    560         /*Same thing in the actual coordinate system: */
    561         IssmDouble dbasis[3][NUMNODESP1];
    562 
    563         /*Get dh1dh2dh3 in actual coordinates system : */
    564         GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
    565 
    566         /*Build B': */
    567         for(int i=0;i<NUMNODESP1;i++){
    568                 B_conduct[NDOF1*NUMNODESP1*0+NDOF1*i] = dbasis[0][i];
    569                 B_conduct[NDOF1*NUMNODESP1*1+NDOF1*i] = dbasis[1][i];
    570                 B_conduct[NDOF1*NUMNODESP1*2+NDOF1*i] = dbasis[2][i];
    571         }
     560         * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
     561         */
     562
     563        /*Fetch number of nodes for this finite element*/
     564        int numnodes = this->NumberofNodes();
     565
     566        /*Get nodal functions derivatives*/
     567        IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
     568        GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
     569
     570        /*Build B: */
     571        for(int i=0;i<numnodes;i++){
     572                B_conduct[numnodes*0+i] = dbasis[0*numnodes+i];
     573                B_conduct[numnodes*1+i] = dbasis[1*numnodes+i];
     574                B_conduct[numnodes*2+i] = dbasis[2*numnodes+i];
     575        }
     576
     577        /*Clean-up*/
     578        xDelete<IssmDouble>(dbasis);
    572579}
    573580/*}}}*/
     
    577584                where hi is the interpolation function for node i.*/
    578585
    579         /*Get dbasis in actual coordinate system: */
    580         IssmDouble dbasis[3][NUMNODESP1];
    581         GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
     586        /*Fetch number of nodes for this finite element*/
     587        int numnodes = this->NumberofNodes();
     588
     589        /*Get nodal functions derivatives*/
     590        IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
     591        GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
    582592
    583593        /*Build B: */
    584         for(int i=0;i<NUMNODESP1;i++){
    585                 B[i] = dbasis[2][i]; 
    586         }
    587 
     594        for(int i=0;i<numnodes;i++){
     595                B[i] = dbasis[2*numnodes+i]; 
     596        }
     597
     598        /*Clean-up*/
     599        xDelete<IssmDouble>(dbasis);
    588600}
    589601/*}}}*/
     
    598610         * where h is the interpolation function for node i.
    599611         *
    600          * We assume B has been allocated already, of size: 3x(NDOF1*NUMNODESP1)
    601          */
    602 
    603         /*Get nodal function derivatives in actual coordinates system : */
    604         IssmDouble dbasis[3][NUMNODESP1];
    605         GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list,gauss);
     612         * We assume B has been allocated already, of size: 3x(NDOF1*numnodes)
     613         */
     614
     615        /*Fetch number of nodes for this finite element*/
     616        int numnodes = this->NumberofNodes();
     617
     618        /*Get nodal functions derivatives*/
     619        IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
     620        GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
    606621
    607622        /*Build B': */
    608         for(int i=0;i<NUMNODESP1;i++){
    609                 Bprime_advec[NDOF1*NUMNODESP1*0+NDOF1*i] = dbasis[0][i];
    610                 Bprime_advec[NDOF1*NUMNODESP1*1+NDOF1*i] = dbasis[1][i];
    611                 Bprime_advec[NDOF1*NUMNODESP1*2+NDOF1*i] = dbasis[2][i];
    612         }
     623        for(int i=0;i<numnodes;i++){
     624                Bprime_advec[numnodes*0+i] = dbasis[0*numnodes+i];
     625                Bprime_advec[numnodes*1+i] = dbasis[1*numnodes+i];
     626                Bprime_advec[numnodes*2+i] = dbasis[2*numnodes+i];
     627        }
     628
     629        /*Clean-up*/
     630        xDelete<IssmDouble>(dbasis);
    613631}
    614632/*}}}*/
     
    616634void PentaRef::GetBprimeVert(IssmDouble* B, IssmDouble* xyz_list, GaussPenta* gauss){
    617635
    618         GetNodalFunctionsP1(B, gauss);
     636        GetNodalFunctions(B,gauss);
    619637
    620638}
     
    631649         ** We assume B has been allocated already, of size: 2 (2 x numnodes)
    632650         **/
    633 
    634651
    635652        /*Fetch number of nodes for this finite element*/
Note: See TracChangeset for help on using the changeset viewer.