Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Jérémy Baudry
WIM2
Commits
4e5b4414
Commit
4e5b4414
authored
Dec 14, 2015
by
Jérémy Baudry
Browse files
ajout commentaires dans le code
parent
a081b91c
Changes
10
Hide whitespace changes
Inline
Side-by-side
nml/parameter.nml
View file @
4e5b4414
...
...
@@ -17,7 +17,7 @@
&waves_parameters
Tm =6
Hs =1
.5
Hs =1
disp =0
/
...
...
@@ -31,14 +31,14 @@ disp =0
! 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
.
201
3
! 1:
Horvat 2015
! FSD_sheme -> method for
compute <D>
! 0:
dumont
et al
(
201
1)
! 1:
power law
!------------------------------------------------------------------------------
&model_parameter
nbin =
10
0
dx =
1
000
nbin =
5
0
dx =
5
000
Cfl =1
name_sim ='simulation1'
root = 'output/'
...
...
@@ -86,9 +86,9 @@ gamma_s =3.3
! Dmin -> Minimum floe size (if FSD_sheme=1) [m]
!------------------------------------------------------------------------------
&ice_parameters
X_ice =5000
X_ice =5000
0
cice =0.8
ice_thick =
0
ice_thick =
1
hice =2
hmax =4
Xh =100000
...
...
src/advection.f90
View file @
4e5b4414
subroutine
advection
use
parameters
!_______________________________________________________________________________
implicit
none
!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.
double precision
,
allocatable
::
diffF
(:),
diffl
(:),
diffr
(:),
phi
(:),
theta
(:)
double precision
,
allocatable
::
F
(:),
diff1
(:)
!_______________________________________________________________________________
!INTERFACE:
subroutine
advection
!MODULE USES:
use
parameters
!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
(:)
allocate
(
diffl
(
nbin
))
allocate
(
diffr
(
nbin
))
allocate
(
diffF
(
nbin
))
allocate
(
theta
(
nbin
))
allocate
(
phi
(
nbin
))
allocate
(
F
(
nbin
))
allocate
(
diff1
(
nbin
-1
))
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
)
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
)
diffr
(
nbin
)
=-
E
(
n
-1
,
nbin
,
ii
)
!set dE=0 at boundaries
diffl
(
1
)
=
E
(
n
-1
,
1
,
ii
)
do
i
=
1
,
nbin
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
)
...
...
@@ -42,7 +63,7 @@ implicit none
E
(
n
,
1
:
nbin
,
ii
)
=
E
(
n
-1
,
1
:
nbin
,
ii
)
-
CN
(
ii
)
*
diffF
!________________________________________________________________________________
end
subroutine
advection
...
...
src/attenuation.f90
View file @
4e5b4414
subroutine
attenuation
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
(:),
att
(:)
allocate
(
p1
(
nfreq
))
allocate
(
p2
(
nfreq
))
allocate
(
p3
(
nfreq
))
allocate
(
att
(
nfreq
))
!DESCRIPTION: In this routine, the attenuation
!coefficient is calculated according Kohout and
!Meylan (2008) and the spectrum attenuation is
!computed.
!____________________________________________________________________________
!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
...
...
@@ -42,13 +60,14 @@ alpha(i,j)=0d0
end
if
end
do
att
=
C_ice
(
i
)
*
alpha
(
i
,
1
:
nfreq
)/(
Dave
(
i
)
+3e-14
)
S_ice
(
i
,
1
:
nfreq
)
=-
att
*
E
(
n
,
i
,
1
:
nfreq
)
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
)
!_____________________________________________________________________________
end
subroutine
attenuation
src/floe_breaking.f90
View file @
4e5b4414
subroutine
floe_breaking
use
parameters
implicit
none
double precision
,
allocatable
::
WN_ice
(:),
fnt
(:),
k
(:)
double precision
::
rho
=
1025
,
d
,
F
,
Y
=
5.5
,
v
=
0.3
integer
::
acc
=
10000
double precision
,
allocatable
::
W
(:)
double precision
,
allocatable
::
fnt_d
(:)
double precision
,
allocatable
::
S
(:)
double precision
::
SS
double precision
::
WN_ice_d
double precision
::
RS
=
7.05e-05
double precision
::
m0_s
double precision
::
m0_a
double precision
::
m2_a
double precision
::
Tw
double precision
::
om_d
double precision
::
wl_w
allocate
(
fnt
(
acc
+1
))
allocate
(
k
(
acc
+1
))
allocate
(
WN_ice
(
nfreq
))
allocate
(
W
(
nfreq
))
allocate
(
fnt_d
(
acc
+1
))
allocate
(
S
(
nfreq
))
F
=
Y
*
h
(
i
)
**
3
/
12d0
*
(
1
-
v
**
2
)
d
=
0.9
*
h
(
i
)
jj
=
1
do
ii
=
0
,
acc
k
(
jj
)
=
real
(
ii
)
*
10d0
/
real
(
acc
)
jj
=
jj
+1
end
do
do
j
=
1
,
nfreq
fnt
=
F
*
k
**
5
+
rho
*
(
g
-
d
*
omega
(
j
)
**
2
)
*
k
-
rho
*
omega
(
j
)
**
2
WN_ice
(
j
)
=
k
(
minloc
(
abs
(
fnt
),
DIM
=
1
))
end
do
W
=
g
*
WN_ice
/
omega
**
2
S
=
(
0.5
*
h
(
i
))
*
WN_ice
**
2
*
W
m0_s
=
sum
(
E
(
n
,
i
,
1
:
nfreq
)
*
S
**
2
)
*
domega
SS
=
2
*
sqrt
(
m0_s
)
if
(
SS
.gt.
RS
)
then
!_______________________________________________________________________________
!DESCRIPTION: Here is the parametrization proposed by
!Williams et al. (2013) for wave induced
!floe breaking. In this routine, the maximum floe size
!is computed using the significant strain imposed by
!passing waves in ice.
!_______________________________________________________________________________
!INTERFACE:
subroutine
floe_breaking
!USES:
use
parameters
!LOCAL PARAMETERS:
implicit
none
m0_a
=
sum
(
E
(
n
,
i
,
1
:
nfreq
)
*
W
**
2
)
*
domega
m2_a
=
sum
(
omega
**
2
*
E
(
n
,
i
,
1
:
nfreq
)
*
W
**
2
)
*
domega
Tw
=
2
*
pi
*
sqrt
(
m0_a
/
m2_a
)
om_d
=
2
*
pi
/
Tw
double precision
,
allocatable
::
WN_ice
(:)
double precision
,
allocatable
::
fnt
(:)
double precision
,
allocatable
::
k
(:)
double precision
::
rho
=
1025
double precision
::
d
double precision
::
F
double precision
::
Y
=
5.5
double precision
::
v
=
0.3
integer
::
acc
=
10000
double precision
,
allocatable
::
W
(:)
double precision
,
allocatable
::
fnt_d
(:)
double precision
,
allocatable
::
S
(:)
double precision
::
SS
double precision
::
WN_ice_d
double precision
::
RS
=
7.05e-05
double precision
::
m0_s
double precision
::
m0_a
double precision
::
m2_a
double precision
::
Tw
double precision
::
om_d
double precision
::
wl_w
allocate
(
fnt
(
acc
+1
))
allocate
(
k
(
acc
+1
))
allocate
(
WN_ice
(
nfreq
))
allocate
(
W
(
nfreq
))
allocate
(
fnt_d
(
acc
+1
))
allocate
(
S
(
nfreq
))
!_______________________________________________________________________________
F
=
Y
*
h
(
i
)
**
3
/
12d0
*
(
1
-
v
**
2
)
d
=
0.9
*
h
(
i
)
jj
=
1
!create a wavelength vector (this is used to
!find the root of the polynom fnt
do
ii
=
0
,
acc
k
(
jj
)
=
real
(
ii
)
*
10d0
/
real
(
acc
)
jj
=
jj
+1
end
do
do
j
=
1
,
nfreq
fnt
=
F
*
k
**
5
+
rho
*
(
g
-
d
*
omega
(
j
)
**
2
)
*
k
-
rho
*
omega
(
j
)
**
2
WN_ice
(
j
)
=
k
(
minloc
(
abs
(
fnt
),
DIM
=
1
))
!calculate wavelength in ice
end
do
W
=
g
*
WN_ice
/
omega
**
2
S
=
(
0.5
*
h
(
i
))
*
WN_ice
**
2
*
W
m0_s
=
sum
(
E
(
n
,
i
,
1
:
nfreq
)
*
S
**
2
)
*
domega
!0th moment of the strain spectrum
SS
=
2
*
sqrt
(
m0_s
)
!significant strain
if
(
SS
.gt.
RS
)
then
fnt_d
=
F
*
k
**
5
+
rho
*
(
g
-
d
*
om_d
**
2
)
*
k
-
rho
*
om_d
**
2
WN_ice_d
=
k
(
minloc
(
abs
(
fnt_d
),
DIM
=
1
))
wl_w
=
2
*
pi
/
WN_ice_d
m0_a
=
sum
(
E
(
n
,
i
,
1
:
nfreq
)
*
W
**
2
)
*
domega
m2_a
=
sum
(
omega
**
2
*
E
(
n
,
i
,
1
:
nfreq
)
*
W
**
2
)
*
domega
Tw
=
2
*
pi
*
sqrt
(
m0_a
/
m2_a
)
om_d
=
2
*
pi
/
Tw
Dmax
(
i
)
=
max
(
Dmin
,
min
(
0.5
*
wl_w
,
Dmax
(
i
)))
fnt_d
=
F
*
k
**
5
+
rho
*
(
g
-
d
*
om_d
**
2
)
*
k
-
rho
*
om_d
**
2
WN_ice_d
=
k
(
minloc
(
abs
(
fnt_d
),
DIM
=
1
))
wl_w
=
2
*
pi
/
WN_ice_d
Dmax
(
i
)
=
max
(
Dmin
,
min
(
0.5
*
wl_w
,
Dmax
(
i
)))
end
if
end
if
!_________________________________________________________________________________
end
subroutine
floe_breaking
src/fsd_build.f90
View file @
4e5b4414
subroutine
fsd_build
use
parameters
implicit
none
double precision
::
coeff
double precision
,
allocatable
::
ND
(:),
NN
(:)
integer
::
M
,
mm
!________________________________________________________________________________
!DESCRIPTION: In this routine the average floe size
!Dave is computed using the value of Dmax calculated in
!the subroutine 'floe_breaking'.
!________________________________________________________________________________
!INTERFACE:
subroutine
fsd_build
!MODULE USES:
use
parameters
!LOCAL PARAMETERS:
implicit
none
double precision
::
coeff
double precision
,
allocatable
::
ND
(:)
double precision
,
allocatable
::
NN
(:)
integer
::
M
integer
::
mm
!_________________________________________________________________________________
if
(
C_ice
(
i
)
.eq.
0
)
then
Dave
(
i
)
=
0
...
...
@@ -13,11 +33,12 @@ use parameters
elseif
(
Dmax
(
i
)
.eq.
Dmin
)
then
Dave
(
i
)
=
Dmin
elseif
(
FSD_scheme
.eq.
1
)
then
coeff
=
1
/((
1
/(
1
-
gam
))
*
(
Dmax
(
i
)
**
(
1
-
gam
)
-
Dmin
**
(
1
-
gam
)))
Dave
(
i
)
=
coeff
*
(
1
/(
2
-
gam
))
*
(
Dmax
(
i
)
**
(
2
-
gam
)
-
Dmin
**
(
2
-
gam
))
else
elseif
(
FSD_scheme
.eq.
1
)
then
!use a power law to compute <D>
coeff
=
1
/((
1
/(
1
-
gam
))
*
(
Dmax
(
i
)
**
(
1
-
gam
)
-
Dmin
**
(
1
-
gam
)))
Dave
(
i
)
=
coeff
*
(
1
/(
2
-
gam
))
*
(
Dmax
(
i
)
**
(
2
-
gam
)
-
Dmin
**
(
2
-
gam
))
else
!use the method from Dumont et al.(2011) to compute <D>
M
=
floor
(
log
(
Dmax
(
i
)/
Dmin
)/
log
(
psi
))
allocate
(
ND
(
M
+1
))
...
...
@@ -40,6 +61,6 @@ use parameters
!_________________________________________________________________________________
end
subroutine
fsd_build
src/initialization.f90
View file @
4e5b4414
...
...
@@ -23,6 +23,22 @@
!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
...
...
@@ -54,7 +70,7 @@
!_______________________________________________________________________
!_______________________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
...
...
@@ -81,6 +97,17 @@ h(1:X1)=0d0
end
if
!_____________________FSD_____________________________________________
res
=
abs
(
minfloe
-
maxfloe
)/
nedge
floe_cat
(
1
)
=
maxfloe
do
i
=
2
,
nedge
floe_cat
(
i
)
=
floe_cat
(
1
)
-
i
*
res
end
do
do
i
=
1
,
nedge
-1
middle_floe_cat
(
i
)
=
(
floe_cat
(
i
)
+
floe_cat
(
i
+1
))
*
0.5
end
do
FSD
(
1
,
1
:
nbin
,
1
)
=
1d0
...
...
src/main.f90
View file @
4e5b4414
...
...
@@ -19,18 +19,6 @@
call
initialization
! initialize the model
!________________________________________________________________________________
spectrum
=
trim
(
root
)//
'Energy_spectrum.dat'
floe_size
=
trim
(
root
)//
'floe_size.dat'
namefile
=
trim
(
root
)//
trim
(
name_sim
)//
'.nc'
open
(
10
,
file
=
spectrum
)
open
(
11
,
file
=
floe_size
)
!________________________________________________________________________________
! DO THE TIME LOOP
...
...
@@ -46,18 +34,17 @@
do
i
=
1
,
nbin
!spatial calculations
call
attenuation
! compute spectrum attenuation
call
break_horvat
! compute floe breaking
!
call floe_breaking
!
call fsd_build
! compute floe breaking
call
floe_breaking
call
fsd_build
end
do
end
do
!______________________OUTPUTS_________________________________________________
namefile
=
trim
(
root
)//
trim
(
name_sim
)//
'.nc'
call
write_output
! Write outputs in NETCDF
!call graph_dislin
close
(
10
)
close
(
11
)
contains
...
...
src/makefile
View file @
4e5b4414
...
...
@@ -5,7 +5,7 @@ OPTION= -O3
NETCDFinc
=
-I
/usr/include
NETCDFLIB
=
-L
/usr/lib64
-lnetcdff
NETCDFMOD
=
-I
/usr/lib64/gfortran/modules
DISLIN
=
-I
/usr/local/dislin/gf
-ldislin
OBJ
=
*
.o
SRC
=
*
.f90
...
...
@@ -17,7 +17,7 @@ EXEC= WIM2
WIM2
:
$(OBJ)
$(COMPILER)
$(OPTION)
$(NETCDFinc)
$(NETCDFMOD)
-o
$(EXEC)
$(OBJ)
$(NETCDFLIB)
$(DISLIN)
$(COMPILER)
$(OPTION)
$(NETCDFinc)
$(NETCDFMOD)
-o
$(EXEC)
$(OBJ)
$(NETCDFLIB)
mv
WIM2 ../
...
...
src/parameters.f90
View file @
4e5b4414
module
parameters
implicit
none
!__________________name of files__________________
character
(
len
=
100
)
::
root
=
'output/'
,
spectrum
,
floe_size
,
name_sim
=
'test'
character
(
len
=
100
)
::
namefile
!______________dummys_____________________________
integer
::
i
,
ii
,
n
,
j
,
jj
!______________global parameters__________________
double precision
::
g
=
9.81
,
pi
=
3.1416
!____________Spectrum_____________________________
double precision
,
allocatable
::
E
(:,:,:),
Ei
(:),
T
(:)
double precision
,
allocatable
::
omega
(:),
freq
(:),
sigma_s
(:)
integer
::
nbin
=
10
,
nfreq
=
60
double precision
::
alpha_s
=
8.1e-3
,
beta_s
=
1.25
double precision
::
Tmin
=
2.5
,
Tmax
=
20
,
Tm
=
6
,
Hs
=
1
double precision
::
gamma_s
=
3.3
,
freq_s
,
domega
double precision
,
allocatable
::
x_axis
(:),
time
(:)
integer
::
init_spec
=
1
!____________waves_________________________________
double precision
,
allocatable
::
wl
(:),
Cp
(:),
Cg
(:),
CN
(:)
integer
::
disp
=
0
double precision
::
dwl
!____________grid parameters________________________
double precision
::
dt
,
dx
=
500
integer
::
nsteps
double precision
::
Cfl
=
1
!_____________ICE_____________________________________
double precision
,
allocatable
::
alpha
(:,:)
double precision
,
allocatable
::
h
(:)
double precision
,
allocatable
::
C_ice
(:)
double precision
,
allocatable
::
S_ice
(:,:)
double precision
::
cice
=
1
double precision
::
hice
=
1
double precision
,
allocatable
::
Dave
(:)
double precision
,
allocatable
::
Dmax
(:)
double precision
::
D0
=
200
double precision
::
gam
=
2
double precision
::
Dmin
=
20
double precision
::
psi
=
2
double precision
::
ff
=
0.5
double precision
::
Xh
=
60000
double precision
::
X_ice
=
50000
integer
::
ice_thick
=
1
double precision
::
hmax
=
4
!_________________FSD______________________________
double precision
::
minfloe
double precision
::
maxfloe
double precision
::
res
integer
::
nbcat
integer
::
nedge
!_________________________________________________________________________________________
!DESCRIPTION: In this routine, the shared parameters for
!other subroutines are declared. It also contains the
!subroutine read_namelist which read parameters value
!from the namelist and the subroutine array_allocation
!for memory allocation.
!________________________________________________________________________________________
!INTERFACE:
module
parameters
implicit
none
!NAME OF OUTPUTS FILES
character
(
len
=
100
)
::
root
=
'output/'
!output directory
character
(
len
=
100
)
::
name_sim
=
'test'
!name of the simulation
character
(
len
=
100
)
::
namefile
!DUMMIES
integer
::
i
,
ii
,
n
,
j
,
jj
!GLOBAL PARAMETERS
double precision
::
g
=
9.81
!gravitationnal acceleration
double precision
::
pi
=
3.1416
! Pi
!SPECTRUM
double precision
,
allocatable
::
E
(:,:,:)
!Energy spectrum
double precision
,
allocatable
::
Ei
(:)
!Initial spec