@@ -581,23 +581,21 @@ end #}}}
581581function IsAllFloating (element:: Tria ) # {{{
582582
583583 input= GetInput (element, MaskOceanLevelsetEnum)
584- migration_style = FindParam (String, element, GroundinglineMigrationEnum)
585- # get the Enum
586- migration_style_enum = StringToEnum (migration_style)
584+ migration_style = StringToEnum (FindParam (String, element, GroundinglineMigrationEnum))
587585
588- if (migration_style_enum == SubelementMigrationEnum)
586+ if (migration_style == SubelementMigrationEnum)
589587 if GetInputMax (input) <= 0.
590588 return true ;
591589 else
592590 return false
593591 end
594- elseif (migration_style_enum == ContactEnum)
592+ elseif (migration_style == ContactEnum)
595593 if GetInputMin (input) < 0.
596594 return true ;
597595 else
598596 return false
599597 end
600- elseif (migration_style_enum == NoneEnum || migration_style_enum == AggressiveMigrationEnum || migration_style_enum == SoftMigrationEnum || migration_style_enum == GroundingOnlyEnum)
598+ elseif (migration_style == NoneEnum || migration_style == AggressiveMigrationEnum || migration_style == SoftMigrationEnum || migration_style == GroundingOnlyEnum)
601599 # by default use none migration
602600 if GetInputMin (input) > 0.
603601 return false ;
@@ -651,30 +649,54 @@ function MigrateGroundingLine(element::Tria) #{{{
651649 # GetInputListOnVertices(element, sl, SealevelEnum)
652650 GetInputListOnVertices! (element, phi, MaskOceanLevelsetEnum)
653651
654-
655652 rho_water = FindParam (Float64, element, MaterialsRhoSeawaterEnum)
656653 rho_ice = FindParam (Float64, element, MaterialsRhoIceEnum)
657654 density = rho_ice/ rho_water
658655
656+ migration_style = StringToEnum (FindParam (String, element, GroundinglineMigrationEnum))
657+
659658 for i in 1 : 3
660659
661- if (phi[i]<= 0 )
660+ if (migration_style == GroundingOnlyEnum && b[i]< r[i])
661+ # Ice shelf: if bed below bathymetry, impose it at the bathymetry and update surface, elso do nothing
662+ b[i] = r[i]
663+ elseif (phi[i]<= 0 )
662664 # reground if base is below bed
663665 if (b[i]<= r[i])
664666 b[i] = r[i]
665667 s[i] = b[i]+ h[i]
666668 end
669+ # Ice sheet: if hydrostatic bed above bathymetry, ice sheet starts to unground, elso do nothing
670+ # Change only if AggressiveMigration or if the ice sheet is in contact with the ocean
667671 else
668672 bed_hydro= - density* h[i]+ sl[i];
669673 if (bed_hydro> r[i])
670674 # Unground only if the element is connected to the ice shelf
671- s[i] = (1 - density)* h[i]+ sl[i]
672- b[i] = - density* h[i]+ sl[i]
675+ if (migration_style== AggressiveMigrationEnum || migration_style== SubelementMigrationEnum)
676+ s[i] = (1.0 - density)* h[i]+ sl[i]
677+ b[i] = - density* h[i]+ sl[i]
678+ elseif (migration_style== SoftMigrationEnum)
679+ s[i] = (1.0 - density)* h[i]+ sl[i]
680+ b[i] = - density* h[i]+ sl[i]
681+ else
682+ if (migration_style!= SoftMigrationEnum && migration_style!= ContactEnum && migration_style!= GroundingOnlyEnum)
683+ error (" Error: migration should be Aggressive, Soft, Subelement, Contact or GroundingOnly" )
684+ end
685+ end
673686 end
674687 end
688+ end
675689
676- # recalculate phi
677- phi[i]= h[i]+ (r[i]- sl[i])/ density
690+ # Recalculate phi
691+ for i in 1 : 3
692+ if (migration_style== SoftMigrationEnum)
693+ bed_hydro = - density* h[i]+ sl[i]
694+ if (phi[i]< 0. || bed_hydro<= r[i] )
695+ phi[i] = h[i]+ (r[i]- sl[i])/ density
696+ end
697+ elseif (migration_style!= ContactEnum)
698+ phi[i]= h[i]+ (r[i]- sl[i])/ density
699+ end
678700 end
679701
680702 # Update inputs
0 commit comments