Changeset 27017


Ignore:
Timestamp:
05/20/22 09:52:09 (3 years ago)
Author:
Mathieu Morlighem
Message:

CHG: moving min thickness as postprocessing. Will move other calving laws as well if successful

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

Legend:

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

    r27016 r27017  
    641641        }
    642642}/*}}}*/
     643void           LevelsetAnalysis::PostProcess(FemModel* femmodel){/*{{{*/
     644
     645        /*This function is only used by "discrete calving laws" for which we change
     646         * the value of the levelset after the advection step (level set equation
     647         * solve) based on the law*/
     648
     649        /*Intermediaries*/
     650        int  calvinglaw;
     651        IssmDouble newlevelset[6];
     652        femmodel->parameters->FindParam(&calvinglaw,CalvingLawEnum);
     653
     654        if(calvinglaw==CalvingMinthicknessEnum){
     655
     656                IssmDouble mig_max = femmodel->parameters->FindParam(MigrationMaxEnum);
     657                IssmDouble dt      = femmodel->parameters->FindParam(TimesteppingTimeStepEnum);
     658
     659                /*Get current distance to terminus*/
     660                InputDuplicatex(femmodel,MaskIceLevelsetEnum,DistanceToCalvingfrontEnum);
     661                femmodel->DistanceToFieldValue(MaskIceLevelsetEnum,0,DistanceToCalvingfrontEnum);
     662
     663                /*Intermediaries*/
     664                IssmDouble thickness,bed,sealevel,distance,levelset;
     665                IssmDouble min_thickness = femmodel->parameters->FindParam(CalvingMinthicknessEnum);
     666
     667                /*Loop over all elements of this partition*/
     668                for(Object* & object : femmodel->elements->objects){
     669                        Element* element  = xDynamicCast<Element*>(object);
     670
     671                        /*no need to postprocess an ice free element*/
     672                        if(!element->IsIceInElement()) continue;
     673
     674                        int      numnodes     = element->GetNumberOfNodes(); _assert_(numnodes<7);
     675                        Gauss*   gauss        = element->NewGauss();
     676                        Input *H_input        = element->GetInput(ThicknessEnum);              _assert_(H_input);
     677                        Input *b_input        = element->GetInput(BedEnum);                    _assert_(b_input);
     678                        Input *sl_input       = element->GetInput(SealevelEnum);               _assert_(sl_input);
     679                        Input *dis_input      = element->GetInput(DistanceToCalvingfrontEnum); _assert_(dis_input);
     680                        Input *levelset_input = element->GetInput(MaskIceLevelsetEnum);        _assert_(levelset_input);
     681
     682                        /*Potentially constrain nodes of this element*/
     683                        for(int in=0;in<numnodes;in++){
     684                                gauss->GaussNode(element->GetElementType(),in);
     685
     686                                levelset_input->GetInputValue(&levelset,gauss);
     687                                H_input->GetInputValue(&thickness,gauss);
     688                                b_input->GetInputValue(&bed,gauss);
     689                                sl_input->GetInputValue(&sealevel,gauss);
     690                                dis_input->GetInputValue(&distance,gauss);
     691
     692                                if(thickness<min_thickness && bed<sealevel && fabs(distance)<mig_max*dt && levelset<0){
     693                                        newlevelset[in] = +400.; //Arbitrary > 0 number
     694                                }
     695                                else{
     696                                        newlevelset[in] = levelset;
     697                                }
     698                        }
     699                        element->AddInput(MaskIceLevelsetEnum,&newlevelset[0],element->GetElementType());
     700                        delete gauss;
     701                }
     702        }
     703}/*}}}*/
    643704void           LevelsetAnalysis::UpdateConstraints(FemModel* femmodel){/*{{{*/
    644705
     
    653714   femmodel->DistanceToFieldValue(MaskIceLevelsetEnum,0,DistanceToCalvingfrontEnum);
    654715
    655         if(calvinglaw==CalvingMinthicknessEnum || calvinglaw==CalvingVonmisesEnum){
     716        if(calvinglaw==CalvingVonmisesEnum){
    656717
    657718                /*Intermediaries*/
  • issm/trunk-jpl/src/c/analyses/LevelsetAnalysis.h

    r26047 r27017  
    3232                void           InputUpdateFromSolution(IssmDouble* solution,Element* element);
    3333                void           UpdateConstraints(FemModel* femmodel);
     34
     35                /*Specific methods to LevelsetAnalysis*/
     36                void  PostProcess(FemModel* femmodel);
    3437};
    3538#endif
  • issm/trunk-jpl/src/c/cores/movingfront_core.cpp

    r26977 r27017  
    114114
    115115        /* solve level set equation */
    116         analysis = new LevelsetAnalysis();
    117         analysis->Core(femmodel);
    118         delete analysis;
     116        LevelsetAnalysis lsanalysis;
     117        lsanalysis.Core(femmodel);
     118        lsanalysis.PostProcess(femmodel);
    119119
    120120        /*Kill ice berg to avoid free body motion*/
Note: See TracChangeset for help on using the changeset viewer.