| [2932] | 1 | MODULE write_output_mod |
|---|
| [3092] | 2 | |
|---|
| [3160] | 3 | implicit none |
|---|
| [3092] | 4 | |
|---|
| [3160] | 5 | private |
|---|
| [2970] | 6 | |
|---|
| [3092] | 7 | INTERFACE write_output |
|---|
| 8 | MODULE PROCEDURE write_output_d0, write_output_d1, write_output_d2, & |
|---|
| 9 | write_output_i0, write_output_i1, write_output_i2, & |
|---|
| 10 | write_output_l0, write_output_l1, write_output_l2 |
|---|
| 11 | END INTERFACE write_output |
|---|
| [2932] | 12 | |
|---|
| [3160] | 13 | public write_output |
|---|
| [3092] | 14 | |
|---|
| [3160] | 15 | !----------------------------------------------------------------------- |
|---|
| 16 | contains |
|---|
| 17 | !----------------------------------------------------------------------- |
|---|
| [2932] | 18 | |
|---|
| [3160] | 19 | SUBROUTINE write_output_d0(field_name,title,units,field) |
|---|
| [3161] | 20 | ! For a scalar |
|---|
| [3160] | 21 | |
|---|
| [2934] | 22 | #ifdef CPP_XIOS |
|---|
| [3160] | 23 | use xios_output_mod, only: xios_is_active_field |
|---|
| 24 | use xios_output_mod, only: send_xios_field |
|---|
| [2934] | 25 | #endif |
|---|
| [3092] | 26 | |
|---|
| [3160] | 27 | implicit none |
|---|
| 28 | |
|---|
| 29 | include "dimensions.h" |
|---|
| 30 | |
|---|
| 31 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 32 | character(*), intent(in) :: field_name |
|---|
| 33 | character(*), intent(in) :: title |
|---|
| 34 | character(*), intent(in) :: units |
|---|
| 35 | real, intent(in) :: field |
|---|
| 36 | |
|---|
| 37 | call writediagfi(ngrid,field_name,title,units,0,(/field/)) |
|---|
| [3092] | 38 | #ifdef CPP_XIOS |
|---|
| [3055] | 39 | ! only send the field to xios if the user asked for it |
|---|
| [3169] | 40 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,field) |
|---|
| [2932] | 41 | #endif |
|---|
| [3092] | 42 | |
|---|
| [3160] | 43 | END SUBROUTINE write_output_d0 |
|---|
| [2932] | 44 | |
|---|
| [3160] | 45 | !----------------------------------------------------------------------- |
|---|
| [3092] | 46 | |
|---|
| [3160] | 47 | SUBROUTINE write_output_d1(field_name,title,units,field) |
|---|
| 48 | ! For a surface field |
|---|
| 49 | |
|---|
| [2934] | 50 | #ifdef CPP_XIOS |
|---|
| [3161] | 51 | use xios_output_mod, only: xios_is_active_field |
|---|
| 52 | use xios_output_mod, only: send_xios_field |
|---|
| [2934] | 53 | #endif |
|---|
| [3092] | 54 | |
|---|
| [3160] | 55 | implicit none |
|---|
| 56 | |
|---|
| 57 | include "dimensions.h" |
|---|
| 58 | |
|---|
| 59 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 60 | character(*), intent(in) :: field_name |
|---|
| 61 | character(*), intent(in) :: title |
|---|
| 62 | character(*), intent(in) :: units |
|---|
| 63 | real, dimension(:), intent(in) :: field |
|---|
| 64 | |
|---|
| 65 | call writediagfi(ngrid,field_name,title,units,2,field) |
|---|
| [3092] | 66 | #ifdef CPP_XIOS |
|---|
| [3055] | 67 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 68 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,field) |
|---|
| [2932] | 69 | #endif |
|---|
| [3092] | 70 | |
|---|
| [3160] | 71 | END SUBROUTINE write_output_d1 |
|---|
| [2932] | 72 | |
|---|
| [3160] | 73 | !----------------------------------------------------------------------- |
|---|
| [3092] | 74 | |
|---|
| [3160] | 75 | SUBROUTINE write_output_d2(field_name,title,units,field) |
|---|
| 76 | ! For a "3D" horizontal-vertical field |
|---|
| 77 | |
|---|
| [2934] | 78 | #ifdef CPP_XIOS |
|---|
| [3160] | 79 | use xios_output_mod, only: xios_is_active_field |
|---|
| 80 | use xios_output_mod, only: send_xios_field |
|---|
| [2934] | 81 | #endif |
|---|
| [3161] | 82 | |
|---|
| [3160] | 83 | use comsoil_h, only: nsoilmx |
|---|
| 84 | use writediagsoil_mod, only: writediagsoil |
|---|
| [2932] | 85 | |
|---|
| [3160] | 86 | implicit none |
|---|
| 87 | |
|---|
| 88 | include "dimensions.h" |
|---|
| 89 | |
|---|
| 90 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 91 | character(*), intent(in) :: field_name |
|---|
| 92 | character(*), intent(in) :: title |
|---|
| 93 | character(*), intent(in) :: units |
|---|
| 94 | real, dimension(:,:), intent(in) :: field |
|---|
| 95 | |
|---|
| 96 | if (size(field,2) == nsoilmx) then |
|---|
| [2932] | 97 | call writediagsoil(ngrid,field_name,title,units,3,field) |
|---|
| [3160] | 98 | else |
|---|
| 99 | call writediagfi(ngrid,field_name,title,units,3,field) |
|---|
| 100 | endif |
|---|
| 101 | |
|---|
| [3092] | 102 | #ifdef CPP_XIOS |
|---|
| [3055] | 103 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 104 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,field) |
|---|
| [2932] | 105 | #endif |
|---|
| [3092] | 106 | |
|---|
| [3160] | 107 | END SUBROUTINE write_output_d2 |
|---|
| [2932] | 108 | |
|---|
| [3160] | 109 | !----------------------------------------------------------------------- |
|---|
| [3092] | 110 | |
|---|
| [3160] | 111 | SUBROUTINE write_output_i0(field_name,title,units,field) |
|---|
| [3161] | 112 | ! For a scalar |
|---|
| [3160] | 113 | |
|---|
| [2970] | 114 | #ifdef CPP_XIOS |
|---|
| [3160] | 115 | use xios_output_mod, only: xios_is_active_field |
|---|
| 116 | use xios_output_mod, only: send_xios_field |
|---|
| [2970] | 117 | #endif |
|---|
| [3092] | 118 | |
|---|
| [3160] | 119 | implicit none |
|---|
| 120 | |
|---|
| 121 | include "dimensions.h" |
|---|
| 122 | |
|---|
| 123 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 124 | character(*), intent(in) :: field_name |
|---|
| 125 | character(*), intent(in) :: title |
|---|
| 126 | character(*), intent(in) :: units |
|---|
| 127 | integer, intent(in) :: field |
|---|
| 128 | |
|---|
| 129 | call writediagfi(ngrid,field_name,title,units,0,(/real(field)/)) |
|---|
| [3092] | 130 | #ifdef CPP_XIOS |
|---|
| [3055] | 131 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 132 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,(/real(field)/)) |
|---|
| [2970] | 133 | #endif |
|---|
| [3092] | 134 | |
|---|
| [3160] | 135 | END SUBROUTINE write_output_i0 |
|---|
| [2970] | 136 | |
|---|
| [3160] | 137 | !----------------------------------------------------------------------- |
|---|
| [3092] | 138 | |
|---|
| [3160] | 139 | SUBROUTINE write_output_i1(field_name,title,units,field) |
|---|
| 140 | ! For a surface field |
|---|
| 141 | |
|---|
| [2970] | 142 | #ifdef CPP_XIOS |
|---|
| [3160] | 143 | use xios_output_mod, only: xios_is_active_field |
|---|
| 144 | use xios_output_mod, only: send_xios_field |
|---|
| [2970] | 145 | #endif |
|---|
| [3092] | 146 | |
|---|
| [3160] | 147 | implicit none |
|---|
| 148 | |
|---|
| 149 | include "dimensions.h" |
|---|
| 150 | |
|---|
| 151 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 152 | character(*), intent(in) :: field_name |
|---|
| 153 | character(*), intent(in) :: title |
|---|
| 154 | character(*), intent(in) :: units |
|---|
| 155 | integer, dimension(:), intent(in) :: field |
|---|
| 156 | |
|---|
| 157 | call writediagfi(ngrid,field_name,title,units,2,real(field)) |
|---|
| [3092] | 158 | #ifdef CPP_XIOS |
|---|
| [3055] | 159 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 160 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,real(field)) |
|---|
| [2970] | 161 | #endif |
|---|
| [3092] | 162 | |
|---|
| [3160] | 163 | END SUBROUTINE write_output_i1 |
|---|
| [2970] | 164 | |
|---|
| [3160] | 165 | !----------------------------------------------------------------------- |
|---|
| [3092] | 166 | |
|---|
| [3160] | 167 | SUBROUTINE write_output_i2(field_name,title,units,field) |
|---|
| 168 | ! For a "3D" horizontal-vertical field |
|---|
| 169 | |
|---|
| [2970] | 170 | #ifdef CPP_XIOS |
|---|
| [3160] | 171 | use xios_output_mod, only: xios_is_active_field |
|---|
| 172 | use xios_output_mod, only: send_xios_field |
|---|
| [2970] | 173 | #endif |
|---|
| 174 | |
|---|
| [3160] | 175 | use comsoil_h, only: nsoilmx |
|---|
| 176 | use writediagsoil_mod, only: writediagsoil |
|---|
| 177 | |
|---|
| 178 | implicit none |
|---|
| 179 | |
|---|
| 180 | include "dimensions.h" |
|---|
| 181 | |
|---|
| 182 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 183 | character(*), intent(in) :: field_name |
|---|
| 184 | character(*), intent(in) :: title |
|---|
| 185 | character(*), intent(in) :: units |
|---|
| 186 | integer, dimension(:,:), intent(in) :: field |
|---|
| 187 | |
|---|
| 188 | if (size(field,2) == nsoilmx) then |
|---|
| [2970] | 189 | call writediagsoil(ngrid,field_name,title,units,3,real(field)) |
|---|
| [3160] | 190 | else |
|---|
| 191 | call writediagfi(ngrid,field_name,title,units,3,real(field)) |
|---|
| 192 | endif |
|---|
| [3092] | 193 | #ifdef CPP_XIOS |
|---|
| [3055] | 194 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 195 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,real(field)) |
|---|
| [2970] | 196 | #endif |
|---|
| [3092] | 197 | |
|---|
| [3160] | 198 | END SUBROUTINE write_output_i2 |
|---|
| [2970] | 199 | |
|---|
| [3160] | 200 | !----------------------------------------------------------------------- |
|---|
| [3092] | 201 | |
|---|
| [3160] | 202 | SUBROUTINE write_output_l0(field_name,title,units,field) |
|---|
| [3161] | 203 | ! For a scalar |
|---|
| [3160] | 204 | |
|---|
| [2970] | 205 | #ifdef CPP_XIOS |
|---|
| [3160] | 206 | use xios_output_mod, only: xios_is_active_field |
|---|
| 207 | use xios_output_mod, only: send_xios_field |
|---|
| [2970] | 208 | #endif |
|---|
| 209 | |
|---|
| [3160] | 210 | implicit none |
|---|
| [3092] | 211 | |
|---|
| [3160] | 212 | include "dimensions.h" |
|---|
| 213 | |
|---|
| 214 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 215 | character(*), intent(in) :: field_name |
|---|
| 216 | character(*), intent(in) :: title |
|---|
| 217 | character(*), intent(in) :: units |
|---|
| 218 | logical, intent(in) :: field |
|---|
| 219 | ! Local argument used to convert logical to real array |
|---|
| 220 | real, dimension(1) :: field_real |
|---|
| 221 | |
|---|
| 222 | field_real = 0. |
|---|
| 223 | if (field) field_real = 1. |
|---|
| 224 | |
|---|
| 225 | call writediagfi(ngrid,field_name,title,units,0,field_real) |
|---|
| [3092] | 226 | #ifdef CPP_XIOS |
|---|
| [3055] | 227 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 228 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,field_real) |
|---|
| [2970] | 229 | #endif |
|---|
| [3092] | 230 | |
|---|
| [3160] | 231 | END SUBROUTINE write_output_l0 |
|---|
| [2970] | 232 | |
|---|
| [3160] | 233 | !----------------------------------------------------------------------- |
|---|
| [3092] | 234 | |
|---|
| [3160] | 235 | SUBROUTINE write_output_l1(field_name,title,units,field) |
|---|
| 236 | ! For a surface field |
|---|
| 237 | |
|---|
| [2970] | 238 | #ifdef CPP_XIOS |
|---|
| [3160] | 239 | use xios_output_mod, only: xios_is_active_field |
|---|
| 240 | use xios_output_mod, only: send_xios_field |
|---|
| [2970] | 241 | #endif |
|---|
| [3160] | 242 | |
|---|
| 243 | implicit none |
|---|
| 244 | |
|---|
| 245 | include "dimensions.h" |
|---|
| 246 | |
|---|
| 247 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 248 | character(*), intent(in) :: field_name |
|---|
| 249 | character(*), intent(in) :: title |
|---|
| 250 | character(*), intent(in) :: units |
|---|
| 251 | logical, dimension(:), intent(in) :: field |
|---|
| [2970] | 252 | ! Local argument used to convert logical to real |
|---|
| [3160] | 253 | real, dimension(ngrid) :: field_real |
|---|
| [2970] | 254 | |
|---|
| [3160] | 255 | field_real = 0. |
|---|
| 256 | where (field) field_real = 1. |
|---|
| [3092] | 257 | |
|---|
| [3160] | 258 | call writediagfi(ngrid,field_name,title,units,2,field_real) |
|---|
| [3092] | 259 | #ifdef CPP_XIOS |
|---|
| [3055] | 260 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 261 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,field_real) |
|---|
| [2970] | 262 | #endif |
|---|
| [3092] | 263 | |
|---|
| [3160] | 264 | END SUBROUTINE write_output_l1 |
|---|
| [2970] | 265 | |
|---|
| [3160] | 266 | !----------------------------------------------------------------------- |
|---|
| [3092] | 267 | |
|---|
| [3160] | 268 | SUBROUTINE write_output_l2(field_name,title,units,field) |
|---|
| 269 | ! For a "3D" horizontal-vertical field |
|---|
| 270 | |
|---|
| [2970] | 271 | #ifdef CPP_XIOS |
|---|
| [3160] | 272 | use xios_output_mod, only: xios_is_active_field |
|---|
| 273 | use xios_output_mod, only: send_xios_field |
|---|
| [2970] | 274 | #endif |
|---|
| [3160] | 275 | |
|---|
| 276 | use comsoil_h, only: nsoilmx |
|---|
| 277 | use writediagsoil_mod, only: writediagsoil |
|---|
| 278 | |
|---|
| 279 | implicit none |
|---|
| 280 | |
|---|
| 281 | include "dimensions.h" |
|---|
| 282 | |
|---|
| 283 | integer, parameter :: ngrid = 2 + (jjm - 1)*iim - 1/jjm |
|---|
| 284 | character(*), intent(in) :: field_name |
|---|
| 285 | character(*), intent(in) :: title |
|---|
| 286 | character(*), intent(in) :: units |
|---|
| 287 | logical, dimension(:,:), intent(in) :: field |
|---|
| [2970] | 288 | ! Local argument used to convert logical to real |
|---|
| [3160] | 289 | real, allocatable, dimension(:,:) :: field_real |
|---|
| [2970] | 290 | |
|---|
| [3160] | 291 | allocate(field_real(size(field,1),size(field,2))) |
|---|
| 292 | field_real = 0. |
|---|
| 293 | where (field) field_real = 1. |
|---|
| [2970] | 294 | |
|---|
| [3160] | 295 | if (size(field,2) == nsoilmx) then |
|---|
| [2970] | 296 | call writediagsoil(ngrid,field_name,title,units,3,field_real) |
|---|
| [3160] | 297 | else |
|---|
| 298 | call writediagfi(ngrid,field_name,title,units,3,field_real) |
|---|
| 299 | endif |
|---|
| [2970] | 300 | |
|---|
| [3092] | 301 | #ifdef CPP_XIOS |
|---|
| [3055] | 302 | ! only send the field to xios if the user asked for it |
|---|
| [3160] | 303 | if (xios_is_active_field(field_name)) call send_xios_field(field_name,field_real) |
|---|
| [2970] | 304 | #endif |
|---|
| [3092] | 305 | |
|---|
| [3160] | 306 | deallocate(field_real) |
|---|
| [2976] | 307 | |
|---|
| [3160] | 308 | END SUBROUTINE write_output_l2 |
|---|
| [2970] | 309 | |
|---|
| [2932] | 310 | END MODULE write_output_mod |
|---|