@@ -781,7 +781,8 @@ subroutine li_velocity_external_write_albany_mesh(domain)
781781 !-----------------------------------------------------------------
782782 ! local variables
783783 !-----------------------------------------------------------------
784- logical , pointer :: config_write_albany_ascii_mesh
784+ logical , pointer :: config_write_albany_ascii_mesh, &
785+ config_damage_rheology_coupling
785786 character (len= StrKIND), pointer :: config_velocity_solver
786787 real (kind= RKIND), dimension (:), pointer :: &
787788 bedTopography, lowerSurface, upperSurface, layerThicknessFractions, beta
@@ -795,12 +796,12 @@ subroutine li_velocity_external_write_albany_mesh(domain)
795796 real (kind= RKIND), dimension (:), pointer :: surfaceAirTemperature, basalHeatFlux
796797 integer , dimension (:), pointer :: vertexMask, cellMask, edgeMask, indexToCellID
797798 real (kind= RKIND), dimension (:,:), pointer :: layerThickness
798- real (kind= RKIND), dimension (:), pointer :: stiffnessFactor
799+ real (kind= RKIND), dimension (:), pointer :: stiffnessFactor, damage
799800 real (kind= RKIND), dimension (:), pointer :: effectivePressure
800801 real (kind= RKIND), dimension (:), pointer :: muFriction
801802 integer , dimension (:,:), pointer :: dirichletVelocityMask
802803 type (mpas_pool_type), pointer :: meshPool, geometryPool, thermalPool, observationsPool, velocityPool, scratchPool, hydroPool
803- real (kind= RKIND), pointer :: config_sea_level, config_ice_density, config_ocean_density
804+ real (kind= RKIND), pointer :: config_sea_level, config_ice_density, config_ocean_density, config_damage_stiffness_min
804805 integer :: iCell
805806 integer :: err
806807
@@ -821,6 +822,8 @@ subroutine li_velocity_external_write_albany_mesh(domain)
821822 call mpas_pool_get_config(liConfigs, ' config_sea_level' , config_sea_level)
822823 call mpas_pool_get_config(liConfigs, ' config_ice_density' , config_ice_density)
823824 call mpas_pool_get_config(liConfigs, ' config_ocean_density' , config_ocean_density)
825+ call mpas_pool_get_config(liConfigs, ' config_damage_stiffness_min' , config_damage_stiffness_min)
826+ call mpas_pool_get_config(liConfigs, ' config_damage_rheology_coupling' , config_damage_rheology_coupling)
824827
825828 if (trim (config_velocity_solver) /= ' FO' ) then
826829 call mpas_log_write(" config_velocity solver needs to be set to 'FO' for config_write_albany_ascii_mesh to work." , &
@@ -847,6 +850,7 @@ subroutine li_velocity_external_write_albany_mesh(domain)
847850
848851 ! Geometry variables
849852 call mpas_pool_get_array(geometryPool, ' thickness' , thickness)
853+ call mpas_pool_get_array(geometryPool, ' damage' , damage)
850854 call mpas_pool_get_array(geometryPool, ' bedTopography' , bedTopography)
851855 call mpas_pool_get_array(geometryPool, ' lowerSurface' , lowerSurface)
852856 call mpas_pool_get_array(geometryPool, ' sfcMassBal' , sfcMassBal)
@@ -907,17 +911,29 @@ subroutine li_velocity_external_write_albany_mesh(domain)
907911
908912 ! call the C++ routine to write the mesh
909913 call mpas_log_write(" Writing Albany ASCII mesh." , flushNow= .true. )
910- call write_ascii_mesh(indexToCellID, bedTopography, lowerSurface, &
911- beta, temperature, &
912- surfaceAirTemperature, basalHeatFlux, &
913- stiffnessFactor, &
914- effectivePressure, muFriction, &
915- thickness, thicknessUncertainty, &
916- sfcMassBal, sfcMassBalUncertainty, &
917- floatingBasalMassBal, floatingBasalMassBalUncertainty, &
918- observedSurfaceVelocityX, observedSurfaceVelocityY, observedSurfaceVelocityUncertainty, &
919- observedThicknessTendency, observedThicknessTendencyUncertainty)
920-
914+ if ( config_damage_rheology_coupling ) then
915+ call write_ascii_mesh(indexToCellID, bedTopography, lowerSurface, &
916+ beta, temperature, &
917+ surfaceAirTemperature, basalHeatFlux, &
918+ max (1.0_RKIND - damage, config_damage_stiffness_min) * stiffnessFactor, &
919+ effectivePressure, muFriction, &
920+ thickness, thicknessUncertainty, &
921+ sfcMassBal, sfcMassBalUncertainty, &
922+ floatingBasalMassBal, floatingBasalMassBalUncertainty, &
923+ observedSurfaceVelocityX, observedSurfaceVelocityY, observedSurfaceVelocityUncertainty, &
924+ observedThicknessTendency, observedThicknessTendencyUncertainty)
925+ else
926+ call write_ascii_mesh(indexToCellID, bedTopography, lowerSurface, &
927+ beta, temperature, &
928+ surfaceAirTemperature, basalHeatFlux, &
929+ stiffnessFactor, &
930+ effectivePressure, muFriction, &
931+ thickness, thicknessUncertainty, &
932+ sfcMassBal, sfcMassBalUncertainty, &
933+ floatingBasalMassBal, floatingBasalMassBalUncertainty, &
934+ observedSurfaceVelocityX, observedSurfaceVelocityY, observedSurfaceVelocityUncertainty, &
935+ observedThicknessTendency, observedThicknessTendencyUncertainty)
936+ endif
921937 !----
922938
923939 call interface_reset_stdout()
0 commit comments