Glam output

From SourceWiki
Revision as of 15:42, 1 August 2007 by Steve-price (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


Output from GLAM

Selecting output from GLAM

GLAM outputs 2d and 3d variables in files glam.2df and glam.3df, respectively (located in subversion repository "glam-matlab"). These files are binary and can be read with MATLAB scripts (see below). The interval between output is selected using the variable nout within glam.nml. The three elements of this array contain intervals for point, 2d and 3d output (the first is no longer used). The unit is years. Note that GLAM will also output at the first (tstr) and final (tstr+trun) time step irrespective of these settings; the actual time integration loop runs from tstr+tinc until trun is exceeded. The variable nstrv can be used to control when output starts in a time-dependent simulation; output will only be written after nstr (in years). This is useful if we are only interested in the equilibrium.

The variables that are output can be selected by editing glam.out. This file contains two arrays (which2d and which3d). Output for a particular variable is selected if the appropriate entry in the array is 1 (otherwise set to zero). The variables currently available for output are shown in Tables 1 and 2.

Table 1. 3d variables available from GLAM.
Variable Grid Units MATLAB name
1 Horizontal velocity in x Staggered m yr-1 u
2 Horizontal velocity in y Staggered m yr-1 v
3 Vertical velocity Normal m yr-1 w
4 Vertical velocity of grid Normal m yr-1 wg
5 Glen’s A Normal Pa-3 yr-1 a
6 Temperature Normal deg. C t
7 Effective viscosity Normal Pa s evs
8 Effective stress Normal Pa tau
9 Vertical shear stress in x Normal Pa txz
10 Vertical shear stress in y Normal Pa tyz
11 Horizontal shear stress Normal Pa txy
12 Longitudinal stress deviator in x Normal Pa txx
13 Longitudinal stress deviator in y Normal Pa tyy
14 Gravitational driving stress in x Normal Pa gdx
15 Gravitational driving stress in y Normal Pa gdy
Horizontal distances Both m xn yn xs ys
Vertical distances Both m zn zs

Table 2. needs to be done

Viewing output from GLAM in MATLAB

The GLAM output files can be loaded using MATLAB scripts glam2d.m and glam3d.m. Both are called using [a] = glam3d(N,'PATH'); (where N is the time step of interest and PATH is the relative location of the output file, e.g. ‘.’ for same directory). These scripts create a MATLAB structure that can be referenced as follows. For 3d output, use a.NAME(I,J,K) where NAME is the variable’s MATLAB name (see Tables 1 and 2), I and J are horizontal indices and K the vertical index. Note that it is often necessary to compress the 3d array to a 2d array for plotting purposes using squeeze(). The command imagesc(squeeze(a.txz(:,:,end))) will produce an image of basal traction.