Changeset 5316


Ignore:
Timestamp:
08/17/10 13:32:50 (15 years ago)
Author:
Eric.Larour
Message:

New routine to update dakota inputs in Tria.cpp

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

Legend:

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

    r5314 r5316  
    414414        if (!IsInput(name)) return;
    415415
     416        /*Penta update B in InputUpdateFromSolutionThermal, so don't look for B update here.*/
     417
    416418        switch(type){
    417419
     
    448450/*FUNCTION Penta::InputUpdateFromVectorDakota(double* vector, int name, int type);{{{1*/
    449451void  Penta::InputUpdateFromVectorDakota(double* vector, int name, int type){
    450 
    451         /*Check that name is an element input*/
    452         if (!IsInput(name)) return;
    453 
    454         switch(type){
    455 
    456                 case VertexEnum:
    457 
    458                         /*New PentaVertexInpu*/
    459                         double values[6];
    460 
    461                         /*Get values on the 6 vertices*/
    462                         for (int i=0;i<6;i++){
    463                                 values[i]=vector[this->nodes[i]->GetVertexDof()];
    464                         }
    465 
    466                         /*update input*/
    467                         this->inputs->AddInput(new PentaVertexInput(name,values));
    468                         return;
    469 
    470                 default:
    471 
    472                         ISSMERROR("type %i (%s) not implemented yet",type,EnumToString(type));
    473         }
     452        ISSMERROR(" not supported yet!");
    474453}
    475454/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r5314 r5316  
    413413                        double values[3];
    414414
    415                         /*Get values on the 6 vertices*/
     415                        /*Get values on the 3 vertices*/
    416416                        for (int i=0;i<3;i++){
    417417                                values[i]=vector[this->nodes[i]->GetVertexDof()];
     
    445445/*FUNCTION Tria::InputUpdateFromVectorDakota(double* vector, int name, int type);{{{1*/
    446446void  Tria::InputUpdateFromVectorDakota(double* vector, int name, int type){
     447       
     448        const int numgrids=3;
     449        double  gaussgrids[numgrids][numgrids]={{1,0,0},{0,1,0},{0,0,1}};
     450        int i,j;
    447451
    448452        /*Check that name is an element input*/
     
    456460                        double values[3];
    457461
    458                         /*Get values on the 6 vertices*/
    459                         for (int i=0;i<3;i++){
     462                        /*Get values on the 3 vertices*/
     463                        for (i=0;i<3;i++){
    460464                                values[i]=vector[this->nodes[i]->GetVertexDof()];
    461465                        }
    462466
    463                         /*update input*/
    464                         if (name==RheologyB2dEnum || name==RheologyBEnum){
    465                                 matice->inputs->AddInput(new TriaVertexInput(name,values));
     467                        /*Branch on the specified type of update: */
     468                        switch(name){
     469                                case RheologyB2dEnum:
     470                                        matice->inputs->AddInput(new TriaVertexInput(name,values));
     471                                        break;
     472                                case RheologyBEnum:
     473                                        matice->inputs->AddInput(new TriaVertexInput(name,values));
     474                                        break;
     475                                case ThicknessEnum:
     476                                        /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{2*/
     477                                        double  thickness[3];
     478                                        double  surface[3];
     479                                        double  bed[3];
     480                                       
     481                                        /*retrieve inputs: */
     482                                        inputs->GetParameterValues(&bed[0],&gaussgrids[0][0],3,BedEnum);
     483                                        inputs->GetParameterValues(&surface[0],&gaussgrids[0][0],3,SurfaceEnum);
     484
     485                                        /*build new thickness: */
     486                                        for(j=0;j<3;j++)thickness[j]=values[j];
     487
     488                                        /*build new bed and surface: */
     489                                        if (this->GetShelf()){
     490                                                /*hydrostatic equilibrium: */
     491                                                double rho_ice,rho_water,di;
     492                                                rho_ice=this->matpar->GetRhoIce();
     493                                                rho_water=this->matpar->GetRhoWater();
     494
     495                                                di=rho_ice/rho_water;
     496
     497                                                for(j=0;j<3;j++){
     498                                                        surface[j]=(1-di)*thickness[j];
     499                                                        bed[j]=-di*thickness[j];
     500                                                }
     501                                        }
     502                                        else{
     503                                                /*update bed on grounded ice: */
     504                                                for(j=0;j<3;j++)surface[j]=bed[j]+thickness[j];
     505                                        }
     506
     507                                        /*Add new inputs: */
     508                                        this->inputs->AddInput(new TriaVertexInput(ThicknessEnum,thickness));
     509                                        this->inputs->AddInput(new TriaVertexInput(BedEnum,bed));
     510                                        this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,surface));
     511
     512                                        /*}}}*/
     513                                        break;
     514                                default:
     515                                        this->inputs->AddInput(new TriaVertexInput(name,values));
    466516                        }
    467                         else{
    468                                 this->inputs->AddInput(new TriaVertexInput(name,values));
    469                         }
    470                         return;
     517                        break;
    471518
    472519                default:
    473 
    474520                        ISSMERROR("type %i (%s) not implemented yet",type,EnumToString(type));
    475521        }
     522
    476523}
    477524/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.