Changeset 22793


Ignore:
Timestamp:
05/17/18 12:19:20 (7 years ago)
Author:
adhikari
Message:

CHG: tutorial 1 completed

Location:
issm/trunk-jpl/examples/EsaWahr
Files:
2 added
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/examples/EsaWahr/runme.m

    r22791 r22793  
    11
    22clear all;
    3 steps=[4];
     3steps=[1:6]; % [1:6];
    44
    5 if any(steps==1)
    6         disp('   Step 1: Mesh creation');
     5if any(steps==0)
     6        disp('   Step 0: Mesh creation');
    77
    8         %Generate initial uniform mesh
     8        % Generate initial uniform mesh
    99        md=roundmesh(model,100000,10000);  % Domain radius and element size (meters)
    1010
    1111        save ./Models/EsaWahr.Mesh md;
    1212       
     13        plotmodel(md,'data','mesh');
     14        %export_fig('Fig0.pdf');
     15
     16end
     17
     18if any(steps==1)
     19        disp('   Step 1: Anisotropic mesh creation');
     20
     21        % Generate initial uniform mesh
     22        md=roundmesh(model,100000,1000);  % Domain radius and element size (meters)
     23        %plotmodel(md,'data','mesh');
     24
     25        % Define a fake field to have anisotropic meshing
     26        disc_radius=20*1000; % km => m
     27        rad_dist=sqrt(md.mesh.x.^2+md.mesh.y.^2);       % radial distance [m]
     28        field = abs(rad_dist-disc_radius);
     29        %plotmodel(md,'data',field);
     30
     31        md = bamg(md,'field',field,'err',50,'hmax',10000); % error in field in m
     32
     33        save ./Models/EsaWahr.Mesh md;
     34       
    1335        plotmodel (md,'data','mesh');
     36        %export_fig('Fig1.pdf');
    1437
    1538end
     
    2043
    2144        % primer
    22         nv=md.mesh.numberofvertices;
    23         ne=md.mesh.numberofelements;
    2445        rho_w_i=md.materials.rho_freshwater/md.materials.rho_ice;
    2546
     
    3051
    3152        % Define a 20-km radius disc and unload it by 1 meter water height equivalent uniformly 
    32         md.esa.deltathickness = zeros(ne,1);
     53        md.esa.deltathickness = zeros(md.mesh.numberofelements,1);
    3354        disc_radius=20; % km
    3455        rad_dist=sqrt(x_cent.^2+y_cent.^2)/1000;        % radial distance in km
     
    3859       
    3960        plotmodel (md,'data',md.esa.deltathickness,'title','Ice height equivalent [m]');
     61        %export_fig('Fig2.pdf');
    4062
    4163end
     
    6789        % Miscellaneous:
    6890        md.miscellaneous.name='EsaWahr';
     91        %% IGNORE BUT DO NOT DELETE %%
    6992       
    7093        save ./Models/EsaWahr.Parameterization md;
     
    86109        md=solve(md,'Esa');
    87110
    88         save ./Models/EsaWahr.EsaSolutions md;
     111        save ./Models/EsaWahr.Solution md;
    89112
    90113end
    91114
    92 return;
     115if any(steps==5)
     116        disp('   Step 5: Plot solutions');
     117        md = loadmodel('./Models/EsaWahr.Solution');
    93118
    94 % high-res mesh...
    95 % plot step.
    96 % analytical step.
    97 
    98        
     119        % m => mm
    99120        vert = md.results.EsaSolution.EsaUmotion*1000; % [mm]
    100         horz_n = md.results.EsaSolution.EsaNmotion*1000; % [mm]
    101         horz_e = md.results.EsaSolution.EsaEmotion*1000; % [mm]
     121        horz_n = md.results.EsaSolution.EsaYmotion*1000; % [mm]
     122        horz_e = md.results.EsaSolution.EsaXmotion*1000; % [mm]
    102123        horz = sqrt(horz_n.^2+horz_e.^2);
    103124
    104         % grid data from the center
    105         xi=[0:100:60000]; % 100 m resolution
    106         yi=zeros(1,length(xi));
    107         vert_track=griddata(md.mesh.x,md.mesh.y,vert,xi,yi,'linear');
    108         horz_track=griddata(md.mesh.x,md.mesh.y,horz,xi,yi,'linear');
    109 
    110         return;
    111 
    112         % figure S1a {{{
     125        % plot
    113126        set(0,'DefaultAxesFontSize',24,'DefaultAxesLineWidth',1,'DefaultTextFontSize',24,'DefaultLineMarkerSize',6);
    114127        figure('Position', [100, 100, 800, 600]);
     
    116129                'xTickLabel#all',[],'yTickLabel#all',[],...
    117130                'colormap#all','jet','colorbarcornerposition#all','south',...
    118                 'expdisp#all','../Exp/RoundDomain.exp',...
     131                'expdisp#all','./RoundDomain.exp',...
    119132                'gridded#all',1,...
    120133                'axispos#1',[0.02 0.505 0.47 0.47],...
     
    132145                'axispos',[0.505 0.02 0.47 0.47],...
    133146                'colorbarpos',[0.53,0.065,0.18,0.02],'colorbartitle#4','East-west [mm]');
    134         % }}}
    135         %export_fig('./Fig/Fig_S1a.pdf');
    136147
    137         % figure S1b {{{
    138         set(0,'DefaultAxesFontSize',24,'DefaultAxesLineWidth',1,'DefaultTextFontSize',24,'DefaultLineMarkerSize',6);
     148        %export_fig('Fig5.pdf');
     149
     150end
     151
     152if any(steps==6)
     153        disp('   Step 6: Compare results against Wahr semi-analytic solutions');
     154        md = loadmodel('./Models/EsaWahr.Solution');
     155
     156        % numerical solutions
     157        % m => mm
     158        vert = md.results.EsaSolution.EsaUmotion*1000; % [mm]
     159        horz_n = md.results.EsaSolution.EsaYmotion*1000; % [mm]
     160        horz_e = md.results.EsaSolution.EsaXmotion*1000; % [mm]
     161        horz = sqrt(horz_n.^2+horz_e.^2);
     162        % grid data from the center
     163        xi=[0:500:100000]; % 500 m resolution
     164        yi=zeros(1,length(xi));
     165        vert_track=griddata(md.mesh.x,md.mesh.y,vert,xi,yi,'linear');
     166        horz_track=griddata(md.mesh.x,md.mesh.y,horz,xi,yi,'linear');
     167
     168        % semi-analytic solution (Wahr et al., 2013, JGR, Figure 1)
     169        disc_radius = 20*1000; % 20 km
     170        [vert_wahr, horz_wahr] = wahr(disc_radius,xi,md.esa.love_h,md.esa.love_l);
     171
     172        % plot
     173        set(0,'DefaultAxesFontSize',16,'DefaultAxesLineWidth',1,'DefaultTextFontSize',16,'DefaultLineMarkerSize',6);
    139174        figure1=figure('Position', [100, 100, 700, 400]);
    140175        ylabel_1={'0',' ','1','','2','','3',''};
    141176        axes1 = axes('Layer','top','Position',[0.1 0.15 0.8 0.8],...
    142                 'XTick',[0:10:60],'xlim',[0 60],...
     177                'XTick',[0:10:100],'xlim',[0 100],...
    143178                'ylim',[0 3.5],'Ytick',[0:0.5:3.5],'yticklabel',ylabel_1);
    144179                box(axes1,'on'); hold(axes1,'all'); grid on;
    145180                xlabel(axes1,'Radial distance [km]');
    146181                ylabel(axes1,'Displacement [mm]');
    147                 plot([20 20],[0 3.5],'-.k','linewidth',2,'parent',axes1);
    148                 h1=plot(xi/1000,vert_track*917/1000,'color',[0.8500 0.3250 0.0980],'linewidth',3,'parent',axes1);
    149                 h2=plot(xi/1000,horz_track*917/1000,'b','linewidth',3,'parent',axes1);
     182                plot([20 20],[0 3.5],'-k','linewidth',2,'parent',axes1);
     183                % analytic soln
     184                h3=plot(xi/1000,vert_wahr,'-r','linewidth',5,'parent',axes1);
     185                h4=plot(xi/1000,horz_wahr,'-m','linewidth',5,'parent',axes1);
     186                % ISSM
     187                h1=plot(xi/1000,vert_track*917/1000,'-b','linewidth',3,'parent',axes1);
     188                h2=plot(xi/1000,horz_track*917/1000,'-c','linewidth',3,'parent',axes1);
    150189                % first box
    151190                ag1 = gca;
    152                 leg1a = legend(ag1,[h1,h2],'Vertical (upward)','Horizontal (away from disc)',1);
    153                 set(leg1a,'location','east','Orientation','Vertical','Box','Off','FontSize',24);
     191                leg1a = legend(ag1,[h3,h1,h4,h2],'Vertical (Wahr)','Vertical (ISSM)','Horizontal (Wahr)','Horizontal (ISSM)',1);
     192                set(leg1a,'location','east','Orientation','Vertical','Box','Off','FontSize',16);
    154193                %
    155194        set(gcf,'color','w');
    156         % }}}
    157         %export_fig('./Fig/Fig_S1b.pdf');
     195       
     196        %export_fig('Fig6.pdf');
    158197
     198end
    159199
Note: See TracChangeset for help on using the changeset viewer.