Changeset 5433


Ignore:
Timestamp:
08/19/10 17:00:42 (15 years ago)
Author:
seroussi
Message:

stokes now independent

Location:
issm/trunk/src
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateConstraintsDiagnosticHoriz.cpp

    r5372 r5433  
    4646
    4747                        /*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){
    4949                                /*If grionmacayeal, spc pattyn dofs: 3 & 4*/
    5050                                        if ((int)iomodel->gridonpattyn[i]){
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticHoriz/CreateLoadsDiagnosticHoriz.cpp

    r5139 r5433  
    5656               
    5757                /*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;
    5959
    6060                /*Create and  add load: */
    61                 if ((int)*(iomodel->elements_type+2*element+0)==(MacAyealApproximationEnum)){
     61                if ((int)*(iomodel->elements_type+element)==(MacAyealApproximationEnum)){
    6262                        loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,SegmentIcefrontEnum,DiagnosticHorizAnalysisEnum));
    6363                        count++;
    6464                }
    65                 else if ((int)*(iomodel->elements_type+2*element+0)==(PattynApproximationEnum)){
     65                else if ((int)*(iomodel->elements_type+element)==(PattynApproximationEnum)){
    6666                        loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,QuadIceFrontEnum,DiagnosticHorizAnalysisEnum));
    6767                        count++;
    6868                }
    69                 else if ((int)*(iomodel->elements_type+2*element+0)==(MacAyealPattynApproximationEnum)){
     69                else if ((int)*(iomodel->elements_type+element)==(MacAyealPattynApproximationEnum)){
    7070                        loads->AddObject(new Icefront(iomodel->loadcounter+count+1,i,iomodel,SegmentIcefrontEnum,DiagnosticHorizAnalysisEnum));
    7171                        count++;
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateConstraintsDiagnosticStokes.cpp

    r4236 r5433  
    3232        /*Fetch data: */
    3333        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");
    3437
    3538        /*Initialize counter*/
     
    4447
    4548                                /*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
    4750                                count++;
    4851
    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
    5053                                count++;
    5154
    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
    5356                                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                                }
    5474                        }
    5575                } //if((my_vertices[i]==1))
     
    5777
    5878        /*Free data: */
     79        xfree((void**)&iomodel->spcvelocity);
    5980        xfree((void**)&iomodel->gridonstokes);
     81        xfree((void**)&iomodel->surface);
     82        xfree((void**)&iomodel->z);
    6083
    6184        cleanup_and_return:
  • issm/trunk/src/c/modules/ModelProcessorx/DiagnosticStokes/CreateLoadsDiagnosticStokes.cpp

    r5137 r5433  
    5656       
    5757                /*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){
    5959                        continue;
    6060                }
  • issm/trunk/src/c/objects/Elements/Penta.cpp

    r5414 r5433  
    21582158                        }
    21592159                        if(!iomodel->pressure){
    2160                                 for(i=0;i<6;i++)nodeinputs[i]=0;
     2160                                for(i=0;i<6;i++)nodeinputs[i]=i;
    21612161                                if(iomodel->qmu_analysis){
    21622162                                        this->inputs->AddInput(new PentaVertexInput(PressureEnum,nodeinputs));
    21632163                                        this->inputs->AddInput(new PentaVertexInput(QmuPressureEnum,nodeinputs));
    21642164                                }
     2165                                if(iomodel->isstokes){
     2166                                        this->inputs->AddInput(new PentaVertexInput(PressureEnum,nodeinputs));
     2167                                        this->inputs->AddInput(new PentaVertexInput(PressureOldEnum,nodeinputs));
     2168                                }
    21652169                        }
    21662170                        break;
     
    21742178        //Need to know the type of approximation for this element
    21752179        if(iomodel->elements_type){
    2176                 if (*(iomodel->elements_type+2*index+0)==MacAyealApproximationEnum){
     2180                if (*(iomodel->elements_type+index)==MacAyealApproximationEnum){
    21772181                        this->inputs->AddInput(new IntInput(ApproximationEnum,MacAyealApproximationEnum));
    21782182                }
     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                }
    21792198                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)));
    21922200                }
    21932201        }
     
    21962204        if(analysis_type==DiagnosticStokesAnalysisEnum){
    21972205                ISSMASSERT(iomodel->elements_type);
    2198                 if(iomodel->elements_type[2*index+1]==StokesApproximationEnum)
     2206                if(iomodel->elements_type[index]==StokesApproximationEnum)
    21992207                 this->inputs->AddInput(new BoolInput(IsStokesEnum,true));
    22002208                else
     
    28682876
    28692877        /*Material properties: */
    2870         double         gravity,rho_ice,rho_water;
     2878        double    gravity,rho_ice,rho_water;
    28712879
    28722880        /*Collapsed formulation: */
     
    29252933        double stokesreconditioning;
    29262934        int analysis_type;
     2935        int approximation;
    29272936
    29282937        /*inputs: */
     
    29452954        inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
    29462955        inputs->GetParameterValue(&isstokes,IsStokesEnum);
     2956        inputs->GetParameterValue(&approximation,ApproximationEnum);
    29472957
    29482958        /*If on water or not Stokes, skip stiffness: */
    2949         if(onwater || !isstokes) return;
     2959        if(onwater || !isstokes || approximation!=StokesApproximationEnum) return;
    29502960
    29512961        /*recovre material parameters: */
     
    41174127        bool shelf;
    41184128        bool isstokes;
     4129        int  approximation;
    41194130        Input* vx_input=NULL;
    41204131        Input* vy_input=NULL;
     
    41274138        inputs->GetParameterValue(&shelf,ElementOnIceShelfEnum);
    41284139        inputs->GetParameterValue(&isstokes,IsStokesEnum);
     4140        inputs->GetParameterValue(&approximation,ApproximationEnum);
    41294141
    41304142        /*retrieve some parameters: */
     
    41324144
    41334145        /*If on water or not Stokes, skip load: */
    4134         if(onwater || !isstokes) return;
     4146        if(onwater || !isstokes || approximation!=StokesApproximationEnum) return;
    41354147
    41364148        /*If on water, skip load: */
  • issm/trunk/src/c/objects/Node.cpp

    r5311 r5433  
    7171
    7272        /*indexing:*/
    73         DistributeNumDofs(&this->indexing,analysis_type,iomodel->vertices_type+2*io_index); //number of dofs per node
     73        DistributeNumDofs(&this->indexing,analysis_type,iomodel->vertices_type+io_index); //number of dofs per node
    7474        numdofs=this->indexing.numberofdofs;
    7575
     
    107107        }
    108108
    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 pressure
    115                         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 
    126109        /*Diagnostic Hutter*/
    127110        if (analysis_type==DiagnosticHutterAnalysisEnum){
  • issm/trunk/src/c/solutions/diagnostic_core.cpp

    r5318 r5433  
    7171       
    7272       
    73         if (dim==3){
     73        if (dim==3 & ~isstokes){
    7474
    7575                if(verbose)_printf_("%s\n"," computing vertical velocities...");
    7676                femmodel->SetCurrentConfiguration(DiagnosticVertAnalysisEnum);
    7777                solver_linear(femmodel);
     78        }
    7879
    79                 if (isstokes){
     80        if (isstokes){
    8081
    81                         if(verbose)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed...");
    82                         ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum);
     82        //      if(verbose)_printf_("%s\n"," update boundary conditions for stokes using velocities previously computed...");
     83        //      ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum);
    8384
    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);
    8888        }
    8989
  • issm/trunk/src/m/classes/public/collapse.m

    r3994 r5433  
    5252        md.elements_type=md.elements_type2d;
    5353elseif ~isnan(md.elements_type)
    54         md.elements_type=project2d(md,md.elements_type,1);
     54        md.elements_type=project2d(md,md.elements_type);
    5555end     
    5656md.gridonhutter=project2d(md,md.gridonhutter,1);
  • issm/trunk/src/m/classes/public/extrude.m

    r5126 r5433  
    176176if ~isnan(md.elements_type)
    177177        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');
    181180        md.gridonhutter=project3d(md,md.gridonhutter,'node');
    182181        md.gridonmacayeal=project3d(md,md.gridonmacayeal,'node');
     
    186185        %dead grids
    187186        md.deadgrids=ones(md.numberofgrids,1);
    188         md.deadgrids(md.elements(md.elements_type(:,1)~=MacAyealApproximationEnum,:))=0;%non macayeal grids are not dead
     187        md.deadgrids(md.elements(md.elements_type~=MacAyealApproximationEnum,:))=0;%non macayeal grids are not dead
    189188        md.deadgrids(find(md.gridonbed))=0;%grids from elements on bed are not dead
    190189end
     
    193192if ~isnan(md.vertices_type)
    194193        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');
    198196end
    199197
  • issm/trunk/src/m/classes/public/ismodelselfconsistent.m

    r5360 r5433  
    5656%Check the size of elements_type
    5757fields={'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()]);
     58checksize(md,fields,[md.numberofelements 1]);
     59%Check the values of elements_type
     60checkvalues(md,{'elements_type'},[MacAyealApproximationEnum() HutterApproximationEnum() PattynApproximationEnum() MacAyealPattynApproximationEnum() StokesApproximationEnum() NoneApproximationEnum()]);
    6361if (md.dim==2),
    64         checkvalues(md,{'elements_type(:,1)'},[MacAyealApproximationEnum() HutterApproximationEnum()]);
     62        checkvalues(md,{'elements_type'},[MacAyealApproximationEnum() HutterApproximationEnum()]);
    6563end
    6664if (md.ismacayealpattyn==0 && md.ishutter==0 && md.isstokes==0),
     
    7169%Check the size of verticess_type
    7270fields={'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()]);
     71checksize(md,fields,[md.numberofgrids 1]);
     72%Check the values of vertices_type
     73checkvalues(md,{'vertices_type'},[MacAyealApproximationEnum() HutterApproximationEnum() PattynApproximationEnum() MacAyealPattynApproximationEnum() StokesApproximationEnum() NoneApproximationEnum()]);
    7874if (md.dim==2),
    79         checkvalues(md,{'elements_type(:,1)'},[MacAyealApproximationEnum() HutterApproximationEnum()]);
     75        checkvalues(md,{'vertices_type'},[MacAyealApproximationEnum() HutterApproximationEnum()]);
    8076end
    8177if (md.ismacayealpattyn==0 && md.ishutter==0 && md.isstokes==0),
     
    205201
    206202        %HUTTER ON ICESHELF WARNING
    207         if any(md.elements_type(:,1)==HutterApproximationEnum & md.elementoniceshelf),
     203        if any(md.elements_type==HutterApproximationEnum & md.elementoniceshelf),
    208204                disp(sprintf('\n !!! Warning: Hutter''s model is not consistent on ice shelves !!!\n'));
    209205        end
  • issm/trunk/src/m/classes/public/mechanicalproperties.m

    r5126 r5433  
    2020        error('only 2d model supported yet');
    2121end
    22 if any(md.elements_type(:,1)~=MacAyealApproximationEnum),
     22if any(md.elements_type~=MacAyealApproximationEnum),
    2323        disp('Warning: the model has some non macayeal elements. These will be treated like MacAyeal''s elements');
    2424end
  • issm/trunk/src/m/classes/public/modelextract.m

    r5126 r5433  
    139139                md2.elements2d(:,3)=Pgrid(md2.elements2d(:,3));
    140140
    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;
    142142                md2.x2d=md1.x(pos_grid_2d);
    143143                md2.y2d=md1.y(pos_grid_2d);
  • issm/trunk/src/m/classes/public/plot/plot_elementstype.m

    r5133 r5433  
    99%process data and model
    1010[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);
    1412
    1513%edgecolor?
     
    2119if is2d
    2220        %Hutter elements
    23         posH=find(data(:,1)==HutterApproximationEnum);
     21        posH=find(data==HutterApproximationEnum);
    2422        A=elements(posH,1); B=elements(posH,2); C=elements(posH,3);
    2523        p1=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',HutterApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    2624        %MacAyeal element
    27         posH=find(data(:,1)==MacAyealApproximationEnum);
     25        posH=find(data==MacAyealApproximationEnum);
    2826        A=elements(posH,1); B=elements(posH,2); C=elements(posH,3);
    2927        p2=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',MacAyealApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    3028        %Pattyn element
    31         posH=find(data(:,1)==PattynApproximationEnum);
     29        posH=find(data==PattynApproximationEnum);
    3230        A=elements(posH,1); B=elements(posH,2); C=elements(posH,3);
    3331        p3=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',PattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    3432        %MacAyealPattyn element
    35         posH=find(data(:,1)==MacAyealPattynApproximationEnum);
     33        posH=find(data==MacAyealPattynApproximationEnum);
    3634        A=elements(posH,1); B=elements(posH,2); C=elements(posH,3);
    3735        p5=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData',MacAyealPattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    3836        %Stokes elements
    3937        alpha=0.35;
    40         posS=find(data(:,2)==StokesApproximationEnum);
     38        posS=find(data==StokesApproximationEnum);
    4139        if ~isempty(posS)
    4240                A=elements(posS,1); B=elements(posS,2); C=elements(posS,3);
     
    4846else
    4947        %Hutter elements
    50         posH=find(data(:,1)==HutterApproximationEnum);
     48        posH=find(data==HutterApproximationEnum);
    5149        A=elements(posH,1); B=elements(posH,2); C=elements(posH,3); D=elements(posH,4); E=elements(posH,5); F=elements(posH,6);
    5250        p1=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', HutterApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
     
    5654        patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', HutterApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    5755        %MacAyeal elements
    58         posM=find(data(:,1)==MacAyealApproximationEnum);
     56        posM=find(data==MacAyealApproximationEnum);
    5957        A=elements(posM,1); B=elements(posM,2); C=elements(posM,3); D=elements(posM,4); E=elements(posM,5); F=elements(posM,6);
    6058        p2=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', MacAyealApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
     
    6462        patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', MacAyealApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    6563        %Pattyn elements
    66         posP=find(data(:,1)==PattynApproximationEnum);
     64        posP=find(data==PattynApproximationEnum);
    6765        A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6);
    6866        p3=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', PattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
     
    7270        patch( 'Faces', [C A D F ], 'Vertices', [x y z],'CData', PattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
    7371        %MacAyealPattyn elements
    74         posP=find(data(:,1)==MacAyealPattynApproximationEnum);
     72        posP=find(data==MacAyealPattynApproximationEnum);
    7573        A=elements(posP,1); B=elements(posP,2); C=elements(posP,3); D=elements(posP,4); E=elements(posP,5); F=elements(posP,6);
    7674        p5=patch( 'Faces', [A B C], 'Vertices', [x y z],'CData', MacAyealPattynApproximationEnum,'FaceColor','flat','EdgeColor',edgecolor);
     
    8179        %Stokes elements
    8280        alpha=0.35;
    83         posS=find(data(:,2)==StokesApproximationEnum);
     81        posS=find(data==StokesApproximationEnum);
    8482        if ~isempty(posS)
    8583                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  
    4747
    4848%check that each element has at least one flag
    49 if any(hutterflag+ macayealflag+pattynflag==0),
     49if any(hutterflag+ macayealflag+pattynflag+stokesflag==0),
    5050        error('setelementstype error message: elements type not assigned, must be specified')
    5151end
     
    6666end
    6767
    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:
     69if any(stokesflag) &any(hutterflag+pattynflag+macayealflag),
     70        error('setelementstype error message: stokes cannot be used with any other model for now, put stokes everywhere')
     71end
    7472
    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 
     73if 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);
     79end
     80       
    8181%add in model who is who
    82 md.elements_type=zeros(md.numberofelements,2);
     82md.elements_type=zeros(md.numberofelements,1);
    8383
    8484%1: Hutter elements
     
    8686gridonhutter(md.elements(find(hutterflag),:))=1;
    8787md.gridonhutter=gridonhutter;
    88 md.elements_type(find(hutterflag),1)=HutterApproximationEnum();
     88md.elements_type(find(hutterflag))=HutterApproximationEnum();
    8989
    9090%2: MacAyeal elements
     
    9292gridonmacayeal(md.elements(find(macayealflag),:))=1;
    9393md.gridonmacayeal=gridonmacayeal;
    94 md.elements_type(find(macayealflag),1)=MacAyealApproximationEnum();
     94md.elements_type(find(macayealflag))=MacAyealApproximationEnum();
    9595
    9696%3: Pattyn elements
     
    9898gridonpattyn(md.elements(find(pattynflag),:))=1;
    9999md.gridonpattyn=gridonpattyn;
    100 md.elements_type(find(pattynflag),1)=PattynApproximationEnum();
     100md.elements_type(find(pattynflag))=PattynApproximationEnum();
    101101
    102102%4: Stokes elements
     103gridonstokes=zeros(md.numberofgrids,1);
     104gridonstokes(md.elements(find(stokesflag),:))=1;
    103105md.gridonstokes=gridonstokes;
    104 md.elements_type(find(stokesflag),2)=StokesApproximationEnum();
     106md.elements_type(find(stokesflag))=StokesApproximationEnum();
    105107
    106 %5: None elements (non Stokes)
    107 md.elements_type(find(~stokesflag),2)=NoneApproximationEnum();
     108%Complete with NoneApproximation if there is no stokes
     109if any(stokesflag),
     110        %5: None elements (non Stokes)
     111        md.elements_type(find(~stokesflag))=NoneApproximationEnum();
     112end
    108113
    109114%Now take care of the coupling between MacAyeal and Pattyn
     
    140145
    141146        %Create MacaAyealPattynApproximation where needed
    142         md.elements_type(find(macayealpattynflag),1)=MacAyealPattynApproximationEnum();
     147        md.elements_type(find(macayealpattynflag))=MacAyealPattynApproximationEnum();
    143148
    144149        %Now recreate gridonmacayeal and gridonmacayealpattyn
     
    148153
    149154%Create vertices_type
    150 md.vertices_type=zeros(md.numberofgrids,2);
     155md.vertices_type=zeros(md.numberofgrids,1);
    151156pos=find(gridonhutter);
    152 md.vertices_type(pos,1)=HutterApproximationEnum();
     157md.vertices_type(pos)=HutterApproximationEnum();
    153158pos=find(gridonmacayeal);
    154 md.vertices_type(pos,1)=MacAyealApproximationEnum();
     159md.vertices_type(pos)=MacAyealApproximationEnum();
    155160pos=find(gridonpattyn);
    156 md.vertices_type(pos,1)=PattynApproximationEnum();
     161md.vertices_type(pos)=PattynApproximationEnum();
    157162pos=find(gridonhutter);
    158 md.vertices_type(pos,1)=HutterApproximationEnum();
     163md.vertices_type(pos)=HutterApproximationEnum();
    159164pos=find(gridonpattyn & gridonmacayeal);
    160 md.vertices_type(pos,1)=PattynApproximationEnum();
     165md.vertices_type(pos)=PattynApproximationEnum();
    161166pos=find(gridonmacayealpattyn);
    162 md.vertices_type(pos,1)=MacAyealPattynApproximationEnum();
     167md.vertices_type(pos)=MacAyealPattynApproximationEnum();
    163168pos=find(gridonstokes);
    164 md.vertices_type(pos,2)=StokesApproximationEnum();
    165 pos=find(~gridonstokes);
    166 md.vertices_type(pos,2)=NoneApproximationEnum();
     169md.vertices_type(pos)=StokesApproximationEnum();
     170if any(stokesflag),
     171        pos=find(~gridonstokes);
     172        md.vertices_type(pos)=NoneApproximationEnum();
     173end
    167174
    168175%flag dead grids (strictly in MacAyeal and not on bed -> not used in diagnostic horiz)
     
    173180md.deadgrids=deadgrids;
    174181
    175 %figure out the border stokes grids
    176 stokes_elements=find(md.elements_type(:,2)==StokesApproximationEnum()); %find the elements on the stokes domain
    177 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 borderstokes
    179 md.borderstokes=borderflags-md.gridonstokes; %remove stokes grids from this list
    180 
    181182%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));
     183md.ishutter=double(any(md.elements_type==HutterApproximationEnum));
     184md.ismacayealpattyn=double(any(md.elements_type==MacAyealApproximationEnum | md.elements_type==PattynApproximationEnum));
     185md.isstokes=double(any(md.elements_type==StokesApproximationEnum));
    185186
    186187end
  • issm/trunk/src/m/solutions/SolutionConfiguration.m

    r5246 r5433  
    1212        case DiagnosticSolutionEnum,
    1313                numanalyses=6;
     14                %analyses=[DiagnosticHorizAnalysisEnum];
    1415                analyses=[DiagnosticHorizAnalysisEnum;DiagnosticVertAnalysisEnum;DiagnosticStokesAnalysisEnum;DiagnosticHutterAnalysisEnum;SurfaceSlopeAnalysisEnum;BedSlopeAnalysisEnum];
    1516
  • issm/trunk/src/m/solutions/diagnostic_core.m

    r5317 r5433  
    5555       
    5656
    57         if dim==3,
     57        if dim==3 & ~isstokes,
    5858       
    5959                displaystring(verbose,'\n%s',['computing vertical velocities...']);
    6060                femmodel=SetCurrentConfiguration(femmodel,DiagnosticVertAnalysisEnum);
    6161                femmodel=solver_linear(femmodel);
     62        end
    6263
    63                 if isstokes,
     64        if isstokes,
    6465
    65                         displaystring(verbose,'\n%s',['update boundary conditions for stokes using velocities previously computed...']);
    66                         femmodel=ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum);
     66%               displaystring(verbose,'\n%s',['update boundary conditions for stokes using velocities previously computed...']);
     67%               femmodel=ResetBoundaryConditions(femmodel,DiagnosticStokesAnalysisEnum);
    6768
    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);
    7272        end
    7373
Note: See TracChangeset for help on using the changeset viewer.