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
subroutine ice_fracture
use parameters
subroutine ice_fracture
!local parameters
implicit none
double precision :: Y=5.5e9
double precision :: TT=13
double precision :: poisson=0.3
double precision, allocatable :: P(:)
double precision, allocatable :: P_cat(:)
double precision, allocatable :: F(:)
double precision, allocatable :: Q(:,:)
double precision, allocatable :: E_A(:)
double precision, allocatable :: Q2(:)
double precision, allocatable :: W(:)
double precision, allocatable :: strain(:)
double precision, allocatable :: stress(:)
integer :: Nband=500
double precision :: m_0
double precision :: m_0_stress
double precision :: m_0_amp
double precision :: m_2_amp
double precision :: Tw
double precision :: kw
double precision,allocatable :: wavelength(:)
double precision,allocatable :: S_strain(:)
double precision, allocatable :: S_stress(:)
integer :: freq1
integer :: freq2
double precision, allocatable :: k(:)
double precision :: Lmin
double precision, allocatable :: Dave1(:)
integer ::ninterp=1
double precision, allocatable :: xinterp(:)
double precision, allocatable :: Pinterp(:)
double precision, allocatable ::nfloe(:,:)
double precision, allocatable :: nfloe_tot(:)
double precision, allocatable :: P2(:)
allocate(P(Nband))
allocate(P_cat(nbcat))
allocate(F(nbcat))
allocate(Q(nbcat,nbcat))
allocate(E_A(nfreq))
allocate(Q2(nbcat))
allocate(strain(nfreq))
allocate(stress(nfreq))
allocate(wavelength(nfreq))
allocate(S_strain(nbcat))
allocate(k(nfreq))
allocate(S_stress(Nband))
allocate(Dave1(nbcat_h))
allocate(xinterp(ninterp))
allocate(Pinterp(ninterp))
allocate(nfloe(nbcat,nbcat_h))
allocate(nfloe_tot(nbcat))
allocate(P2(Nband))
allocate(W(nfreq))
!calculate the probability of fracture for each parts of the
!spectrum and the assiociated wavelength
do iii=1,nbcat_h
Lmin=pi*0.5*((5e6*middle_h_cat(iii)**3)/(3*10*(1-0.3**2)))**0.25!Lmin according Mellor 1986
W=(9.81*kice(iii,:))/omega**2
wavelength=2*pi/kice(iii,:)
use parameters
strain=middle_h_cat(iii)*0.5*kice(iii,:)**2*W
freq1=nfreq
freq2=nfreq
do ii=1,nbcat
!local parameters
implicit none
if(2d0*floe_cat(ii+1).lt.wavelength(nfreq).or.2d0*floe_cat(ii+1).gt.wavelength(1)) then
P_cat(ii)=0d0
else
do while(wavelength(freq1).lt.2d0*floe_cat(ii+1).or.freq1.lt.0)
freq1=freq1-1
end do
!0th moment of the strain spectrum
m_0=sum(E(n,i,freq1:freq2)*strain(freq1:freq2)*domega)
!significant strain
S_strain(ii)=2*sqrt(m_0)
integer :: Nband=500
integer :: freq1
integer :: freq2
integer :: ninterp=1
double precision :: Y=5.5e9
double precision :: TT=13
double precision :: poisson=0.3
double precision :: m_0
double precision :: m_0_stress
double precision :: m_0_amp
double precision :: m_2_amp
double precision :: Tw
double precision :: kw
double precision :: Lmin
double precision, allocatable :: P(:)
double precision, allocatable :: P_cat(:)
double precision, allocatable :: F(:)
double precision, allocatable :: Q(:,:)
double precision, allocatable :: E_A(:)
double precision, allocatable :: Q2(:)
double precision, allocatable :: W(:)
double precision, allocatable :: strain(:)
double precision, allocatable :: stress(:)
double precision, allocatable :: wavelength(:)
double precision, allocatable :: S_strain(:)
double precision, allocatable :: S_stress(:)
double precision, allocatable :: k(:)
double precision, allocatable :: Dave1(:)
double precision, allocatable :: xinterp(:)
double precision, allocatable :: Pinterp(:)
double precision, allocatable :: nfloe(:,:)
double precision, allocatable :: nfloe_tot(:)
double precision, allocatable :: P2(:)
!allocate(P (Nband))
!allocate(S_stress (Nband))
!allocate(P2 (Nband))
allocate(F (nr ))
allocate(P_cat (nr ))