Changeset 17171


Ignore:
Timestamp:
01/24/14 15:57:39 (11 years ago)
Author:
jbondzio
Message:

CHG: Added artificial diffusion to extrapolation routine to stabilize solution

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/analyses/ExtrapolationAnalysis.cpp

    r17159 r17171  
    1515/*}}}*/
    1616void ExtrapolationAnalysis::UpdateElements(Elements* elements,IoModel* iomodel,int analysis_counter,int analysis_type){/*{{{*/
    17         int    stabilization,finiteelement;
     17        int    finiteelement;
    1818
    1919        /*Finite element type*/
     
    8383        IssmDouble dlevelset[dim],normal[dim];
    8484        IssmDouble norm_dlevelset;
     85        IssmDouble hx,hy,hz,kappa;
    8586        IssmDouble* xyz_list = NULL;
    8687
     
    101102        /* Start  looping on the number of gaussian points: */
    102103        Gauss* gauss=element->NewGauss(2);
    103         for(int ig=gauss->begin();ig<gauss->end();ig++){
     104        for(int ig=gauss->begin();ig<gauss->end();ig++){/*{{{*/
    104105                gauss->GaussPoint(ig);
    105106
     
    128129                                        &Ke->values[0],1);
    129130
     131                /* Stabilization *//*{{{*/
    130132                stabilization=1;
    131133                if (stabilization==0){/* no stabilization, do nothing*/}
    132134                else if(stabilization==1){
    133                         /*Streamline upwinding*/
    134                         for(row=0;row<dim;row++)
    135                                 for(col=0;col<dim;col++)
    136                                         D[row][col]=h/(2.*1.)*normal[row]*normal[col];
    137 
     135                        /* Artificial Diffusion */
     136                        element->ElementSizes(&hx,&hy,&hz);
     137                        h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
     138                        kappa=h/2.;
     139                        D[0][0]=D_scalar*kappa;
     140                        D[0][1]=0.;
     141                        D[1][0]=0.;
     142                        D[1][1]=D_scalar*kappa;
    138143                        TripleMultiply(Bprime,dim,numnodes,1,
    139144                                                &D[0][0],dim,dim,0,
     
    141146                                                &Ke->values[0],1);
    142147                }
    143         }
     148                else if(stabilization==2){
     149                        /*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
     150                        for(row=0;row<dim;row++)
     151                                for(col=0;col<dim;col++)
     152                                        D[row][col]=h/(2.*1.)*normal[row]*normal[col];
     153
     154                        TripleMultiply(Bprime,dim,numnodes,1,
     155                                                &D[0][0],dim,dim,0,
     156                                                Bprime,dim,numnodes,0,
     157                                                &Ke->values[0],1);
     158                }/*}}}*/
     159        }/*}}}*/
    144160
    145161        /*Clean up and return*/
     
    150166        return Ke;
    151167
    152         }/*}}}*/
     168}/*}}}*/
    153169ElementVector* ExtrapolationAnalysis::CreatePVector(Element* element){/*{{{*/
    154170
Note: See TracChangeset for help on using the changeset viewer.