initialization.f90 1.28 KB
Newer Older
Jérémy Baudry's avatar
Jérémy Baudry committed
1 2 3 4 5 6
subroutine initialization
use parameters

!local parameters
implicit none
	double precision, allocatable ::Gf(:),PM(:)
Jérémy Baudry's avatar
Jérémy Baudry committed
7
        integer ::X1
Jérémy Baudry's avatar
Jérémy Baudry committed
8 9 10 11 12 13 14

	allocate(Gf(nfreq))
	allocate(PM(nfreq))
	
	

!_________________________INITIAL SPECTRUM_____________________________
Jérémy Baudry's avatar
Jérémy Baudry committed
15
	E(1:nsteps,1:nbin,1:nfreq)=0d0
Jérémy Baudry's avatar
Jérémy Baudry committed
16 17
        
        if(init_spec.eq.1) then
Jérémy Baudry's avatar
Jérémy Baudry committed
18 19 20 21 22 23 24 25 26 27 28 29 30 31
	!build JONSWAP spectrum

	do i=1,nfreq 
		if (freq(i).le.freq_s) then
			sigma_s(i)=0.07
		else
			sigma_s(i)=0.09
		end if
	end do
	
	Gf=gamma_s**(exp((-(freq-freq_s)**2)/(2*sigma_s**2*freq_s**2)))
	PM=alpha_s*Hs**2*(freq_s**4/freq**5)*exp(-beta_s*(freq_s/freq)**4)

	Ei=Gf*PM
Jérémy Baudry's avatar
Jérémy Baudry committed
32 33 34 35 36
        
        else

        Ei=(1.25*Hs**2*(1/freq)**5)/(8*pi*Tm**4)*exp(-1.25*((1/freq)/Tm)**4)
        end if
Jérémy Baudry's avatar
Jérémy Baudry committed
37 38 39 40 41 42 43

	

	E(1,1,1:nfreq)=Ei
	
!_______________________________________________________________________

Jérémy Baudry's avatar
Jérémy Baudry committed
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
!_______________________ICE_TRANSECT____________________________________

X1=floor(X_ice/dx)
C_ice(1:X1)=0
C_ice(X1:nbin)=cice

Dave(1:X1)=0
Dmax(1:X1)=0
Dave(X1:nbin)=D0
Dmax(X1:nbin)=D0

if (ice_thick.eq.0) then

h(X1:nbin)=hice
h(1:X1)=0d0

else

h(1:X1)=0d0
do jj=X1,nbin

h(jj)=hmax*(0.1+0.9*(1-exp(-((real(jj)*dx-X_ice)/Xh))))

end do

end if
        
!_____________________FSD_____________________________________________

FSD(1,1:nbin,1)=1d0

Jérémy Baudry's avatar
Jérémy Baudry committed
75
end subroutine initialization