[23257] | 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 |
|
---|
[23793] | 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)
|
---|
[23257] | 17 |
|
---|
| 18 | #partitioning
|
---|
| 19 | md.qmu.numberofpartitions = 10
|
---|
[23793] | 20 | md = partitioner(md, 'package', 'chaco', 'npart', md.qmu.numberofpartitions)
|
---|
| 21 | md.qmu.partition = md.qmu.partition - 1
|
---|
[23257] | 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
|
---|
[23793] | 31 | md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain('MaterialsRhoIce', md.materials.rho_ice, 0.01)
|
---|
[23257] | 32 |
|
---|
| 33 | #responses
|
---|
[23793] | 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])
|
---|
[23257] | 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:
|
---|
[23793] | 44 | md.qmu.params.analysis_driver = 'matlab'
|
---|
| 45 | md.qmu.params.evaluation_scheduling = 'master'
|
---|
| 46 | md.qmu.params.processors_per_evaluation = 2
|
---|
[23257] | 47 | else:
|
---|
[23793] | 48 | md.qmu.params.analysis_driver = 'stressbalance'
|
---|
| 49 | md.qmu.params.evaluation_concurrency = 1
|
---|
[23257] | 50 |
|
---|
[23793] | 51 | #imperative!
|
---|
| 52 | md.stressbalance.reltol = 10**-5 #tighten for qmu analysese
|
---|
[23257] | 53 |
|
---|
| 54 | #solve
|
---|
[23793] | 55 | md.verbose = verbose('000000000') # this line is recommended
|
---|
| 56 | md = solve(md, 'Stressbalance', 'overwrite', 'y')
|
---|
[23257] | 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):
|
---|
[23793] | 62 | h[i] = md.qmu.results.dresp_out[i].mean
|
---|
[23257] | 63 |
|
---|
| 64 | #project onto grid
|
---|
| 65 | thickness = h[(md.qmu.partition).flatten()]
|
---|
| 66 |
|
---|
| 67 | #Fields and tolerances to track changes
|
---|
[23793] | 68 | field_names = ['Thickness']
|
---|
[23257] | 69 | field_tolerances = [1e-10]
|
---|
[23793] | 70 | field_values = [thickness]
|
---|