Changeset 17225


Ignore:
Timestamp:
02/06/14 21:28:00 (11 years ago)
Author:
seroussi
Message:

BUG: fixed problem in the case of no initial field

Location:
issm/trunk-jpl/src/c/classes
Files:
3 edited

Legend:

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

    r17142 r17225  
    178178}
    179179/*}}}*/
    180 /*FUNCTION PentaRef::GetNodalFunctions{{{*/
    181 void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in){
     180/*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){{{*/
     181void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss){
     182        /*This routine returns the values of the nodal functions  at the gaussian point.*/
     183
     184        _assert_(basis);
     185        GetNodalFunctions(basis,gauss,this->element_type);
     186
     187}
     188/*}}}*/
     189/*FUNCTION PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){{{*/
     190void PentaRef::GetNodalFunctions(IssmDouble* basis,Gauss* gauss_in,int finiteelement){
    182191        /*This routine returns the values of the nodal functions  at the gaussian point.*/
    183192
     
    191200        IssmDouble zeta=gauss->coord4;
    192201
    193         switch(this->element_type){
     202        switch(finiteelement){
     203                case P0Enum:
     204                        basis[0]=1.;
     205                        return;
    194206                case P1Enum: case P1DGEnum:
    195207                        basis[0]=gauss->coord1*(1.-zeta)/2.;
     
    408420
    409421        switch(this->element_type){
     422                case P0Enum:
     423                        /*Zero derivative*/
     424                        dbasis[NUMNODESP0*0+0]   = 0.;
     425                        dbasis[NUMNODESP0*1+0]   = 0.;
     426                        dbasis[NUMNODESP0*2+0]   = 0.;
     427                        return;
    410428                case P1Enum: case P1DGEnum:
    411429                        /*Nodal function 1*/
     
    9961014}
    9971015/*}}}*/
    998 /*FUNCTION PentaRef::GetInputValue{{{*/
     1016/*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){{{*/
    9991017void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss){
    1000         /*P1 interpolation on Gauss point*/
    1001 
    1002         /*intermediary*/
    1003         IssmDouble basis[6];
    1004 
    1005         /*nodal functions: */
    1006         GetNodalFunctionsP1(&basis[0],gauss);
    1007 
    1008         /*Assign output pointers:*/
    1009         *pvalue=basis[0]*plist[0]+basis[1]*plist[1]+basis[2]*plist[2]+basis[3]*plist[3]+basis[4]*plist[4]+basis[5]*plist[5];
     1018
     1019        GetInputValue(pvalue,plist,gauss,this->element_type);
     1020
     1021}
     1022/*}}}*/
     1023/*FUNCTION PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){{{*/
     1024void PentaRef::GetInputValue(IssmDouble* pvalue,IssmDouble* plist,Gauss* gauss,int finiteelement){
     1025
     1026        /*Output*/
     1027        IssmDouble value =0.;
     1028
     1029        /*Fetch number of nodes for this finite element*/
     1030        int numnodes = this->NumberofNodes(finiteelement);
     1031
     1032        /*Get nodal functions*/
     1033        IssmDouble* basis=xNew<IssmDouble>(numnodes);
     1034        GetNodalFunctions(basis, gauss,finiteelement);
     1035
     1036        /*Calculate parameter for this Gauss point*/
     1037        for(int i=0;i<numnodes;i++) value += basis[i]*plist[i];
     1038
     1039        /*Assign output pointer*/
     1040        xDelete<IssmDouble>(basis);
     1041        *pvalue = value;
    10101042
    10111043}
     
    10221054         *   p is a vector of size 3x1 already allocated.
    10231055         */
    1024         IssmDouble dbasis[3][NUMNODESP1];
    1025 
    1026         /*Get nodal funnctions derivatives in actual coordinate system: */
    1027         GetNodalFunctionsP1Derivatives(&dbasis[0][0],xyz_list, gauss);
    1028 
    1029         /*Assign output*/
    1030         p[0]=plist[0]*dbasis[0][0]+plist[1]*dbasis[0][1]+plist[2]*dbasis[0][2]+plist[3]*dbasis[0][3]+plist[4]*dbasis[0][4]+plist[5]*dbasis[0][5];
    1031         p[1]=plist[0]*dbasis[1][0]+plist[1]*dbasis[1][1]+plist[2]*dbasis[1][2]+plist[3]*dbasis[1][3]+plist[4]*dbasis[1][4]+plist[5]*dbasis[1][5];
    1032         p[2]=plist[0]*dbasis[2][0]+plist[1]*dbasis[2][1]+plist[2]*dbasis[2][2]+plist[3]*dbasis[2][3]+plist[4]*dbasis[2][4]+plist[5]*dbasis[2][5];
    1033 
    1034 }
    1035 /*}}}*/
    1036 /*FUNCTION PentaRef::NumberofNodes{{{*/
     1056
     1057        /*Output*/
     1058        IssmDouble dpx=0.;
     1059        IssmDouble dpy=0.;
     1060        IssmDouble dpz=0.;
     1061
     1062        /*Fetch number of nodes for this finite element*/
     1063        int numnodes = this->NumberofNodes();
     1064
     1065        /*Get nodal functions derivatives*/
     1066        IssmDouble* dbasis=xNew<IssmDouble>(3*numnodes);
     1067        GetNodalFunctionsDerivatives(dbasis,xyz_list,gauss);
     1068
     1069        /*Calculate parameter for this Gauss point*/
     1070        for(int i=0;i<numnodes;i++) dpx += dbasis[0*numnodes+i]*plist[i];
     1071        for(int i=0;i<numnodes;i++) dpy += dbasis[1*numnodes+i]*plist[i];
     1072        for(int i=0;i<numnodes;i++) dpz += dbasis[2*numnodes+i]*plist[i];
     1073
     1074        /*Assign values*/
     1075        xDelete<IssmDouble>(dbasis);
     1076        p[0]=dpx;
     1077        p[1]=dpy;
     1078        p[2]=dpz;
     1079
     1080}
     1081/*}}}*/
     1082/*FUNCTION PentaRef::NumberofNodes(){{{*/
    10371083int PentaRef::NumberofNodes(void){
    10381084
    1039         switch(this->element_type){
     1085        return this->NumberofNodes(this->element_type);
     1086}
     1087/*}}}*/
     1088/*FUNCTION PentaRef::NumberofNodes(int finiteelement){{{*/
     1089int PentaRef::NumberofNodes(int finiteelement){
     1090
     1091        switch(finiteelement){
    10401092                case P0Enum:                return NUMNODESP0;
    10411093                case P1Enum:                return NUMNODESP1;
  • issm/trunk-jpl/src/c/classes/Elements/PentaRef.h

    r17095 r17225  
    2323                /*Numerics*/
    2424                void GetNodalFunctions(IssmDouble* basis, Gauss* gauss);
     25                void GetNodalFunctions(IssmDouble* basis, Gauss* gauss,int finiteelement);
    2526                void GetNodalFunctionsVelocity(IssmDouble* basis, Gauss* gauss);
    2627                void GetNodalFunctionsPressure(IssmDouble* basis, Gauss* gauss);
     
    4344                void GetLprimeFSSSA(IssmDouble* LprimeFSSSA, IssmDouble* xyz_list, Gauss* gauss);
    4445                void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss);
     46                void GetInputValue(IssmDouble* pvalue,IssmDouble* plist, Gauss* gauss,int finiteelement);
    4547                void GetInputDerivativeValue(IssmDouble* pvalues, IssmDouble* plist,IssmDouble* xyz_list, Gauss* gauss);
    4648
     
    4850                void SurfaceNodeIndices(int* pnumindices,int** pindices,int finiteelement);
    4951                int  NumberofNodes(void);
     52                int  NumberofNodes(int finiteelement);
    5053                int  NumberofNodesVelocity(void);
    5154                int  NumberofNodesPressure(void);
  • issm/trunk-jpl/src/c/classes/IoModel.cpp

    r17175 r17225  
    14821482        for(int i=0;i<elements->Size();i++){
    14831483                Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    1484                 if(!doublearray) element->InputUpdateFromConstant(default_value,vector_enum);
     1484                if(!doublearray) element->AddInput(vector_enum,&default_value,P0Enum);
    14851485                else             element->InputCreate(doublearray,this,M,N,vector_layout,vector_enum,code);//we need i to index into elements.
    14861486        }
Note: See TracChangeset for help on using the changeset viewer.