- Timestamp:
- 2020-06-03T16:36:09+02:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendors/AGRIF/dev_r12970_AGRIF_CMEMS/AGRIF_FILES/modbcfunction.F90
r5656 r13027 53 53 !> To set the TYPE of the variable 54 54 !--------------------------------------------------------------------------------------------------- 55 subroutine Agrif_Set_parent_int( tabvarsindic,value)56 !--------------------------------------------------------------------------------------------------- 57 integer, intent(in) :: tabvarsindic!< indice of the variable in tabvars55 subroutine Agrif_Set_parent_int(integer_variable,value) 56 !--------------------------------------------------------------------------------------------------- 57 integer, intent(in) :: integer_variable !< indice of the variable in tabvars 58 58 integer, intent(in) :: value !< input value 59 59 ! 60 Agrif_Curgrid % parent % tabvars_i(tabvarsindic) % iarray0 = value 60 61 integer :: i 62 logical :: i_found 63 64 i_found = .FALSE. 65 66 do i=1,Agrif_NbVariables(4) 67 if (LOC(integer_variable) == LOC(agrif_curgrid%tabvars_i(i)%iarray0)) then 68 agrif_curgrid%tabvars_i(i)%parent_var%iarray0 = value 69 i_found = .TRUE. 70 EXIT 71 endif 72 enddo 73 74 if (.NOT.i_found) STOP 'Agrif_Set_Integer : Variable not found' 75 61 76 !--------------------------------------------------------------------------------------------------- 62 77 end subroutine Agrif_Set_parent_int … … 66 81 ! subroutine Agrif_Set_parent_real4 67 82 !--------------------------------------------------------------------------------------------------- 68 !> To set the TYPE of the variable 69 !--------------------------------------------------------------------------------------------------- 70 subroutine Agrif_Set_parent_real4 ( tabvarsindic, value ) 71 !--------------------------------------------------------------------------------------------------- 72 integer, intent(in) :: tabvarsindic !< indice of the variable in tabvars 73 real(kind=4),intent(in) :: value !< input value 74 ! 75 Agrif_Curgrid % parent % tabvars_r(tabvarsindic) % array0 = value 76 Agrif_Curgrid % parent % tabvars_r(tabvarsindic) % sarray0 = value 83 !> To set the parent value of a real variable 84 !--------------------------------------------------------------------------------------------------- 85 subroutine Agrif_Set_parent_real4 ( real_variable, value ) 86 !--------------------------------------------------------------------------------------------------- 87 real(kind=4), intent(in) :: real_variable !< input variable 88 real(kind=4),intent(in) :: value !< input value for the parent grid 89 90 integer :: i 91 logical :: i_found 92 93 i_found = .FALSE. 94 95 do i=1,Agrif_NbVariables(2) 96 if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%array0)) then 97 agrif_curgrid%tabvars_r(i)%parent_var%array0 = value 98 agrif_curgrid%tabvars_r(i)%parent_var%sarray0 = value 99 i_found = .TRUE. 100 EXIT 101 endif 102 enddo 103 104 IF (.NOT.i_found) THEN 105 do i=1,Agrif_NbVariables(2) 106 if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%sarray0)) then 107 agrif_curgrid%tabvars_r(i)%parent_var%array0 = value 108 agrif_curgrid%tabvars_r(i)%parent_var%sarray0 = value 109 i_found = .TRUE. 110 EXIT 111 endif 112 enddo 113 ENDIF 114 115 if (.NOT.i_found) STOP 'Agrif_Set_parent_real4 : Variable not found' 116 77 117 !--------------------------------------------------------------------------------------------------- 78 118 end subroutine Agrif_Set_parent_real4 … … 82 122 ! subroutine Agrif_Set_parent_real8 83 123 !--------------------------------------------------------------------------------------------------- 84 !> To set the TYPE of the variable 85 !--------------------------------------------------------------------------------------------------- 86 subroutine Agrif_Set_parent_real8 ( tabvarsindic, value ) 87 !--------------------------------------------------------------------------------------------------- 88 integer, intent(in) :: tabvarsindic !< indice of the variable in tabvars 89 real(kind=8),intent(in) :: value !< input value 90 ! 91 Agrif_Curgrid % parent % tabvars_r(tabvarsindic) % darray0 = value 124 !> To set the parent value of a real variable 125 !--------------------------------------------------------------------------------------------------- 126 subroutine Agrif_Set_parent_real8 ( real_variable, value ) 127 !--------------------------------------------------------------------------------------------------- 128 real(kind=8), intent(in) :: real_variable !< input variable 129 real(kind=8),intent(in) :: value !< input value for the parent grid 130 131 integer :: i 132 logical :: i_found 133 134 i_found = .FALSE. 135 136 do i=1,Agrif_NbVariables(2) 137 if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%array0)) then 138 agrif_curgrid%tabvars_r(i)%parent_var%darray0 = value 139 agrif_curgrid%tabvars_r(i)%parent_var%array0 = value 140 i_found = .TRUE. 141 EXIT 142 endif 143 enddo 144 145 IF (.NOT.i_found) THEN 146 do i=1,Agrif_NbVariables(2) 147 if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%darray0)) then 148 agrif_curgrid%tabvars_r(i)%parent_var%darray0 = value 149 agrif_curgrid%tabvars_r(i)%parent_var%array0 = value 150 i_found = .TRUE. 151 EXIT 152 endif 153 enddo 154 ENDIF 155 156 if (.NOT.i_found) STOP 'Agrif_Set_parent_real8 : Variable not found' 157 92 158 !--------------------------------------------------------------------------------------------------- 93 159 end subroutine Agrif_Set_parent_real8 … … 106 172 type(Agrif_Variable), pointer :: var 107 173 ! 108 indic = Agrif_Curgrid % tabvars_i(tabvarsindic) % iarray0 109 ! 110 if (indic <= 0) then 111 var => Agrif_Search_Variable(Agrif_Curgrid,-indic) 112 else 113 print*,"Agrif_Set_bc : warning indic >= 0 !!!" 114 var => Agrif_Curgrid % tabvars(indic) 115 endif 116 174 var => Agrif_Search_Variable(Agrif_Curgrid,tabvarsindic) 117 175 if (.not.associated(var)) return ! Grand mother grid case 118 176 ! … … 145 203 type(Agrif_Variable), pointer :: var 146 204 ! 147 indic = Agrif_Curgrid % tabvars_i(tabvarsindic) % iarray0 148 ! 149 if (indic <= 0) then 150 var => Agrif_Search_Variable(Agrif_Mygrid,-indic) 151 else 152 print*,"Agrif_Set_interp : warning indic >= 0 !!!" 153 var => Agrif_Mygrid % tabvars(indic) 154 endif 205 var => Agrif_Search_Variable(Agrif_Curgrid,tabvarsindic) 206 if (.not.associated(var)) return ! Grand mother grid case 155 207 ! 156 208 var % type_interp = Agrif_Constant … … 178 230 TYPE(Agrif_Variable), pointer :: var 179 231 ! 180 indic = Agrif_Curgrid%tabvars_i(tabvarsindic)%iarray0 181 ! 182 if (indic <= 0) then 183 var => Agrif_Search_Variable(Agrif_Mygrid,-indic) 184 else 185 print*,"Agrif_Set_bcinterp : warning indic >= 0 !!!" 186 var => Agrif_Mygrid % tabvars(indic) 187 endif 232 var => Agrif_Search_Variable(Agrif_Curgrid,tabvarsindic) 188 233 ! 189 234 var % type_interp_bc = Agrif_Constant … … 214 259 type(Agrif_Variable), pointer :: root_var 215 260 ! 216 indic = Agrif_Curgrid%tabvars_i(tabvarsindic)%iarray0 217 ! 218 if (indic <= 0) then 219 root_var => Agrif_Search_Variable(Agrif_Mygrid,-indic) 220 else 221 print*,"Agrif_Set_UpdateType : warning indic >= 0 !!!" 222 root_var => Agrif_Mygrid % tabvars(indic) 223 endif 261 262 root_var => Agrif_Search_Variable(Agrif_Mygrid,tabvarsindic) 263 224 264 ! 225 265 root_var % type_update = Agrif_Update_Copy … … 243 283 INTEGER :: indic ! indice of the variable in tabvars 244 284 ! 285 print *,'CURRENTLY BROKEN' 286 STOP 287 245 288 indic = Agrif_Curgrid%tabvars_i(tabvarsindic)%iarray0 246 289 ! … … 283 326 type(Agrif_Variable), pointer :: child_var 284 327 type(Agrif_Variable), pointer :: child_tmp ! Temporary variable on the child grid 328 integer :: i 329 integer,dimension(7) :: lb, ub 285 330 ! 286 331 if ( Agrif_Curgrid%level <= 0 ) return 287 332 ! 288 indic = Agrif_Curgrid%tabvars_i(tabvarsindic)%iarray0289 333 ! 290 334 if ( present(calledweight) ) then … … 296 340 endif 297 341 ! 298 if (indic <= 0) then 299 child_var => Agrif_Search_Variable(Agrif_Curgrid,-indic) 342 child_var => Agrif_Search_Variable(Agrif_Curgrid,tabvarsindic) 300 343 parent_var => child_var % parent_var 301 344 root_var => child_var % root_var 302 else303 print*,"Agrif_Bc_variable : warning indic >= 0 !!!"304 child_var => Agrif_Curgrid % tabvars(indic)305 parent_var => Agrif_Curgrid % parent % tabvars(indic)306 root_var => Agrif_Mygrid % tabvars(indic)307 endif308 345 ! 309 346 nbdim = root_var % nbdim 310 347 ! 348 do i=1,nbdim 349 if (root_var%coords(i) == 0) then 350 lb(i) = parent_var%lb(i) 351 ub(i) = parent_var%ub(i) 352 else 353 lb(i) = child_var%lb(i) 354 ub(i) = child_var%ub(i) 355 endif 356 enddo 357 311 358 select case( nbdim ) 312 359 case(1) 313 allocate(parray1( child_var%lb(1):child_var%ub(1)))360 allocate(parray1(lb(1):ub(1))) 314 361 case(2) 315 allocate(parray2( child_var%lb(1):child_var%ub(1), &316 child_var%lb(2):child_var%ub(2) ))362 allocate(parray2(lb(1):ub(1), & 363 lb(2):ub(2) )) 317 364 case(3) 318 allocate(parray3( child_var%lb(1):child_var%ub(1), &319 child_var%lb(2):child_var%ub(2), &320 child_var%lb(3):child_var%ub(3) ))365 allocate(parray3(lb(1):ub(1), & 366 lb(2):ub(2), & 367 lb(3):ub(3) )) 321 368 case(4) 322 allocate(parray4( child_var%lb(1):child_var%ub(1), &323 child_var%lb(2):child_var%ub(2), &324 child_var%lb(3):child_var%ub(3), &325 child_var%lb(4):child_var%ub(4) ))369 allocate(parray4(lb(1):ub(1), & 370 lb(2):ub(2), & 371 lb(3):ub(3), & 372 lb(4):ub(4) )) 326 373 case(5) 327 allocate(parray5( child_var%lb(1):child_var%ub(1), &328 child_var%lb(2):child_var%ub(2), &329 child_var%lb(3):child_var%ub(3), &330 child_var%lb(4):child_var%ub(4), &331 child_var%lb(5):child_var%ub(5) ))374 allocate(parray5(lb(1):ub(1), & 375 lb(2):ub(2), & 376 lb(3):ub(3), & 377 lb(4):ub(4), & 378 lb(5):ub(5) )) 332 379 case(6) 333 allocate(parray6( child_var%lb(1):child_var%ub(1), &334 child_var%lb(2):child_var%ub(2), &335 child_var%lb(3):child_var%ub(3), &336 child_var%lb(4):child_var%ub(4), &337 child_var%lb(5):child_var%ub(5), &338 child_var%lb(6):child_var%ub(6) ))380 allocate(parray6(lb(1):ub(1), & 381 lb(2):ub(2), & 382 lb(3):ub(3), & 383 lb(4):ub(4), & 384 lb(5):ub(5), & 385 lb(6):ub(6) )) 339 386 end select 340 387 ! … … 343 390 ! 344 391 child_tmp % root_var => root_var 392 child_tmp % parent_var => parent_var 345 393 child_tmp % oldvalues2D => child_var % oldvalues2D 346 394 ! … … 400 448 type(Agrif_Variable), pointer :: child_tmp ! Temporary variable on the child grid 401 449 ! 450 402 451 if ( Agrif_Curgrid%level <= 0 ) return 403 452 ! 404 indic = Agrif_Curgrid%tabvars_i(tabvarsindic)%iarray0 405 ! 406 if (indic <= 0) then 407 child_var => Agrif_Search_Variable(Agrif_Curgrid,-indic) 453 454 child_var => Agrif_Search_Variable(Agrif_Curgrid,tabvarsindic) 408 455 parent_var => child_var % parent_var 409 456 root_var => child_var % root_var 410 else 411 print*,"Agrif_Interp_variable : warning indic >= 0 !!!" 412 child_var => Agrif_Curgrid % tabvars(indic) 413 parent_var => Agrif_Curgrid % parent % tabvars(indic) 414 root_var => Agrif_Mygrid % tabvars(indic) 415 endif 457 416 458 ! 417 459 nbdim = root_var % nbdim … … 421 463 ! 422 464 child_tmp % root_var => root_var 465 child_tmp % parent_var => parent_var 423 466 child_tmp % nbdim = root_var % nbdim 424 467 child_tmp % point = child_var % point … … 486 529 if (agrif_curgrid%grand_mother_grid) return 487 530 ! 488 indic = Agrif_Curgrid%tabvars_i(tabvarsindic)%iarray0 489 ! 490 if (indic <= 0) then 491 child_var => Agrif_Search_Variable(Agrif_Curgrid, -indic) 531 532 child_var => Agrif_Search_Variable(Agrif_Curgrid, tabvarsindic) 492 533 parent_var => child_var % parent_var 493 534 494 535 if (.not.associated(parent_var)) then 495 536 ! can occur during the first update of Agrif_Coarsegrid (if any) 496 parent_var => Agrif_Search_Variable(Agrif_Curgrid % parent, -indic)537 parent_var => Agrif_Search_Variable(Agrif_Curgrid % parent, tabvarsindic) 497 538 child_var % parent_var => parent_var 498 539 endif 499 540 500 541 root_var => child_var % root_var 501 else 502 print*,"Agrif_Update_Variable : warning indic >= 0 !!!" 503 root_var => Agrif_Mygrid % tabvars(indic) 504 child_var => Agrif_Curgrid % tabvars(indic) 505 parent_var => Agrif_Curgrid % parent % tabvars(indic) 506 endif 542 507 543 ! 508 544 nbdim = root_var % nbdim … … 551 587 integer :: nbdim 552 588 ! 589 print *,'CURRENTLY BROKEN' 590 STOP 553 591 root_var => Agrif_Mygrid % tabvars(tabvarsindic0) 554 592 save_var => Agrif_Curgrid % tabvars(tabvarsindic0) … … 575 613 integer :: indic 576 614 ! 615 print *,'CURRENTLY BROKEN' 616 STOP 577 617 indic = tabvarsindic 578 618 if (tabvarsindic >= 0) then … … 612 652 integer :: indic 613 653 ! 654 print *,'CURRENTLY BROKEN' 655 STOP 656 614 657 indic = tabvarsindic 615 658 if (tabvarsindic >= 0) then … … 650 693 integer :: indic 651 694 ! 695 print *,'CURRENTLY BROKEN' 696 STOP 652 697 indic = tabvarsindic 653 698 if (tabvarsindic >= 0) then
Note: See TracChangeset
for help on using the changeset viewer.