[1901] | 1 | ! |
---|
[2281] | 2 | ! $Id$ |
---|
[1901] | 3 | ! |
---|
| 4 | C AGRIF (Adaptive Grid Refinement In Fortran) |
---|
| 5 | C |
---|
| 6 | C Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr) |
---|
| 7 | C Christophe Vouland (Christophe.Vouland@imag.fr) |
---|
| 8 | C |
---|
| 9 | C This program is free software; you can redistribute it and/or modify |
---|
| 10 | C it under the terms of the GNU General Public License as published by |
---|
| 11 | C the Free Software Foundation; either version 2 of the License, or |
---|
| 12 | C (at your option) any later version. |
---|
| 13 | C |
---|
| 14 | C This program is distributed in the hope that it will be useful, |
---|
| 15 | C but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | C GNU General Public License for more details. |
---|
| 18 | C |
---|
| 19 | C You should have received a copy of the GNU General Public License |
---|
| 20 | C along with this program; if not, write to the Free Software |
---|
| 21 | C Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA. |
---|
| 22 | C |
---|
| 23 | C |
---|
| 24 | C |
---|
| 25 | CCC Module Agrif_Interpolation |
---|
| 26 | C |
---|
| 27 | Module Agrif_Interpolation |
---|
| 28 | C |
---|
| 29 | CCC Description: |
---|
| 30 | CCC Module to initialize a fine grid from its parent grid, by using a space |
---|
| 31 | CCC interpolation |
---|
| 32 | C |
---|
| 33 | C Modules used: |
---|
| 34 | C |
---|
| 35 | Use Agrif_Interpbasic |
---|
| 36 | Use Agrif_Arrays |
---|
| 37 | Use Agrif_Mask |
---|
| 38 | Use Agrif_CurgridFunctions |
---|
[2019] | 39 | #if defined key_mpp_mpi |
---|
[1901] | 40 | Use Agrif_mpp |
---|
| 41 | #endif |
---|
| 42 | C |
---|
| 43 | IMPLICIT NONE |
---|
| 44 | logical, private:: precomputedone(7) = .FALSE. |
---|
| 45 | C |
---|
| 46 | CONTAINS |
---|
| 47 | C Define procedures contained in this module |
---|
| 48 | C |
---|
| 49 | C |
---|
| 50 | C |
---|
| 51 | C ************************************************************************** |
---|
| 52 | CCC Subroutine Agrif_Interp_1d |
---|
| 53 | C ************************************************************************** |
---|
| 54 | C |
---|
| 55 | Subroutine Agrif_Interp_1d(TypeInterp,parent,child,tab, |
---|
| 56 | & torestore,nbdim,procname) |
---|
| 57 | C |
---|
| 58 | CCC Description: |
---|
| 59 | CCC Subroutine to calculate the boundary conditions of a fine grid for a 1D |
---|
| 60 | C grid variable. |
---|
| 61 | C |
---|
| 62 | C Declarations: |
---|
| 63 | C |
---|
| 64 | |
---|
| 65 | C |
---|
| 66 | C Arguments |
---|
| 67 | INTEGER :: nbdim |
---|
| 68 | INTEGER,DIMENSION(6) :: TypeInterp ! Kind of interpolation |
---|
| 69 | ! (linear,lagrange,spline) |
---|
| 70 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 71 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 72 | TYPE(AGRIF_PVariable) :: childtemp ! Temporary variable on the child |
---|
| 73 | ! grid |
---|
| 74 | LOGICAL :: torestore |
---|
| 75 | REAL, DIMENSION( |
---|
| 76 | & child%var%lb(1):child%var%ub(1) |
---|
| 77 | & ), Target :: tab ! Result |
---|
| 78 | External :: procname |
---|
| 79 | Optional :: procname |
---|
| 80 | C |
---|
| 81 | C |
---|
| 82 | allocate(childtemp % var) |
---|
| 83 | C |
---|
| 84 | C Pointer on the root variable |
---|
| 85 | childtemp % var % root_var => child % var %root_var |
---|
| 86 | C |
---|
| 87 | C Number of dimensions of the grid variable |
---|
| 88 | childtemp % var % nbdim = nbdim |
---|
| 89 | C |
---|
| 90 | C Tab is the result of the interpolation |
---|
[2715] | 91 | childtemp % var % parray1 => tab |
---|
[1901] | 92 | |
---|
| 93 | childtemp % var % lb = child % var % lb |
---|
| 94 | childtemp % var % ub = child % var % ub |
---|
| 95 | |
---|
| 96 | C |
---|
| 97 | if (torestore) then |
---|
| 98 | C |
---|
[2715] | 99 | childtemp % var % parray1 = child % var % array1 |
---|
[1901] | 100 | C |
---|
| 101 | childtemp % var % restore1D => child % var % restore1D |
---|
| 102 | C |
---|
| 103 | else |
---|
| 104 | C |
---|
| 105 | Nullify(childtemp % var % restore1D) |
---|
| 106 | C |
---|
| 107 | endif |
---|
| 108 | C |
---|
| 109 | C Index indicating (in the Agrif_Interp1D procedure) if a space |
---|
| 110 | C interpolation is necessary |
---|
| 111 | childtemp % var % interpIndex => child % var % interpIndex |
---|
| 112 | childtemp % var % Interpolationshouldbemade = |
---|
| 113 | & child % var % Interpolationshouldbemade |
---|
| 114 | childtemp % var % list_interp => child % var% list_interp |
---|
| 115 | C |
---|
| 116 | if (present(procname)) then |
---|
| 117 | Call Agrif_InterpVariable |
---|
| 118 | & (TypeInterp,parent,childtemp,torestore,procname) |
---|
| 119 | else |
---|
| 120 | Call Agrif_InterpVariable |
---|
| 121 | & (TypeInterp,parent,childtemp,torestore) |
---|
| 122 | endif |
---|
| 123 | child % var % list_interp => childtemp % var %list_interp |
---|
| 124 | C |
---|
| 125 | deallocate(childtemp % var) |
---|
| 126 | C |
---|
| 127 | C |
---|
| 128 | End Subroutine Agrif_Interp_1D |
---|
| 129 | C |
---|
| 130 | C |
---|
| 131 | C |
---|
| 132 | C ************************************************************************** |
---|
| 133 | CCC Subroutine Agrif_Interp_2d |
---|
| 134 | C ************************************************************************** |
---|
| 135 | C |
---|
| 136 | Subroutine Agrif_Interp_2d(TypeInterp,parent,child,tab, |
---|
| 137 | & torestore,nbdim,procname) |
---|
| 138 | C |
---|
| 139 | CCC Description: |
---|
| 140 | CCC Subroutine to calculate the boundary conditions of a fine grid for a 2D |
---|
| 141 | C grid variable. |
---|
| 142 | C |
---|
| 143 | C Declarations: |
---|
| 144 | C |
---|
| 145 | |
---|
| 146 | C |
---|
| 147 | C Arguments |
---|
| 148 | INTEGER :: nbdim |
---|
| 149 | INTEGER,DIMENSION(6) :: TypeInterp ! Kind of interpolation |
---|
| 150 | ! (linear,lagrange,spline) |
---|
| 151 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 152 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 153 | TYPE(AGRIF_PVariable) :: childtemp ! Temporary variable on the child |
---|
| 154 | ! grid |
---|
| 155 | LOGICAL :: torestore |
---|
| 156 | REAL, DIMENSION( |
---|
| 157 | & child%var%lb(1):child%var%ub(1), |
---|
| 158 | & child%var%lb(2):child%var%ub(2) |
---|
| 159 | & ), Target :: tab ! Result |
---|
| 160 | External :: procname |
---|
| 161 | Optional :: procname |
---|
| 162 | C |
---|
| 163 | C |
---|
| 164 | allocate(childtemp % var) |
---|
| 165 | C |
---|
| 166 | C Pointer on the root variable |
---|
| 167 | childtemp % var % root_var => child % var %root_var |
---|
| 168 | C |
---|
| 169 | C Number of dimensions of the grid variable |
---|
| 170 | childtemp % var % nbdim = nbdim |
---|
| 171 | C |
---|
| 172 | C Tab is the result of the interpolation |
---|
[2715] | 173 | childtemp % var % parray2 => tab |
---|
[1901] | 174 | |
---|
| 175 | childtemp % var % lb = child % var % lb |
---|
| 176 | childtemp % var % ub = child % var % ub |
---|
| 177 | |
---|
| 178 | C |
---|
| 179 | if (torestore) then |
---|
| 180 | C |
---|
[2715] | 181 | childtemp % var % parray2 = child % var % array2 |
---|
[1901] | 182 | C |
---|
| 183 | childtemp % var % restore2D => child % var % restore2D |
---|
| 184 | C |
---|
| 185 | else |
---|
| 186 | C |
---|
| 187 | Nullify(childtemp % var % restore2D) |
---|
| 188 | C |
---|
| 189 | endif |
---|
| 190 | C |
---|
| 191 | C Index indicating (in the Agrif_Interp2D procedure) if a space |
---|
| 192 | C interpolation is necessary |
---|
| 193 | childtemp % var % interpIndex => child % var % interpIndex |
---|
| 194 | childtemp % var % Interpolationshouldbemade = |
---|
| 195 | & child % var % Interpolationshouldbemade |
---|
| 196 | childtemp % var % list_interp => child % var% list_interp |
---|
| 197 | C |
---|
| 198 | if (present(procname)) then |
---|
| 199 | Call Agrif_InterpVariable |
---|
| 200 | & (TypeInterp,parent,childtemp,torestore,procname) |
---|
| 201 | else |
---|
| 202 | Call Agrif_InterpVariable |
---|
| 203 | & (TypeInterp,parent,childtemp,torestore) |
---|
| 204 | endif |
---|
| 205 | |
---|
| 206 | child % var % list_interp => childtemp % var %list_interp |
---|
| 207 | C |
---|
| 208 | deallocate(childtemp % var) |
---|
| 209 | C |
---|
| 210 | C |
---|
| 211 | End Subroutine Agrif_Interp_2D |
---|
| 212 | C |
---|
| 213 | C |
---|
| 214 | C |
---|
| 215 | C ************************************************************************** |
---|
| 216 | CCC Subroutine Agrif_Interp_3d |
---|
| 217 | C ************************************************************************** |
---|
| 218 | C |
---|
| 219 | Subroutine Agrif_Interp_3d(TypeInterp,parent,child,tab, |
---|
| 220 | & torestore,nbdim,procname) |
---|
| 221 | C |
---|
| 222 | CCC Description: |
---|
| 223 | CCC Subroutine to calculate the boundary conditions of a fine grid for a 3D |
---|
| 224 | C grid variable. |
---|
| 225 | C |
---|
| 226 | C Declarations: |
---|
| 227 | C |
---|
| 228 | |
---|
| 229 | C |
---|
| 230 | C Arguments |
---|
| 231 | INTEGER :: nbdim |
---|
| 232 | INTEGER,DIMENSION(6) :: TypeInterp ! Kind of interpolation |
---|
| 233 | ! (linear,lagrange,spline) |
---|
| 234 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 235 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 236 | TYPE(AGRIF_PVariable) :: childtemp ! Temporary variable on the child |
---|
| 237 | ! grid |
---|
| 238 | LOGICAL :: torestore |
---|
| 239 | REAL, DIMENSION( |
---|
| 240 | & child%var%lb(1):child%var%ub(1), |
---|
| 241 | & child%var%lb(2):child%var%ub(2), |
---|
| 242 | & child%var%lb(3):child%var%ub(3) |
---|
| 243 | & ), Target :: tab ! Results |
---|
| 244 | External :: procname |
---|
| 245 | Optional :: procname |
---|
| 246 | C |
---|
| 247 | C |
---|
| 248 | allocate(childtemp % var) |
---|
| 249 | C |
---|
| 250 | C Pointer on the root variable |
---|
| 251 | childtemp % var % root_var => child % var %root_var |
---|
| 252 | C |
---|
| 253 | C Number of dimensions of the grid variable |
---|
| 254 | childtemp % var % nbdim = nbdim |
---|
| 255 | C |
---|
| 256 | C Tab is the result of the interpolation |
---|
[2715] | 257 | childtemp % var % parray3 => tab |
---|
[1901] | 258 | |
---|
| 259 | childtemp % var % lb = child % var % lb |
---|
| 260 | childtemp % var % ub = child % var % ub |
---|
| 261 | C |
---|
| 262 | if (torestore) then |
---|
| 263 | C |
---|
[2715] | 264 | childtemp % var % parray3 = child % var % array3 |
---|
[1901] | 265 | C |
---|
| 266 | childtemp % var % restore3D => child % var % restore3D |
---|
| 267 | C |
---|
| 268 | else |
---|
| 269 | C |
---|
| 270 | Nullify(childtemp % var % restore3D) |
---|
| 271 | C |
---|
| 272 | endif |
---|
| 273 | C |
---|
| 274 | C Index indicating (in the Agrif_Interp3D procedure) if a space |
---|
| 275 | C interpolation is necessary |
---|
| 276 | childtemp % var % interpIndex => child % var % interpIndex |
---|
| 277 | childtemp % var % Interpolationshouldbemade = |
---|
| 278 | & child % var % Interpolationshouldbemade |
---|
| 279 | childtemp % var % list_interp => child % var% list_interp |
---|
| 280 | C |
---|
| 281 | |
---|
| 282 | if (present(procname)) then |
---|
| 283 | Call Agrif_InterpVariable |
---|
| 284 | & (TypeInterp,parent,childtemp,torestore,procname) |
---|
| 285 | else |
---|
| 286 | Call Agrif_InterpVariable |
---|
| 287 | & (TypeInterp,parent,childtemp,torestore) |
---|
| 288 | endif |
---|
| 289 | |
---|
| 290 | |
---|
| 291 | child % var % list_interp => childtemp % var %list_interp |
---|
| 292 | C |
---|
| 293 | deallocate(childtemp % var) |
---|
| 294 | C |
---|
| 295 | C |
---|
| 296 | End Subroutine Agrif_Interp_3D |
---|
| 297 | C |
---|
| 298 | C |
---|
| 299 | C |
---|
| 300 | C ************************************************************************** |
---|
| 301 | CCC Subroutine Agrif_Interp_4d |
---|
| 302 | C ************************************************************************** |
---|
| 303 | C |
---|
| 304 | Subroutine Agrif_Interp_4d(TypeInterp,parent,child,tab, |
---|
| 305 | & torestore,nbdim,procname) |
---|
| 306 | C |
---|
| 307 | CCC Description: |
---|
| 308 | CCC Subroutine to calculate the boundary conditions of a fine grid for a 4D |
---|
| 309 | C grid variable. |
---|
| 310 | C |
---|
| 311 | C Declarations: |
---|
| 312 | C |
---|
| 313 | |
---|
| 314 | C |
---|
| 315 | C Arguments |
---|
| 316 | INTEGER :: nbdim |
---|
| 317 | INTEGER,DIMENSION(6) :: TypeInterp ! Kind of interpolation |
---|
| 318 | ! (linear,lagrange,spline) |
---|
| 319 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 320 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 321 | TYPE(AGRIF_PVariable) :: childtemp ! Temporary variable on the child |
---|
| 322 | ! grid |
---|
| 323 | LOGICAL :: torestore |
---|
| 324 | REAL, DIMENSION( |
---|
| 325 | & child%var%lb(1):child%var%ub(1), |
---|
| 326 | & child%var%lb(2):child%var%ub(2), |
---|
| 327 | & child%var%lb(3):child%var%ub(3), |
---|
| 328 | & child%var%lb(4):child%var%ub(4) |
---|
| 329 | & ), Target :: tab ! Results |
---|
| 330 | External :: procname |
---|
| 331 | Optional :: procname |
---|
| 332 | C |
---|
| 333 | C |
---|
| 334 | allocate(childtemp % var) |
---|
| 335 | C |
---|
| 336 | C Pointer on the root variable |
---|
| 337 | childtemp % var % root_var => child % var %root_var |
---|
| 338 | C |
---|
| 339 | C Number of dimensions of the grid variable |
---|
| 340 | childtemp % var % nbdim = nbdim |
---|
| 341 | C |
---|
| 342 | C Tab is the result of the interpolation |
---|
[2715] | 343 | childtemp % var % parray4 => tab |
---|
[1901] | 344 | |
---|
| 345 | childtemp % var % lb = child % var % lb |
---|
| 346 | childtemp % var % ub = child % var % ub |
---|
| 347 | |
---|
| 348 | C |
---|
| 349 | if (torestore) then |
---|
| 350 | C |
---|
[2715] | 351 | childtemp % var % parray4 = child % var % array4 |
---|
[1901] | 352 | C |
---|
| 353 | childtemp % var % restore4D => child % var % restore4D |
---|
| 354 | C |
---|
| 355 | else |
---|
| 356 | C |
---|
| 357 | Nullify(childtemp % var % restore4D) |
---|
| 358 | C |
---|
| 359 | endif |
---|
| 360 | C |
---|
| 361 | C Index indicating (in the Agrif_Interp4D procedure) if a space |
---|
| 362 | C interpolation is necessary |
---|
| 363 | childtemp % var % interpIndex => child % var % interpIndex |
---|
| 364 | childtemp % var % Interpolationshouldbemade = |
---|
| 365 | & child % var % Interpolationshouldbemade |
---|
| 366 | childtemp % var % list_interp => child % var% list_interp |
---|
| 367 | C |
---|
| 368 | if (present(procname)) then |
---|
| 369 | Call Agrif_InterpVariable |
---|
| 370 | & (TypeInterp,parent,childtemp,torestore,procname) |
---|
| 371 | else |
---|
| 372 | Call Agrif_InterpVariable |
---|
| 373 | & (TypeInterp,parent,childtemp,torestore) |
---|
| 374 | endif |
---|
| 375 | |
---|
| 376 | |
---|
| 377 | child % var % list_interp => childtemp % var %list_interp |
---|
| 378 | C |
---|
| 379 | deallocate(childtemp % var) |
---|
| 380 | C |
---|
| 381 | C |
---|
| 382 | End Subroutine Agrif_Interp_4D |
---|
| 383 | C |
---|
| 384 | C |
---|
| 385 | C |
---|
| 386 | C ************************************************************************** |
---|
| 387 | CCC Subroutine Agrif_Interp_5d |
---|
| 388 | C ************************************************************************** |
---|
| 389 | C |
---|
| 390 | Subroutine Agrif_Interp_5d(TypeInterp,parent,child,tab, |
---|
| 391 | & torestore,nbdim,procname) |
---|
| 392 | C |
---|
| 393 | CCC Description: |
---|
| 394 | CCC Subroutine to calculate the boundary conditions of a fine grid for a 5D |
---|
| 395 | C grid variable. |
---|
| 396 | C |
---|
| 397 | C Declarations: |
---|
| 398 | C |
---|
| 399 | |
---|
| 400 | C |
---|
| 401 | C Arguments |
---|
| 402 | INTEGER :: nbdim |
---|
| 403 | INTEGER,DIMENSION(6) :: TypeInterp ! Kind of interpolation |
---|
| 404 | ! (linear,lagrange,spline) |
---|
| 405 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 406 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 407 | TYPE(AGRIF_PVariable) :: childtemp ! Temporary variable on the child |
---|
| 408 | ! grid |
---|
| 409 | LOGICAL :: torestore |
---|
| 410 | REAL, DIMENSION( |
---|
| 411 | & child%var%lb(1):child%var%ub(1), |
---|
| 412 | & child%var%lb(2):child%var%ub(2), |
---|
| 413 | & child%var%lb(3):child%var%ub(3), |
---|
| 414 | & child%var%lb(4):child%var%ub(4), |
---|
| 415 | & child%var%lb(5):child%var%ub(5) |
---|
| 416 | & ), Target :: tab ! Results |
---|
| 417 | External :: procname |
---|
| 418 | Optional :: procname |
---|
| 419 | C |
---|
| 420 | C |
---|
| 421 | allocate(childtemp % var) |
---|
| 422 | C |
---|
| 423 | C Pointer on the root variable |
---|
| 424 | childtemp % var % root_var => child % var %root_var |
---|
| 425 | C |
---|
| 426 | C Number of dimensions of the grid variable |
---|
| 427 | childtemp % var % nbdim = nbdim |
---|
| 428 | C |
---|
| 429 | C Tab is the result of the interpolation |
---|
[2715] | 430 | childtemp % var % parray5 => tab |
---|
[1901] | 431 | |
---|
| 432 | childtemp % var % lb = child % var % lb |
---|
| 433 | childtemp % var % ub = child % var % ub |
---|
| 434 | |
---|
| 435 | C |
---|
| 436 | if (torestore) then |
---|
| 437 | C |
---|
[2715] | 438 | childtemp % var % parray5 = child % var % array5 |
---|
[1901] | 439 | C |
---|
| 440 | childtemp % var % restore5D => child % var % restore5D |
---|
| 441 | C |
---|
| 442 | else |
---|
| 443 | C |
---|
| 444 | Nullify(childtemp % var % restore5D) |
---|
| 445 | C |
---|
| 446 | endif |
---|
| 447 | C |
---|
| 448 | C Index indicating (in the Agrif_Interp5D procedure) if a space |
---|
| 449 | C interpolation is necessary |
---|
| 450 | childtemp % var % interpIndex => child % var % interpIndex |
---|
| 451 | childtemp % var % Interpolationshouldbemade = |
---|
| 452 | & child % var % Interpolationshouldbemade |
---|
| 453 | childtemp % var % list_interp => child % var% list_interp |
---|
| 454 | C |
---|
| 455 | if (present(procname)) then |
---|
| 456 | Call Agrif_InterpVariable |
---|
| 457 | & (TypeInterp,parent,childtemp,torestore,procname) |
---|
| 458 | else |
---|
| 459 | Call Agrif_InterpVariable |
---|
| 460 | & (TypeInterp,parent,childtemp,torestore) |
---|
| 461 | endif |
---|
| 462 | |
---|
| 463 | |
---|
| 464 | child % var % list_interp => childtemp % var %list_interp |
---|
| 465 | C |
---|
| 466 | deallocate(childtemp % var) |
---|
| 467 | C |
---|
| 468 | C |
---|
| 469 | End Subroutine Agrif_Interp_5D |
---|
| 470 | C |
---|
| 471 | C |
---|
| 472 | C |
---|
| 473 | C ************************************************************************** |
---|
| 474 | CCC Subroutine Agrif_Interp_6d |
---|
| 475 | C ************************************************************************** |
---|
| 476 | C |
---|
| 477 | Subroutine Agrif_Interp_6d(TypeInterp,parent,child,tab, |
---|
| 478 | & torestore,nbdim,procname) |
---|
| 479 | C |
---|
| 480 | CCC Description: |
---|
| 481 | CCC Subroutine to calculate the boundary conditions of a fine grid for a 6D |
---|
| 482 | C grid variable. |
---|
| 483 | C |
---|
| 484 | C Declarations: |
---|
| 485 | C |
---|
| 486 | |
---|
| 487 | C |
---|
| 488 | C Arguments |
---|
| 489 | INTEGER :: nbdim |
---|
| 490 | INTEGER,DIMENSION(6) :: TypeInterp ! Kind of interpolation |
---|
| 491 | ! (linear,lagrange,spline) |
---|
| 492 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 493 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 494 | TYPE(AGRIF_PVariable) :: childtemp ! Temporary variable on the child |
---|
| 495 | ! grid |
---|
| 496 | LOGICAL :: torestore |
---|
| 497 | REAL, DIMENSION( |
---|
| 498 | & child%var%lb(1):child%var%ub(1), |
---|
| 499 | & child%var%lb(2):child%var%ub(2), |
---|
| 500 | & child%var%lb(3):child%var%ub(3), |
---|
| 501 | & child%var%lb(4):child%var%ub(4), |
---|
| 502 | & child%var%lb(5):child%var%ub(5), |
---|
| 503 | & child%var%lb(6):child%var%ub(6) |
---|
| 504 | & ), Target :: tab ! Results |
---|
| 505 | External :: procname |
---|
| 506 | Optional :: procname |
---|
| 507 | C |
---|
| 508 | C |
---|
| 509 | allocate(childtemp % var) |
---|
| 510 | C |
---|
| 511 | C Pointer on the root variable |
---|
| 512 | childtemp % var % root_var => child % var %root_var |
---|
| 513 | C |
---|
| 514 | C Number of dimensions of the grid variable |
---|
| 515 | childtemp % var % nbdim = nbdim |
---|
| 516 | C |
---|
| 517 | C Tab is the result of the interpolation |
---|
[2715] | 518 | childtemp % var % parray6 => tab |
---|
[1901] | 519 | |
---|
| 520 | childtemp % var % lb = child % var % lb |
---|
| 521 | childtemp % var % ub = child % var % ub |
---|
| 522 | |
---|
| 523 | C |
---|
| 524 | if (torestore) then |
---|
| 525 | C |
---|
[2715] | 526 | childtemp % var % parray6 = child % var % array6 |
---|
[1901] | 527 | C |
---|
| 528 | childtemp % var % restore6D => child % var % restore6D |
---|
| 529 | C |
---|
| 530 | else |
---|
| 531 | C |
---|
| 532 | Nullify(childtemp % var % restore6D) |
---|
| 533 | C |
---|
| 534 | endif |
---|
| 535 | C |
---|
| 536 | C Index indicating (in the Agrif_Interp6D procedure) if a space |
---|
| 537 | C interpolation is necessary |
---|
| 538 | childtemp % var % interpIndex => child % var % interpIndex |
---|
| 539 | childtemp % var % Interpolationshouldbemade = |
---|
| 540 | & child % var % Interpolationshouldbemade |
---|
| 541 | |
---|
| 542 | childtemp % var % list_interp => child % var% list_interp |
---|
| 543 | C |
---|
| 544 | |
---|
| 545 | if (present(procname)) then |
---|
| 546 | Call Agrif_InterpVariable |
---|
| 547 | & (TypeInterp,parent,childtemp,torestore,procname) |
---|
| 548 | else |
---|
| 549 | Call Agrif_InterpVariable |
---|
| 550 | & (TypeInterp,parent,childtemp,torestore) |
---|
| 551 | endif |
---|
| 552 | |
---|
| 553 | |
---|
| 554 | C |
---|
| 555 | child % var % list_interp => childtemp % var %list_interp |
---|
| 556 | deallocate(childtemp % var) |
---|
| 557 | C |
---|
| 558 | C |
---|
| 559 | End Subroutine Agrif_Interp_6D |
---|
| 560 | C |
---|
| 561 | C |
---|
| 562 | C |
---|
| 563 | C ************************************************************************** |
---|
| 564 | C Subroutine Agrif_InterpVariable |
---|
| 565 | C ************************************************************************** |
---|
| 566 | C |
---|
| 567 | Subroutine Agrif_InterpVariable(TYPEinterp,parent,child,torestore, |
---|
| 568 | & procname) |
---|
| 569 | C |
---|
| 570 | CCC Description: |
---|
| 571 | CCC Subroutine to set some arguments of subroutine Agrif_InterpnD, n being the |
---|
| 572 | CCC DIMENSION of the grid variable. |
---|
| 573 | C |
---|
| 574 | CC Declarations: |
---|
| 575 | C |
---|
| 576 | c |
---|
| 577 | C |
---|
| 578 | C |
---|
| 579 | C Scalar argument |
---|
| 580 | INTEGER,DIMENSION(6) :: TYPEinterp! TYPE of interpolation |
---|
| 581 | ! (linear,spline,...) |
---|
| 582 | C Data TYPE arguments |
---|
| 583 | TYPE(AGRIF_PVariable) :: parent ! Variable on the parent grid |
---|
| 584 | TYPE(AGRIF_PVariable) :: child ! Variable on the child grid |
---|
| 585 | C |
---|
| 586 | C LOGICAL argument |
---|
| 587 | LOGICAL:: torestore ! Its value is .false., it indicates the |
---|
| 588 | ! results of the interpolation are |
---|
| 589 | ! applied on the whole current grid |
---|
| 590 | C |
---|
| 591 | C Local scalars |
---|
| 592 | INTEGER :: nbdim ! Number of dimensions of the |
---|
| 593 | ! current grid |
---|
| 594 | INTEGER ,DIMENSION(6) :: pttab_child |
---|
| 595 | INTEGER ,DIMENSION(6) :: petab_child |
---|
| 596 | INTEGER ,DIMENSION(6) :: pttab_parent |
---|
| 597 | REAL ,DIMENSION(6) :: s_child,s_parent |
---|
| 598 | REAL ,DIMENSION(6) :: ds_child,ds_parent |
---|
| 599 | External :: procname |
---|
| 600 | Optional :: procname |
---|
| 601 | |
---|
| 602 | C |
---|
| 603 | Call PreProcessToInterpOrUpdate(parent,child, |
---|
| 604 | & petab_Child(1:nbdim), |
---|
| 605 | & pttab_Child(1:nbdim),pttab_Parent(1:nbdim), |
---|
| 606 | & s_Child(1:nbdim),s_Parent(1:nbdim), |
---|
| 607 | & ds_Child(1:nbdim),ds_Parent(1:nbdim), |
---|
| 608 | & nbdim) |
---|
| 609 | C |
---|
| 610 | C |
---|
| 611 | C Call to a procedure of interpolation against the number of dimensions of |
---|
| 612 | C the grid variable |
---|
| 613 | C |
---|
| 614 | |
---|
| 615 | if (present(procname)) then |
---|
| 616 | call Agrif_InterpnD |
---|
| 617 | & (TYPEinterp,parent,child, |
---|
| 618 | & pttab_Child(1:nbdim),petab_Child(1:nbdim), |
---|
| 619 | & pttab_Child(1:nbdim),pttab_Parent(1:nbdim), |
---|
| 620 | & s_Child(1:nbdim),s_Parent(1:nbdim), |
---|
| 621 | & ds_Child(1:nbdim),ds_Parent(1:nbdim), |
---|
| 622 | & child,torestore,nbdim,procname) |
---|
| 623 | else |
---|
| 624 | call Agrif_InterpnD |
---|
| 625 | & (TYPEinterp,parent,child, |
---|
| 626 | & pttab_Child(1:nbdim),petab_Child(1:nbdim), |
---|
| 627 | & pttab_Child(1:nbdim),pttab_Parent(1:nbdim), |
---|
| 628 | & s_Child(1:nbdim),s_Parent(1:nbdim), |
---|
| 629 | & ds_Child(1:nbdim),ds_Parent(1:nbdim), |
---|
| 630 | & child,torestore,nbdim) |
---|
| 631 | |
---|
| 632 | endif |
---|
| 633 | C |
---|
| 634 | Return |
---|
| 635 | C |
---|
| 636 | C |
---|
| 637 | End subroutine Agrif_InterpVariable |
---|
| 638 | C |
---|
| 639 | C |
---|
| 640 | C ************************************************************************** |
---|
| 641 | C Subroutine Agrif_InterpnD |
---|
| 642 | C ************************************************************************** |
---|
| 643 | C |
---|
| 644 | Subroutine Agrif_InterpnD(TYPEinterp,parent,child, |
---|
| 645 | & pttab,petab, |
---|
| 646 | & pttab_Child,pttab_Parent, |
---|
| 647 | & s_Child,s_Parent,ds_Child,ds_Parent, |
---|
| 648 | & restore,torestore,nbdim,procname) |
---|
| 649 | C |
---|
| 650 | C Description: |
---|
| 651 | C Subroutine to interpolate a nD grid variable from its parent grid, |
---|
| 652 | C by using a space interpolation. |
---|
| 653 | C |
---|
| 654 | C Declarations: |
---|
| 655 | C |
---|
| 656 | |
---|
| 657 | C |
---|
[2019] | 658 | #ifdef key_mpp_mpi |
---|
[1901] | 659 | C |
---|
[2019] | 660 | INCLUDE 'mpif.h' |
---|
[1901] | 661 | C |
---|
| 662 | #endif |
---|
| 663 | C |
---|
| 664 | C Arguments |
---|
| 665 | External :: procname |
---|
| 666 | Optional :: procname |
---|
| 667 | INTEGER :: nbdim |
---|
| 668 | INTEGER,DIMENSION(6) :: TYPEinterp ! TYPE of interpolation |
---|
| 669 | ! (linear,...) |
---|
| 670 | TYPE(AGRIF_PVARIABLE) :: parent ! Variable of the parent |
---|
| 671 | ! grid |
---|
| 672 | TYPE(AGRIF_PVARIABLE) :: child ! Variable of the child |
---|
| 673 | ! grid |
---|
| 674 | INTEGER,DIMENSION(nbdim) :: pttab ! Index of the first |
---|
| 675 | ! point inside the |
---|
| 676 | ! domain |
---|
| 677 | INTEGER,DIMENSION(nbdim) :: petab ! Index of the first |
---|
| 678 | ! point inside the |
---|
| 679 | ! domain |
---|
| 680 | INTEGER,DIMENSION(nbdim) :: pttab_Child ! Index of the first |
---|
| 681 | ! point inside the |
---|
| 682 | ! domain for the child |
---|
| 683 | ! grid variable |
---|
| 684 | INTEGER,DIMENSION(nbdim) :: pttab_Parent ! Index of the first |
---|
| 685 | ! point inside the |
---|
| 686 | ! domain for the |
---|
| 687 | ! parent grid variable |
---|
| 688 | TYPE(AGRIF_PVARIABLE) :: restore ! Indicates points where |
---|
| 689 | ! interpolation |
---|
| 690 | REAL,DIMENSION(nbdim) :: s_Child,s_Parent ! Positions of the parent |
---|
| 691 | ! and child grids |
---|
| 692 | REAL,DIMENSION(nbdim) :: ds_Child,ds_Parent ! Space steps of the |
---|
| 693 | ! parent and child |
---|
| 694 | ! grids |
---|
| 695 | LOGICAL :: torestore ! Indicates if the array |
---|
| 696 | ! restore is used |
---|
| 697 | C |
---|
| 698 | C Local pointers |
---|
| 699 | TYPE(AGRIF_PVARIABLE),SAVE :: tempP,tempPextend ! Temporary parent grid variable |
---|
| 700 | TYPE(AGRIF_PVARIABLE),SAVE :: tempC ! Temporary child grid variable |
---|
| 701 | C |
---|
| 702 | C Local scalars |
---|
| 703 | INTEGER :: i,j,k,l,m,n |
---|
| 704 | INTEGER,DIMENSION(nbdim) :: pttruetab,cetruetab |
---|
| 705 | INTEGER,DIMENSION(nbdim) :: indmin,indmax |
---|
| 706 | LOGICAL,DIMENSION(nbdim) :: noraftab |
---|
| 707 | REAL ,DIMENSION(nbdim) :: s_Child_temp,s_Parent_temp |
---|
| 708 | INTEGER,DIMENSION(nbdim) :: lowerbound,upperbound |
---|
| 709 | INTEGER,DIMENSION(nbdim) :: indminglob,indmaxglob |
---|
| 710 | INTEGER,DIMENSION(nbdim,2,2) :: childarray |
---|
| 711 | INTEGER,DIMENSION(nbdim,2,2) :: parentarray |
---|
| 712 | LOGICAL :: memberin,member |
---|
| 713 | TYPE(AGRIF_PVARIABLE),SAVE :: parentvalues |
---|
| 714 | LOGICAL :: find_list_interp |
---|
| 715 | INTEGER,DIMENSION(nbdim) :: indminglob2,indmaxglob2 |
---|
| 716 | C |
---|
[2019] | 717 | #ifdef key_mpp_mpi |
---|
[1901] | 718 | C |
---|
| 719 | LOGICAL :: memberout |
---|
| 720 | INTEGER,PARAMETER :: etiquette = 100 |
---|
| 721 | INTEGER :: code |
---|
| 722 | INTEGER,DIMENSION(nbdim,4) :: tab3 |
---|
| 723 | INTEGER,DIMENSION(nbdim,4,0:Agrif_Nbprocs-1) :: tab4 |
---|
| 724 | INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1,8) :: tab4t |
---|
| 725 | LOGICAL, DIMENSION(0:Agrif_Nbprocs-1) :: memberinall |
---|
| 726 | LOGICAL, DIMENSION(0:Agrif_Nbprocs-1) :: sendtoproc1,recvfromproc1 |
---|
| 727 | LOGICAL, DIMENSION(1) :: memberin1 |
---|
| 728 | C |
---|
| 729 | #endif |
---|
| 730 | C |
---|
| 731 | |
---|
| 732 | C |
---|
| 733 | C Boundaries of the current grid where interpolation is done |
---|
| 734 | |
---|
| 735 | IF (Associated(child%var%list_interp)) THEN |
---|
| 736 | Call Agrif_Find_list_interp(child%var%list_interp,pttab,petab, |
---|
| 737 | & pttab_Child,pttab_Parent,nbdim, |
---|
| 738 | & indmin,indmax,indminglob, |
---|
| 739 | & indmaxglob,indminglob2,indmaxglob2,parentarray, |
---|
| 740 | & pttruetab,cetruetab,member,memberin,find_list_interp |
---|
[2019] | 741 | #if defined key_mpp_mpi |
---|
[1901] | 742 | & ,tab4t,memberinall,sendtoproc1,recvfromproc1 |
---|
| 743 | #endif |
---|
| 744 | & ) |
---|
| 745 | ELSE |
---|
| 746 | find_list_interp = .FALSE. |
---|
| 747 | ENDIF |
---|
| 748 | |
---|
| 749 | IF (.not.find_list_interp) THEN |
---|
| 750 | |
---|
| 751 | Call Agrif_nbdim_Get_bound_dimension(child % var, |
---|
| 752 | & lowerbound,upperbound,nbdim) |
---|
| 753 | |
---|
| 754 | Call Agrif_Childbounds(nbdim,lowerbound,upperbound, |
---|
| 755 | & pttab,petab, |
---|
| 756 | & pttruetab,cetruetab,memberin) |
---|
| 757 | |
---|
| 758 | C |
---|
| 759 | Call Agrif_Parentbounds(TYPEinterp,nbdim,indminglob,indmaxglob, |
---|
| 760 | & s_Parent_temp,s_Child_temp, |
---|
| 761 | & s_Child,ds_Child, |
---|
| 762 | & s_Parent,ds_Parent, |
---|
| 763 | & pttab,petab, |
---|
| 764 | & pttab_Child,pttab_Parent, |
---|
| 765 | & child%var%root_var%posvar, |
---|
| 766 | & child % var % root_var % interptab) |
---|
| 767 | |
---|
[2019] | 768 | #ifdef key_mpp_mpi |
---|
[1901] | 769 | IF (memberin) THEN |
---|
| 770 | Call Agrif_Parentbounds(TYPEinterp,nbdim,indmin,indmax, |
---|
| 771 | & s_Parent_temp,s_Child_temp, |
---|
| 772 | & s_Child,ds_Child, |
---|
| 773 | & s_Parent,ds_Parent, |
---|
| 774 | & pttruetab,cetruetab, |
---|
| 775 | & pttab_Child,pttab_Parent, |
---|
| 776 | & child%var%root_var%posvar, |
---|
| 777 | & child % var % root_var % interptab) |
---|
| 778 | ENDIF |
---|
| 779 | |
---|
| 780 | Call Agrif_nbdim_Get_bound_dimension(parent%var, |
---|
| 781 | & lowerbound,upperbound,nbdim) |
---|
| 782 | |
---|
| 783 | Call Agrif_ChildGrid_to_ParentGrid() |
---|
| 784 | C |
---|
| 785 | Call Agrif_Childbounds(nbdim, |
---|
| 786 | & lowerbound,upperbound, |
---|
| 787 | & indminglob,indmaxglob, |
---|
| 788 | & indminglob2,indmaxglob2,member) |
---|
| 789 | |
---|
| 790 | C |
---|
| 791 | IF (member) THEN |
---|
| 792 | Call Agrif_GlobtoLocInd2(parentarray, |
---|
| 793 | & lowerbound,upperbound, |
---|
| 794 | & indminglob2,indmaxglob2, |
---|
| 795 | & nbdim,Agrif_Procrank, |
---|
| 796 | & member) |
---|
| 797 | endif |
---|
| 798 | |
---|
| 799 | Call Agrif_ParentGrid_to_ChildGrid() |
---|
| 800 | #else |
---|
| 801 | parentarray(:,1,1) = indminglob |
---|
| 802 | parentarray(:,2,1) = indmaxglob |
---|
| 803 | parentarray(:,1,2) = indminglob |
---|
| 804 | parentarray(:,2,2) = indmaxglob |
---|
| 805 | indmin = indminglob |
---|
| 806 | indmax = indmaxglob |
---|
| 807 | member = .TRUE. |
---|
| 808 | #endif |
---|
| 809 | |
---|
| 810 | ELSE |
---|
| 811 | |
---|
[2019] | 812 | #if !defined key_mpp_mpi |
---|
[1901] | 813 | parentarray(:,1,1) = indminglob |
---|
| 814 | parentarray(:,2,1) = indmaxglob |
---|
| 815 | parentarray(:,1,2) = indminglob |
---|
| 816 | parentarray(:,2,2) = indmaxglob |
---|
| 817 | indmin = indminglob |
---|
| 818 | indmax = indmaxglob |
---|
| 819 | member = .TRUE. |
---|
| 820 | s_Parent_temp = s_Parent + (indminglob - pttab_Parent)*ds_Parent |
---|
| 821 | s_Child_temp = s_Child + (pttab - pttab_Child) * ds_Child |
---|
| 822 | #else |
---|
| 823 | s_Parent_temp = s_Parent + (indmin - pttab_Parent)*ds_Parent |
---|
| 824 | s_Child_temp = s_Child + (pttruetab - pttab_Child) * ds_Child |
---|
| 825 | #endif |
---|
| 826 | |
---|
| 827 | ENDIF |
---|
| 828 | |
---|
| 829 | IF (member) THEN |
---|
| 830 | IF (.not.associated(tempP%var)) allocate(tempP%var) |
---|
| 831 | |
---|
| 832 | C |
---|
| 833 | Call Agrif_nbdim_allocation(tempP%var, |
---|
| 834 | & parentarray(:,1,1),parentarray(:,2,1),nbdim) |
---|
| 835 | |
---|
| 836 | Call Agrif_nbdim_Full_VarEQreal(tempP%var,0.,nbdim) |
---|
| 837 | |
---|
| 838 | IF (present(procname)) THEN |
---|
| 839 | Call Agrif_ChildGrid_to_ParentGrid() |
---|
| 840 | SELECT CASE (nbdim) |
---|
| 841 | CASE(1) |
---|
| 842 | CALL procname(tempP%var%array1, |
---|
| 843 | & parentarray(1,1,2),parentarray(1,2,2)) |
---|
| 844 | CASE(2) |
---|
| 845 | CALL procname(tempP%var%array2, |
---|
| 846 | & parentarray(1,1,2),parentarray(1,2,2), |
---|
| 847 | & parentarray(2,1,2),parentarray(2,2,2)) |
---|
| 848 | CASE(3) |
---|
| 849 | CALL procname(tempP%var%array3, |
---|
| 850 | & parentarray(1,1,2),parentarray(1,2,2), |
---|
| 851 | & parentarray(2,1,2),parentarray(2,2,2), |
---|
| 852 | & parentarray(3,1,2),parentarray(3,2,2)) |
---|
| 853 | CASE(4) |
---|
| 854 | CALL procname(tempP%var%array4, |
---|
| 855 | & parentarray(1,1,2),parentarray(1,2,2), |
---|
| 856 | & parentarray(2,1,2),parentarray(2,2,2), |
---|
| 857 | & parentarray(3,1,2),parentarray(3,2,2), |
---|
| 858 | & parentarray(4,1,2),parentarray(4,2,2)) |
---|
| 859 | CASE(5) |
---|
| 860 | CALL procname(tempP%var%array5, |
---|
| 861 | & parentarray(1,1,2),parentarray(1,2,2), |
---|
| 862 | & parentarray(2,1,2),parentarray(2,2,2), |
---|
| 863 | & parentarray(3,1,2),parentarray(3,2,2), |
---|
| 864 | & parentarray(4,1,2),parentarray(4,2,2), |
---|
| 865 | & parentarray(5,1,2),parentarray(5,2,2)) |
---|
| 866 | CASE(6) |
---|
| 867 | CALL procname(tempP%var%array6, |
---|
| 868 | & parentarray(1,1,2),parentarray(1,2,2), |
---|
| 869 | & parentarray(2,1,2),parentarray(2,2,2), |
---|
| 870 | & parentarray(3,1,2),parentarray(3,2,2), |
---|
| 871 | & parentarray(4,1,2),parentarray(4,2,2), |
---|
| 872 | & parentarray(5,1,2),parentarray(5,2,2), |
---|
| 873 | & parentarray(6,1,2),parentarray(6,2,2)) |
---|
| 874 | END SELECT |
---|
| 875 | Call Agrif_ParentGrid_to_ChildGrid() |
---|
| 876 | ELSE |
---|
| 877 | |
---|
| 878 | Call Agrif_nbdim_VarEQvar(tempP%var, |
---|
| 879 | & parentarray(:,1,1),parentarray(:,2,1), |
---|
| 880 | & parent%var,parentarray(:,1,2),parentarray(:,2,2), |
---|
| 881 | & nbdim) |
---|
| 882 | ENDIF |
---|
| 883 | endif |
---|
| 884 | |
---|
[2019] | 885 | #ifdef key_mpp_mpi |
---|
[1901] | 886 | if (.not.find_list_interp) then |
---|
| 887 | tab3(:,1) = indminglob2(:) |
---|
| 888 | tab3(:,2) = indmaxglob2(:) |
---|
| 889 | tab3(:,3) = indmin(:) |
---|
| 890 | tab3(:,4) = indmax(:) |
---|
| 891 | C |
---|
| 892 | C |
---|
| 893 | Call MPI_ALLGATHER(tab3,4*nbdim,MPI_INTEGER,tab4,4*nbdim, |
---|
[2715] | 894 | & MPI_INTEGER,MPI_COMM_WORLD,code) |
---|
[1901] | 895 | |
---|
| 896 | IF (.not.associated(tempPextend%var)) Allocate(tempPextend%var) |
---|
| 897 | |
---|
| 898 | DO k=0,Agrif_Nbprocs-1 |
---|
| 899 | do j=1,4 |
---|
| 900 | do i=1,nbdim |
---|
| 901 | tab4t(i,k,j) = tab4(i,j,k) |
---|
| 902 | enddo |
---|
| 903 | enddo |
---|
| 904 | enddo |
---|
| 905 | |
---|
| 906 | memberin1(1) = memberin |
---|
| 907 | CALL MPI_ALLGATHER(memberin1,1,MPI_LOGICAL,memberinall, |
---|
[2715] | 908 | & 1,MPI_LOGICAL,MPI_COMM_WORLD,code) |
---|
[1901] | 909 | |
---|
| 910 | Call Get_External_Data_first(tab4t(:,:,1), |
---|
| 911 | & tab4t(:,:,2), |
---|
| 912 | & tab4t(:,:,3),tab4t(:,:,4),nbdim,member,memberin, |
---|
| 913 | & memberinall,sendtoproc1,recvfromproc1,tab4t(:,:,5), |
---|
| 914 | & tab4t(:,:,6),tab4t(:,:,7),tab4t(:,:,8)) |
---|
| 915 | |
---|
| 916 | endif |
---|
| 917 | |
---|
| 918 | ! Call Get_External_Data(tempP,tempPextend,tab4t(:,:,1), |
---|
| 919 | ! & tab4t(:,:,2), |
---|
| 920 | ! & tab4t(:,:,3),tab4t(:,:,4),nbdim,member,memberin, |
---|
| 921 | ! & memberinall) |
---|
| 922 | |
---|
| 923 | Call ExchangeSameLevel2(sendtoproc1,recvfromproc1,nbdim, |
---|
| 924 | & tab4t(:,:,3),tab4t(:,:,4),tab4t(:,:,5),tab4t(:,:,6), |
---|
| 925 | & tab4t(:,:,7),tab4t(:,:,8),memberin,tempP, |
---|
| 926 | & tempPextend) |
---|
| 927 | #else |
---|
| 928 | tempPextend%var => tempP%var |
---|
| 929 | #endif |
---|
| 930 | |
---|
| 931 | if (.not.find_list_interp) then |
---|
| 932 | Call Agrif_Addto_list_interp(child%var%list_interp,pttab,petab, |
---|
| 933 | & pttab_Child,pttab_Parent,indmin,indmax, |
---|
| 934 | & indminglob,indmaxglob,indminglob2,indmaxglob2,parentarray, |
---|
| 935 | & pttruetab,cetruetab,member,memberin,nbdim |
---|
[2019] | 936 | #if defined key_mpp_mpi |
---|
[1901] | 937 | & ,tab4t,memberinall,sendtoproc1,recvfromproc1 |
---|
| 938 | #endif |
---|
| 939 | & ) |
---|
| 940 | endif |
---|
| 941 | C |
---|
| 942 | C |
---|
| 943 | IF (memberin) THEN |
---|
| 944 | IF (.not.associated(tempC%var)) allocate(tempC%var) |
---|
| 945 | C |
---|
| 946 | |
---|
| 947 | Call Agrif_nbdim_allocation(tempC%var,pttruetab,cetruetab,nbdim) |
---|
| 948 | |
---|
| 949 | C |
---|
| 950 | C |
---|
| 951 | C Special values on the parent grid |
---|
| 952 | if (Agrif_UseSpecialValue) then |
---|
| 953 | C |
---|
| 954 | noraftab(1:nbdim) = |
---|
| 955 | & child % var % root_var % interptab(1:nbdim) .EQ. 'N' |
---|
| 956 | C |
---|
| 957 | IF (.not.associated(parentvalues%var)) |
---|
| 958 | & Allocate(parentvalues%var) |
---|
| 959 | C |
---|
| 960 | Call Agrif_nbdim_allocation |
---|
| 961 | & (parentvalues%var,indmin,indmax,nbdim) |
---|
| 962 | Call Agrif_nbdim_Full_VarEQvar |
---|
| 963 | & (parentvalues%var,tempPextend%var,nbdim) |
---|
| 964 | C |
---|
| 965 | Call Agrif_CheckMasknD(tempPextend, |
---|
| 966 | & parentvalues, |
---|
| 967 | & indmin(1:nbdim),indmax(1:nbdim), |
---|
| 968 | & indmin(1:nbdim),indmax(1:nbdim), |
---|
| 969 | & noraftab(1:nbdim),nbdim) |
---|
| 970 | C |
---|
| 971 | Call Agrif_nbdim_deallocation(parentvalues%var,nbdim) |
---|
| 972 | C Deallocate(parentvalues%var) |
---|
| 973 | C |
---|
| 974 | C |
---|
| 975 | endif |
---|
| 976 | |
---|
| 977 | C |
---|
| 978 | C |
---|
| 979 | C Interpolation of the current grid |
---|
| 980 | |
---|
| 981 | IF (memberin) THEN |
---|
| 982 | if ( nbdim .EQ. 1 ) then |
---|
| 983 | Call Agrif_Interp_1D_recursive(TypeInterp, |
---|
| 984 | & tempPextend%var%array1,tempC%var%array1, |
---|
| 985 | & indmin,indmax, |
---|
| 986 | & pttruetab,cetruetab, |
---|
| 987 | & s_Child_temp,s_Parent_temp, |
---|
| 988 | & ds_Child,ds_Parent,nbdim) |
---|
| 989 | elseif ( nbdim .EQ. 2 ) then |
---|
| 990 | |
---|
| 991 | Call Agrif_Interp_2D_recursive(TypeInterp, |
---|
| 992 | & tempPextend%var%array2,tempC%var%array2, |
---|
| 993 | & indmin,indmax, |
---|
| 994 | & pttruetab,cetruetab, |
---|
| 995 | & s_Child_temp,s_Parent_temp, |
---|
| 996 | & ds_Child,ds_Parent,nbdim) |
---|
| 997 | elseif ( nbdim .EQ. 3 ) then |
---|
| 998 | |
---|
| 999 | Call Agrif_Interp_3D_recursive(TypeInterp, |
---|
| 1000 | & tempPextend%var%array3,tempC%var%array3, |
---|
| 1001 | & indmin,indmax, |
---|
| 1002 | & pttruetab,cetruetab, |
---|
| 1003 | & s_Child_temp,s_Parent_temp, |
---|
| 1004 | & ds_Child,ds_Parent,nbdim) |
---|
| 1005 | elseif ( nbdim .EQ. 4 ) then |
---|
| 1006 | Call Agrif_Interp_4D_recursive(TypeInterp, |
---|
| 1007 | & tempPextend%var%array4,tempC%var%array4, |
---|
| 1008 | & indmin,indmax, |
---|
| 1009 | & pttruetab,cetruetab, |
---|
| 1010 | & s_Child_temp,s_Parent_temp, |
---|
| 1011 | & ds_Child,ds_Parent,nbdim) |
---|
| 1012 | elseif ( nbdim .EQ. 5 ) then |
---|
| 1013 | Call Agrif_Interp_5D_recursive(TypeInterp, |
---|
| 1014 | & tempPextend%var%array5,tempC%var%array5, |
---|
| 1015 | & indmin,indmax, |
---|
| 1016 | & pttruetab,cetruetab, |
---|
| 1017 | & s_Child_temp,s_Parent_temp, |
---|
| 1018 | & ds_Child,ds_Parent,nbdim) |
---|
| 1019 | elseif ( nbdim .EQ. 6 ) then |
---|
| 1020 | Call Agrif_Interp_6D_recursive(TypeInterp, |
---|
| 1021 | & tempPextend%var%array6,tempC%var%array6, |
---|
| 1022 | & indmin,indmax, |
---|
| 1023 | & pttruetab,cetruetab, |
---|
| 1024 | & s_Child_temp,s_Parent_temp, |
---|
| 1025 | & ds_Child,ds_Parent,nbdim) |
---|
| 1026 | endif |
---|
| 1027 | |
---|
| 1028 | |
---|
| 1029 | C |
---|
| 1030 | |
---|
| 1031 | Call Agrif_nbdim_Get_bound_dimension(child % var, |
---|
| 1032 | & lowerbound,upperbound,nbdim) |
---|
| 1033 | |
---|
[2019] | 1034 | #ifdef key_mpp_mpi |
---|
[1901] | 1035 | Call Agrif_GlobtoLocInd2(childarray, |
---|
| 1036 | & lowerbound,upperbound, |
---|
| 1037 | & pttruetab,cetruetab, |
---|
| 1038 | & nbdim,Agrif_Procrank, |
---|
| 1039 | & memberout) |
---|
| 1040 | |
---|
| 1041 | #else |
---|
| 1042 | childarray(:,1,1) = pttruetab |
---|
| 1043 | childarray(:,2,1) = cetruetab |
---|
| 1044 | childarray(:,1,2) = pttruetab |
---|
| 1045 | childarray(:,2,2) = cetruetab |
---|
| 1046 | ccccccccccccccc memberout = .TRUE. |
---|
| 1047 | #endif |
---|
| 1048 | |
---|
| 1049 | |
---|
| 1050 | C |
---|
| 1051 | C |
---|
| 1052 | C Special values on the child grid |
---|
| 1053 | if (Agrif_UseSpecialValueFineGrid) then |
---|
| 1054 | C |
---|
| 1055 | |
---|
| 1056 | Call GiveAgrif_SpecialValueToTab_mpi(child%var,tempC%var, |
---|
| 1057 | & childarray, |
---|
| 1058 | & pttruetab,cetruetab, |
---|
| 1059 | & Agrif_SpecialValueFineGrid,nbdim) |
---|
| 1060 | |
---|
| 1061 | C |
---|
| 1062 | endif |
---|
| 1063 | |
---|
| 1064 | endif |
---|
| 1065 | |
---|
| 1066 | C |
---|
| 1067 | if (torestore) then |
---|
| 1068 | C |
---|
[2019] | 1069 | #ifdef key_mpp_mpi |
---|
[1901] | 1070 | C |
---|
| 1071 | SELECT CASE (nbdim) |
---|
| 1072 | CASE (1) |
---|
| 1073 | do i = pttruetab(1),cetruetab(1) |
---|
| 1074 | ChildarrayAModifier if (restore%var%restore1D(i) == 0) |
---|
| 1075 | ChildarrayAModifier & child%var%array1(childarray(i,1,2) |
---|
| 1076 | ChildarrayAModifier & ) = |
---|
| 1077 | ChildarrayAModifier & tempC%var%array1(i) |
---|
| 1078 | enddo |
---|
| 1079 | CASE (2) |
---|
| 1080 | do i = pttruetab(1),cetruetab(1) |
---|
| 1081 | do j = pttruetab(2),cetruetab(2) |
---|
| 1082 | ChildarrayAModifier if (restore%var%restore2D(i,j) == 0) |
---|
| 1083 | ChildarrayAModifier & child%var%array2(childarray(i,1,2), |
---|
| 1084 | ChildarrayAModifier & childarray(j,2,2)) = |
---|
| 1085 | ChildarrayAModifier & tempC%var%array2(i,j) |
---|
| 1086 | enddo |
---|
| 1087 | enddo |
---|
| 1088 | CASE (3) |
---|
| 1089 | do i = pttruetab(1),cetruetab(1) |
---|
| 1090 | do j = pttruetab(2),cetruetab(2) |
---|
| 1091 | do k = pttruetab(3),cetruetab(3) |
---|
| 1092 | ChildarrayAModifier if (restore%var%restore3D(i,j,k) == 0) |
---|
| 1093 | ChildarrayAModifier & child%var%array3(childarray(i,1,2), |
---|
| 1094 | ChildarrayAModifier & childarray(j,2,2), |
---|
| 1095 | ChildarrayAModifier & childarray(k,3,2)) = |
---|
| 1096 | ChildarrayAModifier & tempC%var%array3(i,j,k) |
---|
| 1097 | enddo |
---|
| 1098 | enddo |
---|
| 1099 | enddo |
---|
| 1100 | CASE (4) |
---|
| 1101 | do i = pttruetab(1),cetruetab(1) |
---|
| 1102 | do j = pttruetab(2),cetruetab(2) |
---|
| 1103 | do k = pttruetab(3),cetruetab(3) |
---|
| 1104 | do l = pttruetab(4),cetruetab(4) |
---|
| 1105 | ChildarrayAModifier if (restore%var%restore4D(i,j,k,l) == 0) |
---|
| 1106 | ChildarrayAModifier & child%var%array4(childarray(i,1,2), |
---|
| 1107 | ChildarrayAModifier & childarray(j,2,2), |
---|
| 1108 | ChildarrayAModifier & childarray(k,3,2), |
---|
| 1109 | ChildarrayAModifier & childarray(l,4,2)) = |
---|
| 1110 | ChildarrayAModifier & tempC%var%array4(i,j,k,l) |
---|
| 1111 | enddo |
---|
| 1112 | enddo |
---|
| 1113 | enddo |
---|
| 1114 | enddo |
---|
| 1115 | CASE (5) |
---|
| 1116 | do i = pttruetab(1),cetruetab(1) |
---|
| 1117 | do j = pttruetab(2),cetruetab(2) |
---|
| 1118 | do k = pttruetab(3),cetruetab(3) |
---|
| 1119 | do l = pttruetab(4),cetruetab(4) |
---|
| 1120 | do m = pttruetab(5),cetruetab(5) |
---|
| 1121 | ChildarrayAModifier if (restore%var%restore5D(i,j,k,l,m) == 0) |
---|
| 1122 | ChildarrayAModifier & child%var%array5(childarray(i,1,2), |
---|
| 1123 | ChildarrayAModifier & childarray(j,2,2), |
---|
| 1124 | ChildarrayAModifier & childarray(k,3,2), |
---|
| 1125 | ChildarrayAModifier & childarray(l,4,2), |
---|
| 1126 | ChildarrayAModifier & childarray(m,5,2)) = |
---|
| 1127 | ChildarrayAModifier & tempC%var%array5(i,j,k,l,m) |
---|
| 1128 | enddo |
---|
| 1129 | enddo |
---|
| 1130 | enddo |
---|
| 1131 | enddo |
---|
| 1132 | enddo |
---|
| 1133 | CASE (6) |
---|
| 1134 | do i = pttruetab(1),cetruetab(1) |
---|
| 1135 | do j = pttruetab(2),cetruetab(2) |
---|
| 1136 | do k = pttruetab(3),cetruetab(3) |
---|
| 1137 | do l = pttruetab(4),cetruetab(4) |
---|
| 1138 | do m = pttruetab(5),cetruetab(5) |
---|
| 1139 | do n = pttruetab(6),cetruetab(6) |
---|
| 1140 | ChildarrayAModifier if (restore%var%restore6D(i,j,k,l,m,n) == 0) |
---|
| 1141 | ChildarrayAModifier & child%var%array6(childarray(i,1,2), |
---|
| 1142 | ChildarrayAModifier & childarray(j,2,2), |
---|
| 1143 | ChildarrayAModifier & childarray(k,3,2), |
---|
| 1144 | ChildarrayAModifier & childarray(l,4,2), |
---|
| 1145 | ChildarrayAModifier & childarray(m,5,2), |
---|
| 1146 | ChildarrayAModifier & childarray(n,6,2)) = |
---|
| 1147 | ChildarrayAModifier & tempC%var%array6(i,j,k,l,m,n) |
---|
| 1148 | enddo |
---|
| 1149 | enddo |
---|
| 1150 | enddo |
---|
| 1151 | enddo |
---|
| 1152 | enddo |
---|
| 1153 | enddo |
---|
| 1154 | END SELECT |
---|
| 1155 | C |
---|
| 1156 | #else |
---|
| 1157 | SELECT CASE (nbdim) |
---|
| 1158 | CASE (1) |
---|
| 1159 | do i = pttruetab(1),cetruetab(1) |
---|
| 1160 | if (restore%var%restore1D(i) == 0) |
---|
[2715] | 1161 | & child % var % parray1(i) = |
---|
[1901] | 1162 | & tempC % var % array1(i) |
---|
| 1163 | enddo |
---|
| 1164 | CASE (2) |
---|
| 1165 | do j = pttruetab(2),cetruetab(2) |
---|
| 1166 | do i = pttruetab(1),cetruetab(1) |
---|
| 1167 | if (restore%var%restore2D(i,j) == 0) |
---|
[2715] | 1168 | & child % var % parray2(i,j) = |
---|
[1901] | 1169 | & tempC % var % array2(i,j) |
---|
| 1170 | enddo |
---|
| 1171 | enddo |
---|
| 1172 | CASE (3) |
---|
| 1173 | do k = pttruetab(3),cetruetab(3) |
---|
| 1174 | do j = pttruetab(2),cetruetab(2) |
---|
| 1175 | do i = pttruetab(1),cetruetab(1) |
---|
| 1176 | if (restore%var%restore3D(i,j,k) == 0) |
---|
[2715] | 1177 | & child % var % parray3(i,j,k) = |
---|
[1901] | 1178 | & tempC % var % array3(i,j,k) |
---|
| 1179 | enddo |
---|
| 1180 | enddo |
---|
| 1181 | enddo |
---|
| 1182 | CASE (4) |
---|
| 1183 | do l = pttruetab(4),cetruetab(4) |
---|
| 1184 | do k = pttruetab(3),cetruetab(3) |
---|
| 1185 | do j = pttruetab(2),cetruetab(2) |
---|
| 1186 | do i = pttruetab(1),cetruetab(1) |
---|
| 1187 | if (restore%var%restore4D(i,j,k,l) == 0) |
---|
[2715] | 1188 | & child % var % parray4(i,j,k,l) = |
---|
[1901] | 1189 | & tempC % var % array4(i,j,k,l) |
---|
| 1190 | enddo |
---|
| 1191 | enddo |
---|
| 1192 | enddo |
---|
| 1193 | enddo |
---|
| 1194 | CASE (5) |
---|
| 1195 | do m = pttruetab(5),cetruetab(5) |
---|
| 1196 | do l = pttruetab(4),cetruetab(4) |
---|
| 1197 | do k = pttruetab(3),cetruetab(3) |
---|
| 1198 | do j = pttruetab(2),cetruetab(2) |
---|
| 1199 | do i = pttruetab(1),cetruetab(1) |
---|
| 1200 | if (restore%var%restore5D(i,j,k,l,m) == 0) |
---|
[2715] | 1201 | & child % var % parray5(i,j,k,l,m) = |
---|
[1901] | 1202 | & tempC % var % array5(i,j,k,l,m) |
---|
| 1203 | enddo |
---|
| 1204 | enddo |
---|
| 1205 | enddo |
---|
| 1206 | enddo |
---|
| 1207 | enddo |
---|
| 1208 | CASE (6) |
---|
| 1209 | do n = pttruetab(6),cetruetab(6) |
---|
| 1210 | do m = pttruetab(5),cetruetab(5) |
---|
| 1211 | do l = pttruetab(4),cetruetab(4) |
---|
| 1212 | do k = pttruetab(3),cetruetab(3) |
---|
| 1213 | do j = pttruetab(2),cetruetab(2) |
---|
| 1214 | do i = pttruetab(1),cetruetab(1) |
---|
| 1215 | if (restore%var%restore6D(i,j,k,l,m,n) == 0) |
---|
[2715] | 1216 | & child % var % parray6(i,j,k,l,m,n) = |
---|
[1901] | 1217 | & tempC % var % array6(i,j,k,l,m,n) |
---|
| 1218 | enddo |
---|
| 1219 | enddo |
---|
| 1220 | enddo |
---|
| 1221 | enddo |
---|
| 1222 | enddo |
---|
| 1223 | enddo |
---|
| 1224 | END SELECT |
---|
| 1225 | C |
---|
| 1226 | #endif |
---|
| 1227 | C |
---|
| 1228 | else |
---|
| 1229 | C |
---|
| 1230 | C |
---|
| 1231 | IF (memberin) THEN |
---|
| 1232 | SELECT CASE (nbdim) |
---|
| 1233 | CASE (1) |
---|
[2715] | 1234 | child%var%parray1(childarray(1,1,2):childarray(1,2,2)) = |
---|
[1901] | 1235 | & tempC%var%array1(childarray(1,1,1):childarray(1,2,1)) |
---|
| 1236 | CASE (2) |
---|
[2715] | 1237 | child%var%parray2(childarray(1,1,2):childarray(1,2,2), |
---|
[1901] | 1238 | & childarray(2,1,2):childarray(2,2,2)) = |
---|
| 1239 | & tempC%var%array2(childarray(1,1,1):childarray(1,2,1), |
---|
| 1240 | & childarray(2,1,1):childarray(2,2,1)) |
---|
| 1241 | CASE (3) |
---|
[2715] | 1242 | child%var%parray3(childarray(1,1,2):childarray(1,2,2), |
---|
[1901] | 1243 | & childarray(2,1,2):childarray(2,2,2), |
---|
| 1244 | & childarray(3,1,2):childarray(3,2,2)) = |
---|
| 1245 | & tempC%var%array3(childarray(1,1,1):childarray(1,2,1), |
---|
| 1246 | & childarray(2,1,1):childarray(2,2,1), |
---|
| 1247 | & childarray(3,1,1):childarray(3,2,1)) |
---|
| 1248 | CASE (4) |
---|
[2715] | 1249 | child%var%parray4(childarray(1,1,2):childarray(1,2,2), |
---|
[1901] | 1250 | & childarray(2,1,2):childarray(2,2,2), |
---|
| 1251 | & childarray(3,1,2):childarray(3,2,2), |
---|
| 1252 | & childarray(4,1,2):childarray(4,2,2)) = |
---|
| 1253 | & tempC%var%array4(childarray(1,1,1):childarray(1,2,1), |
---|
| 1254 | & childarray(2,1,1):childarray(2,2,1), |
---|
| 1255 | & childarray(3,1,1):childarray(3,2,1), |
---|
| 1256 | & childarray(4,1,1):childarray(4,2,1)) |
---|
| 1257 | CASE (5) |
---|
[2715] | 1258 | child%var%parray5(childarray(1,1,2):childarray(1,2,2), |
---|
[1901] | 1259 | & childarray(2,1,2):childarray(2,2,2), |
---|
| 1260 | & childarray(3,1,2):childarray(3,2,2), |
---|
| 1261 | & childarray(4,1,2):childarray(4,2,2), |
---|
| 1262 | & childarray(5,1,2):childarray(5,2,2)) = |
---|
| 1263 | & tempC%var%array5(childarray(1,1,1):childarray(1,2,1), |
---|
| 1264 | & childarray(2,1,1):childarray(2,2,1), |
---|
| 1265 | & childarray(3,1,1):childarray(3,2,1), |
---|
| 1266 | & childarray(4,1,1):childarray(4,2,1), |
---|
| 1267 | & childarray(5,1,1):childarray(5,2,1)) |
---|
| 1268 | CASE (6) |
---|
[2715] | 1269 | child%var%parray6(childarray(1,1,2):childarray(1,2,2), |
---|
[1901] | 1270 | & childarray(2,1,2):childarray(2,2,2), |
---|
| 1271 | & childarray(3,1,2):childarray(3,2,2), |
---|
| 1272 | & childarray(4,1,2):childarray(4,2,2), |
---|
| 1273 | & childarray(5,1,2):childarray(5,2,2), |
---|
| 1274 | & childarray(6,1,2):childarray(6,2,2)) = |
---|
| 1275 | & tempC%var%array6(childarray(1,1,1):childarray(1,2,1), |
---|
| 1276 | & childarray(2,1,1):childarray(2,2,1), |
---|
| 1277 | & childarray(3,1,1):childarray(3,2,1), |
---|
| 1278 | & childarray(4,1,1):childarray(4,2,1), |
---|
| 1279 | & childarray(5,1,1):childarray(5,2,1), |
---|
| 1280 | & childarray(6,1,1):childarray(6,2,1)) |
---|
| 1281 | END SELECT |
---|
| 1282 | ENDIF |
---|
| 1283 | C |
---|
| 1284 | C |
---|
| 1285 | endif |
---|
| 1286 | |
---|
| 1287 | Call Agrif_nbdim_deallocation(tempPextend%var,nbdim) |
---|
| 1288 | C deallocate(tempPextend%var) |
---|
| 1289 | |
---|
| 1290 | Call Agrif_nbdim_deallocation(tempC%var,nbdim) |
---|
| 1291 | |
---|
| 1292 | C Deallocate(tempC % var) |
---|
| 1293 | ELSE |
---|
| 1294 | |
---|
| 1295 | C deallocate(tempPextend%var) |
---|
| 1296 | |
---|
| 1297 | ENDIF |
---|
| 1298 | C |
---|
| 1299 | C |
---|
| 1300 | C Deallocations |
---|
[2019] | 1301 | #ifdef key_mpp_mpi |
---|
[1901] | 1302 | IF (member) THEN |
---|
| 1303 | Call Agrif_nbdim_deallocation(tempP%var,nbdim) |
---|
| 1304 | C Deallocate(tempP % var) |
---|
| 1305 | endif |
---|
| 1306 | #endif |
---|
| 1307 | C |
---|
| 1308 | C |
---|
| 1309 | |
---|
| 1310 | C |
---|
| 1311 | C |
---|
| 1312 | End Subroutine Agrif_InterpnD |
---|
| 1313 | C |
---|
| 1314 | C |
---|
| 1315 | C |
---|
| 1316 | C |
---|
| 1317 | C |
---|
| 1318 | C ************************************************************************** |
---|
| 1319 | CCC Subroutine Agrif_Parentbounds |
---|
| 1320 | C ************************************************************************** |
---|
| 1321 | C |
---|
| 1322 | Subroutine Agrif_Parentbounds(TYPEinterp,nbdim,indmin,indmax, |
---|
| 1323 | & s_Parent_temp, |
---|
| 1324 | & s_Child_temp,s_Child,ds_Child, |
---|
| 1325 | & s_Parent,ds_Parent, |
---|
| 1326 | & pttruetab,cetruetab,pttab_Child, |
---|
| 1327 | & pttab_Parent,posvar,interptab) |
---|
| 1328 | C |
---|
| 1329 | CCC Description: |
---|
| 1330 | CCC Subroutine calculating the bounds of the parent grid for the interpolation |
---|
| 1331 | CCC of the child grid |
---|
| 1332 | C |
---|
| 1333 | C |
---|
| 1334 | C Declarations: |
---|
| 1335 | C |
---|
| 1336 | C |
---|
| 1337 | C Arguments |
---|
| 1338 | INTEGER :: nbdim |
---|
| 1339 | INTEGER, DIMENSION(6) :: TypeInterp |
---|
| 1340 | INTEGER,DIMENSION(nbdim) :: indmin,indmax |
---|
| 1341 | REAL,DIMENSION(nbdim) :: s_Parent_temp,s_child_temp |
---|
| 1342 | REAL,DIMENSION(nbdim) :: s_Child,ds_child |
---|
| 1343 | REAL,DIMENSION(nbdim) :: s_Parent,ds_Parent |
---|
| 1344 | INTEGER,DIMENSION(nbdim) :: pttruetab,cetruetab |
---|
| 1345 | INTEGER,DIMENSION(nbdim) :: pttab_Child,pttab_Parent |
---|
| 1346 | INTEGER,DIMENSION(nbdim) :: posvar |
---|
| 1347 | CHARACTER(6), DIMENSION(nbdim) :: interptab |
---|
| 1348 | C |
---|
| 1349 | C Local variables |
---|
| 1350 | INTEGER :: i |
---|
| 1351 | REAL,DIMENSION(nbdim) :: dim_newmin,dim_newmax |
---|
| 1352 | C |
---|
| 1353 | dim_newmin = s_Child + (pttruetab - pttab_Child) * ds_Child |
---|
| 1354 | dim_newmax = s_Child + (cetruetab - pttab_Child) * ds_Child |
---|
| 1355 | |
---|
| 1356 | DO i = 1,nbdim |
---|
| 1357 | C |
---|
| 1358 | indmin(i) = pttab_Parent(i) + |
---|
| 1359 | & agrif_int((dim_newmin(i)-s_Parent(i))/ds_Parent(i)) |
---|
| 1360 | C |
---|
| 1361 | indmax(i) = pttab_Parent(i) + |
---|
| 1362 | & agrif_ceiling((dim_newmax(i)- |
---|
| 1363 | & s_Parent(i))/ds_Parent(i)) |
---|
| 1364 | |
---|
| 1365 | C |
---|
| 1366 | C |
---|
| 1367 | C Necessary for the Quadratic interpolation |
---|
| 1368 | C |
---|
| 1369 | |
---|
| 1370 | IF ((pttruetab(i) == cetruetab(i)) .AND. |
---|
| 1371 | & (posvar(i) == 1)) THEN |
---|
| 1372 | ELSEIF (interptab(i) .EQ. 'N') THEN |
---|
| 1373 | ELSEIF ( TYPEinterp(i) .eq. Agrif_ppm .or. |
---|
| 1374 | & TYPEinterp(i) .eq. Agrif_eno .or. |
---|
| 1375 | & TYPEinterp(i) .eq. Agrif_weno) THEN |
---|
| 1376 | indmin(i) = indmin(i) - 2 |
---|
| 1377 | indmax(i) = indmax(i) + 2 |
---|
| 1378 | ELSE IF (( TYPEinterp(i) .ne. Agrif_constant ) |
---|
| 1379 | & .AND.( TYPEinterp(i) .ne. Agrif_linear )) THEN |
---|
| 1380 | indmin(i) = indmin(i) - 1 |
---|
| 1381 | indmax(i) = indmax(i) + 1 |
---|
| 1382 | ENDIF |
---|
| 1383 | |
---|
| 1384 | |
---|
| 1385 | C |
---|
| 1386 | ENDDO |
---|
| 1387 | C |
---|
| 1388 | s_Parent_temp = s_Parent + (indmin - pttab_Parent) * ds_Parent |
---|
| 1389 | C |
---|
| 1390 | s_Child_temp = s_Child + (pttruetab - pttab_Child) * ds_Child |
---|
| 1391 | C |
---|
| 1392 | C |
---|
| 1393 | Return |
---|
| 1394 | C |
---|
| 1395 | C |
---|
| 1396 | End Subroutine Agrif_Parentbounds |
---|
| 1397 | C |
---|
| 1398 | C |
---|
| 1399 | C |
---|
| 1400 | C ************************************************************************** |
---|
| 1401 | CCC Subroutine Agrif_Interp_1D_Recursive |
---|
| 1402 | C ************************************************************************** |
---|
| 1403 | C |
---|
| 1404 | Subroutine Agrif_Interp_1D_recursive(TypeInterp,tabin,tabout, |
---|
| 1405 | & indmin,indmax, |
---|
| 1406 | & pttab_child,petab_child, |
---|
| 1407 | & s_child,s_parent,ds_child,ds_parent,nbdim) |
---|
| 1408 | C |
---|
| 1409 | CCC Description: |
---|
| 1410 | CCC Subroutine for the interpolation of a 1D grid variable. |
---|
| 1411 | CCC It calls Agrif_InterpBase. |
---|
| 1412 | C |
---|
| 1413 | C Declarations: |
---|
| 1414 | C |
---|
| 1415 | |
---|
| 1416 | C |
---|
| 1417 | C Arguments |
---|
| 1418 | INTEGER :: nbdim |
---|
| 1419 | INTEGER,DIMENSION(1) :: TypeInterp |
---|
| 1420 | INTEGER, DIMENSION(nbdim) :: indmin,indmax |
---|
| 1421 | INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child |
---|
| 1422 | REAL, DIMENSION(nbdim) :: s_child,s_parent |
---|
| 1423 | REAL, DIMENSION(nbdim) :: ds_child,ds_parent |
---|
| 1424 | REAL, INTENT(IN),DIMENSION(indmin(nbdim):indmax(nbdim)) :: tabin |
---|
| 1425 | REAL, INTENT(OUT), |
---|
| 1426 | & DIMENSION(pttab_child(nbdim):petab_child(nbdim)) :: tabout |
---|
| 1427 | INTEGER :: coeffraf |
---|
| 1428 | C |
---|
| 1429 | C |
---|
| 1430 | C Commentaire perso : nbdim vaut toujours 1 ici. |
---|
| 1431 | C |
---|
| 1432 | coeffraf = nint(ds_parent(nbdim)/ds_child(nbdim)) |
---|
| 1433 | |
---|
| 1434 | Call Agrif_InterpBase(TypeInterp(1), |
---|
| 1435 | & tabin(indmin(nbdim):indmax(nbdim)), |
---|
| 1436 | & tabout(pttab_child(nbdim):petab_child(nbdim)), |
---|
| 1437 | & indmin(nbdim),indmax(nbdim), |
---|
| 1438 | & pttab_child(nbdim),petab_child(nbdim), |
---|
| 1439 | & s_parent(nbdim),s_child(nbdim), |
---|
| 1440 | & ds_parent(nbdim),ds_child(nbdim),coeffraf) |
---|
| 1441 | |
---|
| 1442 | C |
---|
| 1443 | Return |
---|
| 1444 | C |
---|
| 1445 | C |
---|
| 1446 | End Subroutine Agrif_Interp_1D_recursive |
---|
| 1447 | C |
---|
| 1448 | C |
---|
| 1449 | C |
---|
| 1450 | C ************************************************************************** |
---|
| 1451 | CCC Subroutine Agrif_Interp_2D_Recursive |
---|
| 1452 | C ************************************************************************** |
---|
| 1453 | C |
---|
| 1454 | Subroutine Agrif_Interp_2D_recursive(TypeInterp, |
---|
| 1455 | & tabin,tabout, |
---|
| 1456 | & indmin,indmax, |
---|
| 1457 | & pttab_child,petab_child, |
---|
| 1458 | & s_child, s_parent, |
---|
| 1459 | & ds_child,ds_parent, |
---|
| 1460 | & nbdim) |
---|
| 1461 | C |
---|
| 1462 | CCC Description: |
---|
| 1463 | CCC Subroutine for the interpolation of a 2D grid variable. |
---|
| 1464 | CCC It calls Agrif_Interp_1D_recursive and Agrif_InterpBase. |
---|
| 1465 | C |
---|
| 1466 | C Declarations: |
---|
| 1467 | C |
---|
| 1468 | |
---|
| 1469 | C |
---|
| 1470 | INTEGER :: nbdim |
---|
| 1471 | INTEGER,DIMENSION(2) :: TypeInterp |
---|
| 1472 | INTEGER, DIMENSION(nbdim) :: indmin,indmax |
---|
| 1473 | INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child |
---|
| 1474 | REAL , DIMENSION(nbdim) :: s_child, s_parent |
---|
| 1475 | REAL , DIMENSION(nbdim) :: ds_child,ds_parent |
---|
| 1476 | REAL ,INTENT(IN), DIMENSION( |
---|
| 1477 | & indmin(nbdim-1):indmax(nbdim-1), |
---|
| 1478 | & indmin(nbdim):indmax(nbdim) |
---|
| 1479 | & ) :: tabin |
---|
| 1480 | REAL ,INTENT(OUT), DIMENSION( |
---|
| 1481 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1482 | & pttab_child(nbdim):petab_child(nbdim) |
---|
| 1483 | & ) :: tabout |
---|
| 1484 | C |
---|
| 1485 | C Local variables |
---|
| 1486 | REAL, DIMENSION(pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1487 | & indmin(nbdim):indmax(nbdim)) :: tabtemp |
---|
| 1488 | INTEGER i,j |
---|
| 1489 | INTEGER :: coeffraf |
---|
| 1490 | REAL , DIMENSION( |
---|
| 1491 | & pttab_child(nbdim):petab_child(nbdim), |
---|
| 1492 | & pttab_child(nbdim-1):petab_child(nbdim-1) |
---|
| 1493 | & ) :: tabout_trsp |
---|
| 1494 | REAL, DIMENSION(indmin(nbdim):indmax(nbdim), |
---|
| 1495 | & pttab_child(nbdim-1):petab_child(nbdim-1)) :: tabtemp_trsp |
---|
| 1496 | |
---|
| 1497 | C |
---|
| 1498 | C |
---|
| 1499 | C |
---|
| 1500 | C |
---|
| 1501 | C Commentaire perso : nbdim vaut toujours 2 ici. |
---|
| 1502 | C |
---|
| 1503 | coeffraf = nint ( ds_parent(1) / ds_child(1) ) |
---|
| 1504 | IF((TypeInterp(1) == Agrif_Linear) .AND. (coeffraf /= 1 ) )THEN |
---|
| 1505 | |
---|
| 1506 | !---CDIR NEXPAND |
---|
| 1507 | IF(.NOT. precomputedone(1) ) call linear1Dprecompute2D( |
---|
| 1508 | & indmax(2)-indmin(2)+1, |
---|
| 1509 | & indmax(1)-indmin(1)+1, |
---|
| 1510 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1511 | & s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) |
---|
| 1512 | !---CDIR NEXPAND |
---|
| 1513 | call linear1daftercompute(tabin,tabtemp, |
---|
| 1514 | & size(tabin), size(tabtemp), |
---|
| 1515 | & s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) |
---|
| 1516 | |
---|
| 1517 | ELSEIF((TypeInterp(1) == Agrif_PPM) .AND. (coeffraf /= 1 ) )THEN |
---|
| 1518 | !---CDIR NEXPAND |
---|
| 1519 | IF(.NOT. precomputedone(1) ) call ppm1Dprecompute2D( |
---|
| 1520 | & indmax(2)-indmin(2)+1, |
---|
| 1521 | & indmax(1)-indmin(1)+1, |
---|
| 1522 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1523 | & s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) |
---|
| 1524 | !---CDIR NEXPAND |
---|
| 1525 | call ppm1daftercompute(tabin,tabtemp, |
---|
| 1526 | & size(tabin), size(tabtemp), |
---|
| 1527 | & s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) |
---|
| 1528 | |
---|
| 1529 | ELSE |
---|
| 1530 | |
---|
| 1531 | do j = indmin(nbdim),indmax(nbdim) |
---|
| 1532 | C |
---|
| 1533 | !---CDIR NEXPAND |
---|
| 1534 | Call Agrif_Interp_1D_recursive(TypeInterp(1), |
---|
| 1535 | & tabin(indmin(nbdim-1):indmax(nbdim-1),j), |
---|
| 1536 | & tabtemp(pttab_child(nbdim-1):petab_child(nbdim-1),j), |
---|
| 1537 | & indmin(1:nbdim-1),indmax(1:nbdim-1), |
---|
| 1538 | & pttab_child(1:nbdim-1),petab_child(1:nbdim-1), |
---|
| 1539 | & s_child(1:nbdim-1),s_parent(1:nbdim-1), |
---|
| 1540 | & ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1) |
---|
| 1541 | C |
---|
| 1542 | enddo |
---|
| 1543 | ENDIF |
---|
| 1544 | |
---|
| 1545 | coeffraf = nint(ds_parent(nbdim)/ds_child(nbdim)) |
---|
| 1546 | |
---|
| 1547 | tabtemp_trsp = TRANSPOSE(tabtemp) |
---|
| 1548 | |
---|
| 1549 | IF((TypeInterp(2) == Agrif_Linear) .AND. (coeffraf /= 1 ) )THEN |
---|
| 1550 | |
---|
| 1551 | !---CDIR NEXPAND |
---|
| 1552 | IF(.NOT. precomputedone(2) ) call linear1Dprecompute2D( |
---|
| 1553 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1554 | & indmax(2)-indmin(2)+1, |
---|
| 1555 | & petab_child(2)-pttab_child(2)+1, |
---|
| 1556 | & s_parent(2),s_child(2),ds_parent(2),ds_child(2),2) |
---|
| 1557 | !---CDIR NEXPAND |
---|
| 1558 | call linear1daftercompute(tabtemp_trsp,tabout_trsp, |
---|
| 1559 | & size(tabtemp_trsp), size(tabout_trsp), |
---|
| 1560 | & s_parent(2),s_child(2),ds_parent(2),ds_child(2),2) |
---|
| 1561 | |
---|
| 1562 | ELSEIF((TypeInterp(2) == Agrif_PPM) .AND. (coeffraf /= 1 ) )THEN |
---|
| 1563 | |
---|
| 1564 | !---CDIR NEXPAND |
---|
| 1565 | IF(.NOT. precomputedone(1) )call ppm1Dprecompute2D( |
---|
| 1566 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1567 | & indmax(2)-indmin(2)+1, |
---|
| 1568 | & petab_child(2)-pttab_child(2)+1, |
---|
| 1569 | & s_parent(2),s_child(2),ds_parent(2),ds_child(2),2) |
---|
| 1570 | !---CDIR NEXPAND |
---|
| 1571 | call ppm1daftercompute(tabtemp_trsp,tabout_trsp, |
---|
| 1572 | & size(tabtemp_trsp), size(tabout_trsp), |
---|
| 1573 | & s_parent(2),s_child(2),ds_parent(2),ds_child(2),2) |
---|
| 1574 | |
---|
| 1575 | ELSE |
---|
| 1576 | do i=pttab_child(nbdim-1),petab_child(nbdim-1) |
---|
| 1577 | C |
---|
| 1578 | !---CDIR NEXPAND |
---|
| 1579 | Call Agrif_InterpBase(TypeInterp(2), |
---|
| 1580 | & tabtemp_trsp(indmin(nbdim):indmax(nbdim),i), |
---|
| 1581 | & tabout_trsp(pttab_child(nbdim):petab_child(nbdim),i), |
---|
| 1582 | & indmin(nbdim),indmax(nbdim), |
---|
| 1583 | & pttab_child(nbdim),petab_child(nbdim), |
---|
| 1584 | & s_parent(nbdim),s_child(nbdim), |
---|
| 1585 | & ds_parent(nbdim),ds_child(nbdim),coeffraf) |
---|
| 1586 | |
---|
| 1587 | C |
---|
| 1588 | enddo |
---|
| 1589 | ENDIF |
---|
| 1590 | |
---|
| 1591 | tabout = TRANSPOSE(tabout_trsp) |
---|
| 1592 | C |
---|
| 1593 | Return |
---|
| 1594 | C |
---|
| 1595 | C |
---|
| 1596 | End Subroutine Agrif_Interp_2D_recursive |
---|
| 1597 | C |
---|
| 1598 | C |
---|
| 1599 | C |
---|
| 1600 | C ************************************************************************** |
---|
| 1601 | CCC Subroutine Agrif_Interp_3D_Recursive |
---|
| 1602 | C ************************************************************************** |
---|
| 1603 | C |
---|
| 1604 | Subroutine Agrif_Interp_3D_recursive(TypeInterp,tabin,tabout, |
---|
| 1605 | & indmin,indmax, |
---|
| 1606 | & pttab_child,petab_child, |
---|
| 1607 | & s_child,s_parent,ds_child,ds_parent,nbdim) |
---|
| 1608 | C |
---|
| 1609 | CCC Description: |
---|
| 1610 | CCC Subroutine for the interpolation of a 3D grid variable. |
---|
| 1611 | CCC It calls Agrif_Interp_2D_recursive and Agrif_InterpBase. |
---|
| 1612 | C |
---|
| 1613 | C Declarations: |
---|
| 1614 | C |
---|
| 1615 | |
---|
| 1616 | C |
---|
| 1617 | INTEGER :: nbdim |
---|
| 1618 | INTEGER,DIMENSION(3) :: TypeInterp |
---|
| 1619 | INTEGER, DIMENSION(nbdim) :: indmin,indmax |
---|
| 1620 | INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child |
---|
| 1621 | REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent |
---|
| 1622 | REAL,INTENT(IN), DIMENSION(indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1623 | & indmin(nbdim-1):indmax(nbdim-1), |
---|
| 1624 | & indmin(nbdim) :indmax(nbdim)) :: tabin |
---|
| 1625 | REAL,INTENT(OUT), |
---|
| 1626 | & DIMENSION(pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1627 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1628 | & pttab_child(nbdim):petab_child(nbdim)) :: tabout |
---|
| 1629 | C |
---|
| 1630 | C Local variables |
---|
| 1631 | REAL, DIMENSION(pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1632 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1633 | & indmin(nbdim):indmax(nbdim)) :: tabtemp |
---|
| 1634 | INTEGER i,j,k |
---|
| 1635 | INTEGER :: coeffraf, locind_child_left, kdeb |
---|
| 1636 | C |
---|
| 1637 | C |
---|
| 1638 | coeffraf = nint ( ds_parent(1) / ds_child(1) ) |
---|
| 1639 | IF((TypeInterp(1) == Agrif_Linear) .AND. (coeffraf/=1))THEN |
---|
| 1640 | Call linear1Dprecompute2D( |
---|
| 1641 | & indmax(2)-indmin(2)+1, |
---|
| 1642 | & indmax(1)-indmin(1)+1, |
---|
| 1643 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1644 | & s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) |
---|
| 1645 | precomputedone(1) = .TRUE. |
---|
| 1646 | ELSEIF((TypeInterp(1) == Agrif_PPM) .AND. (coeffraf/=1))THEN |
---|
| 1647 | Call ppm1Dprecompute2D( |
---|
| 1648 | & indmax(2)-indmin(2)+1, |
---|
| 1649 | & indmax(1)-indmin(1)+1, |
---|
| 1650 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1651 | & s_parent(1),s_child(1),ds_parent(1),ds_child(1),1) |
---|
| 1652 | precomputedone(1) = .TRUE. |
---|
| 1653 | ENDIF |
---|
| 1654 | |
---|
| 1655 | coeffraf = nint ( ds_parent(2) / ds_child(2) ) |
---|
| 1656 | IF((TypeInterp(2) == Agrif_Linear) .AND. (coeffraf/=1)) THEN |
---|
| 1657 | Call linear1Dprecompute2D( |
---|
| 1658 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1659 | & indmax(2)-indmin(2)+1, |
---|
| 1660 | & petab_child(2)-pttab_child(2)+1, |
---|
| 1661 | & s_parent(2),s_child(2),ds_parent(2),ds_child(2),2) |
---|
| 1662 | precomputedone(2) = .TRUE. |
---|
| 1663 | ELSEIF((TypeInterp(2) == Agrif_PPM) .AND. (coeffraf/=1)) THEN |
---|
| 1664 | Call ppm1Dprecompute2D( |
---|
| 1665 | & petab_child(1)-pttab_child(1)+1, |
---|
| 1666 | & indmax(2)-indmin(2)+1, |
---|
| 1667 | & petab_child(2)-pttab_child(2)+1, |
---|
| 1668 | & s_parent(2),s_child(2),ds_parent(2),ds_child(2),2) |
---|
| 1669 | precomputedone(2) = .TRUE. |
---|
| 1670 | ENDIF |
---|
| 1671 | |
---|
| 1672 | do k = indmin(nbdim),indmax(nbdim) |
---|
| 1673 | C |
---|
| 1674 | Call Agrif_Interp_2D_recursive(TypeInterp(1:2), |
---|
| 1675 | & tabin(indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1676 | & indmin(nbdim-1):indmax(nbdim-1),k), |
---|
| 1677 | & tabtemp(pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1678 | & pttab_child(nbdim-1):petab_child(nbdim-1),k), |
---|
| 1679 | & indmin(1:nbdim-1),indmax(1:nbdim-1), |
---|
| 1680 | & pttab_child(1:nbdim-1),petab_child(1:nbdim-1), |
---|
| 1681 | & s_child(1:nbdim-1),s_parent(1:nbdim-1), |
---|
| 1682 | & ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1) |
---|
| 1683 | C |
---|
| 1684 | enddo |
---|
| 1685 | |
---|
| 1686 | precomputedone(1) = .FALSE. |
---|
| 1687 | precomputedone(2) = .FALSE. |
---|
| 1688 | coeffraf = nint ( ds_parent(3) / ds_child(3) ) |
---|
| 1689 | |
---|
| 1690 | Call Agrif_Compute_nbdim_interp(s_parent(nbdim),s_child(nbdim), |
---|
| 1691 | & ds_parent(nbdim),ds_child(nbdim),coeffraf,locind_child_left) |
---|
| 1692 | |
---|
| 1693 | IF (coeffraf == 1) THEN |
---|
| 1694 | |
---|
| 1695 | kdeb = indmin(3)+locind_child_left-2 |
---|
| 1696 | do k=pttab_child(3),petab_child(3) |
---|
| 1697 | kdeb = kdeb + 1 |
---|
| 1698 | do j = pttab_child(2),petab_child(2) |
---|
| 1699 | do i = pttab_child(1),petab_child(1) |
---|
| 1700 | tabout(i,j,k) = tabtemp(i,j,kdeb) |
---|
| 1701 | enddo |
---|
| 1702 | enddo |
---|
| 1703 | enddo |
---|
| 1704 | |
---|
| 1705 | ELSE |
---|
| 1706 | C |
---|
| 1707 | do j=pttab_child(nbdim-1),petab_child(nbdim-1) |
---|
| 1708 | C |
---|
| 1709 | do i=pttab_child(nbdim-2),petab_child(nbdim-2) |
---|
| 1710 | C |
---|
| 1711 | Call Agrif_InterpBase(TypeInterp(3), |
---|
| 1712 | & tabtemp(i,j,indmin(nbdim):indmax(nbdim)), |
---|
| 1713 | & tabout(i,j,pttab_child(nbdim):petab_child(nbdim)), |
---|
| 1714 | & indmin(nbdim),indmax(nbdim), |
---|
| 1715 | & pttab_child(nbdim),petab_child(nbdim), |
---|
| 1716 | & s_parent(nbdim),s_child(nbdim), |
---|
| 1717 | & ds_parent(nbdim),ds_child(nbdim),coeffraf) |
---|
| 1718 | C |
---|
| 1719 | enddo |
---|
| 1720 | C |
---|
| 1721 | enddo |
---|
| 1722 | ENDIF |
---|
| 1723 | C |
---|
| 1724 | Return |
---|
| 1725 | C |
---|
| 1726 | C |
---|
| 1727 | End Subroutine Agrif_Interp_3D_recursive |
---|
| 1728 | C |
---|
| 1729 | C |
---|
| 1730 | C |
---|
| 1731 | C ************************************************************************** |
---|
| 1732 | CCC Subroutine Agrif_Interp_4D_Recursive |
---|
| 1733 | C ************************************************************************** |
---|
| 1734 | C |
---|
| 1735 | Subroutine Agrif_Interp_4D_recursive(TypeInterp,tabin,tabout, |
---|
| 1736 | & indmin,indmax, |
---|
| 1737 | & pttab_child,petab_child, |
---|
| 1738 | & s_child,s_parent,ds_child,ds_parent,nbdim) |
---|
| 1739 | C |
---|
| 1740 | CCC Description: |
---|
| 1741 | CCC Subroutine for the interpolation of a 4D grid variable. |
---|
| 1742 | CCC It calls Agrif_Interp_3D_recursive and Agrif_InterpBase. |
---|
| 1743 | C |
---|
| 1744 | C Declarations: |
---|
| 1745 | C |
---|
| 1746 | |
---|
| 1747 | C |
---|
| 1748 | INTEGER :: nbdim |
---|
| 1749 | INTEGER,DIMENSION(4) :: TypeInterp |
---|
| 1750 | INTEGER, DIMENSION(nbdim) :: indmin,indmax |
---|
| 1751 | INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child |
---|
| 1752 | REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent |
---|
| 1753 | REAL,INTENT(IN), DIMENSION(indmin(nbdim-3):indmax(nbdim-3), |
---|
| 1754 | & indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1755 | & indmin(nbdim-1):indmax(nbdim-1), |
---|
| 1756 | & indmin(nbdim):indmax(nbdim)) :: tabin |
---|
| 1757 | REAL,INTENT(OUT), |
---|
| 1758 | & DIMENSION(pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1759 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1760 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1761 | & pttab_child(nbdim):petab_child(nbdim)) :: tabout |
---|
| 1762 | C |
---|
| 1763 | C Local variables |
---|
| 1764 | REAL, DIMENSION(pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1765 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1766 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1767 | & indmin(nbdim):indmax(nbdim)) :: tabtemp |
---|
| 1768 | INTEGER i,j,k,l |
---|
| 1769 | INTEGER :: coeffraf |
---|
| 1770 | C |
---|
| 1771 | C |
---|
| 1772 | do l = indmin(nbdim),indmax(nbdim) |
---|
| 1773 | C |
---|
| 1774 | Call Agrif_Interp_3D_recursive(TypeInterp(1:3), |
---|
| 1775 | & tabin(indmin(nbdim-3):indmax(nbdim-3), |
---|
| 1776 | & indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1777 | & indmin(nbdim-1):indmax(nbdim-1),l), |
---|
| 1778 | & tabtemp(pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1779 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1780 | & pttab_child(nbdim-1):petab_child(nbdim-1),l), |
---|
| 1781 | & indmin(1:nbdim-1),indmax(1:nbdim-1), |
---|
| 1782 | & pttab_child(1:nbdim-1),petab_child(1:nbdim-1), |
---|
| 1783 | & s_child(1:nbdim-1),s_parent(1:nbdim-1), |
---|
| 1784 | & ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1) |
---|
| 1785 | C |
---|
| 1786 | enddo |
---|
| 1787 | C |
---|
| 1788 | coeffraf = nint(ds_parent(nbdim)/ds_child(nbdim)) |
---|
| 1789 | |
---|
| 1790 | do k = pttab_child(nbdim-1),petab_child(nbdim-1) |
---|
| 1791 | C |
---|
| 1792 | do j = pttab_child(nbdim-2),petab_child(nbdim-2) |
---|
| 1793 | C |
---|
| 1794 | do i = pttab_child(nbdim-3),petab_child(nbdim-3) |
---|
| 1795 | C |
---|
| 1796 | Call Agrif_InterpBase(TypeInterp(4), |
---|
| 1797 | & tabtemp(i,j,k,indmin(nbdim):indmax(nbdim)), |
---|
| 1798 | & tabout(i,j,k,pttab_child(nbdim):petab_child(nbdim)), |
---|
| 1799 | & indmin(nbdim),indmax(nbdim), |
---|
| 1800 | & pttab_child(nbdim),petab_child(nbdim), |
---|
| 1801 | & s_parent(nbdim),s_child(nbdim), |
---|
| 1802 | & ds_parent(nbdim),ds_child(nbdim),coeffraf) |
---|
| 1803 | C |
---|
| 1804 | enddo |
---|
| 1805 | C |
---|
| 1806 | enddo |
---|
| 1807 | C |
---|
| 1808 | enddo |
---|
| 1809 | C |
---|
| 1810 | Return |
---|
| 1811 | C |
---|
| 1812 | C |
---|
| 1813 | End Subroutine Agrif_Interp_4D_recursive |
---|
| 1814 | C |
---|
| 1815 | C |
---|
| 1816 | C |
---|
| 1817 | C ************************************************************************** |
---|
| 1818 | CCC Subroutine Agrif_Interp_5D_Recursive |
---|
| 1819 | C ************************************************************************** |
---|
| 1820 | C |
---|
| 1821 | Subroutine Agrif_Interp_5D_recursive(TypeInterp,tabin,tabout, |
---|
| 1822 | & indmin,indmax, |
---|
| 1823 | & pttab_child,petab_child, |
---|
| 1824 | & s_child,s_parent,ds_child,ds_parent,nbdim) |
---|
| 1825 | C |
---|
| 1826 | CCC Description: |
---|
| 1827 | CCC Subroutine for the interpolation of a 5D grid variable. |
---|
| 1828 | CCC It calls Agrif_Interp_4D_recursive and Agrif_InterpBase. |
---|
| 1829 | C |
---|
| 1830 | C Declarations: |
---|
| 1831 | C |
---|
| 1832 | |
---|
| 1833 | C |
---|
| 1834 | INTEGER :: nbdim |
---|
| 1835 | INTEGER,DIMENSION(5) :: TypeInterp |
---|
| 1836 | INTEGER, DIMENSION(nbdim) :: indmin,indmax |
---|
| 1837 | INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child |
---|
| 1838 | REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent |
---|
| 1839 | REAL,INTENT(IN), DIMENSION(indmin(nbdim-4):indmax(nbdim-4), |
---|
| 1840 | & indmin(nbdim-3):indmax(nbdim-3), |
---|
| 1841 | & indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1842 | & indmin(nbdim-1):indmax(nbdim-1), |
---|
| 1843 | & indmin(nbdim):indmax(nbdim)) :: tabin |
---|
| 1844 | REAL,INTENT(OUT), |
---|
| 1845 | & DIMENSION(pttab_child(nbdim-4):petab_child(nbdim-4), |
---|
| 1846 | & pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1847 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1848 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1849 | & pttab_child(nbdim):petab_child(nbdim)) :: tabout |
---|
| 1850 | C |
---|
| 1851 | C Local variables |
---|
| 1852 | REAL, DIMENSION(pttab_child(nbdim-4):petab_child(nbdim-4), |
---|
| 1853 | & pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1854 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1855 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1856 | & indmin(nbdim):indmax(nbdim)) :: tabtemp |
---|
| 1857 | INTEGER i,j,k,l,m |
---|
| 1858 | INTEGER :: coeffraf |
---|
| 1859 | C |
---|
| 1860 | C |
---|
| 1861 | do m = indmin(nbdim),indmax(nbdim) |
---|
| 1862 | C |
---|
| 1863 | Call Agrif_Interp_4D_recursive(TypeInterp(1:4), |
---|
| 1864 | & tabin(indmin(nbdim-4):indmax(nbdim-4), |
---|
| 1865 | & indmin(nbdim-3):indmax(nbdim-3), |
---|
| 1866 | & indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1867 | & indmin(nbdim-1):indmax(nbdim-1),m), |
---|
| 1868 | & tabtemp(pttab_child(nbdim-4):petab_child(nbdim-4), |
---|
| 1869 | & pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1870 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1871 | & pttab_child(nbdim-1):petab_child(nbdim-1),m), |
---|
| 1872 | & indmin(1:nbdim-1),indmax(1:nbdim-1), |
---|
| 1873 | & pttab_child(1:nbdim-1),petab_child(1:nbdim-1), |
---|
| 1874 | & s_child(1:nbdim-1),s_parent(1:nbdim-1), |
---|
| 1875 | & ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1) |
---|
| 1876 | C |
---|
| 1877 | enddo |
---|
| 1878 | |
---|
| 1879 | coeffraf = nint(ds_parent(nbdim)/ds_child(nbdim)) |
---|
| 1880 | C |
---|
| 1881 | do l = pttab_child(nbdim-1),petab_child(nbdim-1) |
---|
| 1882 | C |
---|
| 1883 | do k = pttab_child(nbdim-2),petab_child(nbdim-2) |
---|
| 1884 | C |
---|
| 1885 | do j = pttab_child(nbdim-3),petab_child(nbdim-3) |
---|
| 1886 | C |
---|
| 1887 | do i = pttab_child(nbdim-4),petab_child(nbdim-4) |
---|
| 1888 | C |
---|
| 1889 | Call Agrif_InterpBase(TypeInterp(5), |
---|
| 1890 | & tabtemp(i,j,k,l,indmin(nbdim):indmax(nbdim)), |
---|
| 1891 | & tabout(i,j,k,l, |
---|
| 1892 | & pttab_child(nbdim):petab_child(nbdim)), |
---|
| 1893 | & indmin(nbdim),indmax(nbdim), |
---|
| 1894 | & pttab_child(nbdim),petab_child(nbdim), |
---|
| 1895 | & s_parent(nbdim),s_child(nbdim), |
---|
| 1896 | & ds_parent(nbdim),ds_child(nbdim),coeffraf) |
---|
| 1897 | C |
---|
| 1898 | enddo |
---|
| 1899 | C |
---|
| 1900 | enddo |
---|
| 1901 | C |
---|
| 1902 | enddo |
---|
| 1903 | C |
---|
| 1904 | enddo |
---|
| 1905 | C |
---|
| 1906 | C |
---|
| 1907 | Return |
---|
| 1908 | C |
---|
| 1909 | C |
---|
| 1910 | End Subroutine Agrif_Interp_5D_recursive |
---|
| 1911 | C |
---|
| 1912 | C |
---|
| 1913 | C |
---|
| 1914 | C ************************************************************************** |
---|
| 1915 | CCC Subroutine Agrif_Interp_6D_Recursive |
---|
| 1916 | C ************************************************************************** |
---|
| 1917 | C |
---|
| 1918 | Subroutine Agrif_Interp_6D_recursive(TypeInterp,tabin,tabout, |
---|
| 1919 | & indmin,indmax, |
---|
| 1920 | & pttab_child,petab_child, |
---|
| 1921 | & s_child,s_parent,ds_child,ds_parent,nbdim) |
---|
| 1922 | C |
---|
| 1923 | CCC Description: |
---|
| 1924 | CCC Subroutine for the interpolation of a 6D grid variable. |
---|
| 1925 | CCC It calls Agrif_Interp_4D_recursive and Agrif_InterpBase. |
---|
| 1926 | C |
---|
| 1927 | C Declarations: |
---|
| 1928 | C |
---|
| 1929 | |
---|
| 1930 | C |
---|
| 1931 | INTEGER :: nbdim |
---|
| 1932 | INTEGER,DIMENSION(6) :: TypeInterp |
---|
| 1933 | INTEGER, DIMENSION(nbdim) :: indmin,indmax |
---|
| 1934 | INTEGER, DIMENSION(nbdim) :: pttab_child,petab_child |
---|
| 1935 | REAL, DIMENSION(nbdim) :: s_child,s_parent,ds_child,ds_parent |
---|
| 1936 | REAL,INTENT(IN), DIMENSION(indmin(nbdim-5):indmax(nbdim-5), |
---|
| 1937 | & indmin(nbdim-4):indmax(nbdim-4), |
---|
| 1938 | & indmin(nbdim-3):indmax(nbdim-3), |
---|
| 1939 | & indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1940 | & indmin(nbdim-1):indmax(nbdim-1), |
---|
| 1941 | & indmin(nbdim):indmax(nbdim)) :: tabin |
---|
| 1942 | REAL,INTENT(OUT), |
---|
| 1943 | & DIMENSION(pttab_child(nbdim-5):petab_child(nbdim-5), |
---|
| 1944 | & pttab_child(nbdim-4):petab_child(nbdim-4), |
---|
| 1945 | & pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1946 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1947 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1948 | & pttab_child(nbdim):petab_child(nbdim)) :: tabout |
---|
| 1949 | C |
---|
| 1950 | C Local variables |
---|
| 1951 | REAL, DIMENSION(pttab_child(nbdim-5):petab_child(nbdim-5), |
---|
| 1952 | & pttab_child(nbdim-4):petab_child(nbdim-4), |
---|
| 1953 | & pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1954 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1955 | & pttab_child(nbdim-1):petab_child(nbdim-1), |
---|
| 1956 | & indmin(nbdim):indmax(nbdim)) :: tabtemp |
---|
| 1957 | INTEGER i,j,k,l,m,n |
---|
| 1958 | INTEGER :: coeffraf |
---|
| 1959 | C |
---|
| 1960 | C |
---|
| 1961 | C |
---|
| 1962 | do n = indmin(nbdim),indmax(nbdim) |
---|
| 1963 | C |
---|
| 1964 | Call Agrif_Interp_5D_recursive(TypeInterp(1:5), |
---|
| 1965 | & tabin(indmin(nbdim-5):indmax(nbdim-5), |
---|
| 1966 | & indmin(nbdim-4):indmax(nbdim-4), |
---|
| 1967 | & indmin(nbdim-3):indmax(nbdim-3), |
---|
| 1968 | & indmin(nbdim-2):indmax(nbdim-2), |
---|
| 1969 | & indmin(nbdim-1):indmax(nbdim-1),n), |
---|
| 1970 | & tabtemp(pttab_child(nbdim-5):petab_child(nbdim-5), |
---|
| 1971 | & pttab_child(nbdim-4):petab_child(nbdim-4), |
---|
| 1972 | & pttab_child(nbdim-3):petab_child(nbdim-3), |
---|
| 1973 | & pttab_child(nbdim-2):petab_child(nbdim-2), |
---|
| 1974 | & pttab_child(nbdim-1):petab_child(nbdim-1),n), |
---|
| 1975 | & indmin(1:nbdim-1),indmax(1:nbdim-1), |
---|
| 1976 | & pttab_child(1:nbdim-1),petab_child(1:nbdim-1), |
---|
| 1977 | & s_child(1:nbdim-1),s_parent(1:nbdim-1), |
---|
| 1978 | & ds_child(1:nbdim-1),ds_parent(1:nbdim-1),nbdim-1) |
---|
| 1979 | C |
---|
| 1980 | enddo |
---|
| 1981 | |
---|
| 1982 | coeffraf = nint(ds_parent(nbdim)/ds_child(nbdim)) |
---|
| 1983 | C |
---|
| 1984 | do m = pttab_child(nbdim-1),petab_child(nbdim-1) |
---|
| 1985 | do l = pttab_child(nbdim-2),petab_child(nbdim-2) |
---|
| 1986 | C |
---|
| 1987 | do k = pttab_child(nbdim-3),petab_child(nbdim-3) |
---|
| 1988 | C |
---|
| 1989 | do j = pttab_child(nbdim-4),petab_child(nbdim-4) |
---|
| 1990 | C |
---|
| 1991 | do i = pttab_child(nbdim-5),petab_child(nbdim-5) |
---|
| 1992 | C |
---|
| 1993 | Call Agrif_InterpBase(TypeInterp(6), |
---|
| 1994 | & tabtemp(i,j,k,l,m,indmin(nbdim):indmax(nbdim)), |
---|
| 1995 | & tabout(i,j,k,l,m, |
---|
| 1996 | & pttab_child(nbdim):petab_child(nbdim)), |
---|
| 1997 | & indmin(nbdim),indmax(nbdim), |
---|
| 1998 | & pttab_child(nbdim),petab_child(nbdim), |
---|
| 1999 | & s_parent(nbdim),s_child(nbdim), |
---|
| 2000 | & ds_parent(nbdim),ds_child(nbdim),coeffraf) |
---|
| 2001 | C |
---|
| 2002 | enddo |
---|
| 2003 | C |
---|
| 2004 | enddo |
---|
| 2005 | C |
---|
| 2006 | enddo |
---|
| 2007 | C |
---|
| 2008 | enddo |
---|
| 2009 | enddo |
---|
| 2010 | C |
---|
| 2011 | C |
---|
| 2012 | Return |
---|
| 2013 | C |
---|
| 2014 | C |
---|
| 2015 | End Subroutine Agrif_Interp_6D_recursive |
---|
| 2016 | C |
---|
| 2017 | C |
---|
| 2018 | C |
---|
| 2019 | C ************************************************************************** |
---|
| 2020 | CCC Subroutine Agrif_InterpBase |
---|
| 2021 | C ************************************************************************** |
---|
| 2022 | C |
---|
| 2023 | Subroutine Agrif_InterpBase(TypeInterp, |
---|
| 2024 | & parenttab,childtab, |
---|
| 2025 | & indmin,indmax,pttab_child,petab_child, |
---|
| 2026 | & s_parent,s_child,ds_parent,ds_child, |
---|
| 2027 | & coeffraf) |
---|
| 2028 | C |
---|
| 2029 | CCC Description: |
---|
| 2030 | CCC Subroutine calling the interpolation method chosen by the user (linear, |
---|
| 2031 | CCC lagrange or spline). |
---|
| 2032 | C |
---|
| 2033 | C Declarations: |
---|
| 2034 | C |
---|
| 2035 | |
---|
| 2036 | C |
---|
| 2037 | INTEGER :: TypeInterp |
---|
| 2038 | INTEGER :: indmin,indmax |
---|
| 2039 | INTEGER :: pttab_child,petab_child |
---|
| 2040 | REAL,INTENT(IN),DIMENSION(indmin:indmax) :: parenttab |
---|
| 2041 | REAL,INTENT(OUT),DIMENSION(pttab_child:petab_child) :: childtab |
---|
| 2042 | REAL :: s_parent,s_child,ds_parent,ds_child |
---|
| 2043 | INTEGER :: coeffraf |
---|
| 2044 | C |
---|
| 2045 | C |
---|
| 2046 | IF ((indmin == indmax).AND.(pttab_child == petab_child)) THEN |
---|
| 2047 | childtab(pttab_child) = parenttab(indmin) |
---|
| 2048 | ELSEIF (TYPEinterp .EQ. AGRIF_LINEAR) then |
---|
| 2049 | C |
---|
| 2050 | C Linear interpolation |
---|
| 2051 | |
---|
| 2052 | Call linear1D |
---|
| 2053 | & (parenttab,childtab, |
---|
| 2054 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2055 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2056 | C |
---|
| 2057 | elseif ( TYPEinterp .EQ. AGRIF_PPM ) then |
---|
| 2058 | |
---|
| 2059 | Call ppm1D |
---|
| 2060 | & (parenttab,childtab, |
---|
| 2061 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2062 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2063 | C |
---|
| 2064 | |
---|
| 2065 | elseif (TYPEinterp .EQ. AGRIF_LAGRANGE) then |
---|
| 2066 | C |
---|
| 2067 | C Lagrange interpolation |
---|
| 2068 | Call lagrange1D |
---|
| 2069 | & (parenttab,childtab, |
---|
| 2070 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2071 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2072 | C |
---|
| 2073 | elseif (TYPEinterp .EQ. AGRIF_ENO) then |
---|
| 2074 | C |
---|
| 2075 | C Eno interpolation |
---|
| 2076 | Call eno1D |
---|
| 2077 | & (parenttab,childtab, |
---|
| 2078 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2079 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2080 | C |
---|
| 2081 | elseif (TYPEinterp .EQ. AGRIF_WENO) then |
---|
| 2082 | C |
---|
| 2083 | C Eno interpolation |
---|
| 2084 | Call weno1D |
---|
| 2085 | & (parenttab,childtab, |
---|
| 2086 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2087 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2088 | C |
---|
| 2089 | Else if (TYPEinterp .EQ. AGRIF_LINEARCONSERV) then |
---|
| 2090 | C |
---|
| 2091 | C Linear conservative interpolation |
---|
| 2092 | |
---|
| 2093 | Call linear1Dconserv |
---|
| 2094 | & (parenttab,childtab, |
---|
| 2095 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2096 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2097 | C |
---|
| 2098 | Else if (TYPEinterp .EQ. AGRIF_LINEARCONSERVLIM) then |
---|
| 2099 | C |
---|
| 2100 | C Linear conservative interpolation |
---|
| 2101 | |
---|
| 2102 | Call linear1Dconservlim |
---|
| 2103 | & (parenttab,childtab, |
---|
| 2104 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2105 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2106 | C |
---|
| 2107 | elseif (TYPEinterp .EQ. AGRIF_CONSTANT) then |
---|
| 2108 | C |
---|
| 2109 | Call constant1D |
---|
| 2110 | & (parenttab,childtab, |
---|
| 2111 | & indmax-indmin+1,petab_child-pttab_child+1, |
---|
| 2112 | & s_parent,s_child,ds_parent,ds_child) |
---|
| 2113 | C |
---|
| 2114 | endif |
---|
| 2115 | C |
---|
| 2116 | C |
---|
| 2117 | End Subroutine Agrif_InterpBase |
---|
| 2118 | C |
---|
| 2119 | |
---|
| 2120 | Subroutine Agrif_Compute_nbdim_interp(s_parent,s_child, |
---|
| 2121 | & ds_parent,ds_child,coeffraf,locind_child_left) |
---|
| 2122 | real :: s_parent,s_child,ds_parent,ds_child |
---|
| 2123 | integer :: coeffraf,locind_child_left |
---|
| 2124 | |
---|
| 2125 | coeffraf = nint(ds_parent/ds_child) |
---|
| 2126 | locind_child_left = 1 + agrif_int((s_child-s_parent)/ds_parent) |
---|
| 2127 | End Subroutine Agrif_Compute_nbdim_interp |
---|
| 2128 | C |
---|
| 2129 | |
---|
| 2130 | Subroutine Agrif_Find_list_interp(list_interp,pttab,petab, |
---|
| 2131 | & pttab_Child,pttab_Parent,nbdim, |
---|
| 2132 | & indmin,indmax,indminglob, |
---|
| 2133 | & indmaxglob,indminglob2,indmaxglob2,parentarray, |
---|
| 2134 | & pttruetab,cetruetab,member,memberin, |
---|
| 2135 | & find_list_interp |
---|
[2019] | 2136 | #if defined key_mpp_mpi |
---|
[1901] | 2137 | & ,tab4t,memberinall,sendtoproc1,recvfromproc1 |
---|
| 2138 | #endif |
---|
| 2139 | & ) |
---|
| 2140 | TYPE(Agrif_List_Interp_Loc), Pointer :: list_interp |
---|
| 2141 | INTEGER :: nbdim |
---|
| 2142 | INTEGER,DIMENSION(nbdim) :: pttab,petab,pttab_Child,pttab_Parent |
---|
| 2143 | LOGICAL :: find_list_interp |
---|
| 2144 | Type(Agrif_List_Interp_loc), Pointer :: parcours |
---|
| 2145 | INTEGER,DIMENSION(nbdim) :: indmin,indmax |
---|
| 2146 | INTEGER,DIMENSION(nbdim) :: indminglob,indmaxglob |
---|
| 2147 | INTEGER,DIMENSION(nbdim) :: pttruetab,cetruetab |
---|
| 2148 | INTEGER,DIMENSION(nbdim) :: indminglob2,indmaxglob2 |
---|
| 2149 | INTEGER,DIMENSION(nbdim,2,2) :: parentarray |
---|
| 2150 | LOGICAL :: member, memberin |
---|
| 2151 | INTEGER :: i |
---|
[2019] | 2152 | #ifdef key_mpp_mpi |
---|
[1901] | 2153 | C |
---|
| 2154 | INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1,8) :: tab4t |
---|
| 2155 | LOGICAL, DIMENSION(0:Agrif_Nbprocs-1) :: memberinall |
---|
| 2156 | LOGICAL, DIMENSION(0:Agrif_Nbprocs-1) :: sendtoproc1,recvfromproc1 |
---|
| 2157 | #endif |
---|
| 2158 | |
---|
| 2159 | find_list_interp = .FALSE. |
---|
| 2160 | |
---|
| 2161 | parcours => list_interp |
---|
| 2162 | Find_loop : Do While (associated(parcours)) |
---|
| 2163 | Do i=1,nbdim |
---|
| 2164 | IF ((pttab(i) /= parcours%interp_loc%pttab(i)).OR. |
---|
| 2165 | & (petab(i) /= parcours%interp_loc%petab(i)).OR. |
---|
| 2166 | & (pttab_child(i) /= parcours%interp_loc%pttab_child(i)).OR. |
---|
| 2167 | & (pttab_parent(i) /= parcours%interp_loc%pttab_parent(i))) |
---|
| 2168 | & THEN |
---|
| 2169 | parcours=>parcours%suiv |
---|
| 2170 | Cycle Find_loop |
---|
| 2171 | ENDIF |
---|
| 2172 | EndDo |
---|
| 2173 | |
---|
| 2174 | indmin = parcours%interp_loc%indmin(1:nbdim) |
---|
| 2175 | indmax = parcours%interp_loc%indmax(1:nbdim) |
---|
| 2176 | |
---|
| 2177 | pttruetab = parcours%interp_loc%pttruetab(1:nbdim) |
---|
| 2178 | cetruetab = parcours%interp_loc%cetruetab(1:nbdim) |
---|
| 2179 | |
---|
[2019] | 2180 | #if !defined key_mpp_mpi |
---|
[1901] | 2181 | indminglob = parcours%interp_loc%indminglob(1:nbdim) |
---|
| 2182 | indmaxglob = parcours%interp_loc%indmaxglob(1:nbdim) |
---|
| 2183 | #else |
---|
| 2184 | indminglob2 = parcours%interp_loc%indminglob2(1:nbdim) |
---|
| 2185 | indmaxglob2 = parcours%interp_loc%indmaxglob2(1:nbdim) |
---|
| 2186 | parentarray = parcours%interp_loc%parentarray(1:nbdim,:,:) |
---|
| 2187 | member = parcours%interp_loc%member |
---|
| 2188 | tab4t = parcours%interp_loc%tab4t(1:nbdim,0:Agrif_Nbprocs-1,1:8) |
---|
| 2189 | memberinall = parcours%interp_loc%memberinall(0:Agrif_Nbprocs-1) |
---|
| 2190 | sendtoproc1 = parcours%interp_loc%sendtoproc1(0:Agrif_Nbprocs-1) |
---|
| 2191 | recvfromproc1 = |
---|
| 2192 | & parcours%interp_loc%recvfromproc1(0:Agrif_Nbprocs-1) |
---|
| 2193 | #endif |
---|
| 2194 | memberin = parcours%interp_loc%memberin |
---|
| 2195 | find_list_interp = .TRUE. |
---|
| 2196 | Exit Find_loop |
---|
| 2197 | End Do Find_loop |
---|
| 2198 | |
---|
| 2199 | End Subroutine Agrif_Find_list_interp |
---|
| 2200 | |
---|
| 2201 | Subroutine Agrif_AddTo_list_interp(list_interp,pttab,petab, |
---|
| 2202 | & pttab_Child,pttab_Parent,indmin,indmax, |
---|
| 2203 | & indminglob,indmaxglob, |
---|
| 2204 | & indminglob2,indmaxglob2, |
---|
| 2205 | & parentarray,pttruetab,cetruetab, |
---|
| 2206 | & member,memberin,nbdim |
---|
[2019] | 2207 | #if defined key_mpp_mpi |
---|
[1901] | 2208 | & ,tab4t,memberinall,sendtoproc1,recvfromproc1 |
---|
| 2209 | #endif |
---|
| 2210 | & ) |
---|
| 2211 | |
---|
| 2212 | TYPE(Agrif_List_Interp_Loc), Pointer :: list_interp |
---|
| 2213 | INTEGER :: nbdim |
---|
| 2214 | INTEGER,DIMENSION(nbdim) :: pttab,petab,pttab_Child,pttab_Parent |
---|
| 2215 | INTEGER,DIMENSION(nbdim) :: indmin,indmax |
---|
| 2216 | INTEGER,DIMENSION(nbdim) :: indminglob,indmaxglob |
---|
| 2217 | INTEGER,DIMENSION(nbdim) :: indminglob2,indmaxglob2 |
---|
| 2218 | INTEGER,DIMENSION(nbdim) :: pttruetab,cetruetab |
---|
| 2219 | INTEGER,DIMENSION(nbdim,2,2) :: parentarray |
---|
| 2220 | LOGICAL :: member, memberin |
---|
[2019] | 2221 | #ifdef key_mpp_mpi |
---|
[1901] | 2222 | C |
---|
| 2223 | INTEGER,DIMENSION(nbdim,0:Agrif_Nbprocs-1,8) :: tab4t |
---|
| 2224 | LOGICAL,DIMENSION(0:Agrif_Nbprocs-1) :: memberinall |
---|
| 2225 | LOGICAL,DIMENSION(0:Agrif_Nbprocs-1) :: sendtoproc1 |
---|
| 2226 | LOGICAL,DIMENSION(0:Agrif_Nbprocs-1) :: recvfromproc1 |
---|
| 2227 | #endif |
---|
| 2228 | Type(Agrif_List_Interp_loc), Pointer :: parcours |
---|
| 2229 | |
---|
| 2230 | Allocate(parcours) |
---|
| 2231 | Allocate(parcours%interp_loc) |
---|
| 2232 | |
---|
| 2233 | parcours%interp_loc%pttab(1:nbdim) = pttab(1:nbdim) |
---|
| 2234 | parcours%interp_loc%petab(1:nbdim) = petab(1:nbdim) |
---|
| 2235 | parcours%interp_loc%pttab_child(1:nbdim) = pttab_child(1:nbdim) |
---|
| 2236 | parcours%interp_loc%pttab_parent(1:nbdim) = pttab_parent(1:nbdim) |
---|
| 2237 | |
---|
| 2238 | |
---|
| 2239 | parcours%interp_loc%indmin(1:nbdim) = indmin(1:nbdim) |
---|
| 2240 | parcours%interp_loc%indmax(1:nbdim) = indmax(1:nbdim) |
---|
| 2241 | |
---|
| 2242 | parcours%interp_loc%memberin = memberin |
---|
[2019] | 2243 | #if !defined key_mpp_mpi |
---|
[1901] | 2244 | parcours%interp_loc%indminglob(1:nbdim) = indminglob(1:nbdim) |
---|
| 2245 | parcours%interp_loc%indmaxglob(1:nbdim) = indmaxglob(1:nbdim) |
---|
| 2246 | #else |
---|
| 2247 | parcours%interp_loc%indminglob2(1:nbdim) = indminglob2(1:nbdim) |
---|
| 2248 | parcours%interp_loc%indmaxglob2(1:nbdim) = indmaxglob2(1:nbdim) |
---|
| 2249 | parcours%interp_loc%parentarray(1:nbdim,:,:) |
---|
| 2250 | & = parentarray(1:nbdim,:,:) |
---|
| 2251 | parcours%interp_loc%member = member |
---|
| 2252 | Allocate(parcours%interp_loc%tab4t(nbdim,0:Agrif_Nbprocs-1,8)) |
---|
| 2253 | Allocate(parcours%interp_loc%memberinall(0:Agrif_Nbprocs-1)) |
---|
| 2254 | Allocate(parcours%interp_loc%sendtoproc1(0:Agrif_Nbprocs-1)) |
---|
| 2255 | Allocate(parcours%interp_loc%recvfromproc1(0:Agrif_Nbprocs-1)) |
---|
| 2256 | parcours%interp_loc%tab4t=tab4t |
---|
| 2257 | parcours%interp_loc%memberinall=memberinall |
---|
| 2258 | parcours%interp_loc%sendtoproc1=sendtoproc1 |
---|
| 2259 | parcours%interp_loc%recvfromproc1=recvfromproc1 |
---|
| 2260 | #endif |
---|
| 2261 | |
---|
| 2262 | parcours%interp_loc%pttruetab(1:nbdim) = pttruetab(1:nbdim) |
---|
| 2263 | parcours%interp_loc%cetruetab(1:nbdim) = cetruetab(1:nbdim) |
---|
| 2264 | |
---|
| 2265 | parcours%suiv => list_interp |
---|
| 2266 | |
---|
| 2267 | list_interp => parcours |
---|
| 2268 | End Subroutine Agrif_Addto_list_interp |
---|
| 2269 | |
---|
| 2270 | End Module Agrif_Interpolation |
---|