[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
|
---|
[25010] | 19 | npart = 10
|
---|
| 20 | partition = partitioner(md, 'package', 'chaco', 'npart', npart) - 1
|
---|
[23257] | 21 | md.qmu.isdakota = 1
|
---|
| 22 |
|
---|
| 23 | #Dakota options
|
---|
| 24 |
|
---|
| 25 | #dakota version
|
---|
| 26 | version = IssmConfig('_DAKOTA_VERSION_')
|
---|
| 27 | version = float(version[0])
|
---|
| 28 |
|
---|
| 29 | #variables
|
---|
[24870] | 30 | md.qmu.variables.rho_ice = normal_uncertain.normal_uncertain(
|
---|
| 31 | 'descriptor', 'MaterialsRhoIce',
|
---|
| 32 | 'mean', 1,
|
---|
| 33 | 'stddev', .01
|
---|
| 34 | )
|
---|
[23257] | 35 |
|
---|
| 36 | #responses
|
---|
[24870] | 37 | md.qmu.responses.MaxVel = response_function.response_function(
|
---|
| 38 | 'descriptor', 'scaled_Thickness',
|
---|
[25010] | 39 | 'partition', partition
|
---|
[24870] | 40 | )
|
---|
[23257] | 41 |
|
---|
| 42 | #method
|
---|
| 43 | md.qmu.method = dakota_method.dakota_method('nond_l')
|
---|
| 44 |
|
---|
| 45 | #parameters
|
---|
| 46 | md.qmu.params.direct = True
|
---|
| 47 | md.qmu.params.interval_type = 'forward'
|
---|
| 48 |
|
---|
| 49 | if version >= 6:
|
---|
[23793] | 50 | md.qmu.params.analysis_driver = 'matlab'
|
---|
| 51 | md.qmu.params.evaluation_scheduling = 'master'
|
---|
| 52 | md.qmu.params.processors_per_evaluation = 2
|
---|
[23257] | 53 | else:
|
---|
[23793] | 54 | md.qmu.params.analysis_driver = 'stressbalance'
|
---|
| 55 | md.qmu.params.evaluation_concurrency = 1
|
---|
[23257] | 56 |
|
---|
[23793] | 57 | #imperative!
|
---|
[24261] | 58 | md.stressbalance.reltol = 10**-5 #tighten for qmu analysese
|
---|
[23257] | 59 |
|
---|
| 60 | #solve
|
---|
[24214] | 61 | md.verbose = verbose('000000000') # this line is recommended
|
---|
[23793] | 62 | md = solve(md, 'Stressbalance', 'overwrite', 'y')
|
---|
[23257] | 63 | md.qmu.results = md.results.dakota
|
---|
| 64 |
|
---|
| 65 | #test on thickness
|
---|
[25010] | 66 | h = np.zeros(npart)
|
---|
| 67 | for i in range(npart):
|
---|
[23793] | 68 | h[i] = md.qmu.results.dresp_out[i].mean
|
---|
[23257] | 69 |
|
---|
| 70 | #project onto grid
|
---|
[25107] | 71 | thickness = h[(partition + 1).flatten()]
|
---|
[23257] | 72 |
|
---|
| 73 | #Fields and tolerances to track changes
|
---|
[23793] | 74 | field_names = ['Thickness']
|
---|
[23257] | 75 | field_tolerances = [1e-10]
|
---|
[23793] | 76 | field_values = [thickness]
|
---|