1 |
sannino |
1.1 |
C $Header: /u/gcmpack/MITgcm/pkg/oasis/oasis_finalize.F,v 1.0 2005/07/18 23:05:09 gianamria sannino Exp $ |
2 |
|
|
C $Name: $ |
3 |
|
|
|
4 |
|
|
cgm( |
5 |
|
|
#include "CPP_EEOPTIONS.h" |
6 |
|
|
cgm) |
7 |
|
|
#include "OASIS_OPTIONS.h" |
8 |
|
|
C---+----1----+----2----+----3----+----4----+----5----+----6----+----7-|--+----| |
9 |
|
|
CBOP 0 |
10 |
|
|
C !ROUTINE: OASIS_INIT |
11 |
|
|
|
12 |
|
|
C !INTERFACE: |
13 |
|
|
SUBROUTINE OASIS_FINALIZE |
14 |
|
|
|
15 |
|
|
|
16 |
|
|
|
17 |
|
|
C !DESCRIPTION: |
18 |
|
|
C Routine to initialize OASIS parameters and variables. |
19 |
|
|
|
20 |
|
|
C !USES: |
21 |
|
|
USE mod_kinds_model |
22 |
|
|
USE mod_prism_proto |
23 |
|
|
c USE mod_prism_def_partition_proto |
24 |
|
|
c USE mod_prism_put_proto |
25 |
|
|
c USE mod_prism_get_proto |
26 |
|
|
c USE mod_prism_grids_writing |
27 |
|
|
IMPLICIT NONE |
28 |
|
|
cgm) |
29 |
|
|
#include "SIZE.h" |
30 |
|
|
#include "EEPARAMS.h" |
31 |
|
|
#include "EESUPPORT.h" |
32 |
|
|
#include "PARAMS.h" |
33 |
|
|
c#include "GRID.h" |
34 |
|
|
cgm( qui vanno inseriuti anche se il pkg non รจ ancora attivato...piccola porcata |
35 |
|
|
#include "OASIS.h" |
36 |
|
|
#include "OASIS_PARAMS.h" |
37 |
|
|
cgm) |
38 |
|
|
C !INPUT PARAMETERS: |
39 |
|
|
INTEGER myThid |
40 |
|
|
CEOP |
41 |
|
|
|
42 |
|
|
C !LOCAL VARIABLES: |
43 |
|
|
c#ifdef ALLOW_OASIS |
44 |
|
|
INTEGER :: io_size, ii, il_real, il_bufsizebyt |
45 |
|
|
INTEGER :: integer_byte_size, integer_io_size,il_bufsize |
46 |
|
|
REAL(kind=ip_realwp_p), DIMENSION(Nx,Ny) :: rla_array |
47 |
|
|
REAL(kind=ip_realwp_p), DIMENSION(:), ALLOCATABLE :: rla_bufsend |
48 |
|
|
|
49 |
|
|
! |
50 |
|
|
! 1- PSMILe finalize |
51 |
|
|
! |
52 |
|
|
! |
53 |
|
|
! Let's suppose the model attaches to a MPI buffer for its own use |
54 |
|
|
! |
55 |
|
|
! ! Sophisticated way to determine buffer size needed (without "kind") |
56 |
|
|
! ! Here one message containing rla_array |
57 |
|
|
|
58 |
|
|
integer_byte_size = BIT_SIZE(ii)/8 |
59 |
|
|
INQUIRE (iolength=io_size) ii |
60 |
|
|
integer_io_size = io_size |
61 |
|
|
INQUIRE (iolength=io_size) rla_array(1,1) |
62 |
|
|
il_real = io_size/integer_io_size*integer_byte_size |
63 |
|
|
il_bufsize = (Nx*Ny) + MPI_BSEND_OVERHEAD/il_real + 1 |
64 |
|
|
ALLOCATE (rla_bufsend(il_bufsize), stat = ierror) |
65 |
|
|
il_bufsizebyt = il_bufsize * il_real |
66 |
|
|
|
67 |
|
|
CALL MPI_Buffer_Detach(rla_bufsend, il_bufsize, ierror) |
68 |
|
|
|
69 |
|
|
IF (ierror .NE. PRISM_Ok) THEN |
70 |
|
|
WRITE (*,*) ' mit : pb MPI_Buffer_Detach' |
71 |
|
|
CALL prism_abort_proto(il_comp_id, 'mit.F90','abort1') |
72 |
|
|
ENDIF |
73 |
|
|
|
74 |
|
|
! |
75 |
|
|
CALL prism_terminate_proto (ierror) |
76 |
|
|
! |
77 |
|
|
IF (ierror .NE. PRISM_Ok) THEN |
78 |
|
|
WRITE (*,*) ' mit : pb prism_terminate_proto' |
79 |
|
|
ENDIF |
80 |
|
|
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
c#endif /* ALLOW_OASIS */ |
84 |
|
|
|
85 |
|
|
return |
86 |
|
|
end |