[21337] | 1 | Index: ../trunk-jpl/src/m/extrusion/project2d.js
|
---|
| 2 | ===================================================================
|
---|
| 3 | --- ../trunk-jpl/src/m/extrusion/project2d.js (revision 0)
|
---|
| 4 | +++ ../trunk-jpl/src/m/extrusion/project2d.js (revision 20883)
|
---|
| 5 | @@ -0,0 +1,46 @@
|
---|
| 6 | +function project2d(md3d,value,layer) {
|
---|
| 7 | + // PROJECT2D - returns the value of a field for a given layer of the mesh
|
---|
| 8 | + //
|
---|
| 9 | + // returns the value of a vector for a given layer from extruded mesh onto the 2d mesh
|
---|
| 10 | + // used to do the extrusion. This function is used to compare values between different
|
---|
| 11 | + // layers of a 3d mesh.
|
---|
| 12 | + //
|
---|
| 13 | + // Usage:
|
---|
| 14 | + // projection_value=project2d(md3d,value,layer)
|
---|
| 15 | + //
|
---|
| 16 | + // Example:
|
---|
| 17 | + // vel2=project2d(md3d,md3d.initialization.vel,2);
|
---|
| 18 | + // returns the velocity of the second layer (1 is the base)
|
---|
| 19 | +
|
---|
| 20 | + // some checks on list of arguments
|
---|
| 21 | + if (arguments.length !== 3) {
|
---|
| 22 | + console.error('project2d error message');
|
---|
| 23 | + }
|
---|
| 24 | +
|
---|
| 25 | + if (md3d.mesh.domaintype() !== '3D') {
|
---|
| 26 | + console.error("wrong model type ... should be ''3d''");
|
---|
| 27 | + }
|
---|
| 28 | +
|
---|
| 29 | + if (layer<1 || layer>md3d.mesh.numberoflayers) {
|
---|
| 30 | + console.error(['layer must be between 1 and ' + num2str(md3d.mesh.numberoflayers)]);
|
---|
| 31 | + }
|
---|
| 32 | +
|
---|
| 33 | + // Return the projection value
|
---|
| 34 | + var temp = [];
|
---|
| 35 | + if (value.length === md3d.mesh.numberofvertices) {
|
---|
| 36 | + for (var i = (layer-1)*md3d.mesh.numberofvertices2d; i <= layer*md3d.mesh.numberofvertices2d; ++i) {
|
---|
| 37 | + temp.push(value[i]);
|
---|
| 38 | + }
|
---|
| 39 | + } else if (value.length === md3d.mesh.numberofvertices+1) {
|
---|
| 40 | + for (var i = (layer-1)*md3d.mesh.numberofvertices2d; i <= layer*md3d.mesh.numberofvertices2d; ++i) {
|
---|
| 41 | + temp.push(value[i]);
|
---|
| 42 | + }
|
---|
| 43 | + temp.push(value[value.length-1]);
|
---|
| 44 | + } else {
|
---|
| 45 | + for (var i = (layer-1)*md3d.mesh.numberofelements; i <= layer*md3d.mesh.numberofelements2d; ++i) {
|
---|
| 46 | + temp.push(value[i]);
|
---|
| 47 | + }
|
---|
| 48 | + }
|
---|
| 49 | +
|
---|
| 50 | + return temp;
|
---|
| 51 | +}
|
---|
| 52 | Index: ../trunk-jpl/src/m/extrusion/DepthAverage.js
|
---|
| 53 | ===================================================================
|
---|
| 54 | --- ../trunk-jpl/src/m/extrusion/DepthAverage.js (revision 0)
|
---|
| 55 | +++ ../trunk-jpl/src/m/extrusion/DepthAverage.js (revision 20883)
|
---|
| 56 | @@ -0,0 +1,52 @@
|
---|
| 57 | +function DepthAverage(md,vector) {
|
---|
| 58 | + // DEPTHAVERAGE - computes depth average of 3d vector using the trapezoidal rule, and returns the value on 2d mesh.
|
---|
| 59 | + //
|
---|
| 60 | + // Usage:
|
---|
| 61 | + // vector_average=DepthAverage(md,vector);
|
---|
| 62 | + //
|
---|
| 63 | + // Example:
|
---|
| 64 | + // vel_bar=DepthAverage(md,md.initialization.vel);
|
---|
| 65 | +
|
---|
| 66 | + // check that the model given in input is 3d
|
---|
| 67 | + if (md.mesh.elementtype() !== 'Penta') {
|
---|
| 68 | + console.error('DepthAverage error message: the model given in input must be 3d');
|
---|
| 69 | + }
|
---|
| 70 | +
|
---|
| 71 | + // nods data
|
---|
| 72 | + if (vector.length === md.mesh.numberofvertices) {
|
---|
| 73 | + var vector_average=zeros(md.mesh.numberofvertices2d,1);
|
---|
| 74 | +
|
---|
| 75 | + for (var i = 1; i < md.mesh.numberoflayers-1; ++i) {
|
---|
| 76 | + vector_average = vector_average.map(function(x) {
|
---|
| 77 | + return x + (project2d(md, vector, i) + project2d(md,vector,i+1))/2;
|
---|
| 78 | + }).map(function(y) {
|
---|
| 79 | + return y * (project2d(md, md.mesh.z, i+1) - project2d(md, md.mesh.z, i));
|
---|
| 80 | + });
|
---|
| 81 | + }
|
---|
| 82 | +
|
---|
| 83 | + vector_average = vector_average.map(function(z) {
|
---|
| 84 | + return z / project2d(md, md.geometry.thickness, 1);
|
---|
| 85 | + });
|
---|
| 86 | +
|
---|
| 87 | + return vector_average;
|
---|
| 88 | + }
|
---|
| 89 | + // element data
|
---|
| 90 | + else if (vector.length === md.mesh.numberofelements) {
|
---|
| 91 | + var vector_average=zeros(md.mesh.numberofelements2d,1);
|
---|
| 92 | + for (var i = 1; i < md.mesh.numberoflayers-1; ++i) {
|
---|
| 93 | + vector_average = vector_average.map(function(x) {
|
---|
| 94 | + return x + project2d(md, vector, i);
|
---|
| 95 | + }).map(function(y) {
|
---|
| 96 | + return y * (project2d(md, md.mesh.z, i+1) - project2d(md, md.mesh.z, i));
|
---|
| 97 | + });
|
---|
| 98 | + }
|
---|
| 99 | +
|
---|
| 100 | + vector_average = vector_average.map(function(z) {
|
---|
| 101 | + return z / project2d(md, md.geometry.thickness, 1);
|
---|
| 102 | + });
|
---|
| 103 | +
|
---|
| 104 | + return vector_average;
|
---|
| 105 | + } else {
|
---|
| 106 | + console.error('vector size not supported yet');
|
---|
| 107 | + }
|
---|
| 108 | +}
|
---|
| 109 | Index: ../trunk-jpl/src/m/mesh/meshconvert.js
|
---|
| 110 | ===================================================================
|
---|
| 111 | --- ../trunk-jpl/src/m/mesh/meshconvert.js (revision 0)
|
---|
| 112 | +++ ../trunk-jpl/src/m/mesh/meshconvert.js (revision 20883)
|
---|
| 113 | @@ -0,0 +1,49 @@
|
---|
| 114 | +this.meshconvert = function(md,varargin)) {
|
---|
| 115 | +function zeros(...args) {
|
---|
| 116 | + var array = [];
|
---|
| 117 | + for (var i = 0; i < args[0]; ++i) {
|
---|
| 118 | + array.push(args.length == 1 ? 0 : zeros(args.slice(1)));
|
---|
| 119 | + }
|
---|
| 120 | + return array;
|
---|
| 121 | +}
|
---|
| 122 | +var md = new model();
|
---|
| 123 | +//CONVERTMESH - convert mesh to bamg mesh
|
---|
| 124 | +//
|
---|
| 125 | +// Usage:
|
---|
| 126 | +// md=meshconvert(md);
|
---|
| 127 | +// md=meshconvert(md,index,x,y);
|
---|
| 128 | +
|
---|
| 129 | +if (nargin~=1 & nargin~=4,) {
|
---|
| 130 | + help meshconvert
|
---|
| 131 | + console.error('meshconvert error message: bad usage');
|
---|
| 132 | +}
|
---|
| 133 | +
|
---|
| 134 | +if (nargin==1,) {
|
---|
| 135 | + index = md.mesh.elements;
|
---|
| 136 | + x = md.mesh.x;
|
---|
| 137 | + y = md.mesh.y;
|
---|
| 138 | +} else {
|
---|
| 139 | + index = varargin[0];
|
---|
| 140 | + x = varargin[1];
|
---|
| 141 | + y = varargin[2];
|
---|
| 142 | +}
|
---|
| 143 | +
|
---|
| 144 | +//call Bamg
|
---|
| 145 | +[bamgmesh_out bamggeom_out]=BamgConvertMesh(index,x,y);
|
---|
| 146 | +
|
---|
| 147 | +// plug results onto model
|
---|
| 148 | +md.private.bamg = struct();
|
---|
| 149 | +md.private.bamg.mesh = bamgmesh(bamgmesh_out);
|
---|
| 150 | +md.private.bamg.geometry = bamggeom(bamggeom_out);
|
---|
| 151 | +md.mesh.x = bamgmesh_out.Vertices(:,1);
|
---|
| 152 | +md.mesh.y = bamgmesh_out.Vertices(:,2);
|
---|
| 153 | +md.mesh.elements = bamgmesh_out.Triangles(:,1:3);
|
---|
| 154 | +md.mesh.edges = bamgmesh_out.IssmEdges;
|
---|
| 155 | +md.mesh.segments = bamgmesh_out.IssmSegments(:,1:3);
|
---|
| 156 | +md.mesh.segmentmarkers = bamgmesh_out.IssmSegments(:,4);
|
---|
| 157 | +
|
---|
| 158 | +//Fill in rest of fields:
|
---|
| 159 | +md.mesh.numberofelements = size(md.mesh.elements,1);
|
---|
| 160 | +md.mesh.numberofvertices = length(md.mesh.x);
|
---|
| 161 | +md.mesh.numberofedges = size(md.mesh.edges,1);
|
---|
| 162 | +md.mesh.vertexonboundary = zeros(md.mesh.numberofvertices,1); md.mesh.vertexonboundary(md.mesh.segments(:,1:2)) = 1;
|
---|
| 163 | Index: ../trunk-jpl/src/m/classes/model.js
|
---|
| 164 | ===================================================================
|
---|
| 165 | --- ../trunk-jpl/src/m/classes/model.js (revision 20882)
|
---|
| 166 | +++ ../trunk-jpl/src/m/classes/model.js (revision 20883)
|
---|
| 167 | @@ -153,7 +153,7 @@
|
---|
| 168 |
|
---|
| 169 | numlayers=extrusionlist.length;
|
---|
| 170 | } else if (argc==3) { //one polynomial law
|
---|
| 171 | - if (arguments[2]<=0) {
|
---|
| 172 | + if (arguments[1]<=0) {
|
---|
| 173 | //help extrude;
|
---|
| 174 | throw 'extrusionexponent must be >=0';
|
---|
| 175 | }
|
---|
| 176 | @@ -162,7 +162,7 @@
|
---|
| 177 | extrusionlist = [];
|
---|
| 178 |
|
---|
| 179 | for (var i = 0; i < numlayers; i++) {
|
---|
| 180 | - extrusionlist.push(Math.pow(i/(numlayers-1), arguments[2]));
|
---|
| 181 | + extrusionlist.push(Math.pow(i/(numlayers-1), arguments[1]));
|
---|
| 182 | };
|
---|
| 183 |
|
---|
| 184 | } else if (argc==4) { //two polynomial laws
|
---|
| 185 | @@ -264,8 +264,8 @@
|
---|
| 186 | //lowervertex=NaN*ones(number_nodes3d,1);
|
---|
| 187 | //uppervertex=NaN*ones(number_nodes3d,1);
|
---|
| 188 |
|
---|
| 189 | - lowervertex = fillArray(null, number_nodes3d);
|
---|
| 190 | - uppervertex = fillArray(null, number_nodes3d);
|
---|
| 191 | + lowervertex = fillArray(NaN, number_nodes3d);
|
---|
| 192 | + uppervertex = fillArray(NaN, number_nodes3d);
|
---|
| 193 |
|
---|
| 194 | //lowervertex(md.mesh.numberofvertices+1:end)=1:(numlayers-1)*md.mesh.numberofvertices;
|
---|
| 195 | //uppervertex(1:(numlayers-1)*md.mesh.numberofvertices)=md.mesh.numberofvertices+1:number_nodes3d;
|
---|
| 196 | @@ -282,8 +282,8 @@
|
---|
| 197 | md.mesh.uppervertex=uppervertex;
|
---|
| 198 |
|
---|
| 199 | //same for lower and upper elements
|
---|
| 200 | - lowerelements = fillArray(null, number_el3d);
|
---|
| 201 | - upperelements = fillArray(null, number_el3d);
|
---|
| 202 | + lowerelements = fillArray(NaN, number_el3d);
|
---|
| 203 | + upperelements = fillArray(NaN, number_el3d);
|
---|
| 204 | //lowerelements(md.mesh.numberofelements+1:end)=1:(numlayers-2)*md.mesh.numberofelements;
|
---|
| 205 | //upperelements(1:(numlayers-2)*md.mesh.numberofelements)=md.mesh.numberofelements+1:(numlayers-1)*md.mesh.numberofelements;
|
---|
| 206 |
|
---|
| 207 | @@ -325,64 +325,254 @@
|
---|
| 208 | md.mesh.lat=project3d(md,'vector',md.mesh.lat,'type','node');
|
---|
| 209 | md.mesh.long=project3d(md,'vector',md.mesh.long,'type','node');
|
---|
| 210 |
|
---|
| 211 | - md.geometry=md.geometry.extrude(md);
|
---|
| 212 | - md.friction=md.friction.extrude(md);
|
---|
| 213 | - md.inversion=md.inversion.extrude(md);
|
---|
| 214 | - md.smb=md.smb.extrude(md);
|
---|
| 215 | - md.initialization=md.initialization.extrude(md);
|
---|
| 216 | + //md.geometry=md.geometry.extrude(md);
|
---|
| 217 | + //md.friction=md.friction.extrude(md);
|
---|
| 218 | + //md.inversion=md.inversion.extrude(md);
|
---|
| 219 | + //md.smb=md.smb.extrude(md);
|
---|
| 220 | + //md.initialization=md.initialization.extrude(md);
|
---|
| 221 |
|
---|
| 222 | - md.flowequation=md.flowequation.extrude(md);
|
---|
| 223 | - md.stressbalance=md.stressbalance.extrude(md);
|
---|
| 224 | - md.thermal=md.thermal.extrude(md);
|
---|
| 225 | - md.masstransport=md.masstransport.extrude(md);
|
---|
| 226 | - md.levelset=md.levelset.extrude(md);
|
---|
| 227 | - md.calving=md.calving.extrude(md);
|
---|
| 228 | - md.hydrology = md.hydrology.extrude(md);
|
---|
| 229 | + //md.flowequation=md.flowequation.extrude(md);
|
---|
| 230 | + //md.stressbalance=md.stressbalance.extrude(md);
|
---|
| 231 | + //md.thermal=md.thermal.extrude(md);
|
---|
| 232 | + //md.masstransport=md.masstransport.extrude(md);
|
---|
| 233 | + //md.levelset=md.levelset.extrude(md);
|
---|
| 234 | + //md.calving=md.calving.extrude(md);
|
---|
| 235 | + //md.hydrology = md.hydrology.extrude(md);
|
---|
| 236 |
|
---|
| 237 | - //connectivity
|
---|
| 238 | - //if ~isnan(md.mesh.elementconnectivity)
|
---|
| 239 | + ////connectivity
|
---|
| 240 | + ////if ~isnan(md.mesh.elementconnectivity)
|
---|
| 241 |
|
---|
| 242 | - if (md.mesh.elementconnectivity.every(function(e, i, arr) { return e !== null && typeof e !== 'undefined'; })) {
|
---|
| 243 | - var temparr = [];
|
---|
| 244 | - for (var i = 0; i < numlayers; i++) {
|
---|
| 245 | - temparr.push(md.mesh.elementconnectivity);
|
---|
| 246 | - };
|
---|
| 247 | + //if (md.mesh.elementconnectivity.every(function(e, i, arr) { return e !== null && typeof e !== 'undefined'; })) {
|
---|
| 248 | + //var temparr = [];
|
---|
| 249 | + //for (var i = 0; i < numlayers; i++) {
|
---|
| 250 | + //temparr.push(md.mesh.elementconnectivity);
|
---|
| 251 | + //};
|
---|
| 252 |
|
---|
| 253 | - //md.mesh.elementconnectivity=repmat(md.mesh.elementconnectivity,numlayers-1,1);
|
---|
| 254 | + ////md.mesh.elementconnectivity=repmat(md.mesh.elementconnectivity,numlayers-1,1);
|
---|
| 255 |
|
---|
| 256 | - md.mesh.elementconnectivity = temparr;
|
---|
| 257 | + //md.mesh.elementconnectivity = temparr;
|
---|
| 258 |
|
---|
| 259 | - //md.mesh.elementconnectivity(find(md.mesh.elementconnectivity==0))=NaN;
|
---|
| 260 | + ////md.mesh.elementconnectivity(find(md.mesh.elementconnectivity==0))=NaN;
|
---|
| 261 |
|
---|
| 262 | - for (var i = 0; i < md.mesh.elementconnectivity.length; i++) {
|
---|
| 263 | - if (md.mesh.elementconnectivity[i] == 0) {
|
---|
| 264 | - md.mesh.elementconnectivity[i] = NaN;
|
---|
| 265 | - }
|
---|
| 266 | - };
|
---|
| 267 | + //for (var i = 0; i < md.mesh.elementconnectivity.length; i++) {
|
---|
| 268 | + //if (md.mesh.elementconnectivity[i] == 0) {
|
---|
| 269 | + //md.mesh.elementconnectivity[i] = NaN;
|
---|
| 270 | + //}
|
---|
| 271 | + //};
|
---|
| 272 |
|
---|
| 273 | - for (var i = 2; i < numlayers; i++) {
|
---|
| 274 | - for (var j = (i-1)*md.mesh.nuberofelements2d+1; i <= (i)*md.mesh.numberofelements2d; i++) {
|
---|
| 275 | - md.mesh.elementconnectivity[i] += md.mesh.numberofelements2d;
|
---|
| 276 | - };
|
---|
| 277 | - //md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)...
|
---|
| 278 | - //=md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)+md.mesh.numberofelements2d;
|
---|
| 279 | - };
|
---|
| 280 | + //for (var i = 2; i < numlayers; i++) {
|
---|
| 281 | + //for (var j = (i-1)*md.mesh.nuberofelements2d+1; i <= (i)*md.mesh.numberofelements2d; i++) {
|
---|
| 282 | + //md.mesh.elementconnectivity[i] += md.mesh.numberofelements2d;
|
---|
| 283 | + //};
|
---|
| 284 | + ////md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)...
|
---|
| 285 | + ////=md.mesh.elementconnectivity((i-1)*md.mesh.numberofelements2d+1:(i)*md.mesh.numberofelements2d,:)+md.mesh.numberofelements2d;
|
---|
| 286 | + //};
|
---|
| 287 |
|
---|
| 288 | - md.mesh.elementconnectivity.map(function(x) { return (isNaN(x)) ? 0 : x; });
|
---|
| 289 | - }
|
---|
| 290 | + //md.mesh.elementconnectivity.map(function(x) { return (isNaN(x)) ? 0 : x; });
|
---|
| 291 | + //}
|
---|
| 292 |
|
---|
| 293 | - md.materials=md.materials.extrude(md);
|
---|
| 294 | - md.damage=md.damage.extrude(md);
|
---|
| 295 | - md.mask=md.mask.extrude(md);
|
---|
| 296 | - md.qmu=md.qmu.extrude(md);
|
---|
| 297 | - md.basalforcings=md.basalforcings.extrude(md);
|
---|
| 298 | + //md.materials=md.materials.extrude(md);
|
---|
| 299 | + //md.damage=md.damage.extrude(md);
|
---|
| 300 | + //md.mask=md.mask.extrude(md);
|
---|
| 301 | + //md.qmu=md.qmu.extrude(md);
|
---|
| 302 | + //md.basalforcings=md.basalforcings.extrude(md);
|
---|
| 303 |
|
---|
| 304 | - //increase connectivity if less than 25:
|
---|
| 305 | - if (md.mesh.average_vertex_connectivity<=25)
|
---|
| 306 | - md.mesh.average_vertex_connectivity=100;
|
---|
| 307 | - // }}}
|
---|
| 308 | + ////increase connectivity if less than 25:
|
---|
| 309 | + //if (md.mesh.average_vertex_connectivity<=25)
|
---|
| 310 | + //md.mesh.average_vertex_connectivity=100;
|
---|
| 311 | + } //}}}
|
---|
| 312 | + this.collapse = function(md) {
|
---|
| 313 | + /*
|
---|
| 314 | + *COLLAPSE - collapses a 3d mesh into a 2d mesh
|
---|
| 315 | + *
|
---|
| 316 | + * This routine collapses a 3d model into a 2d model
|
---|
| 317 | + * and collapses all the fileds of the 3d model by
|
---|
| 318 | + * taking their depth-averaged values
|
---|
| 319 | + *
|
---|
| 320 | + * Usage:
|
---|
| 321 | + * md=collapse(md)
|
---|
| 322 | + *
|
---|
| 323 | + * See also: EXTRUDE, MODELEXTRACT
|
---|
| 324 | + */
|
---|
| 325 |
|
---|
| 326 | - } //}}}
|
---|
| 327 | + // Check that the model is really a 3d model
|
---|
| 328 | + if (md.mesh.elementtype() !== 'Penta') {
|
---|
| 329 | + console.error('collapse error message: only 3d mesh can be collapsed')
|
---|
| 330 | + }
|
---|
| 331 | +
|
---|
| 332 | + // Start with changing all the fields from the 3d mesh
|
---|
| 333 | +
|
---|
| 334 | + // dealing with the friction law
|
---|
| 335 | + // drag is limited to nodes that are on the bedrock.
|
---|
| 336 | + if (md.friction.classname() === 'friction') {
|
---|
| 337 | + md.friction.coefficient=project2d(md,md.friction.coefficient,1);
|
---|
| 338 | + md.friction.p=project2d(md,md.friction.p,1);
|
---|
| 339 | + md.friction.q=project2d(md,md.friction.q,1);
|
---|
| 340 | + } else if (md.friction.classname() === 'frictionhydro') {
|
---|
| 341 | + md.friction.q=project2d(md,md.friction.q,1);
|
---|
| 342 | + md.friction.C=project2d(md,md.friction.C,1);
|
---|
| 343 | + md.friction.As=project2d(md,md.friction.As,1);
|
---|
| 344 | + md.friction.effective_pressure=project2d(md,md.friction.effective_pressure,1);
|
---|
| 345 | + } else if (md.friction.classname() === 'frictionwaterlayer') {
|
---|
| 346 | + md.friction.coefficient=project2d(md,md.friction.coefficient,1);
|
---|
| 347 | + md.friction.p=project2d(md,md.friction.p,1);
|
---|
| 348 | + md.friction.q=project2d(md,md.friction.q,1);
|
---|
| 349 | + md.friction.water_layer=project2d(md,md.friction.water_layer,1);
|
---|
| 350 | + } else if (md.friction.classname() === 'frictionweertman') {
|
---|
| 351 | + md.friction.C=project2d(md,md.friction.C,1);
|
---|
| 352 | + md.friction.m=project2d(md,md.friction.m,1);
|
---|
| 353 | + } else if (md.friction.classname() === 'frictionweertmantemp') {
|
---|
| 354 | + md.friction.C=project2d(md,md.friction.C,1);
|
---|
| 355 | + md.friction.m=project2d(md,md.friction.m,1);
|
---|
| 356 | + } else {
|
---|
| 357 | + disp('friction type not supported');
|
---|
| 358 | + }
|
---|
| 359 | +
|
---|
| 360 | + // observations
|
---|
| 361 | + if (!isNaN(md.inversion.vx_obs))
|
---|
| 362 | + md.inversion.vx_obs=project2d(md,md.inversion.vx_obs,md.mesh.numberoflayers);
|
---|
| 363 | +
|
---|
| 364 | + if (!isNaN(md.inversion.vy_obs))
|
---|
| 365 | + md.inversion.vy_obs=project2d(md,md.inversion.vy_obs,md.mesh.numberoflayers);
|
---|
| 366 | +
|
---|
| 367 | + if (!isNaN(md.inversion.vel_obs))
|
---|
| 368 | + md.inversion.vel_obs=project2d(md,md.inversion.vel_obs,md.mesh.numberoflayers);
|
---|
| 369 | +
|
---|
| 370 | + if (!isNaN(md.inversion.cost_functions_coefficients))
|
---|
| 371 | + md.inversion.cost_functions_coefficients=project2d(md,md.inversion.cost_functions_coefficients,md.mesh.numberoflayers);
|
---|
| 372 | +
|
---|
| 373 | + if (numel(md.inversion.min_parameters)>1)
|
---|
| 374 | + md.inversion.min_parameters=project2d(md,md.inversion.min_parameters,md.mesh.numberoflayers);
|
---|
| 375 | +
|
---|
| 376 | + if (numel(md.inversion.max_parameters)>1)
|
---|
| 377 | + md.inversion.max_parameters=project2d(md,md.inversion.max_parameters,md.mesh.numberoflayers);
|
---|
| 378 | +
|
---|
| 379 | + if (md.smb.classname() === 'SMBforcing' && !isNaN(md.smb.mass_balance)) {
|
---|
| 380 | + md.smb.mass_balance=project2d(md,md.smb.mass_balance,md.mesh.numberoflayers);
|
---|
| 381 | + } else if (md.smb.classname() === 'SMBhenning' && !isNaN(md.smb.smbref)) {
|
---|
| 382 | + md.smb.smbref=project2d(md,md.smb.smbref,md.mesh.numberoflayers);
|
---|
| 383 | + }
|
---|
| 384 | +
|
---|
| 385 | + // results
|
---|
| 386 | + if (!isNaN(md.initialization.vx))
|
---|
| 387 | + md.initialization.vx=DepthAverage(md,md.initialization.vx);
|
---|
| 388 | + if (!isNaN(md.initialization.vy))
|
---|
| 389 | + md.initialization.vy=DepthAverage(md,md.initialization.vy);
|
---|
| 390 | + if (!isNaN(md.initialization.vz))
|
---|
| 391 | + md.initialization.vz=DepthAverage(md,md.initialization.vz);
|
---|
| 392 | + if (!isNaN(md.initialization.vel))
|
---|
| 393 | + md.initialization.vel=DepthAverage(md,md.initialization.vel);
|
---|
| 394 | + if (!isNaN(md.initialization.temperature))
|
---|
| 395 | + md.initialization.temperature=DepthAverage(md,md.initialization.temperature);
|
---|
| 396 | + if (!isNaN(md.initialization.pressure))
|
---|
| 397 | + md.initialization.pressure=project2d(md,md.initialization.pressure,1);
|
---|
| 398 | + if (!isNaN(md.initialization.sediment_head))
|
---|
| 399 | + md.initialization.sediment_head=project2d(md,md.initialization.sediment_head,1);
|
---|
| 400 | + if (!isNaN(md.initialization.epl_head))
|
---|
| 401 | + md.initialization.epl_head=project2d(md,md.initialization.epl_head,1);
|
---|
| 402 | + if (!isNaN(md.initialization.epl_thickness))
|
---|
| 403 | + md.initialization.epl_thickness=project2d(md,md.initialization.epl_thickness,1);
|
---|
| 404 | +
|
---|
| 405 | + // gia
|
---|
| 406 | + if (!isNaN(md.gia.mantle_viscosity))
|
---|
| 407 | + md.gia.mantle_viscosity=project2d(md,md.gia.mantle_viscosity,1);
|
---|
| 408 | + if (!isNaN(md.gia.lithosphere_thickness))
|
---|
| 409 | + md.gia.lithosphere_thickness=project2d(md,md.gia.lithosphere_thickness,1);
|
---|
| 410 | +
|
---|
| 411 | + // elementstype
|
---|
| 412 | + if (!isNaN(md.flowequation.element_equation)) {
|
---|
| 413 | + md.flowequation.element_equation=project2d(md,md.flowequation.element_equation,1);
|
---|
| 414 | + md.flowequation.vertex_equation=project2d(md,md.flowequation.vertex_equation,1);
|
---|
| 415 | + md.flowequation.borderSSA=project2d(md,md.flowequation.borderSSA,1);
|
---|
| 416 | + md.flowequation.borderHO=project2d(md,md.flowequation.borderHO,1);
|
---|
| 417 | + md.flowequation.borderFS=project2d(md,md.flowequation.borderFS,1);
|
---|
| 418 | + }
|
---|
| 419 | +
|
---|
| 420 | + // boundary conditions
|
---|
| 421 | + md.stressbalance.spcvx=project2d(md,md.stressbalance.spcvx,md.mesh.numberoflayers);
|
---|
| 422 | + md.stressbalance.spcvy=project2d(md,md.stressbalance.spcvy,md.mesh.numberoflayers);
|
---|
| 423 | + md.stressbalance.spcvz=project2d(md,md.stressbalance.spcvz,md.mesh.numberoflayers);
|
---|
| 424 | + md.stressbalance.referential=project2d(md,md.stressbalance.referential,md.mesh.numberoflayers);
|
---|
| 425 | + md.stressbalance.loadingforce=project2d(md,md.stressbalance.loadingforce,md.mesh.numberoflayers);
|
---|
| 426 | + md.masstransport.spcthickness=project2d(md,md.masstransport.spcthickness,md.mesh.numberoflayers);
|
---|
| 427 | + if (!isNaN(md.damage.spcdamage))
|
---|
| 428 | + md.damage.spcdamage=project2d(md,md.damage.spcdamage,md.mesh.numberoflayers);
|
---|
| 429 | + md.thermal.spctemperature=project2d(md,md.thermal.spctemperature,md.mesh.numberoflayers);
|
---|
| 430 | +
|
---|
| 431 | + // Hydrologydc variables
|
---|
| 432 | + if (md.hydrology.classname() === 'hydrologydc') {
|
---|
| 433 | + md.hydrology.spcsediment_head=project2d(md,md.hydrology.spcsediment_head,1);
|
---|
| 434 | + md.hydrology.mask_eplactive_node=project2d(md,md.hydrology.mask_eplactive_node,1);
|
---|
| 435 | + md.hydrology.sediment_transmitivity=project2d(md,md.hydrology.sediment_transmitivity,1);
|
---|
| 436 | + md.hydrology.basal_moulin_input=project2d(md,md.hydrology.basal_moulin_input,1);
|
---|
| 437 | +
|
---|
| 438 | + if(md.hydrology.isefficientlayer==1)
|
---|
| 439 | + md.hydrology.spcepl_head=project2d(md,md.hydrology.spcepl_head,1);
|
---|
| 440 | + }
|
---|
| 441 | +
|
---|
| 442 | + // materials
|
---|
| 443 | + md.materials.rheology_B=DepthAverage(md,md.materials.rheology_B);
|
---|
| 444 | + md.materials.rheology_n=project2d(md,md.materials.rheology_n,1);
|
---|
| 445 | +
|
---|
| 446 | + // damage:
|
---|
| 447 | + if (md.damage.isdamage)
|
---|
| 448 | + md.damage.D=DepthAverage(md,md.damage.D);
|
---|
| 449 | +
|
---|
| 450 | + // special for thermal modeling:
|
---|
| 451 | + if (!isNaN(md.basalforcings.groundedice_melting_rate))
|
---|
| 452 | + md.basalforcings.groundedice_melting_rate=project2d(md,md.basalforcings.groundedice_melting_rate,1);
|
---|
| 453 | +
|
---|
| 454 | + if (!isNaN(md.basalforcings.floatingice_melting_rate))
|
---|
| 455 | + md.basalforcings.floatingice_melting_rate=project2d(md,md.basalforcings.floatingice_melting_rate,1);
|
---|
| 456 | +
|
---|
| 457 | + md.basalforcings.geothermalflux=project2d(md,md.basalforcings.geothermalflux,1); // bedrock only gets geothermal flux
|
---|
| 458 | +
|
---|
| 459 | + // update of connectivity matrix
|
---|
| 460 | + md.mesh.average_vertex_connectivity=25;
|
---|
| 461 | +
|
---|
| 462 | + // Collapse the mesh
|
---|
| 463 | + var nodes2d=md.mesh.numberofvertices2d;
|
---|
| 464 | + var elements2d=md.mesh.numberofelements2d;
|
---|
| 465 | +
|
---|
| 466 | + // parameters
|
---|
| 467 | + md.geometry.surface=project2d(md,md.geometry.surface,1);
|
---|
| 468 | + md.geometry.thickness=project2d(md,md.geometry.thickness,1);
|
---|
| 469 | + md.geometry.base=project2d(md,md.geometry.base,1);
|
---|
| 470 | + if (!isNaN(md.geometry.bed))
|
---|
| 471 | + md.geometry.bed=project2d(md,md.geometry.bed,1);
|
---|
| 472 | +
|
---|
| 473 | + if (!isNaN(md.mask.groundedice_levelset))
|
---|
| 474 | + md.mask.groundedice_levelset=project2d(md,md.mask.groundedice_levelset,1);
|
---|
| 475 | +
|
---|
| 476 | + if (!isNaN(md.mask.ice_levelset))
|
---|
| 477 | + md.mask.ice_levelset=project2d(md,md.mask.ice_levelset,1);
|
---|
| 478 | +
|
---|
| 479 | + // lat long
|
---|
| 480 | + if (numel(md.mesh.lat) === md.mesh.numberofvertices)
|
---|
| 481 | + md.mesh.lat=project2d(md,md.mesh.lat,1);
|
---|
| 482 | + if (numel(md.mesh.long) === md.mesh.numberofvertices)
|
---|
| 483 | + md.mesh.long=project2d(md,md.mesh.long,1);
|
---|
| 484 | +
|
---|
| 485 | + // Initialize with the 2d mesh
|
---|
| 486 | + var mesh = new mesh2d();
|
---|
| 487 | + mesh.x=md.mesh.x2d;
|
---|
| 488 | + mesh.y=md.mesh.y2d;
|
---|
| 489 | + mesh.numberofvertices=md.mesh.numberofvertices2d;
|
---|
| 490 | + mesh.numberofelements=md.mesh.numberofelements2d;
|
---|
| 491 | + mesh.elements=md.mesh.elements2d;
|
---|
| 492 | +
|
---|
| 493 | + if (!isNaN(md.mesh.vertexonboundary))
|
---|
| 494 | + mesh.vertexonboundary=project2d(md,md.mesh.vertexonboundary,1);
|
---|
| 495 | + if (!isNaN(md.mesh.elementconnectivity))
|
---|
| 496 | + mesh.elementconnectivity=project2d(md,md.mesh.elementconnectivity,1);
|
---|
| 497 | +
|
---|
| 498 | + md.mesh=mesh;
|
---|
| 499 | + md.mesh.vertexconnectivity=NodeConnectivity(md.mesh.elements,md.mesh.numberofvertices);
|
---|
| 500 | + md.mesh.elementconnectivity=ElementConnectivity(md.mesh.elements,md.mesh.vertexconnectivity);
|
---|
| 501 | + md.mesh.segments=contourenvelope(md.mesh);
|
---|
| 502 | +
|
---|
| 503 | + return md;
|
---|
| 504 | + }
|
---|
| 505 | //properties
|
---|
| 506 | // {{{
|
---|
| 507 | //Careful here: no other class should be used as default value this is a bug of matlab
|
---|
| 508 | Index: ../trunk-jpl/jenkins/javascript/karma/lib/bin/contourenvelope.js
|
---|
| 509 | ===================================================================
|
---|
| 510 | --- ../trunk-jpl/jenkins/javascript/karma/lib/bin/contourenvelope.js (revision 0)
|
---|
| 511 | +++ ../trunk-jpl/jenkins/javascript/karma/lib/bin/contourenvelope.js (revision 20883)
|
---|
| 512 | @@ -0,0 +1 @@
|
---|
| 513 | +link /home/andy/Programming/Research/trunk-jpl/src/m/parameterization/contourenvelope.js
|
---|
| 514 | \ No newline at end of file
|
---|
| 515 |
|
---|
| 516 | Property changes on: ../trunk-jpl/jenkins/javascript/karma/lib/bin/contourenvelope.js
|
---|
| 517 | ___________________________________________________________________
|
---|
| 518 | Added: svn:special
|
---|
| 519 | + *
|
---|
| 520 |
|
---|
| 521 | Index: ../trunk-jpl/jenkins/javascript/karma/lib/bin/project2d.js
|
---|
| 522 | ===================================================================
|
---|
| 523 | --- ../trunk-jpl/jenkins/javascript/karma/lib/bin/project2d.js (revision 0)
|
---|
| 524 | +++ ../trunk-jpl/jenkins/javascript/karma/lib/bin/project2d.js (revision 20883)
|
---|
| 525 | @@ -0,0 +1 @@
|
---|
| 526 | +link /home/andy/Programming/Research/trunk-jpl/src/m/extrusion/project2d.js
|
---|
| 527 | \ No newline at end of file
|
---|
| 528 |
|
---|
| 529 | Property changes on: ../trunk-jpl/jenkins/javascript/karma/lib/bin/project2d.js
|
---|
| 530 | ___________________________________________________________________
|
---|
| 531 | Added: svn:special
|
---|
| 532 | + *
|
---|
| 533 |
|
---|
| 534 | Index: ../trunk-jpl/jenkins/javascript/karma/lib/bin/DepthAverage.js
|
---|
| 535 | ===================================================================
|
---|
| 536 | --- ../trunk-jpl/jenkins/javascript/karma/lib/bin/DepthAverage.js (revision 0)
|
---|
| 537 | +++ ../trunk-jpl/jenkins/javascript/karma/lib/bin/DepthAverage.js (revision 20883)
|
---|
| 538 | @@ -0,0 +1 @@
|
---|
| 539 | +link /home/andy/Programming/Research/trunk-jpl/src/m/extrusion/DepthAverage.js
|
---|
| 540 | \ No newline at end of file
|
---|
| 541 |
|
---|
| 542 | Property changes on: ../trunk-jpl/jenkins/javascript/karma/lib/bin/DepthAverage.js
|
---|
| 543 | ___________________________________________________________________
|
---|
| 544 | Added: svn:special
|
---|
| 545 | + *
|
---|
| 546 |
|
---|
| 547 | Index: ../trunk-jpl/jenkins/javascript/karma/lib/bin/issm-binaries.js
|
---|
| 548 | ===================================================================
|
---|
| 549 | --- ../trunk-jpl/jenkins/javascript/karma/lib/bin/issm-binaries.js (revision 20882)
|
---|
| 550 | +++ ../trunk-jpl/jenkins/javascript/karma/lib/bin/issm-binaries.js (revision 20883)
|
---|
| 551 | @@ -11181,7 +11181,6 @@
|
---|
| 552 |
|
---|
| 553 | //Marshall into a binary array (fid) all the fields of model.
|
---|
| 554 | var fid = marshall(md); // bin file
|
---|
| 555 | -
|
---|
| 556 | //deal with toolkits options:
|
---|
| 557 | toolkitsstring= md.toolkits.ToolkitsFile(md.miscellaneous.name + '.toolkits'); // toolkits file
|
---|
| 558 |
|
---|
| 559 | Index: ../trunk-jpl/jenkins/javascript/karma/scripts/test104.js
|
---|
| 560 | ===================================================================
|
---|
| 561 | --- ../trunk-jpl/jenkins/javascript/karma/scripts/test104.js (revision 20882)
|
---|
| 562 | +++ ../trunk-jpl/jenkins/javascript/karma/scripts/test104.js (revision 20883)
|
---|
| 563 | @@ -6,7 +6,7 @@
|
---|
| 564 | md.extrude(md,3,2.);
|
---|
| 565 | setflowequation(md,'FS','all');
|
---|
| 566 | //md.cluster=generic('name',oshostname(),'np',3);
|
---|
| 567 | -md=solve(md,StressbalanceSolutionEnum());
|
---|
| 568 | +md=solve(md,StressbalanceSolutionEnum(),'checkconsistency','no');
|
---|
| 569 |
|
---|
| 570 | //Fields and tolerances to track changes
|
---|
| 571 | field_names =['Vx','Vy','Vz','Vel','Pressure'];
|
---|
| 572 | Index: ../trunk-jpl/jenkins/javascript/karma/karma.conf.js
|
---|
| 573 | ===================================================================
|
---|
| 574 | --- ../trunk-jpl/jenkins/javascript/karma/karma.conf.js (revision 20882)
|
---|
| 575 | +++ ../trunk-jpl/jenkins/javascript/karma/karma.conf.js (revision 20883)
|
---|
| 576 | @@ -39,10 +39,13 @@
|
---|
| 577 | 'lib/bin/damage.js',
|
---|
| 578 | 'lib/bin/qmu.js',
|
---|
| 579 | 'lib/bin/basalforcings.js',
|
---|
| 580 | + 'lib/bin/DepthAverage.js',
|
---|
| 581 | + 'lib/bin/project2d.js',
|
---|
| 582 | 'lib/bin/project3d.js',
|
---|
| 583 | 'lib/bin/model.js',
|
---|
| 584 | //'scripts/specs/issm.spec.js'
|
---|
| 585 | - 'scripts/specs/temp.spec.js'
|
---|
| 586 | + //'scripts/specs/temp.spec.js'
|
---|
| 587 | + 'scripts/test102.js'
|
---|
| 588 | //'scripts/specs/3.spec.js'
|
---|
| 589 | ],
|
---|
| 590 |
|
---|