source: issm/trunk-jpl/test/Par/SquareSheetConstrained.py@ 26358

Last change on this file since 26358 was 26358, checked in by jdquinn, 4 years ago

CHG: Completed MATLAB -> Python updates for SE; archive updates now that GMSH can be used on macOS and Linux; various minor bug fixes; formatting; cleanup

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1import inspect
2import os.path
3import numpy as np
4from arch import *
5from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
6from paterson import paterson
7from SetIceSheetBC import SetIceSheetBC
8from verbose import verbose
9
10#Start defining model parameters here
11
12# Geometry
13hmin = 300.0
14hmax = 1000.0
15ymin = np.min(md.mesh.y)
16ymax = np.max(md.mesh.y)
17xmin = np.min(md.mesh.x)
18xmax = np.max(md.mesh.x)
19md.geometry.thickness = hmax + (hmin - hmax) * (md.mesh.y - ymin) / (ymax - ymin) + 0.1 * (hmin - hmax) * (md.mesh.x - xmin) / (xmax - xmin)
20md.geometry.base = -md.materials.rho_ice / md.materials.rho_water * md.geometry.thickness + 20.0
21md.geometry.bed = md.geometry.base
22md.geometry.surface = md.geometry.base + md.geometry.thickness
23
24#Initial velocity
25x = np.array(archread('../Data/SquareSheetConstrained.arch', 'x'))
26y = np.array(archread('../Data/SquareSheetConstrained.arch', 'y'))
27vx = np.array(archread('../Data/SquareSheetConstrained.arch', 'vx'))
28vy = np.array(archread('../Data/SquareSheetConstrained.arch', 'vy'))
29index = archread('../Data/SquareSheetConstrained.arch', 'index').astype(int)
30
31md.initialization.vx = InterpFromMeshToMesh2d(index, x, y, vx, md.mesh.x, md.mesh.y)
32md.initialization.vy = InterpFromMeshToMesh2d(index, x, y, vy, md.mesh.x, md.mesh.y)
33md.initialization.vz = np.zeros((md.mesh.numberofvertices))
34md.initialization.pressure = np.zeros((md.mesh.numberofvertices))
35
36#Materials
37md.initialization.temperature = (273.0 - 20.0) * np.ones((md.mesh.numberofvertices))
38md.materials.rheology_B = paterson(md.initialization.temperature)
39md.materials.rheology_n = 3.0 * np.ones((md.mesh.numberofelements))
40
41#Calving
42md.calving.calvingrate = np.zeros((md.mesh.numberofvertices))
43md.levelset.spclevelset = np.nan * np.ones((md.mesh.numberofvertices))
44
45#Friction
46md.friction.coefficient = 20.0 * np.ones((md.mesh.numberofvertices))
47md.friction.coefficient[np.where(md.mask.ocean_levelset < 0.0)[0]] = 0.0
48md.friction.p = np.ones((md.mesh.numberofelements))
49md.friction.q = np.ones((md.mesh.numberofelements))
50
51#Numerical parameters
52md.masstransport.stabilization = 1.0
53md.thermal.stabilization = 1.0
54md.verbose = verbose(0)
55md.settings.waitonlock = 30
56md.stressbalance.restol = 0.05
57md.steadystate.reltol = 0.05
58md.stressbalance.reltol = 0.05
59md.stressbalance.abstol = np.nan
60md.timestepping.time_step = 1.0
61md.timestepping.final_time = 3.0
62md.groundingline.migration = 'None'
63
64#Boundary conditions:
65md = SetIceSheetBC(md)
66
67#Change name so that no test have the same name
68if len(inspect.stack()) > 2:
69 md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
Note: See TracBrowser for help on using the repository browser.