Changeset 15967


Ignore:
Timestamp:
08/27/13 08:35:37 (12 years ago)
Author:
seroussi
Message:

CHG: trying to finish Grounding line changes

Location:
issm/trunk-jpl/src/c
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Penta.cpp

    r15964 r15967  
    27792779
    27802780        for(i=0;i<NUMVERTICES;i++){
    2781                 if (reCast<bool,IssmDouble>(flags[nodes[i]->Sid()])){
     2781                if (flags[vertices[i]->Sid()]<0.){
    27822782                        shelf=true;
    27832783                        break;
     
    1120011200#ifdef _HAVE_GROUNDINGLINE_
    1120111201/*FUNCTION Penta::MigrateGroundingLine{{{*/
    11202 void  Penta::MigrateGroundingLine(IssmDouble* sheet_ungrounding){
     11202void  Penta::MigrateGroundingLine(IssmDouble* phi_ungrounding){
    1120311203
    1120411204        int        i,migration_style;
     
    1125311253                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
    1125411254                                }
    11255                                 else if(migration_style==SoftMigrationEnum && reCast<int,IssmDouble>(sheet_ungrounding[vertices[i]->Sid()])){
     11255                                //else if(migration_style==SoftMigrationEnum && reCast<int,IssmDouble>(sheet_ungrounding[vertices[i]->Sid()])){
     11256                                else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Sid()]<0.){
    1125611257                                        s[i]        = (1-density)*h[i];
    1125711258                                        b[i]        = -density*h[i];
     
    1130211303                if(migration_style==SoftMigrationEnum){
    1130311304                        bed_hydro=-density*h[i];
    11304                         if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){
     11305                        //if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[nodes[i]->Sid()])){
     11306                        if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Sid()]<0.){
    1130511307                                phi[i]=h[i]+r[i]/density;
    1130611308                        }
     
    1135611358        for(i=0;i<NUMVERTICES;i++){
    1135711359                if (reCast<bool,IssmDouble>(vertices_potentially_ungrounding[nodes[i]->Sid()])){
    11358                         vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(),1,INS_VAL);
     11360                        vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(),-1.,INS_VAL);
    1135911361
    1136011362                        /*If node was not on ice shelf, we flipped*/
    11361                         if(nodes_on_iceshelf[vertices[i]->Sid()]==0){
     11363                        if(nodes_on_iceshelf[vertices[i]->Sid()]>=0.){
    1136211364                                nflipped++;
    1136311365                        }
  • issm/trunk-jpl/src/c/classes/Elements/Tria.cpp

    r15965 r15967  
    19811981
    19821982        for(i=0;i<NUMVERTICES;i++){
    1983                 if (reCast<bool>(flags[nodes[i]->Sid()])){
     1983                if (flags[vertices[i]->Sid()]<0.){
    19841984                        shelf=true;
    19851985                        break;
     
    73127312#ifdef _HAVE_GROUNDINGLINE_
    73137313/*FUNCTION Tria::MigrateGroundingLine{{{*/
    7314 void  Tria::MigrateGroundingLine(IssmDouble* sheet_ungrounding){
     7314void  Tria::MigrateGroundingLine(IssmDouble* phi_ungrounding){
    73157315
    73167316        int        i,migration_style;
     
    73637363                                        nodes[i]->inputs->AddInput(new BoolInput(MaskVertexongroundediceEnum,false));
    73647364                                }
    7365                                 else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){
    7366                                 //else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Sid()]<0.){
     7365                                //else if(migration_style==SoftMigrationEnum && reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){
     7366                                else if(migration_style==SoftMigrationEnum && phi_ungrounding[vertices[i]->Sid()]<0.){
    73677367                                        s[i]        = (1-density)*h[i];
    73687368                                        b[i]        = -density*h[i];
     
    74147414                if(migration_style==SoftMigrationEnum){
    74157415                        bed_hydro=-density*h[i];
    7416                         //if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Sid()]<0.){
    7417                         if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){
     7416                        if(phi[i]<0. || bed_hydro<=r[i] || phi_ungrounding[vertices[i]->Sid()]<0.){
     7417                        //if(phi[i]<0. || bed_hydro<=r[i] || reCast<bool>(sheet_ungrounding[vertices[i]->Sid()])){
    74187418                                phi[i]=h[i]+r[i]/density;
    74197419                        }
     
    74617461        for(i=0;i<3;i++){
    74627462                if (reCast<bool>(vertices_potentially_ungrounding[vertices[i]->Sid()])){
    7463                         vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(),1,INS_VAL);
     7463                        vec_nodes_on_iceshelf->SetValue(vertices[i]->Sid(),-1.,INS_VAL);
    74647464
    74657465                        /*If node was not on ice shelf, we flipped*/
    7466                         if(nodes_on_iceshelf[vertices[i]->Sid()]==0){
     7466                        if(nodes_on_iceshelf[vertices[i]->Sid()]>=0.){
    74677467                                nflipped++;
    74687468                        }
  • issm/trunk-jpl/src/c/modules/GroundinglineMigrationx/GroundinglineMigrationx.cpp

    r15962 r15967  
    5151}
    5252
    53 /*FUNCTION CreateNodesOnFloatingIce {{{*/
    54 Vector<IssmDouble>* CreateNodesOnFloatingIce(Nodes* nodes,int configuration_type){
    55 
    56         int     i,numnods;
    57         Vector<IssmDouble>*   vec_nodes_on_floatingice = NULL;
    58         Node *node                     = NULL;
    59 
    60         /*First, initialize nodes_on_floatingice, which will track which nodes have changed status: */
    61         numnods=nodes->NumberOfNodes(configuration_type);
    62         vec_nodes_on_floatingice=new Vector<IssmDouble>(numnods);
    63 
    64         /*Loop through nodes, and fill vec_nodes_on_floatingice: */
    65         for(i=0;i<nodes->Size();i++){
    66                 node=(Node*)nodes->GetObjectByOffset(i);
    67                 if(node->InAnalysis(configuration_type)){
    68                         if(node->IsFloating()){
    69                                 vec_nodes_on_floatingice->SetValue(node->Sid(),1.0,INS_VAL);
    70                         }
    71                 }
    72         }
    73 
    74         /*Assemble vector: */
    75         vec_nodes_on_floatingice->Assemble();
    76 
    77         return vec_nodes_on_floatingice;
    78 }
    79 /*%}}}*/
    8053/*FUNCTION PotentialUngrounding {{{*/
    8154IssmDouble*    PotentialUngrounding(Elements* elements,Vertices* vertices,Parameters* parameters){
     
    11184        int      numberofvertices;
    11285        int      nflipped,local_nflipped;
    113         IssmDouble*  nodes_on_floatingice                  = NULL;
     86        IssmDouble*  phi                  = NULL;
    11487        IssmDouble*  elements_neighboring_floatingce      = NULL;
    11588        Vector<IssmDouble>*      vec_elements_neighboring_floatingice = NULL;
    116         Vector<IssmDouble>*      vec_nodes_on_floatingice              = NULL;
     89        Vector<IssmDouble>*      vec_phi              = NULL;
    11790        Node*    node                                  = NULL;
    11891        Element* element                               = NULL;
     
    12295        numberofvertices=vertices->NumberOfVertices();
    12396
    124         /*recover vec_nodes_on_floatingice*/
    125         vec_nodes_on_floatingice=CreateNodesOnFloatingIce(nodes,analysis_type);
    126         nodes_on_floatingice=vec_nodes_on_floatingice->ToMPISerial();
     97        /*recover vec_phi*/
     98        vec_phi=new Vector<IssmDouble>(vertices->NumberOfVertices());
     99        for(i=0;i<elements->Size();i++){
     100                Element* element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
     101                element->GetVectorFromInputs(vec_phi,MaskGroundediceLevelsetEnum);
     102        }
     103        phi=vec_phi->ToMPISerial();
    127104
    128105        nflipped=1; //bootstrap
     
    135112                for(i=0;i<elements->Size();i++){
    136113                        element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    137                         vec_elements_neighboring_floatingice->SetValue(element->Sid(),element->IsNodeOnShelfFromFlags(nodes_on_floatingice)?1.0:0.0,INS_VAL);
     114                        vec_elements_neighboring_floatingice->SetValue(element->Sid(),element->IsNodeOnShelfFromFlags(phi)?1.0:0.0,INS_VAL);
    138115                }
    139116
     
    147124                        element=dynamic_cast<Element*>(elements->GetObjectByOffset(i));
    148125                        if(reCast<int,IssmDouble>(elements_neighboring_floatingce[element->Sid()])){
    149                                 local_nflipped+=element->UpdatePotentialUngrounding(vertices_potentially_ungrounding,vec_nodes_on_floatingice,nodes_on_floatingice);
     126                                local_nflipped+=element->UpdatePotentialUngrounding(vertices_potentially_ungrounding,vec_phi,phi);
    150127                        }
    151128                }
    152                 vec_nodes_on_floatingice->Assemble();
     129                vec_phi->Assemble();
    153130
    154131                ISSM_MPI_Allreduce(&local_nflipped,&nflipped,1,ISSM_MPI_INT,ISSM_MPI_SUM,IssmComm::GetComm());
     
    157134                /*Avoid leaks: */
    158135                xDelete<IssmDouble>(elements_neighboring_floatingce);
    159                 xDelete<IssmDouble>(nodes_on_floatingice);
     136                xDelete<IssmDouble>(phi);
    160137
    161138                /*Assemble and serialize:*/
    162139                delete vec_elements_neighboring_floatingice;
    163                 nodes_on_floatingice=vec_nodes_on_floatingice->ToMPISerial();
     140                phi=vec_phi->ToMPISerial();
    164141        }
    165142
    166143        /*Free ressources:*/
    167         delete vec_nodes_on_floatingice;
     144        delete vec_phi;
    168145        xDelete<IssmDouble>(elements_neighboring_floatingce);
    169146
    170         return nodes_on_floatingice;
     147        return phi;
    171148}
    172149/*}}}*/
Note: See TracChangeset for help on using the changeset viewer.