1 | import numpy
|
---|
2 | from model import *
|
---|
3 | from triangle import *
|
---|
4 | from setmask import *
|
---|
5 | from parameterize import *
|
---|
6 | from setflowequation import *
|
---|
7 | from EnumDefinitions import *
|
---|
8 | from solve import *
|
---|
9 | from MatlabFuncs import *
|
---|
10 |
|
---|
11 | """
|
---|
12 | This test is a test from the ISMP-HOM Intercomparison project.
|
---|
13 | Pattyn and Payne 2006
|
---|
14 | """
|
---|
15 |
|
---|
16 | L_list=[5000.,10000.,20000.,40000.,80000.,160000.]
|
---|
17 | results=[]
|
---|
18 |
|
---|
19 | for L in L_list:
|
---|
20 | md=triangle(model(),"../Exp/Square_%d.exp" % L,L/10.) #size 3*L
|
---|
21 | md=setmask(md,'','') #ice sheet test
|
---|
22 | md=parameterize(md,'../Par/ISMIPC.py')
|
---|
23 | md.friction.coefficient=numpy.sqrt(md.constants.yts*(1000.+1000.*numpy.sin(md.mesh.x.reshape(-1,1)*2.*numpy.pi/L)*numpy.sin(md.mesh.y.reshape(-1,1)*2.*numpy.pi/L)))
|
---|
24 | md.extrude(10,1.)
|
---|
25 |
|
---|
26 | #Add spc on the borders
|
---|
27 | pos=numpy.nonzero(numpy.logical_or(numpy.logical_or(md.mesh.x==0.,md.mesh.x==numpy.max(md.mesh.x)),numpy.logical_or(md.mesh.y==0.,md.mesh.y==numpy.max(md.mesh.y))))
|
---|
28 | md.diagnostic.spcvx[pos]=0.
|
---|
29 | md.diagnostic.spcvy[pos]=0.
|
---|
30 | if (L==5000.):
|
---|
31 | md.diagnostic.spcvx[pos]=15.66
|
---|
32 | md.diagnostic.spcvy[pos]=-0.1967
|
---|
33 | elif (L==10000.):
|
---|
34 | md.diagnostic.spcvx[pos]=16.04
|
---|
35 | md.diagnostic.spcvy[pos]=-0.1977
|
---|
36 | elif (L==20000.):
|
---|
37 | md.diagnostic.spcvx[pos]=16.53
|
---|
38 | md.diagnostic.spcvy[pos]=-1.27
|
---|
39 | elif (L==40000.):
|
---|
40 | md.diagnostic.spcvx[pos]=17.23
|
---|
41 | md.diagnostic.spcvy[pos]=-3.17
|
---|
42 | elif (L==80000.):
|
---|
43 | md.diagnostic.spcvx[pos]=16.68
|
---|
44 | md.diagnostic.spcvy[pos]=-2.69
|
---|
45 | elif (L==160000.):
|
---|
46 | md.diagnostic.spcvx[pos]=16.03
|
---|
47 | md.diagnostic.spcvy[pos]=-1.27
|
---|
48 |
|
---|
49 | md=setflowequation(md,'stokes','all')
|
---|
50 |
|
---|
51 | #Compute the diagnostic
|
---|
52 | md.cluster=generic('name',oshostname(),'np',8)
|
---|
53 | md=solve(md,DiagnosticSolutionEnum())
|
---|
54 |
|
---|
55 | #Plot the results and save them
|
---|
56 | vx=md.results.DiagnosticSolution.Vx
|
---|
57 | vy=md.results.DiagnosticSolution.Vy
|
---|
58 | vz=md.results.DiagnosticSolution.Vz
|
---|
59 | results.append(md.results.DiagnosticSolution)
|
---|
60 |
|
---|
61 | # plotmodel(md,'data',vx,'data',vy,'data',vz,'layer#all',md.mesh.numberoflayers)
|
---|
62 |
|
---|
63 | #Fields and tolerances to track changes
|
---|
64 | field_names =[\
|
---|
65 | 'Vx5km','Vy5km','Vz5km',\
|
---|
66 | 'Vx10km','Vy10km','Vz10km',\
|
---|
67 | 'Vx20km','Vy20km','Vz20km',\
|
---|
68 | 'Vx40km','Vy40km','Vz40km',\
|
---|
69 | 'Vx80km','Vy80km','Vz80km',\
|
---|
70 | 'Vx160km','Vy160km','Vz160km'
|
---|
71 | ]
|
---|
72 | field_tolerances=[\
|
---|
73 | 1e-12,1e-12,1e-11,\
|
---|
74 | 1e-12,1e-12,1e-12,\
|
---|
75 | 1e-12,1e-12,1e-12,\
|
---|
76 | 1e-12,1e-12,1e-12,\
|
---|
77 | 1e-12,1e-12,1e-12,\
|
---|
78 | 1e-12,1e-11,1e-12,\
|
---|
79 | ]
|
---|
80 | field_values=[]
|
---|
81 | for result in results:
|
---|
82 | field_values=field_values+[\
|
---|
83 | result.Vx,\
|
---|
84 | result.Vy,\
|
---|
85 | result.Vz,\
|
---|
86 | ]
|
---|