Home > fvcom_prepro > tidal_turbine_example.m

tidal_turbine_example

PURPOSE ^

Example code showing how to make a tidal turbine parameter input netCDF

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 Example code showing how to make a tidal turbine parameter input netCDF
 file for FVCOM.

 Rory O'Hara Murray
 6 Oct 2015

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %
0002 % Example code showing how to make a tidal turbine parameter input netCDF
0003 % file for FVCOM.
0004 %
0005 % Rory O'Hara Murray
0006 % 6 Oct 2015
0007 %
0008 clear, close all
0009 
0010 % load in PFOW model grid and bathymetry
0011 Mobj = read_fvcom_mesh(['\\isilonml\Shelf_Model\PFOW\1_HD Model\4_Climatology Results\input\PFOW_SMS_1_grd.dat']);
0012 Mobj.h =  read_fvcom_bath('\\isilonml\Shelf_Model\PFOW\1_HD Model\4_Climatology Results\input\PFOW_SMS_1_dep.dat');
0013 
0014 lonc = nodes2elems(Mobj.x,Mobj); % calculate approximate x-coordinate at the centre of each element
0015 latc = nodes2elems(Mobj.y,Mobj); % calculate approximate y-coordinate at the centre of each element
0016 [xc yc] = ll2utm(lonc, latc, 30);
0017 
0018 % calculate depth at the centre of each element
0019 Mobj.hc = mean(Mobj.h(Mobj.tri),2);
0020 
0021 % setup empty turbine array
0022 turbine.numbers     = single(zeros(Mobj.nElems,1));
0023 turbine.sigma_layer = single(zeros(Mobj.nElems,10));
0024 turbine.area        = single(zeros(Mobj.nElems,1));
0025 % turbine.thrust      = single(zeros(Mobj.nElems,1));
0026 % turbine.drag        = single(zeros(Mobj.nElems,1));
0027 
0028 % Example turbine positions in the Inner Sound of Stroma
0029 TurbinePositionsll = [-3.137,58.661; ...
0030 -3.12945337127092,58.6596303572796; ...
0031 -3.12960283663035,58.6600269324843; ...
0032 -3.13193517522843,58.658758560404; ...
0033 -3.1320846649985,58.659155132772];
0034 
0035 [TurbinePositions(:,1) TurbinePositions(:,2)] = ll2utm(TurbinePositionsll(:,1), TurbinePositionsll(:,2), 30);
0036 
0037 % For each turbine find which element it is in and count the number of
0038 % turbines in each element
0039 I = fun_nearest2D(TurbinePositions(:,1), TurbinePositions(:,2), xc, yc);
0040 for ii=1:length(I)
0041     turbine.numbers(I(ii)) = turbine.numbers(I(ii)) + 1;
0042 end
0043 turbinesI = turbine.numbers>0;
0044 numTurbineElems = sum(turbinesI);       % total number of elements with turbines in
0045 numTurbines = sum(turbine.numbers);     % total number of turbines
0046 
0047 
0048 % loop through each turbine and work out the fraction spread over each sigma layer
0049 for ii=find(turbinesI)'
0050     turbine.sigma_layer(ii,:) = turbine_area_sigma(Mobj.hc(ii), 15, 10);
0051 end
0052 
0053 % an alternative (simpler) way of specifying the fractional split across
0054 % sigma layers
0055 % turbine.sigma_layer(turbinesI,:) = ones(numTurbineElems,1)*[0 0 0 0 0 0.25 0.25 0.25 0.25 0];
0056 
0057 % turbine rotor swept area - 10 m radius.
0058 turbine.area(turbinesI) = 10*10*pi;
0059 
0060 % The thrust curve is currently not inputted into FVCOM, this could be
0061 % added in the future though.
0062 % turbine.thrust_curve = [0.99 1 1.25 1.5 1.75 2 2.25 2.5 2.75 3 3.25 3.5 3.75 4 4.01; 0 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.635 0.490 0.385 0.308 0.250 0.205 0];
0063 
0064 % write the netcdf input file
0065 write_FVCOM_TT(turbine,['Tidal_Turbines_Example.nc'],'Example Scenario with 5 tidal turbines in the inner sound');
0066 
0067 %% plot the location of the turbines
0068 %plot_fvcom_field(Mobj,elems2nodes(turbine.numbers,Mobj), 'grd', 'w')
0069 plot_fvcom_field(Mobj,single(turbinesI), 'grd', 'w') 
0070 colormap( jet(2) );
0071 daspect([1 1 1])
0072 
0073

Generated on Mon 07-Dec-2015 09:59:26 by m2html © 2005