Changeset 3800


Ignore:
Timestamp:
05/18/10 10:47:41 (15 years ago)
Author:
Mathieu Morlighem
Message:

minor

Location:
issm/trunk/src/c
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/DataSet/Inputs.cpp

    r3775 r3800  
    300300        }
    301301
    302         if (!xinput | !yinput){
     302        if (!xinput || !yinput){
    303303                /*we could not find one input with the correct enum type. No defaults values were provided,
    304304                 * error out: */
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r3791 r3800  
    12111211                /*Compute thickness at gaussian point: */
    12121212                inputs->GetParameterValue(&thickness, gauss_l1l2l3,ThicknessEnum);
     1213                printf("thickness = %g\n",thickness);
    12131214
    12141215                /*Get strain rate from velocity: */
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.cpp

    r3784 r3800  
    149149/*}}}*/
    150150/*FUNCTION TriaVertexInput::GetParameterValue(double* pvalue,double* gauss){{{1*/
    151 void TriaVertexInput::GetParameterValue(double* pvalue,double* gauss){ISSMERROR(" not supported yet!");}
     151void TriaVertexInput::GetParameterValue(double* pvalue,double* gauss){
     152        /*P1 interpolation on Gauss point*/
     153
     154        /*intermediary*/
     155        double l1l2l3[3];
     156
     157        /*nodal functions: */
     158        GetNodalFunctions(l1l2l3,gauss);
     159
     160        /*Assign output pointers:*/
     161        *pvalue=l1l2l3[0]*values[0]+l1l2l3[1]*values[1]+l1l2l3[2]*values[2];
     162
     163}
    152164/*}}}*/
    153165/*FUNCTION TriaVertexInput::GetParameterValue(double* pvalue,double* gauss,double defaultvalue){{{1*/
     
    161173/*}}}*/
    162174/*FUNCTION TriaVertexInput::GetStrainRate(double* epsilon,Input* yinput, double* xyz_list, double* gauss){{{1*/
    163 void TriaVertexInput::GetStrainRate(double* epsilon,Input* yinput,double* xyz_list, double* gauss){ISSMERROR(" not supported yet!");}
     175void TriaVertexInput::GetStrainRate(double* epsilon,Input* yinput,double* xyz_list, double* gauss){
     176        ISSMERROR("not implemented yet");
     177}
    164178/*}}}*/
    165179/*FUNCTION TriaVertexInput::GetStrainRateStokes(double* epsilon,Input* yinput, Input* zinput, double* xyz_list, double* gauss){{{1*/
     
    171185}
    172186/*}}}*/
     187
     188/*Intermediary*/
     189/*FUNCTION TriaVertexInput::GetNodalFunctions {{{1*/
     190void TriaVertexInput::GetNodalFunctions(double* l1l2l3, double* gauss){
     191       
     192        /*This routine returns the values of the nodal functions  at the gaussian point.*/
     193
     194        /*First nodal function: */
     195        l1l2l3[0]=gauss[0];
     196
     197        /*Second nodal function: */
     198        l1l2l3[1]=gauss[1];
     199
     200        /*Third nodal function: */
     201        l1l2l3[2]=gauss[2];
     202
     203}
     204/*}}}*/
     205/*FUNCTION TriaVertexInput::GetB {{{1*/
     206void TriaVertexInput::GetB(double* B, double* xyz_list, double* gauss){
     207        /*Compute B  matrix. B=[B1 B2 B3] where Bi is of size 3*NDOF2.
     208         * For grid i, Bi can be expressed in the actual coordinate system
     209         * by:
     210         *       Bi=[ dh/dx           0    ]
     211         *          [   0           dh/dy  ]
     212         *          [ 1/2*dh/dy  1/2*dh/dx ]
     213         * where h is the interpolation function for grid i.
     214         *
     215         * We assume B has been allocated already, of size: 3x(NDOF2*numgrids)
     216         */
     217
     218        int i;
     219        const int NDOF2=2;
     220        const int numgrids=3;
     221
     222        double dh1dh3[NDOF2][numgrids];
     223
     224
     225        /*Get dh1dh2dh3 in actual coordinate system: */
     226        GetNodalFunctionsDerivatives(&dh1dh3[0][0],xyz_list,gauss);
     227
     228        /*Build B: */
     229        for (i=0;i<numgrids;i++){
     230                *(B+NDOF2*numgrids*0+NDOF2*i)=dh1dh3[0][i]; //B[0][NDOF2*i]=dh1dh3[0][i];
     231                *(B+NDOF2*numgrids*0+NDOF2*i+1)=0;
     232                *(B+NDOF2*numgrids*1+NDOF2*i)=0;
     233                *(B+NDOF2*numgrids*1+NDOF2*i+1)=dh1dh3[1][i];
     234                *(B+NDOF2*numgrids*2+NDOF2*i)=(float).5*dh1dh3[1][i];
     235                *(B+NDOF2*numgrids*2+NDOF2*i+1)=(float).5*dh1dh3[0][i];
     236        }
     237}
     238/*}}}*/
     239/*FUNCTION TriaVertexInput::GetNodalFunctionsDerivatives {{{1*/
     240void TriaVertexInput::GetNodalFunctionsDerivatives(double* dh1dh3,double* xyz_list, double* gauss){
     241
     242        /*This routine returns the values of the nodal functions derivatives  (with respect to the
     243         * actual coordinate system: */
     244
     245        int i;
     246        const int NDOF2=2;
     247        const int numgrids=3;
     248
     249        double dh1dh3_ref[NDOF2][numgrids];
     250        double Jinv[NDOF2][NDOF2];
     251
     252
     253        /*Get derivative values with respect to parametric coordinate system: */
     254        GetNodalFunctionsDerivativesReference(&dh1dh3_ref[0][0], gauss);
     255
     256        /*Get Jacobian invert: */
     257        GetJacobianInvert(&Jinv[0][0], xyz_list, gauss);
     258
     259        /*Build dh1dh3:
     260         *
     261         * [dhi/dx]= Jinv*[dhi/dr]
     262         * [dhi/dy]       [dhi/ds]
     263         */
     264
     265        for (i=0;i<numgrids;i++){
     266                *(dh1dh3+numgrids*0+i)=Jinv[0][0]*dh1dh3_ref[0][i]+Jinv[0][1]*dh1dh3_ref[1][i];
     267                *(dh1dh3+numgrids*1+i)=Jinv[1][0]*dh1dh3_ref[0][i]+Jinv[1][1]*dh1dh3_ref[1][i];
     268        }
     269
     270}
     271/*}}}*/
     272/*FUNCTION TriaVertexInput::GetNodalFunctionsDerivativesReference {{{1*/
     273void TriaVertexInput::GetNodalFunctionsDerivativesReference(double* dl1dl3,double* gauss_l1l2l3){
     274
     275        /*This routine returns the values of the nodal functions derivatives  (with respect to the
     276         * natural coordinate system) at the gaussian point. */
     277
     278        const int NDOF2=2;
     279        const int numgrids=3;
     280
     281        /*First nodal function: */
     282        *(dl1dl3+numgrids*0+0)=-0.5;
     283        *(dl1dl3+numgrids*1+0)=-1.0/(2.0*SQRT3);
     284
     285        /*Second nodal function: */
     286        *(dl1dl3+numgrids*0+1)=0.5;
     287        *(dl1dl3+numgrids*1+1)=-1.0/(2.0*SQRT3);
     288
     289        /*Third nodal function: */
     290        *(dl1dl3+numgrids*0+2)=0;
     291        *(dl1dl3+numgrids*1+2)=1.0/SQRT3;
     292
     293}
     294/*}}}*/
     295/*FUNCTION TriaVertexInput::GetJacobian {{{1*/
     296void TriaVertexInput::GetJacobian(double* J, double* xyz_list,double* gauss){
     297
     298        /*The Jacobian is constant over the element, discard the gaussian points.
     299         * J is assumed to have been allocated of size NDOF2xNDOF2.*/
     300
     301        const int NDOF2=2;
     302        const int numgrids=3;
     303        double x1,y1,x2,y2,x3,y3;
     304
     305        x1=*(xyz_list+numgrids*0+0);
     306        y1=*(xyz_list+numgrids*0+1);
     307        x2=*(xyz_list+numgrids*1+0);
     308        y2=*(xyz_list+numgrids*1+1);
     309        x3=*(xyz_list+numgrids*2+0);
     310        y3=*(xyz_list+numgrids*2+1);
     311
     312
     313        *(J+NDOF2*0+0)=0.5*(x2-x1);
     314        *(J+NDOF2*1+0)=SQRT3/6.0*(2*x3-x1-x2);
     315        *(J+NDOF2*0+1)=0.5*(y2-y1);
     316        *(J+NDOF2*1+1)=SQRT3/6.0*(2*y3-y1-y2);
     317}
     318/*}}}*/
     319/*FUNCTION TriaVertexInput::GetJacobianInvert {{{1*/
     320void TriaVertexInput::GetJacobianInvert(double*  Jinv, double* xyz_list,double* gauss){
     321
     322        double Jdet;
     323        const int NDOF2=2;
     324        const int numgrids=3;
     325
     326        /*Call Jacobian routine to get the jacobian:*/
     327        GetJacobian(Jinv, xyz_list, gauss);
     328
     329        /*Invert Jacobian matrix: */
     330        MatrixInverse(Jinv,NDOF2,NDOF2,NULL,0,&Jdet);
     331
     332}
     333/*}}}*/
  • issm/trunk/src/c/objects/Inputs/TriaVertexInput.h

    r3751 r3800  
    6363                void GetStrainRateStokes(double* epsilon,Input* yinput, Input* zinput, double* xyz_list, double* gauss);
    6464                void ChangeEnum(int newenumtype);
     65
     66                void GetNodalFunctions(double* l1l2l3, double* gauss);
     67                void GetB(double* B, double* xyz_list, double* gauss);
     68                void GetNodalFunctionsDerivatives(double* dh1dh3,double* xyz_list, double* gauss);
     69                void GetNodalFunctionsDerivativesReference(double* dl1dl3,double* gauss_l1l2l3);
     70                void GetJacobian(double* J, double* xyz_list,double* gauss);
     71                void GetJacobianInvert(double*  Jinv, double* xyz_list,double* gauss);
    6572                /*}}}*/
    6673
  • issm/trunk/src/c/parallel/prognostic_core.cpp

    r3791 r3800  
    4747       
    4848        _printf_("extract result from extruded inputs: \n");
    49         InputToResult(&result,fem_p->elements,fem_p->nodes, fem_p->vertices,fem_p->loads, fem_p->materials,fem_p->parameters,ThicknessEnum,results->Size()+1,0,1);
     49        result=new Result(results->Size()+1,0,1,"h_g",h_g);
     50        //InputToResult(&result,fem_p->elements,fem_p->nodes, fem_p->vertices,fem_p->loads, fem_p->materials,fem_p->parameters,ThicknessEnum,results->Size()+1,0,1);
    5051        results->AddObject(result);
    5152
Note: See TracChangeset for help on using the changeset viewer.