Commit a081b91c authored by Jérémy Baudry's avatar Jérémy Baudry

new

parent 4508a952
!
! _______________________
! | |
! | WIM PARAMETERS |
! |_______________________|
!______________________________________________________________________________
! WAVES PARAMETERS:
!
! Tm -> Peak period [s]
! Hs -> Significant wave height [m]
! disp -> Allowing wave dispersion
! 0: Wave dispersion is not allowed,
! group speed is the same at all spectrum
! frequency (cg=max[cg(w)])
! 1: Wave dispersion is allowed
!------------------------------------------------------------------------------
&waves_parameters &waves_parameters
Tm =6 Tm =6
Hs =1.5 Hs =1.5
disp =0 disp =0
/ /
!______________________________________________________________________________
! MODEL PARAMETERS:
!
! nbin -> Number of grid bin
! dx -> Spatial resolution [m]
! Cfl -> Courant–Friedrichs–Lewy condition (0<Cfl<1)
! Only in the case where disp=0. The CFL condition
! is needed to calculate the time step.
! name_sim -> name of the output file
! root -> destination folder for the output file
! FSD_sheme -> method for ice floe breaking parametrization
! 0: Williams et al. 2013
! 1: Horvat 2015
!------------------------------------------------------------------------------
&model_parameter &model_parameter
nbin =100 nbin =100
...@@ -17,9 +43,21 @@ Cfl =1 ...@@ -17,9 +43,21 @@ Cfl =1
name_sim ='simulation1' name_sim ='simulation1'
root = 'output/' root = 'output/'
FSD_scheme =1 FSD_scheme =1
/
/
!______________________________________________________________________________
! SPECTRUM PARAMETERS:
!
! init_spec -> method to build the wave spectrum
! 1: JONSWAP spectrum
! 0: Bretschneider spectrum
! nfreq -> number of frequency bin
! Tmin -> Minimum period [s]
! Tmax -> Maximum period [s]
! alpha_s -> parameter for jonswap spectrum (init_spec=1)
! beta_s -> parameter for jonswap spectrum (init_spec=1)
! gamma_s -> parameter for jonswap spectrum (init_spec=1)
!------------------------------------------------------------------------------
&spectrum_parameters &spectrum_parameters
init_spec =1 init_spec =1
...@@ -30,9 +68,23 @@ alpha_s =0.2044 ...@@ -30,9 +68,23 @@ alpha_s =0.2044
beta_s =1.2500 beta_s =1.2500
gamma_s =3.3 gamma_s =3.3
/ /
!______________________________________________________________________________
! ICE PARAMETERS
!
! X_ice -> Distance of the ice edge [m]
! c_cice -> Ice concentration
! ice_thick -> method for compute the ice thickness
! 0: constant thickness
! 1: thickness is a function of distance
! from ice edge
! hice -> Ice thickness (if ice_thick=0) [m]
! hmax -> Maximum ice thickness (if ice_thick=1) [m]
! Xh -> distance where h=hmax/2 (if ice_thicl=1) [m]
! D0 -> initial floe size in the domain [m]
! gam ->
! Dmin -> Minimum floe size (if FSD_sheme=1) [m]
!------------------------------------------------------------------------------
&ice_parameters &ice_parameters
X_ice =5000 X_ice =5000
cice =0.8 cice =0.8
...@@ -44,3 +96,4 @@ D0 =500 ...@@ -44,3 +96,4 @@ D0 =500
gam =1.5 gam =1.5
Dmin =20 Dmin =20
/ /
!________________________________________________________________________________
subroutine initialization !
use parameters !_______________________________________________________________________
!
! DESCRIPTION:
! This is the initialization routine which contains the
! initial spectrum construction, set initial values for arrays
! and construct the ice transect.
!_______________________________________________________________________
!INTERFACE:
subroutine initialization
!MODULE USES:
use parameters
!LOCAL PARAMETERS AND VARIABLES
implicit none
double precision, allocatable ::Gf(:),PM(:)
integer ::X1
allocate(Gf(nfreq))
allocate(PM(nfreq))
!local parameters
implicit none
double precision, allocatable ::Gf(:),PM(:)
integer ::X1
allocate(Gf(nfreq))
allocate(PM(nfreq))
!_________________________INITIAL SPECTRUM_____________________________ !_________________________INITIAL SPECTRUM_____________________________
E(1:nsteps,1:nbin,1:nfreq)=0d0
E(1:nsteps,1:nbin,1:nfreq)=0d0 !INITIALIZE SPECTRUM ARRAY
if(init_spec.eq.1) then if(init_spec.eq.1) then !use JONSWAP spectrum
!build JONSWAP spectrum
do i=1,nfreq
do i=1,nfreq if (freq(i).le.freq_s) then
if (freq(i).le.freq_s) then sigma_s(i)=0.07
sigma_s(i)=0.07 else
else sigma_s(i)=0.09
sigma_s(i)=0.09 end if
end if end do
end do
Gf=gamma_s**(exp((-(freq-freq_s)**2)/(2*sigma_s**2*freq_s**2)))
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)
PM=alpha_s*Hs**2*(freq_s**4/freq**5)*exp(-beta_s*(freq_s/freq)**4)
Ei=Gf*PM
Ei=Gf*PM
else else !use bretschneider spectrum
Ei=(1.25*Hs**2*(1/freq)**5)/(8*pi*Tm**4)*exp(-1.25*((1/freq)/Tm)**4) Ei=(1.25*Hs**2*(1/freq)**5)/(8*pi*Tm**4)*exp(-1.25*((1/freq)/Tm)**4)
end if end if
E(1,1,1:nfreq)=Ei
E(1,1,1:nfreq)=Ei !initial spectrum
!_______________________________________________________________________ !_______________________________________________________________________
!_______________________ICE_TRANSECT____________________________________ !_______________________ICE_TRANSECT____________________________________
X1=floor(X_ice/dx) X1=floor(X_ice/dx) !find in which grid bin is the ice edge
C_ice(1:X1)=0 C_ice(1:X1)=0 !ice concentration is 0 before ice edge!
C_ice(X1:nbin)=cice C_ice(X1:nbin)=cice !ice concentration in the transect
Dave(1:X1)=0 Dave(1:X1)=0 !initalize mean floe size before ice edge
Dmax(1:X1)=0 Dmax(1:X1)=0 !initialize max floe size before ice edge
Dave(X1:nbin)=D0 Dave(X1:nbin)=D0 !initalize mean floe size in ice transect
Dmax(X1:nbin)=D0 Dmax(X1:nbin)=D0 !initialize max floe size in ice transect
if (ice_thick.eq.0) then if (ice_thick.eq.0) then ! constant ice thickness in the transect
h(X1:nbin)=hice h(X1:nbin)=hice
h(1:X1)=0d0 h(1:X1)=0d0 !0 before ice edge
else else ! thickness is a function of distance from ice edge
h(1:X1)=0d0 h(1:X1)=0d0
do jj=X1,nbin do jj=X1,nbin
h(jj)=hmax*(0.1+0.9*(1-exp(-((real(jj)*dx-X_ice)/Xh)))) h(jj)=hmax*(0.1+0.9*(1-exp(-((real(jj)*dx-X_ice)/Xh))))
end do end do
end if end if
......
PROGRAM WIM2 !
!_________________________________________________________________________________
!DESCRIPTION:
! This is the main program of WIM. This routine merely calls other
! subroutines and do the main time loop. It also contains the subroutine
! progress which display a progress bar in the terminal while the model is
! running.
!_________________________________________________________________________________
!INTERFACE:
PROGRAM WIM2
use parameters !MODULE USES:
call read_namelist use parameters
call array_allocation
call initialization
!______________________________________________________
call read_namelist !read parameters from namelists
call array_allocation ! allocate memory for arrays
call initialization ! initialize the model
!________________________________________________________________________________
spectrum=trim(root)//'Energy_spectrum.dat' spectrum=trim(root)//'Energy_spectrum.dat'
...@@ -21,33 +30,38 @@ PROGRAM WIM2 ...@@ -21,33 +30,38 @@ PROGRAM WIM2
open(10,file=spectrum) open(10,file=spectrum)
open(11,file=floe_size) open(11,file=floe_size)
!_______________________TIME LOOP______________________
do n=2,nsteps
!________________________________________________________________________________
call progress(n,nsteps) ! DO THE TIME LOOP
do ii=1,nfreq
call advection do n=2,nsteps
call progress(n,nsteps) !display progress bar
do ii=1,nfreq !do advection for each frequency
!band
call advection
end do
do i=1,nbin !spatial calculations
call attenuation ! compute spectrum attenuation
call break_horvat ! compute floe breaking
!call floe_breaking
!call fsd_build
end do
end do end do
!______________________OUTPUTS_________________________________________________
do i=1,nbin call write_output ! Write outputs in NETCDF
call attenuation
call break_horvat
!call floe_breaking
!call fsd_build
end do
end do
!______________________OUTPUTS_________________________
call write_output
!call graph_dislin !call graph_dislin
close(10) close(10)
close(11) close(11)
contains contains
!______________________________________________________________________________
subroutine progress(j,jmax) subroutine progress(j,jmax)
implicit none implicit none
integer::j,k,jmax integer::j,k,jmax
...@@ -60,5 +74,6 @@ subroutine progress(j,jmax) ...@@ -60,5 +74,6 @@ subroutine progress(j,jmax)
endif endif
end subroutine progress end subroutine progress
!_______________________________________________________________________________
END PROGRAM WIM2 END PROGRAM WIM2
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment