New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
bdy_oce.F90 in branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/NEMO/OPA_SRC/BDY – NEMO

source: branches/2013/dev_r3858_NOC_ZTC/NEMOGCM/NEMO/OPA_SRC/BDY/bdy_oce.F90 @ 4267

Last change on this file since 4267 was 4267, checked in by davestorkey, 11 years ago

Bug fixes. Now compiles with key_bdy.

  • Property svn:keywords set to Id
File size: 9.5 KB
Line 
1MODULE bdy_oce
2   !!======================================================================
3   !!                       ***  MODULE bdy_oce   ***
4   !! Unstructured Open Boundary Cond. :   define related variables
5   !!======================================================================
6   !! History :  1.0  !  2001-05  (J. Chanut, A. Sellar)  Original code
7   !!            3.0  !  2008-04  (NEMO team)  add in the reference version     
8   !!            3.3  !  2010-09  (D. Storkey) add ice boundary conditions
9   !!            3.4  !  2011     (D. Storkey) rewrite in preparation for OBC-BDY merge
10   !!----------------------------------------------------------------------
11#if defined key_bdy 
12   !!----------------------------------------------------------------------
13   !!   'key_bdy'                      Unstructured Open Boundary Condition
14   !!----------------------------------------------------------------------
15   USE par_oce         ! ocean parameters
16   USE bdy_par         ! Unstructured boundary parameters
17   USE lib_mpp         ! distributed memory computing
18
19   IMPLICIT NONE
20   PUBLIC
21
22   TYPE, PUBLIC ::   OBC_INDEX    !: Indices and weights which define the open boundary
23      INTEGER,          DIMENSION(jpbgrd) ::  nblen
24      INTEGER,          DIMENSION(jpbgrd) ::  nblenrim
25      INTEGER, POINTER, DIMENSION(:,:)   ::  nbi
26      INTEGER, POINTER, DIMENSION(:,:)   ::  nbj
27      INTEGER, POINTER, DIMENSION(:,:)   ::  nbr
28      INTEGER, POINTER, DIMENSION(:,:)   ::  nbmap
29      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  nbw
30      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  nbd
31      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  nbdout
32      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  flagu
33      REAL(wp)   , POINTER, DIMENSION(:,:)   ::  flagv
34   END TYPE OBC_INDEX
35
36   !! Logicals in OBC_DATA structure are true if the chosen algorithm requires this
37   !! field as external data. If true the data can come from external files
38   !! or model initial conditions. If false then no "external" data array
39   !! is required for this field.
40
41   TYPE, PUBLIC ::   OBC_DATA     !: Storage for external data
42      INTEGER,       DIMENSION(2)     ::  nread
43      LOGICAL                         ::  ll_ssh
44      LOGICAL                         ::  ll_u2d
45      LOGICAL                         ::  ll_v2d
46      LOGICAL                         ::  ll_u3d
47      LOGICAL                         ::  ll_v3d
48      LOGICAL                         ::  ll_tem
49      LOGICAL                         ::  ll_sal
50      REAL(wp), POINTER, DIMENSION(:)     ::  ssh
51      REAL(wp), POINTER, DIMENSION(:)     ::  u2d
52      REAL(wp), POINTER, DIMENSION(:)     ::  v2d
53      REAL(wp), POINTER, DIMENSION(:,:)   ::  u3d
54      REAL(wp), POINTER, DIMENSION(:,:)   ::  v3d
55      REAL(wp), POINTER, DIMENSION(:,:)   ::  tem
56      REAL(wp), POINTER, DIMENSION(:,:)   ::  sal
57#if defined key_lim2
58      LOGICAL                         ::  ll_frld
59      LOGICAL                         ::  ll_hicif
60      LOGICAL                         ::  ll_hsnif
61      REAL(wp), POINTER, DIMENSION(:)     ::  frld
62      REAL(wp), POINTER, DIMENSION(:)     ::  hicif
63      REAL(wp), POINTER, DIMENSION(:)     ::  hsnif
64#endif
65   END TYPE OBC_DATA
66
67   !!----------------------------------------------------------------------
68   !! Namelist variables
69   !!----------------------------------------------------------------------
70   CHARACTER(len=80), DIMENSION(jp_bdy) ::   cn_coords_file !: Name of bdy coordinates file
71   CHARACTER(len=80)                    ::   cn_mask_file   !: Name of bdy mask file
72   !
73   LOGICAL, DIMENSION(jp_bdy) ::   ln_coords_file           !: =T read bdy coordinates from file;
74   !                                                        !: =F read bdy coordinates from namelist
75   LOGICAL                    ::   ln_mask_file             !: =T read bdymask from file
76   LOGICAL                    ::   ln_vol                   !: =T volume correction             
77   !
78   INTEGER                    ::   nb_bdy                   !: number of open boundary sets
79   INTEGER, DIMENSION(jp_bdy) ::   nn_rimwidth              !: boundary rim width for Flow Relaxation Scheme
80   INTEGER                    ::   nn_volctl                !: = 0 the total volume will have the variability of the surface Flux E-P
81   !                                                        !  = 1 the volume will be constant during all the integration.
82   CHARACTER(len=20), DIMENSION(jp_bdy) ::   cn_dyn2d       ! Choice of boundary condition for barotropic variables (U,V,SSH)
83   INTEGER, DIMENSION(jp_bdy)           ::   nn_dyn2d_dta   !: = 0 use the initial state as bdy dta ;
84                                                            !: = 1 read it in a NetCDF file
85                                                            !: = 2 read tidal harmonic forcing from a NetCDF file
86                                                            !: = 3 read external data AND tidal harmonic forcing from NetCDF files
87   CHARACTER(len=20), DIMENSION(jp_bdy) ::   cn_dyn3d       ! Choice of boundary condition for baroclinic velocities
88   INTEGER, DIMENSION(jp_bdy)           ::   nn_dyn3d_dta   !: = 0 use the initial state as bdy dta ;
89                                                            !: = 1 read it in a NetCDF file
90   CHARACTER(len=20), DIMENSION(jp_bdy) ::   cn_tra         ! Choice of boundary condition for active tracers (T and S)
91   INTEGER, DIMENSION(jp_bdy)           ::   nn_tra_dta     !: = 0 use the initial state as bdy dta ;
92                                                            !: = 1 read it in a NetCDF file
93   LOGICAL, DIMENSION(jp_bdy) ::   ln_tra_dmp               !: =T Tracer damping
94   LOGICAL, DIMENSION(jp_bdy) ::   ln_dyn3d_dmp             !: =T Baroclinic velocity damping
95   REAL(wp),    DIMENSION(jp_bdy) ::   rn_time_dmp              !: Damping time scale in days
96   REAL(wp),    DIMENSION(jp_bdy) ::   rn_time_dmp_out          !: Damping time scale in days at radiation outflow points
97
98#if defined key_lim2
99   CHARACTER(len=20), DIMENSION(jp_bdy) ::   nn_ice_lim2      ! Choice of boundary condition for sea ice variables
100   INTEGER, DIMENSION(jp_bdy)           ::   nn_ice_lim2_dta  !: = 0 use the initial state as bdy dta ;
101                                                              !: = 1 read it in a NetCDF file
102#endif
103   !
104   
105   !!----------------------------------------------------------------------
106   !! Global variables
107   !!----------------------------------------------------------------------
108   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), TARGET ::   bdytmask   !: Mask defining computational domain at T-points
109   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), TARGET ::   bdyumask   !: Mask defining computational domain at U-points
110   REAL(wp), ALLOCATABLE, SAVE, DIMENSION(:,:), TARGET ::   bdyvmask   !: Mask defining computational domain at V-points
111
112   REAL(wp)                                    ::   bdysurftot !: Lateral surface of unstructured open boundary
113
114   REAL(wp), POINTER, DIMENSION(:,:)           ::   pssh                  !:
115   REAL(wp), POINTER, DIMENSION(:,:)           ::   phur                  !:
116   REAL(wp), POINTER, DIMENSION(:,:)           ::   phvr                  !: Pointers for barotropic fields
117   REAL(wp), POINTER, DIMENSION(:,:)           ::   pub2d, pun2d, pua2d   !:
118   REAL(wp), POINTER, DIMENSION(:,:)           ::   pvb2d, pvn2d, pva2d   !:
119
120   !!----------------------------------------------------------------------
121   !! open boundary data variables
122   !!----------------------------------------------------------------------
123
124   INTEGER,  DIMENSION(jp_bdy)                     ::   nn_dta            !: =0 => *all* data is set to initial conditions
125                                                                          !: =1 => some data to be read in from data files
126   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::   dta_global        !: workspace for reading in global data arrays (unstr.  bdy)
127   REAL(wp), ALLOCATABLE, DIMENSION(:,:,:), TARGET ::   dta_global2       !: workspace for reading in global data arrays (struct. bdy)
128   TYPE(OBC_INDEX), DIMENSION(jp_bdy), TARGET      ::   idx_bdy           !: bdy indices (local process)
129   TYPE(OBC_DATA) , DIMENSION(jp_bdy), TARGET      ::   dta_bdy           !: bdy external data (local process)
130
131   !!----------------------------------------------------------------------
132   !! NEMO/OPA 4.0 , NEMO Consortium (2011)
133   !! $Id$
134   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
135   !!----------------------------------------------------------------------
136CONTAINS
137
138   FUNCTION bdy_oce_alloc()
139      !!----------------------------------------------------------------------
140      USE lib_mpp, ONLY: ctl_warn, mpp_sum
141      !
142      INTEGER :: bdy_oce_alloc
143      !!----------------------------------------------------------------------
144      !
145      ALLOCATE( bdytmask(jpi,jpj) , bdyumask(jpi,jpj), bdyvmask(jpi,jpj),     & 
146         &      STAT=bdy_oce_alloc )
147         !
148      IF( lk_mpp             )   CALL mpp_sum ( bdy_oce_alloc )
149      IF( bdy_oce_alloc /= 0 )   CALL ctl_warn('bdy_oce_alloc: failed to allocate arrays.')
150      !
151   END FUNCTION bdy_oce_alloc
152
153#else
154   !!----------------------------------------------------------------------
155   !!   Dummy module                NO Unstructured Open Boundary Condition
156   !!----------------------------------------------------------------------
157   LOGICAL ::   ln_tides = .false.  !: =T apply tidal harmonic forcing along open boundaries
158#endif
159
160   !!======================================================================
161END MODULE bdy_oce
162
Note: See TracBrowser for help on using the repository browser.