1 | #Test Name: SquareSheetShelfDiadSSA3dDakotaPart
|
---|
2 | from model import *
|
---|
3 | from socket import gethostname
|
---|
4 | from triangle import *
|
---|
5 | from setmask import *
|
---|
6 | from parameterize import *
|
---|
7 | from setflowequation import *
|
---|
8 | from solve import *
|
---|
9 | from partitioner import *
|
---|
10 | from importancefactors import *
|
---|
11 |
|
---|
12 | md = triangle(model(), '../Exp/Square.exp', 150000.)
|
---|
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 | #Dakota options
|
---|
19 |
|
---|
20 | #dakota version
|
---|
21 | version = IssmConfig('_DAKOTA_VERSION_')
|
---|
22 | version = float(version[0])
|
---|
23 |
|
---|
24 | #partitioning
|
---|
25 | npart = 20
|
---|
26 | partition = partitioner(md, 'package', 'chaco', 'npart', npart, 'weighting', 'on')[0] - 1
|
---|
27 |
|
---|
28 | #variables
|
---|
29 | md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain(
|
---|
30 | 'descriptor', 'MaterialsRhoIce',
|
---|
31 | 'mean', md.materials.rho_ice,
|
---|
32 | 'stddev', .01
|
---|
33 | )
|
---|
34 | md.qmu.variables.drag_coefficient = normal_uncertain.normal_uncertain(
|
---|
35 | 'descriptor', 'scaled_FrictionCoefficient',
|
---|
36 | 'mean', np.ones((npart, 1)),
|
---|
37 | 'stddev', .01 * np.ones((npart, 1)),
|
---|
38 | 'partition', partition
|
---|
39 | )
|
---|
40 |
|
---|
41 | #responses
|
---|
42 | md.qmu.responses.MaxVel = response_function.response_function('descriptor','MaxVel')
|
---|
43 |
|
---|
44 | #method
|
---|
45 | md.qmu.method = dakota_method.dakota_method('nond_l')
|
---|
46 |
|
---|
47 | #parameters
|
---|
48 | md.qmu.params.direct = True
|
---|
49 | md.qmu.params.interval_type = 'forward'
|
---|
50 |
|
---|
51 | if version >= 6:
|
---|
52 | md.qmu.params.analysis_driver = 'matlab'
|
---|
53 | md.qmu.params.evaluation_scheduling = 'master'
|
---|
54 | md.qmu.params.processors_per_evaluation = 2
|
---|
55 | else:
|
---|
56 | md.qmu.params.analysis_driver = 'stressbalance'
|
---|
57 | md.qmu.params.evaluation_concurrency = 1
|
---|
58 |
|
---|
59 |
|
---|
60 | #imperative!
|
---|
61 | md.stressbalance.reltol = 10**-5 #tighten for qmu analyses
|
---|
62 | md.qmu.isdakota = 1
|
---|
63 |
|
---|
64 | #solve
|
---|
65 | md.verbose = verbose('000000000') # this line is recommended
|
---|
66 | md = solve(md, 'Stressbalance', 'overwrite', 'y')
|
---|
67 |
|
---|
68 | #Fields and tolerances to track changes
|
---|
69 | md.qmu.results = md.results.dakota
|
---|
70 | md.results.dakota.importancefactors = importancefactors(md, 'scaled_FrictionCoefficient', 'MaxVel', partition).T
|
---|
71 | field_names = ['importancefactors']
|
---|
72 | field_tolerances = [1e-10]
|
---|
73 | field_values = [md.results.dakota.importancefactors]
|
---|