psmile_write_2d_dble.F90

Go to the documentation of this file.
00001 !-----------------------------------------------------------------------
00002 ! Copyright 2007-2010, SGI Germany, Munich, Germany.
00003 ! All rights reserved. Use is subject to OASIS4 license terms.
00004 !-----------------------------------------------------------------------
00005 !BOP
00006 !
00007 ! !ROUTINE:   psmile_write_2d_dble
00008 !
00009 ! !INTERFACE:
00010 
00011       subroutine psmile_write_2d_dble(unit                &
00012                                      ,var                 &
00013                                      ,domain              &
00014                                      ,ain                 &
00015                                      ,a_shape             &
00016                                      ,v_shape             &
00017                                      ,time                &
00018                                      ,time_used           &
00019                                      ,id_blockid          &
00020                                      ,block_used          &
00021                                      ,ierror)
00022 !
00023 ! !USES:
00024 !
00025 
00026       use psmile
00027 
00028 #ifdef __PSMILE_WITH_IO
00029       implicit none
00030       include 'prism.inc'
00031 !
00032 ! !INPUT PARAMETERS:
00033 !
00034       integer,intent(in)           :: unit
00035       Type(fieldtype),intent(in)   :: var
00036       Type(domain2D),intent(inout) :: domain
00037       integer,intent(in)           :: a_shape(2,*)
00038       integer,intent(in)           :: v_shape(2,*)
00039       double precision, intent(inout) :: ain(a_shape(1,1):a_shape(2,1)  
00040                                             ,a_shape(1,2):a_shape(2,2)) 
00041       double precision, intent(in):: time
00042       logical,intent(in) :: time_used
00043       integer,intent(in) :: id_blockid
00044       logical,intent(in) :: block_used
00045 !
00046 ! !OUTPUT PARAMETERS:
00047 !
00048       integer, intent(out) :: ierror
00049 !
00050 ! !LOCAL VARIABLES
00051 !
00052       double precision     :: a(v_shape(1,1):v_shape(2,1)  
00053                                ,v_shape(1,2):v_shape(2,2)) 
00054       integer::ierrp(2)
00055 !
00056 ! !DESCRIPTION:
00057 !
00058 ! Writes a double precision partitioned 2d array to a file.
00059 ! Subblocks are supported.
00060 !
00061 ! !REVISION HISTORY:
00062 !
00063 !   Date      Programmer   Description
00064 ! ----------  ----------   -----------
00065 !  09.12.03   R. Vogelsang created
00066 !
00067 !EOP
00068 !----------------------------------------------------------------------
00069 
00070       character(len=len_cvs_string),save :: mcvs = 
00071 '$Id: psmile_write_2d_dble.F90 2325 2010-04-21 15:00:07Z valcke $'
00072       
00073       ierror=0
00074 
00075 #ifdef VERBOSE
00076       print*,trim(ch_id),' :   psmile_write_2d_dble: start'
00077       print*,trim(ch_id),' :   psmile_write_2d_dble: v_shape,a_shape' &
00078                         ,v_shape(1:2,1:2),a_shape(1:2,1:2)
00079       call psmile_flushstd
00080 
00081 #endif
00082 
00083       ! The Cray pointer used in subroutine MPP_WRITE_2DDECOMP_2D_
00084       ! (file mpp_write_2Ddecomp.h) does not work properly with all
00085       ! compilers when a_shape and v_shape are different, and both
00086       ! ain and a are declared over a_shape, but only the v_shape
00087       ! array section is transferred to mpp_write. We therefore
00088       ! have to extract the v_shape array section and copy that
00089       ! into an array dimensioned with v_shape and pass this
00090       ! to mpp_write.  
00091 
00092         a(v_shape(1,1):v_shape(2,1),v_shape(1,2):v_shape(2,2)) = &
00093       ain(v_shape(1,1):v_shape(2,1),v_shape(1,2):v_shape(2,2))
00094 
00095       if(block_used) then
00096       if(id_blockid.le.0) then
00097          ierror = PRISM_Error_Internal
00098          call psmile_error ( ierror, 'id_blockid <= 0! ', &
00099                              ierrp, 0, __FILE__, __LINE__ )
00100       endif
00101       if(time_used) then
00102         call mpp_write( unit,var,domain,a,tstamp=time,blockid=id_blockid )
00103       else
00104         call mpp_write( unit,var,domain,a,blockid=id_blockid )
00105       endif
00106       else
00107       if(time_used) then
00108         call mpp_write( unit,var,domain,a,tstamp=time )
00109       else
00110         call mpp_write( unit,var,domain,a )
00111       endif
00112       endif
00113 #ifdef __PSMILE_IO_SYNC
00114       call mpp_flush(unit)
00115 #endif
00116 
00117 #ifdef VERBOSE
00118       print*,trim(ch_id),' :   psmile_write_2d_dble: end'
00119       call psmile_flushstd
00120 
00121 #endif
00122 
00123 #endif
00124       end subroutine psmile_write_2d_dble

Generated on 18 Mar 2011 for Oasis4 by  doxygen 1.6.1