[782] | 1 | ! |
---|
| 2 | MODULE oasis |
---|
| 3 | ! |
---|
| 4 | ! This module contains subroutines for initialization, sending and receiving |
---|
| 5 | ! towards the coupler OASIS3. It also contains some parameters for the coupling. |
---|
| 6 | ! |
---|
| 7 | ! This module should always be compiled. With the coupler OASIS3 available the cpp key |
---|
| 8 | ! CPP_COUPLE should be set and the entier of this file will then be compiled. |
---|
| 9 | ! In a forced mode CPP_COUPLE should not be defined and the compilation ends before |
---|
| 10 | ! the CONTAINS, without compiling the subroutines. |
---|
| 11 | ! |
---|
| 12 | USE dimphy |
---|
| 13 | USE mod_phys_lmdz_para |
---|
| 14 | USE write_field_phy |
---|
| 15 | |
---|
| 16 | #ifdef CPP_COUPLE |
---|
[1965] | 17 | ! Use of Oasis-MCT coupler |
---|
| 18 | #if defined CPP_OMCT |
---|
| 19 | USE mod_prism |
---|
| 20 | ! Use of Oasis3 coupler |
---|
| 21 | #else |
---|
[782] | 22 | USE mod_prism_proto |
---|
| 23 | USE mod_prism_def_partition_proto |
---|
| 24 | USE mod_prism_get_proto |
---|
| 25 | USE mod_prism_put_proto |
---|
| 26 | #endif |
---|
[1965] | 27 | #endif |
---|
[782] | 28 | |
---|
| 29 | IMPLICIT NONE |
---|
[1279] | 30 | |
---|
| 31 | ! Id for fields sent to ocean |
---|
| 32 | INTEGER, PARAMETER :: ids_tauxxu = 1 |
---|
| 33 | INTEGER, PARAMETER :: ids_tauyyu = 2 |
---|
| 34 | INTEGER, PARAMETER :: ids_tauzzu = 3 |
---|
| 35 | INTEGER, PARAMETER :: ids_tauxxv = 4 |
---|
| 36 | INTEGER, PARAMETER :: ids_tauyyv = 5 |
---|
| 37 | INTEGER, PARAMETER :: ids_tauzzv = 6 |
---|
| 38 | INTEGER, PARAMETER :: ids_windsp = 7 |
---|
| 39 | INTEGER, PARAMETER :: ids_shfice = 8 |
---|
| 40 | INTEGER, PARAMETER :: ids_shfoce = 9 |
---|
| 41 | INTEGER, PARAMETER :: ids_shftot = 10 |
---|
| 42 | INTEGER, PARAMETER :: ids_nsfice = 11 |
---|
| 43 | INTEGER, PARAMETER :: ids_nsfoce = 12 |
---|
| 44 | INTEGER, PARAMETER :: ids_nsftot = 13 |
---|
| 45 | INTEGER, PARAMETER :: ids_dflxdt = 14 |
---|
| 46 | INTEGER, PARAMETER :: ids_totrai = 15 |
---|
| 47 | INTEGER, PARAMETER :: ids_totsno = 16 |
---|
| 48 | INTEGER, PARAMETER :: ids_toteva = 17 |
---|
| 49 | INTEGER, PARAMETER :: ids_icevap = 18 |
---|
| 50 | INTEGER, PARAMETER :: ids_ocevap = 19 |
---|
| 51 | INTEGER, PARAMETER :: ids_calvin = 20 |
---|
| 52 | INTEGER, PARAMETER :: ids_liqrun = 21 |
---|
| 53 | INTEGER, PARAMETER :: ids_runcoa = 22 |
---|
| 54 | INTEGER, PARAMETER :: ids_rivflu = 23 |
---|
| 55 | INTEGER, PARAMETER :: ids_atmco2 = 24 |
---|
| 56 | INTEGER, PARAMETER :: ids_taumod = 25 |
---|
[2872] | 57 | INTEGER, PARAMETER :: ids_qraioc = 26 |
---|
| 58 | INTEGER, PARAMETER :: ids_qsnooc = 27 |
---|
| 59 | INTEGER, PARAMETER :: ids_qraiic = 28 |
---|
| 60 | INTEGER, PARAMETER :: ids_qsnoic = 29 |
---|
[4370] | 61 | INTEGER, PARAMETER :: ids_delta_sst = 30, ids_delta_sal = 31, ids_dter = 32, & |
---|
| 62 | ids_dser = 33, ids_dt_ds = 34 |
---|
[1279] | 63 | |
---|
[4370] | 64 | INTEGER, PARAMETER :: maxsend = 34 ! Maximum number of fields to send |
---|
[3815] | 65 | |
---|
[1279] | 66 | ! Id for fields received from ocean |
---|
[3815] | 67 | |
---|
[1279] | 68 | INTEGER, PARAMETER :: idr_sisutw = 1 |
---|
| 69 | INTEGER, PARAMETER :: idr_icecov = 2 |
---|
| 70 | INTEGER, PARAMETER :: idr_icealw = 3 |
---|
| 71 | INTEGER, PARAMETER :: idr_icetem = 4 |
---|
| 72 | INTEGER, PARAMETER :: idr_curenx = 5 |
---|
| 73 | INTEGER, PARAMETER :: idr_cureny = 6 |
---|
| 74 | INTEGER, PARAMETER :: idr_curenz = 7 |
---|
| 75 | INTEGER, PARAMETER :: idr_oceco2 = 8 |
---|
[4640] | 76 | ! bulk salinity of the surface layer of the ocean, in ppt |
---|
[3815] | 77 | INTEGER, PARAMETER :: idr_sss = 9 |
---|
[4640] | 78 | INTEGER, PARAMETER :: idr_ocedms = 10 |
---|
[4754] | 79 | INTEGER, PARAMETER :: idr_ocen2o = 11 |
---|
[3815] | 80 | |
---|
[4754] | 81 | INTEGER, PARAMETER :: maxrecv = 11 ! Maximum number of fields to receive |
---|
[4640] | 82 | INTEGER, PARAMETER :: maxrecv_phys = 9 ! Maximum number of fields to receive in physiq (without fields received in INCA model ) |
---|
| 83 | ! will be changed in next version - INCA fields will be received in LMDZ (like for ORCHIDEE fields) |
---|
| 84 | ! and then send by routine in INCA model |
---|
[1279] | 85 | |
---|
[782] | 86 | |
---|
[1279] | 87 | TYPE, PUBLIC :: FLD_CPL ! Type for coupling field information |
---|
| 88 | CHARACTER(len = 8) :: name ! Name of the coupling field |
---|
| 89 | LOGICAL :: action ! To be exchanged or not |
---|
| 90 | INTEGER :: nid ! Id of the field |
---|
| 91 | END TYPE FLD_CPL |
---|
[782] | 92 | |
---|
[1279] | 93 | TYPE(FLD_CPL), DIMENSION(maxsend), SAVE, PUBLIC :: infosend ! Information for sending coupling fields |
---|
[2916] | 94 | !$OMP THREADPRIVATE(infosend) |
---|
[1279] | 95 | TYPE(FLD_CPL), DIMENSION(maxrecv), SAVE, PUBLIC :: inforecv ! Information for receiving coupling fields |
---|
[2916] | 96 | !$OMP THREADPRIVATE(inforecv) |
---|
[1279] | 97 | |
---|
| 98 | LOGICAL,SAVE :: cpl_current |
---|
| 99 | !$OMP THREADPRIVATE(cpl_current) |
---|
[782] | 100 | |
---|
| 101 | #ifdef CPP_COUPLE |
---|
| 102 | |
---|
| 103 | CONTAINS |
---|
| 104 | |
---|
| 105 | SUBROUTINE inicma |
---|
| 106 | !************************************************************************************ |
---|
| 107 | !**** *INICMA* - Initialize coupled mode communication for atmosphere |
---|
| 108 | ! and exchange some initial information with Oasis |
---|
| 109 | ! |
---|
| 110 | ! Rewrite to take the PRISM/psmile library into account |
---|
| 111 | ! LF 09/2003 |
---|
| 112 | ! |
---|
[1067] | 113 | USE IOIPSL |
---|
[996] | 114 | USE surface_data, ONLY : version_ocean |
---|
[1279] | 115 | USE carbon_cycle_mod, ONLY : carbon_cycle_cpl |
---|
[5310] | 116 | use wxios_mod, ONLY : wxios_context_init |
---|
[4754] | 117 | USE chemistry_cycle_mod, ONLY : dms_cycle_cpl, n2o_cycle_cpl |
---|
[4619] | 118 | USE lmdz_xios |
---|
[2311] | 119 | USE print_control_mod, ONLY: lunout |
---|
[3465] | 120 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat, grid_type, unstructured, regular_lonlat |
---|
| 121 | USE geometry_mod, ONLY: ind_cell_glo |
---|
| 122 | USE mod_phys_lmdz_mpi_data, ONLY: klon_mpi_para_nb |
---|
[3815] | 123 | use config_ocean_skin_m, only: activate_ocean_skin |
---|
[5251] | 124 | USE lmdz_cppkeys_wrapper, ONLY: CPPKEY_INCA |
---|
[1279] | 125 | |
---|
[782] | 126 | ! Local variables |
---|
| 127 | !************************************************************************************ |
---|
| 128 | INTEGER :: comp_id |
---|
| 129 | INTEGER :: ierror, il_commlocal |
---|
| 130 | INTEGER :: il_part_id |
---|
[3465] | 131 | INTEGER, ALLOCATABLE :: ig_paral(:) |
---|
[782] | 132 | INTEGER, DIMENSION(2) :: il_var_nodims |
---|
| 133 | INTEGER, DIMENSION(4) :: il_var_actual_shape |
---|
| 134 | INTEGER :: il_var_type |
---|
| 135 | INTEGER :: jf |
---|
| 136 | CHARACTER (len = 6) :: clmodnam |
---|
| 137 | CHARACTER (len = 20) :: modname = 'inicma' |
---|
| 138 | CHARACTER (len = 80) :: abort_message |
---|
[1997] | 139 | LOGICAL, SAVE :: cpl_current_omp |
---|
[4596] | 140 | INTEGER, DIMENSION(klon_mpi) :: ind_cell_glo_mpi |
---|
[782] | 141 | |
---|
[5483] | 142 | !$OMP THREADPRIVATE(cpl_current_omp) |
---|
| 143 | |
---|
| 144 | |
---|
[782] | 145 | !* 1. Initializations |
---|
| 146 | ! --------------- |
---|
| 147 | !************************************************************************************ |
---|
[1279] | 148 | WRITE(lunout,*) ' ' |
---|
| 149 | WRITE(lunout,*) ' ' |
---|
| 150 | WRITE(lunout,*) ' ROUTINE INICMA' |
---|
| 151 | WRITE(lunout,*) ' **************' |
---|
| 152 | WRITE(lunout,*) ' ' |
---|
| 153 | WRITE(lunout,*) ' ' |
---|
[782] | 154 | |
---|
| 155 | ! |
---|
| 156 | ! Define the model name |
---|
| 157 | ! |
---|
[3465] | 158 | IF (grid_type==unstructured) THEN |
---|
| 159 | clmodnam = 'icosa' ! as in $NBMODEL in Cpl/Nam/namcouple.tmp |
---|
| 160 | ELSE IF (grid_type==regular_lonlat) THEN |
---|
| 161 | clmodnam = 'LMDZ' ! as in $NBMODEL in Cpl/Nam/namcouple.tmp |
---|
| 162 | ELSE |
---|
| 163 | abort_message='Pb : type of grid unknown' |
---|
| 164 | CALL abort_physic(modname,abort_message,1) |
---|
| 165 | ENDIF |
---|
[1067] | 166 | |
---|
[1279] | 167 | |
---|
[782] | 168 | !************************************************************************************ |
---|
[1067] | 169 | ! Define if coupling ocean currents or not |
---|
| 170 | !************************************************************************************ |
---|
| 171 | !$OMP MASTER |
---|
| 172 | cpl_current_omp = .FALSE. |
---|
| 173 | CALL getin('cpl_current', cpl_current_omp) |
---|
| 174 | !$OMP END MASTER |
---|
| 175 | !$OMP BARRIER |
---|
| 176 | cpl_current = cpl_current_omp |
---|
[1279] | 177 | WRITE(lunout,*) 'Couple ocean currents, cpl_current = ',cpl_current |
---|
[1067] | 178 | |
---|
| 179 | !************************************************************************************ |
---|
[4596] | 180 | ! Gather global index to be used for oasis decomposition |
---|
| 181 | !************************************************************************************ |
---|
| 182 | CALL gather_omp(ind_cell_glo,ind_cell_glo_mpi) |
---|
| 183 | |
---|
| 184 | !************************************************************************************ |
---|
[1279] | 185 | ! Define coupling variables |
---|
| 186 | !************************************************************************************ |
---|
| 187 | |
---|
| 188 | ! Atmospheric variables to send |
---|
| 189 | |
---|
| 190 | !$OMP MASTER |
---|
| 191 | infosend(:)%action = .FALSE. |
---|
| 192 | |
---|
| 193 | infosend(ids_tauxxu)%action = .TRUE. ; infosend(ids_tauxxu)%name = 'COTAUXXU' |
---|
| 194 | infosend(ids_tauyyu)%action = .TRUE. ; infosend(ids_tauyyu)%name = 'COTAUYYU' |
---|
| 195 | infosend(ids_tauzzu)%action = .TRUE. ; infosend(ids_tauzzu)%name = 'COTAUZZU' |
---|
| 196 | infosend(ids_tauxxv)%action = .TRUE. ; infosend(ids_tauxxv)%name = 'COTAUXXV' |
---|
| 197 | infosend(ids_tauyyv)%action = .TRUE. ; infosend(ids_tauyyv)%name = 'COTAUYYV' |
---|
| 198 | infosend(ids_tauzzv)%action = .TRUE. ; infosend(ids_tauzzv)%name = 'COTAUZZV' |
---|
| 199 | infosend(ids_windsp)%action = .TRUE. ; infosend(ids_windsp)%name = 'COWINDSP' |
---|
| 200 | infosend(ids_shfice)%action = .TRUE. ; infosend(ids_shfice)%name = 'COSHFICE' |
---|
| 201 | infosend(ids_nsfice)%action = .TRUE. ; infosend(ids_nsfice)%name = 'CONSFICE' |
---|
| 202 | infosend(ids_dflxdt)%action = .TRUE. ; infosend(ids_dflxdt)%name = 'CODFLXDT' |
---|
| 203 | infosend(ids_calvin)%action = .TRUE. ; infosend(ids_calvin)%name = 'COCALVIN' |
---|
| 204 | |
---|
[3815] | 205 | if (activate_ocean_skin == 2) then |
---|
| 206 | infosend(ids_delta_sst)%action = .TRUE. |
---|
| 207 | infosend(ids_delta_sst)%name = 'CODELSST' |
---|
| 208 | infosend(ids_delta_sal)%action = .TRUE. |
---|
| 209 | infosend(ids_delta_sal)%name = 'CODELSSS' |
---|
[4370] | 210 | infosend(ids_dter)%action = .TRUE. |
---|
| 211 | infosend(ids_dter)%name = 'CODELTER' |
---|
| 212 | infosend(ids_dser)%action = .TRUE. |
---|
| 213 | infosend(ids_dser)%name = 'CODELSER' |
---|
| 214 | infosend(ids_dt_ds)%action = .TRUE. |
---|
| 215 | infosend(ids_dt_ds)%name = 'CODTDS' |
---|
[3815] | 216 | end if |
---|
| 217 | |
---|
[1279] | 218 | IF (version_ocean=='nemo') THEN |
---|
| 219 | infosend(ids_shftot)%action = .TRUE. ; infosend(ids_shftot)%name = 'COQSRMIX' |
---|
| 220 | infosend(ids_nsftot)%action = .TRUE. ; infosend(ids_nsftot)%name = 'COQNSMIX' |
---|
| 221 | infosend(ids_totrai)%action = .TRUE. ; infosend(ids_totrai)%name = 'COTOTRAI' |
---|
| 222 | infosend(ids_totsno)%action = .TRUE. ; infosend(ids_totsno)%name = 'COTOTSNO' |
---|
| 223 | infosend(ids_toteva)%action = .TRUE. ; infosend(ids_toteva)%name = 'COTOTEVA' |
---|
| 224 | infosend(ids_icevap)%action = .TRUE. ; infosend(ids_icevap)%name = 'COICEVAP' |
---|
| 225 | infosend(ids_liqrun)%action = .TRUE. ; infosend(ids_liqrun)%name = 'COLIQRUN' |
---|
| 226 | infosend(ids_taumod)%action = .TRUE. ; infosend(ids_taumod)%name = 'COTAUMOD' |
---|
| 227 | IF (carbon_cycle_cpl) THEN |
---|
| 228 | infosend(ids_atmco2)%action = .TRUE. ; infosend(ids_atmco2)%name = 'COATMCO2' |
---|
| 229 | ENDIF |
---|
[2872] | 230 | infosend(ids_qraioc)%action = .TRUE. ; infosend(ids_qraioc)%name = 'COQRAIOC' |
---|
| 231 | infosend(ids_qsnooc)%action = .TRUE. ; infosend(ids_qsnooc)%name = 'COQSNOOC' |
---|
| 232 | infosend(ids_qraiic)%action = .TRUE. ; infosend(ids_qraiic)%name = 'COQRAIIC' |
---|
| 233 | infosend(ids_qsnoic)%action = .TRUE. ; infosend(ids_qsnoic)%name = 'COQSNOIC' |
---|
[1279] | 234 | |
---|
| 235 | ELSE IF (version_ocean=='opa8') THEN |
---|
| 236 | infosend(ids_shfoce)%action = .TRUE. ; infosend(ids_shfoce)%name = 'COSHFOCE' |
---|
| 237 | infosend(ids_nsfoce)%action = .TRUE. ; infosend(ids_nsfoce)%name = 'CONSFOCE' |
---|
| 238 | infosend(ids_icevap)%action = .TRUE. ; infosend(ids_icevap)%name = 'COTFSICE' |
---|
| 239 | infosend(ids_ocevap)%action = .TRUE. ; infosend(ids_ocevap)%name = 'COTFSOCE' |
---|
| 240 | infosend(ids_totrai)%action = .TRUE. ; infosend(ids_totrai)%name = 'COTOLPSU' |
---|
| 241 | infosend(ids_totsno)%action = .TRUE. ; infosend(ids_totsno)%name = 'COTOSPSU' |
---|
| 242 | infosend(ids_runcoa)%action = .TRUE. ; infosend(ids_runcoa)%name = 'CORUNCOA' |
---|
| 243 | infosend(ids_rivflu)%action = .TRUE. ; infosend(ids_rivflu)%name = 'CORIVFLU' |
---|
| 244 | ENDIF |
---|
| 245 | |
---|
| 246 | ! Oceanic variables to receive |
---|
| 247 | |
---|
| 248 | inforecv(:)%action = .FALSE. |
---|
| 249 | |
---|
| 250 | inforecv(idr_sisutw)%action = .TRUE. ; inforecv(idr_sisutw)%name = 'SISUTESW' |
---|
| 251 | inforecv(idr_icecov)%action = .TRUE. ; inforecv(idr_icecov)%name = 'SIICECOV' |
---|
| 252 | inforecv(idr_icealw)%action = .TRUE. ; inforecv(idr_icealw)%name = 'SIICEALW' |
---|
| 253 | inforecv(idr_icetem)%action = .TRUE. ; inforecv(idr_icetem)%name = 'SIICTEMW' |
---|
[3815] | 254 | |
---|
| 255 | if (activate_ocean_skin >= 1) then |
---|
| 256 | inforecv(idr_sss)%action = .TRUE. |
---|
| 257 | inforecv(idr_sss)%name = 'SISUSALW' |
---|
| 258 | end if |
---|
[1279] | 259 | |
---|
| 260 | IF (cpl_current ) THEN |
---|
| 261 | inforecv(idr_curenx)%action = .TRUE. ; inforecv(idr_curenx)%name = 'CURRENTX' |
---|
| 262 | inforecv(idr_cureny)%action = .TRUE. ; inforecv(idr_cureny)%name = 'CURRENTY' |
---|
| 263 | inforecv(idr_curenz)%action = .TRUE. ; inforecv(idr_curenz)%name = 'CURRENTZ' |
---|
| 264 | ENDIF |
---|
| 265 | |
---|
| 266 | IF (carbon_cycle_cpl ) THEN |
---|
| 267 | inforecv(idr_oceco2)%action = .TRUE. ; inforecv(idr_oceco2)%name = 'SICO2FLX' |
---|
| 268 | ENDIF |
---|
[4640] | 269 | IF (dms_cycle_cpl) THEN |
---|
| 270 | inforecv(idr_ocedms)%action = .TRUE. ; inforecv(idr_ocedms)%name = 'SIDMSFLX' |
---|
| 271 | ENDIF |
---|
[4754] | 272 | IF (n2o_cycle_cpl) THEN |
---|
| 273 | inforecv(idr_ocen2o)%action = .TRUE. ; inforecv(idr_ocen2o)%name = 'SIN2OFLX' |
---|
| 274 | ENDIF |
---|
[4640] | 275 | |
---|
[1279] | 276 | |
---|
| 277 | !************************************************************************************ |
---|
[782] | 278 | ! Here we go: psmile initialisation |
---|
| 279 | !************************************************************************************ |
---|
| 280 | IF (is_sequential) THEN |
---|
| 281 | CALL prism_init_comp_proto (comp_id, clmodnam, ierror) |
---|
| 282 | |
---|
| 283 | IF (ierror .NE. PRISM_Ok) THEN |
---|
| 284 | abort_message=' Probleme init dans prism_init_comp ' |
---|
[2311] | 285 | CALL abort_physic(modname,abort_message,1) |
---|
[782] | 286 | ELSE |
---|
[1279] | 287 | WRITE(lunout,*) 'inicma : init psmile ok ' |
---|
[782] | 288 | ENDIF |
---|
| 289 | ENDIF |
---|
| 290 | |
---|
| 291 | CALL prism_get_localcomm_proto (il_commlocal, ierror) |
---|
| 292 | !************************************************************************************ |
---|
| 293 | ! Domain decomposition |
---|
| 294 | !************************************************************************************ |
---|
[3465] | 295 | IF (grid_type==unstructured) THEN |
---|
[782] | 296 | |
---|
[3465] | 297 | ALLOCATE( ig_paral(klon_mpi_para_nb(mpi_rank) + 2) ) |
---|
| 298 | |
---|
| 299 | ig_paral(1) = 4 ! points partition for // |
---|
| 300 | ig_paral(2) = klon_mpi_para_nb(mpi_rank) ! nb of local cells |
---|
| 301 | |
---|
| 302 | DO jf=1, klon_mpi_para_nb(mpi_rank) |
---|
[4596] | 303 | ig_paral(2+jf) = ind_cell_glo_mpi(jf) |
---|
[3465] | 304 | ENDDO |
---|
| 305 | |
---|
| 306 | ELSE IF (grid_type==regular_lonlat) THEN |
---|
| 307 | |
---|
| 308 | ALLOCATE( ig_paral(3) ) |
---|
| 309 | |
---|
| 310 | ig_paral(1) = 1 ! apple partition for // |
---|
| 311 | ig_paral(2) = (jj_begin-1)*nbp_lon+ii_begin-1 ! offset |
---|
| 312 | ig_paral(3) = (jj_end*nbp_lon+ii_end) - (jj_begin*nbp_lon+ii_begin) + 1 |
---|
| 313 | |
---|
| 314 | IF (mpi_rank==mpi_size-1) ig_paral(3)=ig_paral(3)+nbp_lon-1 |
---|
| 315 | ELSE |
---|
| 316 | abort_message='Pb : type of grid unknown' |
---|
| 317 | CALL abort_physic(modname,abort_message,1) |
---|
| 318 | ENDIF |
---|
| 319 | |
---|
| 320 | |
---|
[1279] | 321 | WRITE(lunout,*) mpi_rank,'ig_paral--->',ig_paral(2),ig_paral(3) |
---|
[782] | 322 | |
---|
| 323 | ierror=PRISM_Ok |
---|
| 324 | CALL prism_def_partition_proto (il_part_id, ig_paral, ierror) |
---|
| 325 | |
---|
| 326 | IF (ierror .NE. PRISM_Ok) THEN |
---|
| 327 | abort_message=' Probleme dans prism_def_partition ' |
---|
[2311] | 328 | CALL abort_physic(modname,abort_message,1) |
---|
[782] | 329 | ELSE |
---|
[1279] | 330 | WRITE(lunout,*) 'inicma : decomposition domaine psmile ok ' |
---|
[782] | 331 | ENDIF |
---|
| 332 | |
---|
[3465] | 333 | il_var_nodims(1) = 2 ! rank of field array (1d or 2d) |
---|
| 334 | il_var_nodims(2) = 1 ! always 1 in current oasis version" doc oasis3mct p18 |
---|
[782] | 335 | |
---|
[3465] | 336 | il_var_actual_shape(1) = 1 ! min of 1st dimension (always 1) |
---|
| 337 | il_var_actual_shape(2) = nbp_lon ! max of 1st dimension |
---|
| 338 | il_var_actual_shape(3) = 1 ! min of 2nd dimension (always 1) |
---|
| 339 | il_var_actual_shape(4) = nbp_lat ! max of 2nd dimension |
---|
[782] | 340 | |
---|
| 341 | il_var_type = PRISM_Real |
---|
| 342 | |
---|
| 343 | !************************************************************************************ |
---|
[1279] | 344 | ! Oceanic Fields to receive |
---|
| 345 | ! Loop over all possible variables |
---|
[782] | 346 | !************************************************************************************ |
---|
[1279] | 347 | DO jf=1, maxrecv |
---|
| 348 | IF (inforecv(jf)%action) THEN |
---|
| 349 | CALL prism_def_var_proto(inforecv(jf)%nid, inforecv(jf)%name, il_part_id, & |
---|
| 350 | il_var_nodims, PRISM_In, il_var_actual_shape, il_var_type, & |
---|
| 351 | ierror) |
---|
| 352 | IF (ierror .NE. PRISM_Ok) THEN |
---|
| 353 | WRITE(lunout,*) 'inicma : Problem with prism_def_var_proto for field : ',& |
---|
| 354 | inforecv(jf)%name |
---|
| 355 | abort_message=' Problem in call to prism_def_var_proto for fields to receive' |
---|
[2311] | 356 | CALL abort_physic(modname,abort_message,1) |
---|
[1279] | 357 | ENDIF |
---|
[782] | 358 | ENDIF |
---|
| 359 | END DO |
---|
[4247] | 360 | |
---|
[4640] | 361 | |
---|
[5251] | 362 | IF (CPPKEY_INCA) THEN |
---|
[4754] | 363 | IF (dms_cycle_cpl .OR. n2o_cycle_cpl) THEN |
---|
| 364 | CALL init_inca_oasis(inforecv(idr_ocedms:idr_ocen2o)) |
---|
[4640] | 365 | ENDIF |
---|
[5251] | 366 | END IF |
---|
[4247] | 367 | |
---|
[782] | 368 | !************************************************************************************ |
---|
[1279] | 369 | ! Atmospheric Fields to send |
---|
| 370 | ! Loop over all possible variables |
---|
[782] | 371 | !************************************************************************************ |
---|
[1279] | 372 | DO jf=1,maxsend |
---|
| 373 | IF (infosend(jf)%action) THEN |
---|
| 374 | CALL prism_def_var_proto(infosend(jf)%nid, infosend(jf)%name, il_part_id, & |
---|
| 375 | il_var_nodims, PRISM_Out, il_var_actual_shape, il_var_type, & |
---|
| 376 | ierror) |
---|
| 377 | IF (ierror .NE. PRISM_Ok) THEN |
---|
| 378 | WRITE(lunout,*) 'inicma : Problem with prism_def_var_proto for field : ',& |
---|
| 379 | infosend(jf)%name |
---|
| 380 | abort_message=' Problem in call to prism_def_var_proto for fields to send' |
---|
[2311] | 381 | CALL abort_physic(modname,abort_message,1) |
---|
[1279] | 382 | ENDIF |
---|
[782] | 383 | ENDIF |
---|
| 384 | END DO |
---|
[1279] | 385 | |
---|
[782] | 386 | !************************************************************************************ |
---|
| 387 | ! End definition |
---|
| 388 | !************************************************************************************ |
---|
[4619] | 389 | |
---|
| 390 | IF (using_xios) CALL xios_oasis_enddef() |
---|
| 391 | |
---|
[782] | 392 | CALL prism_enddef_proto(ierror) |
---|
| 393 | IF (ierror .NE. PRISM_Ok) THEN |
---|
[1279] | 394 | abort_message=' Problem in call to prism_endef_proto' |
---|
[2311] | 395 | CALL abort_physic(modname,abort_message,1) |
---|
[782] | 396 | ELSE |
---|
[1279] | 397 | WRITE(lunout,*) 'inicma : endef psmile ok ' |
---|
[782] | 398 | ENDIF |
---|
[1279] | 399 | |
---|
[4642] | 400 | !$OMP END MASTER |
---|
[782] | 401 | |
---|
| 402 | END SUBROUTINE inicma |
---|
| 403 | |
---|
| 404 | ! |
---|
| 405 | !************************************************************************************ |
---|
| 406 | ! |
---|
| 407 | |
---|
| 408 | SUBROUTINE fromcpl(ktime, tab_get) |
---|
| 409 | ! ====================================================================== |
---|
| 410 | ! L. Fairhead (09/2003) adapted From L.Z.X Li: this subroutine reads the SST |
---|
| 411 | ! and Sea-Ice provided by the coupler. Adaptation to psmile library |
---|
| 412 | !====================================================================== |
---|
| 413 | ! |
---|
[2311] | 414 | USE print_control_mod, ONLY: lunout |
---|
[2371] | 415 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat |
---|
[782] | 416 | ! Input arguments |
---|
| 417 | !************************************************************************************ |
---|
| 418 | INTEGER, INTENT(IN) :: ktime |
---|
| 419 | |
---|
| 420 | ! Output arguments |
---|
| 421 | !************************************************************************************ |
---|
[4640] | 422 | REAL, DIMENSION(nbp_lon, jj_nb,maxrecv_phys), INTENT(OUT) :: tab_get |
---|
[782] | 423 | |
---|
| 424 | ! Local variables |
---|
| 425 | !************************************************************************************ |
---|
| 426 | INTEGER :: ierror, i |
---|
| 427 | INTEGER :: istart,iend |
---|
| 428 | CHARACTER (len = 20) :: modname = 'fromcpl' |
---|
| 429 | CHARACTER (len = 80) :: abort_message |
---|
[2346] | 430 | REAL, DIMENSION(nbp_lon*jj_nb) :: field |
---|
[782] | 431 | |
---|
| 432 | !************************************************************************************ |
---|
[1279] | 433 | WRITE (lunout,*) ' ' |
---|
| 434 | WRITE (lunout,*) 'Fromcpl: Reading fields from CPL, ktime=',ktime |
---|
| 435 | WRITE (lunout,*) ' ' |
---|
[782] | 436 | |
---|
| 437 | istart=ii_begin |
---|
[2429] | 438 | IF (is_south_pole_dyn) THEN |
---|
[2346] | 439 | iend=(jj_end-jj_begin)*nbp_lon+nbp_lon |
---|
[782] | 440 | ELSE |
---|
[2346] | 441 | iend=(jj_end-jj_begin)*nbp_lon+ii_end |
---|
[782] | 442 | ENDIF |
---|
| 443 | |
---|
[4640] | 444 | DO i = 1, maxrecv_phys |
---|
[1965] | 445 | IF (inforecv(i)%action .AND. inforecv(i)%nid .NE. -1) THEN |
---|
[1279] | 446 | field(:) = -99999. |
---|
| 447 | CALL prism_get_proto(inforecv(i)%nid, ktime, field(istart:iend), ierror) |
---|
[2346] | 448 | tab_get(:,:,i) = RESHAPE(field(:),(/nbp_lon,jj_nb/)) |
---|
[782] | 449 | |
---|
[1279] | 450 | IF (ierror .NE. PRISM_Ok .AND. ierror.NE.PRISM_Recvd .AND. & |
---|
| 451 | ierror.NE.PRISM_FromRest & |
---|
| 452 | .AND. ierror.NE.PRISM_Input .AND. ierror.NE.PRISM_RecvOut & |
---|
| 453 | .AND. ierror.NE.PRISM_FromRestOut) THEN |
---|
| 454 | WRITE (lunout,*) 'Error with receiving filed : ', inforecv(i)%name, ktime |
---|
| 455 | abort_message=' Problem in prism_get_proto ' |
---|
[2311] | 456 | CALL abort_physic(modname,abort_message,1) |
---|
[1279] | 457 | ENDIF |
---|
| 458 | ENDIF |
---|
[782] | 459 | END DO |
---|
| 460 | |
---|
| 461 | |
---|
| 462 | END SUBROUTINE fromcpl |
---|
| 463 | |
---|
| 464 | ! |
---|
| 465 | !************************************************************************************ |
---|
| 466 | ! |
---|
| 467 | |
---|
| 468 | SUBROUTINE intocpl(ktime, last, tab_put) |
---|
| 469 | ! ====================================================================== |
---|
| 470 | ! L. Fairhead (09/2003) adapted From L.Z.X Li: this subroutine provides the |
---|
| 471 | ! atmospheric coupling fields to the coupler with the psmile library. |
---|
| 472 | ! IF last time step, writes output fields to binary files. |
---|
| 473 | ! ====================================================================== |
---|
| 474 | ! |
---|
| 475 | ! |
---|
[2311] | 476 | USE print_control_mod, ONLY: lunout |
---|
[2371] | 477 | USE mod_grid_phy_lmdz, ONLY: nbp_lon, nbp_lat |
---|
[782] | 478 | ! Input arguments |
---|
| 479 | !************************************************************************************ |
---|
[1279] | 480 | INTEGER, INTENT(IN) :: ktime |
---|
| 481 | LOGICAL, INTENT(IN) :: last |
---|
[2346] | 482 | REAL, DIMENSION(nbp_lon, jj_nb, maxsend), INTENT(IN) :: tab_put |
---|
[782] | 483 | |
---|
| 484 | ! Local variables |
---|
| 485 | !************************************************************************************ |
---|
[987] | 486 | LOGICAL :: checkout |
---|
| 487 | INTEGER :: istart,iend |
---|
| 488 | INTEGER :: wstart,wend |
---|
| 489 | INTEGER :: ierror, i |
---|
[2346] | 490 | REAL, DIMENSION(nbp_lon*jj_nb) :: field |
---|
[987] | 491 | CHARACTER (len = 20),PARAMETER :: modname = 'intocpl' |
---|
| 492 | CHARACTER (len = 80) :: abort_message |
---|
[782] | 493 | |
---|
| 494 | !************************************************************************************ |
---|
[987] | 495 | checkout=.FALSE. |
---|
[782] | 496 | |
---|
[1279] | 497 | WRITE(lunout,*) ' ' |
---|
| 498 | WRITE(lunout,*) 'Intocpl: sending fields to CPL, ktime= ', ktime |
---|
| 499 | WRITE(lunout,*) 'last = ', last |
---|
| 500 | WRITE(lunout,*) |
---|
[782] | 501 | |
---|
| 502 | |
---|
| 503 | istart=ii_begin |
---|
[2429] | 504 | IF (is_south_pole_dyn) THEN |
---|
[2346] | 505 | iend=(jj_end-jj_begin)*nbp_lon+nbp_lon |
---|
[782] | 506 | ELSE |
---|
[2346] | 507 | iend=(jj_end-jj_begin)*nbp_lon+ii_end |
---|
[782] | 508 | ENDIF |
---|
| 509 | |
---|
| 510 | IF (checkout) THEN |
---|
| 511 | wstart=istart |
---|
| 512 | wend=iend |
---|
[2429] | 513 | IF (is_north_pole_dyn) wstart=istart+nbp_lon-1 |
---|
| 514 | IF (is_south_pole_dyn) wend=iend-nbp_lon+1 |
---|
[782] | 515 | |
---|
[1279] | 516 | DO i = 1, maxsend |
---|
| 517 | IF (infosend(i)%action) THEN |
---|
[2346] | 518 | field = RESHAPE(tab_put(:,:,i),(/nbp_lon*jj_nb/)) |
---|
[1279] | 519 | CALL writefield_phy(infosend(i)%name,field(wstart:wend),1) |
---|
| 520 | END IF |
---|
| 521 | END DO |
---|
| 522 | END IF |
---|
| 523 | |
---|
[782] | 524 | !************************************************************************************ |
---|
| 525 | ! PRISM_PUT |
---|
| 526 | !************************************************************************************ |
---|
| 527 | |
---|
[1279] | 528 | DO i = 1, maxsend |
---|
[1965] | 529 | IF (infosend(i)%action .AND. infosend(i)%nid .NE. -1 ) THEN |
---|
[2346] | 530 | field = RESHAPE(tab_put(:,:,i),(/nbp_lon*jj_nb/)) |
---|
[1279] | 531 | CALL prism_put_proto(infosend(i)%nid, ktime, field(istart:iend), ierror) |
---|
| 532 | |
---|
| 533 | IF (ierror .NE. PRISM_Ok .AND. ierror.NE.PRISM_Sent .AND. ierror.NE.PRISM_ToRest & |
---|
| 534 | .AND. ierror.NE.PRISM_LocTrans .AND. ierror.NE.PRISM_Output .AND. & |
---|
| 535 | ierror.NE.PRISM_SentOut .AND. ierror.NE.PRISM_ToRestOut) THEN |
---|
| 536 | WRITE (lunout,*) 'Error with sending field :', infosend(i)%name, ktime |
---|
| 537 | abort_message=' Problem in prism_put_proto ' |
---|
[2311] | 538 | CALL abort_physic(modname,abort_message,1) |
---|
[1279] | 539 | ENDIF |
---|
| 540 | ENDIF |
---|
[782] | 541 | END DO |
---|
| 542 | |
---|
| 543 | !************************************************************************************ |
---|
| 544 | ! Finalize PSMILE for the case is_sequential, if parallel finalization is done |
---|
| 545 | ! from Finalize_parallel in dyn3dpar/parallel.F90 |
---|
| 546 | !************************************************************************************ |
---|
| 547 | |
---|
| 548 | IF (last) THEN |
---|
| 549 | IF (is_sequential) THEN |
---|
| 550 | CALL prism_terminate_proto(ierror) |
---|
| 551 | IF (ierror .NE. PRISM_Ok) THEN |
---|
[1279] | 552 | abort_message=' Problem in prism_terminate_proto ' |
---|
[2311] | 553 | CALL abort_physic(modname,abort_message,1) |
---|
[782] | 554 | ENDIF |
---|
| 555 | ENDIF |
---|
| 556 | ENDIF |
---|
| 557 | |
---|
| 558 | |
---|
| 559 | END SUBROUTINE intocpl |
---|
| 560 | |
---|
| 561 | #endif |
---|
| 562 | |
---|
| 563 | END MODULE oasis |
---|