Changeset 5769


Ignore:
Timestamp:
09/13/10 12:03:37 (15 years ago)
Author:
seroussi
Message:

added InputUpdateFromSolution for PattynStokes

Location:
issm/trunk/src/c/objects/Elements
Files:
2 edited

Legend:

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

    r5767 r5769  
    894894                        GetSolutionFromInputsDiagnosticStokes(solution);
    895895                }
    896                 else{
     896                else if (approximation==MacAyealApproximationEnum || approximation==PattynApproximationEnum ||approximation==HutterApproximationEnum){
    897897                        GetSolutionFromInputsDiagnosticHoriz(solution);
    898898                }
     899                else if(approximation==MacAyealPattynApproximationEnum || approximation==PattynStokesApproximationEnum){
     900                        return; //do nothing the elements around with update the solution
     901                }
     902                else ISSMERROR("approximation type : %i (%s) not implemented yet",approximation,EnumToString(approximation));
    899903        }
    900904        else if(analysis_type==DiagnosticHutterAnalysisEnum){
     
    18881892                        this->inputs->AddInput(new IntInput(ApproximationEnum,StokesApproximationEnum));
    18891893                }
     1894                else if (*(iomodel->elements_type+index)==PattynStokesApproximationEnum){
     1895                        this->inputs->AddInput(new IntInput(ApproximationEnum,PattynStokesApproximationEnum));
     1896                }
    18901897                else if (*(iomodel->elements_type+index)==NoneApproximationEnum){
    18911898                        this->inputs->AddInput(new IntInput(ApproximationEnum,NoneApproximationEnum));
     
    39883995        /*If the element is a coupling, do nothing: every grid is also on an other elements
    39893996         * (as coupling is between MacAyeal and Pattyn) so the other element will take care of it*/
    3990         if(approximation==MacAyealPattynApproximationEnum){
    3991          return;
    3992         }
    3993         else{
    3994                 GetDofList(&doflist,approximation);
    3995         }
     3997        GetDofList(&doflist,approximation);
    39963998
    39973999        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     
    44454447        else if (approximation==MacAyealPattynApproximationEnum){
    44464448                InputUpdateFromSolutionDiagnosticMacAyealPattyn(solution);
     4449        }
     4450        else if (approximation==PattynStokesApproximationEnum){
     4451                InputUpdateFromSolutionDiagnosticPattynStokes(solution);
    44474452        }
    44484453}
     
    47074712}
    47084713
     4714/*}}}*/
     4715/*FUNCTION Penta::InputUpdateFromSolutionDiagnosticPattynStokes {{{1*/
     4716void  Penta::InputUpdateFromSolutionDiagnosticPattynStokes(double* solution){
     4717
     4718        int i;
     4719
     4720        const int    numdofpervertexp=2;
     4721        const int    numdofpervertexs=4;
     4722        const int    numdofp=numdofpervertexp*NUMVERTICES;
     4723        const int    numdofs=numdofpervertexs*NUMVERTICES;
     4724        int*         doflistp=NULL;
     4725        int*         doflists=NULL;
     4726        double       pattyn_values[numdofp];
     4727        double       stokes_values[numdofs];
     4728        double       vx[NUMVERTICES];
     4729        double       vy[NUMVERTICES];
     4730        double       vz[NUMVERTICES];
     4731        double       vel[NUMVERTICES];
     4732        int          dummy;
     4733        double       pressure[NUMVERTICES];
     4734        double       xyz_list[NUMVERTICES][3];
     4735
     4736        double *vz_ptr         = NULL;
     4737        Penta  *penta          = NULL;
     4738
     4739        /*OK, we have to add results of this element for pattyn
     4740         * and results from the penta at base for macayeal. Now recover results*/
     4741
     4742        /*Get dof listof this element (pattyn dofs and stokes dofs): */
     4743        GetDofList(&doflistp,PattynApproximationEnum);
     4744        GetDofList(&doflists,StokesApproximationEnum);
     4745
     4746        /*Get node data: */
     4747        GetVerticesCoordinates(&xyz_list[0][0], nodes, NUMVERTICES);
     4748
     4749        /*Use the dof list to index into the solution vector: */
     4750        for(i=0;i<numdofp;i++){
     4751                pattyn_values[i]=solution[doflistp[i]];
     4752        }
     4753        for(i=0;i<numdofs;i++){
     4754                stokes_values[i]=solution[doflists[i]];
     4755        }
     4756
     4757        /*Ok, we have vx and vy in values, fill in vx and vy arrays: */
     4758        for(i=0;i<NUMVERTICES;i++){
     4759                vx[i]=stokes_values[i*numdofpervertexs+0]+pattyn_values[i*numdofpervertexp+0];
     4760                vy[i]=stokes_values[i*numdofpervertexs+1]+pattyn_values[i*numdofpervertexp+1];
     4761                vz[i]=stokes_values[i*numdofpervertexs+2];
     4762                pressure[i]=stokes_values[i*numdofpervertexs+3];
     4763        }
     4764
     4765        /*Get Vz*/
     4766        Input* vz_input=inputs->GetInput(VzEnum);
     4767        if (vz_input){
     4768                if (vz_input->Enum()!=PentaVertexInputEnum){
     4769                        ISSMERROR("Cannot compute Vel as Vz is of type %s",EnumToString(vz_input->Enum()));
     4770                }
     4771                vz_input->GetValuesPtr(&vz_ptr,&dummy);
     4772                for(i=0;i<NUMVERTICES;i++) vz[i]=vz[i]+vz_ptr[i];
     4773        }
     4774        else{
     4775                ISSMERROR("Cannot compute Vel there is no Vz input");
     4776        }
     4777
     4778        /*Now Compute vel*/
     4779        for(i=0;i<NUMVERTICES;i++) {
     4780                vel[i]=pow( pow(vx[i],2.0) + pow(vy[i],2.0) + pow(vz[i],2.0) , 0.5);
     4781        }
     4782
     4783        /*Now, we have to move the previous Vx and Vy inputs  to old
     4784         * status, otherwise, we'll wipe them off: */
     4785        this->inputs->ChangeEnum(VxEnum,VxOldEnum);
     4786        this->inputs->ChangeEnum(VyEnum,VyOldEnum);
     4787        this->inputs->ChangeEnum(VzEnum,VzOldEnum);
     4788        this->inputs->ChangeEnum(PressureEnum,PressureOldEnum);
     4789
     4790        /*Add vx and vy as inputs to the tria element: */
     4791        this->inputs->AddInput(new PentaVertexInput(VxEnum,vx));
     4792        this->inputs->AddInput(new PentaVertexInput(VyEnum,vy));
     4793        this->inputs->AddInput(new PentaVertexInput(VzEnum,vz));
     4794        this->inputs->AddInput(new PentaVertexInput(VelEnum,vel));
     4795        this->inputs->AddInput(new PentaVertexInput(PressureEnum,pressure));
     4796
     4797        /*Free ressources:*/
     4798        xfree((void**)&doflistp);
     4799        xfree((void**)&doflists);
     4800}
    47094801/*}}}*/
    47104802/*FUNCTION Penta::InputUpdateFromSolutionDiagnosticHutter {{{1*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r5746 r5769  
    168168                void    InputUpdateFromSolutionDiagnosticMacAyealPattyn( double* solutiong);
    169169                void    InputUpdateFromSolutionDiagnosticPattyn( double* solutiong);
     170                void    InputUpdateFromSolutionDiagnosticPattynStokes( double* solutiong);
    170171                void    InputUpdateFromSolutionDiagnosticHutter( double* solutiong);
    171172                void    InputUpdateFromSolutionDiagnosticVert( double* solutiong);
Note: See TracChangeset for help on using the changeset viewer.