Changeset 5433
- Timestamp:
- 08/19/10 17:00:42 (15 years ago)
- Location:
- issm/trunk/src
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp
r5372 r5433 46 46 47 47 /*Start with adding spcs of coupling: zero at the border macayeal/pattyn for the appropriate dofs*/ 48 if ((int)iomodel->vertices_type[ 2*i+0]==MacAyealPattynApproximationEnum){48 if ((int)iomodel->vertices_type[i]==MacAyealPattynApproximationEnum){ 49 49 /*If grionmacayeal, spc pattyn dofs: 3 & 4*/ 50 50 if ((int)iomodel->gridonpattyn[i]){ -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp
r5139 r5433 56 56 57 57 /*Do not create ice front if Hutter or Stokes elements*/ 58 if ((int)*(iomodel->elements_type+ 2*element+0)==(HutterApproximationEnum || StokesApproximationEnum)) continue;58 if ((int)*(iomodel->elements_type+element)==(HutterApproximationEnum || StokesApproximationEnum)) continue; 59 59 60 60 /*Create and add load: */ 61 if ((int)*(iomodel->elements_type+ 2*element+0)==(MacAyealApproximationEnum)){61 if ((int)*(iomodel->elements_type+element)==(MacAyealApproximationEnum)){ 62 62 loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,SegmentIcefrontEnum,DiagnosticHorizAnalysisEnum)); 63 63 count++; 64 64 } 65 else if ((int)*(iomodel->elements_type+ 2*element+0)==(PattynApproximationEnum)){65 else if ((int)*(iomodel->elements_type+element)==(PattynApproximationEnum)){ 66 66 loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,QuadIceFrontEnum,DiagnosticHorizAnalysisEnum)); 67 67 count++; 68 68 } 69 else if ((int)*(iomodel->elements_type+ 2*element+0)==(MacAyealPattynApproximationEnum)){69 else if ((int)*(iomodel->elements_type+element)==(MacAyealPattynApproximationEnum)){ 70 70 loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,SegmentIcefrontEnum,DiagnosticHorizAnalysisEnum)); 71 71 count++; -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp
r4236 r5433 32 32 /*Fetch data: */ 33 33 IoModelFetchData(&iomodel->gridonstokes,NULL,NULL,iomodel_handle,"gridonstokes"); 34 IoModelFetchData(&iomodel->spcvelocity,NULL,NULL,iomodel_handle,"spcvelocity"); 35 IoModelFetchData(&iomodel->surface,NULL,NULL,iomodel_handle,"surface"); 36 IoModelFetchData(&iomodel->z,NULL,NULL,iomodel_handle,"z"); 34 37 35 38 /*Initialize counter*/ … … 44 47 45 48 /*This grid will see its vx,vy and vz dofs spc'd to pattyn velocities: */ 46 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1, 0,DiagnosticStokesAnalysisEnum));49 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcvelocity+6*i+3)/iomodel->yts,DiagnosticStokesAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx 47 50 count++; 48 51 49 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2, 0,DiagnosticStokesAnalysisEnum));52 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,*(iomodel->spcvelocity+6*i+4)/iomodel->yts,DiagnosticStokesAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vy 50 53 count++; 51 54 52 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3, 0,DiagnosticStokesAnalysisEnum));55 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,*(iomodel->spcvelocity+6*i+5)/iomodel->yts,DiagnosticStokesAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vz 53 56 count++; 57 58 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,4,iomodel->g*iomodel->rho_ice*(iomodel->surface[i]-iomodel->z[i])/iomodel->stokesreconditioning,DiagnosticStokesAnalysisEnum)); //add lithostatic spc for pressure 59 count++; 60 } 61 else{ //this is a regular node so use spcs if needed 62 if ((int)iomodel->spcvelocity[6*i+0]){ 63 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,1,*(iomodel->spcvelocity+6*i+3)/iomodel->yts,DiagnosticStokesAnalysisEnum)); //add count'th spc, on node i+1, setting dof 1 to vx. 64 count++; 65 } 66 if ((int)iomodel->spcvelocity[6*i+1]){ 67 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,2,*(iomodel->spcvelocity+6*i+4)/iomodel->yts,DiagnosticStokesAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vy 68 count++; 69 } 70 if ((int)iomodel->spcvelocity[6*i+2]){ 71 constraints->AddObject(new Spc(iomodel->constraintcounter+count+1,iomodel->nodecounter+i+1,3,*(iomodel->spcvelocity+6*i+5)/iomodel->yts,DiagnosticStokesAnalysisEnum)); //add count'th spc, on node i+1, setting dof 2 to vz 72 count++; 73 } 54 74 } 55 75 } //if((my_vertices[i]==1)) … … 57 77 58 78 /*Free data: */ 79 xfree((void**)&iomodel->spcvelocity); 59 80 xfree((void**)&iomodel->gridonstokes); 81 xfree((void**)&iomodel->surface); 82 xfree((void**)&iomodel->z); 60 83 61 84 cleanup_and_return: -
issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp
r5137 r5433 56 56 57 57 /*Do not create ice front if it is not a Stokes element*/ 58 if ((int)*(iomodel->elements_type+ 2*element+1)!=StokesApproximationEnum){58 if ((int)*(iomodel->elements_type+element)!=StokesApproximationEnum){ 59 59 continue; 60 60 } -
issm/trunk/src/c/objects/Elements/Penta.cpp
r5414 r5433 2158 2158 } 2159 2159 if(!iomodel->pressure){ 2160 for(i=0;i<6;i++)nodeinputs[i]= 0;2160 for(i=0;i<6;i++)nodeinputs[i]=i; 2161 2161 if(iomodel->qmu_analysis){ 2162 2162 this->inputs->AddInput(new PentaVertexInput(PressureEnum,nodeinputs)); 2163 2163 this->inputs->AddInput(new PentaVertexInput(QmuPressureEnum,nodeinputs)); 2164 2164 } 2165 if(iomodel->isstokes){ 2166 this->inputs->AddInput(new PentaVertexInput(PressureEnum,nodeinputs)); 2167 this->inputs->AddInput(new PentaVertexInput(PressureOldEnum,nodeinputs)); 2168 } 2165 2169 } 2166 2170 break; … … 2174 2178 //Need to know the type of approximation for this element 2175 2179 if(iomodel->elements_type){ 2176 if (*(iomodel->elements_type+ 2*index+0)==MacAyealApproximationEnum){2180 if (*(iomodel->elements_type+index)==MacAyealApproximationEnum){ 2177 2181 this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealApproximationEnum)); 2178 2182 } 2183 else if (*(iomodel->elements_type+index)==PattynApproximationEnum){ 2184 this->inputs->AddInput(new IntInput(ApproximationEnum,PattynApproximationEnum)); 2185 } 2186 else if (*(iomodel->elements_type+index)==MacAyealPattynApproximationEnum){ 2187 this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealPattynApproximationEnum)); 2188 } 2189 else if (*(iomodel->elements_type+index)==HutterApproximationEnum){ 2190 this->inputs->AddInput(new IntInput(ApproximationEnum,HutterApproximationEnum)); 2191 } 2192 else if (*(iomodel->elements_type+index)==StokesApproximationEnum){ 2193 this->inputs->AddInput(new IntInput(ApproximationEnum,StokesApproximationEnum)); 2194 } 2195 else if (*(iomodel->elements_type+index)==NoneApproximationEnum){ 2196 this->inputs->AddInput(new IntInput(ApproximationEnum,NoneApproximationEnum)); 2197 } 2179 2198 else{ 2180 if (*(iomodel->elements_type+2*index+0)==PattynApproximationEnum){ 2181 this->inputs->AddInput(new IntInput(ApproximationEnum,PattynApproximationEnum)); 2182 } 2183 else if (*(iomodel->elements_type+2*index+0)==MacAyealPattynApproximationEnum){ 2184 this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealPattynApproximationEnum)); 2185 } 2186 else if (*(iomodel->elements_type+2*index+0)==HutterApproximationEnum){ 2187 this->inputs->AddInput(new IntInput(ApproximationEnum,HutterApproximationEnum)); 2188 } 2189 else{ 2190 ISSMERROR("Approximation type %s not supported yet",EnumToString((int)*(iomodel->elements_type+2*index+0))); 2191 } 2199 ISSMERROR("Approximation type %s not supported yet",EnumToString((int)*(iomodel->elements_type+index))); 2192 2200 } 2193 2201 } … … 2196 2204 if(analysis_type==DiagnosticStokesAnalysisEnum){ 2197 2205 ISSMASSERT(iomodel->elements_type); 2198 if(iomodel->elements_type[ 2*index+1]==StokesApproximationEnum)2206 if(iomodel->elements_type[index]==StokesApproximationEnum) 2199 2207 this->inputs->AddInput(new BoolInput(IsStokesEnum,true)); 2200 2208 else … … 2868 2876 2869 2877 /*Material properties: */ 2870 double 2878 double gravity,rho_ice,rho_water; 2871 2879 2872 2880 /*Collapsed formulation: */ … … 2925 2933 double stokesreconditioning; 2926 2934 int analysis_type; 2935 int approximation; 2927 2936 2928 2937 /*inputs: */ … … 2945 2954 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 2946 2955 inputs->GetParameterValue(&isstokes,IsStokesEnum); 2956 inputs->GetParameterValue(&approximation,ApproximationEnum); 2947 2957 2948 2958 /*If on water or not Stokes, skip stiffness: */ 2949 if(onwater || !isstokes ) return;2959 if(onwater || !isstokes || approximation!=StokesApproximationEnum) return; 2950 2960 2951 2961 /*recovre material parameters: */ … … 4117 4127 bool shelf; 4118 4128 bool isstokes; 4129 int approximation; 4119 4130 Input* vx_input=NULL; 4120 4131 Input* vy_input=NULL; … … 4127 4138 inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum); 4128 4139 inputs->GetParameterValue(&isstokes,IsStokesEnum); 4140 inputs->GetParameterValue(&approximation,ApproximationEnum); 4129 4141 4130 4142 /*retrieve some parameters: */ … … 4132 4144 4133 4145 /*If on water or not Stokes, skip load: */ 4134 if(onwater || !isstokes ) return;4146 if(onwater || !isstokes || approximation!=StokesApproximationEnum) return; 4135 4147 4136 4148 /*If on water, skip load: */ -
issm/trunk/src/c/objects/Node.cpp
r5311 r5433 71 71 72 72 /*indexing:*/ 73 DistributeNumDofs(&this->indexing,analysis_type,iomodel->vertices_type+ 2*io_index); //number of dofs per node73 DistributeNumDofs(&this->indexing,analysis_type,iomodel->vertices_type+io_index); //number of dofs per node 74 74 numdofs=this->indexing.numberofdofs; 75 75 … … 107 107 } 108 108 109 /*Diagnostic Stokes*/110 if (analysis_type==DiagnosticStokesAnalysisEnum){111 /*On a 3d mesh, in stokes formualtions, only stokes grids are free, the others are frozen: */112 if (!iomodel->borderstokes) ISSMERROR("iomodel->borderstokes is NULL");113 if (iomodel->borderstokes[io_index]){114 //freeze everything except pressure115 this->FreezeDof(1);116 this->FreezeDof(2);117 this->FreezeDof(3);118 }119 else if (iomodel->gridonstokes[io_index]==0){120 for(k=1;k<=numdofs;k++){121 this->FreezeDof(k);122 }123 }124 }125 126 109 /*Diagnostic Hutter*/ 127 110 if (analysis_type==DiagnosticHutterAnalysisEnum){ -
issm/trunk/src/c/solutions/diagnostic_core.cpp
r5318 r5433 71 71 72 72 73 if (dim==3 ){73 if (dim==3 & ~isstokes){ 74 74 75 75 if(verbose)_printf_("%s\n"," computing vertical velocities..."); 76 76 femmodel->SetCurrentConfiguration(DiagnosticVertAnalysisEnum); 77 77 solver_linear(femmodel); 78 } 78 79 79 80 if (isstokes){ 80 81 81 82 82 // if(verbose)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed..."); 83 // ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum); 83 84 84 if(verbose)_printf_("%s\n"," computing stokes velocities and pressure ..."); 85 femmodel->SetCurrentConfiguration(DiagnosticStokesAnalysisEnum); 86 solver_diagnostic_nonlinear(femmodel,conserve_loads); 87 } 85 if(verbose)_printf_("%s\n"," computing stokes velocities and pressure ..."); 86 femmodel->SetCurrentConfiguration(DiagnosticStokesAnalysisEnum); 87 solver_diagnostic_nonlinear(femmodel,conserve_loads); 88 88 } 89 89 -
issm/trunk/src/m/classes/public/collapse.m
r3994 r5433 52 52 md.elements_type=md.elements_type2d; 53 53 elseif ~isnan(md.elements_type) 54 md.elements_type=project2d(md,md.elements_type ,1);54 md.elements_type=project2d(md,md.elements_type); 55 55 end 56 56 md.gridonhutter=project2d(md,md.gridonhutter,1); -
issm/trunk/src/m/classes/public/extrude.m
r5126 r5433 176 176 if ~isnan(md.elements_type) 177 177 oldelements_type=md.elements_type2d; 178 md.elements_type=zeros(number_el3d,2); 179 md.elements_type(:,1)=project3d(md,oldelements_type(:,1),'element'); 180 md.elements_type(:,2)=project3d(md,oldelements_type(:,2),'element'); 178 md.elements_type=zeros(number_el3d,1); 179 md.elements_type=project3d(md,oldelements_type,'element'); 181 180 md.gridonhutter=project3d(md,md.gridonhutter,'node'); 182 181 md.gridonmacayeal=project3d(md,md.gridonmacayeal,'node'); … … 186 185 %dead grids 187 186 md.deadgrids=ones(md.numberofgrids,1); 188 md.deadgrids(md.elements(md.elements_type (:,1)~=MacAyealApproximationEnum,:))=0;%non macayeal grids are not dead187 md.deadgrids(md.elements(md.elements_type~=MacAyealApproximationEnum,:))=0;%non macayeal grids are not dead 189 188 md.deadgrids(find(md.gridonbed))=0;%grids from elements on bed are not dead 190 189 end … … 193 192 if ~isnan(md.vertices_type) 194 193 oldvertices_type=md.vertices_type2d; 195 md.vertices_type=zeros(number_grids3d,2); 196 md.vertices_type(:,1)=project3d(md,oldvertices_type(:,1),'node'); 197 md.vertices_type(:,2)=project3d(md,oldvertices_type(:,2),'node'); 194 md.vertices_type=zeros(number_grids3d,1); 195 md.vertices_type=project3d(md,oldvertices_type,'node'); 198 196 end 199 197 -
issm/trunk/src/m/classes/public/ismodelselfconsistent.m
r5360 r5433 56 56 %Check the size of elements_type 57 57 fields={'elements_type'}; 58 checksize(md,fields,[md.numberofelements 2]); 59 %Check the values of elements_type(1) 60 checkvalues(md,{'elements_type(:,1)'},[MacAyealApproximationEnum() HutterApproximationEnum() PattynApproximationEnum() MacAyealPattynApproximationEnum()]); 61 %Check the values of elements_type(2) 62 checkvalues(md,{'elements_type(:,2)'},[StokesApproximationEnum() NoneApproximationEnum()]); 58 checksize(md,fields,[md.numberofelements 1]); 59 %Check the values of elements_type 60 checkvalues(md,{'elements_type'},[MacAyealApproximationEnum() HutterApproximationEnum() PattynApproximationEnum() MacAyealPattynApproximationEnum() StokesApproximationEnum() NoneApproximationEnum()]); 63 61 if (md.dim==2), 64 checkvalues(md,{'elements_type (:,1)'},[MacAyealApproximationEnum() HutterApproximationEnum()]);62 checkvalues(md,{'elements_type'},[MacAyealApproximationEnum() HutterApproximationEnum()]); 65 63 end 66 64 if (md.ismacayealpattyn==0 && md.ishutter==0 && md.isstokes==0), … … 71 69 %Check the size of verticess_type 72 70 fields={'vertices_type'}; 73 checksize(md,fields,[md.numberofgrids 2]); 74 %Check the values of elements_type(1) 75 checkvalues(md,{'elements_type(:,1)'},[MacAyealApproximationEnum() HutterApproximationEnum() PattynApproximationEnum() MacAyealPattynApproximationEnum()]); 76 %Check the values of elements_type(2) 77 checkvalues(md,{'elements_type(:,2)'},[StokesApproximationEnum() NoneApproximationEnum()]); 71 checksize(md,fields,[md.numberofgrids 1]); 72 %Check the values of vertices_type 73 checkvalues(md,{'vertices_type'},[MacAyealApproximationEnum() HutterApproximationEnum() PattynApproximationEnum() MacAyealPattynApproximationEnum() StokesApproximationEnum() NoneApproximationEnum()]); 78 74 if (md.dim==2), 79 checkvalues(md,{' elements_type(:,1)'},[MacAyealApproximationEnum() HutterApproximationEnum()]);75 checkvalues(md,{'vertices_type'},[MacAyealApproximationEnum() HutterApproximationEnum()]); 80 76 end 81 77 if (md.ismacayealpattyn==0 && md.ishutter==0 && md.isstokes==0), … … 205 201 206 202 %HUTTER ON ICESHELF WARNING 207 if any(md.elements_type (:,1)==HutterApproximationEnum & md.elementoniceshelf),203 if any(md.elements_type==HutterApproximationEnum & md.elementoniceshelf), 208 204 disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n')); 209 205 end -
issm/trunk/src/m/classes/public/mechanicalproperties.m
r5126 r5433 20 20 error('only 2d model supported yet'); 21 21 end 22 if any(md.elements_type (:,1)~=MacAyealApproximationEnum),22 if any(md.elements_type~=MacAyealApproximationEnum), 23 23 disp('Warning: the model has some non macayeal elements. These will be treated like MacAyeal''s elements'); 24 24 end -
issm/trunk/src/m/classes/public/modelextract.m
r5126 r5433 139 139 md2.elements2d(:,3)=Pgrid(md2.elements2d(:,3)); 140 140 141 if ~isnan(md2.elements_type2d), md2.elements_type2d=md1.elements_type2d(pos_elem_2d ,:); end;141 if ~isnan(md2.elements_type2d), md2.elements_type2d=md1.elements_type2d(pos_elem_2d); end; 142 142 md2.x2d=md1.x(pos_grid_2d); 143 143 md2.y2d=md1.y(pos_grid_2d); -
issm/trunk/src/m/classes/public/plot/plot_elementstype.m
r5133 r5433 9 9 %process data and model 10 10 [x y z elements is2d]=processmesh(md,[],options); 11 [data1 datatype]=processdata(md,md.elements_type(:,1),options); 12 [data2 datatype]=processdata(md,md.elements_type(:,2),options); 13 data=[data1 data2]; 11 [data datatype]=processdata(md,md.elements_type,options); 14 12 15 13 %edgecolor? … … 21 19 if is2d 22 20 %Hutter elements 23 posH=find(data (:,1)==HutterApproximationEnum);21 posH=find(data==HutterApproximationEnum); 24 22 A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); 25 23 p1=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',HutterApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 26 24 %MacAyeal element 27 posH=find(data (:,1)==MacAyealApproximationEnum);25 posH=find(data==MacAyealApproximationEnum); 28 26 A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); 29 27 p2=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',MacAyealApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 30 28 %Pattyn element 31 posH=find(data (:,1)==PattynApproximationEnum);29 posH=find(data==PattynApproximationEnum); 32 30 A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); 33 31 p3=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',PattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 34 32 %MacAyealPattyn element 35 posH=find(data (:,1)==MacAyealPattynApproximationEnum);33 posH=find(data==MacAyealPattynApproximationEnum); 36 34 A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); 37 35 p5=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',MacAyealPattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 38 36 %Stokes elements 39 37 alpha=0.35; 40 posS=find(data (:,2)==StokesApproximationEnum);38 posS=find(data==StokesApproximationEnum); 41 39 if ~isempty(posS) 42 40 A=elements(posS,1); B=elements(posS,2); C=elements(posS,3); … … 48 46 else 49 47 %Hutter elements 50 posH=find(data (:,1)==HutterApproximationEnum);48 posH=find(data==HutterApproximationEnum); 51 49 A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); D=elements(posH,4); E=elements(posH,5); F=elements(posH,6); 52 50 p1=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', HutterApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); … … 56 54 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', HutterApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 57 55 %MacAyeal elements 58 posM=find(data (:,1)==MacAyealApproximationEnum);56 posM=find(data==MacAyealApproximationEnum); 59 57 A=elements(posM,1); B=elements(posM,2); C=elements(posM,3); D=elements(posM,4); E=elements(posM,5); F=elements(posM,6); 60 58 p2=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', MacAyealApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); … … 64 62 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', MacAyealApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 65 63 %Pattyn elements 66 posP=find(data (:,1)==PattynApproximationEnum);64 posP=find(data==PattynApproximationEnum); 67 65 A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6); 68 66 p3=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', PattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); … … 72 70 patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', PattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); 73 71 %MacAyealPattyn elements 74 posP=find(data (:,1)==MacAyealPattynApproximationEnum);72 posP=find(data==MacAyealPattynApproximationEnum); 75 73 A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6); 76 74 p5=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', MacAyealPattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor); … … 81 79 %Stokes elements 82 80 alpha=0.35; 83 posS=find(data (:,2)==StokesApproximationEnum);81 posS=find(data==StokesApproximationEnum); 84 82 if ~isempty(posS) 85 83 A=elements(posS,1); B=elements(posS,2); C=elements(posS,3); D=elements(posS,4); E=elements(posS,5); F=elements(posS,6); -
issm/trunk/src/m/classes/public/setelementstype.m
r5393 r5433 47 47 48 48 %check that each element has at least one flag 49 if any(hutterflag+ macayealflag+pattynflag ==0),49 if any(hutterflag+ macayealflag+pattynflag+stokesflag==0), 50 50 error('setelementstype error message: elements type not assigned, must be specified') 51 51 end … … 66 66 end 67 67 68 %Modify stokesflag to get rid of elements contrained everywhere 69 nonstokesflag=find(~stokesflag); %non stokes elements 70 gridonstokes=ones(md.numberofgrids,1); 71 gridonstokes(md.elements(nonstokesflag,:))=0; %non stokes grids 72 pos=find(sum(md.spcvelocity(:,1:2),2)==2); %find all the grids on the boundary of the domain without icefront 73 gridonstokes(pos)=0; %we have to constrain all the boundary of the domain without icefront 68 %Stokes can only be used alone for now: 69 if any(stokesflag) &any(hutterflag+pattynflag+macayealflag), 70 error('setelementstype error message: stokes cannot be used with any other model for now, put stokes everywhere') 71 end 74 72 75 %Rule out elements where all grids are on the border of the stokes grids (because those elements are completely 76 %constrained 77 pos=find(stokesflag); 78 constrained_list=pos(find(sum(gridonstokes(md.elements(pos,:)),2)==0)); 79 stokesflag(constrained_list)=0; 80 73 if any(stokesflag), 74 %Modify stokesflag to get rid of elements contrained everywhere 75 fullspcnodes=double(sum(md.spcvelocity(:,1:3),2)==3); %find all the grids on the boundary of the domain without icefront 76 fullspcelems=double(sum(fullspcnodes(md.elements),2)==6); %find all the grids on the boundary of the domain without icefront 77 stokesflag(find(fullspcelems))=0; 78 gridonstokes=zeros(md.numberofgrids,1); 79 end 80 81 81 %add in model who is who 82 md.elements_type=zeros(md.numberofelements, 2);82 md.elements_type=zeros(md.numberofelements,1); 83 83 84 84 %1: Hutter elements … … 86 86 gridonhutter(md.elements(find(hutterflag),:))=1; 87 87 md.gridonhutter=gridonhutter; 88 md.elements_type(find(hutterflag) ,1)=HutterApproximationEnum();88 md.elements_type(find(hutterflag))=HutterApproximationEnum(); 89 89 90 90 %2: MacAyeal elements … … 92 92 gridonmacayeal(md.elements(find(macayealflag),:))=1; 93 93 md.gridonmacayeal=gridonmacayeal; 94 md.elements_type(find(macayealflag) ,1)=MacAyealApproximationEnum();94 md.elements_type(find(macayealflag))=MacAyealApproximationEnum(); 95 95 96 96 %3: Pattyn elements … … 98 98 gridonpattyn(md.elements(find(pattynflag),:))=1; 99 99 md.gridonpattyn=gridonpattyn; 100 md.elements_type(find(pattynflag) ,1)=PattynApproximationEnum();100 md.elements_type(find(pattynflag))=PattynApproximationEnum(); 101 101 102 102 %4: Stokes elements 103 gridonstokes=zeros(md.numberofgrids,1); 104 gridonstokes(md.elements(find(stokesflag),:))=1; 103 105 md.gridonstokes=gridonstokes; 104 md.elements_type(find(stokesflag) ,2)=StokesApproximationEnum();106 md.elements_type(find(stokesflag))=StokesApproximationEnum(); 105 107 106 %5: None elements (non Stokes) 107 md.elements_type(find(~stokesflag),2)=NoneApproximationEnum(); 108 %Complete with NoneApproximation if there is no stokes 109 if any(stokesflag), 110 %5: None elements (non Stokes) 111 md.elements_type(find(~stokesflag))=NoneApproximationEnum(); 112 end 108 113 109 114 %Now take care of the coupling between MacAyeal and Pattyn … … 140 145 141 146 %Create MacaAyealPattynApproximation where needed 142 md.elements_type(find(macayealpattynflag) ,1)=MacAyealPattynApproximationEnum();147 md.elements_type(find(macayealpattynflag))=MacAyealPattynApproximationEnum(); 143 148 144 149 %Now recreate gridonmacayeal and gridonmacayealpattyn … … 148 153 149 154 %Create vertices_type 150 md.vertices_type=zeros(md.numberofgrids, 2);155 md.vertices_type=zeros(md.numberofgrids,1); 151 156 pos=find(gridonhutter); 152 md.vertices_type(pos ,1)=HutterApproximationEnum();157 md.vertices_type(pos)=HutterApproximationEnum(); 153 158 pos=find(gridonmacayeal); 154 md.vertices_type(pos ,1)=MacAyealApproximationEnum();159 md.vertices_type(pos)=MacAyealApproximationEnum(); 155 160 pos=find(gridonpattyn); 156 md.vertices_type(pos ,1)=PattynApproximationEnum();161 md.vertices_type(pos)=PattynApproximationEnum(); 157 162 pos=find(gridonhutter); 158 md.vertices_type(pos ,1)=HutterApproximationEnum();163 md.vertices_type(pos)=HutterApproximationEnum(); 159 164 pos=find(gridonpattyn & gridonmacayeal); 160 md.vertices_type(pos ,1)=PattynApproximationEnum();165 md.vertices_type(pos)=PattynApproximationEnum(); 161 166 pos=find(gridonmacayealpattyn); 162 md.vertices_type(pos ,1)=MacAyealPattynApproximationEnum();167 md.vertices_type(pos)=MacAyealPattynApproximationEnum(); 163 168 pos=find(gridonstokes); 164 md.vertices_type(pos,2)=StokesApproximationEnum(); 165 pos=find(~gridonstokes); 166 md.vertices_type(pos,2)=NoneApproximationEnum(); 169 md.vertices_type(pos)=StokesApproximationEnum(); 170 if any(stokesflag), 171 pos=find(~gridonstokes); 172 md.vertices_type(pos)=NoneApproximationEnum(); 173 end 167 174 168 175 %flag dead grids (strictly in MacAyeal and not on bed -> not used in diagnostic horiz) … … 173 180 md.deadgrids=deadgrids; 174 181 175 %figure out the border stokes grids176 stokes_elements=find(md.elements_type(:,2)==StokesApproximationEnum()); %find the elements on the stokes domain177 borderflags=zeros(md.numberofgrids,1);178 borderflags(md.elements(stokes_elements,:))=1; %find all the grids of the elements on stokes domain, ie stokes grids and borderstokes179 md.borderstokes=borderflags-md.gridonstokes; %remove stokes grids from this list180 181 182 %figure out solution types 182 md.ishutter=double(any(md.elements_type (:,1)==HutterApproximationEnum));183 md.ismacayealpattyn=double(any(md.elements_type (:,1)==MacAyealApproximationEnum | md.elements_type(:,1)==PattynApproximationEnum));184 md.isstokes=double(any(md.elements_type (:,2)==StokesApproximationEnum));183 md.ishutter=double(any(md.elements_type==HutterApproximationEnum)); 184 md.ismacayealpattyn=double(any(md.elements_type==MacAyealApproximationEnum | md.elements_type==PattynApproximationEnum)); 185 md.isstokes=double(any(md.elements_type==StokesApproximationEnum)); 185 186 186 187 end -
issm/trunk/src/m/solutions/SolutionConfiguration.m
r5246 r5433 12 12 case DiagnosticSolutionEnum, 13 13 numanalyses=6; 14 %analyses=[DiagnosticHorizAnalysisEnum]; 14 15 analyses=[DiagnosticHorizAnalysisEnum;DiagnosticVertAnalysisEnum;DiagnosticStokesAnalysisEnum;DiagnosticHutterAnalysisEnum;SurfaceSlopeAnalysisEnum;BedSlopeAnalysisEnum]; 15 16 -
issm/trunk/src/m/solutions/diagnostic_core.m
r5317 r5433 55 55 56 56 57 if dim==3 ,57 if dim==3 & ~isstokes, 58 58 59 59 displaystring(verbose,'\n%s',['computing vertical velocities...']); 60 60 femmodel=SetCurrentConfiguration(femmodel,DiagnosticVertAnalysisEnum); 61 61 femmodel=solver_linear(femmodel); 62 end 62 63 63 64 if isstokes, 64 65 65 66 66 % displaystring(verbose,'\n%s',['update boundary conditions for stokes using velocities previously computed...']); 67 % femmodel=ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum); 67 68 68 displaystring(verbose,'\n%s',['computing stokes velocities and pressure...']); 69 femmodel=SetCurrentConfiguration(femmodel,DiagnosticStokesAnalysisEnum); 70 femmodel=solver_diagnostic_nonlinear(femmodel,conserve_loads); 71 end 69 displaystring(verbose,'\n%s',['computing stokes velocities and pressure...']); 70 femmodel=SetCurrentConfiguration(femmodel,DiagnosticStokesAnalysisEnum); 71 femmodel=solver_diagnostic_nonlinear(femmodel,conserve_loads); 72 72 end 73 73
Note:
See TracChangeset
for help on using the changeset viewer.