Commit 31a3ff4d3161e1cc6eeeed950d2af038e6983e0c

Authored by Dany Dumont
1 parent c2c1e911
Exists in master

Changement de la structure de la variable fsd (t,x,r,h) > (x,r,h,t)

nml/parameter.nml
... ... @@ -20,7 +20,7 @@
20 20  
21 21 Tm =4.5
22 22 Hs =1.5
23   -disp =1
  23 +disp =0
24 24 cont =1
25 25 /
26 26  
... ... @@ -29,7 +29,7 @@ cont =1
29 29 !
30 30 ! nx -> Number of grid bin
31 31 ! dx -> Spatial resolution [m]
32   -! Cfl -> Courant-Friedrich-Lewy condition (0 < Cfl < 1)
  32 +! cfl -> Courant-Friedrich-Lewy condition (0 < cfl < 1)
33 33 ! Only in the case where disp=0. The CFL condition
34 34 ! is needed to calculate the time step.
35 35 ! name_sim -> name of the output file
... ... @@ -37,9 +37,9 @@ cont =1
37 37 !--------------------------------------------------------------------
38 38 &model_parameter
39 39  
40   -nx =100
  40 +nx =1000
41 41 dx =5
42   -Cfl =1.0
  42 +cfl =1.0
43 43 name_sim ='test'
44 44 root = 'output/'
45 45 /
... ... @@ -62,7 +62,7 @@ root = &#39;output/&#39;
62 62 !--------------------------------------------------------------------
63 63 &spectrum_parameters
64 64  
65   -init_spec =0
  65 +init_spec =1
66 66 nf =36
67 67 Tmin =2.5
68 68 Tmax =20
... ... @@ -88,9 +88,9 @@ swell_Hs =0.09
88 88 !--------------------------------------------------------------------
89 89 &ice_parameters
90 90  
91   -X_ice =10
  91 +X_ice =50
92 92 cice =1
93   -ice_thick=0
  93 +ice_thick=1
94 94 hice =0
95 95 hmax =0.8
96 96 Xh =250
... ... @@ -101,7 +101,7 @@ P_c =0.55
101 101 !____________________________________________________________________
102 102 ! FSD PARAMETERS
103 103  
104   -! FSD_sheme -> method for compute <D>
  104 +! fsd_sheme -> method for compute <D>
105 105 ! 0: dumont et al (2011)
106 106 ! 1: power law
107 107 !
... ... @@ -111,10 +111,10 @@ P_c =0.55
111 111 !--------------------------------------------------------------------
112 112 &fsd_parameters
113 113  
114   -FSD_scheme =1
  114 +fsd_scheme =1
115 115 minfloe =5
116 116 maxfloe =400
117   -nr =60
  117 +nr =25
118 118 /
119 119  
120 120 !____________________________________________________________________
... ...
src/ice_fracture.f90
... ... @@ -129,11 +129,14 @@ subroutine ice_fracture
129 129  
130 130 !compute the new floe size distribution!
131 131 do jj=1,nr
132   - Q2(jj)=sum(Q(jj,:)*FSD(n-1,i,:,iii)*F)
  132 + !Q2(jj)=sum(Q(jj,:)*fsd(n-1,i,:,iii)*F)
  133 + Q2(jj)=sum(Q(jj,:)*fsd(i,:,iii,n-1)*F)
133 134 end do
134 135  
135   - FSD(n,i,1:nr,iii)=FSD(n-1,i,1:nr,iii) - &
136   - F*FSD(n-1,i,1:nr,iii) + Q2
  136 + !fsd(n,i,1:nr,iii)=fsd(n-1,i,1:nr,iii) - &
  137 + ! F*fsd(n-1,i,1:nr,iii) + Q2
  138 + fsd(i,1:nr,iii,n)=fsd(i,1:nr,iii,n-1) - &
  139 + F*fsd(i,1:nr,iii,n-1) + Q2
137 140  
138 141 !if (i.eq.25 .and.n.eq.25.and.iii.eq.10)then
139 142 !open(31,file='output/strain3.dat')
... ... @@ -150,8 +153,8 @@ subroutine ice_fracture
150 153  
151 154 !compute the new average floe diameter <D>
152 155 do ii=1,nh
153   - nfloe(:,ii)=FSD(n,i,:,ii)*itd(i,ii)*dx**2/middle_floe_cat**2
154   - Dave1(ii)=sum(FSD(n,i,:,ii)*middle_floe_cat)
  156 + nfloe(:,ii)=fsd(i,:,ii,n)*itd(i,ii)*dx**2/middle_floe_cat**2
  157 + Dave1(ii)=sum(fsd(i,:,ii,n)*middle_floe_cat)
155 158 enddo
156 159  
157 160 nfloe=nfloe/sum(nfloe+3e-14)
... ...
src/initialization.f90
... ... @@ -28,20 +28,33 @@ subroutine initialization
28 28 allocate(Gf(nf))
29 29 allocate(PM(nf))
30 30  
31   -! construct time array in hours
  31 + ! construct time array [in hours]
32 32 time(1)=0
33 33 do ii=2,nt
34 34 time(ii)=time(ii-1)+dt/3600
35 35 end do
36 36  
37   - write(*,*) ' * Time step is ',dt,' s'
38 37  
39   -! construct space array in km
  38 + ! construct space array [in km]
40 39 x_axis(1)=0
41 40 do ii=2,nx
42   - x_axis(ii)=x_axis(ii-1)+dx/1000
  41 + x_axis(ii)=x_axis(ii-1) + dx/1000
43 42 end do
  43 +
  44 + write(*,*) ' * dt = ',dt,'s'
  45 + if ( disp.eq.1 ) then
  46 + write(*,*) ' * dispersion is on'
  47 + else
  48 + write(*,*) ' * dispersion is off'
  49 + end if
44 50  
  51 + if ( cont.eq.1 ) then
  52 + write(*,*) ' * wave energy is continuously injected'
  53 + else
  54 + write(*,*) ' * only a single wave energy pulse'
  55 + end if
  56 +
  57 +
45 58  
46 59 !--------------------- INITIAL SPECTRUM -----------------------------
47 60  
... ... @@ -75,11 +88,11 @@ subroutine initialization
75 88  
76 89 end if
77 90  
78   - E(1,1:nf,1)=Ei
  91 + E(1,:,1)=Ei
79 92  
80 93 !--------------------- ICE TRANSECT ---------------------------------
81 94  
82   - S_ice(1,1:nf,1)=0
  95 + S_ice(1,:,1)=0
83 96 x1=floor(X_ice/dx) !find in which grid bin is the ice edge
84 97 C_ice( 1:x1)=0 !ice concentration is 0 before ice edge!
85 98 C_ice(x1:nx)=cice !ice concentration in the transect
... ... @@ -91,7 +104,7 @@ subroutine initialization
91 104  
92 105 if ( ice_thick.eq.0 ) then
93 106 ! constant ice thickness in the transect
94   - h(x1:nx)=hice
  107 + h(x1:nx )=hice
95 108 h(1 :x1-1)=0d0
96 109  
97 110 else
... ... @@ -115,9 +128,9 @@ subroutine initialization
115 128 middle_floe_cat(i)=(floe_cat(i)+floe_cat(i+1))*0.5
116 129 end do
117 130  
118   - FSD(:,:,:,:)=0d0
  131 + fsd(:,:,:,:)=0d0
119 132 do i=x1,nx
120   - FSD(1,i,nr,:)=C_ice(i)
  133 + fsd(i,nr,:,1)=C_ice(i)
121 134 end do
122 135  
123 136 Dave(x1:nx)=middle_floe_cat(nr)
... ...
src/main.f90
... ... @@ -43,7 +43,7 @@ call message(5)
43 43 do n=2,nt
44 44  
45 45 ! display progress bar
46   - call progress(n,nt)
  46 + !call progress(n,nt)
47 47  
48 48 ! do advection for each frequency band
49 49 do ii=1,nf
... ... @@ -79,9 +79,9 @@ subroutine progress(j,jmax)
79 79  
80 80 implicit none
81 81 integer :: j,k,jmax
82   - character(len=39) :: bar=' processing ???%'
  82 + character(len=20) :: bar=' processing ???%'
83 83  
84   - write(unit=bar(36:38),fmt="(i3)")ceiling((real(j)/real(jmax))*100)
  84 + write(unit=bar(17:19),fmt="(i3)")ceiling((real(j)/real(jmax))*100)
85 85 write(unit=6,fmt="(a1,a22)",advance="no") char(13), bar
86 86  
87 87 if (real(j)/real(jmax).eq.1) then
... ...
src/parameters.f90
... ... @@ -68,7 +68,7 @@ integer :: nt ! Duration of the simulation
68 68  
69 69 real :: dt ! Time step
70 70 double precision :: dx=500 ! Grid resolution
71   -double precision :: Cfl=1 ! Courant
  71 +double precision :: cfl=1 ! Courant
72 72  
73 73 double precision, allocatable :: x_axis(:) ! Vector of grid width
74 74 double precision, allocatable :: time(:) ! Vector of time
... ... @@ -100,7 +100,7 @@ double precision, allocatable :: Dmax(:) ! Maximum floe size
100 100 double precision, allocatable :: kice(:,:)
101 101  
102 102 !FSD
103   -integer :: FSD_scheme=1
  103 +integer :: fsd_scheme=1
104 104 integer :: nr=40
105 105 integer :: nedge
106 106  
... ... @@ -108,7 +108,7 @@ double precision :: minfloe=5
108 108 double precision :: maxfloe=500
109 109 double precision :: res
110 110  
111   -double precision, allocatable :: FSD(:,:,:,:)
  111 +double precision, allocatable :: fsd(:,:,:,:)
112 112 double precision, allocatable :: floe_cat(:)
113 113 double precision, allocatable :: middle_floe_cat(:)
114 114  
... ... @@ -139,14 +139,14 @@ subroutine read_namelist
139 139 Tmin,Tmax,gamma_s,init_spec, &
140 140 swell_T,swell_Hs
141 141  
142   - namelist /model_parameter/ nx,dx,Cfl,name_sim,root
  142 + namelist /model_parameter/ nx,dx,cfl,name_sim,root
143 143  
144 144 namelist /waves_parameters/ Tm,Hs,disp,cont
145 145  
146 146 namelist /ice_parameters/ cice,hice,ice_thick,hmax, &
147 147 X_ice,Xh,strain_crit,P_c
148 148  
149   - namelist /fsd_parameters/ FSD_scheme,minfloe,maxfloe, &
  149 + namelist /fsd_parameters/ fsd_scheme,minfloe,maxfloe, &
150 150 nr
151 151  
152 152 namelist /itd_parameters/ itd_scheme,mu_itd,mincat_h, &
... ... @@ -211,7 +211,7 @@ subroutine array_allocation
211 211 Cg=0.5*Cp
212 212  
213 213 if ( disp.eq.0 ) then
214   - CN=Cfl
  214 + CN=cfl
215 215 Cg=maxval(Cg)
216 216 dt=CN(1)*dx/maxval(Cg)
217 217 else
... ... @@ -226,12 +226,12 @@ subroutine array_allocation
226 226 allocate(Dave (nx))
227 227 allocate(time (nt))
228 228 allocate(S_ice (nx,nf,nt))
229   - allocate(h_sign(nt,nx))
  229 + allocate(h_sign(nx,nt))
230 230  
231 231 nedge=nr+1
232 232  
233 233 allocate(floe_cat (nedge))
234   - allocate(FSD (nt,nx,nr,nh))
  234 + allocate(fsd (nx,nr,nh,nt))
235 235 allocate(middle_floe_cat(nr))
236 236  
237 237 nedge_h=nh+1
... ...
src/statistics.f90
... ... @@ -7,6 +7,6 @@ subroutine statistics
7 7 double precision :: m_0
8 8  
9 9 m_0=sum(E(i,:,n)*domega)
10   - h_sign(n,i)=4*sqrt(m_0)
  10 + h_sign(i,n)=4*sqrt(m_0)
11 11  
12 12 end subroutine
... ...
src/write_output.f90
... ... @@ -41,7 +41,7 @@ subroutine write_output
41 41 integer :: HsID
42 42 integer :: hID
43 43 integer :: hcat_varID
44   - integer :: idtID
  44 + integer :: itdID
45 45  
46 46 stat=nf90_create(namefile,cmode=or(nf90_clobber,nf90_64bit_offset),ncid=ncid)
47 47 call handle_err(stat)
... ... @@ -99,16 +99,16 @@ subroutine write_output
99 99 stat=nf90_def_var(ncid,"ithk",nf90_double,xID,h_varID)
100 100 call handle_err(stat)
101 101  
102   - ! (t, x, d, h)
103   - stat=nf90_def_var(ncid,"fsd",nf90_double,(/tID,xID,floeID,hID/),fsdID)
  102 + ! (x, r, h, t)
  103 + stat=nf90_def_var(ncid,"fsd",nf90_double,(/xID,floeID,hID,tID/),fsdID)
104 104 call handle_err(stat)
105 105  
106   - ! (t, x)
107   - stat=nf90_def_var(ncid,"hs",nf90_double,(/tID,xID/),HsID)
  106 + ! (x, t)
  107 + stat=nf90_def_var(ncid,"hs",nf90_double,(/xID,tID/),HsID)
108 108 call handle_err(stat)
109 109  
110 110 ! (x, h)
111   - stat=nf90_def_var(ncid,"itd",nf90_double,(/xID,hID/),idtID)
  111 + stat=nf90_def_var(ncid,"itd",nf90_double,(/xID,hID/),itdID)
112 112 call handle_err(stat)
113 113  
114 114 ! set attributes
... ... @@ -135,6 +135,9 @@ subroutine write_output
135 135 stat=nf_put_att_text(ncid,EID,'long_name',50, &
136 136 'Sea surface wave variance spectral density')
137 137  
  138 + stat=nf_put_att_text(ncid,fsdID,'units',10,'m m-1')
  139 + stat=nf_put_att_text(ncid,fsdID,'long_name',50, &
  140 + 'Floe size and thickness distribution')
138 141 ! end file definition
139 142 stat=nf90_enddef(ncid)
140 143 call handle_err(stat)
... ... @@ -167,7 +170,7 @@ subroutine write_output
167 170 stat=nf90_put_var(ncid,h_varID,h)
168 171 call handle_err(stat)
169 172  
170   - stat=nf90_put_var(ncid,fsdID,FSD)
  173 + stat=nf90_put_var(ncid,fsdID,fsd)
171 174 call handle_err(stat)
172 175  
173 176 stat=nf90_put_var(ncid,floe_varID,middle_floe_cat)
... ... @@ -179,7 +182,7 @@ subroutine write_output
179 182 stat=nf90_put_var(ncid,HsID,h_sign)
180 183 call handle_err(stat)
181 184  
182   - stat=nf90_put_var(ncid,idtID,itd)
  185 + stat=nf90_put_var(ncid,itdID,itd)
183 186 call handle_err(stat)
184 187  
185 188 stat=nf90_close(ncid)
... ...