Commit a081b91cd23fcc6e83ff560c256b459637237d6b

Authored by Jérémy Baudry
1 parent 4508a952
Exists in master

new

Showing 3 changed files with 161 additions and 81 deletions   Show diff stats
nml/parameter.nml
1   -
  1 +!
  2 +! _______________________
  3 +! | |
  4 +! | WIM PARAMETERS |
  5 +! |_______________________|
  6 +!______________________________________________________________________________
  7 +! WAVES PARAMETERS:
  8 +!
  9 +! Tm -> Peak period [s]
  10 +! Hs -> Significant wave height [m]
  11 +! disp -> Allowing wave dispersion
  12 +! 0: Wave dispersion is not allowed,
  13 +! group speed is the same at all spectrum
  14 +! frequency (cg=max[cg(w)])
  15 +! 1: Wave dispersion is allowed
  16 +!------------------------------------------------------------------------------
2 17 &waves_parameters
3 18  
4 19 Tm =6
5 20 Hs =1.5
6 21 disp =0
7 22  
8   -
9   -
10 23 /
11   -
  24 +!______________________________________________________________________________
  25 +! MODEL PARAMETERS:
  26 +!
  27 +! nbin -> Number of grid bin
  28 +! dx -> Spatial resolution [m]
  29 +! Cfl -> Courant–Friedrichs–Lewy condition (0<Cfl<1)
  30 +! Only in the case where disp=0. The CFL condition
  31 +! is needed to calculate the time step.
  32 +! name_sim -> name of the output file
  33 +! root -> destination folder for the output file
  34 +! FSD_sheme -> method for ice floe breaking parametrization
  35 +! 0: Williams et al. 2013
  36 +! 1: Horvat 2015
  37 +!------------------------------------------------------------------------------
12 38 &model_parameter
13 39  
14 40 nbin =100
... ... @@ -17,9 +43,21 @@ Cfl =1
17 43 name_sim ='simulation1'
18 44 root = 'output/'
19 45 FSD_scheme =1
20   -/
21   -
22 46  
  47 +/
  48 +!______________________________________________________________________________
  49 +! SPECTRUM PARAMETERS:
  50 +!
  51 +! init_spec -> method to build the wave spectrum
  52 +! 1: JONSWAP spectrum
  53 +! 0: Bretschneider spectrum
  54 +! nfreq -> number of frequency bin
  55 +! Tmin -> Minimum period [s]
  56 +! Tmax -> Maximum period [s]
  57 +! alpha_s -> parameter for jonswap spectrum (init_spec=1)
  58 +! beta_s -> parameter for jonswap spectrum (init_spec=1)
  59 +! gamma_s -> parameter for jonswap spectrum (init_spec=1)
  60 +!------------------------------------------------------------------------------
23 61 &spectrum_parameters
24 62  
25 63 init_spec =1
... ... @@ -30,9 +68,23 @@ alpha_s =0.2044
30 68 beta_s =1.2500
31 69 gamma_s =3.3
32 70  
33   -
34 71 /
35   -
  72 +!______________________________________________________________________________
  73 +! ICE PARAMETERS
  74 +!
  75 +! X_ice -> Distance of the ice edge [m]
  76 +! c_cice -> Ice concentration
  77 +! ice_thick -> method for compute the ice thickness
  78 +! 0: constant thickness
  79 +! 1: thickness is a function of distance
  80 +! from ice edge
  81 +! hice -> Ice thickness (if ice_thick=0) [m]
  82 +! hmax -> Maximum ice thickness (if ice_thick=1) [m]
  83 +! Xh -> distance where h=hmax/2 (if ice_thicl=1) [m]
  84 +! D0 -> initial floe size in the domain [m]
  85 +! gam ->
  86 +! Dmin -> Minimum floe size (if FSD_sheme=1) [m]
  87 +!------------------------------------------------------------------------------
36 88 &ice_parameters
37 89 X_ice =5000
38 90 cice =0.8
... ... @@ -44,3 +96,4 @@ D0 =500
44 96 gam =1.5
45 97 Dmin =20
46 98 /
  99 +!________________________________________________________________________________
... ...
src/initialization.f90
1   -subroutine initialization
2   -use parameters
  1 +!
  2 +!_______________________________________________________________________
  3 +!
  4 +! DESCRIPTION:
  5 +! This is the initialization routine which contains the
  6 +! initial spectrum construction, set initial values for arrays
  7 +! and construct the ice transect.
  8 +!_______________________________________________________________________
  9 +
  10 + !INTERFACE:
  11 + subroutine initialization
  12 +
  13 + !MODULE USES:
  14 + use parameters
  15 +
  16 + !LOCAL PARAMETERS AND VARIABLES
  17 + implicit none
  18 + double precision, allocatable ::Gf(:),PM(:)
  19 + integer ::X1
  20 +
  21 + allocate(Gf(nfreq))
  22 + allocate(PM(nfreq))
3 23  
4   -!local parameters
5   -implicit none
6   - double precision, allocatable ::Gf(:),PM(:)
7   - integer ::X1
8 24  
9   - allocate(Gf(nfreq))
10   - allocate(PM(nfreq))
11   -
12   -
13 25  
14 26 !_________________________INITIAL SPECTRUM_____________________________
15   - E(1:nsteps,1:nbin,1:nfreq)=0d0
  27 +
  28 + E(1:nsteps,1:nbin,1:nfreq)=0d0 !INITIALIZE SPECTRUM ARRAY
16 29  
17   - if(init_spec.eq.1) then
18   - !build JONSWAP spectrum
19   -
20   - do i=1,nfreq
21   - if (freq(i).le.freq_s) then
22   - sigma_s(i)=0.07
23   - else
24   - sigma_s(i)=0.09
25   - end if
26   - end do
27   -
28   - Gf=gamma_s**(exp((-(freq-freq_s)**2)/(2*sigma_s**2*freq_s**2)))
29   - PM=alpha_s*Hs**2*(freq_s**4/freq**5)*exp(-beta_s*(freq_s/freq)**4)
30   -
31   - Ei=Gf*PM
  30 + if(init_spec.eq.1) then !use JONSWAP spectrum
  31 +
  32 + do i=1,nfreq
  33 + if (freq(i).le.freq_s) then
  34 + sigma_s(i)=0.07
  35 + else
  36 + sigma_s(i)=0.09
  37 + end if
  38 + end do
  39 +
  40 + Gf=gamma_s**(exp((-(freq-freq_s)**2)/(2*sigma_s**2*freq_s**2)))
  41 + PM=alpha_s*Hs**2*(freq_s**4/freq**5)*exp(-beta_s*(freq_s/freq)**4)
  42 +
  43 + Ei=Gf*PM
32 44  
33   - else
  45 + else !use bretschneider spectrum
34 46  
35 47 Ei=(1.25*Hs**2*(1/freq)**5)/(8*pi*Tm**4)*exp(-1.25*((1/freq)/Tm)**4)
36 48 end if
37 49  
38   -
39 50  
40   - E(1,1,1:nfreq)=Ei
41   -
  51 +
  52 + E(1,1,1:nfreq)=Ei !initial spectrum
  53 +
42 54 !_______________________________________________________________________
43 55  
44 56 !_______________________ICE_TRANSECT____________________________________
45 57  
46   -X1=floor(X_ice/dx)
47   -C_ice(1:X1)=0
48   -C_ice(X1:nbin)=cice
  58 +X1=floor(X_ice/dx) !find in which grid bin is the ice edge
  59 +C_ice(1:X1)=0 !ice concentration is 0 before ice edge!
  60 +C_ice(X1:nbin)=cice !ice concentration in the transect
49 61  
50   -Dave(1:X1)=0
51   -Dmax(1:X1)=0
52   -Dave(X1:nbin)=D0
53   -Dmax(X1:nbin)=D0
  62 +Dave(1:X1)=0 !initalize mean floe size before ice edge
  63 +Dmax(1:X1)=0 !initialize max floe size before ice edge
  64 +Dave(X1:nbin)=D0 !initalize mean floe size in ice transect
  65 +Dmax(X1:nbin)=D0 !initialize max floe size in ice transect
54 66  
55   -if (ice_thick.eq.0) then
  67 +if (ice_thick.eq.0) then ! constant ice thickness in the transect
56 68  
57   -h(X1:nbin)=hice
58   -h(1:X1)=0d0
  69 +h(X1:nbin)=hice
  70 +h(1:X1)=0d0 !0 before ice edge
59 71  
60   -else
  72 +else ! thickness is a function of distance from ice edge
61 73  
62 74 h(1:X1)=0d0
63   -do jj=X1,nbin
  75 + do jj=X1,nbin
64 76  
65   -h(jj)=hmax*(0.1+0.9*(1-exp(-((real(jj)*dx-X_ice)/Xh))))
  77 + h(jj)=hmax*(0.1+0.9*(1-exp(-((real(jj)*dx-X_ice)/Xh))))
66 78  
67   -end do
  79 + end do
68 80  
69 81 end if
70 82  
... ...
src/main.f90
1   -PROGRAM WIM2
  1 +!
  2 +!_________________________________________________________________________________
  3 + !DESCRIPTION:
  4 +! This is the main program of WIM. This routine merely calls other
  5 +! subroutines and do the main time loop. It also contains the subroutine
  6 +! progress which display a progress bar in the terminal while the model is
  7 +! running.
  8 +!_________________________________________________________________________________
2 9  
  10 + !INTERFACE:
  11 + PROGRAM WIM2
3 12  
4   - use parameters
5   - call read_namelist
6   - call array_allocation
7   - call initialization
8   -
9   -
10   -
  13 + !MODULE USES:
  14 + use parameters
11 15  
12   -!______________________________________________________
  16 +
  17 + call read_namelist !read parameters from namelists
  18 + call array_allocation ! allocate memory for arrays
  19 + call initialization ! initialize the model
13 20  
14 21  
  22 +
15 23  
  24 +!________________________________________________________________________________
16 25  
17 26  
18 27 spectrum=trim(root)//'Energy_spectrum.dat'
... ... @@ -21,33 +30,38 @@ PROGRAM WIM2
21 30  
22 31 open(10,file=spectrum)
23 32 open(11,file=floe_size)
24   -!_______________________TIME LOOP______________________
25   - do n=2,nsteps
26   -
27   - call progress(n,nsteps)
28   - do ii=1,nfreq
29   - call advection
  33 +
  34 +
  35 +!________________________________________________________________________________
  36 +! DO THE TIME LOOP
  37 +
  38 + do n=2,nsteps
  39 +
  40 + call progress(n,nsteps) !display progress bar
  41 + do ii=1,nfreq !do advection for each frequency
  42 + !band
  43 + call advection
  44 + end do
  45 +
  46 + do i=1,nbin !spatial calculations
  47 +
  48 + call attenuation ! compute spectrum attenuation
  49 + call break_horvat ! compute floe breaking
  50 + !call floe_breaking
  51 + !call fsd_build
  52 + end do
30 53 end do
  54 +!______________________OUTPUTS_________________________________________________
31 55  
32   - do i=1,nbin
33   -
34   - call attenuation
35   - call break_horvat
36   - !call floe_breaking
37   - !call fsd_build
38   - end do
39   - end do
40   - !______________________OUTPUTS_________________________
41   -
42   - call write_output
  56 + call write_output ! Write outputs in NETCDF
43 57 !call graph_dislin
44   - close(10)
45   - close(11)
  58 + close(10)
  59 + close(11)
46 60  
47 61  
48 62  
49 63 contains
50   -
  64 +!______________________________________________________________________________
51 65 subroutine progress(j,jmax)
52 66 implicit none
53 67 integer::j,k,jmax
... ... @@ -60,5 +74,6 @@ subroutine progress(j,jmax)
60 74  
61 75 endif
62 76 end subroutine progress
  77 +!_______________________________________________________________________________
63 78  
64 79 END PROGRAM WIM2
... ...