Commit 40602d75 by Pierre Cazenave

parent 75844713
 ... ... @@ -24,8 +24,8 @@

Subsequent directories:

• mat
• plots
• surface_plots
• timeseries
• transect_plots
• plots
• surface_plots
• transect_plots

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

Generated on Mon 04-Feb-2013 14:22:26 by m2html © 2005
\ No newline at end of file
Generated on Tue 18-Dec-2012 12:37:31 by m2html © 2005
0076 if(ftbverbose) 0077 fprintf('%d points provided\n',npts) 0078 end 0079 0080 % add to mesh object 0081 Mobj.nSponge = Mobj.nSponge + 1; 0082 Mobj.nSpongeNodes(Mobj.nSponge) = npts; 0083 Mobj.sponge_nodes(Mobj.nSponge,1:npts) = SpongeList; 0084 Mobj.sponge_name{Mobj.nSponge} = SpongeName; 0085 Mobj.sponge_fac(Mobj.nSponge) = SpongeCoeff; 0086 0087 if max(size(SpongeRadius))==1 % if you have a constant sponge radius 0088 Mobj.sponge_rad(Mobj.nSponge) = SpongeRadius; 0089 else % if you have a variable sponge radius 0090 Mobj.sponge_rad(Mobj.nSponge,1:npts) = SpongeRadius; 0091 end 0092 0093 if(ftbverbose) 0094 fprintf(['end : ' subname '\n']) 0095 end 0096
Generated on Mon 04-Feb-2013 14:22:28 by m2html © 2005
\ No newline at end of file

PURPOSE

Calculate a variable sponge radius based on distance to the boundary

SYNOPSIS

DESCRIPTION

Calculate a variable sponge radius based on distance to the boundary
node's furthest neighbour.

DESCRIPTION
Calculates the sponge radius for each node on the open boundary, based
on the minimum of either the distance to the node's furthest
neighbour, or 100 km.

INPUT
Mobj = Matlab mesh object
Nlist = List of nodes

OUTPUT

EXAMPLE USAGE

Author(s)
Karen Thurston (National Oceanography Centre, Liverpool)

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

CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

SOURCE CODE

0002
0003 % Calculate a variable sponge radius based on distance to the boundary
0004 % node's furthest neighbour.
0005 % (Adapted from Phil Hall's 'produce_netcdf_input_data.py')
0006 %
0008 %
0009 % DESCRIPTION
0010 %    Calculates the sponge radius for each node on the open boundary, based
0011 %    on the minimum of either the distance to the node's furthest
0012 %    neighbour, or 100 km.
0013 %
0014 % INPUT
0015 %    Mobj = Matlab mesh object
0016 %    Nlist = List of nodes
0017 %
0018 % OUTPUT
0020 %
0021 % EXAMPLE USAGE
0023 %
0024 % Author(s)
0025 %    Karen Thurston (National Oceanography Centre, Liverpool)
0026 %
0027 %==========================================================================
0029 global ftbverbose
0030 if(ftbverbose)
0031   fprintf('\n')
0032   fprintf(['begin : ' subname '\n'])
0033 end
0034
0035 %--------------------------------------------------------------------------
0036 % Get a unique list and make sure they are in the range of node numbers
0037 %--------------------------------------------------------------------------
0038 Nlist = unique(Nlist);
0039
0041
0042 % For each node on the open boundary
0043 for i =1:length(Nlist)
0044     % Find the neighbouring nodes
0045     [r,c]=find(Mobj.tri==Nlist(i));
0046     neighbours = unique(Mobj.tri(r,:));
0047
0048     % Remove the node of interest from the neighbours list
0049     n = find(neighbours~=Nlist(i));
0050     neighbours = neighbours(n);
0051
0052     % Calculate the arc length (in degrees) between the node and its
0053     % neighbours
0054     arclen = distance(Mobj.lat(Nlist(i)),Mobj.lon(Nlist(i)),...
0055         Mobj.lat(neighbours),Mobj.lon(neighbours));
0056
0057     % Convert from degrees to whole metres
0058     arclen = ceil(1000*deg2km(arclen));
0059
0060     % If the smallest distance is less than 100km, keep it
0063     end
0064 end
0065
0066 if(ftbverbose)
0067   fprintf(['end   : ' subname '\n'])
0068 end
0069

Generated on Mon 04-Feb-2013 14:22:28 by m2html © 2005
\ No newline at end of file
 Description of get_AMM
Home > fvcom_prepro > get_AMM.m

get_AMM

PURPOSE

Extract boundary forcing information from NOC Operational Tide Surge

SYNOPSIS

function [Mobj] = get_AMM(Mobj,StartDate,EndDate,ModelFolder)

DESCRIPTION

Extract boundary forcing information from NOC Operational Tide Surge
Model output output

function get_AMM(Mobj,StartDate,EndDate,ModelFolder)

DESCRIPTION:
Extract boundary forcing information from NOC Operational Tide Surge
Model output and interpolate to FVCOM open boundary nodes.

INPUT
Mobj          = Matlab mesh object
StartDate     = Start date and time for FVCOM run
EndDate       = End date and time for FVCOM run
ModelFolder   = Location of AMM/S12 hourly outputs

OUTPUT:
Mobj.surfaceElevation = Addition to Matlab mesh object

EXAMPLE USAGE
function get_AMM(Mobj,StartDate,EndDate,ModelFolder)

Author(s):
Karen Thurston (National Oceanography Centre Liverpool)

Revision history
2012-12-04 First version.

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

CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

SOURCE CODE

0001 function [Mobj] = get_AMM(Mobj,StartDate,EndDate,ModelFolder)
0002
0003 % Extract boundary forcing information from NOC Operational Tide Surge
0004 % Model output output
0005 %
0006 % function get_AMM(Mobj,StartDate,EndDate,ModelFolder)
0007 %
0008 % DESCRIPTION:
0009 %    Extract boundary forcing information from NOC Operational Tide Surge
0010 %    Model output and interpolate to FVCOM open boundary nodes.
0011 %
0012 % INPUT
0013 %    Mobj          = Matlab mesh object
0014 %    StartDate     = Start date and time for FVCOM run
0015 %    EndDate       = End date and time for FVCOM run
0016 %    ModelFolder   = Location of AMM/S12 hourly outputs
0017 %
0018 % OUTPUT:
0019 %    Mobj.surfaceElevation = Addition to Matlab mesh object
0020 %
0021 % EXAMPLE USAGE
0022 %    function get_AMM(Mobj,StartDate,EndDate,ModelFolder)
0023 %
0024 % Author(s):
0025 %    Karen Thurston (National Oceanography Centre Liverpool)
0026 %
0027 % Revision history
0028 %    2012-12-04 First version.
0029 %
0030 %==============================================================================
0031 subname = 'get_AMM';
0032 global ftbverbose;
0033 if(ftbverbose);
0034   fprintf('\n')
0035   fprintf(['begin : ' subname '\n'])
0036 end;
0037
0038 %% Put the open boundary nodes into a single array for convenience
0039 count = 0;
0040 ObcNodes = nan(1,sum(Mobj.nObcNodes));
0041 for ob=1:Mobj.nObs
0042     nObcs = Mobj.nObcNodes(ob);
0043     for j=1:nObcs
0044         count = count + 1;
0045         ObcNodes(count) = Mobj.obc_nodes(ob,j);  % set the open boundary nodes
0046     end
0047 end
0048
0049 % Create an array of hourly timesteps
0050 timesteps = datevec(datenum(StartDate):1/24:datenum(EndDate));
0051
0052 % Initialise an array for the sea surface elevation
0053 SurfaceElevation = nan(count,size(timesteps,1));
0054
0055 % For each timestep, find the appropriate AMM/S12 file and extract the
0056 % surface elevation
0057 for i=1:size(timesteps,1)
0058     % Create AMM/S12 output filename from date
0059     % First, accommodate Operational Model idiosyncracy about output times
0060     if timesteps(i,3)==1 && sum(timesteps(i,4:6)) == 0
0062         AMMfile=[ModelFolder,num2str(tempdate(1)),'-',num2str(tempdate(2),'%02i'),'.nc'];
0063     else
0064         AMMfile=[ModelFolder,num2str(timesteps(i,1)),'-',num2str(timesteps(i,2),'%02i'),'.nc'];
0065     end
0066
0067     % Convert FVCOM timestep into AMM/S12 output (seconds since
0068     % 20071101:000000)
0069     AMM_time = etime(timesteps(i,:),[2007,11,01,0,0,0]);
0070
0071     % Load the timeseries from the AMM/S12 output file
0073
0074     % Locate the appropriate timestep number
0075     AMM_timestep = find(AMM_timeseries==AMM_time);
0076
0077     % Load the sea surface elevation ouptut, lat and lon
0078     AMM_elev = ncread(AMMfile,'zet',[1 1 AMM_timestep],[Inf Inf 1])';
0081
0082     % Interpolate the sea surface elevation output to the open boundary
0083     % nodes
0084     [X,Y]=meshgrid(AMM_lon,AMM_lat);
0085     SurfaceElevation(:,i) = interp2(X,Y,AMM_elev,Mobj.lon(ObcNodes),...
0086         Mobj.lat(ObcNodes));
0087 end
0088
0089 Mobj.surfaceElevation = SurfaceElevation;
0090
0091 if(ftbverbose);
0092     fprintf(['end   : ' subname '\n']);
0093 end

Generated on Mon 04-Feb-2013 14:22:28 by m2html © 2005
\ No newline at end of file
 Description of get_HYCOM_forcing
Home > fvcom_prepro > get_HYCOM_forcing.m

get_HYCOM_forcing

PURPOSE

Get mean flow, temperature and salinity data from HYCOM model outputs

SYNOPSIS

function data = get_HYCOM_forcing(Mobj, modelTime)

DESCRIPTION

Get mean flow, temperature and salinity data from HYCOM model outputs
through their OPeNDAP server.

data = get_HYCOM_forcing(Mobj, modelTime)

DESCRIPTION:
Using OPeNDAP, extract the necessary parameters to create an FVCOM
forcing file. Requires the OPeNDAP toolbox (see below for where to get
it).

INPUT:
Mobj - MATLAB mesh object
modelTime - Modified Julian Date start and end times

OUTPUT:
data - struct of the data necessary to force FVCOM. These can be
interpolated onto an unstructured grid in Mobj using
grid2fvcom.m.

The parameters which are obtained from the HYCOM data are:
- temperature
- salinity
- u flow component
- v flow component
- sea surface height (ssh)

REQUIRES:
The OPeNDAP toolbox:
http://www.opendap.org/pub/contributed/source/ml-toolbox/

Author(s)
Pierre Cazenave (Plymouth Marine Laboratory)

Revision history:
2013-01-31 First version.

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

CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

SOURCE CODE

0001 function data = get_HYCOM_forcing(Mobj, modelTime)
0002 % Get mean flow, temperature and salinity data from HYCOM model outputs
0003 % through their OPeNDAP server.
0004 %
0005 % data = get_HYCOM_forcing(Mobj, modelTime)
0006 %
0007 % DESCRIPTION:
0008 %   Using OPeNDAP, extract the necessary parameters to create an FVCOM
0009 %   forcing file. Requires the OPeNDAP toolbox (see below for where to get
0010 %   it).
0011 %
0012 % INPUT:
0013 %   Mobj - MATLAB mesh object
0014 %   modelTime - Modified Julian Date start and end times
0015 %
0016 % OUTPUT:
0017 %   data - struct of the data necessary to force FVCOM. These can be
0018 %   interpolated onto an unstructured grid in Mobj using
0019 %   grid2fvcom.m.
0020 %
0021 % The parameters which are obtained from the HYCOM data are:
0022 %     - temperature
0023 %     - salinity
0024 %     - u flow component
0025 %     - v flow component
0026 %     - sea surface height (ssh)
0027 %
0028 % REQUIRES:
0029 %   The OPeNDAP toolbox:
0030 %       http://www.opendap.org/pub/contributed/source/ml-toolbox/
0031 %
0032 % Author(s)
0033 %   Pierre Cazenave (Plymouth Marine Laboratory)
00