SURFEX v8.1
General documentation of Surfex
read_watfluxn.F90
Go to the documentation of this file.
1 !SFX_LIC Copyright 1994-2014 CNRS, Meteo-France and Universite Paul Sabatier
2 !SFX_LIC This is part of the SURFEX software governed by the CeCILL-C licence
3 !SFX_LIC version 1. See LICENSE, CeCILL-C_V1-en.txt and CeCILL-C_V1-fr.txt
4 !SFX_LIC for details. version 1.
5 ! #########
6  SUBROUTINE read_watflux_n (DTCO, U, W, HPROGRAM)
7 ! #########################################
8 !
9 !!**** *READ_WATFLUX_n* - reads WATFLUX variables
10 !!
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !!** METHOD
16 !! ------
17 !!
18 !! EXTERNAL
19 !! --------
20 !!
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !!
29 !! AUTHOR
30 !! ------
31 !! V. Masson *Meteo France*
32 !!
33 !! MODIFICATIONS
34 !! -------------
35 !! Original 01/2003
36 !-------------------------------------------------------------------------------
37 !
38 !* 0. DECLARATIONS
39 ! ------------
40 !
41 !
42 !
43 !
44 !
46 USE modd_surf_atm_n, ONLY : surf_atm_t
47 USE modd_watflux_n, ONLY : watflux_t
48 !
50 USE modi_interpol_ts_water_mth
51 !
52 !
53 USE yomhook ,ONLY : lhook, dr_hook
54 USE parkind1 ,ONLY : jprb
55 !
56 USE modi_get_type_dim_n
57 !
58 IMPLICIT NONE
59 !
60 !* 0.1 Declarations of arguments
61 ! -------------------------
62 !
63 !
64 TYPE(data_cover_t), INTENT(INOUT) :: DTCO
65 TYPE(surf_atm_t), INTENT(INOUT) :: U
66 TYPE(watflux_t), INTENT(INOUT) :: W
67 !
68  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! calling program
69 !
70 !
71 !* 0.2 Declarations of local variables
72 ! -------------------------------
73 !
74 INTEGER :: JMTH, INMTH
75  CHARACTER(LEN=2 ) :: YMTH
76 !
77 INTEGER :: ILU ! 1D physical dimension
78 !
79 INTEGER :: IRESP ! Error code after redding
80 !
81  CHARACTER(LEN=12) :: YRECFM ! Name of the article to be read
82 REAL(KIND=JPRB) :: ZHOOK_HANDLE
83 !
84 !-------------------------------------------------------------------------------
85 !
86 !* 1D physical dimension
87 !
88 IF (lhook) CALL dr_hook('READ_WATFLUX_N',0,zhook_handle)
89 yrecfm='SIZE_WATER'
90  CALL get_type_dim_n(dtco, u, 'WATER ',ilu)
91 !
92 !* 3. Prognostic fields:
93 ! -----------------
94 !
95 !* water temperature
96 !
97 ALLOCATE(w%XTS(ilu))
98 !
99 IF(w%LINTERPOL_TS)THEN
100 !
101 ! Initialize current Month
102  w%TZTIME%TDATE%YEAR = w%TTIME%TDATE%YEAR
103  w%TZTIME%TDATE%MONTH = w%TTIME%TDATE%MONTH
104  w%TZTIME%TDATE%DAY = w%TTIME%TDATE%DAY
105  w%TZTIME%TIME = w%TTIME%TIME
106 
107 ! Precedent, Current, Next, and Second-next Monthly SST
108  inmth=4
109 !
110  ALLOCATE(w%XTS_MTH(SIZE(w%XTS),inmth))
111  DO jmth=1,inmth
112  WRITE(ymth,'(I2)') (jmth-1)
113  yrecfm='TS_WATER'//adjustl(ymth(:len_trim(ymth)))
114  CALL read_surf(hprogram,yrecfm,w%XTS_MTH(:,jmth),iresp)
115  ENDDO
116 !
117  CALL interpol_ts_water_mth(w)
118 !
119 ELSE
120 !
121  ALLOCATE(w%XTS_MTH(0,0))
122 !
123  yrecfm='TS_WATER'
124  CALL read_surf(hprogram,yrecfm,w%XTS(:),iresp)
125 !
126 ENDIF
127 !
128 !
129 !-------------------------------------------------------------------------------
130 !
131 !* 4. Semi-prognostic fields:
132 ! ----------------------
133 !
134 !* roughness length
135 !
136 ALLOCATE(w%XZ0(ilu))
137 yrecfm='Z0WATER'
138 w%XZ0(:) = 0.001
139  CALL read_surf(hprogram,yrecfm,w%XZ0(:),iresp)
140 IF (lhook) CALL dr_hook('READ_WATFLUX_N',1,zhook_handle)
141 !
142 !-------------------------------------------------------------------------------
143 
144 !
145 END SUBROUTINE read_watflux_n
subroutine get_type_dim_n(DTCO, U, HTYPE, KDIM)
subroutine read_watflux_n(DTCO, U, W, HPROGRAM)
integer, parameter jprb
Definition: parkind1.F90:32
subroutine interpol_ts_water_mth(W)
logical lhook
Definition: yomhook.F90:15