prismtrs_set_src_epio_dble.F90

Go to the documentation of this file.
00001 !------------------------------------------------------------------------
00002 ! Copyright 2006-2010, CERFACS, Toulouse, France.
00003 ! Copyright 2006-2010, NEC High Performance Computing, Duesseldorf, Germany.
00004 ! All rights reserved. Use is subject to OASIS4 license terms.
00005 !-----------------------------------------------------------------------
00006 !BOP
00007 !
00008 ! !ROUTINE: PRISMTrs_Set_src_epio_dble
00009 !
00010 ! !INTERFACE
00011 subroutine prismtrs_set_src_epio_dble(ida_loop, id_err)
00012 !
00013 ! !USES:
00014 !
00015   USE PRISMDrv, dummy_interface => PRISMTrs_Set_src_epio_dble
00016 !
00017   IMPLICIT NONE
00018 !
00019 ! !PARAMETERS:
00020 !
00021   INTEGER, DIMENSION(PSMILe_trans_Header_length), INTENT (IN) :: ida_loop
00022 !
00023 ! ida_loop(2) : global rank of the source psmile process sending the info
00024 ! ida_loop(6) : epio id
00025 ! ida_loop(4) : source component id
00026 ! ida_loop(5) : source process id
00027 ! ida_loop(7) : source epio size 
00028 ! ida_loop(8) : size of compact lat/lon/z arrays
00029 ! ida_loop(9) : PSMILe_3D 
00030 ! ida_loop(10): indicates if the mask will be received or not
00031 !
00032 ! ! RETURN VALUE
00033 !
00034   INTEGER, INTENT (Out)               :: id_err   ! error value
00035 
00036 ! !DESCRIPTION
00037 ! Subroutine "PRISMTrs_Set_src_epio_dble" insures the reception of the 
00038 ! informations about the epio sent by a model through the PSMILe.
00039 !
00040 ! !REVISED HISTORY
00041 !   Date      Programmer   Description
00042 ! ----------  ----------   -----------
00043 ! 01/12/2003  D. Declat    Creation from prismdrv_trs_set_epio_info
00044 ! 05/10/2006  S. Valcke    Revised for corner reception
00045 ! EOP
00046 !----------------------------------------------------------------------
00047 ! $Id: prismtrs_set_src_epio_dble.F90 2685 2010-10-28 14:05:10Z coquart $
00048 ! $Author: coquart $
00049 !----------------------------------------------------------------------
00050 !
00051 ! 0. Local declarations
00052 !
00053   CHARACTER(LEN=len_cvs_string), SAVE  :: mycvs = 
00054      '$Id: prismtrs_set_src_epio_dble.F90 2685 2010-10-28 14:05:10Z coquart $'
00055 !
00056 ! received in ida_loop
00057 !
00058   INTEGER :: il_process_global_rank, il_epio_id, il_src_comp_id
00059   INTEGER :: il_src_process
00060   INTEGER :: il_epio_size, il_lonlatz_size
00061   INTEGER :: il_src_mask, il_dimtype
00062 
00063 !
00064 ! Auxiliary variables
00065 !
00066   INTEGER                            :: il_status(MPI_STATUS_SIZE)
00067 !
00068   INTEGER, PARAMETER  :: nerrp = 2
00069   INTEGER             :: ierrp (nerrp)
00070   INTEGER             :: ii
00071   DOUBLE PRECISION           :: dbl_rad2deg
00072 !
00073   CHARACTER(LEN=30)   :: name_f
00074 
00075 !----------------------------------------------------------------------
00076 !
00077 #ifdef VERBOSE
00078   PRINT *, '| | | Enter PRISMTrs_Set_src_epio_dble'
00079   call psmile_flushstd
00080 #endif
00081 !
00082 ! Put received argument in local integer variables
00083   il_process_global_rank = ida_loop(2)
00084   il_epio_id             = ida_loop(6)
00085   il_src_comp_id         = ida_loop(4)
00086   il_src_process         = ida_loop(5)
00087   il_epio_size           = ida_loop(7)
00088   il_lonlatz_size        = ida_loop(8)
00089   il_dimtype             = ida_loop(9)
00090   il_src_mask            = ida_loop(10)
00091   !
00092 #ifdef VERBOSE
00093   print*, '| | | Reception of source ccordinates for EPIO :',il_epio_id,&
00094            '| | | from global source process :',il_process_global_rank, 'size :', &
00095            il_epio_size
00096   call psmile_flushstd
00097 #endif
00098 !
00099 ! 0. Check if the epio structure is allocated and Set epio general information
00100 !
00101 ! 0.1. Check allocation
00102   IF (Number_of_Epios_allocated == 0) THEN
00103       Number_of_Epios_allocated = Number_of_Epios_allocated + 8
00104       ALLOCATE (Drv_Epios(Number_of_Epios_allocated), STAT = id_err)
00105   END IF
00106   IF (il_epio_id > Number_of_Epios_allocated) THEN
00107       PRINT *, '| | | il_epio_id greater then Number_of_Epios_allocated'
00108       call psmile_abort 
00109   END IF
00110 !
00111 ! 0.2. Set information
00112   Drv_Epios(il_epio_id)%epio_id = il_epio_id
00113   Drv_Epios(il_epio_id)%trans_rank = Appl%rank
00114   Drv_Epios(il_epio_id)%gaussred_stride = 0.5*il_lonlatz_size
00115 !
00116 ! 1. Reception of the different vectors
00117 !
00118 #ifdef VERBOSE
00119   PRINT *, &
00120      '| | | | Reception of the EPIOS latitudes, longitudes and z'
00121   call psmile_flushstd
00122 #endif
00123 
00124 ! 1.2. Reception of the lat, lon, z and mask
00125 
00126   ALLOCATE(Drv_Epios(il_epio_id)%src_lat_pointer_dble(1:il_lonlatz_size), &
00127        stat = id_err)
00128   IF (id_err > 0) THEN
00129      ierrp (1) = id_err
00130      ierrp (2) = il_lonlatz_size
00131      id_err = PRISM_Error_Alloc
00132 
00133      call psmile_error_common ( id_err, 'Src_lat_pointer_dble', &
00134           ierrp, 2, __FILE__, __LINE__ )
00135      RETURN
00136   ENDIF
00137 
00138   ALLOCATE(Drv_Epios(il_epio_id)%src_lon_pointer_dble(1:il_lonlatz_size), &
00139        stat = id_err)
00140   IF (id_err > 0) THEN
00141      ierrp (1) = id_err
00142      ierrp (2) = il_lonlatz_size
00143      id_err = PRISM_Error_Alloc
00144 
00145      call psmile_error_common ( id_err, 'Src_lon_pointer_dble', &
00146           ierrp, 2, __FILE__, __LINE__ )
00147      RETURN
00148   ENDIF
00149 
00150   ALLOCATE(Drv_Epios(il_epio_id)%src_z_pointer_dble(1:il_lonlatz_size), &
00151        stat = id_err)
00152   IF (id_err > 0) THEN
00153      ierrp (1) = id_err
00154      ierrp (2) = il_lonlatz_size
00155      id_err = PRISM_Error_Alloc
00156 
00157      call psmile_error_common ( id_err, 'Src_z_pointer_dble', &
00158           ierrp, 2, __FILE__, __LINE__ )
00159      RETURN
00160   ENDIF
00161 
00162   ALLOCATE(Drv_Epios(il_epio_id)%src_mask_pointer(1:il_epio_size), &
00163        stat = id_err)
00164   IF (id_err > 0) THEN
00165      ierrp (1) = id_err
00166      ierrp (2) = il_epio_size
00167      id_err = PRISM_Error_Alloc
00168 
00169      call psmile_error_common ( id_err, 'Src_msk_pointer', &
00170           ierrp, 2, __FILE__, __LINE__ )
00171      RETURN
00172   ENDIF
00173 
00174   CALL MPI_Recv (Drv_Epios(il_epio_id)%src_lat_pointer_dble, &
00175      il_lonlatz_size, MPI_Double_Precision, &
00176      il_process_global_rank, 1, comm_drv_trans, il_status, id_err)
00177   Drv_Epios(il_epio_id)%src_lat_pointer_dble(:) = &
00178      Drv_Epios(il_epio_id)%src_lat_pointer_dble(:)*dble_deg2rad
00179   
00180   CALL MPI_Recv (Drv_Epios(il_epio_id)%src_lon_pointer_dble, &
00181      il_lonlatz_size, MPI_Double_Precision, &
00182      il_process_global_rank, 2, comm_drv_trans, il_status, id_err)
00183   Drv_Epios(il_epio_id)%src_lon_pointer_dble(:) = &
00184      Drv_Epios(il_epio_id)%src_lon_pointer_dble(:)*dble_deg2rad
00185   
00186   CALL MPI_Recv (Drv_Epios(il_epio_id)%src_z_pointer_dble,  &
00187      il_lonlatz_size, MPI_Double_Precision, &
00188      il_process_global_rank, 3, comm_drv_trans, il_status, id_err)
00189 
00190   IF (il_src_mask > 0) THEN
00191       CALL MPI_Recv (Drv_Epios(il_epio_id)%src_mask_pointer, &
00192          il_epio_size, MPI_Integer, &
00193          il_process_global_rank, 4, comm_drv_trans, il_status, id_err)
00194   ELSE
00195       Drv_Epios(il_epio_id)%src_mask_pointer(:) = 1
00196   END IF
00197 
00198 #ifdef VERBOSE
00199   PRINT *, &
00200      '| | | | Set the EPIOS latitudes, longitudes and z'
00201   call psmile_flushstd
00202 #endif
00203   !
00204 #ifdef DEBUGX
00205   dbl_rad2deg = 360.0/6.2831853
00206   OPEN(unit=87, file='SOURCE_EPIO', form='formatted',position='append')
00207   WRITE(87,*) 'Source , epio_id, epio_size : il_lonlatz_size',il_epio_id, &
00208                il_epio_size, il_lonlatz_size
00209   WRITE(87,*) 'SOURCE LATITUDES and LONGITUDES'
00210   DO ii=1, il_lonlatz_size
00211     WRITE(87,*) ii,dbl_rad2deg*Drv_Epios(il_epio_id)%src_lat_pointer_dble(ii), &
00212                 dbl_rad2deg*Drv_Epios(il_epio_id)%src_lon_pointer_dble(ii)
00213   ENDDO
00214   CLOSE(87)
00215 #endif
00216 
00217 ! 3. Set the general epio information
00218 !
00219   Drv_Epios(il_epio_id)%src_comp_id = il_src_comp_id
00220   Drv_Epios(il_epio_id)%src_process = il_src_process
00221 
00222 !
00223 ! 4. Set the arrays information
00224 !
00225   Drv_Epios(il_epio_id)%src_coord_type = PRISM_Double_Precision
00226   Drv_Epios(il_epio_id)%src_size = il_epio_size 
00227   Drv_Epios(il_epio_id)%src_lonlatz_size = il_lonlatz_size
00228 !
00229 #ifdef VERBOSE 
00230   PRINT *, '| | | Quit PRISMTrs_Set_src_epio_dble '
00231   call psmile_flushstd
00232 #endif
00233 
00234 END SUBROUTINE PRISMTrs_Set_src_epio_dble
00235 
00236 
00237 
00238 
00239 
00240 
00241 

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1