[4777] | 1 | ! |
---|
| 2 | ! $Id$ |
---|
| 3 | ! |
---|
| 4 | ! AGRIF (Adaptive Grid Refinement In Fortran) |
---|
| 5 | ! |
---|
| 6 | ! Copyright (C) 2003 Laurent Debreu (Laurent.Debreu@imag.fr) |
---|
| 7 | ! Christophe Vouland (Christophe.Vouland@imag.fr) |
---|
| 8 | ! |
---|
| 9 | ! This program is free software; you can redistribute it and/or modify |
---|
| 10 | ! it under the terms of the GNU General Public License as published by |
---|
| 11 | ! the Free Software Foundation; either version 2 of the License, or |
---|
| 12 | ! (at your option) any later version. |
---|
| 13 | ! |
---|
| 14 | ! This program is distributed in the hope that it will be useful, |
---|
| 15 | ! but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | ! GNU General Public License for more details. |
---|
| 18 | ! |
---|
| 19 | ! You should have received a copy of the GNU General Public License |
---|
| 20 | ! along with this program; if not, write to the Free Software |
---|
| 21 | ! Foundation, Inc., 59 Temple Place- Suite 330, Boston, MA 02111-1307, USA. |
---|
| 22 | ! |
---|
| 23 | !> Module to define some procedures concerning the current grid |
---|
| 24 | ! |
---|
| 25 | module Agrif_CurgridFunctions |
---|
| 26 | ! |
---|
| 27 | use Agrif_Init |
---|
| 28 | ! |
---|
| 29 | implicit none |
---|
| 30 | ! |
---|
[10725] | 31 | |
---|
| 32 | interface Agrif_Parent |
---|
| 33 | module procedure Agrif_Parent_Real_4, & |
---|
| 34 | Agrif_Parent_Real_8, & |
---|
| 35 | Agrif_Parent_Array2_Real_8, & |
---|
| 36 | Agrif_Parent_Integer, & |
---|
| 37 | Agrif_Parent_Character, & |
---|
| 38 | Agrif_Parent_Logical |
---|
| 39 | end interface |
---|
| 40 | |
---|
[4777] | 41 | contains |
---|
| 42 | ! |
---|
| 43 | !=================================================================================================== |
---|
| 44 | ! function Agrif_rel_dt |
---|
| 45 | ! |
---|
| 46 | !> Returns the time step of the current grid, relatively to the root grid (for which dt=1.). |
---|
| 47 | !--------------------------------------------------------------------------------------------------- |
---|
| 48 | function Agrif_rel_dt ( ) result( rel_dt ) |
---|
| 49 | !--------------------------------------------------------------------------------------------------- |
---|
| 50 | integer :: i |
---|
| 51 | real :: rel_dt |
---|
| 52 | ! |
---|
| 53 | rel_dt = 1. |
---|
| 54 | ! |
---|
| 55 | do i = 1,Agrif_Probdim |
---|
| 56 | rel_dt = min(rel_dt, Agrif_Curgrid % Agrif_dt(i)) |
---|
| 57 | enddo |
---|
| 58 | !--------------------------------------------------------------------------------------------------- |
---|
| 59 | end function Agrif_rel_dt |
---|
| 60 | !=================================================================================================== |
---|
| 61 | ! |
---|
| 62 | !=================================================================================================== |
---|
| 63 | ! function Agrif_rel_idt |
---|
| 64 | ! |
---|
| 65 | !> Returns the time refinement factor of the current grid, relatively to the root grid (for which idt=1). |
---|
| 66 | !--------------------------------------------------------------------------------------------------- |
---|
| 67 | function Agrif_rel_idt ( ) result( rel_idt ) |
---|
| 68 | !--------------------------------------------------------------------------------------------------- |
---|
| 69 | integer :: rel_idt |
---|
| 70 | ! |
---|
| 71 | rel_idt = nint(1./Agrif_rel_dt()) |
---|
| 72 | !--------------------------------------------------------------------------------------------------- |
---|
| 73 | end function Agrif_rel_idt |
---|
| 74 | !=================================================================================================== |
---|
| 75 | ! |
---|
| 76 | !=================================================================================================== |
---|
| 77 | ! function Agrif_IRhot |
---|
| 78 | ! |
---|
| 79 | !> Returns the time refinement factor of the current grid. |
---|
| 80 | !--------------------------------------------------------------------------------------------------- |
---|
| 81 | function Agrif_IRhot ( ) result( irhot ) |
---|
| 82 | !--------------------------------------------------------------------------------------------------- |
---|
| 83 | integer :: i, irhot |
---|
| 84 | ! |
---|
| 85 | irhot = 1 |
---|
| 86 | ! |
---|
| 87 | do i = 1,Agrif_Probdim |
---|
| 88 | irhot = max(irhot, Agrif_Curgrid % timeref(i)) |
---|
| 89 | enddo |
---|
| 90 | !--------------------------------------------------------------------------------------------------- |
---|
| 91 | end function Agrif_IRhot |
---|
| 92 | !=================================================================================================== |
---|
| 93 | ! |
---|
| 94 | !=================================================================================================== |
---|
| 95 | ! function Agrif_Rhot |
---|
| 96 | ! |
---|
| 97 | !> Returns the time refinement factor of the current grid. |
---|
| 98 | !--------------------------------------------------------------------------------------------------- |
---|
| 99 | function Agrif_Rhot ( ) result( rhot ) |
---|
| 100 | !--------------------------------------------------------------------------------------------------- |
---|
| 101 | real :: rhot |
---|
| 102 | ! |
---|
| 103 | rhot = float(Agrif_IRhot()) |
---|
| 104 | !--------------------------------------------------------------------------------------------------- |
---|
| 105 | end function Agrif_Rhot |
---|
| 106 | !=================================================================================================== |
---|
| 107 | ! |
---|
| 108 | !=================================================================================================== |
---|
| 109 | ! function Agrif_Parent_IRhot |
---|
| 110 | ! |
---|
| 111 | !> Returns the time refinement factor of the parent of the current grid. |
---|
| 112 | !--------------------------------------------------------------------------------------------------- |
---|
| 113 | function Agrif_Parent_IRhot ( ) result( irhot ) |
---|
| 114 | !--------------------------------------------------------------------------------------------------- |
---|
| 115 | integer :: i, irhot |
---|
| 116 | ! |
---|
| 117 | irhot = 1 |
---|
| 118 | ! |
---|
| 119 | do i = 1,Agrif_Probdim |
---|
| 120 | irhot = max(irhot, Agrif_Curgrid % parent % timeref(i)) |
---|
| 121 | enddo |
---|
| 122 | !--------------------------------------------------------------------------------------------------- |
---|
| 123 | end function Agrif_Parent_IRhot |
---|
| 124 | !=================================================================================================== |
---|
| 125 | ! |
---|
| 126 | !=================================================================================================== |
---|
| 127 | ! function Agrif_Parent_Rhot |
---|
| 128 | ! |
---|
| 129 | !> Returns the time refinement factor of the parent of the current grid. |
---|
| 130 | !--------------------------------------------------------------------------------------------------- |
---|
| 131 | function Agrif_Parent_Rhot ( ) result( rhot ) |
---|
| 132 | !--------------------------------------------------------------------------------------------------- |
---|
| 133 | real :: rhot |
---|
| 134 | ! |
---|
| 135 | rhot = float(Agrif_Parent_IRhot()) |
---|
| 136 | !--------------------------------------------------------------------------------------------------- |
---|
| 137 | end function Agrif_Parent_Rhot |
---|
| 138 | !=================================================================================================== |
---|
| 139 | ! |
---|
| 140 | !=================================================================================================== |
---|
| 141 | ! function Agrif_Nbstepint |
---|
| 142 | ! |
---|
| 143 | !> function for the calculation of the coefficients used for the time interpolation |
---|
| 144 | !! (module #Agrif_Boundary). |
---|
| 145 | !--------------------------------------------------------------------------------------------------- |
---|
| 146 | function Agrif_Nbstepint ( ) |
---|
| 147 | !--------------------------------------------------------------------------------------------------- |
---|
| 148 | integer :: Agrif_nbstepint ! result |
---|
| 149 | ! |
---|
| 150 | Agrif_nbstepint = mod(Agrif_Curgrid % ngridstep, Agrif_iRhot()) |
---|
| 151 | !--------------------------------------------------------------------------------------------------- |
---|
| 152 | end function Agrif_Nbstepint |
---|
| 153 | !=================================================================================================== |
---|
| 154 | ! |
---|
| 155 | !=================================================================================================== |
---|
| 156 | ! function Agrif_Parent_Nbstepint |
---|
| 157 | ! |
---|
| 158 | !> function for the calculation of the coefficients used for the time interpolation |
---|
| 159 | !! (module #Agrif_Boundary). |
---|
| 160 | !--------------------------------------------------------------------------------------------------- |
---|
| 161 | function Agrif_Parent_Nbstepint ( ) |
---|
| 162 | !--------------------------------------------------------------------------------------------------- |
---|
| 163 | integer :: Agrif_Parent_Nbstepint ! result |
---|
| 164 | ! |
---|
| 165 | Agrif_Parent_Nbstepint = mod(Agrif_Curgrid % parent % ngridstep, int(Agrif_Parent_Rhot())) |
---|
| 166 | !--------------------------------------------------------------------------------------------------- |
---|
| 167 | end function Agrif_Parent_Nbstepint |
---|
| 168 | !=================================================================================================== |
---|
| 169 | ! |
---|
| 170 | !=================================================================================================== |
---|
| 171 | ! subroutine Agrif_InterpNearBorderX |
---|
| 172 | ! |
---|
| 173 | !> Allows to interpolate (in the x direction) on a near border of the current grid if this one |
---|
| 174 | !! has a common border with the root coarse grid. |
---|
| 175 | !--------------------------------------------------------------------------------------------------- |
---|
| 176 | subroutine Agrif_InterpNearBorderX ( ) |
---|
| 177 | !--------------------------------------------------------------------------------------------------- |
---|
| 178 | Agrif_Curgrid % NearRootBorder(1) = .FALSE. |
---|
| 179 | !--------------------------------------------------------------------------------------------------- |
---|
| 180 | end subroutine Agrif_InterpNearBorderX |
---|
| 181 | !=================================================================================================== |
---|
| 182 | ! |
---|
| 183 | !=================================================================================================== |
---|
| 184 | ! subroutine Agrif_InterpDistantBorderX |
---|
| 185 | ! |
---|
| 186 | !> Allows to interpolate (in the x direction) on a distant border of the current grid if this one |
---|
| 187 | !! has a common border with the root coarse grid. |
---|
| 188 | !--------------------------------------------------------------------------------------------------- |
---|
| 189 | subroutine Agrif_InterpDistantBorderX ( ) |
---|
| 190 | !--------------------------------------------------------------------------------------------------- |
---|
| 191 | Agrif_Curgrid % DistantRootBorder(1) = .FALSE. |
---|
| 192 | !--------------------------------------------------------------------------------------------------- |
---|
| 193 | end subroutine Agrif_InterpDistantBorderX |
---|
| 194 | !=================================================================================================== |
---|
| 195 | ! |
---|
| 196 | !=================================================================================================== |
---|
| 197 | ! subroutine Agrif_InterpNearBorderY |
---|
| 198 | ! |
---|
| 199 | !> Allows to interpolate (in the y direction) on a near border of the current grid if this one |
---|
| 200 | !! has a common border with the root coarse grid. |
---|
| 201 | !--------------------------------------------------------------------------------------------------- |
---|
| 202 | subroutine Agrif_InterpNearBorderY ( ) |
---|
| 203 | !--------------------------------------------------------------------------------------------------- |
---|
| 204 | Agrif_Curgrid % NearRootBorder(2) = .FALSE. |
---|
| 205 | !--------------------------------------------------------------------------------------------------- |
---|
| 206 | end subroutine Agrif_InterpNearBorderY |
---|
| 207 | !=================================================================================================== |
---|
| 208 | ! |
---|
| 209 | !=================================================================================================== |
---|
| 210 | ! subroutine Agrif_InterpDistantBorderY |
---|
| 211 | ! |
---|
| 212 | !> Allows to interpolate (in the y direction) on a distant border of the current grid if this one |
---|
| 213 | !! has a common border with the root coarse grid. |
---|
| 214 | !--------------------------------------------------------------------------------------------------- |
---|
| 215 | subroutine Agrif_InterpDistantBorderY ( ) |
---|
| 216 | !--------------------------------------------------------------------------------------------------- |
---|
| 217 | Agrif_Curgrid % DistantRootBorder(2) = .FALSE. |
---|
| 218 | !--------------------------------------------------------------------------------------------------- |
---|
| 219 | end subroutine Agrif_InterpDistantBorderY |
---|
| 220 | !=================================================================================================== |
---|
| 221 | ! |
---|
| 222 | !=================================================================================================== |
---|
| 223 | ! subroutine Agrif_InterpNearBorderZ |
---|
| 224 | ! |
---|
| 225 | !> Allows to interpolate (in the z direction) on a near border of the current grid if this one |
---|
| 226 | !! has a common border with the root coarse grid. |
---|
| 227 | !--------------------------------------------------------------------------------------------------- |
---|
| 228 | subroutine Agrif_InterpNearBorderZ ( ) |
---|
| 229 | !--------------------------------------------------------------------------------------------------- |
---|
| 230 | Agrif_Curgrid % NearRootBorder(3) = .FALSE. |
---|
| 231 | !--------------------------------------------------------------------------------------------------- |
---|
| 232 | end subroutine Agrif_InterpNearBorderZ |
---|
| 233 | !=================================================================================================== |
---|
| 234 | ! |
---|
| 235 | !=================================================================================================== |
---|
| 236 | ! subroutine Agrif_InterpDistantBorderZ |
---|
| 237 | ! |
---|
| 238 | !> Allows to interpolate (in the z direction) on a distant border of the current grid if this one |
---|
| 239 | !! has a common border with the root coarse grid. |
---|
| 240 | !--------------------------------------------------------------------------------------------------- |
---|
| 241 | subroutine Agrif_InterpDistantBorderZ() |
---|
| 242 | !--------------------------------------------------------------------------------------------------- |
---|
| 243 | Agrif_Curgrid % DistantRootBorder(3) = .FALSE. |
---|
| 244 | !--------------------------------------------------------------------------------------------------- |
---|
| 245 | end subroutine Agrif_InterpDistantBorderZ |
---|
| 246 | !=================================================================================================== |
---|
| 247 | ! |
---|
| 248 | !=================================================================================================== |
---|
| 249 | ! function Agrif_Parent_Nb_Step |
---|
| 250 | ! |
---|
| 251 | !> Returns the number of time steps of the parent of the current grid. |
---|
| 252 | !--------------------------------------------------------------------------------------------------- |
---|
| 253 | function Agrif_Parent_Nb_Step ( ) |
---|
| 254 | !--------------------------------------------------------------------------------------------------- |
---|
| 255 | integer :: Agrif_Parent_Nb_Step ! Result |
---|
| 256 | ! |
---|
| 257 | if (Agrif_Root()) then |
---|
| 258 | Agrif_Parent_Nb_Step = -1 |
---|
| 259 | else |
---|
| 260 | Agrif_Parent_Nb_Step = Agrif_Curgrid % parent % ngridstep |
---|
| 261 | endif |
---|
| 262 | !--------------------------------------------------------------------------------------------------- |
---|
| 263 | end function Agrif_Parent_Nb_Step |
---|
| 264 | !=================================================================================================== |
---|
| 265 | ! |
---|
| 266 | !=================================================================================================== |
---|
| 267 | ! function Agrif_Root |
---|
| 268 | ! |
---|
| 269 | !> Indicates if the current grid is or not the root grid. |
---|
| 270 | !--------------------------------------------------------------------------------------------------- |
---|
| 271 | function Agrif_Root ( ) |
---|
| 272 | !--------------------------------------------------------------------------------------------------- |
---|
| 273 | logical :: Agrif_Root ! Result |
---|
| 274 | ! |
---|
| 275 | Agrif_Root = (Agrif_Curgrid % fixedrank == 0) |
---|
| 276 | !--------------------------------------------------------------------------------------------------- |
---|
| 277 | end function Agrif_Root |
---|
| 278 | !=================================================================================================== |
---|
| 279 | ! |
---|
| 280 | !=================================================================================================== |
---|
| 281 | ! function Agrif_GrandMother |
---|
| 282 | ! |
---|
| 283 | !> Indicates if the current grid is or not the root grid. |
---|
| 284 | !--------------------------------------------------------------------------------------------------- |
---|
| 285 | function Agrif_GrandMother ( ) |
---|
| 286 | !--------------------------------------------------------------------------------------------------- |
---|
| 287 | logical :: Agrif_GrandMother ! Result |
---|
| 288 | ! |
---|
| 289 | Agrif_GrandMother = Agrif_Curgrid % grand_mother_grid |
---|
| 290 | !--------------------------------------------------------------------------------------------------- |
---|
| 291 | end function Agrif_GrandMother |
---|
| 292 | !=================================================================================================== |
---|
| 293 | ! |
---|
| 294 | !=================================================================================================== |
---|
| 295 | ! function Agrif_Parent_Root |
---|
| 296 | ! |
---|
| 297 | !> Indicates if the parent of the current grid is or not the root grid. |
---|
| 298 | !--------------------------------------------------------------------------------------------------- |
---|
| 299 | function Agrif_Parent_Root ( ) |
---|
| 300 | !--------------------------------------------------------------------------------------------------- |
---|
| 301 | logical :: Agrif_Parent_Root ! Result |
---|
| 302 | ! |
---|
| 303 | Agrif_Parent_Root = (Agrif_Curgrid % parent % fixedrank == 0) |
---|
| 304 | !--------------------------------------------------------------------------------------------------- |
---|
| 305 | end function Agrif_Parent_Root |
---|
| 306 | !=================================================================================================== |
---|
| 307 | ! |
---|
| 308 | !=================================================================================================== |
---|
| 309 | ! function Agrif_Fixed |
---|
| 310 | ! |
---|
| 311 | !> Returns the number of the current grid. |
---|
| 312 | !--------------------------------------------------------------------------------------------------- |
---|
| 313 | function Agrif_Fixed ( ) |
---|
| 314 | !--------------------------------------------------------------------------------------------------- |
---|
| 315 | integer :: Agrif_Fixed ! Result |
---|
| 316 | ! |
---|
| 317 | if (Agrif_Curgrid % fixed) then |
---|
| 318 | Agrif_Fixed = Agrif_Curgrid % fixedrank |
---|
| 319 | else |
---|
| 320 | Agrif_Fixed = -1 |
---|
| 321 | endif |
---|
| 322 | !--------------------------------------------------------------------------------------------------- |
---|
| 323 | end function Agrif_Fixed |
---|
| 324 | !=================================================================================================== |
---|
| 325 | ! |
---|
| 326 | !=================================================================================================== |
---|
| 327 | ! function Agrif_Parent_Fixed |
---|
| 328 | ! |
---|
| 329 | !> Returns the number of the parent of the current grid. |
---|
| 330 | !--------------------------------------------------------------------------------------------------- |
---|
| 331 | function Agrif_Parent_Fixed ( ) |
---|
| 332 | !--------------------------------------------------------------------------------------------------- |
---|
| 333 | integer :: Agrif_Parent_Fixed ! Result |
---|
| 334 | ! |
---|
| 335 | if (Agrif_Curgrid % parent % fixed) then |
---|
| 336 | Agrif_Parent_Fixed = Agrif_Curgrid % parent % fixedrank |
---|
| 337 | else |
---|
| 338 | Agrif_Parent_Fixed = 0 |
---|
| 339 | endif |
---|
| 340 | !--------------------------------------------------------------------------------------------------- |
---|
| 341 | end function Agrif_Parent_Fixed |
---|
| 342 | !=================================================================================================== |
---|
| 343 | ! |
---|
| 344 | !=================================================================================================== |
---|
| 345 | ! function Agrif_Is_Fixed |
---|
| 346 | ! |
---|
| 347 | !> Returns .TRUE. if the current grid is fixed. |
---|
| 348 | !--------------------------------------------------------------------------------------------------- |
---|
| 349 | function Agrif_Is_Fixed ( ) |
---|
| 350 | !--------------------------------------------------------------------------------------------------- |
---|
| 351 | logical :: Agrif_Is_Fixed ! Result |
---|
| 352 | ! |
---|
| 353 | Agrif_Is_Fixed = Agrif_Curgrid % fixed |
---|
| 354 | !--------------------------------------------------------------------------------------------------- |
---|
| 355 | end function Agrif_Is_Fixed |
---|
| 356 | !=================================================================================================== |
---|
| 357 | ! |
---|
| 358 | !=================================================================================================== |
---|
| 359 | ! function Agrif_Parent_Is_Fixed |
---|
| 360 | ! |
---|
| 361 | !> Returns .TRUE. if the parent of the current grid is fixed. |
---|
| 362 | !--------------------------------------------------------------------------------------------------- |
---|
| 363 | function Agrif_Parent_Is_Fixed ( ) |
---|
| 364 | !--------------------------------------------------------------------------------------------------- |
---|
| 365 | logical :: Agrif_Parent_Is_Fixed ! Result |
---|
| 366 | ! |
---|
| 367 | Agrif_Parent_Is_Fixed = Agrif_Curgrid % parent % fixed |
---|
| 368 | !--------------------------------------------------------------------------------------------------- |
---|
| 369 | end function Agrif_Parent_Is_Fixed |
---|
| 370 | !=================================================================================================== |
---|
| 371 | ! |
---|
| 372 | !=================================================================================================== |
---|
| 373 | ! function Agrif_CFixed |
---|
| 374 | ! |
---|
| 375 | !> Returns the number of the current grid. |
---|
| 376 | !--------------------------------------------------------------------------------------------------- |
---|
| 377 | function Agrif_CFixed ( ) |
---|
| 378 | !--------------------------------------------------------------------------------------------------- |
---|
| 379 | character(3) :: Agrif_CFixed ! Result |
---|
| 380 | ! |
---|
| 381 | character(3) :: cfixed |
---|
| 382 | integer :: fixed |
---|
| 383 | ! |
---|
| 384 | fixed = Agrif_Fixed() |
---|
| 385 | ! |
---|
| 386 | if (fixed /= -1) then |
---|
| 387 | ! |
---|
| 388 | if (fixed <= 9) then |
---|
| 389 | write(cfixed,'(i1)') fixed |
---|
| 390 | else |
---|
| 391 | write(cfixed,'(i2)') fixed |
---|
| 392 | endif |
---|
| 393 | ! |
---|
| 394 | Agrif_CFixed = cfixed |
---|
| 395 | |
---|
| 396 | if (associated(agrif_curgrid,agrif_coarsegrid)) then |
---|
| 397 | Agrif_CFixed = 'gm' |
---|
| 398 | endif |
---|
| 399 | ! |
---|
| 400 | else |
---|
| 401 | print*,'Call to Agrif_CFixed() on a moving grid' |
---|
| 402 | stop |
---|
| 403 | endif |
---|
| 404 | !--------------------------------------------------------------------------------------------------- |
---|
| 405 | end function Agrif_CFixed |
---|
| 406 | !=================================================================================================== |
---|
| 407 | ! |
---|
| 408 | !=================================================================================================== |
---|
| 409 | ! function Agrid_Parent_CFixed |
---|
| 410 | ! |
---|
| 411 | !> Returns the number of the parent of the current grid. |
---|
| 412 | !--------------------------------------------------------------------------------------------------- |
---|
| 413 | function Agrid_Parent_CFixed ( ) |
---|
| 414 | !--------------------------------------------------------------------------------------------------- |
---|
| 415 | character(3) :: Agrid_Parent_CFixed ! Result |
---|
| 416 | ! |
---|
| 417 | character(3) :: cfixed |
---|
| 418 | integer :: fixed |
---|
| 419 | ! |
---|
| 420 | fixed = Agrif_Parent_Fixed() |
---|
| 421 | ! |
---|
| 422 | if(fixed /= -1) then |
---|
| 423 | ! |
---|
| 424 | if (fixed <= 9) then |
---|
| 425 | write(cfixed,'(i1)')fixed |
---|
| 426 | else |
---|
| 427 | write(cfixed,'(i2)')fixed |
---|
| 428 | endif |
---|
| 429 | ! |
---|
| 430 | Agrid_Parent_CFixed=cfixed |
---|
| 431 | ! |
---|
| 432 | else |
---|
| 433 | print*,'Illegal call to Agrid_Parent_CFixed()' |
---|
| 434 | stop |
---|
| 435 | endif |
---|
| 436 | !--------------------------------------------------------------------------------------------------- |
---|
| 437 | end function Agrid_Parent_CFixed |
---|
| 438 | !=================================================================================================== |
---|
| 439 | ! |
---|
| 440 | !=================================================================================================== |
---|
| 441 | ! subroutine Agrif_ChildGrid_to_ParentGrid |
---|
| 442 | ! |
---|
| 443 | !> Make the pointer #Agrif_Curgrid point on the parent grid of the current grid. |
---|
| 444 | !--------------------------------------------------------------------------------------------------- |
---|
| 445 | subroutine Agrif_ChildGrid_to_ParentGrid ( ) |
---|
| 446 | !--------------------------------------------------------------------------------------------------- |
---|
| 447 | Agrif_Curgrid % parent % save_grid => Agrif_Curgrid |
---|
| 448 | call Agrif_Instance(Agrif_Curgrid%parent) |
---|
| 449 | !--------------------------------------------------------------------------------------------------- |
---|
| 450 | end subroutine Agrif_ChildGrid_to_ParentGrid |
---|
| 451 | !=================================================================================================== |
---|
| 452 | ! |
---|
| 453 | !=================================================================================================== |
---|
| 454 | ! subroutine Agrif_ParentGrid_to_ChildGrid |
---|
| 455 | ! |
---|
| 456 | !> Make the pointer #Agrif_Curgrid point on the child grid after having called the |
---|
| 457 | !! #Agrif_ChildGrid_to_ParentGrid subroutine. |
---|
| 458 | !--------------------------------------------------------------------------------------------------- |
---|
| 459 | subroutine Agrif_ParentGrid_to_ChildGrid ( ) |
---|
| 460 | !--------------------------------------------------------------------------------------------------- |
---|
| 461 | call Agrif_Instance(Agrif_Curgrid%save_grid) |
---|
| 462 | !--------------------------------------------------------------------------------------------------- |
---|
| 463 | end subroutine Agrif_ParentGrid_to_ChildGrid |
---|
| 464 | !=================================================================================================== |
---|
| 465 | ! |
---|
| 466 | !=================================================================================================== |
---|
| 467 | ! function Agrif_Get_Unit |
---|
| 468 | ! |
---|
| 469 | !> Returns a unit not connected to any file. |
---|
| 470 | !--------------------------------------------------------------------------------------------------- |
---|
| 471 | function Agrif_Get_Unit ( ) |
---|
| 472 | !--------------------------------------------------------------------------------------------------- |
---|
| 473 | integer :: Agrif_Get_Unit ! Result |
---|
| 474 | ! |
---|
| 475 | integer :: n |
---|
| 476 | logical :: op |
---|
| 477 | ! |
---|
| 478 | integer :: nunit |
---|
| 479 | integer :: iii, out, iiimax |
---|
| 480 | logical :: bexist |
---|
| 481 | integer,dimension(1:1000) :: forbiddenunit |
---|
| 482 | ! |
---|
| 483 | ! Load forbidden Unit if the file Agrif_forbidenUnit exist |
---|
| 484 | ! |
---|
| 485 | INQUIRE(file='Agrif_forbiddenUnit.txt', exist=bexist) |
---|
| 486 | ! |
---|
| 487 | if (.not. bexist) then |
---|
| 488 | ! File Agrif_forbiddenUnit.txt not found |
---|
| 489 | else |
---|
| 490 | nunit = 777 |
---|
| 491 | OPEN(nunit,file='Agrif_forbiddenUnit.txt', form='formatted', status="old") |
---|
| 492 | iii = 1 |
---|
| 493 | do while ( .TRUE. ) |
---|
| 494 | READ(nunit,*, end=99) forbiddenunit(iii) |
---|
| 495 | iii = iii + 1 |
---|
| 496 | enddo |
---|
| 497 | 99 continue |
---|
| 498 | iiimax = iii |
---|
| 499 | close(nunit) |
---|
| 500 | endif |
---|
| 501 | ! |
---|
| 502 | do n = 7,1000 |
---|
| 503 | ! |
---|
| 504 | INQUIRE(Unit=n,Opened=op) |
---|
| 505 | ! |
---|
| 506 | out = 0 |
---|
| 507 | if ( bexist .AND. (.NOT.op) ) then |
---|
| 508 | do iii = 1,iiimax |
---|
| 509 | if ( n == forbiddenunit(iii) ) out = 1 |
---|
| 510 | enddo |
---|
| 511 | endif |
---|
| 512 | ! |
---|
| 513 | if ( (.NOT.op) .AND. (out == 0) ) exit |
---|
| 514 | ! |
---|
| 515 | enddo |
---|
| 516 | ! |
---|
| 517 | Agrif_Get_Unit = n |
---|
| 518 | !--------------------------------------------------------------------------------------------------- |
---|
| 519 | end function Agrif_Get_Unit |
---|
| 520 | !=================================================================================================== |
---|
| 521 | ! |
---|
| 522 | !=================================================================================================== |
---|
| 523 | ! subroutine Agrif_Set_Extra_Boundary_Cells |
---|
| 524 | !--------------------------------------------------------------------------------------------------- |
---|
| 525 | subroutine Agrif_Set_Extra_Boundary_Cells ( nb_extra_cells ) |
---|
| 526 | !--------------------------------------------------------------------------------------------------- |
---|
| 527 | integer, intent(in) :: nb_extra_cells |
---|
| 528 | ! |
---|
| 529 | Agrif_Extra_Boundary_Cells = nb_extra_cells |
---|
| 530 | !--------------------------------------------------------------------------------------------------- |
---|
| 531 | end subroutine Agrif_Set_Extra_Boundary_Cells |
---|
| 532 | !=================================================================================================== |
---|
| 533 | ! |
---|
| 534 | !=================================================================================================== |
---|
| 535 | ! subroutine Agrif_Set_Efficiency |
---|
| 536 | !--------------------------------------------------------------------------------------------------- |
---|
| 537 | subroutine Agrif_Set_Efficiency ( eff ) |
---|
| 538 | !--------------------------------------------------------------------------------------------------- |
---|
| 539 | real, intent(in) :: eff |
---|
| 540 | ! |
---|
| 541 | if ( (eff < 0.) .OR. (eff > 1) ) then |
---|
| 542 | write(*,*) 'Error Efficiency should be between 0 and 1' |
---|
| 543 | stop |
---|
| 544 | else |
---|
| 545 | Agrif_Efficiency = eff |
---|
| 546 | endif |
---|
| 547 | !--------------------------------------------------------------------------------------------------- |
---|
| 548 | end subroutine Agrif_Set_Efficiency |
---|
| 549 | !=================================================================================================== |
---|
| 550 | ! |
---|
| 551 | !=================================================================================================== |
---|
| 552 | ! subroutine Agrif_Set_Regridding |
---|
| 553 | !--------------------------------------------------------------------------------------------------- |
---|
| 554 | subroutine Agrif_Set_Regridding ( regfreq ) |
---|
| 555 | !--------------------------------------------------------------------------------------------------- |
---|
| 556 | integer, intent(in) :: regfreq |
---|
| 557 | ! |
---|
| 558 | if (regfreq < 0) then |
---|
| 559 | write(*,*) 'Regridding frequency should be positive' |
---|
| 560 | stop |
---|
| 561 | else |
---|
| 562 | Agrif_Regridding = regfreq |
---|
| 563 | endif |
---|
| 564 | !--------------------------------------------------------------------------------------------------- |
---|
| 565 | end subroutine Agrif_Set_Regridding |
---|
| 566 | !=================================================================================================== |
---|
| 567 | ! |
---|
| 568 | !=================================================================================================== |
---|
| 569 | ! subroutine Agrif_Set_coeffref_x |
---|
| 570 | !--------------------------------------------------------------------------------------------------- |
---|
| 571 | subroutine Agrif_Set_coeffref_x ( coeffref ) |
---|
| 572 | !--------------------------------------------------------------------------------------------------- |
---|
| 573 | integer, intent(in) :: coeffref |
---|
| 574 | |
---|
| 575 | if (coeffref < 0) then |
---|
| 576 | write(*,*) 'Coefficient of raffinement should be positive' |
---|
| 577 | stop |
---|
| 578 | else |
---|
| 579 | Agrif_coeffref(1) = coeffref |
---|
| 580 | endif |
---|
| 581 | !--------------------------------------------------------------------------------------------------- |
---|
| 582 | end subroutine Agrif_Set_coeffref_x |
---|
| 583 | !=================================================================================================== |
---|
| 584 | ! |
---|
| 585 | !=================================================================================================== |
---|
| 586 | ! subroutine Agrif_Set_coeffref_y |
---|
| 587 | !--------------------------------------------------------------------------------------------------- |
---|
| 588 | subroutine Agrif_Set_coeffref_y ( coeffref ) |
---|
| 589 | !--------------------------------------------------------------------------------------------------- |
---|
| 590 | integer, intent(in) :: coeffref |
---|
| 591 | |
---|
| 592 | if (coeffref < 0) then |
---|
| 593 | write(*,*) 'Coefficient of raffinement should be positive' |
---|
| 594 | stop |
---|
| 595 | else |
---|
| 596 | Agrif_coeffref(2) = coeffref |
---|
| 597 | endif |
---|
| 598 | !--------------------------------------------------------------------------------------------------- |
---|
| 599 | end subroutine Agrif_Set_coeffref_y |
---|
| 600 | !=================================================================================================== |
---|
| 601 | ! |
---|
| 602 | !=================================================================================================== |
---|
| 603 | ! subroutine Agrif_Set_coeffref_z |
---|
| 604 | !--------------------------------------------------------------------------------------------------- |
---|
| 605 | subroutine Agrif_Set_coeffref_z ( coeffref ) |
---|
| 606 | !--------------------------------------------------------------------------------------------------- |
---|
| 607 | integer, intent(in) :: coeffref |
---|
| 608 | ! |
---|
| 609 | if (coeffref < 0) then |
---|
| 610 | write(*,*) 'Coefficient of raffinement should be positive' |
---|
| 611 | stop |
---|
| 612 | else |
---|
| 613 | Agrif_coeffref(3) = coeffref |
---|
| 614 | endif |
---|
| 615 | !--------------------------------------------------------------------------------------------------- |
---|
| 616 | end subroutine Agrif_Set_coeffref_z |
---|
| 617 | !=================================================================================================== |
---|
| 618 | ! |
---|
| 619 | !=================================================================================================== |
---|
| 620 | ! subroutine Agrif_Set_coeffreft_x |
---|
| 621 | !--------------------------------------------------------------------------------------------------- |
---|
| 622 | subroutine Agrif_Set_coeffreft_x ( coeffref ) |
---|
| 623 | !--------------------------------------------------------------------------------------------------- |
---|
| 624 | integer, intent(in) :: coeffref |
---|
| 625 | |
---|
| 626 | if (coeffref < 0) then |
---|
| 627 | write(*,*) 'Coefficient of time raffinement should be positive' |
---|
| 628 | stop |
---|
| 629 | else |
---|
| 630 | Agrif_coeffreft(1) = coeffref |
---|
| 631 | endif |
---|
| 632 | !--------------------------------------------------------------------------------------------------- |
---|
| 633 | end subroutine Agrif_Set_coeffreft_x |
---|
| 634 | !=================================================================================================== |
---|
| 635 | ! |
---|
| 636 | !=================================================================================================== |
---|
| 637 | ! subroutine Agrif_Set_coeffreft_y |
---|
| 638 | !--------------------------------------------------------------------------------------------------- |
---|
| 639 | subroutine Agrif_Set_coeffreft_y ( coeffref ) |
---|
| 640 | !--------------------------------------------------------------------------------------------------- |
---|
| 641 | integer, intent(in) :: coeffref |
---|
| 642 | ! |
---|
| 643 | if (coeffref < 0) then |
---|
| 644 | write(*,*) 'Coefficient of time raffinement should be positive' |
---|
| 645 | stop |
---|
| 646 | else |
---|
| 647 | Agrif_coeffreft(2) = coeffref |
---|
| 648 | endif |
---|
| 649 | !--------------------------------------------------------------------------------------------------- |
---|
| 650 | end subroutine Agrif_Set_coeffreft_y |
---|
| 651 | !=================================================================================================== |
---|
| 652 | ! |
---|
| 653 | !=================================================================================================== |
---|
| 654 | ! subroutine Agrif_Set_coeffreft_z |
---|
| 655 | !--------------------------------------------------------------------------------------------------- |
---|
| 656 | subroutine Agrif_Set_coeffreft_z ( coeffref ) |
---|
| 657 | !--------------------------------------------------------------------------------------------------- |
---|
| 658 | integer, intent(in) :: coeffref |
---|
| 659 | |
---|
| 660 | if (coeffref < 0) then |
---|
| 661 | write(*,*)'Coefficient of time raffinement should be positive' |
---|
| 662 | stop |
---|
| 663 | else |
---|
| 664 | Agrif_coeffreft(3) = coeffref |
---|
| 665 | endif |
---|
| 666 | !--------------------------------------------------------------------------------------------------- |
---|
| 667 | end subroutine Agrif_Set_coeffreft_z |
---|
| 668 | !=================================================================================================== |
---|
| 669 | ! |
---|
| 670 | !=================================================================================================== |
---|
| 671 | ! subroutine Agrif_Set_Minwidth |
---|
| 672 | !--------------------------------------------------------------------------------------------------- |
---|
| 673 | subroutine Agrif_Set_Minwidth ( coefminwidth ) |
---|
| 674 | !--------------------------------------------------------------------------------------------------- |
---|
| 675 | integer, intent(in) :: coefminwidth |
---|
| 676 | ! |
---|
| 677 | if (coefminwidth < 0) then |
---|
| 678 | write(*,*)'Coefficient of Minwidth should be positive' |
---|
| 679 | stop |
---|
| 680 | else |
---|
| 681 | Agrif_Minwidth = coefminwidth |
---|
| 682 | endif |
---|
| 683 | !--------------------------------------------------------------------------------------------------- |
---|
| 684 | end subroutine Agrif_Set_Minwidth |
---|
| 685 | !=================================================================================================== |
---|
| 686 | ! |
---|
| 687 | !=================================================================================================== |
---|
| 688 | ! subroutine Agrif_Set_Rafmax |
---|
| 689 | !--------------------------------------------------------------------------------------------------- |
---|
| 690 | subroutine Agrif_Set_Rafmax ( coefrafmax ) |
---|
| 691 | !--------------------------------------------------------------------------------------------------- |
---|
| 692 | integer, intent(in) :: coefrafmax |
---|
| 693 | ! |
---|
| 694 | integer :: i |
---|
| 695 | real :: res |
---|
| 696 | ! |
---|
| 697 | if (coefrafmax < 0) then |
---|
| 698 | write(*,*)'Coefficient of should be positive' |
---|
| 699 | stop |
---|
| 700 | else |
---|
| 701 | res = 1. |
---|
| 702 | do i = 1,coefrafmax-1 |
---|
| 703 | res = res * FLOAT(Agrif_coeffref(1)) |
---|
| 704 | enddo |
---|
| 705 | if ( res == 0 ) res = 1 |
---|
| 706 | Agrif_Mind(1) = 1. / res |
---|
| 707 | ! |
---|
| 708 | res = 1. |
---|
| 709 | do i = 1,coefrafmax-1 |
---|
| 710 | res = res * FLOAT(Agrif_coeffref(2)) |
---|
| 711 | enddo |
---|
| 712 | if ( res == 0 ) res = 1 |
---|
| 713 | Agrif_Mind(2) = 1. / res |
---|
| 714 | ! |
---|
| 715 | res = 1. |
---|
| 716 | do i = 1,coefrafmax-1 |
---|
| 717 | res = res * FLOAT(Agrif_coeffref(3)) |
---|
| 718 | enddo |
---|
| 719 | if ( res == 0 ) res = 1 |
---|
| 720 | Agrif_Mind(3) = 1. / res |
---|
| 721 | ! |
---|
| 722 | endif |
---|
| 723 | !--------------------------------------------------------------------------------------------------- |
---|
| 724 | end subroutine Agrif_Set_Rafmax |
---|
| 725 | !=================================================================================================== |
---|
| 726 | ! |
---|
| 727 | !=================================================================================================== |
---|
| 728 | ! subroutine Agrif_Set_MaskMaxSearch |
---|
| 729 | !--------------------------------------------------------------------------------------------------- |
---|
| 730 | subroutine Agrif_Set_MaskMaxSearch ( mymaxsearch ) |
---|
| 731 | !--------------------------------------------------------------------------------------------------- |
---|
| 732 | integer, intent(in) :: mymaxsearch |
---|
| 733 | ! |
---|
| 734 | MaxSearch = mymaxsearch |
---|
| 735 | !--------------------------------------------------------------------------------------------------- |
---|
| 736 | end subroutine Agrif_Set_MaskMaxSearch |
---|
| 737 | !=================================================================================================== |
---|
| 738 | ! |
---|
| 739 | !=================================================================================================== |
---|
| 740 | ! function Agrif_Level |
---|
| 741 | !--------------------------------------------------------------------------------------------------- |
---|
| 742 | function Agrif_Level ( ) |
---|
| 743 | !--------------------------------------------------------------------------------------------------- |
---|
| 744 | integer :: Agrif_Level ! Result |
---|
| 745 | ! |
---|
| 746 | Agrif_Level = Agrif_Curgrid % level |
---|
| 747 | !--------------------------------------------------------------------------------------------------- |
---|
| 748 | end function Agrif_Level |
---|
| 749 | !=================================================================================================== |
---|
| 750 | ! |
---|
| 751 | !=================================================================================================== |
---|
| 752 | ! function Agrif_MaxLevel |
---|
| 753 | !--------------------------------------------------------------------------------------------------- |
---|
| 754 | function Agrif_MaxLevel ( ) |
---|
| 755 | !--------------------------------------------------------------------------------------------------- |
---|
| 756 | integer :: Agrif_MaxLevel ! Result |
---|
| 757 | ! |
---|
| 758 | Agrif_MaxLevel = Agrif_MaxLevelLoc |
---|
| 759 | !--------------------------------------------------------------------------------------------------- |
---|
| 760 | end function Agrif_MaxLevel |
---|
| 761 | !=================================================================================================== |
---|
| 762 | ! |
---|
| 763 | !=================================================================================================== |
---|
| 764 | ! function Agrif_GridAllocation_is_done |
---|
| 765 | !--------------------------------------------------------------------------------------------------- |
---|
| 766 | function Agrif_GridAllocation_is_done ( ) result(isdone) |
---|
| 767 | !--------------------------------------------------------------------------------------------------- |
---|
| 768 | logical :: isdone |
---|
| 769 | ! |
---|
| 770 | isdone = Agrif_Curgrid % allocation_is_done |
---|
| 771 | !--------------------------------------------------------------------------------------------------- |
---|
| 772 | end function Agrif_GridAllocation_is_done |
---|
| 773 | !=================================================================================================== |
---|
| 774 | ! |
---|
[10725] | 775 | |
---|
| 776 | function Agrif_Parent_Real_4(real_variable) result(real_variable_parent) |
---|
| 777 | real(KIND=4) :: real_variable |
---|
| 778 | real(KIND=4) :: real_variable_parent |
---|
| 779 | |
---|
| 780 | integer :: i |
---|
| 781 | logical :: i_found |
---|
| 782 | |
---|
| 783 | i_found = .FALSE. |
---|
| 784 | |
---|
| 785 | do i=1,Agrif_NbVariables(2) |
---|
| 786 | if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%array0)) then |
---|
| 787 | real_variable_parent = agrif_curgrid%tabvars_r(i)%parent_var%array0 |
---|
| 788 | i_found = .TRUE. |
---|
| 789 | EXIT |
---|
| 790 | endif |
---|
| 791 | enddo |
---|
| 792 | |
---|
| 793 | IF (.NOT.i_found) THEN |
---|
| 794 | do i=1,Agrif_NbVariables(2) |
---|
| 795 | if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%sarray0)) then |
---|
| 796 | real_variable_parent = agrif_curgrid%tabvars_r(i)%parent_var%sarray0 |
---|
| 797 | i_found = .TRUE. |
---|
| 798 | EXIT |
---|
| 799 | endif |
---|
| 800 | enddo |
---|
| 801 | ENDIF |
---|
| 802 | |
---|
| 803 | if (.NOT.i_found) STOP 'Agrif_Parent_Real_4 : Variable not found' |
---|
| 804 | |
---|
| 805 | end function Agrif_Parent_Real_4 |
---|
| 806 | |
---|
| 807 | function Agrif_Parent_Real_8(real_variable) result(real_variable_parent) |
---|
| 808 | real(KIND=8) :: real_variable |
---|
| 809 | real(KIND=8) :: real_variable_parent |
---|
| 810 | |
---|
| 811 | integer :: i |
---|
| 812 | logical :: i_found |
---|
| 813 | |
---|
| 814 | i_found = .FALSE. |
---|
| 815 | |
---|
| 816 | do i=1,Agrif_NbVariables(2) |
---|
| 817 | if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%array0)) then |
---|
| 818 | real_variable_parent = agrif_curgrid%tabvars_r(i)%parent_var%array0 |
---|
| 819 | i_found = .TRUE. |
---|
| 820 | EXIT |
---|
| 821 | endif |
---|
| 822 | enddo |
---|
| 823 | |
---|
| 824 | IF (.NOT.i_found) THEN |
---|
| 825 | do i=1,Agrif_NbVariables(2) |
---|
| 826 | if (LOC(real_variable) == LOC(agrif_curgrid%tabvars_r(i)%darray0)) then |
---|
| 827 | real_variable_parent = agrif_curgrid%tabvars_r(i)%parent_var%darray0 |
---|
| 828 | i_found = .TRUE. |
---|
| 829 | EXIT |
---|
| 830 | endif |
---|
| 831 | enddo |
---|
| 832 | ENDIF |
---|
| 833 | |
---|
| 834 | if (.NOT.i_found) STOP 'Agrif_Parent_Real_8 : Variable not found' |
---|
| 835 | |
---|
| 836 | end function Agrif_Parent_Real_8 |
---|
| 837 | |
---|
| 838 | function Agrif_Parent_Array2_Real_8(real_variable,ji,jj) result(real_variable_parent) |
---|
| 839 | real(KIND=8), DIMENSION(:,:) :: real_variable |
---|
| 840 | real(KIND=8) :: real_variable_parent |
---|
| 841 | integer :: ji,jj |
---|
| 842 | |
---|
| 843 | integer :: i |
---|
| 844 | logical :: i_found |
---|
| 845 | |
---|
| 846 | i_found = .FALSE. |
---|
| 847 | |
---|
| 848 | do i=1,Agrif_NbVariables(0) |
---|
| 849 | if (LOC(real_variable) == LOC(agrif_curgrid%tabvars(i)%array2)) then |
---|
| 850 | real_variable_parent = agrif_curgrid%tabvars(i)%parent_var%array2(ji,jj) |
---|
| 851 | i_found = .TRUE. |
---|
| 852 | EXIT |
---|
| 853 | endif |
---|
| 854 | enddo |
---|
| 855 | |
---|
| 856 | if (.NOT.i_found) STOP 'Agrif_Parent_Array2_Real_8 : Variable not found' |
---|
| 857 | |
---|
| 858 | end function Agrif_Parent_Array2_Real_8 |
---|
| 859 | |
---|
| 860 | |
---|
| 861 | function Agrif_Parent_Integer(integer_variable) result(integer_variable_parent) |
---|
| 862 | integer :: integer_variable |
---|
| 863 | integer :: integer_variable_parent |
---|
| 864 | |
---|
| 865 | integer :: i |
---|
| 866 | logical :: i_found |
---|
| 867 | |
---|
| 868 | i_found = .FALSE. |
---|
| 869 | |
---|
| 870 | do i=1,Agrif_NbVariables(4) |
---|
| 871 | if (LOC(integer_variable) == LOC(agrif_curgrid%tabvars_i(i)%iarray0)) then |
---|
| 872 | integer_variable_parent = agrif_curgrid%tabvars_i(i)%parent_var%iarray0 |
---|
| 873 | i_found = .TRUE. |
---|
| 874 | EXIT |
---|
| 875 | endif |
---|
| 876 | enddo |
---|
| 877 | |
---|
| 878 | if (.NOT.i_found) STOP 'Agrif_Parent : Variable not found' |
---|
| 879 | |
---|
| 880 | end function Agrif_Parent_Integer |
---|
| 881 | |
---|
| 882 | function Agrif_Parent_Character(character_variable) result(character_variable_parent) |
---|
| 883 | character(*) :: character_variable |
---|
| 884 | character(len(character_variable)) :: character_variable_parent |
---|
| 885 | |
---|
| 886 | integer :: i |
---|
| 887 | logical :: i_found |
---|
| 888 | |
---|
| 889 | i_found = .FALSE. |
---|
| 890 | |
---|
| 891 | do i=1,Agrif_NbVariables(1) |
---|
| 892 | if (LOC(character_variable) == LOC(agrif_curgrid%tabvars_c(i)%carray0)) then |
---|
| 893 | character_variable_parent = agrif_curgrid%tabvars_c(i)%parent_var%carray0 |
---|
| 894 | i_found = .TRUE. |
---|
| 895 | EXIT |
---|
| 896 | endif |
---|
| 897 | enddo |
---|
| 898 | |
---|
| 899 | if (.NOT.i_found) STOP 'Agrif_Parent : Variable not found' |
---|
| 900 | |
---|
| 901 | end function Agrif_Parent_Character |
---|
| 902 | |
---|
| 903 | function Agrif_Parent_Logical(logical_variable) result(logical_variable_parent) |
---|
| 904 | logical :: logical_variable |
---|
| 905 | logical :: logical_variable_parent |
---|
| 906 | |
---|
| 907 | integer :: i |
---|
| 908 | logical :: i_found |
---|
| 909 | |
---|
| 910 | i_found = .FALSE. |
---|
| 911 | |
---|
| 912 | do i=1,Agrif_NbVariables(3) |
---|
| 913 | if (LOC(logical_variable) == LOC(agrif_curgrid%tabvars_l(i)%larray0)) then |
---|
| 914 | logical_variable_parent = agrif_curgrid%tabvars_l(i)%parent_var%larray0 |
---|
| 915 | i_found = .TRUE. |
---|
| 916 | EXIT |
---|
| 917 | endif |
---|
| 918 | enddo |
---|
| 919 | |
---|
| 920 | if (.NOT.i_found) STOP 'Agrif_Parent : Variable not found' |
---|
| 921 | |
---|
| 922 | end function Agrif_Parent_Logical |
---|
| 923 | |
---|
| 924 | function Agrif_Irhox() result(i_val) |
---|
| 925 | integer :: i_val |
---|
| 926 | i_val = agrif_curgrid%spaceref(1) |
---|
| 927 | end function Agrif_Irhox |
---|
| 928 | |
---|
| 929 | function Agrif_Irhoy() result(i_val) |
---|
| 930 | integer :: i_val |
---|
| 931 | i_val = agrif_curgrid%spaceref(2) |
---|
| 932 | end function Agrif_Irhoy |
---|
| 933 | |
---|
| 934 | function Agrif_Irhoz() result(i_val) |
---|
| 935 | integer :: i_val |
---|
| 936 | i_val = agrif_curgrid%spaceref(3) |
---|
| 937 | end function Agrif_Irhoz |
---|
| 938 | |
---|
| 939 | function Agrif_NearCommonBorderX() result(l_val) |
---|
| 940 | logical :: l_val |
---|
| 941 | l_val = agrif_curgrid%nearRootBorder(1) |
---|
| 942 | end function Agrif_NearCommonBorderX |
---|
| 943 | |
---|
| 944 | function Agrif_NearCommonBorderY() result(l_val) |
---|
| 945 | logical :: l_val |
---|
| 946 | l_val = agrif_curgrid%nearRootBorder(2) |
---|
| 947 | end function Agrif_NearCommonBorderY |
---|
| 948 | |
---|
| 949 | function Agrif_NearCommonBorderZ() result(l_val) |
---|
| 950 | logical :: l_val |
---|
| 951 | l_val = agrif_curgrid%nearRootBorder(3) |
---|
| 952 | end function Agrif_NearCommonBorderZ |
---|
| 953 | |
---|
| 954 | function Agrif_DistantCommonBorderX() result(l_val) |
---|
| 955 | logical :: l_val |
---|
| 956 | l_val = agrif_curgrid%DistantRootBorder(1) |
---|
| 957 | end function Agrif_DistantCommonBorderX |
---|
| 958 | |
---|
| 959 | function Agrif_DistantCommonBorderY() result(l_val) |
---|
| 960 | logical :: l_val |
---|
| 961 | l_val = agrif_curgrid%DistantRootBorder(2) |
---|
| 962 | end function Agrif_DistantCommonBorderY |
---|
| 963 | |
---|
| 964 | function Agrif_DistantCommonBorderZ() result(l_val) |
---|
| 965 | logical :: l_val |
---|
| 966 | l_val = agrif_curgrid%DistantRootBorder(3) |
---|
| 967 | end function Agrif_DistantCommonBorderZ |
---|
| 968 | |
---|
| 969 | function Agrif_Ix() result(i_val) |
---|
| 970 | integer :: i_val |
---|
| 971 | i_val = agrif_curgrid%ix(1) |
---|
| 972 | end function Agrif_Ix |
---|
| 973 | |
---|
| 974 | function Agrif_Iy() result(i_val) |
---|
| 975 | integer :: i_val |
---|
| 976 | i_val = agrif_curgrid%ix(2) |
---|
| 977 | end function Agrif_Iy |
---|
| 978 | |
---|
| 979 | function Agrif_Iz() result(i_val) |
---|
| 980 | integer :: i_val |
---|
| 981 | i_val = agrif_curgrid%ix(3) |
---|
| 982 | end function Agrif_Iz |
---|
| 983 | |
---|
| 984 | function Agrif_Get_grid_id() result(i_val) |
---|
| 985 | integer :: i_val |
---|
| 986 | i_val = agrif_curgrid % grid_id |
---|
| 987 | end function Agrif_Get_grid_id |
---|
| 988 | |
---|
| 989 | function Agrif_Get_parent_id() result(i_val) |
---|
| 990 | integer :: i_val |
---|
| 991 | i_val = agrif_curgrid % parent % grid_id |
---|
| 992 | end function Agrif_Get_parent_id |
---|
| 993 | |
---|
| 994 | function Agrif_rhox() result(r_val) |
---|
| 995 | real :: r_val |
---|
| 996 | r_val = real(agrif_curgrid%spaceref(1)) |
---|
| 997 | end function Agrif_rhox |
---|
| 998 | |
---|
| 999 | function Agrif_rhoy() result(r_val) |
---|
| 1000 | real :: r_val |
---|
| 1001 | r_val = real(agrif_curgrid%spaceref(2)) |
---|
| 1002 | end function Agrif_rhoy |
---|
| 1003 | |
---|
| 1004 | function Agrif_rhoz() result(r_val) |
---|
| 1005 | real :: r_val |
---|
| 1006 | r_val = real(agrif_curgrid%spaceref(3)) |
---|
| 1007 | end function Agrif_rhoz |
---|
| 1008 | |
---|
| 1009 | function Agrif_Nb_Step() result(i_val) |
---|
| 1010 | integer :: i_val |
---|
| 1011 | i_val = agrif_curgrid%ngridstep |
---|
| 1012 | end function Agrif_Nb_Step |
---|
| 1013 | |
---|
| 1014 | function Agrif_Nb_Fine_Grids() result(i_val) |
---|
| 1015 | integer :: i_val |
---|
| 1016 | i_val = Agrif_nbfixedgrids |
---|
| 1017 | end function Agrif_Nb_Fine_Grids |
---|
| 1018 | |
---|
[4777] | 1019 | end module Agrif_CurgridFunctions |
---|