SICOPOLIS V3.3
sico_end_m.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Module : s i c o _ e n d _ m
4 !
5 !> @file
6 !!
7 !! Ending of SICOPOLIS.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2017 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> Ending of SICOPOLIS.
34 !<------------------------------------------------------------------------------
35 module sico_end_m
36 
37  use sico_types_m
39  use sico_vars_m
40 
41  implicit none
42 
43  public
44 
45 contains
46 
47 !-------------------------------------------------------------------------------
48 !> Main routine of sico_end_m: Ending of SICOPOLIS.
49 !<------------------------------------------------------------------------------
50  subroutine sico_end()
51 
52 #if (NETCDF>1)
53  use netcdf
54  use nc_check_m
55 #endif
56 
57  implicit none
58 
59  integer(i4b) :: ierr
60 
61  character(len=64), parameter :: thisroutine = 'sico_end'
62 
63  write(unit=6, fmt='(/a/)') ' -------- sico_end --------'
64 
65  close(unit=12, status='keep') ! Close time-series files
66  close(unit=14, status='keep')
67  if (n_core >= 1) deallocate(lambda_core, phi_core, x_core, y_core, ch_core)
68 
69 #if (defined(ASF) && WRITE_SER_FILE_STAKES>0)
70  close(unit=41, status='keep')
71  close(unit=42, status='keep')
72  close(unit=43, status='keep')
73  close(unit=44, status='keep')
74  close(unit=45, status='keep')
75  close(unit=46, status='keep')
76  close(unit=47, status='keep')
77  close(unit=48, status='keep')
78  close(unit=49, status='keep')
79  close(unit=50, status='keep')
80  deallocate(lambda_surf, phi_surf, x_surf, y_surf)
81 #endif
82 
83 #if (defined(XYZ))
84 #if (defined(HEINO))
85  close(unit=15, status='keep')
86 #endif
87 #endif
88 
89 #if (NETCDF>1)
90  call check( nf90_sync(ncid_ser), thisroutine )
91  call check( nf90_close(ncid_ser), thisroutine )
92  ! Closing of NetCDF time-series output file
93  if (n_core >= 1) then
94  call check( nf90_sync(ncid_core), thisroutine )
95  call check( nf90_close(ncid_core), thisroutine )
96  end if
97  ! Closing of NetCDF time-series output file for the deep ice cores
98 #endif
99 
100 #if ((TSURFACE==6) && (ACCSURFACE==6))
101  call check( nf90_close(ncid_temp_precip), thisroutine )
102  ! Closing of NetCDF file containing surface-temperature
103  ! and precipitation data as functions of time
104 #endif
105 
106 #if (CALCTHK==3 || CALCTHK==6 || MARGIN==3 || DYNAMICS==2)
107  call lis_finalize(ierr) ! Finalise execution environment of the
108  ! Library of Iterative Solvers Lis, if required
109 #endif
110 
111  write(unit=6, fmt='(/a/)') ' * * * sicopolis.F90 r e a d y * * *'
112 
113  end subroutine sico_end
114 
115 !-------------------------------------------------------------------------------
116 
117 end module sico_end_m
118 !
real(dp), dimension(:), allocatable phi_core
phi_core(n): Geographical latitude of the prescribed borehole positions
integer(i4b) ncid_ser
ncid_ser: ID of the NetCDF time-series output file
real(dp), dimension(:), allocatable y_surf
y_surf(n): Coordinate eta (= y) of the prescribed surface points
Definition: sico_vars_m.F90:51
subroutine sico_end()
Main routine of sico_end_m: Ending of SICOPOLIS.
Definition: sico_end_m.F90:51
Declarations of global variables for SICOPOLIS (for the ANT domain).
Definition: sico_vars_m.F90:35
Declarations of kind types for SICOPOLIS.
real(dp), dimension(:), allocatable phi_surf
phi_surf(n): Geographical latitude of the prescribed surface points
Definition: sico_vars_m.F90:47
integer(i4b) ncid_core
ncid_core: ID of the NetCDF time-series output file for the deep ice cores
real(dp), dimension(:), allocatable y_core
y_core(n): Coordinate eta (= y) of the prescribed borehole positions
real(dp), dimension(:), allocatable x_surf
x_surf(n): Coordinate xi (= x) of the prescribed surface points
Definition: sico_vars_m.F90:49
NetCDF error capturing.
Definition: nc_check_m.F90:35
subroutine check(status, ch_calling_routine)
NetCDF error capturing.
Definition: nc_check_m.F90:46
integer(i4b) ncid_temp_precip
ncid_temp_precip: ID of the NetCDF file containing the surface-temperature and precipitation data as ...
character(len=16), dimension(:), allocatable ch_core
ch_core(n): Names of the prescribed borehole positions
real(dp), dimension(:), allocatable x_core
x_core(n): Coordinate xi (= x) of the prescribed borehole positions
Ending of SICOPOLIS.
Definition: sico_end_m.F90:35
real(dp), dimension(:), allocatable lambda_core
lambda_core(n): Geographical longitude of the prescribed borehole positions
integer(i4b) n_core
n_core: Number of positions to be considered in the time-series file for deep boreholes ...
Declarations of global variables for SICOPOLIS.
real(dp), dimension(:), allocatable lambda_surf
lambda_surf(n): Geographical longitude of the prescribed surface points
Definition: sico_vars_m.F90:45