1 | //Test Name: SquareShelfConstrainedDakotaB
|
---|
2 | var md = new model();
|
---|
3 | function zeros(...args) {
|
---|
4 | var array = [];
|
---|
5 | for (var i = 0; i < args[0]; ++i) {
|
---|
6 | array.push(args.length == 1 ? 0 : zeros(args.slice(1)));
|
---|
7 | }
|
---|
8 | return array;
|
---|
9 | }
|
---|
10 | var md = new model();
|
---|
11 | squaremesh(model(),1000000,1000000,5,5);
|
---|
12 | setmask(md,'all','');
|
---|
13 | parameterize(md);
|
---|
14 | setflowequation(md,'SSA','all');
|
---|
15 | //md.cluster=generic('name',oshostname(),'np',3);
|
---|
16 |
|
---|
17 | //redo the parameter file for this special shelf.
|
---|
18 | //constant thickness, constrained (vy=0) flow into an icefront,
|
---|
19 | //from 0 m/yr at the grounding line.
|
---|
20 |
|
---|
21 | //needed later
|
---|
22 | ymin=Math.min.apply(null, md.mesh.y);
|
---|
23 | ymax=Math.max.apply(null, md.mesh.y);
|
---|
24 | xmin=Math.min.apply(null, md.mesh.x);
|
---|
25 | xmax=Math.max.apply(null, md.mesh.x);
|
---|
26 |
|
---|
27 | di=md.materials.rho_ice/md.materials.rho_water;
|
---|
28 |
|
---|
29 | h=1000;
|
---|
30 | md.geometry.thickness=h*ones(md.mesh.numberofvertices,1);
|
---|
31 | md.geometry.base=-md.materials.rho_ice/md.materials.rho_water*md.geometry.thickness;
|
---|
32 | md.geometry.surface=md.geometry.base+md.geometry.thickness;
|
---|
33 |
|
---|
34 | //Initial velocity and pressure
|
---|
35 | md.initialization.vx=zeros(md.mesh.numberofvertices,1);
|
---|
36 | md.initialization.vy=zeros(md.mesh.numberofvertices,1);
|
---|
37 | md.initialization.vz=zeros(md.mesh.numberofvertices,1);
|
---|
38 | md.initialization.pressure=zeros(md.mesh.numberofvertices,1);
|
---|
39 |
|
---|
40 | //Materials
|
---|
41 | md.initialization.temperature=(273-20)*ones(md.mesh.numberofvertices,1);
|
---|
42 | md.materials.rheology_B=paterson(md.initialization.temperature);
|
---|
43 | md.materials.rheology_n=3*ones(md.mesh.numberofelements,1);
|
---|
44 |
|
---|
45 | //Boundary conditions:
|
---|
46 | md.stressbalance.spcvx=null*ones(md.mesh.numberofvertices,1);
|
---|
47 | md.stressbalance.spcvy=null*ones(md.mesh.numberofvertices,1);
|
---|
48 | md.stressbalance.spcvz=null*ones(md.mesh.numberofvertices,1);
|
---|
49 |
|
---|
50 | //constrain flanks to 0 normal velocity
|
---|
51 | pos=[];
|
---|
52 | for (var i = 0; i < md.mesh.x==xmin | md.mesh.x==xmax.length; ++i) {
|
---|
53 | if ((md.mesh.x==xmin | md.mesh.x==xmax[i] !== 0)) {
|
---|
54 | pos.push(i);
|
---|
55 | };
|
---|
56 | md.stressbalance.spcvx(pos)=0;
|
---|
57 | md.stressbalance.spcvz(pos)=null;
|
---|
58 |
|
---|
59 | //constrain grounding line to 0 velocity
|
---|
60 | pos=[];
|
---|
61 | for (var i = 0; i < md.mesh.y==ymin.length; ++i) {
|
---|
62 | if ((md.mesh.y==ymin[i] !== 0)) {
|
---|
63 | pos.push(i);
|
---|
64 | };
|
---|
65 | md.stressbalance.spcvx(pos)=0;
|
---|
66 | md.stressbalance.spcvy(pos)=0;
|
---|
67 |
|
---|
68 | //partitioning
|
---|
69 | md.qmu.numberofpartitions=md.mesh.numberofvertices;
|
---|
70 | partitioner(md,'package','linear','npart',md.qmu.numberofpartitions);
|
---|
71 | md.qmu.partition=md.qmu.partition-1;
|
---|
72 |
|
---|
73 | //Dakota options
|
---|
74 |
|
---|
75 | //dakota version
|
---|
76 | version=IssmConfig('_DAKOTA_VERSION_'); version=version.slice(0,2); version=str2num(version);
|
---|
77 |
|
---|
78 | //variables
|
---|
79 | md.qmu.variables.rheology_B=normal_uncertain('scaled_MaterialsRheologyB',1,.05);
|
---|
80 |
|
---|
81 | //responses
|
---|
82 | md.qmu.responses.MaxVel=response_function('MaxVel',[],[0.0001 0.001 0.01 0.25 0.5 0.75 0.99 0.999 0.9999]);
|
---|
83 |
|
---|
84 | //method
|
---|
85 | md.qmu.method =dakota_method('nond_l');
|
---|
86 |
|
---|
87 | //parameters
|
---|
88 | md.qmu.params.direct=true;
|
---|
89 | md.qmu.params.interval_type='forward';
|
---|
90 |
|
---|
91 | if (version>=6,) {
|
---|
92 | md.qmu.params.analysis_driver='matlab';
|
---|
93 | md.qmu.params.evaluation_scheduling='master';
|
---|
94 | md.qmu.params.processors_per_evaluation=2;
|
---|
95 | } else {
|
---|
96 | md.qmu.params.analysis_driver='stressbalance';
|
---|
97 | md.qmu.params.evaluation_concurrency=1;
|
---|
98 | }
|
---|
99 |
|
---|
100 | //imperative!
|
---|
101 | md.stressbalance.reltol=10^-10; //tighten for qmu analysese
|
---|
102 | md.qmu.isdakota=1;
|
---|
103 |
|
---|
104 | //solve
|
---|
105 | md=solve(md,'Stressbalance','overwrite','y');
|
---|
106 |
|
---|
107 | //Fields and tolerances to track changes
|
---|
108 | md.qmu.results=md.results.dakota;
|
---|
109 | md.results.dakota.importancefactors=importancefactors(md,'scaled_MaterialsRheologyB','MaxVel')';
|
---|
110 | field_names =['importancefactors'];
|
---|
111 | field_tolerances=[1e-10];
|
---|
112 | field_values=[
|
---|
113 | md.results.dakota.importancefactors,
|
---|
114 | ];
|
---|