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.
sbcget.F90 in branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC – NEMO

source: branches/UKMO/dev_3841_sbc/NEMOGCM/NEMO/OPA_SRC/SBC/sbcget.F90 @ 4827

Last change on this file since 4827 was 4827, checked in by charris, 9 years ago

Some demonstration code changes.

File size: 6.8 KB
Line 
1MODULE sbcget
2   !!======================================================================
3   !!                       ***  MODULE  sbcget  ***
4   !! Ocean forcing:  get input field for surface boundary condition
5   !!=====================================================================
6
7   !!----------------------------------------------------------------------
8   !!   fld_read      : read input fields used for the computation of the
9   !!                   surface boundary condition
10   !!----------------------------------------------------------------------
11   USE oce             ! ocean dynamics and tracers
12   USE dom_oce         ! ocean space and time domain
13   USE phycst          ! ???
14   USE in_out_manager  ! I/O manager
15   USE iom             ! I/O manager library
16   USE lib_mpp         ! MPP library
17   USE wrk_nemo        ! work arrays
18   USE timing
19   USE fldread2
20   USE fld_def
21   USE sbc_ice
22#if defined key_cice
23   USE ice_domain_size, only: ncat
24#endif
25   USE cpl_oasis3      ! OASIS3 coupling
26
27   IMPLICIT NONE
28   PRIVATE   
29
30   PUBLIC  sbc_get_init, sbc_get
31
32#if defined key_cice
33   INTEGER, PUBLIC, PARAMETER ::   jpl = ncat 
34#elif ! defined key_lim2   &&   ! defined key_lim3
35   INTEGER, PUBLIC, PARAMETER ::   jpl = 1 
36#endif
37
38   TYPE(FLD), PUBLIC, ALLOCATABLE, DIMENSION(:) ::   sf   ! structure of input fields (file informations, fields read)
39
40   !!----------------------------------------------------------------------
41   !! NEMO/OPA 3.3 , NEMO Consortium (2010)
42   !! $Id: fldread.F90 3851 2013-03-27 10:03:54Z smasson $
43   !! Software governed by the CeCILL licence     (NEMOGCM/NEMO_CeCILL.txt)
44   !!----------------------------------------------------------------------
45CONTAINS
46
47   SUBROUTINE sbc_get_init(  )
48      !!---------------------------------------------------------------------
49      !!                    ***  ROUTINE sbc_get_init  ***
50      !!
51      !! ** Purpose :  - read namelists, initialise stuff
52      !!----------------------------------------------------------------------
53      TYPE(FLD_N) ::   sn_wndi, sn_wndj, sn_otx1, sn_oty1, sn_otz1, sn_otx2, sn_oty2, sn_otz2,  sn_itx1, sn_ity1, sn_itz1, sn_itx2, sn_ity2, sn_itz2
54      TYPE(FLD_N) ::   sn_qsroce, sn_qnsoce, sn_qlw, sn_tair, sn_humi, sn_prec, sn_rain, sn_snow, sn_tevp, sn_ievp, sn_tdif, sn_w10m, sn_qtot
55      TYPE(FLD_N) ::   sn_oemp, sn_rnf, sn_cal, sn_topm, sn_botm, sn_qsrice, sn_qsrmix, sn_qnsice, sn_qnsmix, sn_taum, sn_sbpr, sn_semp, sn_dqnsdt, sn_co2
56      TYPE(FLD_N), DIMENSION(jpfld) ::   slf_i
57      INTEGER ::   jn       ! dummy loop index
58      INTEGER ::   ierror   ! return error code
59      CHARACTER(len=100) ::  cn_dir   !   Root directory for location of core files
60      NAMELIST/namsbc_get/ cn_dir , sn_wndi, sn_wndj, sn_otx1, sn_oty1, sn_otz1, sn_otx2, sn_oty2, sn_otz2,  sn_itx1, sn_ity1, sn_itz1, sn_itx2, sn_ity2, sn_itz2, sn_qsroce, sn_qnsoce, sn_qlw, sn_tair, sn_humi, sn_prec, sn_rain, sn_snow, sn_tevp, sn_ievp, sn_tdif, sn_w10m, sn_qtot, sn_oemp, sn_rnf, sn_cal, sn_topm, sn_botm, sn_qsrice, sn_qsrmix, sn_qnsice, sn_qnsmix, sn_taum, sn_sbpr, sn_semp, sn_dqnsdt, sn_co2
61      !!---------------------------------------------------------------------
62      !
63      IF( nn_timing == 1 )  CALL timing_start('sbc_get_init')
64
65      ! set file information (default values)
66      cn_dir = './'       ! directory in which the model is executed
67
68      REWIND( numnam )                    ! ... read namlist namsbc_get
69      READ  ( numnam, namsbc_get )
70
71      slf_i(jp_wndi) = sn_wndi     ;   slf_i(jp_wndj) = sn_wndj
72      slf_i(jp_otx1) = sn_otx1     ;   slf_i(jp_oty1) = sn_oty1     ;  slf_i(jp_otz1) = sn_otz1
73      slf_i(jp_otx2) = sn_otx2     ;   slf_i(jp_oty2) = sn_oty2     ;  slf_i(jp_otz2) = sn_otz2
74      slf_i(jp_itx1) = sn_itx1     ;   slf_i(jp_ity1) = sn_ity1     ;  slf_i(jp_itz1) = sn_itz1
75      slf_i(jp_itx1) = sn_itx2     ;   slf_i(jp_ity2) = sn_ity2     ;  slf_i(jp_itz2) = sn_itz2
76      slf_i(jp_qsroce) = sn_qsroce ;   slf_i(jp_qsrice) = sn_qsrice ;  slf_i(jp_qsrmix) = sn_qsrmix 
77      slf_i(jp_qnsoce) = sn_qnsoce ;   slf_i(jp_qnsice) = sn_qnsice ;  slf_i(jp_qnsmix) = sn_qnsmix 
78      slf_i(jp_qlw)  = sn_qlw      ;   slf_i(jp_tair) = sn_tair     ;  slf_i(jp_humi) = sn_humi 
79      slf_i(jp_prec) = sn_prec     ;   slf_i(jp_rain) = sn_rain     ;  slf_i(jp_snow) = sn_snow     
80      slf_i(jp_tevp) = sn_tevp     ;   slf_i(jp_ievp) = sn_ievp     ;  slf_i(jp_tdif) = sn_tdif
81      slf_i(jp_taum) = sn_taum     ;   slf_i(jp_w10m) = sn_w10m     ;  slf_i(jp_qtot) = sn_qtot
82      slf_i(jp_sbpr) = sn_sbpr     ;   slf_i(jp_semp) = sn_semp     ;  slf_i(jp_oemp) = sn_oemp     
83      slf_i(jp_rnf)  = sn_rnf      ;   slf_i(jp_cal)  = sn_cal      ;  slf_i(jp_topm) = sn_topm
84      slf_i(jp_botm) = sn_botm     ;   slf_i(jp_dqnsdt) = sn_dqnsdt ;  slf_i(jp_co2) = sn_co2
85
86      ALLOCATE( sf(jpfld), STAT=ierror )         ! set sf structure
87      IF( ierror > 0 )   CALL ctl_stop( 'STOP', 'sbc_cpl: unable to allocate sf structure' )
88
89      CALL fld_fill2( sf, slf_i, jpl, cn_dir, 'sbc_get', 'coupled formulation for ocean surface boundary condition', 'namsbc_get' )
90
91      ! Allocate all parts of sf used for received fields
92      DO jn = 1, jpfld
93         IF ( sf(jn)%loasis .OR. sf(jn)%lfile ) ALLOCATE( sf(jn)%fnow(jpi,jpj,sf(jn)%nct) )
94         IF ( sf(jn)%lfile .AND. sf(jn)%ln_tint ) ALLOCATE( sf(jn)%fdta(jpi,jpj,sf(jn)%nct,2) )
95      END DO
96
97      ! Allocate taum part of sf which is used even when not received as coupling field
98      IF ( .NOT. sf(jp_taum)%loasis ) ALLOCATE( sf(jp_taum)%fnow(jpi,jpj,sf(jn)%nct) )
99
100! **WE REALLY NEED A WHOLE LOAD OF CHECKS THAT NAMSBC_GET IS CONSISTENT WITH OTHER CHOICES RE COUPLED / BULK ETC  BUT DO THIS LATER** ! **MAY REQUIRE CHANGES TO OTHER NAME-LIST STRUCTURES** !
101
102      IF( nn_timing == 1 )  CALL timing_stop('sbc_get_init')
103
104   END SUBROUTINE sbc_get_init
105
106   SUBROUTINE sbc_get( kt )
107      !!---------------------------------------------------------------------
108      !!                    ***  ROUTINE sbc_get  ***
109      !!
110      !! ** Purpose :   get the data
111      !!----------------------------------------------------------------------
112      INTEGER, INTENT(in) ::   kt       ! ocean model time step index
113      INTEGER ::   jn       ! dummy loop index
114      INTEGER  ::   isec                   ! number of seconds since nit000 (assuming rdttra did not change since nit000)
115
116      isec = ( kt - nit000 ) * NINT( rdttra(1) )             ! date of exchanges
117
118      DO jn= 1, jpfld
119         IF( sf(jn)%lfile )  CALL fld_read2( kt, nn_fsbc, sf(jn:jn) )  ! input fields provided at the current time-step
120         IF( sf(jn)%loasis )  CALL cpl_prism_rcv( isec, sf(jn) )        ! input fields provided at the current time-step
121      END DO
122
123! Need to sort out where / how rotation should work....
124      CALL fld_rot2( kt, sf )                    ! rotate vector before/now/after fields if needed
125
126   END SUBROUTINE sbc_get
127
128END MODULE sbcget
Note: See TracBrowser for help on using the repository browser.