[9096] | 1 | #undef UPD_HIGH /* MIX HIGH UPDATE */ |
---|
[393] | 2 | #if defined key_agrif |
---|
[3680] | 3 | !!---------------------------------------------------------------------- |
---|
[9598] | 4 | !! NEMO/NST 4.0 , NEMO Consortium (2018) |
---|
[3680] | 5 | !! $Id$ |
---|
[9598] | 6 | !! Software governed by the CeCILL licence (./LICENSE) |
---|
[3680] | 7 | !!---------------------------------------------------------------------- |
---|
| 8 | SUBROUTINE agrif_user |
---|
| 9 | END SUBROUTINE agrif_user |
---|
| 10 | |
---|
| 11 | SUBROUTINE agrif_before_regridding |
---|
| 12 | END SUBROUTINE agrif_before_regridding |
---|
| 13 | |
---|
| 14 | SUBROUTINE Agrif_InitWorkspace |
---|
[1156] | 15 | !!---------------------------------------------------------------------- |
---|
[3680] | 16 | !! *** ROUTINE Agrif_InitWorkspace *** |
---|
[1156] | 17 | !!---------------------------------------------------------------------- |
---|
[3680] | 18 | USE par_oce |
---|
| 19 | USE dom_oce |
---|
| 20 | USE nemogcm |
---|
[9449] | 21 | USE mppini |
---|
[7646] | 22 | !! |
---|
[3680] | 23 | IMPLICIT NONE |
---|
| 24 | !!---------------------------------------------------------------------- |
---|
| 25 | ! |
---|
| 26 | IF( .NOT. Agrif_Root() ) THEN |
---|
[9449] | 27 | ! no more static variables |
---|
| 28 | !!$! JC: change to allow for different vertical levels |
---|
| 29 | !!$! jpk is already set |
---|
| 30 | !!$! keep it jpk possibly different from jpkglo which |
---|
| 31 | !!$! hold parent grid vertical levels number (set earlier) |
---|
| 32 | !!$! jpk = jpkglo |
---|
[3680] | 33 | ENDIF |
---|
| 34 | ! |
---|
| 35 | END SUBROUTINE Agrif_InitWorkspace |
---|
[1156] | 36 | |
---|
[390] | 37 | |
---|
[3680] | 38 | SUBROUTINE Agrif_InitValues |
---|
| 39 | !!---------------------------------------------------------------------- |
---|
| 40 | !! *** ROUTINE Agrif_InitValues *** |
---|
| 41 | !! |
---|
| 42 | !! ** Purpose :: Declaration of variables to be interpolated |
---|
| 43 | !!---------------------------------------------------------------------- |
---|
| 44 | USE Agrif_Util |
---|
| 45 | USE oce |
---|
| 46 | USE dom_oce |
---|
| 47 | USE nemogcm |
---|
| 48 | USE tradmp |
---|
[7646] | 49 | USE bdy_oce , ONLY: ln_bdy |
---|
| 50 | !! |
---|
[3680] | 51 | IMPLICIT NONE |
---|
| 52 | !!---------------------------------------------------------------------- |
---|
[7646] | 53 | ! |
---|
| 54 | CALL nemo_init !* Initializations of each fine grid |
---|
[4147] | 55 | |
---|
[7646] | 56 | ! !* Agrif initialization |
---|
[3680] | 57 | CALL agrif_nemo_init |
---|
| 58 | CALL Agrif_InitValues_cont_dom |
---|
| 59 | CALL Agrif_InitValues_cont |
---|
[2715] | 60 | # if defined key_top |
---|
[3680] | 61 | CALL Agrif_InitValues_cont_top |
---|
[7646] | 62 | # endif |
---|
[9570] | 63 | # if defined key_si3 |
---|
[9610] | 64 | CALL Agrif_InitValues_cont_ice |
---|
[7761] | 65 | # endif |
---|
[7646] | 66 | ! |
---|
[9031] | 67 | IF ( Agrif_Level().EQ.Agrif_MaxLevel() ) CALL agrif_Update_ini() |
---|
| 68 | |
---|
| 69 | Agrif_UseSpecialValueInUpdate = .FALSE. |
---|
| 70 | |
---|
[3680] | 71 | END SUBROUTINE Agrif_initvalues |
---|
[2031] | 72 | |
---|
[3680] | 73 | |
---|
| 74 | SUBROUTINE Agrif_InitValues_cont_dom |
---|
| 75 | !!---------------------------------------------------------------------- |
---|
| 76 | !! *** ROUTINE Agrif_InitValues_cont *** |
---|
| 77 | !! |
---|
| 78 | !! ** Purpose :: Declaration of variables to be interpolated |
---|
| 79 | !!---------------------------------------------------------------------- |
---|
| 80 | USE Agrif_Util |
---|
| 81 | USE oce |
---|
| 82 | USE dom_oce |
---|
| 83 | USE nemogcm |
---|
| 84 | USE in_out_manager |
---|
[9570] | 85 | USE agrif_oce_update |
---|
| 86 | USE agrif_oce_interp |
---|
| 87 | USE agrif_oce_sponge |
---|
[9019] | 88 | ! |
---|
[3680] | 89 | IMPLICIT NONE |
---|
[7646] | 90 | !!---------------------------------------------------------------------- |
---|
[3680] | 91 | ! |
---|
| 92 | ! Declaration of the type of variable which have to be interpolated |
---|
[7646] | 93 | ! |
---|
[3680] | 94 | CALL agrif_declare_var_dom |
---|
| 95 | ! |
---|
| 96 | END SUBROUTINE Agrif_InitValues_cont_dom |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | SUBROUTINE agrif_declare_var_dom |
---|
| 100 | !!---------------------------------------------------------------------- |
---|
[5656] | 101 | !! *** ROUTINE agrif_declare_var *** |
---|
[3680] | 102 | !! |
---|
| 103 | !! ** Purpose :: Declaration of variables to be interpolated |
---|
| 104 | !!---------------------------------------------------------------------- |
---|
| 105 | USE agrif_util |
---|
[5656] | 106 | USE par_oce |
---|
[3680] | 107 | USE oce |
---|
[9019] | 108 | ! |
---|
[3680] | 109 | IMPLICIT NONE |
---|
[9019] | 110 | ! |
---|
| 111 | INTEGER :: ind1, ind2, ind3 |
---|
[3680] | 112 | !!---------------------------------------------------------------------- |
---|
| 113 | |
---|
| 114 | ! 1. Declaration of the type of variable which have to be interpolated |
---|
| 115 | !--------------------------------------------------------------------- |
---|
[9019] | 116 | ind1 = nbghostcells |
---|
| 117 | ind2 = 1 + nbghostcells |
---|
| 118 | ind3 = 2 + nbghostcells |
---|
| 119 | CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e1u_id) |
---|
| 120 | CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),e2v_id) |
---|
[3680] | 121 | |
---|
| 122 | ! 2. Type of interpolation |
---|
| 123 | !------------------------- |
---|
[9019] | 124 | CALL Agrif_Set_bcinterp( e1u_id, interp1=Agrif_linear, interp2=AGRIF_ppm ) |
---|
| 125 | CALL Agrif_Set_bcinterp( e2v_id, interp1=AGRIF_ppm , interp2=Agrif_linear ) |
---|
[3680] | 126 | |
---|
| 127 | ! 3. Location of interpolation |
---|
| 128 | !----------------------------- |
---|
[9019] | 129 | CALL Agrif_Set_bc(e1u_id,(/0,ind1-1/)) |
---|
| 130 | CALL Agrif_Set_bc(e2v_id,(/0,ind1-1/)) |
---|
[3680] | 131 | |
---|
[9031] | 132 | ! 4. Update type |
---|
[3680] | 133 | !--------------- |
---|
[9031] | 134 | # if defined UPD_HIGH |
---|
| 135 | CALL Agrif_Set_Updatetype(e1u_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Full_Weighting) |
---|
| 136 | CALL Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Full_Weighting, update2=Agrif_Update_Average) |
---|
| 137 | #else |
---|
| 138 | CALL Agrif_Set_Updatetype(e1u_id,update1 = Agrif_Update_Copy, update2=Agrif_Update_Average) |
---|
| 139 | CALL Agrif_Set_Updatetype(e2v_id,update1 = Agrif_Update_Average, update2=Agrif_Update_Copy) |
---|
| 140 | #endif |
---|
[3680] | 141 | |
---|
| 142 | END SUBROUTINE agrif_declare_var_dom |
---|
| 143 | |
---|
| 144 | |
---|
| 145 | SUBROUTINE Agrif_InitValues_cont |
---|
| 146 | !!---------------------------------------------------------------------- |
---|
| 147 | !! *** ROUTINE Agrif_InitValues_cont *** |
---|
| 148 | !! |
---|
| 149 | !! ** Purpose :: Declaration of variables to be interpolated |
---|
| 150 | !!---------------------------------------------------------------------- |
---|
[9570] | 151 | USE agrif_oce_update |
---|
| 152 | USE agrif_oce_interp |
---|
| 153 | USE agrif_oce_sponge |
---|
[3680] | 154 | USE Agrif_Util |
---|
| 155 | USE oce |
---|
| 156 | USE dom_oce |
---|
[9019] | 157 | USE zdf_oce |
---|
[3680] | 158 | USE nemogcm |
---|
[9019] | 159 | ! |
---|
[5656] | 160 | USE lib_mpp |
---|
[3680] | 161 | USE in_out_manager |
---|
[9019] | 162 | ! |
---|
[3680] | 163 | IMPLICIT NONE |
---|
| 164 | ! |
---|
| 165 | LOGICAL :: check_namelist |
---|
[9031] | 166 | CHARACTER(len=15) :: cl_check1, cl_check2, cl_check3, cl_check4 |
---|
[3680] | 167 | !!---------------------------------------------------------------------- |
---|
[390] | 168 | |
---|
[3680] | 169 | ! 1. Declaration of the type of variable which have to be interpolated |
---|
| 170 | !--------------------------------------------------------------------- |
---|
| 171 | CALL agrif_declare_var |
---|
[636] | 172 | |
---|
[3680] | 173 | ! 2. First interpolations of potentially non zero fields |
---|
| 174 | !------------------------------------------------------- |
---|
[9019] | 175 | Agrif_SpecialValue = 0._wp |
---|
[3680] | 176 | Agrif_UseSpecialValue = .TRUE. |
---|
[5656] | 177 | CALL Agrif_Bc_variable(tsn_id,calledweight=1.,procname=interptsn) |
---|
| 178 | CALL Agrif_Sponge |
---|
| 179 | tabspongedone_tsn = .FALSE. |
---|
| 180 | CALL Agrif_Bc_variable(tsn_sponge_id,calledweight=1.,procname=interptsn_sponge) |
---|
| 181 | ! reset tsa to zero |
---|
| 182 | tsa(:,:,:,:) = 0. |
---|
[390] | 183 | |
---|
[5656] | 184 | Agrif_UseSpecialValue = ln_spc_dyn |
---|
| 185 | CALL Agrif_Bc_variable(un_interp_id,calledweight=1.,procname=interpun) |
---|
| 186 | CALL Agrif_Bc_variable(vn_interp_id,calledweight=1.,procname=interpvn) |
---|
| 187 | tabspongedone_u = .FALSE. |
---|
| 188 | tabspongedone_v = .FALSE. |
---|
| 189 | CALL Agrif_Bc_variable(un_sponge_id,calledweight=1.,procname=interpun_sponge) |
---|
| 190 | tabspongedone_u = .FALSE. |
---|
| 191 | tabspongedone_v = .FALSE. |
---|
| 192 | CALL Agrif_Bc_variable(vn_sponge_id,calledweight=1.,procname=interpvn_sponge) |
---|
[4326] | 193 | |
---|
[5656] | 194 | Agrif_UseSpecialValue = .TRUE. |
---|
| 195 | CALL Agrif_Bc_variable(sshn_id,calledweight=1., procname=interpsshn ) |
---|
[9116] | 196 | hbdy_w(:,:) = 0.e0 ; hbdy_e(:,:) = 0.e0 ; hbdy_n(:,:) = 0.e0 ; hbdy_s(:,:) = 0.e0 |
---|
[9031] | 197 | ssha(:,:) = 0.e0 |
---|
[628] | 198 | |
---|
[5930] | 199 | IF ( ln_dynspg_ts ) THEN |
---|
| 200 | Agrif_UseSpecialValue = ln_spc_dyn |
---|
| 201 | CALL Agrif_Bc_variable(unb_id,calledweight=1.,procname=interpunb) |
---|
| 202 | CALL Agrif_Bc_variable(vnb_id,calledweight=1.,procname=interpvnb) |
---|
| 203 | CALL Agrif_Bc_variable(ub2b_interp_id,calledweight=1.,procname=interpub2b) |
---|
| 204 | CALL Agrif_Bc_variable(vb2b_interp_id,calledweight=1.,procname=interpvb2b) |
---|
[9116] | 205 | ubdy_w(:,:) = 0.e0 ; vbdy_w(:,:) = 0.e0 |
---|
| 206 | ubdy_e(:,:) = 0.e0 ; vbdy_e(:,:) = 0.e0 |
---|
| 207 | ubdy_n(:,:) = 0.e0 ; vbdy_n(:,:) = 0.e0 |
---|
| 208 | ubdy_s(:,:) = 0.e0 ; vbdy_s(:,:) = 0.e0 |
---|
[5930] | 209 | ENDIF |
---|
[5656] | 210 | |
---|
| 211 | Agrif_UseSpecialValue = .FALSE. |
---|
| 212 | ! reset velocities to zero |
---|
| 213 | ua(:,:,:) = 0. |
---|
| 214 | va(:,:,:) = 0. |
---|
| 215 | |
---|
[3680] | 216 | ! 3. Some controls |
---|
| 217 | !----------------- |
---|
[5656] | 218 | check_namelist = .TRUE. |
---|
[3680] | 219 | |
---|
[5656] | 220 | IF( check_namelist ) THEN |
---|
[3680] | 221 | |
---|
| 222 | ! Check time steps |
---|
[5656] | 223 | IF( NINT(Agrif_Rhot()) * NINT(rdt) .NE. Agrif_Parent(rdt) ) THEN |
---|
| 224 | WRITE(cl_check1,*) NINT(Agrif_Parent(rdt)) |
---|
| 225 | WRITE(cl_check2,*) NINT(rdt) |
---|
| 226 | WRITE(cl_check3,*) NINT(Agrif_Parent(rdt)/Agrif_Rhot()) |
---|
[9031] | 227 | CALL ctl_stop( 'Incompatible time step between ocean grids', & |
---|
[5656] | 228 | & 'parent grid value : '//cl_check1 , & |
---|
| 229 | & 'child grid value : '//cl_check2 , & |
---|
[7646] | 230 | & 'value on child grid should be changed to : '//cl_check3 ) |
---|
[3680] | 231 | ENDIF |
---|
| 232 | |
---|
| 233 | ! Check run length |
---|
| 234 | IF( Agrif_IRhot() * (Agrif_Parent(nitend)- & |
---|
[5656] | 235 | Agrif_Parent(nit000)+1) .NE. (nitend-nit000+1) ) THEN |
---|
| 236 | WRITE(cl_check1,*) (Agrif_Parent(nit000)-1)*Agrif_IRhot() + 1 |
---|
| 237 | WRITE(cl_check2,*) Agrif_Parent(nitend) *Agrif_IRhot() |
---|
[9031] | 238 | CALL ctl_warn( 'Incompatible run length between grids' , & |
---|
| 239 | & 'nit000 on fine grid will be changed to : '//cl_check1, & |
---|
| 240 | & 'nitend on fine grid will be changed to : '//cl_check2 ) |
---|
[5656] | 241 | nit000 = (Agrif_Parent(nit000)-1)*Agrif_IRhot() + 1 |
---|
| 242 | nitend = Agrif_Parent(nitend) *Agrif_IRhot() |
---|
[3680] | 243 | ENDIF |
---|
| 244 | |
---|
[5930] | 245 | ! Check free surface scheme |
---|
| 246 | IF ( ( Agrif_Parent(ln_dynspg_ts ).AND.ln_dynspg_exp ).OR.& |
---|
| 247 | & ( Agrif_Parent(ln_dynspg_exp).AND.ln_dynspg_ts ) ) THEN |
---|
[9031] | 248 | WRITE(cl_check1,*) Agrif_Parent( ln_dynspg_ts ) |
---|
| 249 | WRITE(cl_check2,*) ln_dynspg_ts |
---|
| 250 | WRITE(cl_check3,*) Agrif_Parent( ln_dynspg_exp ) |
---|
| 251 | WRITE(cl_check4,*) ln_dynspg_exp |
---|
| 252 | CALL ctl_stop( 'Incompatible free surface scheme between grids' , & |
---|
| 253 | & 'parent grid ln_dynspg_ts :'//cl_check1 , & |
---|
| 254 | & 'child grid ln_dynspg_ts :'//cl_check2 , & |
---|
| 255 | & 'parent grid ln_dynspg_exp :'//cl_check3 , & |
---|
| 256 | & 'child grid ln_dynspg_exp :'//cl_check4 , & |
---|
| 257 | & 'those logicals should be identical' ) |
---|
[5930] | 258 | STOP |
---|
| 259 | ENDIF |
---|
| 260 | |
---|
[9031] | 261 | ! Check if identical linear free surface option |
---|
| 262 | IF ( ( Agrif_Parent(ln_linssh ).AND.(.NOT.ln_linssh )).OR.& |
---|
| 263 | & ( (.NOT.Agrif_Parent(ln_linssh)).AND.ln_linssh ) ) THEN |
---|
| 264 | WRITE(cl_check1,*) Agrif_Parent(ln_linssh ) |
---|
| 265 | WRITE(cl_check2,*) ln_linssh |
---|
| 266 | CALL ctl_stop( 'Incompatible linearized fs option between grids', & |
---|
| 267 | & 'parent grid ln_linssh :'//cl_check1 , & |
---|
| 268 | & 'child grid ln_linssh :'//cl_check2 , & |
---|
| 269 | & 'those logicals should be identical' ) |
---|
| 270 | STOP |
---|
| 271 | ENDIF |
---|
| 272 | |
---|
[5656] | 273 | ! check if masks and bathymetries match |
---|
| 274 | IF(ln_chk_bathy) THEN |
---|
| 275 | ! |
---|
| 276 | IF(lwp) WRITE(numout,*) 'AGRIF: Check Bathymetry and masks near bdys. Level: ', Agrif_Level() |
---|
| 277 | ! |
---|
| 278 | kindic_agr = 0 |
---|
| 279 | ! check if umask agree with parent along western and eastern boundaries: |
---|
| 280 | CALL Agrif_Bc_variable(umsk_id,calledweight=1.,procname=interpumsk) |
---|
| 281 | ! check if vmask agree with parent along northern and southern boundaries: |
---|
| 282 | CALL Agrif_Bc_variable(vmsk_id,calledweight=1.,procname=interpvmsk) |
---|
[7761] | 283 | ! check if tmask and vertical scale factors agree with parent over first two coarse grid points: |
---|
[5656] | 284 | CALL Agrif_Bc_variable(e3t_id,calledweight=1.,procname=interpe3t) |
---|
| 285 | ! |
---|
| 286 | IF (lk_mpp) CALL mpp_sum( kindic_agr ) |
---|
[7761] | 287 | IF( kindic_agr /= 0 ) THEN |
---|
[5656] | 288 | CALL ctl_stop('Child Bathymetry is not correct near boundaries.') |
---|
| 289 | ELSE |
---|
| 290 | IF(lwp) WRITE(numout,*) 'Child Bathymetry is ok near boundaries.' |
---|
| 291 | END IF |
---|
| 292 | ENDIF |
---|
| 293 | ! |
---|
[3680] | 294 | ENDIF |
---|
[5656] | 295 | ! |
---|
[9031] | 296 | END SUBROUTINE Agrif_InitValues_cont |
---|
| 297 | |
---|
| 298 | RECURSIVE SUBROUTINE Agrif_Update_ini( ) |
---|
| 299 | !!---------------------------------------------------------------------- |
---|
| 300 | !! *** ROUTINE agrif_Update_ini *** |
---|
| 301 | !! |
---|
| 302 | !! ** Purpose :: Recursive update done at initialization |
---|
| 303 | !!---------------------------------------------------------------------- |
---|
| 304 | USE dom_oce |
---|
[9570] | 305 | USE agrif_oce_update |
---|
[9031] | 306 | #if defined key_top |
---|
| 307 | USE agrif_top_update |
---|
| 308 | #endif |
---|
[9570] | 309 | #if defined key_si3 |
---|
[9596] | 310 | USE agrif_ice_update |
---|
[9482] | 311 | #endif |
---|
[5656] | 312 | ! |
---|
[9031] | 313 | IMPLICIT NONE |
---|
| 314 | !!---------------------------------------------------------------------- |
---|
[3680] | 315 | ! |
---|
[9031] | 316 | IF (Agrif_Root()) RETURN |
---|
| 317 | ! |
---|
[9088] | 318 | CALL Agrif_Update_ssh() |
---|
[9031] | 319 | IF (.NOT.ln_linssh) CALL Agrif_Update_vvl() |
---|
| 320 | CALL Agrif_Update_tra() |
---|
| 321 | #if defined key_top |
---|
| 322 | CALL Agrif_Update_Trc() |
---|
| 323 | #endif |
---|
| 324 | CALL Agrif_Update_dyn() |
---|
| 325 | ! JC remove update because this precludes from perfect restartability |
---|
| 326 | !! CALL Agrif_Update_tke(0) |
---|
[1605] | 327 | |
---|
[9570] | 328 | #if defined key_si3 |
---|
[9610] | 329 | CALL agrif_update_ice(0) |
---|
[9482] | 330 | #endif |
---|
| 331 | |
---|
[9031] | 332 | CALL Agrif_ChildGrid_To_ParentGrid() |
---|
| 333 | CALL Agrif_Update_ini() |
---|
| 334 | CALL Agrif_ParentGrid_To_ChildGrid() |
---|
[3294] | 335 | |
---|
[9031] | 336 | END SUBROUTINE agrif_update_ini |
---|
| 337 | |
---|
[3680] | 338 | SUBROUTINE agrif_declare_var |
---|
| 339 | !!---------------------------------------------------------------------- |
---|
| 340 | !! *** ROUTINE agrif_declarE_var *** |
---|
| 341 | !! |
---|
| 342 | !! ** Purpose :: Declaration of variables to be interpolated |
---|
| 343 | !!---------------------------------------------------------------------- |
---|
| 344 | USE agrif_util |
---|
[9019] | 345 | USE agrif_oce |
---|
| 346 | USE par_oce ! ocean parameters |
---|
| 347 | USE zdf_oce ! vertical physics |
---|
[3680] | 348 | USE oce |
---|
[9019] | 349 | ! |
---|
[3680] | 350 | IMPLICIT NONE |
---|
[9019] | 351 | ! |
---|
| 352 | INTEGER :: ind1, ind2, ind3 |
---|
[3680] | 353 | !!---------------------------------------------------------------------- |
---|
[2715] | 354 | |
---|
[3680] | 355 | ! 1. Declaration of the type of variable which have to be interpolated |
---|
| 356 | !--------------------------------------------------------------------- |
---|
[9019] | 357 | ind1 = nbghostcells |
---|
| 358 | ind2 = 1 + nbghostcells |
---|
| 359 | ind3 = 2 + nbghostcells |
---|
[9031] | 360 | # if defined key_vertical |
---|
| 361 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsn_id) |
---|
| 362 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts+1/),tsn_sponge_id) |
---|
| 363 | |
---|
| 364 | CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_interp_id) |
---|
| 365 | CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_interp_id) |
---|
| 366 | CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_update_id) |
---|
| 367 | CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_update_id) |
---|
| 368 | CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),un_sponge_id) |
---|
| 369 | CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),vn_sponge_id) |
---|
| 370 | # else |
---|
[9019] | 371 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_id) |
---|
| 372 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jpts/),tsn_sponge_id) |
---|
[2715] | 373 | |
---|
[9031] | 374 | CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_interp_id) |
---|
| 375 | CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_interp_id) |
---|
| 376 | CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_update_id) |
---|
| 377 | CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_update_id) |
---|
| 378 | CALL agrif_declare_variable((/1,2,0,0/),(/ind2,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),un_sponge_id) |
---|
| 379 | CALL agrif_declare_variable((/2,1,0,0/),(/ind3,ind2,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),vn_sponge_id) |
---|
| 380 | # endif |
---|
[2715] | 381 | |
---|
[9019] | 382 | CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),e3t_id) |
---|
| 383 | CALL agrif_declare_variable((/1,2,0/),(/ind2,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),umsk_id) |
---|
| 384 | CALL agrif_declare_variable((/2,1,0/),(/ind3,ind2,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),vmsk_id) |
---|
[2715] | 385 | |
---|
[9019] | 386 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,3/),scales_t_id) |
---|
[5656] | 387 | |
---|
[9019] | 388 | CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),unb_id) |
---|
| 389 | CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vnb_id) |
---|
| 390 | CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_interp_id) |
---|
| 391 | CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_interp_id) |
---|
| 392 | CALL agrif_declare_variable((/1,2/),(/ind2,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),ub2b_update_id) |
---|
| 393 | CALL agrif_declare_variable((/2,1/),(/ind3,ind2/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),vb2b_update_id) |
---|
[5656] | 394 | |
---|
[9019] | 395 | CALL agrif_declare_variable((/2,2/),(/ind3,ind3/),(/'x','y'/),(/1,1/),(/nlci,nlcj/),sshn_id) |
---|
[5656] | 396 | |
---|
[9058] | 397 | IF( ln_zdftke.OR.ln_zdfgls ) THEN |
---|
[9134] | 398 | ! CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/), en_id) |
---|
| 399 | ! CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpk/),avt_id) |
---|
[9031] | 400 | # if defined key_vertical |
---|
[9134] | 401 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,2/),avm_id) |
---|
[9031] | 402 | # else |
---|
[9058] | 403 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,1/),avm_id) |
---|
[9031] | 404 | # endif |
---|
[9019] | 405 | ENDIF |
---|
[5656] | 406 | |
---|
[3680] | 407 | ! 2. Type of interpolation |
---|
| 408 | !------------------------- |
---|
| 409 | CALL Agrif_Set_bcinterp(tsn_id,interp=AGRIF_linear) |
---|
[2715] | 410 | |
---|
[5656] | 411 | CALL Agrif_Set_bcinterp(un_interp_id,interp1=Agrif_linear,interp2=AGRIF_ppm) |
---|
| 412 | CALL Agrif_Set_bcinterp(vn_interp_id,interp1=AGRIF_ppm,interp2=Agrif_linear) |
---|
[2715] | 413 | |
---|
[5656] | 414 | CALL Agrif_Set_bcinterp(tsn_sponge_id,interp=AGRIF_linear) |
---|
[2715] | 415 | |
---|
[4326] | 416 | CALL Agrif_Set_bcinterp(sshn_id,interp=AGRIF_linear) |
---|
[5656] | 417 | CALL Agrif_Set_bcinterp(unb_id,interp1=Agrif_linear,interp2=AGRIF_ppm) |
---|
| 418 | CALL Agrif_Set_bcinterp(vnb_id,interp1=AGRIF_ppm,interp2=Agrif_linear) |
---|
| 419 | CALL Agrif_Set_bcinterp(ub2b_interp_id,interp1=Agrif_linear,interp2=AGRIF_ppm) |
---|
| 420 | CALL Agrif_Set_bcinterp(vb2b_interp_id,interp1=AGRIF_ppm,interp2=Agrif_linear) |
---|
[4326] | 421 | |
---|
[5656] | 422 | |
---|
| 423 | CALL Agrif_Set_bcinterp(un_sponge_id,interp1=Agrif_linear,interp2=AGRIF_ppm) |
---|
| 424 | CALL Agrif_Set_bcinterp(vn_sponge_id,interp1=AGRIF_ppm,interp2=Agrif_linear) |
---|
| 425 | |
---|
| 426 | CALL Agrif_Set_bcinterp(e3t_id,interp=AGRIF_constant) |
---|
| 427 | CALL Agrif_Set_bcinterp(umsk_id,interp=AGRIF_constant) |
---|
| 428 | CALL Agrif_Set_bcinterp(vmsk_id,interp=AGRIF_constant) |
---|
| 429 | |
---|
[9058] | 430 | IF( ln_zdftke.OR.ln_zdfgls ) CALL Agrif_Set_bcinterp( avm_id, interp=AGRIF_linear ) |
---|
[5656] | 431 | |
---|
[3680] | 432 | ! 3. Location of interpolation |
---|
| 433 | !----------------------------- |
---|
[9019] | 434 | CALL Agrif_Set_bc( tsn_id, (/0,ind1/) ) |
---|
| 435 | CALL Agrif_Set_bc( un_interp_id, (/0,ind1/) ) |
---|
| 436 | CALL Agrif_Set_bc( vn_interp_id, (/0,ind1/) ) |
---|
[2715] | 437 | |
---|
[9019] | 438 | CALL Agrif_Set_bc( tsn_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) ) ! if west and rhox=3 and sponge=2 and ghost=1: columns 2 to 9 |
---|
| 439 | CALL Agrif_Set_bc( un_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) ) |
---|
| 440 | CALL Agrif_Set_bc( vn_sponge_id, (/-nn_sponge_len*Agrif_irhox()-1,0/) ) |
---|
[4326] | 441 | |
---|
[9019] | 442 | CALL Agrif_Set_bc( sshn_id, (/0,ind1-1/) ) |
---|
| 443 | CALL Agrif_Set_bc( unb_id, (/0,ind1-1/) ) |
---|
| 444 | CALL Agrif_Set_bc( vnb_id, (/0,ind1-1/) ) |
---|
| 445 | CALL Agrif_Set_bc( ub2b_interp_id, (/0,ind1-1/) ) |
---|
| 446 | CALL Agrif_Set_bc( vb2b_interp_id, (/0,ind1-1/) ) |
---|
[2715] | 447 | |
---|
[9019] | 448 | CALL Agrif_Set_bc( e3t_id, (/-2*Agrif_irhox()-1,ind1-1/) ) ! if west and rhox=3 and ghost=1: column 2 to 9 |
---|
| 449 | CALL Agrif_Set_bc( umsk_id, (/0,ind1-1/) ) |
---|
| 450 | CALL Agrif_Set_bc( vmsk_id, (/0,ind1-1/) ) |
---|
[2715] | 451 | |
---|
[9058] | 452 | IF( ln_zdftke.OR.ln_zdfgls ) CALL Agrif_Set_bc( avm_id, (/0,ind1/) ) |
---|
[5656] | 453 | |
---|
[9031] | 454 | ! 4. Update type |
---|
[3680] | 455 | !--------------- |
---|
[5656] | 456 | CALL Agrif_Set_Updatetype(scales_t_id, update = AGRIF_Update_Average) |
---|
[2715] | 457 | |
---|
[9031] | 458 | # if defined UPD_HIGH |
---|
| 459 | CALL Agrif_Set_Updatetype(tsn_id, update = Agrif_Update_Full_Weighting) |
---|
| 460 | CALL Agrif_Set_Updatetype(un_update_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Full_Weighting) |
---|
| 461 | CALL Agrif_Set_Updatetype(vn_update_id,update1 = Agrif_Update_Full_Weighting, update2 = Agrif_Update_Average) |
---|
| 462 | |
---|
| 463 | CALL Agrif_Set_Updatetype(ub2b_update_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Full_Weighting) |
---|
| 464 | CALL Agrif_Set_Updatetype(vb2b_update_id,update1 = Agrif_Update_Full_Weighting, update2 = Agrif_Update_Average) |
---|
| 465 | CALL Agrif_Set_Updatetype(sshn_id, update = Agrif_Update_Full_Weighting) |
---|
| 466 | CALL Agrif_Set_Updatetype(e3t_id, update = Agrif_Update_Full_Weighting) |
---|
| 467 | |
---|
[9058] | 468 | IF( ln_zdftke.OR.ln_zdfgls ) THEN |
---|
| 469 | ! CALL Agrif_Set_Updatetype( en_id, update = AGRIF_Update_Full_Weighting) |
---|
| 470 | ! CALL Agrif_Set_Updatetype(avt_id, update = AGRIF_Update_Full_Weighting) |
---|
| 471 | ! CALL Agrif_Set_Updatetype(avm_id, update = AGRIF_Update_Full_Weighting) |
---|
[9031] | 472 | ENDIF |
---|
| 473 | |
---|
| 474 | #else |
---|
| 475 | CALL Agrif_Set_Updatetype(tsn_id, update = AGRIF_Update_Average) |
---|
[5656] | 476 | CALL Agrif_Set_Updatetype(un_update_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average) |
---|
| 477 | CALL Agrif_Set_Updatetype(vn_update_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy) |
---|
[3680] | 478 | |
---|
[5656] | 479 | CALL Agrif_Set_Updatetype(ub2b_update_id,update1 = Agrif_Update_Copy, update2 = Agrif_Update_Average) |
---|
| 480 | CALL Agrif_Set_Updatetype(vb2b_update_id,update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy) |
---|
[9031] | 481 | CALL Agrif_Set_Updatetype(sshn_id, update = AGRIF_Update_Average) |
---|
| 482 | CALL Agrif_Set_Updatetype(e3t_id, update = AGRIF_Update_Average) |
---|
[5656] | 483 | |
---|
[9058] | 484 | IF( ln_zdftke.OR.ln_zdfgls ) THEN |
---|
| 485 | ! CALL Agrif_Set_Updatetype( en_id, update = AGRIF_Update_Average) |
---|
| 486 | ! CALL Agrif_Set_Updatetype(avt_id, update = AGRIF_Update_Average) |
---|
| 487 | ! CALL Agrif_Set_Updatetype(avm_id, update = AGRIF_Update_Average) |
---|
[9019] | 488 | ENDIF |
---|
[5656] | 489 | |
---|
[9031] | 490 | #endif |
---|
[5656] | 491 | ! |
---|
[3680] | 492 | END SUBROUTINE agrif_declare_var |
---|
| 493 | |
---|
[9570] | 494 | #if defined key_si3 |
---|
[9610] | 495 | SUBROUTINE Agrif_InitValues_cont_ice |
---|
[7646] | 496 | !!---------------------------------------------------------------------- |
---|
[9610] | 497 | !! *** ROUTINE Agrif_InitValues_cont_ice *** |
---|
[7646] | 498 | !! |
---|
[9656] | 499 | !! ** Purpose :: Initialisation of variables to be interpolated for ice |
---|
[7646] | 500 | !!---------------------------------------------------------------------- |
---|
| 501 | USE Agrif_Util |
---|
| 502 | USE sbc_oce, ONLY : nn_fsbc ! clem: necessary otherwise Agrif_Parent(nn_fsbc) = nn_fsbc |
---|
| 503 | USE ice |
---|
| 504 | USE agrif_ice |
---|
| 505 | USE in_out_manager |
---|
[9596] | 506 | USE agrif_ice_interp |
---|
[7646] | 507 | USE lib_mpp |
---|
| 508 | ! |
---|
| 509 | IMPLICIT NONE |
---|
| 510 | !!---------------------------------------------------------------------- |
---|
| 511 | ! |
---|
| 512 | ! Declaration of the type of variable which have to be interpolated (parent=>child) |
---|
| 513 | !---------------------------------------------------------------------------------- |
---|
[9610] | 514 | CALL agrif_declare_var_ice |
---|
[3680] | 515 | |
---|
[7761] | 516 | ! Controls |
---|
| 517 | |
---|
[9482] | 518 | ! clem: For some reason, nn_fsbc(child)/=1 does not work properly (signal can be largely degraded by the agrif zoom) |
---|
[7761] | 519 | ! the run must satisfy CFL=Uice/(dx/dt) < 0.6/nn_fsbc(child) |
---|
| 520 | ! therefore, if nn_fsbc(child)>1 one must reduce the time-step in proportion to nn_fsbc(child), which is not acceptable |
---|
[9482] | 521 | ! If a solution is found, the following stop could be removed because the rest of the code take nn_fsbc(child) into account |
---|
| 522 | IF( nn_fsbc > 1 ) CALL ctl_stop('nn_fsbc(child) must be set to 1 otherwise agrif and sea-ice may not work properly') |
---|
[7761] | 523 | |
---|
[7646] | 524 | ! stop if rhot * nn_fsbc(parent) /= N * nn_fsbc(child) with N being integer |
---|
| 525 | IF( MOD( Agrif_irhot() * Agrif_Parent(nn_fsbc), nn_fsbc ) /= 0 ) THEN |
---|
| 526 | CALL ctl_stop('rhot * nn_fsbc(parent) /= N * nn_fsbc(child), therefore nn_fsbc(child) should be set to 1 or nn_fsbc(parent)') |
---|
| 527 | ENDIF |
---|
| 528 | ! First Interpolations (using "after" ice subtime step => lim_nbstep=1) |
---|
| 529 | !---------------------------------------------------------------------- |
---|
[7761] | 530 | lim_nbstep = ( Agrif_irhot() * Agrif_Parent(nn_fsbc) / nn_fsbc ) ! clem: to have calledweight=1 in interp (otherwise the western border of the zoom is wrong) |
---|
[9610] | 531 | CALL agrif_interp_ice('U') ! interpolation of ice velocities |
---|
| 532 | CALL agrif_interp_ice('V') ! interpolation of ice velocities |
---|
| 533 | CALL agrif_interp_ice('T') ! interpolation of ice tracers |
---|
[7646] | 534 | lim_nbstep = 0 |
---|
| 535 | |
---|
| 536 | ! |
---|
[9610] | 537 | END SUBROUTINE Agrif_InitValues_cont_ice |
---|
[7646] | 538 | |
---|
[9610] | 539 | SUBROUTINE agrif_declare_var_ice |
---|
[7646] | 540 | !!---------------------------------------------------------------------- |
---|
[9610] | 541 | !! *** ROUTINE agrif_declare_var_ice *** |
---|
[7646] | 542 | !! |
---|
[9656] | 543 | !! ** Purpose :: Declaration of variables to be interpolated for ice |
---|
[7646] | 544 | !!---------------------------------------------------------------------- |
---|
| 545 | USE Agrif_Util |
---|
| 546 | USE ice |
---|
[9019] | 547 | USE par_oce, ONLY : nbghostcells |
---|
| 548 | ! |
---|
[7646] | 549 | IMPLICIT NONE |
---|
[9019] | 550 | ! |
---|
| 551 | INTEGER :: ind1, ind2, ind3 |
---|
[7646] | 552 | !!---------------------------------------------------------------------- |
---|
| 553 | ! |
---|
| 554 | ! 1. Declaration of the type of variable which have to be interpolated (parent=>child) |
---|
| 555 | ! agrif_declare_variable(position,1st point index,--,--,dimensions,name) |
---|
[7761] | 556 | ! ex.: position=> 1,1 = not-centered (in i and j) |
---|
| 557 | ! 2,2 = centered ( - ) |
---|
| 558 | ! index => 1,1 = one ghost line |
---|
| 559 | ! 2,2 = two ghost lines |
---|
[7646] | 560 | !------------------------------------------------------------------------------------- |
---|
[9019] | 561 | ind1 = nbghostcells |
---|
| 562 | ind2 = 1 + nbghostcells |
---|
| 563 | ind3 = 2 + nbghostcells |
---|
[9167] | 564 | CALL agrif_declare_variable((/2,2,0/),(/ind3,ind3,0/),(/'x','y','N'/),(/1,1,1/),(/nlci,nlcj,jpl*(8+nlay_s+nlay_i)/),tra_ice_id) |
---|
| 565 | CALL agrif_declare_variable((/1,2/) ,(/ind2,ind3/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,u_ice_id ) |
---|
| 566 | CALL agrif_declare_variable((/2,1/) ,(/ind3,ind2/) ,(/'x','y'/) ,(/1,1/) ,(/nlci,nlcj/) ,v_ice_id ) |
---|
[7646] | 567 | |
---|
| 568 | ! 2. Set interpolations (normal & tangent to the grid cell for velocities) |
---|
| 569 | !----------------------------------- |
---|
[9167] | 570 | CALL Agrif_Set_bcinterp(tra_ice_id, interp = AGRIF_linear) |
---|
[7646] | 571 | CALL Agrif_Set_bcinterp(u_ice_id , interp1 = Agrif_linear,interp2 = AGRIF_ppm ) |
---|
| 572 | CALL Agrif_Set_bcinterp(v_ice_id , interp1 = AGRIF_ppm ,interp2 = Agrif_linear) |
---|
| 573 | |
---|
| 574 | ! 3. Set location of interpolations |
---|
| 575 | !---------------------------------- |
---|
[9019] | 576 | CALL Agrif_Set_bc(tra_ice_id,(/0,ind1/)) |
---|
| 577 | CALL Agrif_Set_bc(u_ice_id ,(/0,ind1/)) |
---|
| 578 | CALL Agrif_Set_bc(v_ice_id ,(/0,ind1/)) |
---|
[7646] | 579 | |
---|
| 580 | ! 4. Set update type in case 2 ways (child=>parent) (normal & tangent to the grid cell for velocities) |
---|
| 581 | !-------------------------------------------------- |
---|
[9134] | 582 | # if defined UPD_HIGH |
---|
[9167] | 583 | CALL Agrif_Set_Updatetype(tra_ice_id, update = Agrif_Update_Full_Weighting) |
---|
| 584 | CALL Agrif_Set_Updatetype(u_ice_id , update1 = Agrif_Update_Average , update2 = Agrif_Update_Full_Weighting) |
---|
| 585 | CALL Agrif_Set_Updatetype(v_ice_id , update1 = Agrif_Update_Full_Weighting, update2 = Agrif_Update_Average ) |
---|
[9134] | 586 | #else |
---|
[9167] | 587 | CALL Agrif_Set_Updatetype(tra_ice_id, update = AGRIF_Update_Average) |
---|
| 588 | CALL Agrif_Set_Updatetype(u_ice_id , update1 = Agrif_Update_Copy , update2 = Agrif_Update_Average) |
---|
| 589 | CALL Agrif_Set_Updatetype(v_ice_id , update1 = Agrif_Update_Average, update2 = Agrif_Update_Copy ) |
---|
[9134] | 590 | #endif |
---|
[7646] | 591 | |
---|
[9610] | 592 | END SUBROUTINE agrif_declare_var_ice |
---|
[7646] | 593 | #endif |
---|
| 594 | |
---|
| 595 | |
---|
[2715] | 596 | # if defined key_top |
---|
[3680] | 597 | SUBROUTINE Agrif_InitValues_cont_top |
---|
| 598 | !!---------------------------------------------------------------------- |
---|
| 599 | !! *** ROUTINE Agrif_InitValues_cont_top *** |
---|
| 600 | !! |
---|
| 601 | !! ** Purpose :: Declaration of variables to be interpolated |
---|
| 602 | !!---------------------------------------------------------------------- |
---|
| 603 | USE Agrif_Util |
---|
| 604 | USE oce |
---|
| 605 | USE dom_oce |
---|
| 606 | USE nemogcm |
---|
| 607 | USE par_trc |
---|
[5656] | 608 | USE lib_mpp |
---|
[3680] | 609 | USE trc |
---|
| 610 | USE in_out_manager |
---|
[9570] | 611 | USE agrif_oce_sponge |
---|
[3680] | 612 | USE agrif_top_update |
---|
| 613 | USE agrif_top_interp |
---|
| 614 | USE agrif_top_sponge |
---|
[7646] | 615 | !! |
---|
[3680] | 616 | IMPLICIT NONE |
---|
| 617 | ! |
---|
[5656] | 618 | CHARACTER(len=10) :: cl_check1, cl_check2, cl_check3 |
---|
[3680] | 619 | LOGICAL :: check_namelist |
---|
| 620 | !!---------------------------------------------------------------------- |
---|
[1300] | 621 | |
---|
| 622 | |
---|
[3680] | 623 | ! 1. Declaration of the type of variable which have to be interpolated |
---|
| 624 | !--------------------------------------------------------------------- |
---|
| 625 | CALL agrif_declare_var_top |
---|
| 626 | |
---|
| 627 | ! 2. First interpolations of potentially non zero fields |
---|
| 628 | !------------------------------------------------------- |
---|
| 629 | Agrif_SpecialValue=0. |
---|
| 630 | Agrif_UseSpecialValue = .TRUE. |
---|
[5656] | 631 | CALL Agrif_Bc_variable(trn_id,calledweight=1.,procname=interptrn) |
---|
[3680] | 632 | Agrif_UseSpecialValue = .FALSE. |
---|
[5656] | 633 | CALL Agrif_Sponge |
---|
| 634 | tabspongedone_trn = .FALSE. |
---|
| 635 | CALL Agrif_Bc_variable(trn_sponge_id,calledweight=1.,procname=interptrn_sponge) |
---|
| 636 | ! reset tsa to zero |
---|
| 637 | tra(:,:,:,:) = 0. |
---|
[3680] | 638 | |
---|
[5656] | 639 | |
---|
[3680] | 640 | ! 3. Some controls |
---|
| 641 | !----------------- |
---|
[5656] | 642 | check_namelist = .TRUE. |
---|
[3680] | 643 | |
---|
| 644 | IF( check_namelist ) THEN |
---|
| 645 | ! Check time steps |
---|
[5656] | 646 | IF( NINT(Agrif_Rhot()) * NINT(rdt) .NE. Agrif_Parent(rdt) ) THEN |
---|
| 647 | WRITE(cl_check1,*) Agrif_Parent(rdt) |
---|
| 648 | WRITE(cl_check2,*) rdt |
---|
| 649 | WRITE(cl_check3,*) rdt*Agrif_Rhot() |
---|
[7646] | 650 | CALL ctl_stop( 'incompatible time step between grids', & |
---|
[5656] | 651 | & 'parent grid value : '//cl_check1 , & |
---|
| 652 | & 'child grid value : '//cl_check2 , & |
---|
[7646] | 653 | & 'value on child grid should be changed to & |
---|
[5656] | 654 | & :'//cl_check3 ) |
---|
[3680] | 655 | ENDIF |
---|
| 656 | |
---|
| 657 | ! Check run length |
---|
| 658 | IF( Agrif_IRhot() * (Agrif_Parent(nitend)- & |
---|
[5656] | 659 | Agrif_Parent(nit000)+1) .NE. (nitend-nit000+1) ) THEN |
---|
| 660 | WRITE(cl_check1,*) (Agrif_Parent(nit000)-1)*Agrif_IRhot() + 1 |
---|
| 661 | WRITE(cl_check2,*) Agrif_Parent(nitend) *Agrif_IRhot() |
---|
| 662 | CALL ctl_warn( 'incompatible run length between grids' , & |
---|
| 663 | & ' nit000 on fine grid will be change to : '//cl_check1, & |
---|
| 664 | & ' nitend on fine grid will be change to : '//cl_check2 ) |
---|
| 665 | nit000 = (Agrif_Parent(nit000)-1)*Agrif_IRhot() + 1 |
---|
| 666 | nitend = Agrif_Parent(nitend) *Agrif_IRhot() |
---|
[3680] | 667 | ENDIF |
---|
| 668 | |
---|
| 669 | ENDIF |
---|
| 670 | ! Check passive tracer cell |
---|
[5656] | 671 | IF( nn_dttrc .NE. 1 ) THEN |
---|
[3680] | 672 | WRITE(*,*) 'nn_dttrc should be equal to 1' |
---|
[1300] | 673 | ENDIF |
---|
[3680] | 674 | ENDIF |
---|
[5656] | 675 | ! |
---|
[3680] | 676 | END SUBROUTINE Agrif_InitValues_cont_top |
---|
[2715] | 677 | |
---|
| 678 | |
---|
[3680] | 679 | SUBROUTINE agrif_declare_var_top |
---|
| 680 | !!---------------------------------------------------------------------- |
---|
| 681 | !! *** ROUTINE agrif_declare_var_top *** |
---|
| 682 | !! |
---|
| 683 | !! ** Purpose :: Declaration of TOP variables to be interpolated |
---|
| 684 | !!---------------------------------------------------------------------- |
---|
| 685 | USE agrif_util |
---|
[5656] | 686 | USE agrif_oce |
---|
[3680] | 687 | USE dom_oce |
---|
| 688 | USE trc |
---|
[7646] | 689 | !! |
---|
[3680] | 690 | IMPLICIT NONE |
---|
[9019] | 691 | ! |
---|
| 692 | INTEGER :: ind1, ind2, ind3 |
---|
[7646] | 693 | !!---------------------------------------------------------------------- |
---|
[2715] | 694 | |
---|
[3680] | 695 | ! 1. Declaration of the type of variable which have to be interpolated |
---|
| 696 | !--------------------------------------------------------------------- |
---|
[9019] | 697 | ind1 = nbghostcells |
---|
| 698 | ind2 = 1 + nbghostcells |
---|
| 699 | ind3 = 2 + nbghostcells |
---|
[9031] | 700 | # if defined key_vertical |
---|
| 701 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_id) |
---|
| 702 | CALL agrif_declare_variable((/2,2,0,0/),(/ind3,ind3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra+1/),trn_sponge_id) |
---|
| 703 | # else |
---|
| 704 | CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_id) |
---|
| 705 | CALL agrif_declare_variable((/2,2,0,0/),(/3,3,0,0/),(/'x','y','N','N'/),(/1,1,1,1/),(/nlci,nlcj,jpk,jptra/),trn_sponge_id) |
---|
| 706 | # endif |
---|
[2715] | 707 | |
---|
[3680] | 708 | ! 2. Type of interpolation |
---|
| 709 | !------------------------- |
---|
| 710 | CALL Agrif_Set_bcinterp(trn_id,interp=AGRIF_linear) |
---|
[5656] | 711 | CALL Agrif_Set_bcinterp(trn_sponge_id,interp=AGRIF_linear) |
---|
[3680] | 712 | |
---|
| 713 | ! 3. Location of interpolation |
---|
| 714 | !----------------------------- |
---|
[9019] | 715 | CALL Agrif_Set_bc(trn_id,(/0,ind1/)) |
---|
[5656] | 716 | CALL Agrif_Set_bc(trn_sponge_id,(/-nn_sponge_len*Agrif_irhox()-1,0/)) |
---|
[3680] | 717 | |
---|
[9031] | 718 | ! 4. Update type |
---|
[3680] | 719 | !--------------- |
---|
[9031] | 720 | # if defined UPD_HIGH |
---|
| 721 | CALL Agrif_Set_Updatetype(trn_id, update = Agrif_Update_Full_Weighting) |
---|
| 722 | #else |
---|
[5656] | 723 | CALL Agrif_Set_Updatetype(trn_id, update = AGRIF_Update_Average) |
---|
[9031] | 724 | #endif |
---|
[5656] | 725 | ! |
---|
[3680] | 726 | END SUBROUTINE agrif_declare_var_top |
---|
[2715] | 727 | # endif |
---|
[636] | 728 | |
---|
[3680] | 729 | SUBROUTINE Agrif_detect( kg, ksizex ) |
---|
| 730 | !!---------------------------------------------------------------------- |
---|
[7646] | 731 | !! *** ROUTINE Agrif_detect *** |
---|
[3680] | 732 | !!---------------------------------------------------------------------- |
---|
| 733 | INTEGER, DIMENSION(2) :: ksizex |
---|
| 734 | INTEGER, DIMENSION(ksizex(1),ksizex(2)) :: kg |
---|
| 735 | !!---------------------------------------------------------------------- |
---|
| 736 | ! |
---|
| 737 | RETURN |
---|
| 738 | ! |
---|
| 739 | END SUBROUTINE Agrif_detect |
---|
[390] | 740 | |
---|
[782] | 741 | |
---|
[3680] | 742 | SUBROUTINE agrif_nemo_init |
---|
| 743 | !!---------------------------------------------------------------------- |
---|
| 744 | !! *** ROUTINE agrif_init *** |
---|
| 745 | !!---------------------------------------------------------------------- |
---|
| 746 | USE agrif_oce |
---|
| 747 | USE agrif_ice |
---|
| 748 | USE in_out_manager |
---|
| 749 | USE lib_mpp |
---|
[7646] | 750 | !! |
---|
[3680] | 751 | IMPLICIT NONE |
---|
| 752 | ! |
---|
[4147] | 753 | INTEGER :: ios ! Local integer output status for namelist read |
---|
[5656] | 754 | INTEGER :: iminspon |
---|
[9031] | 755 | NAMELIST/namagrif/ rn_sponge_tra, rn_sponge_dyn, ln_spc_dyn, ln_chk_bathy |
---|
[5656] | 756 | !!-------------------------------------------------------------------------------------- |
---|
[3680] | 757 | ! |
---|
[5656] | 758 | REWIND( numnam_ref ) ! Namelist namagrif in reference namelist : AGRIF zoom |
---|
| 759 | READ ( numnam_ref, namagrif, IOSTAT = ios, ERR = 901) |
---|
[9169] | 760 | 901 IF( ios /= 0 ) CALL ctl_nam ( ios , 'namagrif in reference namelist', lwp ) |
---|
[5656] | 761 | REWIND( numnam_cfg ) ! Namelist namagrif in configuration namelist : AGRIF zoom |
---|
| 762 | READ ( numnam_cfg, namagrif, IOSTAT = ios, ERR = 902 ) |
---|
[9169] | 763 | 902 IF( ios > 0 ) CALL ctl_nam ( ios , 'namagrif in configuration namelist', lwp ) |
---|
[5656] | 764 | IF(lwm) WRITE ( numond, namagrif ) |
---|
[3680] | 765 | ! |
---|
| 766 | IF(lwp) THEN ! control print |
---|
| 767 | WRITE(numout,*) |
---|
| 768 | WRITE(numout,*) 'agrif_nemo_init : AGRIF parameters' |
---|
| 769 | WRITE(numout,*) '~~~~~~~~~~~~~~~' |
---|
| 770 | WRITE(numout,*) ' Namelist namagrif : set AGRIF parameters' |
---|
| 771 | WRITE(numout,*) ' sponge coefficient for tracers rn_sponge_tra = ', rn_sponge_tra, ' s' |
---|
| 772 | WRITE(numout,*) ' sponge coefficient for dynamics rn_sponge_tra = ', rn_sponge_dyn, ' s' |
---|
| 773 | WRITE(numout,*) ' use special values for dynamics ln_spc_dyn = ', ln_spc_dyn |
---|
[5656] | 774 | WRITE(numout,*) ' check bathymetry ln_chk_bathy = ', ln_chk_bathy |
---|
[3680] | 775 | ENDIF |
---|
| 776 | ! |
---|
| 777 | ! convert DOCTOR namelist name into OLD names |
---|
| 778 | visc_tra = rn_sponge_tra |
---|
| 779 | visc_dyn = rn_sponge_dyn |
---|
| 780 | ! |
---|
[5656] | 781 | ! Check sponge length: |
---|
| 782 | iminspon = MIN(FLOOR(REAL(jpiglo-4)/REAL(2*Agrif_irhox())), FLOOR(REAL(jpjglo-4)/REAL(2*Agrif_irhox())) ) |
---|
| 783 | IF (lk_mpp) iminspon = MIN(iminspon,FLOOR(REAL(jpi-2)/REAL(Agrif_irhox())), FLOOR(REAL(jpj-2)/REAL(Agrif_irhox())) ) |
---|
| 784 | IF (nn_sponge_len > iminspon) CALL ctl_stop('agrif sponge length is too large') |
---|
| 785 | ! |
---|
| 786 | IF( agrif_oce_alloc() > 0 ) CALL ctl_warn('agrif agrif_oce_alloc: allocation of arrays failed') |
---|
[3680] | 787 | ! |
---|
| 788 | END SUBROUTINE agrif_nemo_init |
---|
| 789 | |
---|
[1605] | 790 | # if defined key_mpp_mpi |
---|
| 791 | |
---|
[3680] | 792 | SUBROUTINE Agrif_InvLoc( indloc, nprocloc, i, indglob ) |
---|
| 793 | !!---------------------------------------------------------------------- |
---|
[9031] | 794 | !! *** ROUTINE Agrif_InvLoc *** |
---|
[3680] | 795 | !!---------------------------------------------------------------------- |
---|
| 796 | USE dom_oce |
---|
[7646] | 797 | !! |
---|
[3680] | 798 | IMPLICIT NONE |
---|
| 799 | ! |
---|
| 800 | INTEGER :: indglob, indloc, nprocloc, i |
---|
| 801 | !!---------------------------------------------------------------------- |
---|
| 802 | ! |
---|
| 803 | SELECT CASE( i ) |
---|
| 804 | CASE(1) ; indglob = indloc + nimppt(nprocloc+1) - 1 |
---|
[5656] | 805 | CASE(2) ; indglob = indloc + njmppt(nprocloc+1) - 1 |
---|
| 806 | CASE DEFAULT |
---|
| 807 | indglob = indloc |
---|
[3680] | 808 | END SELECT |
---|
| 809 | ! |
---|
| 810 | END SUBROUTINE Agrif_InvLoc |
---|
[390] | 811 | |
---|
[7646] | 812 | |
---|
[5656] | 813 | SUBROUTINE Agrif_get_proc_info( imin, imax, jmin, jmax ) |
---|
| 814 | !!---------------------------------------------------------------------- |
---|
| 815 | !! *** ROUTINE Agrif_get_proc_info *** |
---|
| 816 | !!---------------------------------------------------------------------- |
---|
| 817 | USE par_oce |
---|
[7646] | 818 | !! |
---|
[5656] | 819 | IMPLICIT NONE |
---|
| 820 | ! |
---|
| 821 | INTEGER, INTENT(out) :: imin, imax |
---|
| 822 | INTEGER, INTENT(out) :: jmin, jmax |
---|
| 823 | !!---------------------------------------------------------------------- |
---|
| 824 | ! |
---|
| 825 | imin = nimppt(Agrif_Procrank+1) ! ????? |
---|
| 826 | jmin = njmppt(Agrif_Procrank+1) ! ????? |
---|
| 827 | imax = imin + jpi - 1 |
---|
| 828 | jmax = jmin + jpj - 1 |
---|
| 829 | ! |
---|
| 830 | END SUBROUTINE Agrif_get_proc_info |
---|
| 831 | |
---|
[7646] | 832 | |
---|
[5656] | 833 | SUBROUTINE Agrif_estimate_parallel_cost(imin, imax,jmin, jmax, nbprocs, grid_cost) |
---|
| 834 | !!---------------------------------------------------------------------- |
---|
| 835 | !! *** ROUTINE Agrif_estimate_parallel_cost *** |
---|
| 836 | !!---------------------------------------------------------------------- |
---|
| 837 | USE par_oce |
---|
[7646] | 838 | !! |
---|
[5656] | 839 | IMPLICIT NONE |
---|
| 840 | ! |
---|
| 841 | INTEGER, INTENT(in) :: imin, imax |
---|
| 842 | INTEGER, INTENT(in) :: jmin, jmax |
---|
| 843 | INTEGER, INTENT(in) :: nbprocs |
---|
| 844 | REAL(wp), INTENT(out) :: grid_cost |
---|
| 845 | !!---------------------------------------------------------------------- |
---|
| 846 | ! |
---|
| 847 | grid_cost = REAL(imax-imin+1,wp)*REAL(jmax-jmin+1,wp) / REAL(nbprocs,wp) |
---|
| 848 | ! |
---|
| 849 | END SUBROUTINE Agrif_estimate_parallel_cost |
---|
| 850 | |
---|
[1605] | 851 | # endif |
---|
| 852 | |
---|
[390] | 853 | #else |
---|
[3680] | 854 | SUBROUTINE Subcalledbyagrif |
---|
| 855 | !!---------------------------------------------------------------------- |
---|
| 856 | !! *** ROUTINE Subcalledbyagrif *** |
---|
| 857 | !!---------------------------------------------------------------------- |
---|
| 858 | WRITE(*,*) 'Impossible to be here' |
---|
| 859 | END SUBROUTINE Subcalledbyagrif |
---|
[390] | 860 | #endif |
---|