Changeset 23462


Ignore:
Timestamp:
11/09/18 09:05:58 (6 years ago)
Author:
Mathieu Morlighem
Message:

BUG: make sure vx and vy are initialized before they are used and force them to be 0 on boundary

File:
1 edited

Legend:

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

    r23066 r23462  
    3838                iomodel->FetchDataToInput(elements,"md.mesh.vertexonsurface",MeshVertexonsurfaceEnum);
    3939        }
     40        iomodel->FetchDataToInput(elements,"md.mesh.vertexonboundary",MeshVertexonboundaryEnum);
    4041}/*}}}*/
    4142void GLheightadvectionAnalysis::UpdateParameters(Parameters* parameters,IoModel* iomodel,int solution_enum,int analysis_enum){/*{{{*/
     
    6162        /*Intermediaries */
    6263        int        domaintype,dim;
    63         IssmDouble Jdet,D_scalar;
     64        IssmDouble Jdet,D_scalar,onboundary;
    6465        IssmDouble vel,vx,vy;
    6566        IssmDouble* xyz_list = NULL;
     
    8990   Input* vx_input=element->GetInput(VxEnum); _assert_(vx_input);
    9091        Input* vy_input=element->GetInput(VyEnum); _assert_(vy_input);
     92        Input* bc_input=element->GetInput(MeshVertexonboundaryEnum); _assert_(bc_input);
    9193
    9294        IssmDouble h = element->CharacteristicLength();
     
    104106                D_scalar=gauss->weight*Jdet;
    105107
     108                /*Get velocity*/
     109                vx_input->GetInputValue(&vx,gauss);
     110                vy_input->GetInputValue(&vy,gauss);
     111                bc_input->GetInputValue(&onboundary,gauss);
     112                if(onboundary>0.){
     113                        /*We do not want to advect garbage, make sure only diffusion is applied on boundary*/
     114                        vx = 0.; vy = 0.;
     115                }
     116
    106117                /*Diffusion */
    107118                if(sqrt(vx*vx+vy*vy)<1000./31536000.){
    108                         IssmPDouble kappa = -10;
     119                        IssmPDouble kappa = -10.;
    109120                        for(int i=0;i<numnodes;i++){
    110121                                for(int j=0;j<numnodes;j++){
     
    113124                        }
    114125                }
     126
    115127                /*Advection: */
    116                 vx_input->GetInputValue(&vx,gauss);
    117                 vy_input->GetInputValue(&vy,gauss);
    118128                for(int i=0;i<numnodes;i++){
    119129                        for(int j=0;j<numnodes;j++){
     
    122132                }
    123133
    124                 /*Artifficial diffusivity*/
     134                /*Artificial diffusivity*/
    125135                vel=sqrt(vx*vx + vy*vy)+1.e-14;
    126136                D[0][0]=D_scalar*h/(2.*vel)*fabs(vx*vx);  D[0][1]=D_scalar*h/(2.*vel)*fabs(vx*vy);
Note: See TracChangeset for help on using the changeset viewer.