source: trunk/NEMOGCM/NEMO/OPA_SRC/OBC/obcdta.F90 @ 22

Last change on this file since 22 was 9, checked in by cholod, 12 years ago

fldread.F90 and obcdta.F90 modifications to read OBC

File size: 9.4 KB
Line 
1MODULE obcdta
2   !!======================================================================
3   !!                       ***  MODULE obcdta  ***
4   !! Open boundary data : read the data for the open boundaries.
5   !!======================================================================
6   !! History : 3.3  !  2010-12  ()        -              -
7   !!----------------------------------------------------------------------
8#if defined key_obc
9   !!------------------------------------------------------------------------------
10   !!   'key_obc'         :                                Open Boundary Conditions
11   !!------------------------------------------------------------------------------
12   !!   obc_dta           : read u, v, t, s data along each open boundary
13   !!------------------------------------------------------------------------------
14   USE obc_oce         ! ocean open boundary conditions
15   USE obc_par         ! ocean open boundary conditions
16   USE fldread         ! read input fields
17   USE in_out_manager  ! I/O logical units
18
19   IMPLICIT NONE
20   PRIVATE
21
22   PUBLIC obc_dta      ! routines called by step.F90
23   PUBLIC obc_dta_bt   ! routines called by dynspg_ts.F90
24
25   TYPE(FLD), DIMENSION(16) ::   sf_obc       !: structure:
26   !!----------------------------------------------------------------------
27   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
28   !! $Id: obcdta.F90 188 2010-12-28 21:15:19Z rblod $
29   !! Software governed by the CeCILL licence (NEMOGCM/NEMO_CeCILL.txt)
30   !!----------------------------------------------------------------------
31CONTAINS
32
33   SUBROUTINE obc_dta( kt )
34      !!---------------------------------------------------------------------------
35      !!                      ***  SUBROUTINE obc_dta  ***
36      !!                   
37      !! ** Purpose :   read the data for the open boundaries.
38      !!---------------------------------------------------------------------------
39      INTEGER, INTENT( in ) ::   kt     ! ocean time-step
40      !!---------------------------------------------------------------------
41      !     
42      IF( kt == nit000 )  CALL obc_dta_init()
43      !
44      IF ( lp_obc_east ) THEN
45         CALL fld_read( kt, 1, sf_obc(1:4) )
46         ufoe(:,:) = sf_obc(1)%fnow(:,:,1)
47         vfoe(:,:) = sf_obc(2)%fnow(:,:,1)
48         tfoe(:,:) = sf_obc(3)%fnow(:,:,1)
49         sfoe(:,:) = sf_obc(4)%fnow(:,:,1)
50      ENDIF
51 
52      IF ( lp_obc_west ) THEN
53         CALL fld_read( kt, 1, sf_obc(5:8) )
54         ufow(:,:) = sf_obc(5)%fnow(:,:,1)
55         vfow(:,:) = sf_obc(6)%fnow(:,:,1)
56         tfow(:,:) = sf_obc(7)%fnow(:,:,1)
57         sfow(:,:) = sf_obc(8)%fnow(:,:,1)
58      ENDIF
59 
60      IF ( lp_obc_north ) THEN
61         CALL fld_read( kt, 1, sf_obc(9:12) )
62         ufon(:,:) = sf_obc( 9)%fnow(:,:,1)
63         vfon(:,:) = sf_obc(10)%fnow(:,:,1)
64         tfon(:,:) = sf_obc(11)%fnow(:,:,1)
65         sfon(:,:) = sf_obc(12)%fnow(:,:,1)
66      ENDIF
67 
68      IF ( lp_obc_south ) THEN
69         CALL fld_read( kt, 1, sf_obc(13:16) )
70         ufos(:,:) = sf_obc(13)%fnow(:,:,1)
71         vfos(:,:) = sf_obc(14)%fnow(:,:,1)
72         tfos(:,:) = sf_obc(15)%fnow(:,:,1)
73         sfos(:,:) = sf_obc(16)%fnow(:,:,1)
74      ENDIF
75 
76   END SUBROUTINE obc_dta
77
78
79# if defined key_dynspg_ts || defined key_dynspg_exp
80   SUBROUTINE obc_dta_bt( kt, kbt )
81      INTEGER,INTENT(in) :: kt
82      INTEGER, INTENT( in ) ::   kbt         ! barotropic ocean time-step index
83      !!---------------------------------------------------------------------------
84      !!                      ***  SUBROUTINE obc_dta  ***
85      !!
86      !! ** Purpose :   time interpolation of barotropic data for time-splitting scheme
87      !!                Data at the boundary must be in m2/s
88   END SUBROUTINE obc_dta_bt
89
90# else
91   !!-----------------------------------------------------------------------------
92   !!   Default option
93   !!-----------------------------------------------------------------------------
94   SUBROUTINE obc_dta_bt ( kt, kbt )       ! Empty routine
95      INTEGER,INTENT(in) :: kt
96      INTEGER, INTENT( in ) ::   kbt         ! barotropic ocean time-step index
97      WRITE(*,*) 'obc_dta_bt: You should not have seen this print! error?', kt
98      WRITE(*,*) 'obc_dta_bt: You should not have seen this print! error?', kbt
99   END SUBROUTINE obc_dta_bt
100# endif
101
102
103   SUBROUTINE obc_dta_init
104      !!---------------------------------------------------------------------------
105      !!                      ***  SUBROUTINE obc_dta  ***
106      !!                   
107      !! ** Purpose :   initialization of ....
108      !!
109      !! ** Method  : - read the obc namobc_dta namelist
110      !!
111      !! ** Action  : - read parameters
112      !!---------------------------------------------------------------------------
113      INTEGER :: ifpr
114      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
115      TYPE(FLD_N), DIMENSION(4) ::   sn_obce, sn_obcw, sn_obcn, sn_obcs  ! array of namelist informations on the obc to read
116      NAMELIST/namobc_dta/ sn_obce, sn_obcw, sn_obcn, sn_obcs
117      !!---------------------------------------------------------------------
118      ! set file information (default values)
119      cn_dir = './'       ! directory in which the model is executed
120      !
121      ! (NB: frequency positive => hours, negative => months)
122      !            !    file    ! frequency ! variable ! time intep !  clim   ! 'yearly' or ! weights  ! rotation !
123      !            !    name    !  (hours)  !  name    !   (T/F)    !  (T/F)  !  'monthly'  ! filename ! pairs    !
124      sn_obce(1) = FLD_N( 'obc_east', 120   ,   'vozocrtx'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
125      sn_obce(2) = FLD_N( 'obc_east', 120   ,   'vomecrty'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
126      sn_obce(3) = FLD_N( 'obc_east', 120   ,   'votemper'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
127      sn_obce(4) = FLD_N( 'obc_east', 120   ,   'vosaline'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
128         
129      sn_obcw(1) = FLD_N( 'obc_west', 120   ,   'vozocrtx'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
130      sn_obcw(2) = FLD_N( 'obc_west', 120   ,   'vomecrty'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
131      sn_obcw(3) = FLD_N( 'obc_west', 120   ,   'votemper'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
132      sn_obcw(4) = FLD_N( 'obc_west', 120   ,   'vosaline'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
133         
134      sn_obcn(1) = FLD_N( 'obc_north', 120  ,   'vozocrtx'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
135      sn_obcn(2) = FLD_N( 'obc_north', 120  ,   'vomecrty'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
136      sn_obcn(3) = FLD_N( 'obc_north', 120  ,   'votemper'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
137      sn_obcn(4) = FLD_N( 'obc_north', 120  ,   'vosaline'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
138         
139      sn_obcs(1) = FLD_N( 'obc_south', 120  ,   'vozocrtx'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
140      sn_obcs(2) = FLD_N( 'obc_south', 120  ,   'vomecrty'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
141      sn_obcs(3) = FLD_N( 'obc_south', 120  ,   'votemper'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
142      sn_obcs(4) = FLD_N( 'obc_south', 120  ,   'vosaline'   ,   .TRUE.   , .FALSE. ,   'yearly'  , ''       , ''       )
143      !
144      REWIND( numnam )                          ! read in namlist namobc_dta
145      READ  ( numnam, namobc_dta )
146         
147      IF ( lp_obc_east ) THEN
148         DO ifpr= 1, 4
149            ALLOCATE( sf_obc(ifpr)%fnow(jpj,jpk,1) )
150            IF( sn_obce(ifpr)%ln_tint ) ALLOCATE( sf_obc(ifpr)%fdta(jpj,jpk,1,2) )
151         END DO
152         CALL fld_fill( sf_obc(1:4), sn_obce, cn_dir, 'obc_dta_init', 'fill east OBC', 'namobc_dta' )
153      ENDIF
154 
155      IF ( lp_obc_west ) THEN
156         DO ifpr= 5, 8
157            ALLOCATE( sf_obc(ifpr)%fnow(jpj,jpk,1) )
158            IF( sn_obcw(ifpr-4)%ln_tint ) ALLOCATE( sf_obc(ifpr)%fdta(jpj,jpk,1,2) )
159         END DO
160         CALL fld_fill( sf_obc(5:8), sn_obcw, cn_dir, 'obc_dta_init', 'fill west OBC', 'namobc_dta' )
161      ENDIF
162 
163      IF ( lp_obc_north ) THEN
164         DO ifpr= 9, 12
165            ALLOCATE( sf_obc(ifpr)%fnow(jpi,jpk,1) )
166            IF( sn_obcn(ifpr-8)%ln_tint ) ALLOCATE( sf_obc(ifpr)%fdta(jpi,jpk,1,2) )
167         END DO
168         CALL fld_fill( sf_obc(9:12), sn_obcn, cn_dir, 'obc_dta_init', 'fill north OBC', 'namobc_dta' )
169      ENDIF
170 
171      IF ( lp_obc_south ) THEN
172         DO ifpr= 13, 16
173            ALLOCATE( sf_obc(ifpr)%fnow(jpi,jpk,1) )
174            IF( sn_obcs(ifpr-12)%ln_tint ) ALLOCATE( sf_obc(ifpr)%fdta(jpi,jpk,1,2) )
175         END DO
176         CALL fld_fill( sf_obc(13:16), sn_obcs, cn_dir, 'obc_dta_init', 'fill south OBC', 'namobc_dta' )
177      ENDIF
178
179   END SUBROUTINE obc_dta_init
180
181#else
182      !!------------------------------------------------------------------------------
183      !!   default option:           Dummy module          NO Open Boundary Conditions
184      !!------------------------------------------------------------------------------
185   CONTAINS
186      SUBROUTINE obc_dta( kt )             ! Dummy routine
187         INTEGER, INTENT (in) :: kt
188         WRITE(*,*) 'obc_dta: You should not have seen this print! error?', kt
189      END SUBROUTINE obc_dta
190#endif
191
192   !!======================================================================
193   END MODULE obcdta
Note: See TracBrowser for help on using the repository browser.