This is the runme.py
import sys
import numpy as np
from issmversion import issmversion
from model import *
from plotmodel import *
#from mesh2d import *
from triangle import *
from parameterize import *
from setmask import *
from hydrologyshakti import *
from transient import *
from solve import *
# STEP 1
print(" Step 1: Mesh")
md=triangle(model(),'./outline.exp',20);
## plot
plotmodel(md,"mesh", 'data','mesh')
# STEP 2
print(" Step 2: Parameterization")
md=setmask(md,'','');
md=parameterize(md,'moulin.par.py')
## HYDROLOGY SPECIFIC PARAMETERIZATION:
md.hydrology=hydrolyshakti()
## Define initial water head such that water pressure is 50%
## of ice overburden P
md.hydrology.head = 0.5*md.materials.rho_ice/md.materials.rho_freshwater*md.geometry.thickness + md.geometry.base
## Initial subglacial gap height of 0.01m everywhere
md.hydrology.gap_height = 0.01*np.ones((md.mesh.numberofelements))
## Typical bed bump bump spacing (2m)
md.hydrology.bump_spacing = 2*np.ones((md.mesh.numberofelements))
## Typical bed bump height (0.1m)
md.hydrology.bump_height = 0.1*np.ones((md.mesh.numberofelements))
## Define distributed englacial input to the subglacial system (m/yr)
## Change the value 0.0 to add distributed input
md.hydrology.englacial_input = 0.0*np.ones((md.mesh.numberofvertices))
## Initial Reynolds number (start at Re=1000 everywhere)
md.hydrology.reynolds= 1000*np.ones((md.mesh.numberofelements))
## Set up atmospheric pressure Type I boundary condition at left edge
## of domain (outflow, i.e. h=zb at x=xmin)
md.hydrology.spchead = float('NaN') * np.ones((md.mesh.numberofvertices))
pos = np.nonzero(np.logical_and(md.mesh.vertexonboundary, (md.mesh.x==min(md.mesh.x))))[0]
md.hydrology.spchead[pos]=md.geometry.base[pos]
## plot
plotmodel(md,"init", 'data', md.geometry.base, 'title', 'Bed elevation in m',
'data', md.geometry.surface, 'title', 'Surface elevation in m',
'data', md.hydrology.head, 'title', 'Head in m',
'data', md.hydrology.gap_height, 'title', 'Gap height in m')
#STEP 3
print(" Step 3: Solve!")
md.transient.deactivateall()
md.transient.ishydrology=1
## Specify that you want to run the model on your current computer
## Change the number of processors according to your machine
md.cluster=generic('np',1);
## time stepping
md.timestepping.time_step=3600./md.constants.yts
md.timestepping.final_time=30.0/365.0
time = np.arange(md.timestepping.start_time, md.timestepping.final_time + md.timestepping.time_step, md.timestepping.time_step)
num_ts = len(time)
print("final time ?", md.timestepping.final_time)
print("time stepping ?", md.timestepping.time_step)
print("number of ts ?", num_ts)
## Add one moulin with steady input at x=500, y=500
md.hydrology.moulin_input = np.zeros((md.mesh.numberofvertices+1, num_ts))
md.hydrology.moulin_input[-1,:] = time
pos = np.where((np.sqrt((md.mesh.x - 500.)**2+(md.mesh.y - 500.)**2))==np.nanmin(np.sqrt((md.mesh.x - 500.)**2+(md.mesh.y - 500.)**2)))
md.hydrology.moulin_input[pos,:] = 4
## BC
md.hydrology.neumannflux=np.zeros((md.mesh.numberofelements+1, num_ts))
md.hydrology.neumannflux[-1,:] = time
## verbose
md.verbose.solution=1
## solve
md=solve(md,'Transient')
## plot
plotmodel(md,"finalSol", 'data', md.results.TransientSolution[-1].EffectivePressure, 'title', 'Pressure effective in Pa',
'data', md.results.TransientSolution[-1].HydrologyHead, 'title', 'Head in m',
'data', md.results.TransientSolution[-1].HydrologyBasalFlux, 'title', 'Basal water flux in m2s-1',
'data', md.results.TransientSolution[-1].HydrologyGapHeight, 'title', 'Gap height in m ')
This is the moulin.par.py
mport numpy as np
from frictionshakti import *
from verbose import *
from SetIceSheetBC import *
#Start defining model parameters here
# Set up bed topography and ice geometry for a tilted 500m thick slab
md.geometry.base = .02*md.mesh.x
md.geometry.bed = md.geometry.base
md.geometry.surface = .02*md.mesh.x + 500.
md.geometry.thickness = md.geometry.surface - md.geometry.bed
# Define ice sliding velocity (m/yr)
md.initialization.vx = 1.0e-6*md.constants.yts*np.ones((md.mesh.numberofvertices))
md.initialization.vy = np.zeros((md.mesh.numberofvertices))
md.initialization.pressure=np.zeros((md.mesh.numberofvertices))
md.initialization.pressure=np.zeros((md.mesh.numberofvertices))
# Materials
# Ice flow law parameter (note that the standard parameter A=B^(-3))
# Not sure about this one in matlab it is (5e-25)^(-1/3)
md.materials.rheology_B= (5.e-25)**(-1/3)*np.ones((md.mesh.numberofvertices))
md.initialization.temperature=(273.)*np.ones((md.mesh.numberofvertices))
md.materials.rheology_n=3.*np.ones((md.mesh.numberofelements))
#Calving
md.calving.calvingrate=np.zeros((md.mesh.numberofvertices))
# Friction law and coefficient
md.friction=frictionshakti(md)
md.friction.coefficient=20.*np.ones((md.mesh.numberofvertices))
#Numerical parameters
#md.stressbalance.viscosity_overshoot=0.0;
md.masstransport.stabilization=1.
md.thermal.stabilization=1.
md.verbose=verbose(0)
md.settings.waitonlock=30
md.stressbalance.restol=0.05
md.steadystate.reltol=0.05
md.stressbalance.reltol=0.05
md.stressbalance.abstol=float('NaN')
md.timestepping.time_step=1.
md.timestepping.final_time=3.
#GIA:
md.gia.lithosphere_thickness=100.*np.ones((md.mesh.numberofvertices)) # in km
md.gia.mantle_viscosity=1.e+21*np.ones((md.mesh.numberofvertices)) # in Pa.s
md.materials.lithosphere_shear_modulus=6.7*1.0e+10 # in Pa
md.materials.lithosphere_density=3.32 # in g/cm^-3
md.materials.mantle_shear_modulus=1.45*1.0e+11 # in Pa
md.materials.mantle_density=3.34 # in g/cm^-3
#Boundary conditions:
md=SetIceSheetBC(md)
#Change name so that no test have the same name
#A=dbstack
#if (length(A)>2):
# md.miscellaneous.name=A(3).file(1:end-2)