Changeset 27014


Ignore:
Timestamp:
05/19/22 13:30:04 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: added migration max to min thickness calving

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.cpp

    r27010 r27014  
    646646        int  calvinglaw;
    647647        femmodel->parameters->FindParam(&calvinglaw,CalvingLawEnum);
     648        IssmDouble mig_max = femmodel->parameters->FindParam(MigrationMaxEnum);
     649        IssmDouble dt      = femmodel->parameters->FindParam(TimesteppingTimeStepEnum);
     650
     651
     652   /*Get current distance to terminus*/
     653   InputDuplicatex(femmodel,MaskIceLevelsetEnum,DistanceToCalvingfrontEnum);
     654   femmodel->DistanceToFieldValue(MaskIceLevelsetEnum,0,DistanceToCalvingfrontEnum);
     655
    648656
    649657        if(calvinglaw==CalvingMinthicknessEnum || calvinglaw==CalvingVonmisesEnum){
    650658
    651659                /*Intermediaries*/
    652                 IssmDouble thickness,bed,sealevel;
     660                IssmDouble thickness,bed,sealevel,distance;
    653661                IssmDouble min_thickness = femmodel->parameters->FindParam(CalvingMinthicknessEnum);
     662
     663                /*Loop over all elements of this partition*/
     664                for(Object* & object : femmodel->elements->objects){
     665                        Element* element  = xDynamicCast<Element*>(object);
     666
     667                        int      numnodes = element->GetNumberOfNodes();
     668                        Gauss*   gauss    = element->NewGauss();
     669                        Input*   H_input  = element->GetInput(ThicknessEnum); _assert_(H_input);
     670                        Input*   b_input  = element->GetInput(BedEnum); _assert_(b_input);
     671                        Input*   sl_input = element->GetInput(SealevelEnum); _assert_(sl_input);
     672                        Input*   dis_input = element->GetInput(DistanceToCalvingfrontEnum); _assert_(dis_input);
     673
     674                        /*Potentially constrain nodes of this element*/
     675                        for(int in=0;in<numnodes;in++){
     676                                gauss->GaussNode(element->GetElementType(),in);
     677                                Node* node=element->GetNode(in);
     678                                if(!node->IsActive()) continue;
     679
     680                                H_input->GetInputValue(&thickness,gauss);
     681                                b_input->GetInputValue(&bed,gauss);
     682                                sl_input->GetInputValue(&sealevel,gauss);
     683                                dis_input->GetInputValue(&distance,gauss);
     684                                if(thickness<min_thickness && bed<sealevel && distance<mig_max*dt){
     685                                        node->ApplyConstraint(0,+1.);
     686                                }
     687                                else {
     688                                        /* no ice, set no spc */
     689                                        node->DofInFSet(0);
     690                                }
     691                        }
     692                        delete gauss;
     693                }
     694        }
     695        else if(calvinglaw==CalvingParameterizationEnum){
     696
     697      /*Intermediaries*/
     698      IssmDouble thickness,bed,sealevel,distance;
     699      IssmDouble min_thickness = femmodel->parameters->FindParam(CalvingMinthicknessEnum);
    654700
    655701                /*Loop over all elements of this partition*/
     
    662708                        Input*   b_input = element->GetInput(BedEnum); _assert_(b_input);
    663709                        Input*   sl_input = element->GetInput(SealevelEnum); _assert_(sl_input);
     710                        Input*   dis_input           = element->GetInput(DistanceToCalvingfrontEnum); _assert_(dis_input);
    664711
    665712                        /*Potentially constrain nodes of this element*/
     
    672719                                b_input->GetInputValue(&bed,gauss);
    673720                                sl_input->GetInputValue(&sealevel,gauss);
    674                                 if(thickness<min_thickness && bed<sealevel){
     721                                dis_input->GetInputValue(&distance,gauss);
     722                                if(thickness<min_thickness && bed<sealevel && distance<mig_max*dt){
    675723                                        node->ApplyConstraint(0,+1.);
    676724                                }
     
    683731                }
    684732        }
    685         else if(calvinglaw==CalvingParameterizationEnum){
    686 
    687       /*Intermediaries*/
    688       IssmDouble thickness,bed,sealevel;
    689       IssmDouble min_thickness = femmodel->parameters->FindParam(CalvingMinthicknessEnum);
     733   else if(calvinglaw==CalvingHabEnum){
     734
     735                /*Intermediaries*/
     736                IssmDouble  thickness,water_depth,distance,hab_fraction;
    690737
    691738                /*Loop over all elements of this partition*/
     
    693740                        Element* element  = xDynamicCast<Element*>(object);
    694741
    695                         int      numnodes = element->GetNumberOfNodes();
    696                         Gauss*   gauss    = element->NewGauss();
    697                         Input*   H_input  = element->GetInput(ThicknessEnum); _assert_(H_input);
    698                         Input*   b_input = element->GetInput(BedEnum); _assert_(b_input);
    699                         Input*   sl_input = element->GetInput(SealevelEnum); _assert_(sl_input);
     742                        IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
     743                        IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
     744
     745                        int      numnodes           = element->GetNumberOfNodes();
     746                        Gauss*   gauss              = element->NewGauss();
     747                        Input*   H_input            = element->GetInput(ThicknessEnum); _assert_(H_input);
     748                        Input*   bed_input          = element->GetInput(BedEnum); _assert_(bed_input);
     749                        Input*   hab_fraction_input = element->GetInput(CalvingHabFractionEnum); _assert_(hab_fraction_input);
     750                        Input*   dis_input           = element->GetInput(DistanceToCalvingfrontEnum); _assert_(dis_input);
    700751
    701752                        /*Potentially constrain nodes of this element*/
     
    706757
    707758                                H_input->GetInputValue(&thickness,gauss);
    708                                 b_input->GetInputValue(&bed,gauss);
    709                                 sl_input->GetInputValue(&sealevel,gauss);
    710                                 if(thickness<min_thickness && bed<sealevel){
    711                                         node->ApplyConstraint(0,+1.);
    712                                 }
    713                                 else {
    714                                         /* no ice, set no spc */
    715                                         node->DofInFSet(0);
    716                                 }
    717                         }
    718                         delete gauss;
    719                 }
    720         }
    721    else if(calvinglaw==CalvingHabEnum){
    722 
    723                 /*Intermediaries*/
    724                 IssmDouble  thickness,water_depth,levelset,hab_fraction;
    725 
    726                 /*Get the fraction of the flotation thickness at the terminus*/
    727                 InputDuplicatex(femmodel,MaskIceLevelsetEnum,DistanceToCalvingfrontEnum);
    728                 femmodel->DistanceToFieldValue(MaskIceLevelsetEnum,0,DistanceToCalvingfrontEnum);
    729 
    730                 /*Loop over all elements of this partition*/
    731                 for(Object* & object : femmodel->elements->objects){
    732                         Element* element  = xDynamicCast<Element*>(object);
    733 
    734                         IssmDouble rho_ice   = element->FindParam(MaterialsRhoIceEnum);
    735                         IssmDouble rho_water = element->FindParam(MaterialsRhoSeawaterEnum);
    736 
    737                         int      numnodes           = element->GetNumberOfNodes();
    738                         Gauss*   gauss              = element->NewGauss();
    739                         Input*   H_input            = element->GetInput(ThicknessEnum); _assert_(H_input);
    740                         Input*   bed_input          = element->GetInput(BedEnum); _assert_(bed_input);
    741                         Input*   hab_fraction_input = element->GetInput(CalvingHabFractionEnum); _assert_(hab_fraction_input);
    742                         Input*   ls_input           = element->GetInput(DistanceToCalvingfrontEnum); _assert_(ls_input);
    743 
    744                         /*Potentially constrain nodes of this element*/
    745                         for(int in=0;in<numnodes;in++){
    746                                 gauss->GaussNode(element->GetElementType(),in);
    747                                 Node* node=element->GetNode(in);
    748                                 if(!node->IsActive()) continue;
    749 
    750                                 H_input->GetInputValue(&thickness,gauss);
    751759                                bed_input->GetInputValue(&water_depth,gauss);
    752                                 ls_input->GetInputValue(&levelset,gauss);
     760                                dis_input->GetInputValue(&distance,gauss);
    753761                                hab_fraction_input->GetInputValue(&hab_fraction,gauss);
    754762
    755                                 if(thickness<((rho_water/rho_ice)*(1+hab_fraction)*-water_depth) && levelset>-300. && levelset<0.){
     763                                if(thickness<((rho_water/rho_ice)*(1+hab_fraction)*-water_depth) && distance<mig_max*dt){
    756764                                        node->ApplyConstraint(0,+1.);
    757765                                }
     
    780788
    781789                IssmDouble crevasse_threshold = femmodel->parameters->FindParam(CalvingCrevasseThresholdEnum);
    782                 IssmDouble mig_max            = femmodel->parameters->FindParam(MigrationMaxEnum);
    783                 IssmDouble dt                 = femmodel->parameters->FindParam(TimesteppingTimeStepEnum);
     790
    784791
    785792                for(Object* & object : femmodel->elements->objects){
     
    856863                                                surface_input->GetInputValue(&surface,gauss);
    857864
     865                  /*FIXME: not sure about levelset<0. && levelset>-mig_max*dt! SHould maybe be distance<mig_max*dt*/
    858866                  if((surface_crevasse>surface || crevassedepth>crevasse_threshold*thickness) && bed<0. && levelset<0. && levelset>-mig_max*dt && constraint_nodes[node->Lid()]==0.){
    859867                                                        local_nflipped++;
Note: See TracChangeset for help on using the changeset viewer.