Changeset 11338


Ignore:
Timestamp:
02/06/12 16:59:01 (13 years ago)
Author:
Mathieu Morlighem
Message:

Prepared Stokes Newton's iterations

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

Legend:

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

    r11332 r11338  
    788788#ifdef _HAVE_DIAGNOSTIC_
    789789                case DiagnosticHorizAnalysisEnum:
    790                         Ke=CreateJacobianDiagnosticPattyn();
     790                        Ke=CreateJacobianDiagnosticHoriz();
    791791                        break;
    792792#endif
     
    74247424}
    74257425/*}}}*/
     7426/*FUNCTION Penta::CreateJacobianDiagnosticHoriz{{{1*/
     7427ElementMatrix* Penta::CreateJacobianDiagnosticHoriz(void){
     7428
     7429        int approximation;
     7430        inputs->GetInputValue(&approximation,ApproximationEnum);
     7431
     7432        switch(approximation){
     7433                case MacAyealApproximationEnum:
     7434                        _error_("Not supported yet");
     7435                case PattynApproximationEnum:
     7436                        return CreateJacobianDiagnosticPattyn();
     7437                case StokesApproximationEnum:
     7438                        return CreateJacobianDiagnosticStokes();
     7439                default:
     7440                        _error_("Approximation %s not supported yet",EnumToStringx(approximation));
     7441        }
     7442}
     7443/*}}}*/
    74267444/*FUNCTION Penta::CreateJacobianDiagnosticPattyn{{{1*/
    74277445ElementMatrix* Penta::CreateJacobianDiagnosticPattyn(void){
    74287446
     7447        /*Constants*/
     7448        const int    numdof=NDOF2*NUMVERTICES;
     7449
     7450        /*Intermediaries */
     7451        int        i,j,ig;
     7452        int        approximation;
     7453        double     xyz_list[NUMVERTICES][3];
     7454        double     Jdet;
     7455        double     eps1dotdphii,eps1dotdphij;
     7456        double     eps2dotdphii,eps2dotdphij;
     7457        double     mu_prime;
     7458        double     epsilon[5]; /* epsilon=[exx,eyy,exy,exz,eyz];*/
     7459        double     eps1[3],eps2[3];
     7460        double     phi[NUMVERTICES];
     7461        double     dphi[3][NUMVERTICES];
     7462        GaussPenta *gauss=NULL;
     7463
     7464        /*Initialize Jacobian with regular Pattyn (first part of the Gateau derivative)*/
     7465        ElementMatrix* Ke=CreateKMatrixDiagnosticPattyn();
     7466
     7467        /*Retrieve all inputs and parameters*/
     7468        inputs->GetInputValue(&approximation,ApproximationEnum);
     7469        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     7470        Input* vx_input=inputs->GetInput(VxEnum);       _assert_(vx_input);
     7471        Input* vy_input=inputs->GetInput(VyEnum);       _assert_(vy_input);
     7472
     7473        /* Start  looping on the number of gaussian points: */
     7474        gauss=new GaussPenta(5,5);
     7475        for (ig=gauss->begin();ig<gauss->end();ig++){
     7476
     7477                gauss->GaussPoint(ig);
     7478
     7479                GetJacobianDeterminant(&Jdet, &xyz_list[0][0],gauss);
     7480                GetNodalFunctionsP1Derivatives(&dphi[0][0],&xyz_list[0][0],gauss);
     7481
     7482                this->GetStrainRate3dPattyn(&epsilon[0],&xyz_list[0][0],gauss,vx_input,vy_input);
     7483                matice->GetViscosityDerivativeEpsSquare(&mu_prime,&epsilon[0]);
     7484                eps1[0]=2*epsilon[0]+epsilon[1];   eps2[0]=epsilon[2];
     7485                eps1[1]=epsilon[2];                eps2[1]=epsilon[0]+2*epsilon[1];
     7486                eps1[2]=epsilon[3];                eps2[2]=epsilon[4];
     7487
     7488                for(i=0;i<6;i++){
     7489                        for(j=0;j<6;j++){
     7490                                eps1dotdphii=eps1[0]*dphi[0][i]+eps1[1]*dphi[1][i]+eps1[2]*dphi[2][i];
     7491                                eps1dotdphij=eps1[0]*dphi[0][j]+eps1[1]*dphi[1][j]+eps1[2]*dphi[2][j];
     7492                                eps2dotdphii=eps2[0]*dphi[0][i]+eps2[1]*dphi[1][i]+eps2[2]*dphi[2][i];
     7493                                eps2dotdphij=eps2[0]*dphi[0][j]+eps2[1]*dphi[1][j]+eps2[2]*dphi[2][j];
     7494
     7495                                Ke->values[12*(2*i+0)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps1dotdphii;
     7496                                Ke->values[12*(2*i+0)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps1dotdphii;
     7497                                Ke->values[12*(2*i+1)+2*j+0]+=gauss->weight*Jdet*2*mu_prime*eps1dotdphij*eps2dotdphii;
     7498                                Ke->values[12*(2*i+1)+2*j+1]+=gauss->weight*Jdet*2*mu_prime*eps2dotdphij*eps2dotdphii;
     7499                        }
     7500                }
     7501        }
     7502
     7503        /*Transform Coordinate System*/
     7504        TransformStiffnessMatrixCoord(Ke,nodes,NUMVERTICES,XYEnum);
     7505
     7506        /*Clean up and return*/
     7507        delete gauss;
     7508        return Ke;
     7509}
     7510/*}}}*/
     7511/*FUNCTION Penta::CreateJacobianDiagnosticStokes{{{1*/
     7512ElementMatrix* Penta::CreateJacobianDiagnosticStokes(void){
     7513
     7514        _error_("Not implemented yet");
    74297515        /*Constants*/
    74307516        const int    numdof=NDOF2*NUMVERTICES;
  • issm/trunk-jpl/src/c/objects/Elements/Penta.h

    r11322 r11338  
    235235                ElementMatrix* CreateKMatrixDiagnosticVertVolume(void);
    236236                ElementMatrix* CreateKMatrixDiagnosticVertSurface(void);
     237                ElementMatrix* CreateJacobianDiagnosticHoriz(void);
    237238                ElementMatrix* CreateJacobianDiagnosticPattyn(void);
     239                ElementMatrix* CreateJacobianDiagnosticStokes(void);
    238240                void           InputUpdateFromSolutionDiagnosticHoriz( double* solutiong);
    239241                void           InputUpdateFromSolutionDiagnosticMacAyeal( double* solutiong);
  • issm/trunk-jpl/src/c/solvers/solver_newton.cpp

    r11337 r11338  
    7878
    7979                CreateJacobianMatrixx(&Jff,femmodel->elements,femmodel->nodes,femmodel->vertices,femmodel->loads,femmodel->materials,femmodel->parameters,kmax);
    80                 Solverx(&duf,Jff,pJf,NULL,NULL,femmodel->parameters); MatFree(&Jff);//VecFree(&pJf);
     80                Solverx(&duf,Jff,pJf,NULL,NULL,femmodel->parameters); MatFree(&Jff);VecFree(&pJf);
    8181                VecAXPY(uf,1.,duf);      VecFree(&duf);
    8282                Mergesolutionfromftogx(&ug,uf,ys,femmodel->nodes,femmodel->parameters);VecFree(&ys);
Note: See TracChangeset for help on using the changeset viewer.