Changeset 10377 for issm/trunk


Ignore:
Timestamp:
10/31/11 14:39:39 (13 years ago)
Author:
seroussi
Message:

removed shelf sync

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r10376 r10377  
    1313void GroundinglineMigrationx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters){
    1414
    15         int      i, migration_style;
     15        int      i, migration_style,analysis_type;
    1616        double*  vertices_potentially_ungrounding = NULL;
    1717        double*  vertices_ungrounding             = NULL;
     18        double*  old_floatingice                  = NULL;
    1819        Element* element                          = NULL;
    1920       
     
    2223        /*retrieve parameters: */
    2324        parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
     25        parameters->FindParam(&analysis_type,AnalysisTypeEnum);
     26
    2427        if(migration_style==NoneEnum) return;
    2528        if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error_("%s not supported yet!",EnumToStringx(migration_style));
     
    3336        }
    3437
     38        /*Create vector with vertices initially floating*/
     39        old_floatingice=CreateNodesOnIceShelf(nodes,analysis_type);
     40
    3541        /*Migrate grounding line : */
    3642        for(i=0;i<elements->Size();i++){
    3743                element=(Element*)elements->GetObjectByOffset(i);
    38                 element->MigrateGroundingLine(vertices_ungrounding);
    39         }
    40 
    41         /*Synchronise mask: */
    42         for(i=0;i<elements->Size();i++){
    43                 element=(Element*)elements->GetObjectByOffset(i);
    44                 element->ShelfSync();
     44                element->MigrateGroundingLine(old_floatingice,vertices_ungrounding);
    4545        }
    4646
     
    4848        xfree((void**)&vertices_potentially_ungrounding);
    4949        xfree((void**)&vertices_ungrounding);
     50        xfree((void**)&old_floatingice);
    5051}
    5152/*FUNCTION PotentialSheetUngrounding {{{1*/
     
    6768        }
    6869
    69         /*Assemble vector: */
     70        /*Assemble vector and serialize */
    7071        VecAssemblyBegin(vec_vertices_potentially_ungrounding);
    7172        VecAssemblyEnd(vec_vertices_potentially_ungrounding);
    72 
    73         /*Serialize vector: */
    7473        VecToMPISerial(&vertices_potentially_ungrounding,vec_vertices_potentially_ungrounding);
    7574
     
    162161}
    163162/*}}}*/
     163/*FUNCTION CreateNodesOnIceShelf {{{1*/
     164double* CreateNodesOnIceShelf(Nodes* nodes,int configuration_type){
     165
     166        int     i,numnods;
     167        double* nodes_on_floatingice  = NULL;
     168        Vec     vec_nodes_on_iceshelf = NULL;
     169        Node*   node                  = NULL;
     170
     171        /*First, initialize nodes_on_iceshelf, which will track which nodes have changed status: */
     172        numnods=nodes->NumberOfNodes(configuration_type);
     173        vec_nodes_on_iceshelf=NewVec(numnods);
     174
     175        /*Loop through nodes, and fill vec_nodes_on_iceshelf: */
     176        for(i=0;i<nodes->Size();i++){
     177                node=(Node*)nodes->GetObjectByOffset(i);
     178                if(node->InAnalysis(configuration_type)){
     179                        if(node->IsFloating()){
     180                                VecSetValue(vec_nodes_on_iceshelf,node->Sid(),1.0,INSERT_VALUES);
     181                        }
     182                }
     183        }
     184
     185        /*Assemble vector: */
     186        VecAssemblyBegin(vec_nodes_on_iceshelf);
     187        VecAssemblyEnd(vec_nodes_on_iceshelf);
     188        VecToMPISerial(&nodes_on_floatingice,vec_nodes_on_iceshelf);
     189
     190        /*Free ressources*/
     191        VecFree(&vec_nodes_on_iceshelf);
     192
     193        return nodes_on_floatingice;
     194}
     195/*%}}}*/
  • issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.h

    r10376 r10377  
    1515double*    PotentialSheetUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters);
    1616double*    PropagateFloatingiceToGrounded(Elements* elements,Nodes* nodes,Vertices* vertices,Parameters* parameters,double* vertices_potentially_ungrounding);
     17double*    CreateNodesOnIceShelf(Nodes* nodes,int configuration_type);
    1718#endif  /* _GROUNDINGLINEMIGRATIONX_H */
  • issm/trunk/src/c/objects/Elements/Element.h

    r10376 r10377  
    6565                virtual int*   GetHorizontalNeighboorSids(void)=0;
    6666                virtual double TimeAdapt()=0;
    67                 virtual void   MigrateGroundingLine(double* sheet_ungrounding)=0;
    68                 virtual void   ShelfSync()=0;
     67                virtual void   MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding)=0;
    6968                virtual void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding)=0;
    7069                virtual int    UpdatePotentialSheetUngrounding(double* potential_sheet_ungrounding,Vec vec_nodes_on_iceshelf,double* nodes_on_iceshelf)=0;
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r10376 r10377  
    304304void  Penta::AverageOntoPartition(Vec partition_contributions,Vec partition_areas,double* vertex_response,double* qmu_part){
    305305        _error_("Not supported yet!");
    306 }
    307 /*}}}*/
    308 /*FUNCTION Penta::ShelfSync{{{1*/
    309 void  Penta::ShelfSync(void){
    310         _error_("not supported yet!");
    311306}
    312307/*}}}*/
     
    20422037}/*}}}*/
    20432038/*FUNCTION Penta::MigrateGroundingLine{{{1*/
    2044 void  Penta::MigrateGroundingLine(double* sheet_ungrounding){
     2039void  Penta::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){
    20452040        _error_("not supported yet!");
    20462041}
  • issm/trunk/src/c/objects/Elements/Penta.h

    r10376 r10377  
    103103               
    104104                void   InputToResult(int enum_type,int step,double time);
    105                 void   MigrateGroundingLine(double* sheet_ungrounding);
     105                void   MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding);
    106106                void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
    107                 void   ShelfSync();
    108107                void   RequestedOutput(int output_enum,int step,double time);
    109108                void   ListResultsEnums(int** results_enums,int* num_results);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r10376 r10377  
    19231923}/*}}}*/
    19241924/*FUNCTION Tria::MigrateGroundingLine{{{1*/
    1925 void  Tria::MigrateGroundingLine(double* sheet_ungrounding){
     1925void  Tria::MigrateGroundingLine(double* old_floating_ice,double* sheet_ungrounding){
    19261926
    19271927        int     i,migration_style,unground;
    19281928        bool    elementonshelf = false;
    1929         double  bed_hydro;
     1929        double  bed_hydro,yts,gl_melting_rate;
    19301930        double  rho_water,rho_ice,density;
     1931        double  melting[NUMVERTICES];
    19311932        double  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
    19321933
    19331934        /*Recover info at the vertices: */
    19341935        parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
     1936        parameters->FindParam(&yts,ConstantsYtsEnum);
    19351937        GetInputListOnVertices(&h[0],ThicknessEnum);
    19361938        GetInputListOnVertices(&s[0],SurfaceEnum);
     
    19441946        for(i=0;i<NUMVERTICES;i++){
    19451947                /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
    1946                 if (nodes[i]->IsFloating()){
     1948                if(old_floating_ice[nodes[i]->Sid()]){
    19471949                        if(b[i]<=ba[i]){
    19481950                                b[i]=ba[i];
    19491951                                s[i]=b[i]+h[i];
     1952                                nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false));
     1953                                nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true));
    19501954                        }
    19511955                }
     
    19591963                                        s[i]=(1-density)*h[i];
    19601964                                        b[i]=-density*h[i];
     1965                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
     1966                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
    19611967                                }
    19621968                                else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){
    19631969                                        s[i]=(1-density)*h[i];
    19641970                                        b[i]=-density*h[i];
     1971                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
     1972                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
    19651973                                }
    19661974                        }
    19671975                }
    19681976        }
     1977
     1978        /*If at least one vertex is now floating, the element is now floating*/
     1979        for(i=0;i<NUMVERTICES;i++){
     1980                if(nodes[i]->IsFloating()){
     1981                        elementonshelf=true;
     1982                        break;
     1983                }
     1984        }
     1985       
     1986   /*Add basal melting rate if element just ungrounded*/
     1987        if(!this->IsFloating() && elementonshelf==true){
     1988                for(i=0;i<NUMVERTICES;i++)melting[i]=gl_melting_rate/yts;
     1989                this->inputs->AddInput(new TriaVertexInput(BasalforcingsMeltingRateEnum,&melting[0]));
     1990        }
     1991
     1992        /*Update inputs*/
     1993   this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf));
    19691994
    19701995        /*Update inputs*/   
     
    21082133        else this->nodes=NULL;
    21092134
    2110 }
    2111 /*}}}*/
    2112 /*FUNCTION Tria::ShelfSync{{{1*/
    2113 void  Tria::ShelfSync(void){
    2114 
    2115         int     i;
    2116         bool    elementonshelf = false;
    2117         double  bed_hydro,gl_melting_rate;
    2118         double  yts,rho_water,rho_ice,density;
    2119         double  melting[NUMVERTICES];
    2120         double  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
    2121 
    2122         /*recover parameters: */
    2123         parameters->FindParam(&yts,ConstantsYtsEnum);
    2124         parameters->FindParam(&gl_melting_rate,GroundinglineMeltingRateEnum);
    2125         rho_water=matpar->GetRhoWater();
    2126         rho_ice=matpar->GetRhoIce();
    2127         density=rho_ice/rho_water;
    2128 
    2129         /*Recover info at the vertices: */
    2130         GetInputListOnVertices(&h[0],ThicknessEnum);
    2131         GetInputListOnVertices(&s[0],SurfaceEnum);
    2132         GetInputListOnVertices(&b[0],BedEnum);
    2133         GetInputListOnVertices(&ba[0],BathymetryEnum);
    2134 
    2135         /*go through vertices, and update inputs, considering them to be TriaVertex type: */
    2136         for(i=0;i<NUMVERTICES;i++){
    2137                 if(b[i]==ba[i]){
    2138                         nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,false));
    2139                         nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,true));
    2140                 }
    2141                 else{
    2142                         nodes[i]->inputs->AddInput(new BoolInput(MaskVertexonfloatingiceEnum,true));
    2143                         nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
    2144                 }
    2145         }
    2146 
    2147         /*If at least one vertex is now floating, the element is an iceshelf*/
    2148         for(i=0;i<NUMVERTICES;i++){
    2149                 if(nodes[i]->IsFloating()){
    2150                         elementonshelf=true;
    2151                         break;
    2152                 }
    2153         }
    2154        
    2155    /*Add basal melting rate if element just ungrounded*/
    2156         if(!this->IsFloating() && elementonshelf==true){
    2157                 for(i=0;i<NUMVERTICES;i++)melting[i]=gl_melting_rate/yts;
    2158                 this->inputs->AddInput(new TriaVertexInput(BasalforcingsMeltingRateEnum,&melting[0]));
    2159         }
    2160 
    2161         /*Update inputs*/
    2162    this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf));
    21632135}
    21642136/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r10376 r10377  
    102102                void   DeleteResults(void);
    103103                void   MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
    104                 void   MigrateGroundingLine(double* sheet_ungrounding);
    105                 void   ShelfSync();
     104                void   MigrateGroundingLine(double* oldfloating,double* sheet_ungrounding);
    106105                void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
    107106                void   RequestedOutput(int output_enum,int step,double time);
Note: See TracChangeset for help on using the changeset viewer.