Home > fvcom_prepro > set_spectide.m

set_spectide

PURPOSE ^

Setup spectral tides on the open boundary and dump a spectral file

SYNOPSIS ^

function set_spectide(Mobj,nComps,SpectralFile,MyTitle)

DESCRIPTION ^

 Setup spectral tides on the open boundary and dump a spectral file

 function set_spectide(Mobj,nComps,SpectralFile,MyTitle)

 DESCRIPTION:
    Setup spectral tides on the open boundary and dump a spectral file
    This is a USER DEFINED driver program for the FVCOM spectral tide
    It requires USER Modification to work

 INPUT
    Mobj         = Matlab mesh object
    nComps       = Number of tidal components
    SpectralFile = Output file name
    MyTitle     = Title in resulting NetCDF file.

 OUTPUT:

 EXAMPLE USAGE
    set_spectide(Mobj,nComps,SpectralFile,MyTitle)

 Author(s):
    Geoff Cowles (University of Massachusetts Dartmouth)
    Pierre Cazenave (Plymouth Marine Laboratory)

 Revision history
    2012-06-15 Added support for variables when calling set_spectide.
     2012-08-02 Can now write out equilibrium amplitudes and beta love numbers.

==============================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function set_spectide(Mobj,nComps,SpectralFile,MyTitle)
0002 
0003 % Setup spectral tides on the open boundary and dump a spectral file
0004 %
0005 % function set_spectide(Mobj,nComps,SpectralFile,MyTitle)
0006 %
0007 % DESCRIPTION:
0008 %    Setup spectral tides on the open boundary and dump a spectral file
0009 %    This is a USER DEFINED driver program for the FVCOM spectral tide
0010 %    It requires USER Modification to work
0011 %
0012 % INPUT
0013 %    Mobj         = Matlab mesh object
0014 %    nComps       = Number of tidal components
0015 %    SpectralFile = Output file name
0016 %    MyTitle     = Title in resulting NetCDF file.
0017 %
0018 % OUTPUT:
0019 %
0020 % EXAMPLE USAGE
0021 %    set_spectide(Mobj,nComps,SpectralFile,MyTitle)
0022 %
0023 % Author(s):
0024 %    Geoff Cowles (University of Massachusetts Dartmouth)
0025 %    Pierre Cazenave (Plymouth Marine Laboratory)
0026 %
0027 % Revision history
0028 %    2012-06-15 Added support for variables when calling set_spectide.
0029 %     2012-08-02 Can now write out equilibrium amplitudes and beta love numbers.
0030 %
0031 %==============================================================================
0032 subname = 'set_spectide';
0033 global ftbverbose;
0034 if(ftbverbose);
0035   fprintf('\n')
0036   fprintf(['begin : ' subname '\n'])
0037 end;
0038 
0039 %------------------------------------------------------------------------------
0040 % Set Component Periods
0041 %------------------------------------------------------------------------------
0042 % Components = {   'M2',    'N2',    'S2',   'O1',    'K1'};
0043 % Period     = [44714.16, 45570.05, 43200, 92949.63, 86164.09];
0044 
0045 %------------------------------------------------------------------------------
0046 % Setup user defined phase and amplitude along the open boundaries
0047 % need to set:
0048 %   1.) Period - vector containing component period in seconds
0049 %   2.) Amp    - array of size [Nobcs, Ncomponents] containing amplitude in m
0050 %   3.) Phase  - array of size [Nobcs, Ncomponents] containing phase in degrees
0051 %------------------------------------------------------------------------------
0052 if nComps > numel(Mobj.Components)
0053     error('Too few components given in Mobj. Check and try again.')
0054 end
0055 
0056 if(Mobj.nObs==0)
0057     warning('cannot setup spectral open boundary, there is no open boundary in the mesh struct')
0058     return
0059 end
0060 
0061 cnt = 0;
0062 Amp = nan(sum(Mobj.nObcNodes),nComps);
0063 Phase = nan(sum(Mobj.nObcNodes),nComps);
0064 ObcNodes = nan(1,sum(Mobj.nObcNodes));
0065 for ob=1:Mobj.nObs
0066     nObcs = Mobj.nObcNodes(ob);
0067     for j=1:nObcs
0068         cnt = cnt + 1;
0069         ObcNodes(cnt) = Mobj.obc_nodes(ob,j);  % set the open boundary nodes
0070 
0071         Amp(cnt,:) = Mobj.amp_obc{ob}(:,j);
0072         Phase(cnt,:) = Mobj.phase_obc{ob}(:,j);
0073     end
0074 end
0075 
0076 %------------------------------------------------------------------------------
0077 % Dump a spectral tide file in NetCDF
0078 %------------------------------------------------------------------------------
0079 %write_FVCOM_spectide(ObcNodes,Mobj.period_obc(1:nComps),Phase,Amp,Mobj.beta_love,Mobj.equilibrium_amp,SpectralFile,MyTitle)
0080 write_FVCOM_spectide(ObcNodes,Mobj.Components,Mobj.period_obc(1:nComps),Phase,Amp,Mobj.beta_love,Mobj.equilibrium_amp,SpectralFile,MyTitle)
0081 if(ftbverbose); fprintf(['end   : ' subname '\n']); end

Generated on Tue 18-Dec-2012 12:37:31 by m2html © 2005