parameters.f90 4.34 KB
Newer Older
Jérémy Baudry's avatar
Jérémy Baudry committed
1 2 3 4 5
module parameters

implicit none

!__________________name of files__________________
Jérémy Baudry's avatar
Jérémy Baudry committed
6 7
	character(len=100) ::root='output/',spectrum,floe_size,name_sim='test'
        character(len=100) ::namefile
Jérémy Baudry's avatar
Jérémy Baudry committed
8 9 10 11 12 13 14 15 16 17 18 19
!______________dummys_____________________________
	integer	:: i,ii,n,j,jj
!______________global parameters__________________

	double precision	:: g=9.81,pi=3.1416
!____________Spectrum_____________________________
	double precision, allocatable	:: E(:,:,:),Ei(:),T(:)
	double precision, allocatable	:: omega(:),freq(:),sigma_s(:)
	integer	:: nbin=10,nfreq=60
	double precision :: alpha_s=8.1e-3,beta_s=1.25
	double precision :: Tmin=2.5,Tmax=20,Tm=6,Hs=1
	double precision :: gamma_s=3.3,freq_s,domega
Jérémy Baudry's avatar
Jérémy Baudry committed
20
        double precision, allocatable :: x_axis(:),time(:)
Jérémy Baudry's avatar
Jérémy Baudry committed
21
        integer :: init_spec=1
Jérémy Baudry's avatar
Jérémy Baudry committed
22 23 24
!____________waves_________________________________
	double precision, allocatable	::wl(:),Cp(:),Cg(:),CN(:)
	integer				::disp=0
Jérémy Baudry's avatar
Jérémy Baudry committed
25
        double precision ::dwl
Jérémy Baudry's avatar
Jérémy Baudry committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
!____________grid parameters________________________
	double precision :: dt,dx=500
	integer		 :: nsteps
	double precision :: Cfl=1
!_____________ICE_____________________________________
	double precision, allocatable :: alpha(:,:)
	double precision, allocatable :: h(:)
	double precision, allocatable :: C_ice(:)
	double precision, allocatable :: S_ice(:,:)
	double precision :: cice=1
	double precision :: hice=1
	double precision, allocatable :: Dave(:)
	double precision, allocatable :: Dmax(:)
	double precision :: D0=200
	double precision :: gam=2
	double precision :: Dmin=20
Jérémy Baudry's avatar
Jérémy Baudry committed
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
        double precision :: psi=2
        double precision :: ff=0.5
        double precision :: Xh=60000
        double precision :: X_ice=50000
        integer          :: ice_thick=1
        double precision :: hmax=4
!_________________FSD______________________________
        double precision :: minfloe
        double precision :: maxfloe
        double precision :: res
        integer          :: nbcat
        integer          :: nedge
        double precision, allocatable :: FSD(:,:,:)
        double precision, allocatable :: floe_cat(:)
        double precision, allocatable :: middle_floe_cat(:)
Jérémy Baudry's avatar
Jérémy Baudry committed
57
	
Jérémy Baudry's avatar
Jérémy Baudry committed
58 59
!_________model parameters____________________________
        integer :: FSD_scheme=1
Jérémy Baudry's avatar
Jérémy Baudry committed
60 61 62 63 64 65 66 67
	


contains


subroutine read_namelist

Jérémy Baudry's avatar
Jérémy Baudry committed
68
	namelist /spectrum_parameters/ nfreq,alpha_s,beta_s,Tmin,Tmax,gamma_s,init_spec
Jérémy Baudry's avatar
Jérémy Baudry committed
69
	namelist /model_parameter/ nbin,dx,Cfl,name_sim,root,FSD_scheme
Jérémy Baudry's avatar
Jérémy Baudry committed
70
	namelist /waves_parameters/ Tm,Hs,disp
Jérémy Baudry's avatar
Jérémy Baudry committed
71
	namelist /ice_parameters/ cice,hice,D0,gam,Dmin,ice_thick,hmax,X_ice,Xh
Jérémy Baudry's avatar
Jérémy Baudry committed
72 73

	open(30,file='nml/parameter.nml',status='old')
Jérémy Baudry's avatar
Jérémy Baudry committed
74
	read(30,nml=spectrum_parameters)
Jérémy Baudry's avatar
Jérémy Baudry committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
 	close(30)

	open(30,file='nml/parameter.nml',status='old')
	read(30,nml=model_parameter)	
 	close(30)

	open(30,file='nml/parameter.nml',status='old')
	read(30,nml=waves_parameters)	
 	close(30)

	open(30,file='nml/parameter.nml',status='old')
	read(30,nml=ice_parameters)	
 	close(30)
	

end subroutine read_namelist



subroutine array_allocation

nfreq=nfreq+1




allocate(Ei(nfreq))
allocate(T(nfreq))
allocate(omega(nfreq))
allocate(freq(nfreq))
allocate(sigma_s(nfreq))
allocate(wl(nfreq))
allocate(Cp(nfreq))
allocate(Cg(nfreq))
allocate(CN(nfreq))
allocate(alpha(nbin,nfreq))
allocate(h(nbin))
allocate(C_ice(nbin))
allocate(S_ice(nbin,nfreq))
Jérémy Baudry's avatar
Jérémy Baudry committed
114 115
allocate(x_axis(nbin))

Jérémy Baudry's avatar
Jérémy Baudry committed
116 117


Jérémy Baudry's avatar
Jérémy Baudry committed
118

Jérémy Baudry's avatar
Jérémy Baudry committed
119 120
	
	domega=(2*pi/Tmin-2*pi/Tmax)/(nfreq-1)
Jérémy Baudry's avatar
Jérémy Baudry committed
121
        dwl=(g*Tmax**2/(2*pi)-g*Tmin**2/(2*pi))/(nfreq-1)
Jérémy Baudry's avatar
Jérémy Baudry committed
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138
	ii=1
	do i=0,nfreq-1
	omega(ii)=2*pi/Tmax+i*domega
	freq(ii)=1/Tmax+i*(1/Tmin-1/Tmax)/(nfreq-1)
	ii=ii+1
	end do
	T=1/freq
	freq_s=1/Tm
	wl=g*T**2/(2*pi)
	Cp=sqrt(g*wl/(2*pi))
	Cg=Cp/2

	
	
	if (disp.eq.0) then
	CN=Cfl
	Cg=maxval(Cg)
Jérémy Baudry's avatar
Jérémy Baudry committed
139 140 141 142
	dt=CN(1)*dx/maxval(Cg)
        else
        dt=dx/maxval(Cg)
        CN=Cg*dt/dx
Jérémy Baudry's avatar
Jérémy Baudry committed
143 144 145 146 147 148 149 150
	end if

	

	nsteps=ceiling(nbin/minval(CN))



Jérémy Baudry's avatar
Jérémy Baudry committed
151 152 153


allocate(E(nsteps,nbin,nfreq))
Jérémy Baudry's avatar
Jérémy Baudry committed
154 155
allocate(Dmax(nbin))
allocate(Dave(nbin))
Jérémy Baudry's avatar
Jérémy Baudry committed
156
allocate(time(nsteps))
Jérémy Baudry's avatar
Jérémy Baudry committed
157

Jérémy Baudry's avatar
Jérémy Baudry committed
158 159 160 161 162 163 164 165 166 167 168 169
        time(1)=0
        do ii=2,nsteps
        time(ii)=time(ii-1)+dt/60
        end do
        x_axis(1)=0
        do ii=2,nbin
        x_axis(ii)=x_axis(ii-1)+dx/1000
        end do




Jérémy Baudry's avatar
Jérémy Baudry committed
170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192
minfloe=1
maxfloe=500
nbcat=100
nedge=nbcat+1
res=abs(minfloe-maxfloe)/nedge

allocate(floe_cat(nedge))
allocate(FSD(nsteps,nbin,nbcat))
allocate(middle_floe_cat(nbcat))

floe_cat(1)=maxfloe
do i=2,nedge
floe_cat(i)=floe_cat(1)-i*res
end do

do i=1,nedge-1
middle_floe_cat(i)=(floe_cat(i)+floe_cat(i+1))*0.5
end do

write(*,*)wl



Jérémy Baudry's avatar
Jérémy Baudry committed
193 194 195 196 197 198 199 200 201
end subroutine array_allocation


	




end module parameters