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
flexpart
flexpart-noresm
Commits
a0a53511
Commit
a0a53511
authored
Jun 30, 2021
by
Espen Sollum
Browse files
Mostly finished migrating to netcdf4.
parent
d8921abf
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
src/FLEXPART.f90
View file @
a0a53511
...
...
@@ -60,6 +60,7 @@ program flexpart_NorESM
integer
::
i
,
j
,
ix
,
jy
,
inest
integer
::
idummy
=
-320
character
(
len
=
256
)
::
inline_options
!pathfile, flexversion, arg2
! Generate a large number of random numbers
!******************************************
...
...
@@ -69,6 +70,29 @@ program flexpart_NorESM
end
do
call
gasdev1
(
idummy
,
rannumb
(
maxrand
),
rannumb
(
maxrand
-1
))
! Read the pathnames where input/output files are stored
!*******************************************************
inline_options
=
'none'
select
case
(
iargc
())
case
(
2
)
call
getarg
(
1
,
arg1
)
pathfile
=
arg1
call
getarg
(
2
,
arg2
)
inline_options
=
arg2
case
(
1
)
call
getarg
(
1
,
arg1
)
pathfile
=
arg1
if
(
arg1
(
1
:
1
)
.eq.
'-'
)
then
write
(
pathfile
,
'(a11)'
)
'./pathnames'
inline_options
=
arg1
endif
case
(
0
)
write
(
pathfile
,
'(a11)'
)
'./pathnames'
end
select
write
(
*
,
*
)
'Pathnames: '
,
pathfile
! Print the GPL License statement
!*******************************************************
print
*
,
'Welcome to FLEXPART-NorESM Version 1.0'
...
...
src/allocatedumarray.f90
View file @
a0a53511
!**********************************************************************
! Copyright 2016 *
! Andreas Stohl, Massimo Cassiani, Petra Seibert, A. Frank, *
! Gerhard Wotawa, Caroline Forster, Sabine Eckhardt, John Burkhart, *
! Harald Sodemann *
! *
! This file is part of FLEXPART-NorESM *
! *
! FLEXPART-NorESM is free software: you can redistribute it *
! and/or modify *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or *
! (at your option) any later version. *
! *
! FLEXPART-NorESM is distributed in the hope that it will be useful, *
! but WITHOUT ANY WARRANTY; without even the implied warranty of *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! GNU General Public License for more details. *
! *
! You should have received a copy of the GNU General Public License *
! along with FLEXPART-NorESM. *
! If not, see <http://www.gnu.org/licenses/>. *
!**********************************************************************
subroutine
allocatedumarray
(
ndims
,
lendim_exp
,
maxdim
,
vartype
)
!*****************************************************************************
! *
! This routine allocate temporary variables for reading netcdf input *
! files from NorESM *
! *
! Author: *
! M. Cassiani 2016 *
! *
! *
!*****************************************************************************
! *
! Variables: *
! vartype type of variable *
! ndims number of dimensions 0,1,2,3 *
! lendim_exp expeceted elemnts in the dimension *
! vartype *
! Constants: *
! *
!*****************************************************************************
use
noresm_variables
implicit
none
include
'netcdf.inc'
integer
ndims
,
lendim_exp
(
maxdim
),
maxdim
,
vartype
if
(
vartype
.eq.
nf_double
)
then
if
(
ndims
.eq.
0
)
then
dumvar
=
dble
(
0.0
)
else
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
3
)
then
call
allocatedumarray3D
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
4
)
then
call
allocatedumarray4D
(
ndims
,
lendim_exp
,
maxdim
)
end
if
else
if
(
vartype
.eq.
nf_float
)
then
if
(
ndims
.eq.
0
)
then
dumvar_real
=
0.0
else
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D_real
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D_real
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
3
)
then
call
allocatedumarray3D_real
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
4
)
then
call
allocatedumarray4D_real
(
ndims
,
lendim_exp
,
maxdim
)
end
if
else
if
(
vartype
.eq.
nf_int
)
then
if
(
ndims
.eq.
0
)
then
dumvar_int
=
0.0
else
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D_int
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D_int
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
3
)
then
call
allocatedumarray3D_int
(
ndims
,
lendim_exp
,
maxdim
)
!else if (ndims.eq.4) then
! call allocatedumarray4D_int(ndims,lendim_exp,maxdim)
end
if
else
if
(
vartype
.eq.
nf_char
)
then
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D_char
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D_char
(
ndims
,
lendim_exp
,
maxdim
)
end
if
end
if
return
end
!**********************************************************************
! Copyright 2016 *
! Andreas Stohl, Massimo Cassiani, Petra Seibert, A. Frank, *
! Gerhard Wotawa, Caroline Forster, Sabine Eckhardt, John Burkhart, *
! Harald Sodemann *
! *
! This file is part of FLEXPART-NorESM *
! *
! FLEXPART-NorESM is free software: you can redistribute it *
! and/or modify *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or *
! (at your option) any later version. *
! *
! FLEXPART-NorESM is distributed in the hope that it will be useful, *
! but WITHOUT ANY WARRANTY; without even the implied warranty of *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! GNU General Public License for more details. *
! *
! You should have received a copy of the GNU General Public License *
! along with FLEXPART-NorESM. *
! If not, see <http://www.gnu.org/licenses/>. *
!**********************************************************************
subroutine
allocatedumarray
(
ndims
,
lendim_exp
,
maxdim
,
vartype
)
!*****************************************************************************
! *
! This routine allocate temporary variables for reading netcdf input *
! files from NorESM *
! *
! Author: *
! M. Cassiani 2016 *
! *
! *
!*****************************************************************************
! *
! Variables: *
! vartype type of variable *
! ndims number of dimensions 0,1,2,3 *
! lendim_exp expeceted elemnts in the dimension *
! vartype *
! Constants: *
! *
!*****************************************************************************
use
netcdf
use
noresm_variables
implicit
none
! include 'netcdf.inc'
integer
ndims
,
lendim_exp
(
maxdim
),
maxdim
,
vartype
if
(
vartype
.eq.
nf90_double
)
then
if
(
ndims
.eq.
0
)
then
dumvar
=
dble
(
0.0
)
else
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
3
)
then
call
allocatedumarray3D
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
4
)
then
call
allocatedumarray4D
(
ndims
,
lendim_exp
,
maxdim
)
end
if
else
if
(
vartype
.eq.
nf90_float
)
then
if
(
ndims
.eq.
0
)
then
dumvar_real
=
0.0
else
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D_real
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D_real
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
3
)
then
call
allocatedumarray3D_real
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
4
)
then
call
allocatedumarray4D_real
(
ndims
,
lendim_exp
,
maxdim
)
end
if
else
if
(
vartype
.eq.
nf90_int
)
then
if
(
ndims
.eq.
0
)
then
dumvar_int
=
0.0
else
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D_int
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D_int
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
3
)
then
call
allocatedumarray3D_int
(
ndims
,
lendim_exp
,
maxdim
)
!else if (ndims.eq.4) then
! call allocatedumarray4D_int(ndims,lendim_exp,maxdim)
end
if
else
if
(
vartype
.eq.
nf90_char
)
then
if
(
ndims
.eq.
1
)
then
call
allocatedumarray1D_char
(
ndims
,
lendim_exp
,
maxdim
)
else
if
(
ndims
.eq.
2
)
then
call
allocatedumarray2D_char
(
ndims
,
lendim_exp
,
maxdim
)
end
if
end
if
return
end
subroutine
allocatedumarray
src/allocatedumarray_parts.f90
View file @
a0a53511
!**********************************************************************
! Copyright 2016 *
! Andreas Stohl, Massimo Cassiani, Petra Seibert, A. Frank, *
! Gerhard Wotawa, Caroline Forster, Sabine Eckhardt, John Burkhart, *
! Harald Sodemann *
! *
! This file is part of FLEXPART-NorESM *
! *
! FLEXPART-NorESM is free software: you can redistribute it *
! and/or modify *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or *
! (at your option) any later version. *
! *
! FLEXPART-NorESM is distributed in the hope that it will be useful, *
! but WITHOUT ANY WARRANTY; without even the implied warranty of *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! GNU General Public License for more details. *
! *
! You should have received a copy of the GNU General Public License *
! along with FLEXPART-NorESM. *
! If not, see <http://www.gnu.org/licenses/>. *
!**********************************************************************
!*****************************************************************************
! *
! These routines allocates temporary variables for reading netcdf input *
! files from NorESM *
! *
! Author: *
! M. Cassiani 2016 *
! *
! *
!*****************************************************************************
! *
! Variables: *
! vartype type of variable *
! ndims number of dimensions 0,1,2,3 *
! lendim_exp expeceted elemnts in the dimension *
! *
! Constants: *
! *
!*****************************************************************************
subroutine
allocatedumarray1D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray1D
))
deallocate
(
dumarray1D
)
allocate
(
dumarray1D
(
lendim_exp
(
1
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray2D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray2D
))
deallocate
(
dumarray2D
)
allocate
(
dumarray2D
(
lendim_exp
(
1
),
lendim_exp
(
2
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray3D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray3D
))
deallocate
(
dumarray3D
)
allocate
(
dumarray3D
(
lendim_exp
(
1
),
lendim_exp
(
2
),
lendim_exp
(
3
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray4D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray4D
))
deallocate
(
dumarray4D
)
allocate
(
dumarray4D
(
lendim_exp
(
1
),
lendim_exp
(
2
),
lendim_exp
(
3
),
lendim_exp
(
4
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray1D_real
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray1D_real
))
deallocate
(
dumarray1D_real
)
allocate
(
dumarray1D_real
(
lendim_exp
(
1
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray2D_real
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray2D_real
))
deallocate
(
dumarray2D_real
)
allocate
(
dumarray2D_real
(
lendim_exp
(
1
),
lendim_exp
(
2
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray3D_real
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray3D_real
))
deallocate
(
dumarray3D_real
)
allocate
(
dumarray3D_real
(
lendim_exp
(
1
),
lendim_exp
(
2
),
lendim_exp
(
3
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray4D_real
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray4D_real
))
deallocate
(
dumarray4D_real
)
allocate
(
dumarray4D_real
(
lendim_exp
(
1
),
lendim_exp
(
2
),
lendim_exp
(
3
),
lendim_exp
(
4
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray1D_int
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray1D_int
))
deallocate
(
dumarray1D_int
)
allocate
(
dumarray1D_int
(
lendim_exp
(
1
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray2D_int
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray2D_int
))
deallocate
(
dumarray2D_int
)
allocate
(
dumarray2D_int
(
lendim_exp
(
1
),
lendim_exp
(
2
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray3D_int
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray3D_int
))
deallocate
(
dumarray3D_int
)
allocate
(
dumarray3D_int
(
lendim_exp
(
1
),
lendim_exp
(
2
),
lendim_exp
(
3
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray1D_char
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray1D_char
))
deallocate
(
dumarray1D_char
)
allocate
(
dumarray1D_char
(
lendim_exp
(
1
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray2D_char
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray2D_char
))
deallocate
(
dumarray2D_char
)
allocate
(
dumarray2D_char
(
lendim_exp
(
1
),
lendim_exp
(
2
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
!**********************************************************************
! Copyright 2016 *
! Andreas Stohl, Massimo Cassiani, Petra Seibert, A. Frank, *
! Gerhard Wotawa, Caroline Forster, Sabine Eckhardt, John Burkhart, *
! Harald Sodemann *
! *
! This file is part of FLEXPART-NorESM *
! *
! FLEXPART-NorESM is free software: you can redistribute it *
! and/or modify *
! it under the terms of the GNU General Public License as published by*
! the Free Software Foundation, either version 3 of the License, or *
! (at your option) any later version. *
! *
! FLEXPART-NorESM is distributed in the hope that it will be useful, *
! but WITHOUT ANY WARRANTY; without even the implied warranty of *
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
! GNU General Public License for more details. *
! *
! You should have received a copy of the GNU General Public License *
! along with FLEXPART-NorESM. *
! If not, see <http://www.gnu.org/licenses/>. *
!**********************************************************************
!*****************************************************************************
! *
! These routines allocates temporary variables for reading netcdf input *
! files from NorESM *
! *
! Author: *
! M. Cassiani 2016 *
! *
! *
!*****************************************************************************
! *
! Variables: *
! vartype type of variable *
! ndims number of dimensions 0,1,2,3 *
! lendim_exp expeceted elemnts in the dimension *
! *
! Constants: *
! *
!*****************************************************************************
subroutine
allocatedumarray1D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray1D
))
deallocate
(
dumarray1D
)
!
allocate
(
dumarray1D
(
lendim_exp
(
1
)))
! allocate(dumarray1D(0:lendim_exp(1)-1))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray2D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray2D
))
deallocate
(
dumarray2D
)
allocate
(
dumarray2D
(
lendim_exp
(
1
),
lendim_exp
(
2
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray3D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)
if
(
allocated
(
dumarray3D
))
deallocate
(
dumarray3D
)
allocate
(
dumarray3D
(
lendim_exp
(
1
),
lendim_exp
(
2
),
lendim_exp
(
3
)))
if
(
allocated
(
istart
))
deallocate
(
istart
)
allocate
(
istart
(
ndims
))
if
(
allocated
(
icount
))
deallocate
(
icount
)
allocate
(
icount
(
ndims
))
return
end
subroutine
allocatedumarray4D
(
ndims
,
lendim_exp
,
maxdim
)
use
noresm_variables
integer
maxdim
integer
ndims
,
lendim_exp
(
maxdim
)