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