1 | #Test Name: SquareSheetShelfDakotaScaledResponse
|
---|
2 | import numpy as np
|
---|
3 | from model import *
|
---|
4 | from socket import gethostname
|
---|
5 | from triangle import *
|
---|
6 | from setmask import *
|
---|
7 | from parameterize import *
|
---|
8 | from setflowequation import *
|
---|
9 | from solve import *
|
---|
10 | from partitioner import *
|
---|
11 |
|
---|
12 | md = triangle(model(), '../Exp/Square.exp', 200000.)
|
---|
13 | md = setmask(md, '../Exp/SquareShelf.exp', '')
|
---|
14 | md = parameterize(md, '../Par/SquareSheetShelf.py')
|
---|
15 | md = setflowequation(md, 'SSA', 'all')
|
---|
16 | md.cluster = generic('name', gethostname(), 'np', 3)
|
---|
17 |
|
---|
18 | #partitioning
|
---|
19 | md.qmu.numberofpartitions = 10
|
---|
20 | md = partitioner(md, 'package', 'chaco', 'npart', md.qmu.numberofpartitions)
|
---|
21 | md.qmu.vpartition = md.qmu.vpartition - 1
|
---|
22 | md.qmu.isdakota = 1
|
---|
23 |
|
---|
24 | #Dakota options
|
---|
25 |
|
---|
26 | #dakota version
|
---|
27 | version = IssmConfig('_DAKOTA_VERSION_')
|
---|
28 | version = float(version[0])
|
---|
29 |
|
---|
30 | #variables
|
---|
31 | md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain('MaterialsRhoIce', md.materials.rho_ice, 0.01)
|
---|
32 |
|
---|
33 | #responses
|
---|
34 | md.qmu.responses.MaxVel = response_function.response_function('scaled_Thickness', [], [0.0001, 0.001, 0.01, 0.25, 0.5, 0.75, 0.99, 0.999, 0.9999])
|
---|
35 |
|
---|
36 | #method
|
---|
37 | md.qmu.method = dakota_method.dakota_method('nond_l')
|
---|
38 |
|
---|
39 | #parameters
|
---|
40 | md.qmu.params.direct = True
|
---|
41 | md.qmu.params.interval_type = 'forward'
|
---|
42 |
|
---|
43 | if version >= 6:
|
---|
44 | md.qmu.params.analysis_driver = 'matlab'
|
---|
45 | md.qmu.params.evaluation_scheduling = 'master'
|
---|
46 | md.qmu.params.processors_per_evaluation = 2
|
---|
47 | else:
|
---|
48 | md.qmu.params.analysis_driver = 'stressbalance'
|
---|
49 | md.qmu.params.evaluation_concurrency = 1
|
---|
50 |
|
---|
51 | #imperative!
|
---|
52 | md.stressbalance.reltol = 10**-5 #tighten for qmu analysese
|
---|
53 |
|
---|
54 | #solve
|
---|
55 | md.verbose = verbose('000000000') # this line is recommended
|
---|
56 | md = solve(md, 'Stressbalance', 'overwrite', 'y')
|
---|
57 | md.qmu.results = md.results.dakota
|
---|
58 |
|
---|
59 | #test on thickness
|
---|
60 | h = np.zeros((md.qmu.numberofpartitions, ))
|
---|
61 | for i in range(md.qmu.numberofpartitions):
|
---|
62 | h[i] = md.qmu.results.dresp_out[i].mean
|
---|
63 |
|
---|
64 | #project onto grid
|
---|
65 | thickness = h[(md.qmu.vpartition).flatten()]
|
---|
66 |
|
---|
67 | #Fields and tolerances to track changes
|
---|
68 | field_names = ['Thickness']
|
---|
69 | field_tolerances = [1e-10]
|
---|
70 | field_values = [thickness]
|
---|