Changeset 7288


Ignore:
Timestamp:
02/03/11 06:26:36 (14 years ago)
Author:
Eric.Larour
Message:

Grounding line migration: trying to debug.

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

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/Makefile.am

    r7178 r7288  
    359359                                        ./modules/GroundingLineMigrationx/CreateElementTouchingIceShelf.cpp\
    360360                                        ./modules/GroundingLineMigrationx/CreateElementOnGroundingLine.cpp\
     361                                        ./modules/GroundingLineMigrationx/UpdateShelfStatus.cpp\
    361362                                        ./modules/ModelProcessorx/ModelProcessorx.h\
    362363                                        ./modules/ModelProcessorx/ModelProcessorx.cpp\
     
    937938                                        ./modules/GroundingLineMigrationx/CreateElementTouchingIceShelf.cpp\
    938939                                        ./modules/GroundingLineMigrationx/CreateElementOnGroundingLine.cpp\
     940                                        ./modules/GroundingLineMigrationx/UpdateShelfStatus.cpp\
    939941                                        ./modules/ModelProcessorx/ModelProcessorx.h\
    940942                                        ./modules/ModelProcessorx/ModelProcessorx.cpp\
  • issm/trunk/src/c/modules/GroundingLineMigrationx/GroundingLineMigrationx.cpp

    r7287 r7288  
    1414        int i,j;
    1515        Element* element=NULL;
    16         double* element_touching_iceshelf=NULL;
     16        double*  element_touching_iceshelf=NULL;
     17        int      nflipped;
    1718
    1819        _printf_(VerboseModule(),"   Migrating grounding line\n");
     
    2021        /*Loop until no more nodes and elements  change from grounded to floating: */
    2122        nflipped=1; //arbitrary, get things started
     23
    2224        while(nflipped){
    2325
  • issm/trunk/src/c/modules/GroundingLineMigrationx/GroundingLineMigrationxLocal.h

    r7287 r7288  
    77
    88class Elements;
     9class Nodes;
     10class Parameters;
    911
    1012/* local prototypes: */
     
    1214bool*   CreateElementOnGroundingLine(Elements* elements,double* element_on_iceshelf);
    1315double* CreateElementTouchingIceShelf(Elements* elements);
    14 int UpdateShelfStatus(Elements* elements,Nodes* nodes,Parameters* parameters);
    1516int UpdateShelfStatus(Elements* elements,Nodes* nodes,Parameters* parameters,double* element_touching_iceshelf);
    1617
  • issm/trunk/src/c/modules/GroundingLineMigrationx/UpdateShelfStatus.cpp

    r7287 r7288  
    11/*!\file UpdateShelfStatus
    2  * \brief: update elements and nodes shelf status. Plus return how many nodes have changed status. */
     2 * \brief: update elements and nodes shelf status. Plus return how many nodes have changed status.
    33 */
    44
     
    1616        int numnods;
    1717        Vec vec_new_shelf_nodes=NULL;
     18        double* new_shelf_nodes=NULL;
    1819
    1920        /*output: */
     21        int local_nflipped=0;
    2022        int nflipped=0;
    2123
     
    3133        for(i=0;i<elements->Size();i++){
    3234                element=(Element*)elements->GetObjectByOffset(i);
    33                 nflipped+=element->UpdateShelfStatus(vec_new_shelf_nodes);
     35                if(element_touching_iceshelf[element->Sid()]){
     36                        local_nflipped+=element->UpdateShelfStatus(vec_new_shelf_nodes);
     37                }
    3438        }
     39        MPI_Allreduce(&local_nflipped,&nflipped,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD);
    3540
    3641        /*Serialize vec_new_shelf_nodes: */
  • issm/trunk/src/c/objects/Elements/Element.h

    r7089 r7288  
    8484                virtual double TimeAdapt()=0;
    8585                virtual void   MigrateGroundingLine()=0;
    86                 virtual void   UpdateShelfStatus()=0;
     86                virtual int    UpdateShelfStatus(Vec new_shelf_nodes)=0;
     87                virtual void   UpdateShelfFlags(double* new_shelf_nodes)=0;
    8788
    8889                /*Implementation: */
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r7220 r7288  
    50405040                /*Check solution*/
    50415041                if(isnan(values[i])) _error_("NaN found in solution vector");
    5042                 if(values[i]<0)      printf("temperature < 0°K found in solution vector\n");
    5043                 if(values[i]>275)    printf("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)\n");
     5042                //if(values[i]<0)      printf("temperature < 0°K found in solution vector\n");
     5043                //if(values[i]>275)    printf("temperature > 275°K found in solution vector (Paterson's rheology associated is negative)\n");
    50445044        }
    50455045
     
    61316131/*}}}*/
    61326132/*FUNCTION Penta::UpdateShelfStatus{{{1*/
    6133 void Penta::UpdateShelfStatus(void){
     6133int Penta::UpdateShelfStatus(Vec new_shelf_nodes){
    61346134        _error_("Not implemented yet");
    61356135}
    61366136/*}}}*/
     6137/*FUNCTION Penta::UpdateShelfFlags{{{1*/
     6138void Penta::UpdateShelfFlags(double* new_shelf_nodes){
     6139        _error_("Not implemented yet");
     6140}
     6141/*}}}*/
  • issm/trunk/src/c/objects/Elements/Penta.h

    r7089 r7288  
    125125                double SurfaceArea(void);
    126126                void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
    127                 void   UpdateShelfStatus(void);
     127                int    UpdateShelfStatus(Vec new_shelf_nodes);
     128                void   UpdateShelfFlags(double* new_shelf_nodes);
    128129                double TimeAdapt();
    129130                int*   GetHorizontalNeighboorSids(void);
  • issm/trunk/src/c/objects/Elements/Tria.cpp

    r7242 r7288  
    5353                /*Build horizontalneighborsids list: */
    5454                _assert_(iomodel->elementconnectivity);
    55                 for (i=0;i<3;i++) this->horizontalneighborsids[i]=(int)iomodel->elementconnectivity[3*index+i]-1;
     55                //for (i=0;i<3;i++) this->horizontalneighborsids[i]=(int)iomodel->elementconnectivity[3*index+i]-1;
    5656
    5757                /*intialize inputs and results: */
     
    44374437                                b[i]=ba[i];
    44384438                                s[i]=b[i]+h[i];
     4439                                //printf("Node id %i is starting to ground\n",nodes[i]->Id());
    44394440                        }
    44404441                        else{
     
    44504451                                s[i]=(1-density)*h[i];
    44514452                                b[i]=-density*h[i];
     4453                                //printf("Node id %i is starting to float\n",nodes[i]->Id());
    44524454                        }
    44534455                        else{
     
    53275329/*}}}*/
    53285330/*FUNCTION Tria::UpdateShelfStatus{{{1*/
    5329 void  Tria::UpdateShelfStatus(void){
     5331int  Tria::UpdateShelfStatus(Vec new_shelf_nodes){
    53305332
    53315333        int     i;
     
    53415343        double  density;
    53425344        bool    elementonshelf = false;
     5345        int     flipped=0;
     5346        bool    shelfstatus[3];
    53435347
    53445348
     
    53585362        density=rho_ice/rho_water;
    53595363
     5364        /*Initialize current status of nodes: */
     5365        for(i=0;i<3;i++){
     5366                shelfstatus[i]=nodes[i]->inputs->GetInput(NodeOnIceShelfEnum);
     5367        }
     5368       
    53605369        /*go through vertices, and figure out if they are grounded or not, then update their status: */
     5370        flipped=0;
    53615371        for(i=0;i<3;i++){
    53625372                if(b[i]<=ba[i]){
    53635373                        nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,false));
    53645374                        nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,true));
     5375                        if(shelfstatus[i])flipped++;
     5376                        //printf("node %i flipping to sheet\n",nodes[i]->Sid());
     5377                        VecSetValue(new_shelf_nodes,nodes[i]->Sid(),0,INSERT_VALUES);
    53655378                }
    53665379                else{
    53675380                        nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,true));
    53685381                        nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,false));
     5382                        if(!shelfstatus[i])flipped++;
     5383                        //printf("node %i flipping to shelf\n",nodes[i]->Sid());
     5384                        VecSetValue(new_shelf_nodes,nodes[i]->Sid(),1,INSERT_VALUES);
    53695385                }
    53705386        }
    53715387
    53725388        /*Now, update  shelf status of element. An element can only be on shelf if all its nodes are on shelf: */
    5373         elementonshelf=true;
     5389        elementonshelf=false;
    53745390        for(i=0;i<3;i++){
    5375                 if(nodes[i]->IsOnSheet()){
    5376                         elementonshelf=false;
     5391                if(nodes[i]->IsOnShelf()){
     5392                        elementonshelf=true;
    53775393                        break;
    53785394                }
    53795395        }
    53805396    this->inputs->AddInput(new BoolInput(ElementOnIceShelfEnum,elementonshelf));
    5381 }
    5382 /*}}}*/
     5397
     5398         return flipped;
     5399}
     5400/*}}}*/
     5401/*FUNCTION Tria::UpdateShelfFlags{{{1*/
     5402void Tria::UpdateShelfFlags(double* new_shelf_nodes){
     5403
     5404        /*go through vertices, and update the status of NodeOnIceShelfEnum and NodeOnIceSheetEnum flags: */
     5405        bool flag;
     5406        int  i;
     5407
     5408        for(i=0;i<3;i++){
     5409                flag=(bool)new_shelf_nodes[nodes[i]->Sid()];
     5410                nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceShelfEnum,flag));
     5411                nodes[i]->inputs->AddInput(new BoolInput(NodeOnIceSheetEnum,!flag));
     5412        }
     5413}
     5414/*}}}*/
  • issm/trunk/src/c/objects/Elements/Tria.h

    r7089 r7288  
    129129                double SurfaceArea(void);
    130130                void   Update(int index, IoModel* iomodel,int analysis_counter,int analysis_type);
    131                 void   UpdateShelfStatus(void);
     131                int    UpdateShelfStatus(Vec new_shelf_nodes);
     132                void   UpdateShelfFlags(double* new_shelf_nodes);
    132133                double TimeAdapt();
    133134                int*   GetHorizontalNeighboorSids(void);
  • issm/trunk/src/c/solutions/control_core.cpp

    r6412 r7288  
    108108
    109109                /*Temporary saving every 5 control steps: */
    110                 if (((n+1)%5)==0){
     110                /*if (((n+1)%5)==0){
    111111                        _printf_(VerboseControl(),"%s\n","   saving temporary results");
    112112                        controlrestart(femmodel,J);
    113                 }
     113                }*/
    114114        }
    115115
  • issm/trunk/src/c/solutions/transient2d_core.cpp

    r7109 r7288  
    5353                step+=1;
    5454
    55                 _printf_(VerboseSolution(),"%s%g%s%i%s%g%s%g\n","time [yr]: ",time/yts,"    iteration number: ",step,"/",floor(finaltime/dt)," dt [yr]: ",dt/yts);
     55                _printf_(VerboseSolution(),"%s%g%s%i%s%g%s%g\n","time [yr]: ",time/yts,"    iteration number: ",step,"/",floor((finaltime-time)/dt)," dt [yr]: ",dt/yts);
    5656
    5757                _printf_(VerboseSolution(),"%s\n","   computing new velocity");
  • issm/trunk/src/c/solutions/transient3d_core.cpp

    r7109 r7288  
    5151                time+=dt;
    5252
    53                 _printf_(VerboseSolution(),"%s%g%s%i%s%g%s%g\n","time [yr]: ",time/yts,"    iteration number: ",step,"/",floor(finaltime/dt)," dt [yr]: ",dt/yts);
     53                _printf_(VerboseSolution(),"%s%g%s%i%s%g%s%g\n","time [yr]: ",time/yts,"    iteration number: ",step,"/",floor((finaltime-time)/dt)," dt [yr]: ",dt/yts);
    5454
    5555                _printf_(VerboseSolution(),"   computing temperatures:\n");
Note: See TracChangeset for help on using the changeset viewer.