psmile_mg_ctrl_subgrid_1d_real.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2006-2010, NEC Europe Ltd., London, UK.
00003 ! All rights reserved. Use is subject to OASIS4 license terms.
00004 !-----------------------------------------------------------------------
00005 !BOP
00006 !
00007 ! !ROUTINE: PSMILe_MG_ctrl_subgrid_1d_real
00008 !
00009 ! !INTERFACE:
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 ! !USES:
00018 !
00019       use PRISM_constants
00020 !
00021       use PSMILe, dummy_interface => PSMILe_MG_ctrl_subgrid_1d_real
00022 
00023       implicit none
00024 !
00025 ! !INPUT PARAMETERS:
00026 !
00027       Integer, Intent (In)             :: corner_shape(2), nbr_corners
00028 
00029 !     Dimensions of "array"
00030 !
00031       Real, Intent (In)                :: array (corner_shape(1):
00032                                                  corner_shape(2),
00033                                                  nbr_corners)
00034 
00035 !     Fully dimensioned array "array" for which the first MG level
00036 !     was be computed.
00037 
00038       Integer, Intent (In)             :: range (2)
00039 
00040 !     Definintion of the subgrid
00041 
00042       Integer, Intent (In)             :: levdim
00043 
00044 !     Dimension of the first MG level
00045 
00046       Real, Intent (In)                :: chmin (0:levdim)
00047 !
00048 !     Minimum value of bounding box of coordinate array "array".
00049 !
00050       Real, Intent (In)                :: chmax (0:levdim)
00051 !
00052 !     Maximum value of bounding box of coordinate array "array".
00053 !
00054       Real, Intent (In)                :: period
00055 !
00056 !     Period of cyclic coordinate
00057 
00058       Integer, Intent (In)             :: grid_id
00059 
00060 !     Grid id
00061 
00062       Integer, Intent (In)             :: ind
00063 
00064 !     Index of the grid
00065 !
00066 ! !OUTPUT PARAMETERS:
00067 !
00068       Integer, Intent (Out)            :: ierror
00069 
00070 !     Returns the error code of PSMILe_MG_ctrl_subgrid_1d_real
00071 !             ierror = 0 : No error
00072 !             ierror > 0 : Severe error
00073 !
00074 ! !LOCAL VARIABLES
00075 !
00076       Integer                          :: i, ibeg, iend
00077       Real                             :: dist_cyclic
00078 !
00079 ! !DESCRIPTION:
00080 !
00081 ! Subroutine "PSMILe_MG_ctrl_subgrid_1d_real" controls whether
00082 ! the "control volumes" defined by the corner arrays "array" fulfill the
00083 ! internal requirements of the MG search.
00084 !
00085 ! !REVISION HISTORY:
00086 !
00087 !   Date      Programmer   Description
00088 ! ----------  ----------   -----------
00089 ! 03.06.25    H. Ritzdorf  created
00090 !
00091 !EOP
00092 !----------------------------------------------------------------------
00093 !
00094 !  $Id: psmile_mg_ctrl_subgrid_1d_real.F90 2325 2010-04-21 15:00:07Z valcke $
00095 !  $Author: valcke $
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 !  Initialization
00109 !
00110       ierror = 0
00111 !
00112       ibeg = 0
00113       iend = min (range(1)+levdim, range (2)) - range (1)
00114 !
00115 !     Control cells and warn user
00116 !
00117       dist_cyclic = period * 0.5
00118 
00119 !cdir vector
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 !     ... A cell violating the internal requirements was probably found
00127 !         Warn user !
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 !===> All done
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 !  Formats:
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

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1