Commit 40602d75 by Pierre Cazenave

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

Subsequent directories:

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
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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Generated on Tue 18-Dec-2012 12:37:31 by m2html © 2005
0186 % hold on 0187 % plot(data(point,2), data(point,1), 'rx') 0188
Generated on Mon 04-Feb-2013 14:22:28 by m2html © 2005
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
 ... @@ -183,7 +183,11 @@ This function is called by: ... @@ -183,7 +183,11 @@ This function is called by: 0112 end 0112 end 0113 end 0113 end 0114 0114 0115 netcdf.close(ncERA) 0115 netcdf.close(ncERA)
Generated on Tue 18-Dec-2012 12:37:31 by m2html © 2005
0116 0117 if ftbverbose; 0118 fprintf(['end : ' subname '\n']) 0119 end
Generated on Mon 04-Feb-2013 14:22:28 by m2html © 2005
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
 ... @@ -46,8 +46,10 @@ ... @@ -46,8 +46,10 @@ Author(s): Author(s): Geoff Cowles (University of Massachusetts Dartmouth) Geoff Cowles (University of Massachusetts Dartmouth) Karen Thurston (National Oceanography Centre, Liverpool) Revision history Revision history 2013-01-18 Added support for variable sponge radius ============================================================================== ============================================================================== ... @@ -85,46 +87,54 @@ This function is called by: ... @@ -85,46 +87,54 @@ This function is called by: 0019 % 0019 % 0020 % Author(s): 0020 % Author(s): 0021 % Geoff Cowles (University of Massachusetts Dartmouth) 0021 % Geoff Cowles (University of Massachusetts Dartmouth) 0022 % 0022 % Karen Thurston (National Oceanography Centre, Liverpool) 0023 % Revision history 0023 % 0024 % 0024 % Revision history 0025 %============================================================================== 0025 % 2013-01-18 Added support for variable sponge radius 0026 subname = 'write_FVCOM_sponge'; 0026 % 0027 global ftbverbose 0027 %============================================================================== 0028 if(ftbverbose) 0028 subname = 'write_FVCOM_sponge'; 0029 fprintf('\n'); fprintf(['begin : ' subname '\n']); 0029 global ftbverbose 0030 end; 0030 if(ftbverbose) 0031 0031 fprintf('\n'); fprintf(['begin : ' subname '\n']); 0032 %------------------------------------------------------------------------------ 0032 end; 0033 % Parse input arguments 0033 0034 %------------------------------------------------------------------------------ 0034 %------------------------------------------------------------------------------ 0035 if(exist('Mobj')*exist('filename')==0) 0035 % Parse input arguments