FMS  2024.03
Flexible Modeling System
register_domain_restart_variable.inc
1 !***********************************************************************
2 !* GNU Lesser General Public License
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* FMS is free software: you can redistribute it and/or modify it under
7 !* the terms of the GNU Lesser General Public License as published by
8 !* the Free Software Foundation, either version 3 of the License, or (at
9 !* your option) any later version.
10 !*
11 !* FMS is distributed in the hope that it will be useful, but WITHOUT
12 !* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 !* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 !* for more details.
15 !*
16 !* You should have received a copy of the GNU Lesser General Public
17 !* License along with FMS. If not, see <http://www.gnu.org/licenses/>.
18 !***********************************************************************
19 !> @file
20 !> @brief Adds domain decomposed variable for restarts for the @ref register_restart_field
21 !! interface
22 
23 !> @addtogroup fms2_io_mod
24 !> @{
25 
26 !> @brief Add a domain decomposed variable.
27 subroutine register_domain_restart_variable_0d(fileobj, variable_name, vdata, &
28  dimensions, is_optional, &
29  chunksizes)
30 
31  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
32  character(len=*), intent(in) :: variable_name !< Variable name.
33  class(*), intent(in), target :: vdata !< Variable data.
34  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
35  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
36  !! if a variable does not exist.
37  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
38  !! This feature is only
39  !! available for netcdf4 files
40 
41  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
42  chunksizes=chunksizes)
44 
45 
46 !> @brief Add a domain decomposed variable.
47 subroutine register_domain_restart_variable_1d(fileobj, variable_name, vdata, &
48  dimensions, is_optional, &
49  chunksizes)
50 
51  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
52  character(len=*), intent(in) :: variable_name !< Variable name.
53  class(*), dimension(:), intent(in), target :: vdata !< Variable data.
54  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
55  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
56  !! if a variable does not exist.
57  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
58  !! This feature is only
59  !! available for netcdf4 files
60 
61  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
62  chunksizes=chunksizes)
63  if (.not. fileobj%is_readonly) then
64  call add_domain_attribute(fileobj, variable_name)
65  endif
67 
68 
69 !> @brief Add a domain decomposed variable.
70 subroutine register_domain_restart_variable_2d(fileobj, variable_name, vdata, &
71  dimensions, is_optional, &
72  chunksizes)
73 
74  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
75  character(len=*), intent(in) :: variable_name !< Variable name.
76  class(*), dimension(:,:), intent(in), target :: vdata !< Variable data.
77  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
78  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
79  !! if a variable does not exist.
80  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
81  !! This feature is only
82  !! available for netcdf4 files
83 
84  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
85  chunksizes=chunksizes)
87 
88 
89 !> @brief Add a domain decomposed variable.
90 subroutine register_domain_restart_variable_3d(fileobj, variable_name, vdata, &
91  dimensions, is_optional, &
92  chunksizes)
93 
94  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
95  character(len=*), intent(in) :: variable_name !< Variable name.
96  class(*), dimension(:,:,:), intent(in), target :: vdata !< Variable data.
97  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
98  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
99  !! if a variable does not exist.
100  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
101  !! This feature is only
102  !! available for netcdf4 files
103 
104  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
105  chunksizes=chunksizes)
107 
108 
109 !> @brief Add a domain decomposed variable.
110 subroutine register_domain_restart_variable_4d(fileobj, variable_name, vdata, &
111  dimensions, is_optional, &
112  chunksizes)
113 
114  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
115  character(len=*), intent(in) :: variable_name !< Variable name.
116  class(*), dimension(:,:,:,:), intent(in), target :: vdata !< Variable data.
117  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
118  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
119  !! if a variable does not exist.
120  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
121  !! This feature is only
122  !! available for netcdf4 files
123 
124  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
125  chunksizes=chunksizes)
127 
128 
129 !> @brief Add a domain decomposed variable.
130 subroutine register_domain_restart_variable_5d(fileobj, variable_name, vdata, &
131  dimensions, is_optional, &
132  chunksizes)
133 
134  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
135  character(len=*), intent(in) :: variable_name !< Variable name.
136  class(*), dimension(:,:,:,:,:), intent(in), target :: vdata !< Variable data.
137  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
138  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
139  !! if a variable does not exist.
140  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
141  !! This feature is only
142  !! available for netcdf4 files
143 
144  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
145  chunksizes=chunksizes)
147 !> @}
subroutine register_domain_restart_variable_3d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine register_domain_restart_variable_1d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine register_domain_restart_variable_5d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine register_domain_restart_variable_4d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine register_domain_restart_variable_0d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.
subroutine register_domain_restart_variable_2d(fileobj, variable_name, vdata, dimensions, is_optional, chunksizes)
Add a domain decomposed variable.