Changeset 21401
- Timestamp:
- 11/18/16 13:37:29 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp
r20690 r21401 84 84 85 85 /*Intermediaries */ 86 int dim, domaintype, extrapolationcase;87 int i,row,col,stabilization;88 bool extrapolatebydiffusion;89 IssmDouble Jdet,D_scalar,h;90 IssmDouble norm_dlsf;91 IssmDouble hx,hy,hz,kappa;92 IssmDouble * xyz_list= NULL;93 Element * workelement=NULL;86 int dim, domaintype, extrapolationcase; 87 int i,row,col,stabilization; 88 bool extrapolatebydiffusion; 89 IssmDouble Jdet,D_scalar,h; 90 IssmDouble norm_dlsf; 91 IssmDouble hx,hy,hz,kappa; 92 IssmDouble *xyz_list = NULL; 93 Element *workelement = NULL; 94 94 95 95 /*Get problem case*/ … … 102 102 case 1: case 2: case 3: workelement=element; break; 103 103 } 104 104 105 /* get extrapolation dimension */ 105 106 workelement->FindParam(&domaintype,DomainTypeEnum); 106 107 switch(domaintype){ 107 case Domain2DverticalEnum: dim=1; break;108 case Domain2DverticalEnum: dim=1; break; 108 109 case Domain2DhorizontalEnum: dim=2; break; 109 case Domain3DEnum: dim=3; break; 110 case Domain3DEnum: dim=3; break; 111 default: _error_("not supported yet"); 110 112 } 111 113 … … 117 119 IssmDouble* B = xNew<IssmDouble>(dim*numnodes); 118 120 IssmDouble* Bprime = xNew<IssmDouble>(dim*numnodes); 119 IssmDouble* D = xNew<IssmDouble>(dim*dim);120 IssmDouble* dlsf= xNew<IssmDouble>(dim);121 IssmDouble* normal= xNew<IssmDouble>(dim);121 IssmDouble* dlsf = xNew<IssmDouble>(dim); 122 IssmDouble* normal = xNew<IssmDouble>(dim); 123 IssmDouble* D = xNewZeroInit<IssmDouble>(dim*dim); 122 124 123 125 /*Retrieve all inputs and parameters*/ … … 128 130 /* Start looping on the number of gaussian points: */ 129 131 Gauss* gauss=workelement->NewGauss(2); 130 for(int ig=gauss->begin();ig<gauss->end();ig++){ /*{{{*/132 for(int ig=gauss->begin();ig<gauss->end();ig++){ 131 133 gauss->GaussPoint(ig); 132 134 … … 139 141 extrapolatebydiffusion=true; 140 142 if(extrapolatebydiffusion){ 141 /* diffuse values outward */ 142 for(row=0;row<dim;row++) 143 for(col=0;col<dim;col++) 144 if(row==col && row<2) //extrapolate only in xy-plane 145 D[row*dim+col] = D_scalar; 146 else 147 D[row*dim+col] = 0.; 143 144 /* diffuse values outward only along the xy-plane*/ 145 for(int i=0;i<2;i++) D[i*dim+i] = D_scalar; 148 146 149 147 TripleMultiply(Bprime,dim,numnodes,1, … … 180 178 &Ke->values[0],1); 181 179 182 /* stabilization */ /*{{{*/180 /* stabilization */ 183 181 /* do not use streamline upwinding for extrapolation: it yields oscillating results due to diffusion along normal direction, but none across */ 184 182 stabilization=1; … … 200 198 &Ke->values[0],1); 201 199 } 202 /*}}}*/203 200 } 204 } /*}}}*/201 } 205 202 206 203 /*Clean up and return*/ … … 236 233 /*Initialize Element vector*/ 237 234 ElementVector* pe = workelement->NewElementVector(); 238 for(int i=0;i<numnodes;i++) 239 pe->values[i]=0.; 240 241 if(extrapolationcase==0){workelement->DeleteMaterials(); delete workelement;}; 235 236 if(extrapolationcase==0){ 237 workelement->DeleteMaterials(); 238 delete workelement; 239 } 240 242 241 return pe; 243 242 }/*}}}*/ … … 326 325 int domaintype, extrapolationvariable; 327 326 int extrapolationcase; 327 328 328 element->FindParam(&domaintype,DomainTypeEnum); 329 329 switch(domaintype){ 330 case Domain2DverticalEnum: extrapolationcase=0; break;331 case Domain2DhorizontalEnum: extrapolationcase=1; break;332 case Domain3DEnum: 330 case Domain2DverticalEnum: extrapolationcase=0; break; 331 case Domain2DhorizontalEnum: extrapolationcase=1; break; 332 case Domain3DEnum: 333 333 element->FindParam(&extrapolationvariable, ExtrapolationVariableEnum); 334 if(extrapolationvariable==ThicknessEnum) extrapolationcase=2; // scalar fields that are constant along z-axis 335 else extrapolationcase=3; // scalar fields that vary along z-axis 334 if(extrapolationvariable==ThicknessEnum){ 335 extrapolationcase=2; // scalar fields that are constant along z-axis 336 } 337 else{ 338 extrapolationcase=3; // scalar fields that vary along z-axis 339 } 336 340 break; 337 341 }
Note:
See TracChangeset
for help on using the changeset viewer.