Changeset 9009


Ignore:
Timestamp:
07/15/11 17:43:41 (14 years ago)
Author:
Eric.Larour
Message:

Implementing Dakota update in 3D

File:
1 edited

Legend:

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

    r8998 r9009  
    49374937                        this->inputs->AddInput(transientinput);
    49384938                }
    4939                 else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long",iomodel->numberofvertices,M);
     4939                else _error_("nodal vector is either numberofnodes (%i), or numberofnodes+1 long. Field provided is %i long. Enum %s",iomodel->numberofvertices,M,EnumToStringx(vector_enum));
    49404940        }
    49414941        else if(vector_type==2){ //element vector
     
    65056505/*FUNCTION Penta::InputUpdateFromVectorDakota(double* vector, int name, int type);{{{1*/
    65066506void  Penta::InputUpdateFromVectorDakota(double* vector, int name, int type){
    6507         _error_(" not supported yet!");
     6507       
     6508        int i,j;
     6509
     6510        /*Check that name is an element input*/
     6511        if (!IsInput(name)) return;
     6512
     6513        switch(type){
     6514
     6515                case VertexEnum:
     6516
     6517                        /*New PentaVertexInput*/
     6518                        double values[6];
     6519
     6520                        /*Get values on the 6 vertices*/
     6521                        for (i=0;i<6;i++){
     6522                                values[i]=vector[this->nodes[i]->GetSidList()]; //careful, vector of values here is not parallel distributed, but serial distributed (from a serial Dakota core!)
     6523                        }
     6524
     6525                        /*Branch on the specified type of update: */
     6526                        switch(name){
     6527                                case ThicknessEnum:
     6528                                        /*Update thickness + surface: assume bed is constant. On ice shelves, takes hydrostatic equilibrium {{{2*/
     6529                                        double  thickness[6];
     6530                                        double  thickness_init[6];
     6531                                        double  thickness_coeff[6];
     6532                                        double  surface[6];
     6533                                        double  bed[6];
     6534                                       
     6535                                        /*retrieve inputs: */
     6536                                        GetParameterListOnVertices(&thickness_init[0],ThicknessEnum);
     6537                                        GetParameterListOnVertices(&thickness_coeff[0],ThicknessCoeffEnum);
     6538                                        GetParameterListOnVertices(&bed[0],BedEnum);
     6539                                        GetParameterListOnVertices(&surface[0],SurfaceEnum);
     6540
     6541                                        /*build new thickness: */
     6542//                                      for(j=0;j<6;j++)thickness[j]=values[j];
     6543
     6544                                        /*build new bed and surface: */
     6545                                        if (this->IsOnShelf()){
     6546                                                /*hydrostatic equilibrium: */
     6547                                                double rho_ice,rho_water,di;
     6548                                                rho_ice=this->matpar->GetRhoIce();
     6549                                                rho_water=this->matpar->GetRhoWater();
     6550
     6551                                                di=rho_ice/rho_water;
     6552
     6553                                                /*build new thickness: */
     6554                                                for (j=0; j<6; j++) {
     6555                                                /*  for observed/interpolated/hydrostatic thickness, remove scaling from any hydrostatic thickness  */
     6556                                                        if     (thickness_coeff[j] >= 0.)
     6557                                                                thickness[j]=values[j]-(values[j]/thickness_init[j]-1.)*thickness_coeff[j]*surface[j]/(1.-di);
     6558                                                /*  for minimum thickness, don't scale  */
     6559                                                        else
     6560                                                                thickness[j]=thickness_init[j];
     6561
     6562                                                /*  check the computed thickness and update bed  */
     6563                                                        if (thickness[j] < 0.)
     6564                                                                thickness[j]=1./(1.-di);
     6565                                                        bed[j]=surface[j]-thickness[j];
     6566                                                }
     6567
     6568//                                              for(j=0;j<6;j++){
     6569//                                                      surface[j]=(1-di)*thickness[j];
     6570//                                                      bed[j]=-di*thickness[j];
     6571//                                              }
     6572                                        }
     6573                                        else{
     6574                                                /*build new thickness: */
     6575                                                for (j=0; j<6; j++) {
     6576                                                /*  for observed thickness, use scaled value  */
     6577                                                        if     (thickness_coeff[j] >= 0.)
     6578                                                                thickness[j]=values[j];
     6579                                                /*  for minimum thickness, don't scale  */
     6580                                                        else
     6581                                                                thickness[j]=thickness_init[j];
     6582                                                }
     6583
     6584                                                /*update bed on grounded ice: */
     6585//                                              for(j=0;j<6;j++)surface[j]=bed[j]+thickness[j];
     6586                                                for(j=0;j<6;j++)bed[j]=surface[j]-thickness[j];
     6587                                        }
     6588
     6589                                        /*Add new inputs: */
     6590                                        this->inputs->AddInput(new PentaVertexInput(ThicknessEnum,thickness));
     6591                                        this->inputs->AddInput(new PentaVertexInput(BedEnum,bed));
     6592                                        this->inputs->AddInput(new PentaVertexInput(SurfaceEnum,surface));
     6593
     6594                                        /*}}}*/
     6595                                        break;
     6596                                default:
     6597                                        this->inputs->AddInput(new PentaVertexInput(name,values));
     6598                        }
     6599                        break;
     6600
     6601                default:
     6602                        _error_("type %i (%s) not implemented yet",type,EnumToStringx(type));
     6603        }
     6604
    65086605}
    65096606/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.