parameters.f90 2.84 KB
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