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
RevLine 
[26358]1import inspect
[13636]2import os.path
[21657]3import numpy as np
[26358]4from arch import *
[13636]5from InterpFromMeshToMesh2d import InterpFromMeshToMesh2d
[16170]6from paterson import paterson
7from SetIceSheetBC import SetIceSheetBC
[26358]8from verbose import verbose
[13636]9
10#Start defining model parameters here
11
[26358]12# Geometry
13hmin = 300.0
14hmax = 1000.0
[24214]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)
[26358]20md.geometry.base = -md.materials.rho_ice / md.materials.rho_water * md.geometry.thickness + 20.0
[26066]21md.geometry.bed = md.geometry.base
[24214]22md.geometry.surface = md.geometry.base + md.geometry.thickness
[13636]23
[24214]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)
[13636]30
[25455]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)
[24214]33md.initialization.vz = np.zeros((md.mesh.numberofvertices))
34md.initialization.pressure = np.zeros((md.mesh.numberofvertices))
[13636]35
36#Materials
[26358]37md.initialization.temperature = (273.0 - 20.0) * np.ones((md.mesh.numberofvertices))
[24214]38md.materials.rheology_B = paterson(md.initialization.temperature)
[26358]39md.materials.rheology_n = 3.0 * np.ones((md.mesh.numberofelements))
[13636]40
[18761]41#Calving
[24214]42md.calving.calvingrate = np.zeros((md.mesh.numberofvertices))
43md.levelset.spclevelset = np.nan * np.ones((md.mesh.numberofvertices))
[17438]44
[13636]45#Friction
[26358]46md.friction.coefficient = 20.0 * np.ones((md.mesh.numberofvertices))
47md.friction.coefficient[np.where(md.mask.ocean_levelset < 0.0)[0]] = 0.0
[24214]48md.friction.p = np.ones((md.mesh.numberofelements))
49md.friction.q = np.ones((md.mesh.numberofelements))
[13636]50
51#Numerical parameters
[26358]52md.masstransport.stabilization = 1.0
53md.thermal.stabilization = 1.0
[24214]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
[26358]60md.timestepping.time_step = 1.0
61md.timestepping.final_time = 3.0
[24214]62md.groundingline.migration = 'None'
[13636]63
64#Boundary conditions:
[24214]65md = SetIceSheetBC(md)
[13636]66
67#Change name so that no test have the same name
68if len(inspect.stack()) > 2:
[24214]69 md.miscellaneous.name = os.path.basename(inspect.stack()[2][1]).split('.')[0]
Note: See TracBrowser for help on using the repository browser.