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

Last change on this file since 25129 was 25129, checked in by jdquinn, 5 years ago

CHG: Saving progress on MATLAB to Python translations (still need to track down marshalling bug on Python side)

  • Property svn:executable set to *
File size: 2.9 KB
RevLine 
[13636]1import os.path
[21657]2import numpy as np
[13636]3import inspect
[16170]4from verbose import verbose
[13636]5from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
[16170]6from paterson import paterson
7from SetIceSheetBC import SetIceSheetBC
[21170]8from arch import *
[13636]9
10#Start defining model parameters here
11
12#Geometry
[24214]13hmin = 300.
14hmax = 1000.
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.
21md.geometry.surface = md.geometry.base + md.geometry.thickness
[13636]22
[24214]23#Initial velocity
24x = np.array(archread('../Data/SquareSheetConstrained.arch', 'x'))
25y = np.array(archread('../Data/SquareSheetConstrained.arch', 'y'))
26vx = np.array(archread('../Data/SquareSheetConstrained.arch', 'vx'))
27vy = np.array(archread('../Data/SquareSheetConstrained.arch', 'vy'))
28index = archread('../Data/SquareSheetConstrained.arch', 'index').astype(int)
[13636]29
[24214]30md.initialization.vx = InterpFromMeshToMesh2d(index, x, y, vx, md.mesh.x, md.mesh.y)[0]
31md.initialization.vy = InterpFromMeshToMesh2d(index, x, y, vy, md.mesh.x, md.mesh.y)[0]
32md.initialization.vz = np.zeros((md.mesh.numberofvertices))
33md.initialization.pressure = np.zeros((md.mesh.numberofvertices))
[13636]34
35#Materials
[24214]36md.initialization.temperature = (273. - 20.) * np.ones((md.mesh.numberofvertices))
37md.materials.rheology_B = paterson(md.initialization.temperature)
38md.materials.rheology_n = 3. * np.ones((md.mesh.numberofelements))
[13636]39
[18761]40#Calving
[24214]41md.calving.calvingrate = np.zeros((md.mesh.numberofvertices))
42md.levelset.spclevelset = np.nan * np.ones((md.mesh.numberofvertices))
[17438]43
[13636]44#Friction
[24214]45md.friction.coefficient = 20. * np.ones((md.mesh.numberofvertices))
[24862]46md.friction.coefficient[np.where(md.mask.ocean_levelset < 0.)[0]] = 0.
[24214]47md.friction.p = np.ones((md.mesh.numberofelements))
48md.friction.q = np.ones((md.mesh.numberofelements))
[13636]49
50#Numerical parameters
[24214]51md.masstransport.stabilization = 1.
52md.thermal.stabilization = 1.
53md.verbose = verbose(0)
54md.settings.waitonlock = 30
55md.stressbalance.restol = 0.05
56md.steadystate.reltol = 0.05
57md.stressbalance.reltol = 0.05
58md.stressbalance.abstol = np.nan
59md.timestepping.time_step = 1.
60md.timestepping.final_time = 3.
61md.groundingline.migration = 'None'
[13636]62
[14826]63#GIA:
[24214]64md.gia.lithosphere_thickness = 100. * np.ones((md.mesh.numberofvertices)) # in km
[25129]65md.gia.mantle_viscosity = 1.e21 * np.ones((md.mesh.numberofvertices)) # in Pa.s
66md.materials.lithosphere_shear_modulus = 6.7e10 # in Pa
[24214]67md.materials.lithosphere_density = 3.32 # in g / cm^ - 3
[25129]68md.materials.mantle_shear_modulus = 1.45e11 # in Pa
[24214]69md.materials.mantle_density = 3.34 # in g / cm^ - 3
[14826]70
[13636]71#Boundary conditions:
[24214]72md = SetIceSheetBC(md)
[13636]73
74#Change name so that no test have the same name
75if len(inspect.stack()) > 2:
[24214]76 md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
Note: See TracBrowser for help on using the repository browser.