[6610] | 1 | #include <inca_define.h> |
---|
| 2 | |
---|
| 3 | MODULE xios_inca |
---|
| 4 | |
---|
| 5 | #ifdef XIOS |
---|
| 6 | USE xios |
---|
| 7 | #endif |
---|
| 8 | USE PRINT_INCA |
---|
| 9 | USE MOD_GRID_INCA |
---|
| 10 | USE MOD_INCA_MPI_DATA |
---|
| 11 | USE MOD_INCA_PARA |
---|
| 12 | USE MOD_CONST_MPI_INCA |
---|
| 13 | USE CONST_LMDZ |
---|
| 14 | USE IOIPSL |
---|
| 15 | USE PARAM_CHEM |
---|
| 16 | USE SURF_CHEM_MOD |
---|
| 17 | USE RATE_INDEX_MOD |
---|
| 18 | USE CHEM_TRACNM, ONLY: solsym |
---|
| 19 | USE SPECIES_NAMES |
---|
| 20 | USE AEROSOL_DIAG, ONLY : naero_grp, mrfname,mrfname_xml, mrfname_long, las, cla |
---|
| 21 | USE AEROSOL_MOD |
---|
| 22 | |
---|
| 23 | IMPLICIT NONE |
---|
| 24 | PRIVATE |
---|
| 25 | PUBLIC :: xios_inca_init , xios_inca_change_context, & |
---|
| 26 | xios_inca_update_calendar, xios_inca_context_finalize, & |
---|
| 27 | xios_inca_send_field, xios_inca_recv_field, xios_inca_recv_field_glo, xios_inca_recv_field_mpi |
---|
| 28 | |
---|
| 29 | ! |
---|
| 30 | !! Declaration of internal variables |
---|
| 31 | ! |
---|
| 32 | #ifdef XIOS |
---|
| 33 | TYPE(xios_context) :: ctx_hdl_inca !! Handel for INCA |
---|
| 34 | !$OMP THREADPRIVATE(ctx_hdl_inca) |
---|
| 35 | TYPE(xios_fieldgroup) :: reacflux_hdl,reacrate_hdl, invoxy_hdl, phtrate_hdl, extfrc_hdl, extfrc_col_hdl, conc_spcs_hdl, emi_hdl, dryvd_hdl |
---|
| 36 | TYPE(xios_fieldgroup) :: tauinca1_hdl, pizinca1_hdl, cginca1_hdl, tauinca2_hdl, pizinca2_hdl, cginca2_hdl |
---|
| 37 | TYPE(xios_fieldgroup) :: drydep_hdl, hrate_hdl, od_hdl, od3d_hdl, source_hdl, emiNoBio_hdl,emiOrch_hdl |
---|
| 38 | TYPE(xios_fieldgroup) :: source0_hdl, source0_read_hdl, invoxy0_hdl, invoxy0_read_hdl |
---|
| 39 | TYPE(xios_fieldgroup) :: sed_hdl,wet_hdl,load_hdl,emialt_hdl,mdw_hdl,aerh2o_hdl |
---|
| 40 | TYPE(xios_fieldgroup) :: tau1_hdl, tau2_hdl,piz1_hdl,piz2_hdl,cg1_hdl,cg2_hdl |
---|
| 41 | TYPE(xios_fieldgroup) :: swtoaas_hdl,swtoacs_hdl,swsrfas_hdl,swsrfcs_hdl,fswtoaas_hdl,fswtoacs_hdl,fswsrfas_hdl,fswsrfcs_hdl, wetloss_hdl |
---|
| 42 | TYPE(xios_field) :: child |
---|
| 43 | !$OMP THREADPRIVATE(reacflux_hdl, reacrate_hdl,invoxy_hdl, phtrate_hdl, extfrc_hdl, extfrc_col_hdl, conc_spcs_hdl, emi_hdl,dryvd_hdl, child) |
---|
| 44 | !$OMP THREADPRIVATE(tauinca1_hdl, pizinca1_hdl, cginca1_hdl, tauinca2_hdl, pizinca2_hdl, cginca2_hdl) |
---|
| 45 | !$OMP THREADPRIVATE(drydep_hdl, hrate_hdl, od_hdl, od3d_hdl, source_hdl, emiNoBio_hdl,emiOrch_hdl) |
---|
| 46 | !$OMP THREADPRIVATE(sed_hdl,wet_hdl,load_hdl,emialt_hdl,mdw_hdl,aerh2o_hdl) |
---|
| 47 | !$OMP THREADPRIVATE(tau1_hdl, tau2_hdl,piz1_hdl,piz2_hdl,cg1_hdl,cg2_hdl) |
---|
| 48 | !$OMP THREADPRIVATE(swtoaas_hdl,swtoacs_hdl,swsrfas_hdl,swsrfcs_hdl,fswtoaas_hdl,fswtoacs_hdl,fswsrfas_hdl,fswsrfcs_hdl, wetloss_hdl) |
---|
| 49 | !$OMP THREADPRIVATE(source0_hdl, source0_read_hdl, invoxy0_hdl, invoxy0_read_hdl) |
---|
| 50 | |
---|
| 51 | #endif |
---|
| 52 | CHARACTER(len=*),PARAMETER :: id="client" !! Id for initialization of INCA in XIOS |
---|
| 53 | |
---|
| 54 | ! ==================================================================== |
---|
| 55 | ! INTERFACE : xios_inca_send_field |
---|
| 56 | ! |
---|
| 57 | ! Send a field to XIOS. |
---|
| 58 | ! |
---|
| 59 | ! DESCRIPTION : Send a field to XIOS. The field can have 1, 2 or 3 dimensions. |
---|
| 60 | ! This interface should be called at each time-step for each output varaiables. |
---|
| 61 | ! |
---|
| 62 | ! ==================================================================== |
---|
| 63 | |
---|
| 64 | INTERFACE xios_inca_send_field |
---|
| 65 | MODULE PROCEDURE xios_inca_send_field_r2d, xios_inca_send_field_r1d,xios_inca_send_field_r0d |
---|
| 66 | END INTERFACE |
---|
| 67 | |
---|
| 68 | |
---|
| 69 | INTERFACE xios_inca_recv_field |
---|
| 70 | MODULE PROCEDURE xios_inca_recv_field_r0d, xios_inca_recv_field_r1d, xios_inca_recv_field_r2d,xios_inca_recv_field_r3d |
---|
| 71 | END INTERFACE |
---|
| 72 | |
---|
| 73 | INTERFACE xios_inca_recv_field_mpi |
---|
| 74 | MODULE PROCEDURE xios_inca_recv_field_mpi_r1d |
---|
| 75 | END INTERFACE |
---|
| 76 | |
---|
| 77 | INTERFACE xios_inca_recv_field_glo |
---|
| 78 | MODULE PROCEDURE xios_inca_recv_field_glo_r1d,xios_inca_recv_field_glo_r2d,xios_inca_recv_field_glo_r3d |
---|
| 79 | END INTERFACE |
---|
| 80 | |
---|
| 81 | |
---|
| 82 | CONTAINS |
---|
| 83 | ! ==================================================================== |
---|
| 84 | ! SUBROUTINE : xios_inca_init |
---|
| 85 | ! |
---|
| 86 | ! Initialize variables needed for use of XIOS. |
---|
| 87 | ! |
---|
| 88 | ! DESCRIPTION : Initialization of specific varaiables needed to use XIOS such as model domain and time step. |
---|
| 89 | ! |
---|
| 90 | ! |
---|
| 91 | ! ==================================================================== |
---|
| 92 | |
---|
| 93 | SUBROUTINE xios_inca_init(& |
---|
| 94 | COMM_LMDZ, timestep, year, month, day, & |
---|
| 95 | hour, ini_an, ini_mois, ini_jour, ini_heure, & |
---|
| 96 | io_lon, io_lat, presnivs) |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | USE PARAM_CHEM, ONLY : use_group, LMDZ_10m_winds |
---|
| 100 | USE MOD_GEOMETRY_INCA, ONLY : longitude, latitude, boundslon, boundslat,ind_cell_glo |
---|
| 101 | USE MOD_GRID_INCA, ONLY : nvertex, plon_glo, grid_type, regular_lonlat, unstructured |
---|
| 102 | USE MOD_INCA_MPI_DATA, ONLY : ij_nb |
---|
| 103 | USE CONST_MOD, ONLY: PI |
---|
| 104 | USE INCA_DIM |
---|
| 105 | USE PRINT_INCA |
---|
| 106 | IMPLICIT NONE |
---|
| 107 | |
---|
| 108 | ! |
---|
| 109 | !! 0. Variable and parameter declaration |
---|
| 110 | ! |
---|
| 111 | !! 0.1 Input variables |
---|
| 112 | ! |
---|
| 113 | INTEGER, INTENT(in) :: COMM_LMDZ !! Inca MPI communicator (from module mod_inca_mpi_data) |
---|
| 114 | INTEGER, INTENT(in) :: year, month, day, ini_an, ini_mois, ini_jour !! Current date information |
---|
| 115 | REAL, INTENT(in) :: hour, ini_heure |
---|
| 116 | REAL,INTENT(IN) :: io_lat(:) ! latitudes (of global grid) |
---|
| 117 | REAL,INTENT(IN) :: io_lon(:) ! longitudes (of global grid) |
---|
| 118 | REAL, INTENT(in) :: timestep |
---|
| 119 | REAL, INTENT(in) :: presnivs(PLEV) |
---|
| 120 | ! |
---|
| 121 | !! 0.2 Local variables |
---|
| 122 | ! |
---|
| 123 | LOGICAL :: find |
---|
| 124 | INTEGER :: i |
---|
| 125 | INTEGER :: it,la |
---|
| 126 | CHARACTER(LEN=30) :: start_str , time_orig !! Current date as character string |
---|
| 127 | |
---|
| 128 | #ifdef XIOS |
---|
| 129 | TYPE(xios_duration) :: dtime = xios_duration(0, 0, 0, 0, 0, 0) |
---|
| 130 | #endif |
---|
| 131 | |
---|
| 132 | LOGICAL :: mask(iim_glo,jj_nb) !Masque pour les problÚmes de recouvrement MPI |
---|
| 133 | |
---|
| 134 | REAL, DIMENSION(nbveget) :: veget |
---|
| 135 | REAL, DIMENSION(nbsurf) :: surf |
---|
| 136 | REAL, DIMENSION(PLEV+1) :: paprsniv |
---|
| 137 | REAL, DIMENSION(PLEV) :: klev_value |
---|
| 138 | REAL, DIMENSION(12) :: timeco2_value |
---|
| 139 | REAL, DIMENSION(2920) :: timeco2h_value |
---|
| 140 | INTEGER :: n, length, ni, nj |
---|
| 141 | CHARACTER(len=13) :: tmp_name |
---|
| 142 | |
---|
| 143 | ! variables pour la grille non structuree de dynamico |
---|
| 144 | REAL :: lon_mpi(plon_mpi) |
---|
| 145 | REAL :: lat_mpi(plon_mpi) |
---|
| 146 | REAL :: boundslon_mpi(plon_mpi,nvertex) |
---|
| 147 | REAL :: boundslat_mpi(plon_mpi,nvertex) |
---|
| 148 | INTEGER :: ind_cell_glo_mpi(plon_mpi) |
---|
| 149 | |
---|
| 150 | |
---|
| 151 | ! =================================================================== |
---|
| 152 | |
---|
| 153 | ! |
---|
| 154 | !! 1. Set date and calendar information on the format needed by XIOS |
---|
| 155 | ! |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | IF (grid_type == unstructured) THEN |
---|
| 159 | |
---|
| 160 | ! write(*,*) ' dans xios_inca cell = ', ind_cell_glo |
---|
| 161 | ! call flush(6) |
---|
| 162 | |
---|
| 163 | CALL gather_omp(longitude*180/PI,lon_mpi) |
---|
| 164 | CALL gather_omp(latitude*180/PI,lat_mpi) |
---|
| 165 | CALL gather_omp(boundslon*180/PI,boundslon_mpi) |
---|
| 166 | CALL gather_omp(boundslat*180/PI,boundslat_mpi) |
---|
| 167 | CALL gather_omp(ind_cell_glo,ind_cell_glo_mpi) |
---|
| 168 | endif |
---|
| 169 | |
---|
| 170 | |
---|
| 171 | !$OMP MASTER |
---|
| 172 | #ifdef XIOS |
---|
| 173 | ! |
---|
| 174 | !! 2. Context initialization |
---|
| 175 | ! |
---|
| 176 | CALL xios_context_initialize("inca",COMM_LMDZ) |
---|
| 177 | CALL xios_get_handle("inca",ctx_hdl_inca) |
---|
| 178 | CALL xios_set_current_context(ctx_hdl_inca) |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | ! Groupes pour les restart |
---|
| 182 | ! ecriture |
---|
| 183 | CALL xios_get_handle("source" , source_hdl ) |
---|
| 184 | CALL xios_get_handle("inv_oxy" , invoxy_hdl ) |
---|
| 185 | CALL xios_get_handle("tauinca1", tauinca1_hdl ) |
---|
| 186 | CALL xios_get_handle("pizinca1", pizinca1_hdl ) |
---|
| 187 | CALL xios_get_handle("cginca1" , cginca1_hdl ) |
---|
| 188 | CALL xios_get_handle("tauinca2", tauinca2_hdl ) |
---|
| 189 | CALL xios_get_handle("pizinca2", pizinca2_hdl ) |
---|
| 190 | CALL xios_get_handle("cginca2" , cginca2_hdl ) |
---|
| 191 | |
---|
| 192 | ! lecture |
---|
| 193 | CALL xios_get_handle("source0" , source0_hdl ) |
---|
| 194 | CALL xios_get_handle("invoxy0" , invoxy0_hdl ) |
---|
| 195 | |
---|
| 196 | CALL xios_get_handle("source0_read" , source0_read_hdl ) |
---|
| 197 | CALL xios_get_handle("invoxy0_read" , invoxy0_read_hdl ) |
---|
| 198 | |
---|
| 199 | |
---|
| 200 | |
---|
| 201 | ! Groupes pour les output du code |
---|
| 202 | IF(use_group)THEN |
---|
| 203 | |
---|
| 204 | CALL xios_get_handle("reac_flux" , reacflux_hdl) |
---|
| 205 | CALL xios_get_handle("reac_rate" , reacrate_hdl) |
---|
| 206 | CALL xios_get_handle("photo_rate" , phtrate_hdl) |
---|
| 207 | CALL xios_get_handle("ext_forc" , extfrc_hdl) |
---|
| 208 | CALL xios_get_handle("ext_forc_col" , extfrc_col_hdl) |
---|
| 209 | CALL xios_get_handle("conc_species" , conc_spcs_hdl) |
---|
| 210 | CALL xios_get_handle("emi_species" , emi_hdl) |
---|
| 211 | CALL xios_get_handle("emi_noBioNat" , emiNoBio_hdl) |
---|
| 212 | CALL xios_get_handle("emi_FromOrch" , emiOrch_hdl) |
---|
| 213 | CALL xios_get_handle("dryvd_species" , dryvd_hdl) |
---|
| 214 | CALL xios_get_handle("drydep_species", drydep_hdl) |
---|
| 215 | CALL xios_get_handle("henry_const" , hrate_hdl) |
---|
| 216 | CALL xios_get_handle("Opt_thick" , od_hdl) |
---|
| 217 | CALL xios_get_handle("Opt_thick3D" , od3d_hdl) |
---|
| 218 | CALL xios_get_handle("sed_aero" , sed_hdl) |
---|
| 219 | CALL xios_get_handle("wet_aero" , wet_hdl) |
---|
| 220 | CALL xios_get_handle("load_aero" , load_hdl) |
---|
| 221 | CALL xios_get_handle("emialt_aero" , emialt_hdl) |
---|
| 222 | CALL xios_get_handle("mdw_aero" , mdw_hdl) |
---|
| 223 | CALL xios_get_handle("aerh2o_aero" , aerh2o_hdl) |
---|
| 224 | CALL xios_get_handle("oduvvis_aero", tau1_hdl) |
---|
| 225 | CALL xios_get_handle("odvisir_aero", tau2_hdl) |
---|
| 226 | CALL xios_get_handle("ssauvvis_aero", piz1_hdl) |
---|
| 227 | CALL xios_get_handle("ssavisir_aero", piz2_hdl) |
---|
| 228 | CALL xios_get_handle("asyuvvis_aero", cg1_hdl) |
---|
| 229 | CALL xios_get_handle("asyvisir_aero", cg2_hdl) |
---|
| 230 | CALL xios_get_handle("swtoaas_aero",swtoaas_hdl ) |
---|
| 231 | CALL xios_get_handle("swtoacs_aero",swtoacs_hdl ) |
---|
| 232 | CALL xios_get_handle("swsrfas_aero",swsrfas_hdl ) |
---|
| 233 | CALL xios_get_handle("swsrfcs_aero",swsrfcs_hdl ) |
---|
| 234 | CALL xios_get_handle("fswtoaas_aero",fswtoaas_hdl ) |
---|
| 235 | CALL xios_get_handle("fswtoacs_aero",fswtoacs_hdl ) |
---|
| 236 | CALL xios_get_handle("fswsrfas_aero",fswsrfas_hdl ) |
---|
| 237 | CALL xios_get_handle("fswsrfcs_aero",fswsrfcs_hdl ) |
---|
| 238 | CALL xios_get_handle("wetloss",wetloss_hdl ) |
---|
| 239 | |
---|
| 240 | ENDIF |
---|
| 241 | |
---|
| 242 | |
---|
| 243 | ! |
---|
| 244 | !! 2. Calendar and date definition |
---|
| 245 | ! |
---|
| 246 | !Réglage du calendrier: |
---|
| 247 | SELECT CASE (calend) |
---|
| 248 | CASE('earth_360d') |
---|
| 249 | CALL xios_define_calendar(TYPE="D360",time_origin=xios_date(year,month,day,INT(hour),0,0),start_date=xios_date(ini_an, ini_mois, ini_jour, INT(ini_heure),0,0)) |
---|
| 250 | CASE('earth_365d') |
---|
| 251 | CALL xios_define_calendar(TYPE="NoLeap",time_origin=xios_date(year,month,day,INT(hour),0,0),start_date=xios_date(ini_an, ini_mois, ini_jour, INT(ini_heure),0,0)) |
---|
| 252 | CASE('gregorian') |
---|
| 253 | CALL xios_define_calendar(TYPE="Gregorian",time_origin=xios_date(year,month,day,INT(hour),0,0),start_date=xios_date(ini_an, ini_mois, ini_jour, INT(ini_heure),0,0)) |
---|
| 254 | CASE DEFAULT |
---|
| 255 | CALL print_err(3, 'wxios_set_cal',' Mauvais choix de calendrier', '', '') |
---|
| 256 | END SELECT |
---|
| 257 | |
---|
| 258 | |
---|
| 259 | !! 3. Send the time-step length to XIOS |
---|
| 260 | ! |
---|
| 261 | |
---|
| 262 | dtime%second = timestep |
---|
| 263 | CALL xios_set_timestep(dtime) |
---|
| 264 | |
---|
| 265 | ! |
---|
| 266 | !! 4. Domain definition |
---|
| 267 | ! |
---|
| 268 | ! Global domain |
---|
| 269 | !On parametrise le domaine: |
---|
| 270 | ! write(*,*) 'XIOS INCA initialisation grille ', grid_type, ' regular_lonlat = ', regular_lonlat, ' unstructured = ', unstructured |
---|
| 271 | |
---|
| 272 | if (grid_type == regular_lonlat) THEN |
---|
| 273 | CALL xios_set_domain_attr("dom_chem", ni_glo=iim_glo, ibegin=0, ni=iim_glo, TYPE="rectilinear") |
---|
| 274 | CALL xios_set_domain_attr("dom_chem", nj_glo=jjm_glo, jbegin=jj_begin-1, nj=jj_nb, data_dim=2) |
---|
| 275 | CALL xios_set_domain_attr("dom_chem", lonvalue_1D=(io_lon(1:iim_glo)+1000)-1000, latvalue_1D=io_lat(jj_begin:jj_end)) |
---|
| 276 | |
---|
| 277 | |
---|
| 278 | IF (.NOT.is_sequential) THEN |
---|
| 279 | mask(:,:)=.TRUE. |
---|
| 280 | IF (ii_begin>1) mask(1:ii_begin-1,1) = .FALSE. |
---|
| 281 | IF (ii_end<jj_nb) mask(ii_end+1:iim_glo,jj_nb) = .FALSE. |
---|
| 282 | ! special case for south pole |
---|
| 283 | IF ((ii_end.EQ.1).AND.(is_south_pole)) mask(1:iim_glo,jj_nb)=.TRUE. |
---|
| 284 | CALL xios_set_domain_attr("dom_chem", mask_1D=RESHAPE(mask(:,:),(/iim_glo*jj_nb/))) |
---|
| 285 | END IF |
---|
| 286 | |
---|
| 287 | |
---|
| 288 | |
---|
| 289 | ELSE IF (grid_type == unstructured) THEN |
---|
| 290 | |
---|
| 291 | CALL xios_set_domain_attr("dom_chem", ni_glo=jjm_glo, type="unstructured", nvertex=nvertex) |
---|
| 292 | CALL xios_set_domain_attr("dom_chem", ibegin=ij_begin-1, ni=ij_nb) |
---|
| 293 | CALL xios_set_domain_attr("dom_chem", nvertex=nvertex, lonvalue_1d=lon_mpi, latvalue_1d=lat_mpi) |
---|
| 294 | CALL xios_set_domain_attr("dom_chem", bounds_lon_1d=TRANSPOSE(boundslon_mpi), bounds_lat_1d=TRANSPOSE(boundslat_mpi) ) |
---|
| 295 | CALL xios_set_domain_attr("dom_chem", i_index=ind_cell_glo_mpi(:)-1) |
---|
| 296 | |
---|
| 297 | |
---|
| 298 | IF (xios_remap_output) THEN |
---|
| 299 | ! Define output grid as domain_landpoints_regular (grid specified in xml files) |
---|
| 300 | CALL xios_set_domain_attr("dom_chem_out",domain_ref="dom_chem_regular") |
---|
| 301 | |
---|
| 302 | CALL xios_set_fieldgroup_attr("remap_expr",expr="@this_ref") |
---|
| 303 | CALL xios_set_fieldgroup_attr("remap_1ts", freq_op=xios_duration_convert_from_string("1ts")) |
---|
| 304 | CALL xios_set_fieldgroup_attr("remap_1800s", freq_op=xios_duration_convert_from_string("1800s")) |
---|
| 305 | CALL xios_set_fieldgroup_attr("remap_1h", freq_op=xios_duration_convert_from_string("1h")) |
---|
| 306 | CALL xios_set_fieldgroup_attr("remap_3h", freq_op=xios_duration_convert_from_string("3h")) |
---|
| 307 | CALL xios_set_fieldgroup_attr("remap_6h", freq_op=xios_duration_convert_from_string("6h")) |
---|
| 308 | CALL xios_set_fieldgroup_attr("remap_1d", freq_op=xios_duration_convert_from_string("1d")) |
---|
| 309 | CALL xios_set_fieldgroup_attr("remap_1mo", freq_op=xios_duration_convert_from_string("1mo")) |
---|
| 310 | |
---|
| 311 | ENDIF |
---|
| 312 | |
---|
| 313 | ENDIF |
---|
| 314 | |
---|
| 315 | !! 5. Axis definition |
---|
| 316 | ! |
---|
| 317 | DO i=1,nbveget |
---|
| 318 | veget(i) = i |
---|
| 319 | END DO |
---|
| 320 | |
---|
| 321 | DO i=1,nbsurf |
---|
| 322 | surf(i) = i |
---|
| 323 | END DO |
---|
| 324 | |
---|
| 325 | DO i=1,PLEV+1 |
---|
| 326 | paprsniv(i) = real(i) |
---|
| 327 | END DO |
---|
| 328 | |
---|
| 329 | DO i=1,PLEV |
---|
| 330 | klev_value(i) = real(i) |
---|
| 331 | enddo |
---|
| 332 | |
---|
| 333 | CALL xios_set_axis_attr("presnivs",n_glo=PLEV,VALUE=presnivs) |
---|
| 334 | CALL xios_set_axis_attr("paprsniv",n_glo=PLEV+1,VALUE=paprsniv) |
---|
| 335 | CALL xios_set_axis_attr("veget", n_glo=nbveget, VALUE=veget) |
---|
| 336 | CALL xios_set_axis_attr("surf", n_glo=nbsurf, VALUE=surf) |
---|
| 337 | CALL xios_set_axis_attr("klev", n_glo=PLEV, VALUE=klev_value(1:PLEV)) |
---|
| 338 | CALL xios_set_axis_attr("bnds",n_glo=2, VALUE=(/1.,2./)) |
---|
| 339 | |
---|
| 340 | if (grid_type == regular_lonlat) THEN |
---|
| 341 | IF (xios_is_valid_axis("axis_lat")) THEN |
---|
| 342 | CALL xios_set_axis_attr( "axis_lat", n_glo=jjm_glo, n=jj_nb, begin=jj_begin-1, value=io_lat(jj_begin:jj_end)) |
---|
| 343 | ENDIF |
---|
| 344 | endif |
---|
| 345 | |
---|
| 346 | ! Declaration interactivement pour la definition des variables des groupes xml |
---|
| 347 | ! au fur et a mesure le lien nom_variable / name_xml sera reproduit dans le fichier |
---|
| 348 | ! inca_IDxml.out |
---|
| 349 | |
---|
| 350 | !----------------------------------------------------- |
---|
| 351 | !----------------------------------------------------- |
---|
| 352 | ! Groupes pour les restarts |
---|
| 353 | !----------------------------------------------------- |
---|
| 354 | !----------------------------------------------------- |
---|
| 355 | ! ecriture |
---|
| 356 | ! Sources |
---|
| 357 | DO n=1,PCNST |
---|
| 358 | CALL xios_add_child(source_hdl, child, "source_"//trim(tracnam(n))) |
---|
| 359 | CALL xios_set_attr(child,name="source"//TRIM(tracnam(n)), unit="kg m-2 s-1") |
---|
| 360 | ENDDO! |
---|
| 361 | |
---|
| 362 | ! invariants |
---|
| 363 | DO n=1, NFS |
---|
| 364 | CALL xios_add_child(invoxy_hdl, child, "inv_"//TRIM(invname(n))) |
---|
| 365 | CALL xios_set_attr(child,name="inv_"//TRIM(invname(n)), unit="cm-3" ) |
---|
| 366 | CALL write_xml_info("inv_"//TRIM(invname(n)), "inv_"//TRIM(invname(n)),"false", "cm-3","presnivs","false") |
---|
| 367 | ENDDO |
---|
| 368 | |
---|
| 369 | ! lecture |
---|
| 370 | ! Sources |
---|
| 371 | DO n=1,PCNST |
---|
| 372 | CALL xios_add_child(source0_hdl, child, "source"//trim(tracnam(n))//"id") |
---|
| 373 | CALL xios_set_attr(child,name="source"//TRIM(tracnam(n))) |
---|
| 374 | |
---|
| 375 | CALL xios_add_child(source0_read_hdl, child, "source"//trim(tracnam(n))//"_read") |
---|
| 376 | CALL xios_set_attr(child,field_ref="source"//trim(tracnam(n))//"id") |
---|
| 377 | ENDDO |
---|
| 378 | |
---|
| 379 | ! invariants |
---|
| 380 | DO n=1, NFS |
---|
| 381 | CALL xios_add_child(invoxy0_hdl, child, "inv_"//TRIM(invname(n))//"id") |
---|
| 382 | CALL xios_set_attr(child,name="inv_"//TRIM(invname(n)) ) |
---|
| 383 | |
---|
| 384 | CALL xios_add_child(invoxy0_read_hdl, child, "inv_"//TRIM(invname(n))//"_read") |
---|
| 385 | CALL xios_set_attr(child,field_ref="inv_"//TRIM(invname(n))//"id") |
---|
| 386 | |
---|
| 387 | ENDDO |
---|
| 388 | |
---|
| 389 | |
---|
| 390 | |
---|
| 391 | #ifdef AER |
---|
| 392 | ! dependantes des aerosols |
---|
| 393 | DO i=1, naero_grp |
---|
| 394 | CALL xios_add_child(tauinca1_hdl, child,"tau_inca1_"//mrfname(i) ) |
---|
| 395 | CALL xios_add_child(tauinca2_hdl, child,"tau_inca2_"//mrfname(i) ) |
---|
| 396 | |
---|
| 397 | CALL xios_add_child(pizinca1_hdl, child,"piz_inca1_"//mrfname(i) ) |
---|
| 398 | CALL xios_add_child(pizinca2_hdl, child,"piz_inca2_"//mrfname(i) ) |
---|
| 399 | |
---|
| 400 | CALL xios_add_child(cginca1_hdl, child,"cg_inca1_"//mrfname(i) ) |
---|
| 401 | CALL xios_add_child(cginca2_hdl, child,"cg_inca2_"//mrfname(i) ) |
---|
| 402 | |
---|
| 403 | ENDDO |
---|
| 404 | #else |
---|
| 405 | ! a retirer si nous ne sommes pas dans le cas aerosols |
---|
| 406 | CALL xios_set_field_attr("ccm1", enabled=.FALSE.) |
---|
| 407 | CALL xios_set_field_attr("ccm2", enabled=.FALSE.) |
---|
| 408 | #endif |
---|
| 409 | #ifndef STRAT |
---|
| 410 | CALL xios_set_field_attr("h2oc", enabled=.FALSE.) |
---|
| 411 | #endif |
---|
| 412 | |
---|
| 413 | !----------------------------------------------------- |
---|
| 414 | !----------------------------------------------------- |
---|
| 415 | ! Groupes pour les output |
---|
| 416 | !----------------------------------------------------- |
---|
| 417 | !----------------------------------------------------- |
---|
| 418 | IF(use_group)THEN |
---|
| 419 | |
---|
| 420 | DO n=1,PCNST |
---|
| 421 | |
---|
| 422 | !----------------------------------------------- |
---|
| 423 | ! declaration des concentrations d'especes |
---|
| 424 | !----------------------------------------------- |
---|
| 425 | CALL xios_add_child(conc_spcs_hdl,child,tracnam(n)) |
---|
| 426 | |
---|
| 427 | #ifdef AER |
---|
| 428 | ! on traite differemment le cas des aerosols dans les modes ci / cs / ai / as / ss |
---|
| 429 | DO i=1,nmodes |
---|
| 430 | find = .FALSE. |
---|
| 431 | IF (n .GE. mass1index(i) .AND. n .LE. massNindex(i)) THEN |
---|
| 432 | find = .TRUE. |
---|
| 433 | CALL xios_set_attr(child,name="mmr"//TRIM(name_xml(n)),unit="kg kg-1", long_name=TRIM(tracnam(n))//" Mass Mixing Ratio "//TRIM(mode_name(i))) |
---|
| 434 | CALL write_xml_info(TRIM(tracnam(n)), "mmr"//TRIM(name_xml(n)), TRIM(tracnam(n))//" Mass Mixing Ratio "//TRIM(mode_name(i)),"kg kg-1","presnivs","false") |
---|
| 435 | |
---|
| 436 | ELSEIF (n == numberindex(i)) THEN |
---|
| 437 | find = .TRUE. |
---|
| 438 | CALL xios_set_attr(child,name="nmr"//TRIM(name_xml(n)),unit="kg-1", long_name="Number Mixing Ratio "//TRIM(mode_name(i))) |
---|
| 439 | CALL write_xml_info( TRIM(tracnam(n)), "nmr"//TRIM(name_xml(n)), "Number Mixing Ratio "//TRIM(mode_name(i)),"kg kg-1","presnivs","false") |
---|
| 440 | |
---|
| 441 | ENDIF |
---|
| 442 | IF (find) EXIT |
---|
| 443 | END DO |
---|
| 444 | IF (.NOT. find) THEN |
---|
| 445 | CALL xios_set_attr(child,name="vmr"//TRIM(name_xml(n)),unit="mol mol-1", long_name=TRIM(tracnam(n))//" Volume Mixing Ratio") |
---|
| 446 | CALL write_xml_info(TRIM(tracnam(n)), "vmr"//TRIM(name_xml(n)), TRIM(tracnam(n))//" Volume Mixing Ratio","mol mol-1","presnivs","false") |
---|
| 447 | ENDIF |
---|
| 448 | #else |
---|
| 449 | CALL xios_set_attr(child,name="vmr"//TRIM(name_xml(n)),unit="mol mol-1", long_name=TRIM(tracnam(n))//" Volume Mixing Ratio") |
---|
| 450 | CALL write_xml_info(TRIM(tracnam(n)), "vmr"//TRIM(name_xml(n)), TRIM(tracnam(n))//" Volume Mixing Ratio","mol mol-1","presnivs","false") |
---|
| 451 | |
---|
| 452 | #endif |
---|
| 453 | !----------------------------------------------- |
---|
| 454 | ! declaration des emissions |
---|
| 455 | !----------------------------------------------- |
---|
| 456 | CALL xios_add_child(emi_hdl,child,"Emi_"//tracnam(n)) |
---|
| 457 | #ifdef AER |
---|
| 458 | ! on traite differemment le cas des nombres ASN, AIN, SSN, CSN, CIN |
---|
| 459 | DO i=1,nmodes |
---|
| 460 | find = .FALSE. |
---|
| 461 | IF (n == numberindex(i)) THEN |
---|
| 462 | find = .TRUE. |
---|
| 463 | CALL xios_set_attr(child,name="emin"//TRIM(name_xml(n)), unit="m-2 s-1", long_name="Emission Number "//TRIM(mode_name(i))) |
---|
| 464 | CALL write_xml_info("Emi_"//TRIM(tracnam(n)), "emin"//TRIM(name_xml(n)), "Emission Number "//TRIM(mode_name(i)),"m-2 s-1","false","false") |
---|
| 465 | ENDIF |
---|
| 466 | IF (find) EXIT |
---|
| 467 | END DO |
---|
| 468 | IF (.NOT. find) THEN |
---|
| 469 | CALL xios_set_attr(child,name="emi"//TRIM(name_xml(n)), unit="kg m-2 s-1", long_name="Total Emission Rate of "//TRIM(tracnam(n))) |
---|
| 470 | CALL write_xml_info("Emi_"//TRIM(tracnam(n)), "emi"//TRIM(name_xml(n)), "Total Emission Rate of "//TRIM(tracnam(n)),"kg m-2 s-1","false","false") |
---|
| 471 | ENDIF |
---|
| 472 | #else |
---|
| 473 | CALL xios_set_attr(child,name="emi"//TRIM(name_xml(n)), unit="kg m-2 s-1", long_name="Total Emission Rate of "//TRIM(tracnam(n))) |
---|
| 474 | CALL write_xml_info("Emi_"//TRIM(tracnam(n)), "emi"//TRIM(name_xml(n)), "Total Emission Rate of "//TRIM(tracnam(n)),"kg m-2 s-1","false","false") |
---|
| 475 | |
---|
| 476 | #endif |
---|
| 477 | !----------------------------------------------- |
---|
| 478 | ! declaration des vitesses de deposition seches |
---|
| 479 | !----------------------------------------------- |
---|
| 480 | CALL xios_add_child(dryvd_hdl,child,"Dep_"//tracnam(n)) |
---|
| 481 | #ifdef AER |
---|
| 482 | DO i=1,nmodes |
---|
| 483 | find = .FALSE. |
---|
| 484 | IF (n == numberindex(i)) THEN |
---|
| 485 | find = .TRUE. |
---|
| 486 | CALL xios_set_attr(child,name="dryvdn"//TRIM(name_xml(n)), unit="m-2 s-1", long_name="Number Dry Deposition velocity of aerosol number "//TRIM(mode_name(i))) |
---|
| 487 | CALL write_xml_info("Dep_"//TRIM(tracnam(n)), "dryvdn"//TRIM(name_xml(n)), "Number Dry Deposition velocity of aerosol number "//TRIM(mode_name(i)),"m-2 s-1","false","false") |
---|
| 488 | ENDIF |
---|
| 489 | IF (find) EXIT |
---|
| 490 | END DO |
---|
| 491 | IF (.NOT. find) THEN |
---|
| 492 | CALL xios_set_attr(child,name="dryvd"//TRIM(name_xml(n)), unit="cm s-1", long_name="Dry Deposition Velocity of "//TRIM(tracnam(n))) |
---|
| 493 | CALL write_xml_info("Dep_"//TRIM(tracnam(n)), "dryvd"//TRIM(name_xml(n)), "Dry Deposition Velocity of "//TRIM(tracnam(n)),"cm s-1","false","false") |
---|
| 494 | END IF |
---|
| 495 | #else |
---|
| 496 | CALL xios_set_attr(child,name="dryvd"//TRIM(name_xml(n)), unit="cm s-1", long_name="Dry Deposition Velocity of "//TRIM(tracnam(n))) |
---|
| 497 | CALL write_xml_info("Dep_"//TRIM(tracnam(n)), "dryvd"//TRIM(name_xml(n)), "Dry Deposition Velocity of "//TRIM(tracnam(n)),"cm s-1","false","false") |
---|
| 498 | |
---|
| 499 | #endif |
---|
| 500 | |
---|
| 501 | |
---|
| 502 | !----------------------------------------------- |
---|
| 503 | ! declaration des depots sec |
---|
| 504 | !----------------------------------------------- |
---|
| 505 | CALL xios_add_child(drydep_hdl,child,"Dflux_"//tracnam(n)) |
---|
| 506 | #ifdef AER |
---|
| 507 | DO i=1,nmodes |
---|
| 508 | find = .FALSE. |
---|
| 509 | IF (n == numberindex(i)) THEN |
---|
| 510 | find = .TRUE. |
---|
| 511 | CALL xios_set_attr(child,name="dryn"//TRIM(name_xml(n)), unit="kg m-2 s-1", long_name="Number Dry Deposition of aerosol number "//TRIM(mode_name(i))) |
---|
| 512 | CALL write_xml_info("Dflux_"//TRIM(tracnam(n)), "dryn"//TRIM(name_xml(n)), "Number Dry Deposition of aerosol number "//TRIM(mode_name(i)),"kg m-2 s-1","false","false") |
---|
| 513 | ENDIF |
---|
| 514 | IF (find) EXIT |
---|
| 515 | END DO |
---|
| 516 | IF (.NOT. find) THEN |
---|
| 517 | CALL xios_set_attr(child,name="dry"//TRIM(name_xml(n)), unit="kg m-2 s-1", long_name="Dry Deposition of "//TRIM(tracnam(n))) |
---|
| 518 | CALL write_xml_info("Dflux_"//TRIM(tracnam(n)), "dry"//TRIM(name_xml(n)), "Dry Deposition of "//TRIM(tracnam(n)),"kg m-2 s-1","false","false") |
---|
| 519 | END IF |
---|
| 520 | #else |
---|
| 521 | CALL xios_set_attr(child,name="dry"//TRIM(name_xml(n)), unit="kg m-2 s-1", long_name="Dry Deposition of "//TRIM(tracnam(n))) |
---|
| 522 | CALL write_xml_info("Dflux_"//TRIM(tracnam(n)), "dry"//TRIM(name_xml(n)), "Dry Deposition of "//TRIM(tracnam(n)),"kg m-2 s-1","false","false") |
---|
| 523 | |
---|
| 524 | #endif |
---|
| 525 | ENDDO |
---|
| 526 | |
---|
| 527 | !----------------------------------------------- |
---|
| 528 | ! groupe reaction flux |
---|
| 529 | !----------------------------------------------- |
---|
| 530 | DO n=1, RXNCNT |
---|
| 531 | CALL xios_add_child(reacflux_hdl, child, "flux_"//TRIM(reacname(n))) |
---|
| 532 | CALL xios_set_attr(child, name="flux_"//TRIM(reacname(n)), unit="molec.cm-3.s-1") |
---|
| 533 | CALL write_xml_info("flux_"//TRIM(reacname(n)), "flux_"//TRIM(reacname(n)), "false","molec.cm-3.s-1","presnivs","false") |
---|
| 534 | |
---|
| 535 | CALL xios_add_child(reacrate_hdl, child, "reacrate_"//TRIM(reacname(n))) |
---|
| 536 | CALL xios_set_attr(child, name="reacrate_"//TRIM(reacname(n))) |
---|
| 537 | ENDDO |
---|
| 538 | |
---|
| 539 | |
---|
| 540 | |
---|
| 541 | !----------------------------------------------- |
---|
| 542 | ! groupe phtrate |
---|
| 543 | !----------------------------------------------- |
---|
| 544 | DO n=1, PHTCNT |
---|
| 545 | CALL xios_add_child(phtrate_hdl, child, "phtrate_"//TRIM(reacname(n))) |
---|
| 546 | CALL xios_set_attr(child, name="phtrate_"//TRIM(reacname(n)), long_name="photolysis rate for "//TRIM(reacname(n)), unit="s-1") |
---|
| 547 | CALL write_xml_info("phtrate_"//TRIM(reacname(n)),"phtrate_"//TRIM(reacname(n)),"photolysis rate for "//TRIM(reacname(n)),"s-1","presnivs","false") |
---|
| 548 | ENDDO |
---|
| 549 | |
---|
| 550 | # if EXTCNT != 0 |
---|
| 551 | DO n=1, EXTCNT |
---|
| 552 | !----------------------------------------------- |
---|
| 553 | ! groupe external forcing |
---|
| 554 | !----------------------------------------------- |
---|
| 555 | CALL xios_add_child(extfrc_hdl, child, "extfrc_"//TRIM(extname(n))) |
---|
| 556 | CALL xios_set_attr(child, name="extfrc_"//TRIM(extname(n)), unit="??") |
---|
| 557 | CALL write_xml_info("extfrc_"//TRIM(extname(n)), "extfrc_"//TRIM(extname(n)),"false","false","presnivs","false") |
---|
| 558 | |
---|
| 559 | !----------------------------------------------- |
---|
| 560 | ! groupe vertically integrated external forcing |
---|
| 561 | !----------------------------------------------- |
---|
| 562 | CALL xios_add_child(extfrc_col_hdl, child, "extfrc_"//TRIM(extname(n))//"_col") |
---|
| 563 | CALL xios_set_attr(child, name="extfrc_"//TRIM(extname(n))//"_col", unit="kg/m2/s") |
---|
| 564 | CALL write_xml_info("extfrc_"//TRIM(extname(n))//"_col", "extfrc_"//TRIM(extname(n))//"_col","Vertically integrated 3D emission","kg/m2/s","false","false") |
---|
| 565 | ENDDO |
---|
| 566 | #endif |
---|
| 567 | |
---|
| 568 | !----------------------------------------------- |
---|
| 569 | ! groupe constantes d'henry des reactions heterogenes |
---|
| 570 | !----------------------------------------------- |
---|
| 571 | DO n=1, HETCNT |
---|
| 572 | CALL xios_add_child(hrate_hdl, child, "hrate_"//TRIM(hetname(n))) |
---|
| 573 | CALL xios_set_attr(child, name="hrate_"//TRIM(hetname(n)), unit="s-1") |
---|
| 574 | CALL write_xml_info("hrate_"//TRIM(hetname(n)),"hrate_"//TRIM(hetname(n)),"false","s-1","presnivs","false") |
---|
| 575 | |
---|
| 576 | CALL xios_add_child(wetloss_hdl, child, "wetloss_"//TRIM(hetname(n))) |
---|
| 577 | CALL xios_set_attr(child, name="wetloss_"//TRIM(hetname(n))) |
---|
| 578 | CALL write_xml_info("wetloss_"//TRIM(hetname(n)),"wetloss_"//TRIM(hetname(n)),"false","[kg m-2 s-1]","presnivs","false") |
---|
| 579 | |
---|
| 580 | ENDDO |
---|
| 581 | |
---|
| 582 | #ifdef AER |
---|
| 583 | |
---|
| 584 | !----------------------------------------------- |
---|
| 585 | ! Variables AEROSOLS |
---|
| 586 | !----------------------------------------------- |
---|
| 587 | DO it=trmx,trnx |
---|
| 588 | |
---|
| 589 | ! do just for aerosol mass tracer |
---|
| 590 | #ifdef DUSS |
---|
| 591 | IF ( (it.NE.id_CIDUSTM) .AND. (it.NE.id_ASSSM) .AND. (it.NE.id_CSSSM) & |
---|
| 592 | .AND. (it.NE.id_SSSSM) ) THEN |
---|
| 593 | #else |
---|
| 594 | #ifdef NMHC |
---|
| 595 | IF ((it.NE.id_CIDUSTM) & |
---|
| 596 | .AND. (it.NE.id_ASSSM) .AND. (it.NE.id_CSSSM) .AND. (it.NE.id_SSSSM) & |
---|
| 597 | .AND. (it.NE.id_ASPOMM) .AND. (it.NE.id_AIPOMM) & |
---|
| 598 | .AND. (it.NE.id_ASAPp1a) .AND. (it.NE.id_ASAPp2a) & |
---|
| 599 | .AND. (it.NE.id_ASARp1a) .AND. (it.NE.id_ASARp2a) & |
---|
| 600 | .AND. (it.NE.id_ASBCM) .AND. (it.NE.id_AIBCM) & |
---|
| 601 | .AND. (it.NE.id_ASNH4M) .AND. (it.NE.id_CINO3M) & |
---|
| 602 | .AND. (it.NE.id_ASSO4M) .AND. (it.NE.id_CSSO4M) .AND. & |
---|
| 603 | (it.NE.id_ASNO3M) .AND. (it.NE.id_CSNO3M) ) THEN |
---|
| 604 | #else |
---|
| 605 | IF ((it.NE.id_CIDUSTM) & |
---|
| 606 | .AND. (it.NE.id_ASSSM) .AND. (it.NE.id_CSSSM) .AND. (it.NE.id_SSSSM) & |
---|
| 607 | .AND. (it.NE.id_ASPOMM) .AND. (it.NE.id_AIPOMM) & |
---|
| 608 | .AND. (it.NE.id_ASBCM) .AND. (it.NE.id_AIBCM) & |
---|
| 609 | .AND. (it.NE.id_ASNH4M) .AND. (it.NE.id_CINO3M) & |
---|
| 610 | .AND. (it.NE.id_ASSO4M) .AND. (it.NE.id_CSSO4M) .AND. & |
---|
| 611 | (it.NE.id_ASNO3M) .AND. (it.NE.id_CSNO3M) ) THEN |
---|
| 612 | #endif |
---|
| 613 | #endif |
---|
| 614 | CYCLE |
---|
| 615 | ENDIF |
---|
| 616 | |
---|
| 617 | IF (config_inca .NE. 'aeNP') THEN |
---|
| 618 | DO la=1,las |
---|
| 619 | CALL xios_add_child(od_hdl, child, "OD"//cla(la)//"_"//solsym(it)) |
---|
| 620 | CALL xios_set_attr(child,name="od"//cla(la)//name_xml(it),long_name="Optical Thickness at "//cla(la)//" nm for "//name_xml(it)) |
---|
| 621 | CALL write_xml_info("OD"//cla(la)//"_"//solsym(it), "od"//cla(la)//name_xml(it), "Optical Thickness at "//cla(la)//" nm for "//name_xml(it),"false","false","false") |
---|
| 622 | |
---|
| 623 | CALL xios_add_child(od3d_hdl, child, "OD"//cla(la)//"3D_"//solsym(it)) |
---|
| 624 | CALL xios_set_attr(child,name="od"//cla(la)//"3d"//name_xml(it),long_name="Optical Thickness at "//cla(la)//" nm 3D for "//name_xml(it)) |
---|
| 625 | CALL write_xml_info("OD"//cla(la)//"3D_"//solsym(it), "od"//cla(la)//"3d"//name_xml(it), "Optical Thickness at "//cla(la)//" nm 3D for "//name_xml(it),"false","presnivs","false") |
---|
| 626 | |
---|
| 627 | ENDDO |
---|
| 628 | ENDIF |
---|
| 629 | |
---|
| 630 | |
---|
| 631 | CALL xios_add_child(sed_hdl, child, "SED_"//solsym(it)) |
---|
| 632 | CALL xios_set_attr(child,name="sed"//name_xml(it),long_name=" Sedimentation Flux of "//name_xml(it), unit="kg m-2 s-1") |
---|
| 633 | CALL write_xml_info("SED_"//solsym(it), "sed"//name_xml(it), " Sedimentation Flux of "//name_xml(it),"kg m-2 s-1","false","false") |
---|
| 634 | |
---|
| 635 | CALL xios_add_child(wet_hdl, child, "WET_"//solsym(it)) |
---|
| 636 | CALL xios_set_attr(child,name="wet"//name_xml(it),long_name="Wet deposition of "//name_xml(it),unit="kg m-2 s-1") |
---|
| 637 | CALL write_xml_info("WET_"//solsym(it), "wet"//name_xml(it), "Wet deposition of "//name_xml(it),"kg m-2 s-1","false","false") |
---|
| 638 | |
---|
| 639 | CALL xios_add_child(load_hdl, child, "LOAD_"//solsym(it)) |
---|
| 640 | CALL xios_set_attr(child,name="load"//name_xml(it),long_name="Atmospheric load of "//name_xml(it),unit="kg m-2") |
---|
| 641 | CALL write_xml_info("LOAD_"//solsym(it), "load"//name_xml(it), "Atmospheric load of "//name_xml(it),"kg m-2","false","false") |
---|
| 642 | |
---|
| 643 | CALL xios_add_child(emialt_hdl, child,"Emi_alt_"//solsym(it)) |
---|
| 644 | CALL xios_set_attr(child,name="emialt"//name_xml(it),long_name="3D emission of "//name_xml(it),unit="kg m-2 s-1") |
---|
| 645 | CALL write_xml_info("Emi_alt_"//solsym(it), "emialt"//name_xml(it), "3D emission of "//name_xml(it),"kg m-2 s-1","presnivs","false") |
---|
| 646 | |
---|
| 647 | CALL xios_add_child(mdw_hdl, child,"MDW_"//solsym(it)) |
---|
| 648 | CALL xios_set_attr(child,name="mdw"//name_xml(it),long_name=" wet diameter of "//name_xml(it),unit="m" ) |
---|
| 649 | CALL write_xml_info("MDW_"//solsym(it), "mdw"//name_xml(it), " wet diameter of "//name_xml(it),"m","presnivs","false") |
---|
| 650 | |
---|
| 651 | CALL xios_add_child(aerh2o_hdl, child, "AERH2O_"//solsym(it)) |
---|
| 652 | CALL xios_set_attr(child,name="h2o"//name_xml(it),long_name="water associated to "//name_xml(it),unit="kg") |
---|
| 653 | CALL write_xml_info("AERH2O_"//solsym(it), "h2o"//name_xml(it), "water associated to "//name_xml(it),"kg","presnivs","false") |
---|
| 654 | |
---|
| 655 | ENDDO !it=trmx,trnx |
---|
| 656 | #endif |
---|
| 657 | IF (config_inca .NE. 'aeNP') THEN |
---|
| 658 | ! forcing diagnostics |
---|
| 659 | DO la=1,naero_grp |
---|
| 660 | |
---|
| 661 | |
---|
| 662 | CALL xios_add_child(tau1_hdl, child, "ODUVVIS_"//TRIM(mrfname(la))) |
---|
| 663 | CALL xios_set_attr(child,name="oduvvis"//TRIM(mrfname_xml(la)),long_name="Optical thickness band1 "//TRIM(mrfname_long(la))) |
---|
| 664 | CALL write_xml_info("ODUVVIS_"//TRIM(mrfname(la)),"oduvvis"//TRIM(mrfname_xml(la)),"Optical thickness band1 "//TRIM(mrfname_long(la)),"false","presnivs","false") |
---|
| 665 | |
---|
| 666 | CALL xios_add_child(tau2_hdl, child,"ODVISIR_"//TRIM(mrfname(la)) ) |
---|
| 667 | CALL xios_set_attr(child,name="odvisir"//TRIM(mrfname_xml(la)),long_name="Optical thickness band2 "//TRIM(mrfname_long(la))) |
---|
| 668 | CALL write_xml_info("ODVISIR_"//TRIM(mrfname(la)),"odvisir"//TRIM(mrfname_xml(la)),"Optical thickness band2 "//TRIM(mrfname_long(la)),"false","presnivs","false") |
---|
| 669 | |
---|
| 670 | CALL xios_add_child(piz1_hdl, child, "SSAUVVIS_"//TRIM(mrfname(la))) |
---|
| 671 | CALL xios_set_attr(child,name="ssauvvis"//TRIM(mrfname_xml(la)),long_name="Single scattering albedo band1 "//TRIM(mrfname_long(la))) |
---|
| 672 | CALL write_xml_info("SSAUVVIS_"//TRIM(mrfname(la)),"ssauvvis"//TRIM(mrfname_xml(la)),"Single scattering albedo band1 "//TRIM(mrfname_long(la)),"false","presnivs","false") |
---|
| 673 | |
---|
| 674 | CALL xios_add_child(piz2_hdl, child,"SSAVISIR_"//TRIM(mrfname(la)) ) |
---|
| 675 | CALL xios_set_attr(child,name="ssavisir"//TRIM(mrfname_xml(la)),long_name="Single scattering albedo band2 "//TRIM(mrfname_long(la))) |
---|
| 676 | CALL write_xml_info("SSAVISIR_"//TRIM(mrfname(la)),"ssavisir"//TRIM(mrfname_xml(la)),"Single scattering albedo band2 "//TRIM(mrfname_long(la)),"false","presnivs","false") |
---|
| 677 | |
---|
| 678 | CALL xios_add_child(cg1_hdl, child, "ASYUVVIS_"//TRIM(mrfname(la))) |
---|
| 679 | CALL xios_set_attr(child,name="asyuvvis"//TRIM(mrfname_xml(la)),long_name="Asymmetry parameter band1 "//TRIM(mrfname_long(la))) |
---|
| 680 | CALL write_xml_info("ASYUVVIS_"//TRIM(mrfname(la)),"asyuvvis"//TRIM(mrfname_xml(la)),"Asymmetry parameter band1 "//TRIM(mrfname_long(la)),"false","presnivs","false") |
---|
| 681 | |
---|
| 682 | CALL xios_add_child(cg2_hdl, child,"ASYVISIR_"//TRIM(mrfname(la)) ) |
---|
| 683 | CALL xios_set_attr(child,name="asyvisir"//TRIM(mrfname_xml(la)),long_name="Asymmetry parameter band2 "//TRIM(mrfname_long(la))) |
---|
| 684 | CALL write_xml_info("ASYVISIR_"//TRIM(mrfname(la)),"asyvisir"//TRIM(mrfname_xml(la)),"Asymmetry parameter band2 "//TRIM(mrfname_long(la)),"false","presnivs","false") |
---|
| 685 | |
---|
| 686 | |
---|
| 687 | CALL xios_add_child(swtoaas_hdl, child, "SWTOAAS_"//TRIM(mrfname(la)) ) |
---|
| 688 | CALL write_xml_info("SWTOAAS_"//TRIM(mrfname(la)),"SWTOAAS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 689 | |
---|
| 690 | CALL xios_add_child(swtoacs_hdl, child, "SWTOACS_"//TRIM(mrfname(la)) ) |
---|
| 691 | CALL write_xml_info("SWTOACS_"//TRIM(mrfname(la)),"SWTOACS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 692 | |
---|
| 693 | CALL xios_add_child(swsrfas_hdl, child, "SWSRFAS_"//TRIM(mrfname(la)) ) |
---|
| 694 | CALL write_xml_info("SWSRFAS_"//TRIM(mrfname(la)),"SWSRFAS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 695 | |
---|
| 696 | CALL xios_add_child(swsrfcs_hdl, child, "SWSRFCS_"//TRIM(mrfname(la)) ) |
---|
| 697 | CALL write_xml_info("SWSRFCS_"//TRIM(mrfname(la)),"SWSRFCS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 698 | |
---|
| 699 | CALL xios_add_child(fswtoaas_hdl, child, "FSWTOAAS_"//TRIM(mrfname(la)) ) |
---|
| 700 | CALL write_xml_info("FSWTOAAS_"//TRIM(mrfname(la)),"FSWTOAAS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 701 | |
---|
| 702 | CALL xios_add_child(fswtoacs_hdl, child, "FSWTOACS_"//TRIM(mrfname(la)) ) |
---|
| 703 | CALL write_xml_info("FSWTOACS_"//TRIM(mrfname(la)),"FSWTOACS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 704 | |
---|
| 705 | CALL xios_add_child(fswsrfas_hdl, child, "FSWSRFAS_"//TRIM(mrfname(la)) ) |
---|
| 706 | CALL write_xml_info("FSWSRFAS_"//TRIM(mrfname(la)),"FSWSRFAS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 707 | |
---|
| 708 | CALL xios_add_child(fswsrfcs_hdl, child, "FSWSRFCS_"//TRIM(mrfname(la)) ) |
---|
| 709 | CALL write_xml_info("FSWSRFCS_"//TRIM(mrfname(la)),"FSWSRFCS_"//TRIM(mrfname(la)),"false","false","false","false" ) |
---|
| 710 | |
---|
| 711 | |
---|
| 712 | ENDDO |
---|
| 713 | ENDIF |
---|
| 714 | |
---|
| 715 | IF (CoupSurfAtm) THEN !!! couplage avec orchidee |
---|
| 716 | |
---|
| 717 | ! declaration des emissions provenant du fichier non vegetales dans le cas d'un couplage avec Orchidee |
---|
| 718 | ! on traite differemment le cas des nombres ASN, AIN, SSN, CSN, CIN |
---|
| 719 | DO i=1,nb_flux |
---|
| 720 | length = len_trim(field_emi_names(i)) |
---|
| 721 | tmp_name = field_emi_names(i) |
---|
| 722 | CALL xios_add_child(emiNoBio_hdl,child,"EmiNoBio_"//TRIM(tmp_name(5:length))) |
---|
| 723 | CALL xios_set_attr(child,name="emiNoBio"//TRIM(tmp_name(5:length)), unit="kg m-2 s-1", long_name="Total Emission Rate of "//TRIM(TRIM(tmp_name(5:length))),enabled=.TRUE.) |
---|
| 724 | CALL write_xml_info("EmiNoBio_"//TRIM(tmp_name(5:length)), "emiNoBio_"//TRIM(tmp_name(5:length)),"Total Emission Rate of "//TRIM(TRIM(tmp_name(5:length))),"kg m-2 s-1","false",".TRUE.") |
---|
| 725 | ENDDO |
---|
| 726 | |
---|
| 727 | DO i=1,nb_flux |
---|
| 728 | length = len_trim(field_emi_names(i)) |
---|
| 729 | tmp_name = field_emi_names(i) |
---|
| 730 | CALL xios_add_child(emiNoBio_hdl,child,"EmiBio_"//TRIM(tmp_name(5:length))) |
---|
| 731 | CALL xios_set_attr(child,name="emiBio"//TRIM(tmp_name(5:length)), unit="kg m-2 s-1", long_name="Total Emission Rate of "//TRIM(TRIM(tmp_name(5:length))),enabled=.TRUE.) |
---|
| 732 | CALL write_xml_info("EmiBio_"//TRIM(tmp_name(5:length)), "emiBio_"//TRIM(tmp_name(5:length)),"Total Emission Rate of "//TRIM(TRIM(tmp_name(5:length))),"kg m-2 s-1","false",".TRUE.") |
---|
| 733 | ENDDO |
---|
| 734 | |
---|
| 735 | DO i=1,nb_flux |
---|
| 736 | CALL xios_set_field_attr("EmiNoBio_"//TRIM(tmp_name(5:length)), enabled=.TRUE.) |
---|
| 737 | CALL xios_set_field_attr("EmiBio_"//TRIM(tmp_name(5:length)), enabled=.TRUE.) |
---|
| 738 | CALL xios_set_field_attr(field_emi_names(i),enabled=.TRUE.) |
---|
| 739 | CALL xios_set_field_attr('tot'//field_emi_names(i),enabled=.TRUE.) |
---|
| 740 | ENDDO |
---|
| 741 | ENDIF |
---|
| 742 | |
---|
| 743 | ENDIF! IF(use_group)THEN |
---|
| 744 | |
---|
| 745 | |
---|
| 746 | |
---|
| 747 | #if defined(AER) && !defined(DUSS) |
---|
| 748 | IF (config_inca == 'aeNP') THEN |
---|
| 749 | !----------------------------------------------- |
---|
| 750 | ! desactivation de variables non calculee en nouvelle physique |
---|
| 751 | !----------------------------------------------- |
---|
| 752 | CALL xios_set_field_attr("SWTOAAS_AI" , enabled=.FALSE.) |
---|
| 753 | CALL xios_set_field_attr("SWSRFAS_AI" , enabled=.FALSE.) |
---|
| 754 | CALL xios_set_field_attr("FSWTOAAS_AI" , enabled=.FALSE.) |
---|
| 755 | CALL xios_set_field_attr("FSWSRFAS_AI" , enabled=.FALSE.) |
---|
| 756 | |
---|
| 757 | CALL xios_set_field_attr("Wet3D_ASSO4M" , enabled=.FALSE.) |
---|
| 758 | CALL xios_set_field_attr("Wet3D_ASNH4M" , enabled=.FALSE.) |
---|
| 759 | CALL xios_set_field_attr("Wet3D_ASNO3M" , enabled=.FALSE.) |
---|
| 760 | CALL xios_set_field_attr("Wet3D_CSNO3M" , enabled=.FALSE.) |
---|
| 761 | CALL xios_set_field_attr("Wet3D_CINO3M" , enabled=.FALSE.) |
---|
| 762 | CALL xios_set_field_attr("tautot_550" , enabled=.FALSE.) |
---|
| 763 | CALL xios_set_field_attr("tauant_550" , enabled=.FALSE.) |
---|
| 764 | CALL xios_set_field_attr("taunat_550" , enabled=.FALSE.) |
---|
| 765 | CALL xios_set_field_attr("SOLUBLE_LOAD" , enabled=.FALSE.) |
---|
| 766 | CALL xios_set_field_attr("SOLUBLE_LOAD_PI" , enabled=.FALSE.) |
---|
| 767 | CALL xios_set_field_attr("SOLUBLE_LOAD_ANTR" , enabled=.FALSE.) |
---|
| 768 | |
---|
| 769 | CALL xios_set_field_attr( "cforcTOA_0" , enabled=.FALSE.) |
---|
| 770 | CALL xios_set_field_attr( "cforcSRF_0" , enabled=.FALSE.) |
---|
| 771 | CALL xios_set_field_attr( "DcforcTOA_NAT" , enabled=.FALSE.) |
---|
| 772 | CALL xios_set_field_attr( "DcforcSRF_NAT" , enabled=.FALSE.) |
---|
| 773 | CALL xios_set_field_attr( "DcforcTOA_ANTR" , enabled=.FALSE.) |
---|
| 774 | CALL xios_set_field_attr( "DcforcSRF_ANTR" , enabled=.FALSE.) |
---|
| 775 | CALL xios_set_field_attr( "CLOUDfract" , enabled=.FALSE.) |
---|
| 776 | CALL xios_set_field_attr( "cRFtoa_nat" , enabled=.FALSE.) |
---|
| 777 | CALL xios_set_field_attr( "cRFsrf_nat" , enabled=.FALSE.) |
---|
| 778 | CALL xios_set_field_attr( "cRFtoa_antr" , enabled=.FALSE.) |
---|
| 779 | CALL xios_set_field_attr( "cRFsrf_antr" , enabled=.FALSE.) |
---|
| 780 | |
---|
| 781 | CALL xios_set_field_attr("SWTOAAS_AD" , enabled=.FALSE.) |
---|
| 782 | CALL xios_set_field_attr("SWTOACS_AD" , enabled=.FALSE.) |
---|
| 783 | CALL xios_set_field_attr("SWSRFAS_AD" , enabled=.FALSE.) |
---|
| 784 | CALL xios_set_field_attr("SWSRFCS_AD" , enabled=.FALSE.) |
---|
| 785 | CALL xios_set_field_attr("tops" , enabled=.FALSE.) |
---|
| 786 | CALL xios_set_field_attr("tops0" , enabled=.FALSE.) |
---|
| 787 | CALL xios_set_field_attr("topl" , enabled=.FALSE.) |
---|
| 788 | CALL xios_set_field_attr("topl0" , enabled=.FALSE.) |
---|
| 789 | |
---|
| 790 | CALL xios_set_field_attr("taucld" , enabled=.FALSE.) |
---|
| 791 | CALL xios_set_field_attr("taucldpi" , enabled=.FALSE.) |
---|
| 792 | CALL xios_set_field_attr("cldemi" , enabled=.FALSE.) |
---|
| 793 | CALL xios_set_field_attr("CCM1" , enabled=.FALSE.) |
---|
| 794 | CALL xios_set_field_attr("CCM2" , enabled=.FALSE.) |
---|
| 795 | |
---|
| 796 | |
---|
| 797 | ENDIF |
---|
| 798 | |
---|
| 799 | #endif |
---|
| 800 | |
---|
| 801 | ! |
---|
| 802 | !! 6. Close context |
---|
| 803 | ! |
---|
| 804 | CALL xios_close_context_definition() |
---|
| 805 | |
---|
| 806 | |
---|
| 807 | ! on interroge xios pour connaitre les dimensions de la grille vents 320x160 sur |
---|
| 808 | ! sur chaque proc mpi |
---|
| 809 | ! |
---|
| 810 | IF (.not. LMDZ_10m_winds) THEN |
---|
| 811 | call xios_get_domain_attr("wind_file", ni=ni_winds, nj=nj_winds) |
---|
| 812 | call xios_get_axis_attr("wind_time", n_glo=ntime_winds) |
---|
| 813 | endif |
---|
| 814 | |
---|
| 815 | call xios_get_axis_attr("chemLR_time", n_glo=ntime_chemLR) |
---|
| 816 | call xios_get_axis_attr("npp_time", n_glo=ntime_npp) |
---|
| 817 | call xios_get_axis_attr("landuse_type", n_glo=ntype_landuse) |
---|
| 818 | ! |
---|
| 819 | call xios_get_axis_attr("oxyd_time", n_glo=ntime_oxyd) |
---|
| 820 | call xios_get_axis_attr("oxyd_presnivs", n_glo=presnivs_oxyd) |
---|
| 821 | CALL xios_get_domain_attr("oxyd_dom", ni= ni_oxyd, nj= nj_oxyd) |
---|
| 822 | |
---|
| 823 | #ifdef GES |
---|
| 824 | CALL xios_get_axis_attr("time_co2_h", n_glo=ntime_co2h) |
---|
| 825 | #endif |
---|
| 826 | |
---|
| 827 | |
---|
| 828 | #endif |
---|
| 829 | !$OMP END MASTER |
---|
| 830 | |
---|
| 831 | IF (.not. LMDZ_10m_winds) THEN |
---|
| 832 | CALL bcast_omp(ni_winds) |
---|
| 833 | CALL bcast_omp(nj_winds) |
---|
| 834 | CALL bcast_omp(ntime_winds) |
---|
| 835 | endif |
---|
| 836 | CALL bcast_omp(ntime_chemLR) |
---|
| 837 | CALL bcast_omp(ntime_npp) |
---|
| 838 | CALL bcast_omp(ntype_landuse) |
---|
| 839 | CALL bcast_omp(ntime_oxyd) |
---|
| 840 | CALL bcast_omp(presnivs_oxyd) |
---|
| 841 | CALL bcast_omp(ni_oxyd) |
---|
| 842 | CALL bcast_omp(nj_oxyd) |
---|
| 843 | CALL bcast_omp(ntime_co2h) |
---|
| 844 | |
---|
| 845 | |
---|
| 846 | |
---|
| 847 | |
---|
| 848 | END SUBROUTINE xios_inca_init |
---|
| 849 | |
---|
| 850 | |
---|
| 851 | ! ====================================================================== |
---|
| 852 | ! SUBROUTINE : xios_inca_change_context |
---|
| 853 | ! |
---|
| 854 | ! Use this subroutine to switch between different context. |
---|
| 855 | ! This subroutine must be called when running in |
---|
| 856 | ! coupled mode at each time INCA is called, in the |
---|
| 857 | ! begining and end of intersurf_gathered. First call |
---|
| 858 | ! is done after xios_inca_init is done. |
---|
| 859 | ! |
---|
| 860 | ! |
---|
| 861 | ! |
---|
| 862 | ! ====================================================================== |
---|
| 863 | SUBROUTINE xios_inca_change_context(new_context) |
---|
| 864 | ! |
---|
| 865 | !! 0. Variable and parameter declaration |
---|
| 866 | ! |
---|
| 867 | !! Input variable |
---|
| 868 | CHARACTER(LEN=*),INTENT(IN) :: new_context |
---|
| 869 | |
---|
| 870 | !! Local variables |
---|
| 871 | #ifdef XIOS |
---|
| 872 | TYPE(xios_context) :: ctx_hdl |
---|
| 873 | #endif |
---|
| 874 | |
---|
| 875 | !$OMP MASTER |
---|
| 876 | #ifdef XIOS |
---|
| 877 | CALL xios_get_handle(new_context,ctx_hdl) |
---|
| 878 | CALL xios_set_current_context(ctx_hdl) |
---|
| 879 | #endif |
---|
| 880 | !$OMP END MASTER |
---|
| 881 | |
---|
| 882 | |
---|
| 883 | END SUBROUTINE xios_inca_change_context |
---|
| 884 | |
---|
| 885 | ! ==================================================================== |
---|
| 886 | ! SUBROUTINE : xios_inca_update_calendar |
---|
| 887 | ! |
---|
| 888 | ! Update the calandar in XIOS. |
---|
| 889 | ! |
---|
| 890 | ! DESCRIPTION : Update the calendar in XIOS : let XIOS know that INCA |
---|
| 891 | ! avanced one time-step. This subroutine should be called |
---|
| 892 | ! in the beginning of each time-step. The first |
---|
| 893 | ! time-step in a new execution should always start at 1. |
---|
| 894 | ! Therefore, first calculate an offset that is substracted |
---|
| 895 | ! to the current time step in sechiba. |
---|
| 896 | ! |
---|
| 897 | ! |
---|
| 898 | ! ==================================================================== |
---|
| 899 | SUBROUTINE xios_inca_update_calendar(itau) |
---|
| 900 | ! |
---|
| 901 | !! 0. Variable and parameter declaration |
---|
| 902 | ! |
---|
| 903 | !! 0.1 Input variables |
---|
| 904 | ! |
---|
| 905 | INTEGER, INTENT(IN) :: itau !! Current time step of the model |
---|
| 906 | ! |
---|
| 907 | |
---|
| 908 | !_ ================================================================== |
---|
| 909 | |
---|
| 910 | !$OMP MASTER |
---|
| 911 | #ifdef XIOS |
---|
| 912 | CALL xios_update_calendar(itau) |
---|
| 913 | #endif |
---|
| 914 | !$OMP END MASTER |
---|
| 915 | |
---|
| 916 | |
---|
| 917 | END SUBROUTINE xios_inca_update_calendar |
---|
| 918 | |
---|
| 919 | |
---|
| 920 | ! ===================================================================== |
---|
| 921 | ! SUBROUTINE : xios_inca_context_finalize |
---|
| 922 | ! |
---|
| 923 | ! Finalize inca context. |
---|
| 924 | ! |
---|
| 925 | ! DESCRIPTION : This subroutine finalizes the inca context without |
---|
| 926 | ! finalizing XIOS. In coupled mode, the atmospheric |
---|
| 927 | ! modele must finalize XIOS. This subroutine is |
---|
| 928 | ! called in the end of the execution of INCA only in |
---|
| 929 | ! coupeld mode. |
---|
| 930 | ! |
---|
| 931 | ! |
---|
| 932 | ! ====================================================================== |
---|
| 933 | SUBROUTINE xios_inca_context_finalize |
---|
| 934 | |
---|
| 935 | !$OMP MASTER |
---|
| 936 | #ifdef XIOS |
---|
| 937 | CALL xios_context_finalize() |
---|
| 938 | #endif |
---|
| 939 | !$OMP END MASTER |
---|
| 940 | |
---|
| 941 | |
---|
| 942 | END SUBROUTINE xios_inca_context_finalize |
---|
| 943 | |
---|
| 944 | |
---|
| 945 | |
---|
| 946 | |
---|
| 947 | ! ====================================================================== |
---|
| 948 | ! SUBROUTINE : xios_inca_send_field_r0d |
---|
| 949 | ! |
---|
| 950 | ! Subroutine for sending 1D (array) fields to XIOS. |
---|
| 951 | ! |
---|
| 952 | ! DESCRIPTION : Send one field to XIOS. This is the interface for 1D fields (array). |
---|
| 953 | ! NB! This subroutine should not be called directly. |
---|
| 954 | ! Use interface xios_inca_send_field. |
---|
| 955 | ! |
---|
| 956 | ! ===================================================================== |
---|
| 957 | SUBROUTINE xios_inca_send_field_r0d(field_id,field) |
---|
| 958 | ! |
---|
| 959 | !! 0. Variable and parameter declaration |
---|
| 960 | ! |
---|
| 961 | !! 0.1 Input variables |
---|
| 962 | ! |
---|
| 963 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 964 | REAL, INTENT(IN) :: field |
---|
| 965 | |
---|
| 966 | ! All master threads send the field to XIOS |
---|
| 967 | !$OMP MASTER |
---|
| 968 | #ifdef XIOS |
---|
| 969 | CALL xios_send_field(field_id,field) |
---|
| 970 | #endif |
---|
| 971 | !$OMP END MASTER |
---|
| 972 | |
---|
| 973 | |
---|
| 974 | END SUBROUTINE xios_inca_send_field_r0d |
---|
| 975 | |
---|
| 976 | ! ====================================================================== |
---|
| 977 | ! SUBROUTINE : xios_inca_send_field_r1d |
---|
| 978 | ! |
---|
| 979 | ! Subroutine for sending 2D (array) fields to XIOS. |
---|
| 980 | ! |
---|
| 981 | ! DESCRIPTION : Send one field to XIOS. This is the interface for 2D fields (array). |
---|
| 982 | ! NB! This subroutine should not be called directly. |
---|
| 983 | ! Use interface xios_inca_send_field. |
---|
| 984 | ! We modify the action in fonction of the array size. |
---|
| 985 | ! with the size(field) we will determinate if we need to |
---|
| 986 | ! transform this field on 2d grid or not. |
---|
| 987 | ! |
---|
| 988 | ! ===================================================================== |
---|
| 989 | SUBROUTINE xios_inca_send_field_r1d(field_id,field) |
---|
| 990 | USE INCA_DIM |
---|
| 991 | IMPLICIT NONE |
---|
| 992 | ! |
---|
| 993 | !! 0. Variable and parameter declaration |
---|
| 994 | ! |
---|
| 995 | !! 0.1 Input variables |
---|
| 996 | ! |
---|
| 997 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 998 | REAL, DIMENSION(:), INTENT(IN) :: field |
---|
| 999 | |
---|
| 1000 | !! 0.2 Local variables |
---|
| 1001 | REAL, DIMENSION(nbp_mpi) :: field_mpi |
---|
| 1002 | REAL, DIMENSION(iim_glo,jj_nb) :: field2d_mpi |
---|
| 1003 | |
---|
| 1004 | |
---|
| 1005 | IF (SIZE(field) .EQ. PLON) THEN |
---|
| 1006 | ! Gather all omp domains on the mpi domains |
---|
| 1007 | CALL gather_omp(field, field_mpi) |
---|
| 1008 | |
---|
| 1009 | ! All master threads send the field to XIOS |
---|
| 1010 | !$OMP MASTER |
---|
| 1011 | CALL grid1dTo2d_mpi(field_mpi,field2d_mpi) |
---|
| 1012 | #ifdef XIOS |
---|
| 1013 | CALL xios_send_field(field_id,field2d_mpi) |
---|
| 1014 | #endif |
---|
| 1015 | !$OMP END MASTER |
---|
| 1016 | |
---|
| 1017 | ELSEIF ((SIZE(field) .EQ. PLEV) .or. (SIZE(field) .EQ. PLEV+1)) THEN |
---|
| 1018 | |
---|
| 1019 | !$OMP MASTER |
---|
| 1020 | #ifdef XIOS |
---|
| 1021 | CALL xios_send_field(field_id,field) |
---|
| 1022 | #endif |
---|
| 1023 | !$OMP END MASTER |
---|
| 1024 | |
---|
| 1025 | ELSE IF (SIZE(field) .EQ. PLON_MPI) THEN ! Cas d'un appel purement mpi |
---|
| 1026 | |
---|
| 1027 | ! Gather all omp domains on the mpi domains |
---|
| 1028 | CALL grid1dTo2d_mpi(field,field2d_mpi) |
---|
| 1029 | #ifdef XIOS |
---|
| 1030 | CALL xios_send_field(field_id,field2d_mpi) |
---|
| 1031 | #endif |
---|
| 1032 | |
---|
| 1033 | ELSE ! le cas n'est pas prévu |
---|
| 1034 | |
---|
| 1035 | |
---|
| 1036 | WRITE(lunout,*) field_id, "xios_send_field r1d cas non prevu " |
---|
| 1037 | WRITE(lunout,*) "size ", field_id, " = ", size(field) , " different de ", PLON, PLEV, PLEV+1 , PLON_MPI |
---|
| 1038 | |
---|
| 1039 | STOP "see inca output " |
---|
| 1040 | |
---|
| 1041 | ENDIF |
---|
| 1042 | |
---|
| 1043 | |
---|
| 1044 | END SUBROUTINE xios_inca_send_field_r1d |
---|
| 1045 | |
---|
| 1046 | |
---|
| 1047 | |
---|
| 1048 | ! ========================================================================== |
---|
| 1049 | ! SUBROUTINE : xios_inca_send_field_r2d |
---|
| 1050 | ! |
---|
| 1051 | ! Subroutine for sending 2D fields to XIOS. |
---|
| 1052 | ! |
---|
| 1053 | ! DESCRIPTION : Send one field to XIOS. This is the interface for INCA 2D fields. |
---|
| 1054 | ! NB! This subroutine should not be called directly. |
---|
| 1055 | ! Use interface xios_inca_send_field. |
---|
| 1056 | ! with the size(field,1) we will determinate if we need to |
---|
| 1057 | ! transform this field on 2d grid or not. |
---|
| 1058 | ! |
---|
| 1059 | ! ========================================================================== |
---|
| 1060 | SUBROUTINE xios_inca_send_field_r2d(field_id,field) |
---|
| 1061 | USE PRINT_INCA |
---|
| 1062 | ! |
---|
| 1063 | !! 0. Variable and parameter declaration |
---|
| 1064 | ! |
---|
| 1065 | !! 0.1 Input variables |
---|
| 1066 | ! |
---|
| 1067 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1068 | REAL, DIMENSION(:,:), INTENT(IN) :: field |
---|
| 1069 | |
---|
| 1070 | !! 0.2 Local variables |
---|
| 1071 | REAL, DIMENSION(nbp_mpi,SIZE(field,2)) :: field_mpi |
---|
| 1072 | REAL, DIMENSION(iim_glo,jj_nb,SIZE(field,2)) :: field2d_mpi |
---|
| 1073 | |
---|
| 1074 | |
---|
| 1075 | IF (SIZE(field, 1) .EQ. PLON) THEN |
---|
| 1076 | |
---|
| 1077 | ! Gather all omp domains on the mpi domains |
---|
| 1078 | CALL gather_omp(field, field_mpi) |
---|
| 1079 | ! All master threads send the field to XIOS |
---|
| 1080 | !$OMP MASTER |
---|
| 1081 | CALL grid1dTo2d_mpi(field_mpi,field2d_mpi) |
---|
| 1082 | #ifdef XIOS |
---|
| 1083 | CALL xios_send_field(field_id,field2d_mpi) |
---|
| 1084 | #endif |
---|
| 1085 | !$OMP END MASTER |
---|
| 1086 | |
---|
| 1087 | ELSE |
---|
| 1088 | |
---|
| 1089 | !$OMP MASTER |
---|
| 1090 | CALL xios_send_field(field_id, field) |
---|
| 1091 | !$OMP END MASTER |
---|
| 1092 | |
---|
| 1093 | |
---|
| 1094 | ENDIF |
---|
| 1095 | |
---|
| 1096 | |
---|
| 1097 | END SUBROUTINE xios_inca_send_field_r2d |
---|
| 1098 | |
---|
| 1099 | |
---|
| 1100 | |
---|
| 1101 | SUBROUTINE xios_inca_recv_field_r0d(field_id,field) |
---|
| 1102 | USE PRINT_INCA |
---|
| 1103 | ! |
---|
| 1104 | !! 0. Variable and parameter declaration |
---|
| 1105 | ! |
---|
| 1106 | !! 0.1 Input variables |
---|
| 1107 | ! |
---|
| 1108 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1109 | |
---|
| 1110 | !! 0.2 Output variables |
---|
| 1111 | REAL, INTENT(OUT) :: field |
---|
| 1112 | |
---|
| 1113 | !_ ================================================================================================================================ |
---|
| 1114 | |
---|
| 1115 | |
---|
| 1116 | !$OMP MASTER |
---|
| 1117 | #ifdef XIOS |
---|
| 1118 | CALL xios_recv_field(field_id,field) |
---|
| 1119 | #endif |
---|
| 1120 | !$OMP END MASTER |
---|
| 1121 | call bcast_omp(field) |
---|
| 1122 | |
---|
| 1123 | |
---|
| 1124 | END SUBROUTINE xios_inca_recv_field_r0d |
---|
| 1125 | |
---|
| 1126 | |
---|
| 1127 | |
---|
| 1128 | |
---|
| 1129 | SUBROUTINE xios_inca_recv_field_r1d(field_id,field) |
---|
| 1130 | USE PRINT_INCA |
---|
| 1131 | ! |
---|
| 1132 | !! 0. Variable and parameter declaration |
---|
| 1133 | ! |
---|
| 1134 | !! 0.1 Input variables |
---|
| 1135 | ! |
---|
| 1136 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1137 | |
---|
| 1138 | !! 0.2 Output variables |
---|
| 1139 | REAL, DIMENSION(:), INTENT(OUT) :: field |
---|
| 1140 | REAL, DIMENSION(iim_glo,jj_nb) :: field2d_mpi |
---|
| 1141 | REAL, DIMENSION(PLON_MPI) :: field_mpi |
---|
| 1142 | |
---|
| 1143 | !_ ================================================================================================================================ |
---|
| 1144 | |
---|
| 1145 | ! All master threads recieve the field from XIOS |
---|
| 1146 | IF (size(field) .eq. PLON) THEN ! cas MPI_OMP |
---|
| 1147 | |
---|
| 1148 | |
---|
| 1149 | !$OMP MASTER |
---|
| 1150 | #ifdef XIOS |
---|
| 1151 | CALL xios_recv_field(field_id,field2d_mpi) |
---|
| 1152 | #endif |
---|
| 1153 | CALL grid2dTo1d_mpi(field2d_mpi, field_mpi) |
---|
| 1154 | !$OMP END MASTER |
---|
| 1155 | call scatter_omp(field_mpi, field) |
---|
| 1156 | |
---|
| 1157 | ELSE |
---|
| 1158 | |
---|
| 1159 | WRITE(lunout,*) field_id, 'Entering xios_inca_recv_field_r1d cas non prevu size = ', size(field), ' PLON = ', PLON |
---|
| 1160 | stop "exit see inca_output " |
---|
| 1161 | |
---|
| 1162 | ENDIF |
---|
| 1163 | |
---|
| 1164 | END SUBROUTINE xios_inca_recv_field_r1d |
---|
| 1165 | |
---|
| 1166 | |
---|
| 1167 | |
---|
| 1168 | |
---|
| 1169 | SUBROUTINE xios_inca_recv_field_r2d(field_id,field) |
---|
| 1170 | ! |
---|
| 1171 | !! 0. Variable and parameter declaration |
---|
| 1172 | ! |
---|
| 1173 | !! 0.1 Input variables |
---|
| 1174 | ! |
---|
| 1175 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1176 | |
---|
| 1177 | !! 0.2 Output variables |
---|
| 1178 | REAL, DIMENSION(:,:), INTENT(OUT) :: field |
---|
| 1179 | REAL, DIMENSION(iim_glo,jj_nb,SIZE(field,2)) :: field2d_mpi |
---|
| 1180 | REAL, DIMENSION(PLON_MPI,SIZE(field,2)) :: field_mpi |
---|
| 1181 | |
---|
| 1182 | |
---|
| 1183 | !_ ================================================================================================================================ |
---|
| 1184 | if (size(field,1) .eq. PLON) THEN |
---|
| 1185 | ! on va recevoir un champ en lon,lat et le transformer sur la grille 1d |
---|
| 1186 | !$OMP MASTER |
---|
| 1187 | #ifdef XIOS |
---|
| 1188 | CALL xios_recv_field(field_id,field2d_mpi) |
---|
| 1189 | #endif |
---|
| 1190 | CALL grid2dTo1d_mpi(field2d_mpi, field_mpi) |
---|
| 1191 | !$OMP END MASTER |
---|
| 1192 | call scatter_omp(field_mpi, field) |
---|
| 1193 | |
---|
| 1194 | ELSE |
---|
| 1195 | |
---|
| 1196 | |
---|
| 1197 | WRITE(lunout,*) field_id, 'cas non prevu xios_inca_recv_field_r2d, size = ',size(field,1), " PLON = ", PLON |
---|
| 1198 | STOP "see inca output " |
---|
| 1199 | |
---|
| 1200 | |
---|
| 1201 | ENDIF |
---|
| 1202 | |
---|
| 1203 | |
---|
| 1204 | END SUBROUTINE xios_inca_recv_field_r2d |
---|
| 1205 | |
---|
| 1206 | SUBROUTINE xios_inca_recv_field_r3d(field_id,field) |
---|
| 1207 | ! |
---|
| 1208 | !! 0. Variable and parameter declaration |
---|
| 1209 | ! |
---|
| 1210 | !! 0.1 Input variables |
---|
| 1211 | ! |
---|
| 1212 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1213 | |
---|
| 1214 | !! 0.2 Output variables |
---|
| 1215 | REAL, DIMENSION(:,:,:), INTENT(OUT) :: field |
---|
| 1216 | REAL, DIMENSION(iim_glo,jj_nb,SIZE(field,2), size(field,3)) :: field3d_mpi |
---|
| 1217 | REAL, DIMENSION(PLON_MPI,SIZE(field,2), size(field,3) ) :: field_mpi |
---|
| 1218 | |
---|
| 1219 | |
---|
| 1220 | !_ ================================================================================================================================ |
---|
| 1221 | |
---|
| 1222 | |
---|
| 1223 | ! All master threads recieve the field from XIOS |
---|
| 1224 | if (size(field,1) .eq. PLON) then |
---|
| 1225 | |
---|
| 1226 | ! on va recevoir un champ en lon,lat et le transformer sur la grille 1d |
---|
| 1227 | !$OMP MASTER |
---|
| 1228 | #ifdef XIOS |
---|
| 1229 | CALL xios_recv_field(field_id,field3d_mpi) |
---|
| 1230 | #endif |
---|
| 1231 | CALL grid2dTo1d_mpi(field3d_mpi, field_mpi) |
---|
| 1232 | !$OMP END MASTER |
---|
| 1233 | call scatter_omp(field_mpi, field) |
---|
| 1234 | |
---|
| 1235 | else |
---|
| 1236 | |
---|
| 1237 | WRITE(lunout,*) field_id, 'cas non prevu xios_inca_recv_field_r3d, size = ',size(field,1), " PLON = ", PLON |
---|
| 1238 | STOP "see inca output " |
---|
| 1239 | |
---|
| 1240 | |
---|
| 1241 | endif |
---|
| 1242 | |
---|
| 1243 | END SUBROUTINE xios_inca_recv_field_r3d |
---|
| 1244 | |
---|
| 1245 | |
---|
| 1246 | |
---|
| 1247 | SUBROUTINE xios_inca_recv_field_mpi_r1d(field_id,field) |
---|
| 1248 | USE PRINT_INCA |
---|
| 1249 | ! |
---|
| 1250 | !! 0. Variable and parameter declaration |
---|
| 1251 | ! |
---|
| 1252 | !! 0.1 Input variables |
---|
| 1253 | ! |
---|
| 1254 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1255 | |
---|
| 1256 | !! 0.2 Output variables |
---|
| 1257 | REAL, DIMENSION(:), INTENT(OUT) :: field |
---|
| 1258 | REAL, DIMENSION(iim_glo,jj_nb) :: field2d_mpi |
---|
| 1259 | REAL, DIMENSION(PLON_MPI) :: field_mpi |
---|
| 1260 | |
---|
| 1261 | !_ ================================================================================================================================ |
---|
| 1262 | WRITE(lunout,*) 'Entering xios_inca_recv_field_mpi_r1d, field_id=',field_id |
---|
| 1263 | |
---|
| 1264 | ! All master threads recieve the field from XIOS |
---|
| 1265 | IF (SIZE(field) .EQ. PLON_MPI) THEN ! cas purement MPI |
---|
| 1266 | |
---|
| 1267 | WRITE(lunout,*) 'Entering xios_inca_recv_field_r1d cas PLON_MPI' |
---|
| 1268 | |
---|
| 1269 | |
---|
| 1270 | #ifdef XIOS |
---|
| 1271 | CALL xios_recv_field(field_id,field2d_mpi) |
---|
| 1272 | #endif |
---|
| 1273 | CALL grid2dTo1d_mpi(field2d_mpi, field) |
---|
| 1274 | |
---|
| 1275 | ELSE |
---|
| 1276 | |
---|
| 1277 | WRITE(lunout,*) field_id, " xios_inca_recv_field_mpi_r1d size", size(field), " is not PLON_MPI ", PLON_MPI |
---|
| 1278 | STOP "see inca output " |
---|
| 1279 | |
---|
| 1280 | ENDIF |
---|
| 1281 | |
---|
| 1282 | END SUBROUTINE xios_inca_recv_field_mpi_r1d |
---|
| 1283 | |
---|
| 1284 | |
---|
| 1285 | |
---|
| 1286 | |
---|
| 1287 | |
---|
| 1288 | |
---|
| 1289 | SUBROUTINE xios_inca_recv_field_glo_r1d(field_id,field) |
---|
| 1290 | |
---|
| 1291 | USE PRINT_INCA |
---|
| 1292 | ! |
---|
| 1293 | !! 0. Variable and parameter declaration |
---|
| 1294 | ! |
---|
| 1295 | !! 0.1 Input variables |
---|
| 1296 | ! |
---|
| 1297 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1298 | |
---|
| 1299 | !! 0.2 Output variables |
---|
| 1300 | REAL, DIMENSION(:), INTENT(OUT) :: field |
---|
| 1301 | |
---|
| 1302 | |
---|
| 1303 | !$OMP MASTER |
---|
| 1304 | #ifdef XIOS |
---|
| 1305 | CALL xios_recv_field(field_id,field) |
---|
| 1306 | #endif |
---|
| 1307 | !$OMP END MASTER |
---|
| 1308 | CALL bcast_omp(field) |
---|
| 1309 | |
---|
| 1310 | END SUBROUTINE xios_inca_recv_field_glo_r1d |
---|
| 1311 | |
---|
| 1312 | |
---|
| 1313 | |
---|
| 1314 | SUBROUTINE xios_inca_recv_field_glo_r2d(field_id,field) |
---|
| 1315 | |
---|
| 1316 | USE PRINT_INCA |
---|
| 1317 | ! |
---|
| 1318 | !! 0. Variable and parameter declaration |
---|
| 1319 | ! |
---|
| 1320 | !! 0.1 Input variables |
---|
| 1321 | ! |
---|
| 1322 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1323 | |
---|
| 1324 | !! 0.2 Output variables |
---|
| 1325 | REAL, DIMENSION(:,:), INTENT(OUT) :: field |
---|
| 1326 | |
---|
| 1327 | |
---|
| 1328 | !$OMP MASTER |
---|
| 1329 | #ifdef XIOS |
---|
| 1330 | CALL xios_recv_field(field_id,field) |
---|
| 1331 | #endif |
---|
| 1332 | !$OMP END MASTER |
---|
| 1333 | CALL bcast_omp(field) |
---|
| 1334 | |
---|
| 1335 | END SUBROUTINE xios_inca_recv_field_glo_r2d |
---|
| 1336 | |
---|
| 1337 | |
---|
| 1338 | |
---|
| 1339 | |
---|
| 1340 | |
---|
| 1341 | SUBROUTINE xios_inca_recv_field_glo_r3d(field_id,field) |
---|
| 1342 | |
---|
| 1343 | USE PRINT_INCA |
---|
| 1344 | ! |
---|
| 1345 | !! 0. Variable and parameter declaration |
---|
| 1346 | ! |
---|
| 1347 | !! 0.1 Input variables |
---|
| 1348 | ! |
---|
| 1349 | CHARACTER(len=*), INTENT(IN) :: field_id |
---|
| 1350 | |
---|
| 1351 | !! 0.2 Output variables |
---|
| 1352 | REAL, DIMENSION(:,:,:), INTENT(OUT) :: field |
---|
| 1353 | |
---|
| 1354 | |
---|
| 1355 | |
---|
| 1356 | !$OMP MASTER |
---|
| 1357 | #ifdef XIOS |
---|
| 1358 | CALL xios_recv_field(field_id,field) |
---|
| 1359 | #endif |
---|
| 1360 | !$OMP END MASTER |
---|
| 1361 | CALL bcast_omp(field) |
---|
| 1362 | |
---|
| 1363 | END SUBROUTINE xios_inca_recv_field_glo_r3d |
---|
| 1364 | |
---|
| 1365 | |
---|
| 1366 | |
---|
| 1367 | |
---|
| 1368 | |
---|
| 1369 | SUBROUTINE write_xml_info(str1, str2, str3, str4, str5, str6) |
---|
| 1370 | CHARACTER(LEN=*) , INTENT(in):: str1,str2,str3, str4, str5, str6 |
---|
| 1371 | CHARACTER(LEN=200) :: str3_out,str4_out,str5_out, str6_out |
---|
| 1372 | |
---|
| 1373 | !$OMP MASTER |
---|
| 1374 | IF (is_mpi_root) THEN |
---|
| 1375 | ! WRITE(outxml,*) "ID = ", str1," / name = ", str2," |
---|
| 1376 | IF(str3=='false') THEN |
---|
| 1377 | str3_out=' ' |
---|
| 1378 | ELSE |
---|
| 1379 | str3_out=' long_name="'//TRIM(str3)//'" ' |
---|
| 1380 | ENDIF |
---|
| 1381 | |
---|
| 1382 | IF(str4=='false') THEN |
---|
| 1383 | str4_out=' ' |
---|
| 1384 | ELSE |
---|
| 1385 | str4_out=' unit="'//TRIM(str4)//'" ' |
---|
| 1386 | ENDIF |
---|
| 1387 | |
---|
| 1388 | IF(str5=='false') THEN |
---|
| 1389 | str5_out=' ' |
---|
| 1390 | ELSE |
---|
| 1391 | str5_out=' axis_ref="'//TRIM(str5)//'" ' |
---|
| 1392 | ENDIF |
---|
| 1393 | |
---|
| 1394 | IF(str6=='false') THEN |
---|
| 1395 | str6_out=' ' |
---|
| 1396 | ELSE |
---|
| 1397 | str6_out=' enabled="'//TRIM(str6)//'" ' |
---|
| 1398 | ENDIF |
---|
| 1399 | |
---|
| 1400 | WRITE(outxml,"(4x,a,a,a,a,a,a,a,/)", advance="no") '<field id="'//TRIM(str1)//TRIM('"'),' name="'//TRIM(str2)//TRIM('"'),TRIM(str3_out),TRIM(str4_out),TRIM(str5_out),TRIM(str6_out),TRIM('/>') |
---|
| 1401 | |
---|
| 1402 | ENDIF |
---|
| 1403 | !$OMP END MASTER |
---|
| 1404 | |
---|
| 1405 | END SUBROUTINE write_xml_info |
---|
| 1406 | |
---|
| 1407 | END MODULE xios_inca |
---|
| 1408 | |
---|
| 1409 | |
---|