Changeset 5358


Ignore:
Timestamp:
08/18/10 10:13:49 (15 years ago)
Author:
Mathieu Morlighem
Message:

Control_type is now an enum and moved RheologyB2d to RheologyBbar

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r5286 r5358  
    221221        ResetPenaltiesEnum,
    222222        RheologyBEnum,
    223         RheologyB2dEnum,
     223        RheologyBbarEnum,
    224224        RheologyNEnum,
    225225        SegmentOnIceShelfEnum,
  • issm/trunk/src/c/EnumDefinitions/EnumToModelField.cpp

    r5329 r5358  
    1616                case DragCoefficientEnum : return "drag_coefficient";
    1717                case RheologyBEnum : return "rheology_B";
    18                 case RheologyB2dEnum : return "rheology_B";
     18                case RheologyBbarEnum : return "rheology_B";
    1919                default : ISSMERROR("No model field is associated to enum %s",EnumToString(en));
    2020        }
  • issm/trunk/src/c/EnumDefinitions/EnumToString.cpp

    r5286 r5358  
    195195                case ResetPenaltiesEnum : return "ResetPenalties";
    196196                case RheologyBEnum : return "RheologyB";
    197                 case RheologyB2dEnum : return "RheologyB2d";
     197                case RheologyBbarEnum : return "RheologyBbar";
    198198                case RheologyNEnum : return "RheologyN";
    199199                case SegmentOnIceShelfEnum : return "SegmentOnIceShelf";
  • issm/trunk/src/c/EnumDefinitions/StringToEnum.cpp

    r5286 r5358  
    193193        else if (strcmp(name,"ResetPenalties")==0) return ResetPenaltiesEnum;
    194194        else if (strcmp(name,"RheologyB")==0) return RheologyBEnum;
    195         else if (strcmp(name,"RheologyB2d")==0) return RheologyB2dEnum;
     195        else if (strcmp(name,"RheologyBbar")==0) return RheologyBbarEnum;
    196196        else if (strcmp(name,"RheologyN")==0) return RheologyNEnum;
    197197        else if (strcmp(name,"SegmentOnIceShelf")==0) return SegmentOnIceShelfEnum;
  • issm/trunk/src/c/modules/ModelProcessorx/Balancedthickness/UpdateElementsBalancedthickness.cpp

    r5251 r5358  
    3939                IoModelFetchData(&iomodel->thickness_obs,NULL,NULL,iomodel_handle,"thickness_obs");
    4040                IoModelFetchData(&iomodel->weights,NULL,NULL,iomodel_handle,"weights");
    41                 if(strcmp(iomodel->control_type,"dhdt")==0){
    42                         IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,iomodel->control_type); //copy the control parameter in iomodel
     41                if(iomodel->control_type==DhDtEnum){
     42                        IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel
    4343                }
    4444        }
  • issm/trunk/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp

    r5281 r5358  
    2626
    2727                /*What control type?*/
    28                 if (strcmp(iomodel->control_type,"drag_coefficient")==0){
    29                         parameters->AddObject(new IntParam(ControlTypeEnum,DragCoefficientEnum));
    30                 }
    31                 else  if (strcmp(iomodel->control_type,"rheology_B")==0){
    32                         parameters->AddObject(new IntParam(ControlTypeEnum,RheologyB2dEnum));
    33                 }
    34                 else  if (strcmp(iomodel->control_type,"dhdt")==0){
    35                         parameters->AddObject(new IntParam(ControlTypeEnum,DhDtEnum));
     28                if (iomodel->control_type!=DragCoefficientEnum && iomodel->control_type!=RheologyBbarEnum &&  iomodel->control_type!=DhDtEnum){
     29                        ISSMERROR("control_type %s not supported yet!",EnumToString(iomodel->control_type));
    3630                }
    3731                else{
    38                         ISSMERROR("control_type %s not supported yet!",iomodel->control_type);
     32                        parameters->AddObject(new IntParam(ControlTypeEnum,iomodel->control_type));
    3933                }
    4034
     
    7569                xfree((void**)&iomodel->maxiter);
    7670
    77                 IoModelFetchData(&control_parameter,NULL,NULL,iomodel_handle,iomodel->control_type);
     71                IoModelFetchData(&control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type));
    7872                parameters->AddObject(new DoubleVecParam(ControlParameterEnum,control_parameter,iomodel->nsteps));
    7973                xfree((void**)&control_parameter);
  • issm/trunk/src/c/modules/ModelProcessorx/CreateElementsVerticesAndMaterials.cpp

    r4967 r5358  
    4040        IoModelFetchData(&iomodel->rheology_B,NULL,NULL,iomodel_handle,"rheology_B");
    4141        IoModelFetchData(&iomodel->rheology_n,NULL,NULL,iomodel_handle,"rheology_n");
    42         if(iomodel->control_analysis && strcmp(iomodel->control_type,"rheology_B")==0){
    43                 IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,iomodel->control_type); //copy the control parameter in iomodel
     42        if(iomodel->control_analysis && iomodel->control_type==RheologyBbarEnum){
     43                IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel
    4444        }
    4545       
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/UpdateElementsDiagnosticHoriz.cpp

    r4967 r5358  
    4747                IoModelFetchData(&iomodel->vy_obs,NULL,NULL,iomodel_handle,"vy_obs");
    4848                IoModelFetchData(&iomodel->weights,NULL,NULL,iomodel_handle,"weights");
    49                 if(strcmp(iomodel->control_type,"drag_coefficient")==0){
    50                         IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,iomodel->control_type); //copy the control parameter in iomodel
     49                if(iomodel->control_type==DragCoefficientEnum){
     50                        IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel
    5151                }
    5252        }
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/UpdateElementsDiagnosticStokes.cpp

    r4967 r5358  
    4848                IoModelFetchData(&iomodel->vy_obs,NULL,NULL,iomodel_handle,"vy_obs");
    4949                IoModelFetchData(&iomodel->weights,NULL,NULL,iomodel_handle,"weights");
    50                 if(strcmp(iomodel->control_type,"drag_coefficient")==0){
    51                         IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,iomodel->control_type); //copy the control parameter in iomodel
     50                if(iomodel->control_type==DragCoefficientEnum){
     51                        IoModelFetchData(&iomodel->control_parameter,NULL,NULL,iomodel_handle,EnumToModelField(iomodel->control_type)); //copy the control parameter in iomodel
    5252                }
    5353        }
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r5322 r5358  
    716716
    717717                /*Depth Average B*/
    718                 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     718                this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum);
    719719
    720720                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
     
    723723
    724724                /*delete B average*/
    725                 this->matice->inputs->DeleteInput(RheologyB2dEnum);
     725                this->matice->inputs->DeleteInput(RheologyBbarEnum);
    726726
    727727                return J;
     
    731731                /*Depth Average B and put it in inputs*/
    732732                Penta* penta=GetBasalElement();
    733                 penta->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
    734                 Input* B_input=penta->matice->inputs->GetInput(RheologyB2dEnum);
     733                penta->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum);
     734                Input* B_input=penta->matice->inputs->GetInput(RheologyBbarEnum);
    735735                Input* B_copy=(Input*)B_input->copy();
    736736                this->matice->inputs->AddInput((Input*)B_copy);
     
    741741
    742742                /*delete B average*/
    743                 this->matice->inputs->DeleteInput(RheologyB2dEnum);
    744                 penta->matice->inputs->DeleteInput(RheologyB2dEnum);
     743                this->matice->inputs->DeleteInput(RheologyBbarEnum);
     744                penta->matice->inputs->DeleteInput(RheologyBbarEnum);
    745745
    746746                return J;
     
    10331033                GradjDrag(gradient);
    10341034        }
    1035         else if (control_type==RheologyB2dEnum){
     1035        else if (control_type==RheologyBbarEnum){
    10361036                GradjB(gradient);
    10371037        }
     
    10871087
    10881088        /*Rheology*/
    1089         if(control_type==RheologyB2dEnum){
     1089        if(control_type==RheologyBbarEnum){
    10901090
    10911091                /*The update is done by the element on bed only*/
     
    10971097
    10981098                /*Now, update using the gradient new = old + scalar * gradient*/
    1099                 //matice->inputs->AXPY(RheologyB2dEnum,scalar,GradientEnum);
     1099                //matice->inputs->AXPY(RheologyBbarEnum,scalar,GradientEnum);
    11001100                // For now: Gradient is in element (TO BE CHANGED) and parameter in matice
    11011101                Input* input_B   =(Input*)matice->inputs->GetInput(RheologyBEnum); ISSMASSERT(input_B);
     
    12681268
    12691269        /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
    1270         if (enum_type==RheologyB2dEnum){
     1270        if (enum_type==RheologyBbarEnum){
    12711271                input=this->matice->inputs->GetInput(RheologyBEnum);
    12721272        }
     
    26362636
    26372637                /*Depth Averaging B*/
    2638                 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     2638                this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum);
    26392639
    26402640                /*Call Tria function*/
     
    26442644
    26452645                /*Delete B averaged*/
    2646                 this->matice->inputs->DeleteInput(RheologyB2dEnum);
     2646                this->matice->inputs->DeleteInput(RheologyBbarEnum);
    26472647
    26482648                return;
     
    52645264
    52655265                /*Depth Average B*/
    5266                 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     5266                this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum);
    52675267
    52685268                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
     
    52715271
    52725272                /*delete B average*/
    5273                 this->matice->inputs->DeleteInput(RheologyB2dEnum);
     5273                this->matice->inputs->DeleteInput(RheologyBbarEnum);
    52745274        }
    52755275        else{
    5276                 /*Gradient is computed on bed only (B2d)*/
     5276                /*Gradient is computed on bed only (Bbar)*/
    52775277                if (!onbed) return;
    52785278
    52795279                /*Depth Average B*/
    5280                 this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     5280                this->InputDepthAverageAtBase(RheologyBEnum,RheologyBbarEnum,MaterialsEnum);
    52815281
    52825282                /*B is a 2d field, use MacAyeal(2d) gradient even if it is Stokes or Pattyn*/
     
    52865286
    52875287                /*delete B average*/
    5288                 this->matice->inputs->DeleteInput(RheologyB2dEnum);
     5288                this->matice->inputs->DeleteInput(RheologyBbarEnum);
    52895289        }
    52905290
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r5327 r5358  
    419419
    420420                        /*update input*/
    421                         if (name==RheologyB2dEnum || name==RheologyBEnum){
     421                        if (name==RheologyBbarEnum || name==RheologyBEnum){
    422422                                matice->inputs->AddInput(new TriaVertexInput(name,values));
    423423                        }
     
    709709                        }
    710710                }
    711                 else if (control_type==RheologyB2dEnum){
    712                         matice->inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyB2dEnum);
     711                else if (control_type==RheologyBbarEnum){
     712                        matice->inputs->GetParameterDerivativeValue(&dB[0], &xyz_list[0][0], &gauss_l1l2l3[0],RheologyBbarEnum);
    713713                        Jelem+=cm_noisedmp*1/2*(pow(dB[0],2)+pow(dB[1],2))*Jdet*gauss_weight;
    714714                }
     
    954954                GradjDrag(gradient);
    955955        }
    956         else if (control_type==RheologyB2dEnum){
     956        else if (control_type==RheologyBbarEnum){
    957957                GradjB(gradient);
    958958        }
     
    10501050        adjointx_input=inputs->GetInput(AdjointxEnum);
    10511051        adjointy_input=inputs->GetInput(AdjointyEnum);
    1052         rheologyb_input=matice->inputs->GetInput(RheologyB2dEnum);
     1052        rheologyb_input=matice->inputs->GetInput(RheologyBbarEnum);
    10531053
    10541054        /* Start  looping on the number of gaussian points: */
     
    13921392
    13931393        /*Rheology*/
    1394         if(control_type==RheologyB2dEnum){
     1394        if(control_type==RheologyBbarEnum){
    13951395
    13961396                /*First, get revert to previous parameter value (kept in ControlParameter input)*/
    1397                 matice->inputs->DuplicateInput(ControlParameterEnum,RheologyB2dEnum);
     1397                matice->inputs->DuplicateInput(ControlParameterEnum,RheologyBbarEnum);
    13981398
    13991399                /*Now, update using the gradient new = old + scalar * gradient*/
    1400                 //matice->inputs->AXPY(RheologyB2dEnum,scalar,GradientEnum);
     1400                //matice->inputs->AXPY(RheologyBbarEnum,scalar,GradientEnum);
    14011401                // For now: Gradient is in element (TO BE CHANGED) and parameter in matice
    1402                 Input* input_B   =(Input*)matice->inputs->GetInput(RheologyB2dEnum); ISSMASSERT(input_B);
     1402                Input* input_B   =(Input*)matice->inputs->GetInput(RheologyBbarEnum); ISSMASSERT(input_B);
    14031403                Input* input_Grad=(Input*)this->inputs->GetInput(GradientEnum); ISSMASSERT(input_Grad);
    14041404                input_B->AXPY(input_Grad,scalar);
    14051405
    14061406                /*Constrain constrain input*/
    1407                 input=(Input*)matice->inputs->GetInput(RheologyB2dEnum); ISSMASSERT(input);
     1407                input=(Input*)matice->inputs->GetInput(RheologyBbarEnum); ISSMASSERT(input);
    14081408                input->Constrain(cm_min,cm_max);
    14091409
    14101410                /*Finally: save input if requested*/
    1411                 if (save_parameter) matice->inputs->DuplicateInput(RheologyB2dEnum,ControlParameterEnum);
     1411                if (save_parameter) matice->inputs->DuplicateInput(RheologyBbarEnum,ControlParameterEnum);
    14121412
    14131413        }
     
    15421542
    15431543        /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
    1544         if (enum_type==RheologyB2dEnum){
     1544        if (enum_type==RheologyBbarEnum){
    15451545                input=this->matice->inputs->GetInput(enum_type);
    15461546        }
     
    55335533        gravity=matpar->GetG();
    55345534        n=matice->GetN();
    5535         B=matice->GetB2d();
     5535        B=matice->GetBbar();
    55365536
    55375537        /* Get slopes and thickness */
  • issm/trunk/src/c/objects/IoModel.cpp

    r5281 r5358  
    100100        xfree((void**)&this->riftinfo);
    101101        xfree((void**)&this->penalties);
    102         xfree((void**)&this->control_type);
    103102        xfree((void**)&this->control_parameter);
    104103       
     
    297296        this->rheology_n=NULL;
    298297        this->rheology_B=NULL;
    299 
    300         /*!control methods: */
    301         this->control_type=NULL;
    302298
    303299        /*!solution parameters: */
  • issm/trunk/src/c/objects/IoModel.h

    r5281 r5358  
    125125
    126126                /*control methods: */
    127                 char*   control_type;
     127                int      control_type;
    128128                double* control_parameter;
    129129
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r5320 r5358  
    4747                if (iomodel->rheology_B) {
    4848                        for(i=0;i<num_vertices;i++) nodeinputs[i]=iomodel->rheology_B[int(iomodel->elements[num_vertices*index+i]-1)];
    49                         this->inputs->AddInput(new TriaVertexInput(RheologyB2dEnum,nodeinputs));
     49                        this->inputs->AddInput(new TriaVertexInput(RheologyBbarEnum,nodeinputs));
    5050                }
    5151
     
    257257}
    258258/*}}}*/
    259 /*FUNCTION Matice::GetB2d {{{1*/
    260 double Matice::GetB2d(){
     259/*FUNCTION Matice::GetBbar {{{1*/
     260double Matice::GetBbar(){
    261261
    262262        /*Output*/
    263         double B2d;
    264 
    265         inputs->GetParameterAverage(&B2d,RheologyB2dEnum);
    266         return B2d;
     263        double Bbar;
     264
     265        inputs->GetParameterAverage(&Bbar,RheologyBbarEnum);
     266        return Bbar;
    267267}
    268268/*}}}*/
     
    302302
    303303        /*Get B and n*/
    304         B=GetB2d();
     304        B=GetBbar();
    305305        n=GetN();
    306306
     
    507507
    508508        /*Get B and n*/
    509         B=GetB2d();
     509        B=GetBbar();
    510510        n=GetN();
    511511
     
    652652        if (
    653653                                name==RheologyBEnum ||
    654                                 name==RheologyB2dEnum ||
     654                                name==RheologyBbarEnum ||
    655655                                name==RheologyNEnum ||
    656656                                name==ControlParameterEnum
  • issm/trunk/src/c/objects/Materials/Matice.h

    r5320 r5358  
    6464                void   GetViscosityComplement(double* pviscosity_complement, double* pepsilon);
    6565                double GetB();
    66                 double GetB2d();
     66                double GetBbar();
    6767                double GetN();
    6868                bool   IsInput(int name);
Note: See TracChangeset for help on using the changeset viewer.