Changeset 17363


Ignore:
Timestamp:
02/27/14 13:16:16 (11 years ago)
Author:
jbondzio
Message:

CHG: Instead of extrapolation along normal, diffuse variable outward. Once initialization of levelset function to signed distance function is working, revert this step.

File:
1 edited

Legend:

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

    r17274 r17363  
    5757        if(VerboseSolution()) _printf0_("extrapolation of " << EnumToStringx(extvar_enum) << ": call computational core:\n");
    5858        solutionsequence_linear(femmodel);
    59 
     59       
     60        save_results=true;
     61        if(save_results){
     62                if(VerboseSolution()) _printf0_("   saving results\n");
     63                int outputs[2] = {VxEnum,VyEnum};
     64                femmodel->RequestedOutputsx(&femmodel->results,&outputs[0],2);
     65        }
    6066
    6167}/*}}}*/
     
    8490        /*Initialize Element vector and other vectors*/
    8591        ElementMatrix* Ke     = element->NewElementMatrix();
    86         IssmDouble*    B      = xNew<IssmDouble>(dim*numnodes);
    8792        IssmDouble*    Bprime = xNew<IssmDouble>(dim*numnodes);
    8893        IssmDouble     D[dim][dim];
    8994
    9095        /*Retrieve all inputs and parameters*/
    91         Input* lsf_slopex_input=element->GetInput(LevelsetfunctionSlopeXEnum); _assert_(lsf_slopex_input);
    92         Input* lsf_slopey_input=element->GetInput(LevelsetfunctionSlopeYEnum); _assert_(lsf_slopey_input);
    9396        element->GetVerticesCoordinates(&xyz_list);
    94         h = element->CharacteristicLength();
    9597
    9698        /* Start  looping on the number of gaussian points: */
     
    100102
    101103                element->JacobianDeterminant(&Jdet,xyz_list,gauss);
    102                 GetB(B,element,xyz_list,gauss);
    103104                GetBprime(Bprime,element,xyz_list,gauss);
    104105
    105                 /* Get normal on ice boundary */
    106                 lsf_slopex_input->GetInputValue(&dlsf[0],gauss);
    107                 lsf_slopey_input->GetInputValue(&dlsf[1],gauss);
    108                 norm_dlsf=0.;
    109                 for(i=0;i<dim;i++) norm_dlsf+=dlsf[i]*dlsf[i];
    110                 norm_dlsf=sqrt(norm_dlsf); _assert_(norm_dlsf>0.);
    111                 for(i=0;i<dim;i++)
    112                         normal[i]=dlsf[i]/norm_dlsf;
    113                
    114106                D_scalar=gauss->weight*Jdet;
    115107
    116108                for(row=0;row<dim;row++)
    117109                        for(col=0;col<dim;col++)
    118                                 if(row==col)
    119                                         D[row][col]=D_scalar*normal[row];
    120                                 else
    121                                         D[row][col]=0.;
    122                 TripleMultiply(B,dim,numnodes,1,
     110                                D[row][col]=((row==col)?D_scalar:0.);
     111
     112                TripleMultiply(Bprime,dim,numnodes,1,
    123113                                        &D[0][0],dim,dim,0,
    124114                                        Bprime,dim,numnodes,0,
    125115                                        &Ke->values[0],1);
    126 
    127                 /* Stabilization *//*{{{*/
    128                 stabilization=1;
    129                 if (stabilization==0){/* no stabilization, do nothing*/}
    130                 else if(stabilization==1){
    131                         /* Artificial Diffusion */
    132                         element->ElementSizes(&hx,&hy,&hz);
    133                         h=sqrt( pow(hx*normal[0],2) + pow(hy*normal[1],2));
    134                         kappa=h/2.;
    135                         D[0][0]=D_scalar*kappa;
    136                         D[0][1]=0.;
    137                         D[1][0]=0.;
    138                         D[1][1]=D_scalar*kappa;
    139                         TripleMultiply(Bprime,dim,numnodes,1,
    140                                                 &D[0][0],dim,dim,0,
    141                                                 Bprime,dim,numnodes,0,
    142                                                 &Ke->values[0],1);
    143                 }
    144                 else if(stabilization==2){
    145                         /*Streamline upwinding - do not use this for extrapolation: yields oscillating results due to smoothing along normal, not across */
    146                         for(row=0;row<dim;row++)
    147                                 for(col=0;col<dim;col++)
    148                                         D[row][col]=h/(2.*1.)*normal[row]*normal[col];
    149 
    150                         TripleMultiply(Bprime,dim,numnodes,1,
    151                                                 &D[0][0],dim,dim,0,
    152                                                 Bprime,dim,numnodes,0,
    153                                                 &Ke->values[0],1);
    154                 }/*}}}*/
    155116        }/*}}}*/
    156117
    157118        /*Clean up and return*/
    158119        xDelete<IssmDouble>(xyz_list);
    159         xDelete<IssmDouble>(B);
    160120        xDelete<IssmDouble>(Bprime);
    161121        delete gauss;
Note: See TracChangeset for help on using the changeset viewer.