00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 subroutine psmile_mg_ctrl_subgrid_2d_dble (array, &
00012 corner_shape, nbr_corners, range, &
00013 chmin, chmax, levdim, &
00014 period, grid_id, ind, ierror)
00015
00016
00017
00018 use PRISM_constants
00019
00020 use PSMILe, dummy_interface => PSMILe_MG_ctrl_subgrid_2d_dble
00021
00022 Implicit none
00023
00024
00025
00026 Integer, Intent (In) :: corner_shape (2, 2)
00027 Integer, Intent (In) :: nbr_corners
00028
00029
00030
00031 Double Precision, Intent (In) :: array (
00032 corner_shape(1,1):corner_shape(2,1),
00033 corner_shape(1,2):corner_shape(2,2),
00034 nbr_corners)
00035
00036
00037
00038
00039 Integer, Intent (In) :: range (2, 2)
00040
00041
00042
00043 Integer, Intent (In) :: levdim (2)
00044
00045
00046
00047 Double Precision, Intent (In) :: chmin (0:levdim(1), 0:levdim(2))
00048
00049
00050
00051 Double Precision, Intent (In) :: chmax (0:levdim(1), 0:levdim(2))
00052
00053
00054
00055 Double Precision, Intent (In) :: period
00056
00057
00058
00059 Integer, Intent (In) :: grid_id
00060
00061
00062
00063 Integer, Intent (In) :: ind
00064
00065
00066
00067
00068
00069 Integer, Intent (Out) :: ierror
00070
00071
00072
00073
00074
00075
00076
00077 Integer :: i, j, jbeg
00078 Integer :: ijend (2)
00079 Double Precision :: dist_cyclic
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099 Character(len=len_cvs_string), save :: mycvs =
00100 '$Id: psmile_mg_ctrl_subgrid_2d_dble.F90 2325 2010-04-21 15:00:07Z valcke $'
00101
00102
00103
00104 #ifdef VERBOSE
00105 print 9990, trim(ch_id)
00106
00107 call psmile_flushstd
00108 #endif /* VERBOSE */
00109
00110
00111
00112 ierror = 0
00113
00114 ijend(:) = min (range(1,:)+levdim(:), range (2,:)) - range (1,:)
00115
00116
00117
00118 dist_cyclic = period * 0.5
00119
00120 loopj: do j = 0, ijend(2)
00121
00122 do i = 0, ijend (1)
00123 if (chmax(i,j) - chmin (i,j) > dist_cyclic) exit loopj
00124 enddo
00125 enddo loopj
00126
00127 if (j <= ijend(2)) then
00128
00129
00130
00131
00132 print 9970, trim(ch_id), grid_id, trim(Grids(grid_id)%grid_name), &
00133 name_coord(ind)
00134
00135 jbeg = j
00136 do j = jbeg, ijend(2)
00137 do i = 0, ijend (1)
00138 if (chmax(i,j) - chmin (i,j) > dist_cyclic) then
00139 ierror = ierror - 1
00140 print 9960, i+range(1,1), j+range(1,2), &
00141 array (i+range(1,1), j+range(1,2), :)
00142 end if
00143 end do
00144 end do
00145
00146 print *
00147 endif
00148
00149
00150
00151 #ifdef VERBOSE
00152 if ( ierror == 0 ) then
00153 print 9980, trim(ch_id), ierror
00154 else
00155 print 9981, trim(ch_id), abs(ierror)
00156 endif
00157
00158 call psmile_flushstd
00159 #endif /* VERBOSE */
00160
00161
00162
00163 9990 format (1x, a, ': psmile_mg_ctrl_subgrid_2d_dble')
00164 9980 format (1x, a, ': psmile_mg_ctrl_subgrid_2d_dble eof: ierror =', i4)
00165 9981 format (1x, a, ': psmile_mg_ctrl_subgrid_2d_dble eof: issue warning for', i8, ' cells.')
00166
00167 9970 format (/1x, a, ': #### WARNING in psmile_mg_ctrl_subgrid_2d_dble:', &
00168 /10x, 'Cells with incorrect (periodic) corner coordinates ', &
00169 'probably found !' &
00170 /10x, 'Grid id ', i4, '; name:', 1x, a, &
00171 /10x, 'Cell indices of ', a, ' coordinate direction:')
00172 9960 format (1x, 'Indices(', i7, ',', i7, '); coordinates', (1x, 4f16.9))
00173
00174 end subroutine PSMILe_MG_ctrl_subgrid_2d_dble