Changeset 10355


Ignore:
Timestamp:
10/28/11 16:46:03 (13 years ago)
Author:
seroussi
Message:

merged soft and agressive migration

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Container/Vertices.cpp

    r9320 r10355  
    155155int Vertices::NumberOfVertices(void){
    156156
    157         int i;
    158 
     157        int i,sid;
    159158        int max_sid=0;
    160         int sid;
    161159        int vertex_max_sid;
    162160
    163161        for(i=0;i<this->Size();i++){
    164                
    165162                Vertex* vertex=(Vertex*)this->GetObjectByOffset(i);
    166163                sid=vertex->Sid();
  • issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r10354 r10355  
    1414void GroundinglineMigrationx(Elements* elements,Nodes* nodes, Vertices* vertices,Loads* loads,Materials* materials, Parameters* parameters){
    1515
    16         int i, migration_style;
    17         Element* element=NULL;
     16        int      i, migration_style;
     17        double*  vertices_potentially_ungrounding = NULL;
     18        double*  sheet_ungrounding                = NULL;
     19        Element* element                          = NULL;
    1820       
    1921        _printf_(VerboseModule(),"   Migrating grounding line\n");
     
    2123        /*retrieve parameters: */
    2224        parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
     25        if(migration_style==NoneEnum) return;
     26        if(migration_style!=AgressiveMigrationEnum && migration_style!=SoftMigrationEnum) _error_("%s not supported yet!",EnumToStringx(migration_style));
    2327
    24         /*call different migration modules, according to user wishes: */
    25         if(migration_style==AgressiveMigrationEnum){
    26                 /*Migrate grounding line : */
    27                 for(i=0;i<elements->Size();i++){
    28                         element=(Element*)elements->GetObjectByOffset(i);
    29                         element->AgressiveMigration();
    30                 }
    31 
    32                 /*Synchronise mask: */
    33                 for(i=0;i<elements->Size();i++){
    34                         element=(Element*)elements->GetObjectByOffset(i);
    35                         element->ShelfSync();
    36                 }
    37         }
    38         else if(migration_style==SoftMigrationEnum){
    39 
     28        if(migration_style==SoftMigrationEnum){
    4029                /*Create flag for nodes above the hydrostatic equilibrium: */
    41                 double* vertices_potentially_ungrounding=PotentialSheetUngrounding(elements,vertices,parameters);
     30                vertices_potentially_ungrounding=PotentialSheetUngrounding(elements,vertices,parameters);
    4231
    4332                /*propagate ice shelf into connex areas of the ice sheet that potentially want to unground: */
    44                 double* sheet_ungrounding=PropagateShelfIntoConnexIceSheet(elements,nodes,parameters,vertices_potentially_ungrounding);
     33                sheet_ungrounding=PropagateShelfIntoConnexIceSheet(elements,nodes,parameters,vertices_potentially_ungrounding);
     34        }
    4535
    46                 /*Now, use the sheet_ungrounding flags to unground the ice sheet (at the same time, take care of grounding elements of the ice shelf
    47                  * that want to: */
    48                 for(i=0;i<elements->Size();i++){
    49                         element=(Element*)elements->GetObjectByOffset(i);
    50                         element->SoftMigration(sheet_ungrounding);
    51                 }
     36        /*Migrate grounding line : */
     37        for(i=0;i<elements->Size();i++){
     38                element=(Element*)elements->GetObjectByOffset(i);
     39                element->Migration(sheet_ungrounding);
     40        }
    5241
    53                 /*Synchronise mask*/
    54                 for(i=0;i<elements->Size();i++){
    55                         element=(Element*)elements->GetObjectByOffset(i);
    56                         element->ShelfSync();
    57                 }
     42        /*Synchronise mask: */
     43        for(i=0;i<elements->Size();i++){
     44                element=(Element*)elements->GetObjectByOffset(i);
     45                element->ShelfSync();
     46        }
    5847
    59                 /*free ressouces: */
    60                 xfree((void**)&vertices_potentially_ungrounding);
    61                 xfree((void**)&sheet_ungrounding);
    62         }
    63         else if(migration_style==NoneEnum) _printf_(true,"%s\n","NoneEnum supplied for migration style, doing nothing!");
    64         else _error_("%s not supported yet!",EnumToStringx(migration_style));
     48        /*free ressouces: */
     49        xfree((void**)&vertices_potentially_ungrounding);
     50        xfree((void**)&sheet_ungrounding);
    6551}
  • issm/trunk/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationxUtils.cpp

    r10354 r10355  
    1616        int      i,numberofvertices;
    1717        double*  vertices_potentially_ungrounding      = NULL;
    18         Vec      vec_vertices_potentially_ungrounding = NULL;
     18        Vec      vec_vertices_potentially_ungrounding  = NULL;
    1919        Element* element                               = NULL;
    2020
  • issm/trunk/src/c/objects/Elements/Element.h

    r10298 r10355  
    6565                virtual int*   GetHorizontalNeighboorSids(void)=0;
    6666                virtual double TimeAdapt()=0;
    67                 virtual void   AgressiveMigration()=0;
    68                 virtual void   SoftMigration(double* sheet_ungrounding)=0;
     67                virtual void   Migration(double* sheet_ungrounding)=0;
    6968                virtual void   ShelfSync()=0;
    7069                virtual void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding)=0;
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r10298 r10355  
    306306}
    307307/*}}}*/
    308 /*FUNCTION Penta::AgressiveMigration{{{1*/
    309 void  Penta::AgressiveMigration(void){
    310         _error_("not supported yet!");
    311 }
    312 /*}}}*/
    313 /*FUNCTION Penta::SoftMigration{{{1*/
    314 void  Penta::SoftMigration(double* sheet_ungrounding){
     308/*FUNCTION Penta::Migration{{{1*/
     309void  Penta::Migration(double* sheet_ungrounding){
    315310        _error_("not supported yet!");
    316311}
  • issm/trunk/src/c/objects/Elements/Penta.h

    r10298 r10355  
    103103               
    104104                void   InputToResult(int enum_type,int step,double time);
    105                 void   AgressiveMigration();
    106                 void   SoftMigration(double* sheet_ungrounding);
     105                void   Migration(double* sheet_ungrounding);
    107106                void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
    108107                void   ShelfSync();
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r10321 r10355  
    278278
    279279/*Other*/
    280 /*FUNCTION Tria::AgressiveMigration{{{1*/
    281 void  Tria::AgressiveMigration(void){
    282 
    283         int     i;
    284         bool    elementonshelf = false;
    285         double  bed_hydro;
    286         double  rho_water,rho_ice,density;
    287         double  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
    288 
    289         /*vertices and material parameters: */
    290         GetInputListOnVertices(&h[0],ThicknessEnum);
    291         GetInputListOnVertices(&s[0],SurfaceEnum);
    292         GetInputListOnVertices(&b[0],BedEnum);
    293         GetInputListOnVertices(&ba[0],BathymetryEnum);
    294         rho_water=matpar->GetRhoWater();
    295         rho_ice=matpar->GetRhoIce();
    296         density=rho_ice/rho_water;
    297 
    298         /*go through vertices, and update inputs, considering them to be TriaVertex type: */
    299         for(i=0;i<NUMVERTICES;i++){
    300                 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
    301                 if (nodes[i]->IsFloating()){
    302                         if(b[i]<=ba[i]){
    303                                 b[i]=ba[i];
    304                                 s[i]=b[i]+h[i];
    305                         }
    306                 }
    307                 /*Ice sheet: if hydrostatic bed above bathymetry, the ice sheet start to unground, elso do nothing */
    308                 else{
    309                         bed_hydro=-density*h[i];
    310                         if (bed_hydro>ba[i]){
    311                                 s[i]=(1-density)*h[i];
    312                                 b[i]=-density*h[i];
    313                         }
    314                 }
    315         }
    316 
    317         /*Update inputs*/
    318         this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,&s[0]));
    319         this->inputs->AddInput(new TriaVertexInput(BedEnum,&b[0]));
    320         }
    321 /*}}}*/
    322280/*FUNCTION Tria::AverageOntoPartition {{{1*/
    323281void  Tria::AverageOntoPartition(Vec partition_contributions,Vec partition_areas,double* vertex_response,double* qmu_part){
     
    19641922
    19651923}/*}}}*/
     1924/*FUNCTION Tria::Migration{{{1*/
     1925void  Tria::Migration(double* sheet_ungrounding){
     1926
     1927        int     i,migration_style,unground;
     1928        bool    elementonshelf = false;
     1929        double  bed_hydro;
     1930        double  rho_water,rho_ice,density;
     1931        double  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
     1932
     1933        /*Recover info at the vertices: */
     1934        parameters->FindParam(&migration_style,GroundinglineMigrationEnum);
     1935        GetInputListOnVertices(&h[0],ThicknessEnum);
     1936        GetInputListOnVertices(&s[0],SurfaceEnum);
     1937        GetInputListOnVertices(&b[0],BedEnum);
     1938        GetInputListOnVertices(&ba[0],BathymetryEnum);
     1939        rho_water=matpar->GetRhoWater();
     1940        rho_ice=matpar->GetRhoIce();
     1941        density=rho_ice/rho_water;
     1942       
     1943        /*go through vertices, and update inputs, considering them to be TriaVertex type: */
     1944        for(i=0;i<NUMVERTICES;i++){
     1945                /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
     1946                if (nodes[i]->IsFloating()){
     1947                        if(b[i]<=ba[i]){
     1948                                b[i]=ba[i];
     1949                                s[i]=b[i]+h[i];
     1950                        }
     1951                }
     1952                /*Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing */
     1953                /*Change only if AgressiveMigration or if the ice sheet is in contact with the ocean*/
     1954                else{
     1955                        bed_hydro=-density*h[i];
     1956                        if (bed_hydro>ba[i]){
     1957                                /*Unground only if the element is connected to the ice shelf*/
     1958                                if(migration_style==AgressiveMigrationEnum){
     1959                                        s[i]=(1-density)*h[i];
     1960                                        b[i]=-density*h[i];
     1961                                }
     1962                                else if(migration_style==SoftMigrationEnum && sheet_ungrounding[nodes[i]->Sid()]){
     1963                                        s[i]=(1-density)*h[i];
     1964                                        b[i]=-density*h[i];
     1965                                }
     1966                        }
     1967                }
     1968        }
     1969
     1970        /*Update inputs*/   
     1971        this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,&s[0]));
     1972        this->inputs->AddInput(new TriaVertexInput(BedEnum,&b[0]));
     1973}
     1974/*}}}*/
    19661975/*FUNCTION Tria::MigrateGroundingline{{{1*/
    19671976void  Tria::MigrateGroundingline(void){
     
    20852094void  Tria::PotentialSheetUngrounding(Vec potential_sheet_ungrounding){
    20862095
    2087 
    2088         double *values         = NULL;
    2089         double  h[3],s[3],b[3],ba[3];
     2096        int     i;
     2097        double  h[NUMVERTICES],ba[NUMVERTICES];
    20902098        double  bed_hydro;
    20912099        double  rho_water,rho_ice,density;
    2092         int     i;
    20932100        bool    elementonshelf = false;
    2094 
    2095         /*Recover info at the vertices: */
    2096         Input* surface_input =inputs->GetInput(SurfaceEnum); _assert_(surface_input);
    2097         Input* bed_input     =inputs->GetInput(BedEnum);     _assert_(bed_input);
    2098         if((surface_input->ObjectEnum()!=TriaVertexInputEnum) | (bed_input->ObjectEnum()!=TriaVertexInputEnum))_error_(" not supported yet for bed and surface interpolations not P1!");
    2099 
    2100         GetInputListOnVertices(&h[0],ThicknessEnum);
    2101         GetInputListOnVertices(&s[0],SurfaceEnum);
    2102         GetInputListOnVertices(&b[0],BedEnum);
    2103         GetInputListOnVertices(&ba[0],BathymetryEnum);
    21042101
    21052102        /*material parameters: */
     
    21072104        rho_ice=matpar->GetRhoIce();
    21082105        density=rho_ice/rho_water;
     2106        GetInputListOnVertices(&h[0],ThicknessEnum);
     2107        GetInputListOnVertices(&ba[0],BathymetryEnum);
    21092108
    21102109        /*go through vertices, and figure out which ones are on the ice sheet, and want to unground: */
    2111         for(i=0;i<3;i++){
     2110        for(i=0;i<NUMVERTICES;i++){
     2111                /*Find if grounded vertices want to start floating*/
    21122112                if (!nodes[i]->IsFloating()){
    2113                        
    2114                         /*This node is on the sheet, near the grounding line. See if wants to unground. To
    2115                          * do so, we compute the hydrostatic bed, and if it is > bathymetry, then we unground: */
    21162113                        bed_hydro=-density*h[i];
    21172114                        if (bed_hydro>ba[i]){
    2118                                 /*ok, this node wants to unground. flag it: */
     2115                                /*Vertex that could potentially unground, flag it*/
    21192116                                VecSetValue(potential_sheet_ungrounding,nodes[i]->Sid(),1,INSERT_VALUES);
    21202117                        }
     
    22252222        /*Update inputs*/
    22262223   this->inputs->AddInput(new BoolInput(MaskElementonfloatingiceEnum,elementonshelf));
    2227 }
    2228 /*}}}*/
    2229 /*FUNCTION Tria::SoftMigration{{{1*/
    2230 void  Tria::SoftMigration(double* sheet_ungrounding){
    2231 
    2232         int     i;
    2233         bool    elementonshelf = false;
    2234         double  bed_hydro;
    2235         double  rho_water,rho_ice,density;
    2236         double  h[NUMVERTICES],s[NUMVERTICES],b[NUMVERTICES],ba[NUMVERTICES];
    2237 
    2238         /*Recover info at the vertices: */
    2239         GetInputListOnVertices(&h[0],ThicknessEnum);
    2240         GetInputListOnVertices(&s[0],SurfaceEnum);
    2241         GetInputListOnVertices(&b[0],BedEnum);
    2242         GetInputListOnVertices(&ba[0],BathymetryEnum);
    2243         rho_water=matpar->GetRhoWater();
    2244         rho_ice=matpar->GetRhoIce();
    2245         density=rho_ice/rho_water;
    2246        
    2247         /*go through vertices, and update inputs, considering them to be TriaVertex type: */
    2248         for(i=0;i<NUMVERTICES;i++){
    2249                 /*Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing */
    2250                 if (nodes[i]->IsFloating()){
    2251                         if(b[i]<=ba[i]){
    2252                                 b[i]=ba[i];
    2253                                 s[i]=b[i]+h[i];
    2254                         }
    2255                 }
    2256                 /*Ice sheet: if hydrostatic bed above bathymetry, the ice sheet starts to unground if it is connected to the ice shelf, elso do nothing */
    2257                 else{
    2258                         bed_hydro=-density*h[i];
    2259                         if (bed_hydro>ba[i]){
    2260                                 /*Unground only if the element is connected to the ice shelf*/
    2261                                 if(sheet_ungrounding[nodes[i]->Sid()]){
    2262                                         s[i]=(1-density)*h[i];
    2263                                         b[i]=-density*h[i];
    2264                                 }
    2265                         }
    2266                 }
    2267         }
    2268 
    2269         /*Update inputs*/   
    2270         this->inputs->AddInput(new TriaVertexInput(SurfaceEnum,&s[0]));
    2271         this->inputs->AddInput(new TriaVertexInput(BedEnum,&b[0]));
    22722224}
    22732225/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r10298 r10355  
    104104                void   MaterialUpdateFromTemperature(void){_error_("not implemented yet");};
    105105               
    106                 void   AgressiveMigration();
    107                 void   SoftMigration(double* sheet_ungrounding);
     106                void   Migration(double* sheet_ungrounding);
    108107                void   ShelfSync();
    109108                void   PotentialSheetUngrounding(Vec potential_sheet_ungrounding);
Note: See TracChangeset for help on using the changeset viewer.