parameters.f90 2.84 KB
Newer Older
Jérémy Baudry's avatar
Jérémy Baudry committed
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
67
68
69
70
71
72
73
74
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
module parameters

implicit none

!__________________name of files__________________
	character(len=100) ::root,spectrum,floe_size

!______________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
!____________waves_________________________________
	double precision, allocatable	::wl(:),Cp(:),Cg(:),CN(:)
	integer				::disp=0
!____________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
	

	


contains


subroutine read_namelist

	namelist /spectrum_parameters/ nfreq,alpha_s, &
					beta_s,Tmin,Tmax,gamma_s
	namelist /model_parameter/ nbin,dx,Cfl
	namelist /waves_parameters/ Tm,Hs,disp
	namelist /ice_parameters/ cice,hice,D0,gam,Dmin

	open(30,file='nml/parameter.nml',status='old')
	read(30,nml=spectrum_parameters)	
 	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))


	
	domega=(2*pi/Tmin-2*pi/Tmax)/(nfreq-1)
	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)
	dt=CN(1)*dx/maxval(Cg)	
	end if

	

	nsteps=ceiling(nbin/minval(CN))

	h(1:nbin)=hice
	C_ice(1:nbin)=cice

	

	
allocate(E(nsteps,nbin,nfreq))	
allocate(Dmax(nbin))
allocate(Dave(nbin))

	Dmax=D0
	Dave=D0
	Dmax(1)=0
	Dave(1)=0

end subroutine array_allocation


	




end module parameters