FMS  2025.04
Flexible Modeling System
register_domain_restart_variable.inc
1 !***********************************************************************
2 !* Apache License 2.0
3 !*
4 !* This file is part of the GFDL Flexible Modeling System (FMS).
5 !*
6 !* Licensed under the Apache License, Version 2.0 (the "License");
7 !* you may not use this file except in compliance with the License.
8 !* You may obtain a copy of the License at
9 !*
10 !* http://www.apache.org/licenses/LICENSE-2.0
11 !*
12 !* FMS is distributed in the hope that it will be useful, but WITHOUT
13 !* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied;
14 !* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
15 !* PARTICULAR PURPOSE. See the License for the specific language
16 !* governing permissions and limitations under the License.
17 !***********************************************************************
18 !> @file
19 !> @brief Adds domain decomposed variable for restarts for the @ref register_restart_field
20 !! interface
21 
22 !> @addtogroup fms2_io_mod
23 !> @{
24 
25 !> @brief Add a domain decomposed variable.
26 subroutine register_domain_restart_variable_0d(fileobj, variable_name, vdata, &
27  dimensions, is_optional, &
28  chunksizes)
29 
30  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
31  character(len=*), intent(in) :: variable_name !< Variable name.
32  class(*), intent(in), target :: vdata !< Variable data.
33  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
34  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
35  !! if a variable does not exist.
36  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
37  !! This feature is only
38  !! available for netcdf4 files
39 
40  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
41  chunksizes=chunksizes)
43 
44 
45 !> @brief Add a domain decomposed variable.
46 subroutine register_domain_restart_variable_1d(fileobj, variable_name, vdata, &
47  dimensions, is_optional, &
48  chunksizes)
49 
50  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
51  character(len=*), intent(in) :: variable_name !< Variable name.
52  class(*), dimension(:), intent(in), target :: vdata !< Variable data.
53  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
54  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
55  !! if a variable does not exist.
56  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
57  !! This feature is only
58  !! available for netcdf4 files
59 
60  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
61  chunksizes=chunksizes)
62  if (.not. fileobj%is_readonly) then
63  call add_domain_attribute(fileobj, variable_name)
64  endif
66 
67 
68 !> @brief Add a domain decomposed variable.
69 subroutine register_domain_restart_variable_2d(fileobj, variable_name, vdata, &
70  dimensions, is_optional, &
71  chunksizes)
72 
73  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
74  character(len=*), intent(in) :: variable_name !< Variable name.
75  class(*), dimension(:,:), intent(in), target :: vdata !< Variable data.
76  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
77  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
78  !! if a variable does not exist.
79  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
80  !! This feature is only
81  !! available for netcdf4 files
82 
83  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
84  chunksizes=chunksizes)
86 
87 
88 !> @brief Add a domain decomposed variable.
89 subroutine register_domain_restart_variable_3d(fileobj, variable_name, vdata, &
90  dimensions, is_optional, &
91  chunksizes)
92 
93  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
94  character(len=*), intent(in) :: variable_name !< Variable name.
95  class(*), dimension(:,:,:), intent(in), target :: vdata !< Variable data.
96  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
97  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
98  !! if a variable does not exist.
99  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
100  !! This feature is only
101  !! available for netcdf4 files
102 
103  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
104  chunksizes=chunksizes)
106 
107 
108 !> @brief Add a domain decomposed variable.
109 subroutine register_domain_restart_variable_4d(fileobj, variable_name, vdata, &
110  dimensions, is_optional, &
111  chunksizes)
112 
113  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
114  character(len=*), intent(in) :: variable_name !< Variable name.
115  class(*), dimension(:,:,:,:), intent(in), target :: vdata !< Variable data.
116  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
117  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
118  !! if a variable does not exist.
119  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
120  !! This feature is only
121  !! available for netcdf4 files
122 
123  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
124  chunksizes=chunksizes)
126 
127 
128 !> @brief Add a domain decomposed variable.
129 subroutine register_domain_restart_variable_5d(fileobj, variable_name, vdata, &
130  dimensions, is_optional, &
131  chunksizes)
132 
133  type(fmsnetcdfdomainfile_t), intent(inout) :: fileobj !< File object.
134  character(len=*), intent(in) :: variable_name !< Variable name.
135  class(*), dimension(:,:,:,:,:), intent(in), target :: vdata !< Variable data.
136  character(len=*), dimension(:), intent(in), optional :: dimensions !< Dimension names.
137  logical, intent(in), optional :: is_optional !< Prevent errors in read-only files
138  !! if a variable does not exist.
139  integer, intent(in), optional :: chunksizes(:) !< netcdf chunksize to use for this variable
140  !! This feature is only
141  !! available for netcdf4 files
142 
143  call netcdf_add_restart_variable(fileobj, variable_name, vdata, dimensions, is_optional, &
144  chunksizes=chunksizes)
146 !> @}
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.