Commit 5e256d18 authored by Jérémy Baudry's avatar Jérémy Baudry

nettoyage!

parent d380ec6c
File deleted
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000 0.0000000000000000
4.67950925783336522E-067 2.22629063774832403E-043 1.86047825022193849E-029 7.26884501201403012E-021 2.37388636149809682E-015 1.06929631400098977E-011 3.26805736321345173E-009 1.74290715738444442E-007 2.89921538309260074E-006 2.17440833634750726E-005 9.35026054732778790E-005 2.70691375180493105E-004 5.88858707265495782E-004 1.04046745784872399E-003 1.58646763233278709E-003 2.21413746427823362E-003 3.03256060311372574E-003 4.36234121430526846E-003 6.65167145503830007E-003 9.67152294436269058E-003 1.12773173537781685E-002 1.02218877788641249E-002 7.91893718082620560E-003 5.73020415903088484E-003 4.21942005067637953E-003 3.31030307813106120E-003 2.77627384988582675E-003 2.44069346588253726E-003 2.19977333455199150E-003 2.00224635066572655E-003 1.82692365653251698E-003 1.66659906324478652E-003 1.51918118656764727E-003 1.38394576701342861E-003 1.26034009460873099E-003 1.14772599771339892E-003 1.04537854225776085E-003 9.52528217916501479E-004 8.68398034709047962E-004 7.92229374888612971E-004 7.23298493270941277E-004 6.60926203581860619E-004 6.04482786654046526E-004 5.53389628981113338E-004 5.07118685465212347E-004 4.65190549475677723E-004 4.27171683928026036E-004 3.92671199296484299E-004 3.61337442763468887E-004 3.32854575163448927E-004 3.06939249970022651E-004 2.83337464540176550E-004 2.61821623141505273E-004 2.42187830234146884E-004 2.24253418333657207E-004 2.07854705551948184E-004 1.92844972152353476E-004 1.79092642113339549E-004 1.66479654018151678E-004 1.54900005033988496E-004 1.44258451929288615E-004
6.52602436873789001E-066 3.10477576885178824E-042 2.59461531743540874E-028 1.01371013641173847E-019 3.31061215827662809E-014 1.49123624253775803E-010 4.55761936041964985E-008 2.43065115481894441E-006 4.04323385162878518E-005 3.03242092465927718E-004 1.30398349108432760E-003 3.77505078738318801E-003 8.21219931753570422E-003 1.45103163829264376E-002 2.21248123646438609E-002 3.08782700310448743E-002 4.22919654715200669E-002 6.08370311943501954E-002 9.27639365938913857E-002 0.13487866128710674 0.15727300409022502 0.14255402663795091 0.11043717229550717 7.99131915746931071E-002 5.88438585233288097E-002 4.61653506072852299E-002 3.87178009495667275E-002 3.40378107133899738E-002 3.06779484685386107E-002 2.79232452736102171E-002 2.54782021905330253E-002 2.32423220051220167E-002 2.11864383588354389E-002 1.93004507586400503E-002 1.75766511339743060E-002 1.60061395693864156E-002 1.45788061641501515E-002 1.32839193589109929E-002 1.21106432833499641E-002 1.10483982855648262E-002 1.00870910449765618E-002 9.21724965773377571E-003 8.43009208622318151E-003 7.71754901027740543E-003 7.07225633467517718E-003 6.48752827425853277E-003 5.95731873867440080E-003 5.47617639866981344E-003 5.03919711851076851E-003 4.64197621818215975E-003 4.28056215867802983E-003 3.95141262958358368E-003 3.65135359017345479E-003 3.37754152163295901E-003 3.12742895073536741E-003 2.89873317660003247E-003 2.68940805181255242E-003 2.49761862258705098E-003 2.32171840926017475E-003 2.16022910068454019E-003 2.01182243866920765E-003
1.51826113888746689E-065 7.22317314257711228E-042 6.03629926007493500E-028 2.35836800362409231E-019 7.70204568943687947E-014 3.46931900345249416E-010 1.06031727278158217E-007 5.65484126634858119E-006 9.40646936865404326E-005 7.05484164097563591E-004 3.03368076550261222E-003 8.78254904359004537E-003 1.91054497870714324E-002 3.37578412711627140E-002 5.14727511275170635E-002 7.18374231772530014E-002 9.83910632791546585E-002 0.14153563494205867 0.21581267868903800 0.31379139630301978 0.36589120238369222 0.33164791702760277 0.25692896242941149 0.18591578332673386 0.13689857501319794 0.10740238440714167 9.00758704587491243E-002 7.91880053444266735E-002 7.13713807194720773E-002 6.49626415335383123E-002 5.92743178525471648E-002 5.40726057458935511E-002 4.92896505041330452E-002 4.49019536154772816E-002 4.08915824714526366E-002 3.72378316701078918E-002 3.39171808129226510E-002 3.09046632301343722E-002 2.81750695754676914E-002 2.57037865875577448E-002 2.34673324411283565E-002 2.14436710193704506E-002 1.96123711597949932E-002 1.79546598169226489E-002 1.64534046311945355E-002 1.50930513122575320E-002 1.38595338016561341E-002 1.27401697358372704E-002 1.17235497815161259E-002 1.07994265750325294E-002 9.95860697248665723E-003 9.19284988873881638E-003 8.49477100768124271E-003 7.85775496309692838E-003 7.27587513046845918E-003 6.74382087066400984E-003 6.25683187951033004E-003 5.81063918884650032E-003 5.40141231023485904E-003 5.02571199454080342E-003 4.68044808659517312E-003
1.95873867346487579E-065 9.31875829336317988E-042 7.78754886262852974E-028 3.04257712763802231E-019 9.93656122144324420E-014 4.47583694833191780E-010 1.36793624966385249E-007 7.29542237300393300E-006 1.21354718639815330E-004 9.10159049942831566E-004 3.91381145584134525E-003 1.13305399332603515E-002 2.46483180089165331E-002 4.35516575751703355E-002 6.64060125631479731E-002 9.26788780765710474E-002 0.12693625347575638 0.18259791727104541 0.27842419801512130 0.40482847620644036 0.47204346474590375 0.42786552617163764 0.33146912751284846 0.23985362299165147 0.17661555469770751 0.13856193679222009 0.11620865903401190 0.10216200926826749 9.20776274997427147E-002 8.38095865349079566E-002 7.64709678376607194E-002 6.97601363406503278E-002 6.35895513434259207E-002 5.79288969519493741E-002 5.27550379539480363E-002 4.80412619015349179E-002 4.37572246641666704E-002 3.98707162482138042E-002 3.63492135782859244E-002 3.31609625999054469E-002 3.02756689466330414E-002 2.76649033890685007E-002 2.53023072810697643E-002 2.31636611459887093E-002 2.12268621884786034E-002 1.94718435114342031E-002 1.78804582151066184E-002 1.64363445318617719E-002 1.51247830555507421E-002 1.39325534599805262E-002 1.28477954886866003E-002 1.18598771550093816E-002 1.09592718069343419E-002 1.01374448298839851E-002 9.38675016854672271E-003 8.70033646251960023E-003 8.07206234939613146E-003 7.49642034906078739E-003 6.96846867274685845E-003 6.48377027723753656E-003 6.03833849233373354E-003
function E = advection(E,c,dx,dt)
%ADVECTION is a 1d advection code Lax Wendroff scheme with Superbee flux limiter
%
% E = advection(E,c,dx,dt)
%
% INPUTS:
% E = vector of the thing to be advected;
% c = scalar speed;
% dx = the spatial resolution;
% dt = the temporal resolution;
%
% OUTPUT:
% E = vector of the thing to be advected - after advection;
if ~isequal(size(E),size(c))
c = c';
end
f = flux(E,c,dx,dt);
E = E-dt*diffl(f)/dx;
function f = flux(E,c,h,dt)
% Lax-Wendroff with Superbee flux limiting;
theta = diffl(E)./(diffr(E)+3e-14);
phi = limiter(theta);
f = c.*E+c/2.*(1-c*dt/h).*diffr(E).*phi;
end
function y = diffl(x)
y = [x(1);diff(x)];
end
function y = diffr(x)
y = [diff(x);-x(end)];
end
% Superbee
function phi = limiter(r)
phi = max(0,max(min(1,2*r),min(r,2)));
end
end
function E = advection(E,c,dx,dt)
%ADVECTION is a 1d advection code Lax Wendroff scheme with Superbee flux limiter
%
% E = advection(E,c,dx,dt)
%
% INPUTS:
% E = vector of the thing to be advected;
% c = scalar speed;
% dx = the spatial resolution;
% dt = the temporal resolution;
%
% OUTPUT:
% E = vector of the thing to be advected - after advection;
if ~isequal(size(E),size(c))
c = c';
end
f = flux(E,c,dx,dt);
E = E-dt*diffl(f)/dx;
function f = flux(E,c,h,dt)
% Lax-Wendroff with Superbee flux limiting;
theta = diffl(E)./(diffr(E)+3e-14);
phi = limiter(theta);
f = c.*E+c/2.*(1-c*dt/h).*diffr(E).*phi;
end
function y = diffl(x)
y = [0;diff(x)];
end
function y = diffr(x)
y = [diff(x);0];
end
% Superbee
function phi = limiter(r)
phi = max(0,max(min(1,2*r),min(r,2)));
end
end
clear all;
close all;
x=ncread('simulation1.nc','x_axis');
t=ncread('simulation1.nc','time');
om=ncread('simulation1.nc','omega');
spectre=ncread('simulation1.nc','Spectrum');
Dave=ncread('simulation1.nc','Dave');
Dmax=ncread('simulation1.nc','Dmax');
f=om/(2*pi);
E=reshape(spectre(end,end,:),length(om),1);
Ei=reshape(spectre(30,:,:),length(x),length(om));
E1=reshape(spectre(1,1,:),length(om),1);
figure(1)
cmap=rand(length(t),3);
w = waitforbuttonpress;
for i=1:length(t)
figure(1)
sp=reshape(spectre(i,:,:),length(x),length(om));
h=mesh(f,x,sp);
axis([min(f) max(f) min(x) max(x) 0 max(E1)])
xlabel('Frequency [s^{-1}]')
zlabel('Energy')
ylabel('x [km]')
pause(0.1)
end
for i=1:length(om)
EE(i)=sum(Ei(:,i));
end
figure
plot(E1)
hold on
plot(EE,'r')
for
% figure
%
% subplot(1,2,1)
%
% plot(T,E,'color','r')
% hold on
% plot(T,Ei,'--b')
% grid on
% xlabel('Frequency [s^{-1}]')
% ylabel('Energy')
%
%
% subplot(1,2,2)
%
% plot(x,Dmax,'color','r')
% hold on
% plot(x,Dave,'--b')
% grid on
%
% xlabel('x [km]')
% ylabel('Floe size [m]')
%
% legend('Dmax','<D>')
\ No newline at end of file
! NOAA/PMEL TMAP
! FERRET v6.93
! Linux 2.6.32-504.el6.x86_64 64-bit - 11/13/14
! 1-Oct-15 15:51
use simulation1
use simulation1.nc
show data
use simulation1.nc
exit
! NOAA/PMEL TMAP
! FERRET v6.93
! Linux 2.6.32-504.el6.x86_64 64-bit - 11/13/14
! 30-Sep-15 15:02
use simulation1.nc
use simulation1
quit
! NOAA/PMEL TMAP
! FERRET v6.93
! Linux 2.6.32-504.el6.x86_64 64-bit - 11/13/14
! 30-Sep-15 15:05
use simulation1.nc
show data
show axis/all
show data
plot/I=1/J=1 SPECTRUM
0.0000000000000000 0.0000000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
500.00000000000000 500.00000000000000
function [E] = JONSWAP(Tm,Hs,om)
% Formule http://hmf.enseeiht.fr/travaux/CD0910/bei/beiere/groupe4/node/59
gam = 3.3;
alp = 0.0624/(0.23+0.0336*gam-0.185/(1.9+gam));
fp = 1/Tm;
f = om/(2*pi);
sig = zeros(length(om),1);
sig(f<=fp) = 0.07;
sig(f>fp) = 0.09;
E = alp*Hs^2*fp^4*f.^-5.*exp(-5/4*(fp./f).^4).*gam.^(exp(-(f-fp).^2./(2.*sig.^2.*fp^2)));
end
clear all;
close all;
% Parameters
g = 9.81; % gravitational acceleration
dx = 5000; % spatial resolution
Hs=1;
Tm=6;
% Waves
fmin = 1/20; % minimum wave frequency
fmax = 1/2.5; % maximum wave frequency
om1 = 2*pi*fmin; % minimum wave radial frequency
om2 = 2*pi*fmax; % maximum wave radial fequency
nw = 61; % number of frequency bins
dw = (om2-om1)/(nw-1); % integral interval for wave radial frequencies
om = om1+(0:nw-1)'*dw; % wave radial frequencies vector
T = 2*pi./om; % wave periods vector
wlng = g.*T.^2./(2.*pi); % wavelength as a function only of wave period
cp = sqrt(g.*wlng./(2.*pi)); % phase speed
cg = cp./2; % group speed
cgmax = max(cg); % group speed maximum
cg(:) = cgmax; % no dispersion = all group speed are the same (maximum)
dt = dx/cgmax; % time interval (temporal resolution)
Ei = jonswap(Tm,Hs,om); % JONSWAP spectrum
\ No newline at end of file
clear all;
close all;
% Parameters
g = 9.81; % gravitational acceleration
dx = 500; % spatial resolution
nbin=80;
x=linspace(0,dx*nbin/1000,nbin);
Hs=1;
Tm=6;
% Waves
fmin = 1/20; % minimum wave frequency
fmax = 1/2.5; % maximum wave frequency
om1 = 2*pi*fmin; % minimum wave radial frequency
om2 = 2*pi*fmax; % maximum wave radial fequency
nw = 61; % number of frequency bins
dw = (om2-om1)/(nw-1); % integral interval for wave radial frequencies
om = om1+(0:nw-1)'*dw; % wave radial frequencies vector
T = 2*pi./om; % wave periods vector
wlng = g.*T.^2./(2.*pi); % wavelength as a function only of wave period
cp = sqrt(g.*wlng./(2.*pi)); % phase speed
cg = cp./2; % group speed
cgmax = max(cg); % group speed maximum
cg(:) = cgmax; % no dispersion = all group speed are the same (maximum)
CN=0.7;
dt = CN*dx/cgmax; % time interval (temporal resolution)
nsteps=ceil(nbin/CN);
Ei = jonswap(Tm,Hs,om); % JONSWAP spectrum
E=zeros(nsteps,nbin,length(om));
E(1,1,:)=Ei;
EE=reshape(E(1,:,:),nbin,length(om));
for n=2:nsteps
for w=1:nw % Advection loop over each frequency
EE(:,w) = advection(EE(:,w),cg(w,:),dx,dt); % SEE advection routine
end
E(n,:,:)=reshape(EE,1,nbin,length(om));
end
figure(1)
rr = waitforbuttonpress;
for n=1:nsteps
figure(1)
E3=reshape(E(n,:,:),nbin,length(om));
h=mesh(om,x,E3);
axis([om1 om2 min(x) max(x) 0 max(Ei)])
xlabel('Frequency [s^{-1}]')
zlabel('Energy')
ylabel('x [km]')
pause(0.1)
end
for i=1:nsteps
E2=reshape(E(i,:,:),nbin,length(om));
m0(i)=sum(sum(E2))/sum(Ei);
end
figure
plot(m0)
clear all;
close all;
% Parameters
g = 9.81; % gravitational acceleration
dx = 500; % spatial resolution
nbin=80;
x=linspace(0,dx*nbin/1000,nbin);
Hs=1;
Tm=6;
% Waves
fmin = 1/20; % minimum wave frequency
fmax = 1/2.5; % maximum wave frequency
om1 = 2*pi*fmin; % minimum wave radial frequency
om2 = 2*pi*fmax; % maximum wave radial fequency
nw = 61; % number of frequency bins
dw = (om2-om1)/(nw-1); % integral interval for wave radial frequencies
om = om1+(0:nw-1)'*dw; % wave radial frequencies vector
T = 2*pi./om; % wave periods vector
wlng = g.*T.^2./(2.*pi); % wavelength as a function only of wave period
cp = sqrt(g.*wlng./(2.*pi)); % phase speed
cg = cp./2; % group speed
cgmax = max(cg); % group speed maximum
cg(:) = cgmax; % no dispersion = all group speed are the same (maximum)
CN=0.5;
dt = CN*dx/cgmax; % time interval (temporal resolution)
nsteps=ceil(nbin/CN);
Ei = jonswap(Tm,Hs,om); % JONSWAP spectrum
E=zeros(nsteps,nbin,length(om));
E(1,1,:)=Ei;
EE=reshape(E(1,:,:),nbin,length(om));
figure(1)
rr = waitforbuttonpress;
for n=2:nsteps
for w=1:nw % Advection loop over each frequency
EE(:,w) = advection(EE(:,w),cg(w,:),dx,dt); % SEE advection routine
end
% Incident wave spectrum
%EE(1,:) = Ei;
figure(1)
h=mesh(om,x,EE);
axis([om1 om2 min(x) max(x) 0 max(Ei)])
xlabel('Frequency [s^{-1}]')
zlabel('Energy')
ylabel('x [km]')
pause(0.1)
E(n,:,:)=reshape(EE,1,nbin,length(om));
end
for i=1:nsteps
E2=reshape(E(i,:,:),nbin,length(om));
m0(i)=sum(sum(E2))/sum(Ei);
end
figure
plot(m0)
function [T,cice,Hsig,Ei,E,S_win,S_wcp,S_ice,Dmax,Dave,om_do] = wim(C,h,D,U10,Tm,Hs)
% WIM - Models the propagation of a wave spectrum along a 1D
% ice-covered transect.
%
% Syntax: [T,cice,Hsig,Ei,E,S_win,S_wcp,S_ice] = wim_final(C,h,D,U10,Tm,Hs)
%
% Inputs:
% C : ice concentration. For a homogeneous concentration, C is scalar
% in tenths. Otherwise, C is a vector of the size of the spatial
% grid, in fraction of 1 (0 < C < 1). In this version of WIM, if
% C is homogeneous, the transect is 5km long with spatial
% resolution of 500m.
% h : ice thickness in meters. h is a scalar.
% D : average floe diameter in meters. D is a scalar.
% U10 : wind speed at 10m elevation in m/sec. U10 is a scalar.
% Tm : mean wave period to build the spectrum, in seconds. Tm is a scalar.
% Hs : significant wave height, in meters. Hs is a scalar.
%
% Outputs:
% T : wave period in seconds. T is a vector the size of the frequency range.
% cice : ice concentration vector in fraction of 1. cice has the size of
% the spatial grid.If C is a vector, then cice = C.
% Hsig : final wave heigh in each cell in meters. Hsig has the size of
% the spatial grid.
% Ei : initial spectrum in m2/hz.
% E : final wave spectrum in each cell [m2/Hz].
% S_win: final wind source term in each cell in m2/Hz/sec.
% S_wcp: final white-capping source term in each cell in m2/Hz/sec.
% S_ice: final ice source term in each cell in m2/Hz/sec.
% Parameters
g = 9.81; % gravitational acceleration
dx = 5000; % spatial resolution
% Ice conditions
if length(C) == 1 % Homogeneous ice concentration case
nx = 10; % 10 cells of 500m -> 5km long transect
cice = zeros(1,nx)+C; % homogeneous ice concentration vector
hice = zeros(1,nx)+h; % homogeneous ice thickness vector
Dmax = zeros(1,nx)+D; % homogeneous floe diameter vector
Dave = zeros(1,nx)+D;
else % Variable ice concentration case
nx = length(C); % number of cells
cice = C; % ice concentration vector
hice = zeros(1,nx); % ice thickness vector size allocation
hice(find(C)) = h; % ice thickness vector
Dmax = zeros(1,nx); % floes diameter vector size allocation
Dmax(find(C)) = D; % floes diameter vector
end
% Waves
fmin = 1/20; % minimum wave frequency
fmax = 1/2.5; % maximum wave frequency
om1 = 2*pi*fmin; % minimum wave radial frequency
om2 = 2*pi*fmax; % maximum wave radial fequency
nw = 61; % number of frequency bins
dw = (om2-om1)/(nw-1); % integral interval for wave radial frequencies
om = om1+(0:nw-1)'*dw; % wave radial frequencies vector
T = 2*pi./om; % wave periods vector
Ei = jonswap(Tm,Hs,om); % JONSWAP spectrum
wlng = g.*T.^2./(2.*pi); % wavelength as a function only of wave period
cp = sqrt(g.*wlng./(2.*pi)); % phase speed
cg = cp./2; % group speed
cgmax = max(cg); % group speed maximum
cg(:) = cgmax; % no dispersion = all group speed are the same (maximum)
% Wind
U10 = repmat(U10,nx,1); % wind speed at 10m elevation vector
% Temporal grid
dt = dx/cgmax; % time interval (temporal resolution)
nsteps = nx+1; % number of time steps (=nx+1 because advection is
% done from one cell at each time step)
time = 0:dt:nsteps*dt; % time vector
nt = length(time); % time vector size
% Memory preallocation
E = zeros(nx,nw); % wave spectrum
Swin = zeros(nx,nw); % wind source term
Swcp = zeros(nx,nw); % white-capping source term
Sice = zeros(nx,nw); % ice dissipation source term
S_win = zeros(nx,nw); % wind source term weighted by open water fraction (for outputs)
S_ice = zeros(nx,nw); % ice dissipation source terme weighted by ice fraction
S_wcp = zeros(nx,nw); % white-capping source term weighted by open water fraction
Hsig = zeros(1,nx); % significant wave height
% Action density limiter
Slim = action_density_limiter(om,cp); % SEE action_density_limiter routine
for n=1:nt % Time loop
% Advection.
% The advection is done by solving Dt(S) = 0 using the
% Lax-Wendroff scheme with Superbee flux limiting and a Neumann
% boundary condition. The advection is performed over the whole domain
% in one step on an unattenuated intermediate spectrum.
for w=1:nw % Advection loop over each frequency
E(:,w) = advection(E(:,w),cg(w,:),dx,dt); % SEE advection routine
end
% Incident wave spectrum
E(1,:) = Ei; % The initial wave spectrum is forced in the first cell
% Processes for each spatial cell with ice (generation by wind, dissipation
% by white-capping and attenuation by ice)
for i=2:nx % Spatial loop
% % Generation by wind
% Swin(i,:) = wind_gen(U10(i),E(i,:),om,cp); % SEE wind_gen routine
% Swin(i,:) = min(Swin(i,:),Slim'); % action density limiter
% E(i,:) = E(i,:) + Swin(i,:)*dt*(1-cice(i)); % the wave spectrum is updated (explicit scheme)
% S_win(i,:) = Swin(i,:)*(1-cice(i)); % effective wind source term for outputs
% % Dissipation by white-capping
% Swcp(i,:) = white_cap(E(i,:),om,cp); % SEE white-cap routine
% Swcp(i,:) = max(Swcp(i,:),-Slim'); % action density limiter
% E(i,:) = E(i,:) + Swcp(i,:)*dt*(1-cice(i)); % the wave spectrum is updated (semi-implicit scheme)
% S_wcp(i,:) = Swcp(i,:)*(1-cice(i)); % effective white-capping source term for outputs
% Attenuation by ice
if cice(i)>0
Sice(i,:) = ice_att(E(i,:),T,cg,cice(i),hice(i),Dave(i),dt*cice(i)); % SEE ice_att routine
E(i,:) = E(i,:) + Sice(i,:)*dt; % the wave spectrum is updated (implicit scheme)
else
Sice(i,:) = 0; % if there is no ice, there is no attenuation Sherlock !
end
S_ice(i,:) = Sice(i,:)*cice(i); % effective ice dissipation source term for outputs
[Dmax(i),om_do(i)]=floe_breaking(E(i,:),h,om,Dmax(i),dw);
Dave(i)=FSD(Dmax(i),D);
% Wave spectrum statistics
E(E<0) = 0; % avoiding negative energy
m0 = trapz(om,E(i,:)); % total energy
Hsig(i) = 4*sqrt(m0); % significant wave height
end
end
end
File deleted
COMPILER= ifort
OPTION= -O3
NETCDFinc= -I/usr/local/include
NETCDFLIB= -L/usr/local/lib -lnetcdf
OBJ= *.o
SRC= *.f90
MOD= parameters.mod
EXEC= WIM2
WIM2: $(OBJ)
$(COMPILER) $(OPTION) $(NETCDFinc) -o $(EXEC) $(OBJ) $(NETCDFLIB)
mv WIM2 ../
$(MOD): parameters.f90
$(COMPILER) -c parameters.f90
$(OBJ): $(SRC) $(MOD)
$(COMPILER) $(NETCDFinc) -c $(SRC) $(NETCDFLIB)
clean:
rm -f *.o *.mod
mrproper:
rm -f *.o *.mod ../WIM2
GFORTRAN module version '0' created from parameters.f90 on Mon Oct 5 10:51:18 2015
MD5:2945bfc901545c55dde121545c48b899 -- If you edit this, you'll get what you deserve.
(() () () () () () () () () () () () () () () () () () () () () () () ()
() () ())
()
()
()
()
(2 '__convert_i4_r8' '(intrinsic)' '__convert_i4_r8' 1 ((PROCEDURE
UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN UNKNOWN FUNCTION ELEMENTAL PURE) (
REAL 8 0 0 REAL ()) 0 0 () () 0 () () () 0 0)
3 '__convert_r4_r8' '(intrinsic)' '__convert_r4_r8' 1 ((PROCEDURE
UNKNOWN-INTENT UNKNOWN-PROC UNKNOWN UNKNOWN FUNCTION ELEMENTAL PURE) (
REAL 8 0 0 REAL ()) 0 0 () () 0 () () () 0 0)
4 'alpha' 'parameters' 'alpha' 1 ((VARIABLE UNKNOWN-INTENT UNKNOWN-PROC
UNKNOWN UNKNOWN ALLOCATABLE DIMENSION) (REAL 8 0 0 REAL ()) 0 0 () (2
DEFERRED () () () ()) 0 () () () 0 0)
5 'alpha_s' 'parameters' 'alpha_s' 1 ((VARIABLE UNKNOWN-INTENT
UNKNOWN-PROC UNKNOWN IMPLICIT-SAVE IN_NAMELIST) (REAL 8 0 0 REAL ()) 0 0
() () 0 () () () 0 0)
6 'array_allocation' 'parameters' 'array_allocation' 1 ((PROCEDURE
UNKNOWN-INTENT MODULE-PROC DECL UNKNOWN SUBROUTINE) (UNKNOWN 0 0 0
UNKNOWN ()) 0 0 () () 0 () () () 0 0)
7 'beta_s' 'parameters' 'beta_s' 1 ((VARIABLE UNKNOWN-INTENT
UNKNOWN-PROC UNKNOWN IMPLICIT-SAVE IN_NAMELIST) (REAL 8 0 0 REAL ()) 0 0
() () 0 () () () 0 0)