slopecompute

PURPOSE ^

SLOPECOMPUTE - compute the slope of the bed or the surface on the grids

SYNOPSIS ^

function md=slopecompute(md,field)

DESCRIPTION ^

SLOPECOMPUTE - compute the slope of the bed or the surface on the grids

   Usage:
      md=slopecompute(md,field)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function md=slopecompute(md,field)
0002 %SLOPECOMPUTE - compute the slope of the bed or the surface on the grids
0003 %
0004 %   Usage:
0005 %      md=slopecompute(md,field)
0006 
0007 % Define global variables
0008 iceglobal
0009 global gridset
0010 
0011 if ~strcmpi(field, 'bed') & ~strcmpi(field, 'surface')
0012     error('slope compute error message: bed and surface computing only ');
0013 end
0014 
0015 %determine if run is parallel
0016 if strcmpi(md.cluster,'yes'), cluster=1; else cluster=0;end;
0017 
0018 %for now, only serial support is in
0019 if cluster,
0020     error('slopecompute error message: parallel support not implemented yet');
0021 end
0022 
0023 %First, build elements,grids,loads, etc ... for horizontal, base vertical and vertical model
0024 if strcmpi(field, 'bed'),
0025     m_bs=CreateFemModel(md,'bed_slope_compute');
0026 elseif strcmpi(field, 'surface'),
0027     m_ss=CreateFemModel(md,'surface_slope_compute');
0028 end
0029 
0030 if strcmpi(field, 'bed'),
0031     slopex=icediagnostic_core_linear(m_bs,'bed_slope_compute_x');
0032     slopey=icediagnostic_core_linear(m_bs,'bed_slope_compute_y');
0033     
0034     slopex=slopex(1:6:end);
0035     slopey=slopey(1:6:end);
0036 
0037     if strcmpi(md.type,'3d'),
0038         slopex=project3d(md,project2d(md,slopex,1),'node');
0039         slopey=project3d(md,project2d(md,slopey,1),'node');
0040     end
0041 
0042     md.bed_slopex=slopex;
0043     md.bed_slopey=slopey;
0044     
0045 elseif strcmpi(field, 'surface'),
0046     slopex=icediagnostic_core_linear(m_ss,'surface_slope_compute_x');
0047     slopey=icediagnostic_core_linear(m_ss,'surface_slope_compute_y');
0048         
0049     slopex=slopex(1:6:end);
0050     slopey=slopey(1:6:end);
0051 
0052     if strcmpi(md.type,'3d'),
0053         slopex=project3d(md,project2d(md,slopex,md.numlayers),'node');
0054         slopey=project3d(md,project2d(md,slopey,md.numlayers),'node');
0055     end
0056 
0057     md.surface_slopex=slopex;
0058     md.surface_slopey=slopey;
0059 end
0060

Generated on Sun 29-Mar-2009 20:22:55 by m2html © 2003