Changeset 4978


Ignore:
Timestamp:
08/04/10 12:09:21 (15 years ago)
Author:
Mathieu Morlighem
Message:

Enable CM RheologyB2d in 3d, still some work to do

Location:
issm/trunk/src
Files:
1 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/EnumDefinitions/EnumAsString.cpp

    r4971 r4978  
    268268                case EpsRelEnum : return "EpsRel";
    269269                case EpsResEnum : return "EpsRes";
    270                 case ExtrudeParamEnum : return "ExtrudeParam";
    271270                case HeatCapacityEnum : return "HeatCapacity";
    272271                case IsHutterEnum : return "IsHutter";
  • issm/trunk/src/c/EnumDefinitions/EnumDefinitions.h

    r4971 r4978  
    305305        EpsRelEnum,
    306306        EpsResEnum,
    307         ExtrudeParamEnum,
    308307        HeatCapacityEnum,
    309308        IsHutterEnum,
  • issm/trunk/src/c/EnumDefinitions/StringAsEnum.cpp

    r4971 r4978  
    266266        else if (strcmp(name,"EpsRel")==0) return EpsRelEnum;
    267267        else if (strcmp(name,"EpsRes")==0) return EpsResEnum;
    268         else if (strcmp(name,"ExtrudeParam")==0) return ExtrudeParamEnum;
    269268        else if (strcmp(name,"HeatCapacity")==0) return HeatCapacityEnum;
    270269        else if (strcmp(name,"IsHutter")==0) return IsHutterEnum;
  • issm/trunk/src/c/modules/ModelProcessorx/Control/CreateParametersControl.cpp

    r4934 r4978  
    2626
    2727                if (strcmp(iomodel->control_type,"drag_coefficient")==0){
    28                         parameters->AddObject(new BoolParam(ExtrudeParamEnum,false));
    2928                        parameters->AddObject(new IntParam(ControlTypeEnum,DragCoefficientEnum));
    3029                }
    3130                else  if (strcmp(iomodel->control_type,"rheology_B")==0){
    32                         parameters->AddObject(new BoolParam(ExtrudeParamEnum,true));
    3331                        parameters->AddObject(new IntParam(ControlTypeEnum,RheologyB2dEnum));
    3432                }
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r4974 r4978  
    697697                /*This element should be collapsed into a tria element at its base. Create this tria element,
    698698                 * and compute CostFunction*/
     699
     700                /*Depth Average B*/
     701                this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     702
    699703                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
    700704                J=tria->CostFunction(process_units);
    701705                delete tria;
     706
     707                /*delete B average*/
     708                this->matice->inputs->DeleteInput(RheologyB2dEnum);
     709
    702710                return J;
    703711        }
    704712        else{
     713
     714                /*Depth Average B*/
     715                this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
    705716
    706717                tria=(Tria*)SpawnTria(3,4,5); //grids 3, 4 and 5 make the new tria (upper face).
    707718                J=tria->CostFunction(process_units);
    708719                delete tria;
     720
     721                /*delete B average*/
     722                this->matice->inputs->DeleteInput(RheologyB2dEnum);
     723
    709724                return J;
    710725        }
     
    9941009        double cm_min,cm_max;
    9951010        int    control_type;
     1011        bool   onbed;
    9961012
    9971013        /*retrieve some parameters: */
     
    10001016        this->parameters->FindParam(&control_type,ControlTypeEnum);
    10011017
    1002 
    10031018        /*Rheology*/
    10041019        if(control_type==RheologyB2dEnum){
     1020
     1021                /*The update is done by the element on bed only*/
     1022                inputs->GetParameterValue(&onbed,ElementOnBedEnum);
     1023                if (!onbed) return;
    10051024
    10061025                /*First, get revert to previous parameter value (kept in ControlParameter input)*/
     
    10181037                input->Constrain(cm_min,cm_max);
    10191038
     1039                /*OK, now we can propagate the new parameter up*/
     1040                this->InputExtrude(RheologyBEnum,MaterialsEnum);
     1041
    10201042                /*Finally: save input if requested*/
    1021                 if (save_parameter) matice->inputs->DuplicateInput(RheologyBEnum,ControlParameterEnum);
     1043                if (save_parameter){
     1044                        matice->inputs->DuplicateInput(RheologyBEnum,ControlParameterEnum);
     1045                        this->InputExtrude(ControlParameterEnum,MaterialsEnum);
     1046                }
    10221047
    10231048        }
     
    11741199        /*Go through all the input objects, and find the one corresponding to enum_type, if it exists: */
    11751200        if (enum_type==RheologyB2dEnum){
    1176                 input=this->matice->inputs->GetInput(enum_type);
     1201                input=this->matice->inputs->GetInput(RheologyBEnum);
    11771202        }
    11781203        else{
     
    46714696                /*This element should be collapsed into a tria element at its base. Create this tria element,
    46724697                 * and compute gardj*/
     4698
     4699                /*Depth Average B*/
     4700                this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     4701
    46734702                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
    46744703                tria->GradjB(gradient);
    46754704                delete tria;
     4705
     4706                /*delete B average*/
     4707                this->matice->inputs->DeleteInput(RheologyB2dEnum);
    46764708        }
    46774709        else{
     4710                /*Depth Average B*/
     4711                this->InputDepthAverageAtBase(RheologyBEnum,RheologyB2dEnum,MaterialsEnum);
     4712
    46784713                /*B is a 2d field, use MacAyeal(2d) gradient even if it is Stokes or Pattyn*/
    46794714                tria=(Tria*)SpawnTria(0,1,2); //grids 0, 1 and 2 make the new tria (lower face).
    46804715                tria->GradjB(gradient);
    46814716                delete tria;
    4682         }
    4683 
     4717
     4718                /*delete B average*/
     4719                this->matice->inputs->DeleteInput(RheologyB2dEnum);
     4720        }
    46844721
    46854722}
     
    47364773/*}}}*/
    47374774/*FUNCTION Penta::InputExtrude {{{1*/
    4738 void  Penta::InputExtrude(int enum_type,bool only_if_collapsed){
    4739 
    4740         bool   onbed,collapse=false;
     4775void  Penta::InputExtrude(int enum_type,int object_type){
     4776
     4777        bool   onbed;
    47414778        Penta *penta          = NULL;
    47424779        Input *original_input = NULL;
    47434780
    47444781        /*recover parameters: */
    4745         if (only_if_collapsed) inputs->GetParameterValue(&collapse,CollapseEnum);
    47464782        inputs->GetParameterValue(&onbed,ElementOnBedEnum);
    4747 
    4748         /*First: if only_if_collapsed, check wether this penta is collapsed*/
    4749         if (only_if_collapsed && !collapse) return;
    47504783
    47514784        /*Are we on the base, not on the surface?:*/
     
    47584791
    47594792                /*Step1: Extrude the original input: */
    4760                 original_input=(Input*)this->inputs->GetInput(enum_type);
     4793                if (object_type==ElementsEnum)
     4794                 original_input=(Input*)this->inputs->GetInput(enum_type);
     4795                else if (object_type==MaterialsEnum)
     4796                 original_input=(Input*)matice->inputs->GetInput(enum_type);
     4797                else
     4798                 ISSMERROR("object of type %s not supported yet",EnumAsString(object_type));
    47614799                if(!original_input) ISSMERROR("%s%s"," could not find input with enum:",EnumAsString(enum_type));
    47624800                original_input->Extrude();
     
    47764814                        Input* copy=NULL;
    47774815                        copy=(Input*)original_input->copy();
    4778                         penta->inputs->AddInput((Input*)copy);
     4816                        if (object_type==ElementsEnum)
     4817                         penta->inputs->AddInput((Input*)copy);
     4818                        else if (object_type==MaterialsEnum)
     4819                         penta->matice->inputs->AddInput((Input*)copy);
     4820                        else
     4821                         ISSMERROR("object of type %s not supported yet",EnumAsString(object_type));
    47794822
    47804823                        /*Stop if we have reached the surface*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r4974 r4978  
    156156                void    GetStrainRate3d(double* epsilon,double* xyz_list, double* gauss, Input* vx_input, Input* vy_input, Input* vz_input);
    157157                Penta*  GetUpperElement(void);
    158                 void      InputExtrude(int enum_type,bool only_if_collapsed);
     158                void      InputExtrude(int enum_type,int object_type);
    159159                void    InputUpdateFromSolutionAdjointHoriz( double* solutiong);
    160160                void    InputUpdateFromSolutionAdjointStokes( double* solutiong);
  • issm/trunk/src/c/objects/Materials/Matice.cpp

    r4967 r4978  
    547547
    548548        /*Call inputs method*/
    549         printf("%s\n",EnumAsString(original_enum));
    550549        if (IsInput(original_enum)) inputs->DuplicateInput(original_enum,new_enum);
    551550
Note: See TracChangeset for help on using the changeset viewer.