Changeset 10725 for vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modvariables.F90
- Timestamp:
- 2019-02-27T14:55:54+01:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendors/AGRIF/CMEMS_2020/AGRIF_FILES/modvariables.F90
r10087 r10725 5 5 implicit none 6 6 ! 7 #if defined AGRIF_MPI8 interface9 subroutine Agrif_InvLoc ( indloc, proc_id, dir, indglob )10 integer, intent(in) :: indloc !< local index11 integer, intent(in) :: proc_id !< rank of the proc calling this function12 integer, intent(in) :: dir !< direction of the index13 integer, intent(out) :: indglob !< global index14 end subroutine Agrif_InvLoc15 end interface16 private :: Agrif_InvLoc17 #endif18 19 7 contains 20 8 ! … … 26 14 subroutine Agrif_Declare_Variable ( posvar, firstpoint, raf, lb, ub, varid, torestore ) 27 15 !--------------------------------------------------------------------------------------------------- 28 integer, dimension(:), intent(in):: posvar !< position of the variable on the cell29 !<(1 for the border of the edge, 2 for the center)30 integer, dimension(:), intent(in):: firstpoint !< index of the first point in the real domain31 character( *), dimension(:), intent(in):: raf !< Array indicating the type of dimension (space or not)32 !<for each of them33 integer, dimension(:), intent(in):: lb !< Lower bounds of the array34 integer, dimension(:), intent(in):: ub !< Upper bounds of the array35 integer, intent(out) 36 logical, optional, intent(in):: torestore !< Indicates if the array restore is used37 ! 16 integer, dimension(:), intent(in) :: posvar !< position of the variable on the cell 17 !! (1 for the border of the edge, 2 for the center) 18 integer, dimension(:), intent(in) :: firstpoint !< index of the first point in the real domain 19 character(1), dimension(:), intent(in) :: raf !< Array indicating the type of dimension (space or not) 20 !! for each of them 21 integer, dimension(:), intent(in) :: lb !< Lower bounds of the array 22 integer, dimension(:), intent(in) :: ub !< Upper bounds of the array 23 integer, intent(out) :: varid !< Id number of the newly created variable 24 logical, optional, intent(in) :: torestore !< Indicates if the array restore is used 25 !--------------------------------------------------------------------------------------------------- 38 26 type(Agrif_Variables_List), pointer :: new_varlist 39 27 type(Agrif_Variable), pointer :: var 40 integer :: nbdim 28 integer :: nbdim, i 41 29 logical :: restore 42 #if defined AGRIF_MPI43 include 'mpif.h'44 integer :: i45 integer,dimension(6,2) :: iminmaxg, lubglob46 integer :: code47 #endif48 30 49 31 restore = .FALSE. … … 61 43 allocate(var % posvar(nbdim)) 62 44 allocate(var % interptab(nbdim)) 45 allocate(var % coords(nbdim)) 63 46 ! 64 var % interptab = raf65 var % nbdim = nbdim66 var % posvar = posvar67 var % point(1:nbdim) = firstpoint 47 var % nbdim = nbdim 48 var % interptab = raf(1:nbdim) 49 var % posvar = posvar(1:nbdim) 50 var % point(1:nbdim) = firstpoint(1:nbdim) 68 51 var % restore = restore 69 52 ! 53 do i = 1,nbdim 54 select case( raf(i) ) 55 case('x') ; var % coords(i) = 1 56 case('y') ; var % coords(i) = 2 57 case('z') ; var % coords(i) = 3 58 case('N') ; var % coords(i) = 0 59 case default ; var % coords(i) = 0 60 end select 61 enddo 62 ! 70 63 var % lb(1:nbdim) = lb(1:nbdim) 71 64 var % ub(1:nbdim) = ub(1:nbdim) 72 73 #if defined AGRIF_MPI74 do i = 1,nbdim75 call Agrif_Invloc(lb(i), Agrif_Procrank, i, iminmaxg(i,1))76 call Agrif_Invloc(ub(i), Agrif_Procrank, i, iminmaxg(i,2))77 enddo78 !79 iminmaxg(1:nbdim,2) = - iminmaxg(1:nbdim,2)80 call MPI_ALLREDUCE(iminmaxg(1:nbdim,:), lubglob(1:nbdim,:), 2*nbdim, MPI_INTEGER,MPI_MIN,Agrif_mpi_comm, code)81 lubglob(1:nbdim,2) = - lubglob(1:nbdim,2)82 var % lbglob(1:nbdim) = lubglob(1:nbdim,1)83 var % ubglob(1:nbdim) = lubglob(1:nbdim,2)84 #else85 var % lbglob(1:nbdim) = var % lb(1:nbdim)86 var % ubglob(1:nbdim) = var % ub(1:nbdim)87 #endif88 65 89 66 if ( restore ) then … … 122 99 Agrif_Curgrid % Nbvariables = Agrif_Curgrid % Nbvariables + 1 123 100 124 varid = -Agrif_Curgrid % Nbvariables101 varid = Agrif_Curgrid % Nbvariables 125 102 126 103 var % parent_var => Agrif_Search_Variable(Agrif_Curgrid % parent, Agrif_Curgrid % nbvariables) … … 144 121 integer :: nb, varidinv 145 122 ! 146 if ( .not.associated(grid) ) then123 if ( .not.associated(grid) ) then 147 124 outvar => NULL() 148 125 return … … 150 127 ! 151 128 parcours => grid % variables 152 129 153 130 if (.not. associated(parcours)) then ! can occur on the grand mother grid 154 131 outvar => NULL() ! during the first call by agrif_mygrid 155 132 return 156 133 endif 157 158 134 159 135 varidinv = 1 + grid % nbvariables - varid 160 136 … … 164 140 165 141 outvar => parcours % var 166 167 142 !--------------------------------------------------------------------------------------------------- 168 143 end function Agrif_Search_variable
Note: See TracChangeset
for help on using the changeset viewer.