modinitvars.F90 4.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. !
  2. ! $Id: modinitvars.F90 4779 2014-09-19 14:21:37Z rblod $
  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. !
  24. !> Module Agrif_Init_Vars
  25. !>
  26. !> Initialization of the variables of the current grid.
  27. !
  28. module Agrif_Init_Vars
  29. !
  30. use Agrif_Types
  31. use Agrif_Grids
  32. use Agrif_Link
  33. !
  34. implicit none
  35. !
  36. contains
  37. !
  38. !===================================================================================================
  39. ! subroutine Agrif_Create_Var
  40. !
  41. !> Allocation of the list of grid variables for grid Agrif_Gr.
  42. !---------------------------------------------------------------------------------------------------
  43. subroutine Agrif_Create_Var ( Agrif_Gr )
  44. !---------------------------------------------------------------------------------------------------
  45. type(Agrif_Grid), pointer :: Agrif_Gr !< Pointer on the current grid
  46. !
  47. integer :: nb
  48. !
  49. if (Agrif_NbVariables(0) > 0) allocate(Agrif_Gr % tabvars (Agrif_NbVariables(0)))
  50. if (Agrif_NbVariables(1) > 0) allocate(Agrif_Gr % tabvars_c(Agrif_NbVariables(1)))
  51. if (Agrif_NbVariables(2) > 0) allocate(Agrif_Gr % tabvars_r(Agrif_NbVariables(2)))
  52. if (Agrif_NbVariables(3) > 0) allocate(Agrif_Gr % tabvars_l(Agrif_NbVariables(3)))
  53. if (Agrif_NbVariables(4) > 0) allocate(Agrif_Gr % tabvars_i(Agrif_NbVariables(4)))
  54. !
  55. if ( Agrif_Gr % fixedrank /= 0 ) then
  56. do nb = 1, Agrif_NbVariables(0)
  57. Agrif_Gr % tabvars(nb) % parent_var => Agrif_Gr % parent % tabvars(nb)
  58. Agrif_Gr % tabvars(nb) % nbdim = Agrif_Mygrid % tabvars(nb) % nbdim
  59. Agrif_Gr % tabvars(nb) % root_var => Agrif_Mygrid % tabvars(nb)
  60. enddo
  61. do nb = 1, Agrif_NbVariables(1)
  62. Agrif_Gr % tabvars_c(nb) % parent_var => Agrif_Gr % parent % tabvars_c(nb)
  63. Agrif_Gr % tabvars_c(nb) % nbdim = Agrif_Mygrid % tabvars_c(nb) % nbdim
  64. Agrif_Gr % tabvars_c(nb) % root_var => Agrif_Mygrid % tabvars_c(nb)
  65. enddo
  66. do nb = 1, Agrif_NbVariables(2)
  67. Agrif_Gr % tabvars_r(nb) % parent_var => Agrif_Gr % parent % tabvars_r(nb)
  68. Agrif_Gr % tabvars_r(nb) % nbdim = Agrif_Mygrid % tabvars_r(nb) % nbdim
  69. Agrif_Gr % tabvars_r(nb) % root_var => Agrif_Mygrid % tabvars_r(nb)
  70. enddo
  71. do nb = 1, Agrif_NbVariables(3)
  72. Agrif_Gr % tabvars_l(nb) % parent_var => Agrif_Gr % parent % tabvars_l(nb)
  73. Agrif_Gr % tabvars_l(nb) % nbdim = Agrif_Mygrid % tabvars_l(nb) % nbdim
  74. Agrif_Gr % tabvars_l(nb) % root_var => Agrif_Mygrid % tabvars_l(nb)
  75. enddo
  76. do nb = 1, Agrif_NbVariables(4)
  77. Agrif_Gr % tabvars_i(nb) % parent_var => Agrif_Gr % parent % tabvars_i(nb)
  78. Agrif_Gr % tabvars_i(nb) % nbdim = Agrif_Mygrid % tabvars_i(nb) % nbdim
  79. Agrif_Gr % tabvars_i(nb) % root_var => Agrif_Mygrid % tabvars_i(nb)
  80. enddo
  81. endif
  82. !---------------------------------------------------------------------------------------------------
  83. end subroutine Agrif_Create_Var
  84. !===================================================================================================
  85. !
  86. end module Agrif_Init_Vars