Commit c2c1e911 authored by Dany Dumont's avatar Dany Dumont

Renommage de variables, injection continue de vagues, amelioration du fichier...

Renommage de variables, injection continue de vagues, amelioration du fichier de sortie netcdf, formatage des routines.
parent 963a18cb
......@@ -3,7 +3,7 @@
! | |
! | WIM PARAMETERS |
! |_______________________|
!______________________________________________________________________________
!____________________________________________________________________
! WAVES PARAMETERS:
!
! Tm -> Peak period [s]
......@@ -13,7 +13,7 @@
! group speed is the same at all spectrum
! frequency (cg=max[cg(w)])
! 1: Wave dispersion is allowed
!------------------------------------------------------------------------------
!--------------------------------------------------------------------
&waves_parameters
Tm =Tmbatch
......@@ -21,34 +21,34 @@ Hs =Hsbatch
disp =0
/
!______________________________________________________________________________
!____________________________________________________________________
! MODEL PARAMETERS:
!
! nbin -> Number of grid bin
! nx -> 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
!------------------------------------------------------------------------------
!--------------------------------------------------------------------
&model_parameter
nbin =100
nx =100
dx =5000
Cfl =1
name_sim ='nmebatch'
root = 'output/'
/
!______________________________________________________________________________
!___________________________________________________________________
! SPECTRUM PARAMETERS:
!
! init_spec -> method to build the wave spectrum
! 2: Swell
! 1: JONSWAP spectrum
! 0: Bretschneider spectrum
! nfreq -> number of frequency bin
! nf -> number of frequency bin
! Tmin -> Minimum period [s]
! Tmax -> Maximum period [s]
! alpha_s -> parameter for jonswap spectrum (init_spec=1)
......@@ -60,7 +60,7 @@ root = 'output/'
&spectrum_parameters
init_spec =0
nfreq =800
nf =800
Tmin =2.5
Tmax =20
alpha_s =0.2044
......@@ -85,8 +85,9 @@ swell_Hs=0.09
! D0 -> initial floe size in the domain [m]
! gam ->
! Dmin -> Minimum floe size (if FSD_sheme=1) [m]
!------------------------------------------------------------------------------
!--------------------------------------------------------------------
&ice_parameters
X_ice =50000
cice =1
ice_thick =0
......@@ -99,7 +100,6 @@ Dmin =20
stress_crit =0.67e6
strain_crit =strainbatch
P_c =probcritbatch
/
!________________________________________________________________________________
! FSD PARAMETERS
......
!
! _______________________
! | |
! | WIM PARAMETERS |
! |_______________________|
!______________________________________________________________________________
!____________________________________________________________________
! WAVES PARAMETERS:
!
! Tm -> Peak period [s]
......@@ -13,42 +12,46 @@
! group speed is the same at all spectrum
! frequency (cg=max[cg(w)])
! 1: Wave dispersion is allowed
!------------------------------------------------------------------------------
! cont -> Allowing continuous wave input
! 0: Not continuous (default)
! 1: Continuous input
!--------------------------------------------------------------------
&waves_parameters
Tm =8
Hs =1
disp =0
Tm =4.5
Hs =1.5
disp =1
cont =1
/
!______________________________________________________________________________
!____________________________________________________________________
! MODEL PARAMETERS:
!
! nbin -> Number of grid bin
! nx -> Number of grid bin
! dx -> Spatial resolution [m]
! Cfl -> Courant–Friedrichs–Lewy condition (0<Cfl<1)
! Cfl -> Courant-Friedrich-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
!------------------------------------------------------------------------------
!--------------------------------------------------------------------
&model_parameter
nbin =100
dx =5000
Cfl =1
nx =100
dx =5
Cfl =1.0
name_sim ='test'
root = 'output/'
/
!______________________________________________________________________________
!____________________________________________________________________
! SPECTRUM PARAMETERS:
!
! init_spec -> method to build the wave spectrum
! 2: Swell
! 1: JONSWAP spectrum
! 0: Bretschneider spectrum
! nfreq -> number of frequency bin
! nf -> number of frequency bin
! Tmin -> Minimum period [s]
! Tmax -> Maximum period [s]
! alpha_s -> parameter for jonswap spectrum (init_spec=1)
......@@ -56,21 +59,21 @@ root = 'output/'
! gamma_s -> parameter for jonswap spectrum (init_spec=1)
! swell_T -> swell period (init_spec=2)
! swell_Hs -> swell significant height (init_spec=2)
!------------------------------------------------------------------------------
!--------------------------------------------------------------------
&spectrum_parameters
init_spec =0
nfreq =800
Tmin =2.5
Tmax =20
alpha_s =0.2044
beta_s =1.2500
gamma_s =3.3
swell_T =19
swell_Hs=0.09
nf =36
Tmin =2.5
Tmax =20
alpha_s =0.2044
beta_s =1.2500
gamma_s =3.3
swell_T =19
swell_Hs =0.09
/
!______________________________________________________________________________
!____________________________________________________________________
! ICE PARAMETERS
!
! X_ice -> Distance of the ice edge [m]
......@@ -82,62 +85,57 @@ swell_Hs=0.09
! 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]
!------------------------------------------------------------------------------
!--------------------------------------------------------------------
&ice_parameters
X_ice =50000
cice =1
ice_thick =0
hice =3
hmax =3
Xh =200000
strain_crit =3e-5
P_c =0.55
X_ice =10
cice =1
ice_thick=0
hice =0
hmax =0.8
Xh =250
strain_crit=3e-5
P_c =0.55
/
!________________________________________________________________________________
!____________________________________________________________________
! FSD PARAMETERS
! FSD_sheme -> method for compute <D>
! 0: dumont et al (2011)
! 1: power law
!
! minfloe -> minimum size floe to build the floe size categories [m]
! maxfloe -> maximum size floe to build the floe size categories [m]
! nbcat -> number of floe size categories
!--------------------------------------------------------------------------------
! minfloe -> minimum floe size of the FSD [m]
! maxfloe -> maximum floe size of the FSD [m]
! nr -> number of floe size categories
!--------------------------------------------------------------------
&fsd_parameters
FSD_scheme =1
minfloe =5
maxfloe =400
nbcat =60
nr =60
/
!_________________________________________________________________________________
! IDT PARAMETERS
!IDT_scheme -> compute the ice thickness distribution
!____________________________________________________________________
! ITD PARAMETERS
!itd_scheme -> compute the ice thickness distribution
0: no distribution
1: distribution (rayleigh)
!mu_IDT -> parameter for the distribution
!mu_itd -> parameter for the distribution
!mincat_h -> minimum ice thickness category
!maxcat_h -> maximum ice thickness category
!nbcat_h -> number of ice thickness categories
!---------------------------------------------------------------------------------
&idt_parameters
IDT_scheme =1
mu_IDT =0.5
!nh -> number of ice thickness categories
!--------------------------------------------------------------------
&itd_parameters
itd_scheme =1
mu_itd =0.5
mincat_h =0.1
maxcat_h =10
nbcat_h =50
nh =50
/
!________________________________________________________________________________
!____________________________________________________________________
!-------------------------------------------------------------------
!DESCRIPTION: Here, the wave spectrum is advected through the
! domain. The advection equation is solved using a
! Lax-wendroff discretization sheme with a Superbee
! flux limiter.
!-------------------------------------------------------------------
!_______________________________________________________________________________
!INTERFACE:
subroutine advection
!DESCRIPTION: Here, the wave spectrum is advected through the
!domain. The advection equation is solved using a Lax-wendroff
!discretization sheme with a superbee flux limiter.
!MODULE USES:
use parameters
!_______________________________________________________________________________
!INTERFACE:
subroutine advection
!MODULE USES:
use parameters
!LOCAL PARAMETERS:
implicit none
!LOCAL PARAMETERS:
implicit none
double precision, allocatable :: diffF(:)
double precision, allocatable :: diffl(:)
double precision, allocatable :: diffr(:)
double precision, allocatable :: phi(:)
double precision, allocatable :: theta(:)
double precision, allocatable :: F(:)
double precision, allocatable :: diff1(:)
double precision, allocatable :: diffF(:)
double precision, allocatable :: diffl(:)
double precision, allocatable :: diffr(:)
double precision, allocatable :: phi (:)
double precision, allocatable :: theta(:)
double precision, allocatable :: F (:)
double precision, allocatable :: diff1(:)
allocate(diffl(nbin))
allocate(diffr(nbin))
allocate(diffF(nbin))
allocate(theta(nbin))
allocate(phi(nbin))
allocate(F(nbin))
allocate(diff1(nbin-1))
!________________________________________________________________________________
do i=2,nbin
diffl(i)=E(n-1,i,ii)-E(n-1,i-1,ii)
end do
do i=1,nbin-1
diffr(i)=E(n-1,i+1,ii)-E(n-1,i,ii)
end do
diffr(nbin)=-E(n-1,nbin,ii) !set dE=0 at boundaries
diffl(1)=E(n-1,1,ii)
do i=1,nbin !Superbee flux limiter
theta(i)=diffl(i)/(diffr(i)+3e-14)
phi(i)=max(0d0,min(theta(i)*2,1d0),min(theta(i),2d0))
end do
!Lax-Wendroff sheme:
F=E(n-1,1:nbin,ii)+0.5*(1-CN(ii))*diffr*phi
do i=2,nbin
diffF(i)=F(i)-F(i-1)
end do
diffF(1)=F(1)
E(n,1:nbin,ii)=E(n-1,1:nbin,ii)-CN(ii)*diffF
!________________________________________________________________________________
allocate(diffl(nx ))
allocate(diffr(nx ))
allocate(diffF(nx ))
allocate(theta(nx ))
allocate(phi (nx ))
allocate(F (nx ))
allocate(diff1(nx-1))
if ( cont.eq.1 ) then
E(1,ii,n-1)=Ei(ii)
end if
do i=2,nx
diffl(i) = E(i ,ii,n-1) - E(i-1,ii,n-1)
end do
do i=1,nx-1
diffr(i) = E(i+1,ii,n-1) - E(i ,ii,n-1)
end do
! set dE=0 at boundaries
diffr(nx)=-E(nx,ii,n-1)
diffl(1 )= E( 1,ii,n-1)
! Superbee flux limiter
do i=1,nx
theta(i)=diffl(i)/(diffr(i)+3e-14)
phi(i)=max(0d0,min(theta(i)*2,1d0),min(theta(i),2d0))
end do
! Lax-Wendroff sheme
F=E(1:nx,ii,n-1) + 0.5*(1-CN(ii))*diffr*phi
do i=2,nx
diffF(i)=F(i) - F(i-1)
end do
diffF(1)=F(1)
E(1:nx,ii,n)=E(1:nx,ii,n-1)-CN(ii)*diffF
end subroutine advection
!____________________________________________________________________________
!____________________________________________________________________
!
!DESCRIPTION: In this routine, the attenuation coefficient is
! calculated according Kohout and Meylan (2008) and the
! spectrum attenuation is computed.
!
!____________________________________________________________________
!INTERFACE:
subroutine attenuation
!DESCRIPTION: In this routine, the attenuation
!coefficient is calculated according Kohout and
!Meylan (2008) and the spectrum attenuation is
!computed.
!USES:
use parameters
!____________________________________________________________________________
implicit none
double precision :: q11,q12,q13,q14,q15,q21,q22,q23,q24,q25
double precision :: q31,q32,q33,q34,q35
double precision, allocatable :: p1(:),p2(:),p3(:)
double precision, allocatable :: att(:)
allocate(p1 (nf))
allocate(p2 (nf))
allocate(p3 (nf))
allocate(att(nf))
!INTERFACE:
subroutine attenuation
!USES:
use parameters
implicit none
double precision :: q11,q12,q13,q14,q15,q21,q22,q23,q24,q25
double precision :: q31,q32,q33,q34,q35
double precision, allocatable :: p1(:),p2(:),p3(:)
double precision, allocatable :: att(:)
allocate(p1(nfreq))
allocate(p2(nfreq))
allocate(p3(nfreq))
allocate(att(nfreq))
!____________________________________________________________________________
q11 = -0.00000777
q12 = 0.00032080
......@@ -53,21 +48,17 @@ p1 = q11*T**4 + q12*T**3 + q13*T**2 + q14*T + q15
p2 = q21*T**4 + q22*T**3 + q23*T**2 + q24*T + q25
p3 = q31*T**4 + q32*T**3 + q33*T**2 + q34*T + q35
alpha(i,1:nfreq)=-1*(p1*h(i)**2 + p2*h(i) + p3)
do j=1,nfreq
if (alpha(i,j).lt.0)then
alpha(i,j)=0d0
end if
end do
att=C_ice(i)*alpha(i,1:nfreq)/(Dave(i)+3e-14)
S_ice(n,i,1:nfreq)=-att*E(n,i,1:nfreq)
E(n,i,1:nfreq)=E(n,i,1:nfreq)*exp(-att*Cg*dt)
alpha(i,:)=-1*(p1*h(i)**2 + p2*h(i) + p3)
do ii=1,nf
if ( alpha(i,ii).lt.0 )then
alpha(i,ii)=0d0
end if
end do
!_____________________________________________________________________________
att=C_ice(i)*alpha(i,:)/(Dave(i)+3e-14)
!S_ice(n,i,1:nf)=-att*E(n,i,1:nf)
S_ice(i,:,n)=-att*E(i,:,n)
E(i,:,n)=E(i,:,n)*exp(-att*Cg*dt)
end subroutine attenuation
This diff is collapsed.
!
!_______________________________________________________________________
!____________________________________________________________________
!
! 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
complex(kind=8), dimension(6) :: poly
complex(kind=8), dimension(5) :: roots
logical :: param1
logical :: param2
allocate(Gf(nfreq))
allocate(PM(nfreq))
!construct time array
time(1)=0
do ii=2,nsteps
time(ii)=time(ii-1)+dt/60
end do
!construct space array
x_axis(1)=0
do ii=2,nbin
x_axis(ii)=x_axis(ii-1)+dx/1000
end do
!_________________________INITIAL SPECTRUM_____________________________
E(1:nsteps,1:nbin,1:nfreq)=0d0 !INITIALIZE SPECTRUM ARRAY
if(init_spec.eq.1) then !use JONSWAP spectrum
do i=1,nfreq
if (freq(i).le.freq_s) then
sigma_s(i)=0.07
else
sigma_s(i)=0.09
end if
end do
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)
Ei=Gf*PM
!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
complex(kind=8), dimension(6) :: poly
complex(kind=8), dimension(5) :: roots
logical :: param1
logical :: param2
allocate(Gf(nf))
allocate(PM(nf))
! construct time array in hours
time(1)=0
do ii=2,nt
time(ii)=time(ii-1)+dt/3600
end do
write(*,*) ' * Time step is ',dt,' s'
! construct space array in km
x_axis(1)=0
do ii=2,nx
x_axis(ii)=x_axis(ii-1)+dx/1000
end do
!--------------------- INITIAL SPECTRUM -----------------------------
E(:,:,:)=0d0
if ( init_spec.eq.1 ) then
! JONSWAP spectrum
do i=1,nf
if ( freq(i).le.freq_s ) then
sigma_s(i)=0.07
else
sigma_s(i)=0.09
end if
end do
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)
Ei=Gf*PM
else if (init_spec.eq.0) then !use bretschneider spectrum
Ei=(1.25*Hs**2*(1/freq)**5)/(8*pi*Tm**4)*exp(-1.25*((1/freq)/Tm)**4)
else
Ei=1/(0.01*sqrt(2*pi))*exp(-(omega-2*pi/swell_T)**2/(2*0.01**2))
Ei=(swell_Hs/4d0)**2*Ei/(sum(Ei*domega))
end if
else if ( init_spec.eq.0 ) then
! Bretschneider spectrum
Ei=(1.25*Hs**2*(1/freq)**5)/(8*pi*Tm**4)* &
exp(-1.25*((1/freq)/Tm)**4)
E(1,1,1:nfreq)=Ei !initial spectrum
else
!_______________________________________________________________________
Ei=1/(0.01*sqrt(2*pi))*exp(-(omega-2*pi/swell_T)**2/(2*0.01**2))
Ei=(swell_Hs/4d0)**2*Ei/(sum(Ei*domega))
!_______________________ICE_TRANSECT____________________________________
S_ice(1,1,1:nfreq)=0
X1=floor(X_ice/dx) !find in which grid bin is the ice edge
C_ice(1:X1)=0 !ice concentration is 0 before ice edge!
C_ice(X1:nbin)=cice !ice concentration in the transect
end if
Dave(1:X1)=0 !initalize mean floe size before ice edge
Dmax(1:X1)=0 !initialize max floe size before ice edge
Dave(X1:nbin)=maxfloe !initalize mean floe size in ice transect
Dmax(X1:nbin)=maxfloe !initialize max floe size in ice transect
E(1,1:nf,1)=Ei
if (ice_thick.eq.0) then ! constant ice thickness in the transect
!--------------------- ICE TRANSECT ---------------------------------
h(X1:nbin)=hice
h(1:X1-1)=0d0 !0 before ice edge
S_ice(1,1:nf,1)=0
x1=floor(X_ice/dx) !find in which grid bin is the ice edge
C_ice( 1:x1)=0 !ice concentration is 0 before ice edge!
C_ice(x1:nx)=cice !ice concentration in the transect
else ! thickness is a function of distance from ice edge
Dave( 1:x1)=0 !initalize mean floe size before ice edge
Dmax( 1:x1)=0 !initialize max floe size before ice edge
Dave(x1:nx)=maxfloe !initalize mean floe size in ice transect
Dmax(x1:nx)=maxfloe !initialize max floe size in ice transect
h(1:X1)=0d0
do jj=X1,nbin
if ( ice_thick.eq.0 ) then
! constant ice thickness in the transect
h(x1:nx)=hice
h(1 :x1-1)=0d0