-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInertialDiss.m
More file actions
66 lines (65 loc) · 2.04 KB
/
InertialDiss.m
File metadata and controls
66 lines (65 loc) · 2.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
function [epsilon,k,phi]=InertialDiss(dt,velocity,lfft,col);
% function [epsilon,k,phi]=InertialDiss(dt,velocity,lfft,col);
%
% Calculate the turbulent dissipation rate from velocity time series
% Assumes isotropic turbulence with an inertial subrange near k=0.1*k_s
% Following Nasmyth, Grant, Stewart, etc. and Green 1992.
% Inputs: dt is the sample rate in seconds i.e. 1/4
% velocity(3,:) is the [U,V,W] time series in m/s
% Optional: lfft = length of fft (default 128)
% col = color of spectra plot, default 'b'
% Output: epsilon is the turbulent dissipation rate in m2/s3
% k is the wavenumber vector
% phi is the wavenumber spectra phi(k)
% Assumes Temp=10, Sal=31, Density = 1024 --> viscosity=1.345e-6
% Generates a plot of the spectra and the fit in the -5/3 inertial subrange
% RKD 05/10
if nargin<3, lfft=128; end
if nargin<4, col='b'; end
U=velocity(1,:);V=velocity(2,:);W=velocity(3,:);
spd=mean(sqrt(U.^2 + V.^2));
f2k=spd/(2*pi);
%
[pspec,f]=ps(W,dt,lfft);
k=f./f2k;
phi=pspec*f2k;
loglog(k,phi,col);
hold on
%
% now look for a best fit to the Nasmyth spectra in the length scale range 0.5 - 1.0 m
% corresponding to wavenumbers k = 6.3 t0 12.6
varmin=1e20;
nu=1.345e-6;
k1=10;k2=21; % between scales of 0.63m and 0.30m
indx=find(k > k1 & k < k2);
kfit=k(indx);
m=length(kfit);
eps=1e-10*rand(1);
go=1;
while go,
[phiN,kN]=nasmyth2(eps,nu,m,kfit);
phiN=phiN./(kN.*kN);
var=sum((phi(indx)-phiN).^2);
varmin=min(var,varmin);
if varmin==var,
epsilon=eps;
indx0=indx;
end
eps=eps*1.1;
if eps> 1e-4,
go=0;
end
end
[phiN,kN]=nasmyth2(epsilon,nu,length(k),k);
loglog(kN,phiN./(kN.*kN),'k');
[phiN,kN]=nasmyth2(epsilon,nu,length(k(indx0)),k(indx0));
loglog(kN,phiN./(kN.*kN),'r');
axis([5e-2 5e2 1e-10 1e-3]);
set(gca,'YTick',[1e-10 1e-7 1e-4]);
psslope(-5,3,2,2);
%
%xlabel('Wavenumber (k_1) [m^{-1}]');
ylabel('Velocity Spectra [\phi_{33}(k_1)]')
title(['Epsilon = ',num2str(epsilon),'[W/kg]']);
hold off
% fini