Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmerice/examples/Inverse_Methods/MassConservation/DirectValidation/RAMP_2nd.sif
3206 views
! Test SSA and Thickness Solvers for an ice shelf ramp
!  Solutions are analytical (cf Greve. Dynamics of Ice Sheets and Glaciers, lectures note 2010, ch. 5.4)
!-----------------------------
! PARAMETERS:
!----------------------------
$name=ipar(0)
$ID="RAMP2nd"

include ../src/PARAMETERS.sif
!
Header
  Mesh DB "." "rectangle_$name$_2nd"
End

Constants
  RAMP Hgl = Real $Hgl
  RAMP Vgl = Real $V_gl
  RAMP dhdx = Real $dhdx

  RAMP RateFactor = Real $A
  RAMP Glen = Real $n
  RAMP rhoi = Real $rhoi
  RAMP rhow = Real $rhow
  RAMP gravity = Real $gravity

  sea level = Real $zsl
  water density = Real $rhow
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Simulation
  Coordinate System  = Cartesian 2D 

  Simulation Type = Steady

  Steady State Min Iterations = 1
  Steady State Max Iterations = 1

  Post File = "$ID$_$name$.vtu"

  max output level = 3
End

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Body 1
  Equation = 1
  Body Force = 1
  Material = 1
  Initial Condition = 1
End
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Initial Condition 1
! analytical SMB
  SMB = Variable Coordinate 1
    REAL procedure "RAMP" "SMB"
! analytical Thickness
  H = Variable Coordinate 1
    REAL procedure "RAMP" "Thickness"

! for the flotation need to define the bed
  bedrock = Real -1000.0

! anaytical solution for the u-velocity
  USolution 1  = Variable Coordinate 1
    REAL procedure "RAMP" "Velocity"
  USolution 2 = Real 0.0

! and thickness
  HSolution  = Variable Coordinate 1
    REAL procedure "RAMP" "Thickness"
End
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Body Force 1
  Flow BodyForce 1 = Real 0.0                          
  Flow BodyForce 2 = Real 0.0
  Flow BodyForce 3 = Real $gravity

  Top Surface Accumulation = Equals SMB
  Bottom Surface Accumulation = Real 0.0

! compute the error between model and analytical solutions
  dh = Variable H, HSolution
    REAL LUA "tx[0]-tx[1]"

  du 1 = Variable SSAVelocity 1, USolution 1
    REAL LUA "tx[0]-tx[1]"
  du 2 = Variable SSAVelocity 2, USolution 2
    REAL LUA "tx[0]-tx[1]"
End
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Material 1
! Material properties
  Viscosity Exponent = Real $1/n
  Critical Shear Rate = Real 1.0e-16

  SSA Mean Viscosity = Real $eta
  SSA Mean Density = Real $rhoi
  SSA Critical Thickness = Real $Hcr

! slip coeff for the SSA
  SSA Friction Law = String "linear"
  SSA Friction Parameter = Real 0.0
End
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Flotation : update Zs, Zb and GroundedMask from H and bedrock
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Solver 1
   Equation = "Flotation"
   Variable = GroundedMask
      Procedure = "ElmerIceSolvers" "Flotation"

   Exported Variable 1 = Zs
   Exported Variable 2 = Zb
   Exported Variable 3 = bedrock
   Exported Variable 4 = SMB
   Exported Variable 5 = -dofs 2 USolution
   Exported Variable 6 = HSolution
End
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! SSA using analytical H
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Solver 2
  Equation = "SSA"
  Variable = -dofs 2 "SSAVelocity"

  Procedure = "ElmerIceSolvers" "SSABasalSolver"

  Linear System Solver = Direct
  Linear System Direct Method = umfpack

  Nonlinear System Max Iterations = 20
  Nonlinear System Convergence Tolerance  = 1.0e-09
  Nonlinear System Newton After Iterations = 5
  Nonlinear System Newton After Tolerance = 1.0e-06
  Nonlinear System Relaxation Factor = 1.00

  Steady State convergence tolerance = Real 1.0e-5
End
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Steady state H from anlytical velocity and SMB
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Solver 3
   Equation = "Thickness"
   Variable = -dofs 1 "H"

   Procedure = "ElmerIceSolvers" "AdjointThickness_ThicknessSolver"

  Linear System Solver = Direct
  Linear System Direct Method = umfpack

!!  the convection velocity (mean horizontal velocity)
  Flow Solution Name = String "USolution"
End

!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
! Compute the difference and save results
!%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Solver 4
  Equation = "Compare"
  Variable = -nooutput upd
  Procedure = "ElmerIceSolvers" "UpdateExport"

  Exported Variable 1 = dh
  Exported Variable 2 = -dofs 2 "du"
End

Solver 5 
 Exec Solver = After All
 Equation = "SaveScalars"

 Procedure = "SaveData" "SaveScalars"

 Filename = "$ID$_$name$.dat"

 Variable 1 = h
 Operator 1 = dofs

 Variable 2 = dh
 Operator 2 = rms

 Variable 3 = du
 Operator 3 = rms
End
!!######################
Equation 1
  Active Solvers(4) = 1 2 3 4
End
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Boundary Condition 1
  name = "Sides"
  Target Boundaries(2) = 1 3
   
  SSAVelocity 2 = Real 0.0
End

Boundary Condition 2
  name = "calving front"
  Target Boundaries = 2
  
  Calving Front = Logical True
End

Boundary Condition 3
  name = "inflow"
  Target Boundaries = 4
  SSAVelocity 1 = Real $V_gl
  SSAVelocity 2 = Real 0.0

  H = Real $Hgl
End