Changeset 10725 for vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modinterp.F90
- Timestamp:
- 2019-02-27T14:55:54+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modinterp.F90
r10087 r10725 26 26 module Agrif_Interpolation 27 27 ! 28 use Agrif_Init 29 use Agrif_Arrays 30 use Agrif_InterpBasic 31 use Agrif_User_Functions 32 28 use Agrif_InterpBasic 29 use Agrif_Arrays 30 use Agrif_Mask 31 use Agrif_CurgridFunctions 33 32 #if defined AGRIF_MPI 34 33 use Agrif_Mpp 35 34 #endif 36 37 use Agrif_Mask38 35 ! 39 36 implicit none … … 69 66 integer, dimension(6) :: ub_child 70 67 integer, dimension(6) :: lb_parent 71 real (kind=8), dimension(6) :: s_child, s_parent72 real (kind=8), dimension(6) :: ds_child, ds_parent68 real , dimension(6) :: s_child, s_parent 69 real , dimension(6) :: ds_child, ds_parent 73 70 integer, dimension(child % root_var % nbdim,2,2) :: childarray 74 71 ! … … 118 115 INTEGER, DIMENSION(nbdim), INTENT(in) :: pttab_Parent !< Index of the first point inside the domain 119 116 !< for the parent grid variable 120 REAL (kind=8), DIMENSION(nbdim), INTENT(in) :: s_Child,s_Parent !< Positions of the parent and child grids121 REAL (kind=8), DIMENSION(nbdim), INTENT(in) :: ds_Child,ds_Parent !< Space steps of the parent and child grids117 REAL, DIMENSION(nbdim), INTENT(in) :: s_Child,s_Parent !< Positions of the parent and child grids 118 REAL, DIMENSION(nbdim), INTENT(in) :: ds_Child,ds_Parent !< Space steps of the parent and child grids 122 119 TYPE(Agrif_Variable), pointer :: restore !< Indicates points where interpolation 123 120 LOGICAL, INTENT(in) :: torestore !< Indicates if the array restore is used … … 131 128 INTEGER :: i,j,k,l,m,n 132 129 INTEGER, DIMENSION(nbdim) :: pttruetab,cetruetab 133 INTEGER, DIMENSION(nbdim) :: indmin, indmax , indmin_required_p, indmax_required_p130 INTEGER, DIMENSION(nbdim) :: indmin, indmax 134 131 INTEGER, DIMENSION(nbdim) :: indminglob, indmaxglob 135 132 #if defined AGRIF_MPI … … 138 135 #endif 139 136 LOGICAL, DIMENSION(nbdim) :: noraftab 140 REAL (kind=8) , DIMENSION(nbdim) :: s_Child_temp,s_Parent_temp,s_Parent_temp_p137 REAL , DIMENSION(nbdim) :: s_Child_temp,s_Parent_temp 141 138 INTEGER, DIMENSION(nbdim) :: lowerbound, upperbound, coords 142 139 INTEGER, DIMENSION(nbdim,2,2), INTENT(OUT) :: childarray … … 174 171 child % list_interp, & 175 172 pttab, petab, pttab_Child, pttab_Parent, nbdim, & 176 indmin, indmax, indmin_required_p, indmax_required_p, & 177 indminglob, indmaxglob, & 173 indmin, indmax, indminglob, indmaxglob, & 178 174 pttruetab, cetruetab, memberin & 179 175 #if defined AGRIF_MPI … … 182 178 #endif 183 179 ) 184 185 180 ! 186 181 if (.not.find_list_interp) then 187 182 ! 188 ! output : lowerbound and upperbound are the (local) lower and upper bounds of the child arrays189 190 183 call Agrif_get_var_bounds_array(child, lowerbound, upperbound, nbdim) 191 192 ! input : pttab, petab : global indexes where the interpolation is required193 ! output : pttruetab, cetruetab : global indexes restricted to the bounds of the current processor194 ! output : memberin is false if the current processor is not involved in the interpolation195 196 184 call Agrif_Childbounds(nbdim, lowerbound, upperbound, & 197 185 pttab, petab, Agrif_Procrank, coords, & 198 186 pttruetab, cetruetab, memberin) 199 200 201 202 ! output : indminglob, indmaxglob : global indexes required on the parent grid for the interpolation203 ! output : s_Parent_temp, s_Child_temp : local s_Parent, s_Child relatively to indmin ou pttab204 187 call Agrif_Parentbounds(type_interp,nbdim,indminglob,indmaxglob, & 205 indmin_required_p, indmax_required_p, &206 188 s_Parent_temp,s_Child_temp, & 207 189 s_Child,ds_Child, & … … 212 194 #if defined AGRIF_MPI 213 195 if (memberin) then 214 215 ! output : indmin, indmax : global indexes required on the parent grid for the interpolation on the current processor (i.e. on pttruetab, cetruetab)216 ! output : s_Parent_temp, s_Child_temp : local s_Parent, s_Child relatively to indmin ou pttruetab217 196 call Agrif_Parentbounds(type_interp,nbdim,indmin,indmax, & 218 indmin_required_p, indmax_required_p, &219 197 s_Parent_temp,s_Child_temp, & 220 198 s_Child,ds_Child, & … … 226 204 227 205 local_proc = Agrif_Procrank 228 229 ! output : lowerbound and upperbound are the (local) lower and upper bounds of the parent arrays230 206 call Agrif_get_var_bounds_array(parent,lowerbound,upperbound,nbdim) 231 207 call Agrif_ChildGrid_to_ParentGrid() 232 233 ! input : indminglob,indmaxglob : global indexes where data are required for the interpolation 234 ! output : indminglob2,indmaxglob2 : global indexes restricted to the bounds of the current processor 235 ! output : member is false if the current processor does not need to send data 236 ! output : indminglob3,indmaxglob3 : global bounds on the current processor for the parent array 237 208 ! 238 209 call Agrif_Childbounds(nbdim,lowerbound,upperbound, & 239 210 indminglob,indmaxglob, local_proc, coords, & … … 242 213 ! 243 214 if (member) then 244 245 ! output : parentarray246 ! output : parentarray (:,:,2) : indminglob2, indmaxglob2 in term of local indexes on current processor247 ! output : parentarray (:,:,1) : indminglob2, indmaxglob2 restricted to the current processor (different from indminglob2 ???)248 ! output : member is .false. is the current processor has not data to send249 250 215 call Agrif_GlobalToLocalBounds(parentarray, & 251 216 lowerbound, upperbound, & … … 256 221 call Agrif_ParentGrid_to_ChildGrid() 257 222 #else 258 259 ! In the sequentiel case, the following lines ensure that the bounds needed on the parent grid in the interpolation260 ! do not exceed lower and upper bounds of the parent array261 262 ! output : lowerbound and upperbound are the (local) lower and upper bounds of the parent arrays263 call Agrif_get_var_bounds_array(parent,lowerbound,upperbound,nbdim)264 call Agrif_ChildGrid_to_ParentGrid()265 266 ! input : indminglob,indmaxglob : global indexes where data are required for the interpolation267 ! output : indminglob2,indmaxglob2 : global indexes restricted to the bounds of the current processor268 ! output : member is false if the current processor does not need to send data269 270 call Agrif_Childbounds(nbdim,lowerbound,upperbound, &271 indminglob,indmaxglob, Agrif_Procrank, coords, &272 indmin,indmax,member)273 274 call Agrif_ParentGrid_to_ChildGrid()275 276 indminglob = indmin277 indmaxglob = indmax278 279 223 parentarray(:,1,1) = indminglob 280 224 parentarray(:,2,1) = indmaxglob 281 225 parentarray(:,1,2) = indminglob 282 226 parentarray(:,2,2) = indmaxglob 283 284 ! indmin = indminglob 285 ! indmax = indmaxglob 286 227 indmin = indminglob 228 indmax = indmaxglob 287 229 member = .TRUE. 288 s_Parent_temp = s_Parent + (indminglob - pttab_Parent) * ds_Parent289 290 230 #endif 291 231 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! … … 307 247 s_Child_temp = s_Child + (pttruetab - pttab_Child) * ds_Child 308 248 #else 309 310 ! In the sequentiel case, the following lines ensure that the bounds needed on the parent grid in the interpolation311 ! do not exceed lower and upper bounds of the parent array312 313 ! output : lowerbound and upperbound are the (local) lower and upper bounds of the parent arrays314 call Agrif_get_var_bounds_array(parent,lowerbound,upperbound,nbdim)315 call Agrif_ChildGrid_to_ParentGrid()316 317 ! input : indminglob,indmaxglob : global indexes where data are required for the interpolation318 ! output : indminglob2,indmaxglob2 : global indexes restricted to the bounds of the current processor319 ! output : member is false if the current processor does not need to send data320 321 call Agrif_Childbounds(nbdim,lowerbound,upperbound, &322 indminglob,indmaxglob, Agrif_Procrank, coords, &323 indmin,indmax,member)324 325 call Agrif_ParentGrid_to_ChildGrid()326 327 indminglob = indmin328 indmaxglob = indmax329 330 249 parentarray(:,1,1) = indminglob 331 250 parentarray(:,2,1) = indmaxglob 332 251 parentarray(:,1,2) = indminglob 333 252 parentarray(:,2,2) = indmaxglob 334 !indmin = indminglob335 !indmax = indmaxglob253 indmin = indminglob 254 indmax = indmaxglob 336 255 member = .TRUE. 337 256 s_Parent_temp = s_Parent + (indminglob - pttab_Parent) * ds_Parent … … 343 262 if (.not.associated(tempP)) allocate(tempP) 344 263 ! 345 346 264 call Agrif_array_allocate(tempP,parentarray(:,1,1),parentarray(:,2,1),nbdim) 347 265 call Agrif_var_set_array_tozero(tempP,nbdim) … … 384 302 parentarray(6,1,2),parentarray(6,2,2),.TRUE.,nb,ndir) 385 303 end select 386 387 304 ! 388 305 call Agrif_ParentGrid_to_ChildGrid() … … 443 360 child%list_interp,pttab,petab, & 444 361 pttab_Child,pttab_Parent,indmin,indmax, & 445 indmin_required_p, indmax_required_p, &446 362 indminglob,indmaxglob, & 447 363 pttruetab,cetruetab, & … … 456 372 endif 457 373 ! 458 459 374 if (memberin) then 460 375 ! 461 376 if (.not.associated(tempC)) allocate(tempC) 462 377 ! 463 464 378 call Agrif_array_allocate(tempC,pttruetab,cetruetab,nbdim) 465 466 379 ! 467 380 ! Special values on the parent grid … … 471 384 ! 472 385 if (.not.associated(parentvalues)) allocate(parentvalues) 473 !t 474 386 ! 475 387 call Agrif_array_allocate(parentvalues,indmin,indmax,nbdim) 476 388 call Agrif_var_full_copy_array(parentvalues,tempPextend,nbdim) 477 389 ! 478 call Agrif_CheckMasknD(tempPextend,parentvalues, & 479 indmin(1:nbdim),indmax(1:nbdim), & 480 indmin(1:nbdim),indmax(1:nbdim), & 481 indmin_required_p(1:nbdim),indmax_required_p(1:nbdim), & 390 call Agrif_CheckMasknD(tempPextend,parentvalues, & 391 indmin(1:nbdim),indmax(1:nbdim), & 392 indmin(1:nbdim),indmax(1:nbdim), & 482 393 noraftab(1:nbdim),nbdim) 483 394 ! … … 507 418 ds_Child(1:2), ds_Parent(1:2) ) 508 419 case(3) 509 s_Parent_temp_p = s_Parent + (indmin_required_p - pttab_Parent) * ds_Parent 510 call Agrif_Interp_3D_recursive( type_interp(1:3), & 511 tempPextend % array3( & 512 indmin_required_p(1):indmax_required_p(1), & 513 indmin_required_p(2):indmax_required_p(2), & 514 indmin_required_p(3):indmax_required_p(3)), & 515 tempC % array3, & 516 indmin_required_p(1:3), indmax_required_p(1:3), & 517 pttruetab(1:3), cetruetab(1:3), & 518 s_Child_temp(1:3), s_Parent_temp_p(1:3), & 420 call Agrif_Interp_3D_recursive( type_interp(1:3), & 421 tempPextend % array3, & 422 tempC % array3, & 423 indmin(1:3), indmax(1:3), & 424 pttruetab(1:3), cetruetab(1:3), & 425 s_Child_temp(1:3), s_Parent_temp(1:3), & 519 426 ds_Child(1:3), ds_Parent(1:3) ) 520 521 427 case(4) 522 s_Parent_temp_p = s_Parent + (indmin_required_p - pttab_Parent) * ds_Parent 523 call Agrif_Interp_4D_recursive( type_interp(1:4), & 524 tempPextend % array4( & 525 indmin_required_p(1):indmax_required_p(1), & 526 indmin_required_p(2):indmax_required_p(2), & 527 indmin_required_p(3):indmax_required_p(3), & 528 indmin_required_p(4):indmax_required_p(4)), & 529 tempC % array4, & 530 indmin_required_p(1:4), indmax_required_p(1:4), & 531 pttruetab(1:4), cetruetab(1:4), & 532 s_Child_temp(1:4), s_Parent_temp_p(1:4), & 428 call Agrif_Interp_4D_recursive( type_interp(1:4), & 429 tempPextend % array4, & 430 tempC % array4, & 431 indmin(1:4), indmax(1:4), & 432 pttruetab(1:4), cetruetab(1:4), & 433 s_Child_temp(1:4), s_Parent_temp(1:4), & 533 434 ds_Child(1:4), ds_Parent(1:4) ) 534 435 case(5) … … 721 622 else ! .not.to_restore 722 623 ! 723 724 624 if (memberin) then 725 625 ! … … 842 742 endif 843 743 844 845 744 call Agrif_array_deallocate(tempPextend,nbdim) 846 745 call Agrif_array_deallocate(tempC,nbdim) … … 864 763 !--------------------------------------------------------------------------------------------------- 865 764 subroutine Agrif_Parentbounds ( type_interp, nbdim, indmin, indmax, & 866 indmin_required,indmax_required, &867 765 s_Parent_temp, s_Child_temp, & 868 766 s_Child, ds_Child, & … … 874 772 INTEGER, intent(in) :: nbdim 875 773 INTEGER, DIMENSION(nbdim), intent(out) :: indmin, indmax 876 INTEGER, DIMENSION(nbdim), intent(out) :: indmin_required, indmax_required 877 REAL(kind=8), DIMENSION(nbdim), intent(out) :: s_Parent_temp, s_child_temp 878 REAL(kind=8), DIMENSION(nbdim), intent(in) :: s_Child, ds_child 879 REAL(kind=8), DIMENSION(nbdim), intent(in) :: s_Parent,ds_Parent 774 REAL, DIMENSION(nbdim), intent(out) :: s_Parent_temp, s_child_temp 775 REAL, DIMENSION(nbdim), intent(in) :: s_Child, ds_child 776 REAL, DIMENSION(nbdim), intent(in) :: s_Parent,ds_Parent 880 777 INTEGER, DIMENSION(nbdim), intent(in) :: pttruetab, cetruetab 881 778 INTEGER, DIMENSION(nbdim), intent(in) :: pttab_Child, pttab_Parent … … 883 780 INTEGER, DIMENSION(nbdim), intent(in) :: coords 884 781 ! 885 REAL(kind=8) :: xpmin, xpmax886 INTEGER :: coeffraf887 782 INTEGER :: i 888 REAL (kind=8),DIMENSION(nbdim) :: dim_newmin, dim_newmax783 REAL,DIMENSION(nbdim) :: dim_newmin, dim_newmax 889 784 ! 890 785 dim_newmin = s_Child + (pttruetab - pttab_Child) * ds_Child … … 895 790 indmin(i) = pttab_Parent(i) + agrif_int((dim_newmin(i)-s_Parent(i))/ds_Parent(i)) 896 791 indmax(i) = pttab_Parent(i) + agrif_ceiling((dim_newmax(i)-s_Parent(i))/ds_Parent(i)) 897 898 coeffraf = nint(ds_Parent(i)/ds_Child(i))899 900 indmin_required(i) = indmin(i)901 indmax_required(i) = indmax(i)902 792 ! 903 793 ! Necessary for the Quadratic interpolation 904 794 ! 905 906 795 if ( (pttruetab(i) == cetruetab(i)) .and. (posvar(i) == 1) ) then 907 if (Agrif_UseSpecialValue) then908 indmin(i) = indmin(i)-MaxSearch909 indmax(i) = indmax(i)+MaxSearch910 endif911 796 elseif ( coords(i) == 0 ) then ! (interptab == 'N') 912 797 elseif ( (type_interp(i) == Agrif_ppm) .or. & … … 914 799 (type_interp(i) == Agrif_ppm_lim) .or. & 915 800 (type_interp(i) == Agrif_weno) ) then 916 917 if ((mod(coeffraf,2) == 0).AND.(posvar(i)==2)) then 918 919 xpmax = s_Parent(i)+(indmax(i)-pttab_Parent(i))*ds_Parent(i) 920 if (xpmax > dim_newmax(i)+ds_Child(i)) then 921 indmax(i) = indmax(i) + 1 922 else 923 indmax(i) = indmax(i) + 2 924 endif 925 926 xpmin = s_Parent(i)+(indmin(i)-pttab_Parent(i))*ds_Parent(i) 927 if (xpmin < dim_newmin(i)-ds_Child(i)) then 928 indmin(i) = indmin(i) - 1 929 else 930 indmin(i) = indmin(i) - 2 931 endif 932 933 else 934 indmin(i) = indmin(i) - 2 935 indmax(i) = indmax(i) + 2 936 endif 937 938 indmin_required(i) = indmin(i) 939 indmax_required(i) = indmax(i) 940 941 if (Agrif_UseSpecialValue) then 942 indmin(i) = indmin(i)-MaxSearch 943 indmax(i) = indmax(i)+MaxSearch 944 endif 945 elseif (type_interp(i) == Agrif_linearconservlim) then 946 947 if ((mod(coeffraf,2) == 0).AND.(posvar(i)==2)) then 948 949 xpmax = s_Parent(i)+(indmax(i)-pttab_Parent(i))*ds_Parent(i) 950 if (xpmax > dim_newmax(i)+ds_Child(i)) then 951 indmax(i) = indmax(i) 952 else 953 indmax(i) = indmax(i) + 1 954 endif 955 956 xpmin = s_Parent(i)+(indmin(i)-pttab_Parent(i))*ds_Parent(i) 957 if (xpmin < dim_newmin(i)-ds_Child(i)) then 958 indmin(i) = indmin(i) 959 else 960 indmin(i) = indmin(i) - 1 961 endif 962 963 else 964 indmin(i) = indmin(i) - 1 965 indmax(i) = indmax(i) + 1 966 endif 967 968 indmin_required(i) = indmin(i) 969 indmax_required(i) = indmax(i) 970 971 if (Agrif_UseSpecialValue) then 972 indmin(i) = indmin(i)-MaxSearch 973 indmax(i) = indmax(i)+MaxSearch 974 endif 975 801 indmin(i) = indmin(i) - 2 802 indmax(i) = indmax(i) + 2 976 803 elseif ( (type_interp(i) /= Agrif_constant) .and. & 977 804 (type_interp(i) /= Agrif_linear) ) then 978 805 indmin(i) = indmin(i) - 1 979 806 indmax(i) = indmax(i) + 1 980 981 indmin_required(i) = indmin(i)982 indmax_required(i) = indmax(i)983 984 if (Agrif_UseSpecialValue) then985 indmin(i) = indmin(i)-MaxSearch986 indmax(i) = indmax(i)+MaxSearch987 endif988 elseif ( (type_interp(i) == Agrif_constant) .or. &989 (type_interp(i) == Agrif_linear) ) then990 indmin_required(i) = indmin(i)991 indmax_required(i) = indmax(i)992 if (Agrif_UseSpecialValue) then993 indmin(i) = indmin(i)-MaxSearch994 indmax(i) = indmax(i)+MaxSearch995 endif996 807 endif 997 998 808 ! 999 809 enddo … … 1020 830 integer, intent(in) :: indmin, indmax 1021 831 integer, intent(in) :: pttab_child, petab_child 1022 real (kind=8), intent(in) :: s_child, s_parent1023 real (kind=8), intent(in) :: ds_child, ds_parent832 real, intent(in) :: s_child, s_parent 833 real, intent(in) :: ds_child, ds_parent 1024 834 real, dimension( & 1025 835 indmin:indmax & … … 1055 865 integer, dimension(2), intent(in) :: indmin, indmax 1056 866 integer, dimension(2), intent(in) :: pttab_child, petab_child 1057 real (kind=8), dimension(2), intent(in) :: s_child, s_parent1058 real (kind=8), dimension(2), intent(in) :: ds_child, ds_parent867 real, dimension(2), intent(in) :: s_child, s_parent 868 real, dimension(2), intent(in) :: ds_child, ds_parent 1059 869 real, dimension( & 1060 870 indmin(1):indmax(1), & … … 1073 883 indmin(2):indmax(2), & 1074 884 pttab_child(1):petab_child(1)) :: tabtemp_trsp 1075 integer :: i, j, coeffraf , locind_child_left, ideb885 integer :: i, j, coeffraf 1076 886 !--------------------------------------------------------------------------------------------------- 1077 887 ! … … 1098 908 s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) 1099 909 !---CDIR NEXPAND 1100 call PPM1dAfterCompute(tabin,tabtemp,size(tabin),size(tabtemp),1,indchildppm(:,1),tabppm(:,:,1)) 1101 else if (coeffraf == 1) then 1102 locind_child_left = indmin(1) + agrif_int((s_child(1)-s_parent(1))/ds_parent(1)) 1103 1104 do j = indmin(2), indmax(2) 1105 ideb = locind_child_left 1106 do i = pttab_child(1), petab_child(1) 1107 tabtemp(i,j) = tabin(ideb,j) 1108 ideb = ideb + 1 1109 enddo 1110 enddo 1111 910 call PPM1dAfterCompute(tabin,tabtemp,size(tabin),size(tabtemp),1) 1112 911 else 1113 912 do j = indmin(2),indmax(2) … … 1150 949 !---CDIR NEXPAND 1151 950 call PPM1dAfterCompute(tabtemp_trsp, tabout_trsp, & 1152 size(tabtemp_trsp), size(tabout_trsp), 2, & 1153 indchildppm(:,2),tabppm(:,:,2)) 951 size(tabtemp_trsp), size(tabout_trsp), 2) 1154 952 else 1155 953 do i = pttab_child(1), petab_child(1) … … 1186 984 integer, dimension(3), intent(in) :: indmin, indmax 1187 985 integer, dimension(3), intent(in) :: pttab_child, petab_child 1188 real (kind=8), dimension(3), intent(in) :: s_child, s_parent1189 real (kind=8), dimension(3), intent(in) :: ds_child, ds_parent986 real, dimension(3), intent(in) :: s_child, s_parent 987 real, dimension(3), intent(in) :: ds_child, ds_parent 1190 988 real, dimension( & 1191 989 indmin(1):indmax(1), & … … 1201 999 pttab_child(2):petab_child(2), & 1202 1000 indmin(3):indmax(3)) :: tabtemp 1203 integer :: i, j, k, coeffraf ,kp,kp1,kp2,kp3,kp4,kref1001 integer :: i, j, k, coeffraf 1204 1002 integer :: locind_child_left, kdeb 1205 real(kind=8) :: ypos,globind_parent_left1206 real(kind=8) :: deltax, invdsparent1207 real :: t2,t3,t4,t5,t6,t7,t81208 integer :: locind_parent_left1209 1210 1003 ! 1211 1004 coeffraf = nint ( ds_parent(1) / ds_child(1) ) … … 1266 1059 enddo 1267 1060 enddo 1268 else if (type_interp(3) == Agrif_LAGRANGE) then1269 invdsparent = 1./ds_parent(3)1270 ypos = s_child(3)1271 do k=pttab_child(3), petab_child(3)1272 locind_parent_left = indmin(3)+agrif_int((ypos - s_parent(3))/ds_parent(3))1273 globind_parent_left = s_parent(3) + (locind_parent_left - indmin(3))*ds_parent(3)1274 deltax = invdsparent*(ypos-globind_parent_left)1275 deltax = nint(coeffraf*deltax)/real(coeffraf)1276 ypos = ypos + ds_child(3)1277 1278 if (abs(deltax) <= 0.0001) then1279 do j = pttab_child(2), petab_child(2)1280 do i = pttab_child(1), petab_child(1)1281 tabout(i,j,k) = tabtemp(i,j,locind_parent_left)1282 enddo1283 enddo1284 else1285 t2 = deltax - 2.1286 t3 = deltax - 1.1287 t4 = deltax + 1.1288 1289 t5 = -(1./6.)*deltax*t2*t31290 t6 = 0.5*t2*t3*t41291 t7 = -0.5*deltax*t2*t41292 t8 = (1./6.)*deltax*t3*t41293 do j = pttab_child(2), petab_child(2)1294 do i = pttab_child(1), petab_child(1)1295 tabout(i,j,k) = t5*tabtemp(i,j,locind_parent_left-1) + t6*tabtemp(i,j,locind_parent_left) &1296 +t7*tabtemp(i,j,locind_parent_left+1) + t8*tabtemp(i,j,locind_parent_left+2)1297 enddo1298 enddo1299 1300 endif1301 1302 enddo1303 else if (type_interp(3) == Agrif_PPM) then1304 call PPM1dPrecompute2d(1, &1305 indmax(3)-indmin(3)+1, &1306 petab_child(3)-pttab_child(3)+1, &1307 s_parent(3),s_child(3),ds_parent(3),ds_child(3),1)1308 1309 do k=pttab_child(3),petab_child(3)1310 kref = k-pttab_child(3)+11311 kp=indmin(3)+indparentppm(kref,1)-11312 kp1 = kp + 11313 kp2 = kp1 + 11314 kp3 = kp2 + 11315 kp4 = kp3 + 11316 do j = pttab_child(2), petab_child(2)1317 do i = pttab_child(1), petab_child(1)1318 tabout(i,j,k) = tabppm(1,indchildppm(kref,1),1)*tabtemp(i,j,kp) + &1319 tabppm(2,indchildppm(kref,1),1)*tabtemp(i,j,kp1) + &1320 tabppm(3,indchildppm(kref,1),1)*tabtemp(i,j,kp2) + &1321 tabppm(4,indchildppm(kref,1),1)*tabtemp(i,j,kp3) + &1322 tabppm(5,indchildppm(kref,1),1)*tabtemp(i,j,kp4)1323 enddo1324 enddo1325 enddo1326 1327 1061 else 1328 1329 1062 do j = pttab_child(2), petab_child(2) 1330 1063 do i = pttab_child(1), petab_child(1) … … 1338 1071 enddo 1339 1072 enddo 1340 1341 1073 endif 1342 1074 !--------------------------------------------------------------------------------------------------- … … 1359 1091 integer, dimension(4), intent(in) :: indmin, indmax 1360 1092 integer, dimension(4), intent(in) :: pttab_child, petab_child 1361 real (kind=8), dimension(4), intent(in) :: s_child, s_parent1362 real (kind=8), dimension(4), intent(in) :: ds_child, ds_parent1093 real, dimension(4), intent(in) :: s_child, s_parent 1094 real, dimension(4), intent(in) :: ds_child, ds_parent 1363 1095 real, dimension( & 1364 1096 indmin(1):indmax(1), & … … 1378 1110 indmin(4):indmax(4)) :: tabtemp 1379 1111 integer :: i, j, k, l 1380 1381 real(kind=8) :: ypos,globind_parent_left1382 real(kind=8) :: deltax, invdsparent1383 real :: t2,t3,t4,t5,t6,t7,t81384 integer :: locind_parent_left, coeffraf1385 1112 ! 1386 1113 do l = indmin(4), indmax(4) … … 1398 1125 enddo 1399 1126 ! 1400 if (type_interp(4) == Agrif_LAGRANGE) then1401 coeffraf = nint(ds_parent(4)/ds_child(4))1402 invdsparent = 1./ds_parent(4)1403 ypos = s_child(4)1404 do l=pttab_child(4), petab_child(4)1405 locind_parent_left = indmin(4)+agrif_int((ypos - s_parent(4))/ds_parent(4))1406 globind_parent_left = s_parent(4) + (locind_parent_left - indmin(4))*ds_parent(4)1407 deltax = invdsparent*(ypos-globind_parent_left)1408 deltax = nint(coeffraf*deltax)/real(coeffraf)1409 ypos = ypos + ds_child(4)1410 1411 if (abs(deltax) <= 0.0001) then1412 do k = pttab_child(3), petab_child(3)1413 do j = pttab_child(2), petab_child(2)1414 do i = pttab_child(1), petab_child(1)1415 tabout(i,j,k,l) = tabtemp(i,j,k,locind_parent_left)1416 enddo1417 enddo1418 enddo1419 else1420 t2 = deltax - 2.1421 t3 = deltax - 1.1422 t4 = deltax + 1.1423 1424 t5 = -(1./6.)*deltax*t2*t31425 t6 = 0.5*t2*t3*t41426 t7 = -0.5*deltax*t2*t41427 t8 = (1./6.)*deltax*t3*t41428 do k = pttab_child(3), petab_child(3)1429 do j = pttab_child(2), petab_child(2)1430 do i = pttab_child(1), petab_child(1)1431 tabout(i,j,k,l) = t5*tabtemp(i,j,k,locind_parent_left-1) + t6*tabtemp(i,j,k,locind_parent_left) &1432 +t7*tabtemp(i,j,k,locind_parent_left+1) + t8*tabtemp(i,j,k,locind_parent_left+2)1433 enddo1434 enddo1435 enddo1436 endif1437 1438 enddo1439 else1440 1127 do k = pttab_child(3), petab_child(3) 1441 1128 do j = pttab_child(2), petab_child(2) … … 1451 1138 enddo 1452 1139 enddo 1453 endif1454 1140 !--------------------------------------------------------------------------------------------------- 1455 1141 end subroutine Agrif_Interp_4D_recursive … … 1471 1157 integer, dimension(5), intent(in) :: indmin, indmax 1472 1158 integer, dimension(5), intent(in) :: pttab_child, petab_child 1473 real (kind=8), dimension(5), intent(in) :: s_child, s_parent1474 real (kind=8), dimension(5), intent(in) :: ds_child, ds_parent1159 real, dimension(5), intent(in) :: s_child, s_parent 1160 real, dimension(5), intent(in) :: ds_child, ds_parent 1475 1161 real, dimension( & 1476 1162 indmin(1):indmax(1), & … … 1544 1230 integer, dimension(6), intent(in) :: indmin, indmax 1545 1231 integer, dimension(6), intent(in) :: pttab_child, petab_child 1546 real (kind=8), dimension(6), intent(in) :: s_child, s_parent1547 real (kind=8), dimension(6), intent(in) :: ds_child, ds_parent1232 real, dimension(6), intent(in) :: s_child, s_parent 1233 real, dimension(6), intent(in) :: ds_child, ds_parent 1548 1234 real, dimension( & 1549 1235 indmin(1):indmax(1), & … … 1623 1309 REAL, DIMENSION(indmin:indmax), INTENT(IN) :: parenttab 1624 1310 REAL, DIMENSION(pttab_child:petab_child), INTENT(OUT) :: childtab 1625 REAL (kind=8):: s_parent, s_child1626 REAL (kind=8):: ds_parent,ds_child1311 REAL :: s_parent, s_child 1312 REAL :: ds_parent,ds_child 1627 1313 ! 1628 1314 if ( (indmin == indmax) .and. (pttab_child == petab_child) ) then … … 1693 1379 !--------------------------------------------------------------------------------------------------- 1694 1380 function Agrif_Find_list_interp ( list_interp, pttab, petab, pttab_Child, pttab_Parent, & 1695 nbdim, indmin, indmax, indmin_required_p, indmax_required_p, & 1696 indminglob, indmaxglob, & 1381 nbdim, indmin, indmax, indminglob, indmaxglob, & 1697 1382 pttruetab, cetruetab, memberin & 1698 1383 #if defined AGRIF_MPI … … 1705 1390 integer, intent(in) :: nbdim 1706 1391 integer, dimension(nbdim), intent(in) :: pttab, petab, pttab_Child, pttab_Parent 1707 integer, dimension(nbdim), intent(out) :: indmin, indmax , indmin_required_p, indmax_required_p1392 integer, dimension(nbdim), intent(out) :: indmin, indmax 1708 1393 integer, dimension(nbdim), intent(out) :: indminglob, indmaxglob 1709 1394 integer, dimension(nbdim), intent(out) :: pttruetab, cetruetab … … 1744 1429 indmin = pil % indmin(1:nbdim) 1745 1430 indmax = pil % indmax(1:nbdim) 1746 indmin_required_p = pil % indmin_required_p(1:nbdim)1747 indmax_required_p = pil % indmax_required_p(1:nbdim)1748 1431 1749 1432 pttruetab = pil % pttruetab(1:nbdim) … … 1777 1460 !--------------------------------------------------------------------------------------------------- 1778 1461 subroutine Agrif_AddTo_list_interp ( list_interp, pttab, petab, pttab_Child, pttab_Parent, & 1779 indmin, indmax, indmin_required_p, indmax_required_p, & 1780 indminglob, indmaxglob, & 1462 indmin, indmax, indminglob, indmaxglob, & 1781 1463 pttruetab, cetruetab, & 1782 1464 memberin, nbdim & … … 1792 1474 integer :: nbdim 1793 1475 integer, dimension(nbdim) :: pttab, petab, pttab_Child, pttab_Parent 1794 integer, dimension(nbdim) :: indmin,indmax , indmin_required_p, indmax_required_p1476 integer, dimension(nbdim) :: indmin,indmax 1795 1477 integer, dimension(nbdim) :: indminglob, indmaxglob 1796 1478 integer, dimension(nbdim) :: pttruetab, cetruetab … … 1821 1503 pil % indmin(1:nbdim) = indmin(1:nbdim) 1822 1504 pil % indmax(1:nbdim) = indmax(1:nbdim) 1823 1824 pil % indmin_required_p(1:nbdim) = indmin_required_p(1:nbdim)1825 pil % indmax_required_p(1:nbdim) = indmax_required_p(1:nbdim)1826 1505 1827 1506 pil % memberin = memberin
Note: See TracChangeset
for help on using the changeset viewer.