Changeset 130


Ignore:
Timestamp:
04/29/09 14:54:53 (16 years ago)
Author:
Mathieu Morlighem
Message:

Initialize viscosity with current velocity in MacAyeal

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk/src/m/solutions/macayeal/diagnostic.m

    r119 r130  
    2525x=md.x;
    2626y=md.y;
    27 
    2827index=md.elements;index=sort(index,2); %necessary
    2928nods=md.numberofgrids;
     
    4746drag_type=md.drag_type;
    4847drag=md.drag;
    49 
    5048criterion_rel=md.eps_rel;
    5149criterion_abs=md.eps_abs;
     
    5351B=md.B; B_bar=(B(index(:,1))+B(index(:,2))+B(index(:,3)))/3;
    5452glen_coeff=md.n;
     53
     54%initialize velocities if any
     55if (~isnan(md.vx) & ~isnan(md.vy)),
     56        u=md.vx/yts; v=md.vy/yts;
     57        velocity_is_present=1;
     58else
     59        velocity_is_present=0;
     60end
    5561
    5662%average of p and q over the grids (size nel->nods)
     
    266272
    267273        %Compute viscosity (as in ICE and CIELO)
    268         if convergence_count==1;
     274        if (convergence_count==1),
    269275                %Initialize viscosity
    270                 nu_bar=viscosity(index,nel,alpha,beta,{},{},B_bar,glen_coeff);
    271         elseif convergence_count==2,
     276                if ~velocity_is_present;
     277                        nu_bar=viscosity(index,nel,alpha,beta,{},{},B_bar,glen_coeff);
     278                else
     279                        nu_bar=viscosity(index,nel,alpha,beta,u,v,B_bar,glen_coeff);
     280                        nu_bar(find(nu_bar<=0))=-nu_bar(find(nu_bar<=0));
     281                        u_old=u; v_old=v;
     282                end
     283        elseif (convergence_count==2),
    272284                nu_bar_oldvalue=nu_bar;
    273285                nu_bar=viscosity(index,nel,alpha,beta,u,v,B_bar,glen_coeff);
     
    421433
    422434        %Test for direct shooting convergence
    423         if convergence_count>1,
     435        if (convergence_count>1 | velocity_is_present),
    424436
    425437                ug=[u_old;v_old];
Note: See TracChangeset for help on using the changeset viewer.