SURFEX  V8_0
Surfex V8_0 release
 All Classes Files Functions Variables
writesurf_seaflux_sbln.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 writesurf_seaflux_sbl_n (DGU, U, &
7  s, ssb, &
8  hprogram,hwrite)
9 ! ####################################
10 !
11 !!**** *WRITE_SEAFLUX_n* - writes SEAFLUX fields
12 !!
13 !! PURPOSE
14 !! -------
15 !!
16 !!** METHOD
17 !! ------
18 !!
19 !! EXTERNAL
20 !! --------
21 !!
22 !!
23 !! IMPLICIT ARGUMENTS
24 !! ------------------
25 !!
26 !! REFERENCE
27 !! ---------
28 !!
29 !!
30 !! AUTHOR
31 !! ------
32 !! V. Masson *Meteo France*
33 !!
34 !! MODIFICATIONS
35 !! -------------
36 !! Original 01/2003
37 !! E. Martin 01/2012 avoid write of XUNDEF fields
38 !-------------------------------------------------------------------------------
39 !
40 !* 0. DECLARATIONS
41 ! ------------
42 !
43 !
44 !
45 !
46 !
47 !
48 !
50 USE modd_surf_atm_n, ONLY : surf_atm_t
51 !
52 USE modd_seaflux_n, ONLY : seaflux_t
54 !
56 !
57 !
58 USE yomhook ,ONLY : lhook, dr_hook
59 USE parkind1 ,ONLY : jprb
60 !
61 IMPLICIT NONE
62 !
63 !* 0.1 Declarations of arguments
64 ! -------------------------
65 !
66 !
67 !
68 TYPE(diag_surf_atm_t), INTENT(INOUT) :: dgu
69 TYPE(surf_atm_t), INTENT(INOUT) :: u
70 !
71 TYPE(seaflux_t), INTENT(INOUT) :: s
72 TYPE(seaflux_sbl_t), INTENT(INOUT) :: ssb
73 !
74  CHARACTER(LEN=6), INTENT(IN) :: hprogram ! program calling
75  CHARACTER(LEN=3), INTENT(IN) :: hwrite ! 'PREP' : does not write SBL XUNDEF fields
76 ! ! 'ALL' : all fields are written
77 !
78 !* 0.2 Declarations of local variables
79 ! -------------------------------
80 !
81 INTEGER :: iresp ! IRESP : return-code if a problem appears
82  CHARACTER(LEN=12) :: yrecfm ! Name of the article to be read
83  CHARACTER(LEN=100):: ycomment ! Comment string
84 !
85 INTEGER :: jlayer ! loop counter on layers
86 REAL(KIND=JPRB) :: zhook_handle
87 !-------------------------------------------------------------------------------
88 !
89 !* 1. Prognostic fields:
90 ! -----------------
91 !
92 !* flag to define if SBL is computed
93 !
94 IF (lhook) CALL dr_hook('WRITESURF_SEAFLUX_SBL_N',0,zhook_handle)
95 yrecfm='SEA_SBL'
96 ycomment='flag to use SBL levels'
97  CALL write_surf(dgu, u, &
98  hprogram,yrecfm,s%LSBL,iresp,hcomment=ycomment)
99 !
100 IF (.NOT. s%LSBL .AND. lhook) CALL dr_hook('WRITESURF_SEAFLUX_SBL_N',1,zhook_handle)
101 IF (.NOT. s%LSBL) RETURN
102 !
103 !* number of levels
104 !
105 yrecfm='SEA_SBL_LVL'
106 ycomment='number of SBL levels'
107  CALL write_surf(dgu, u, &
108  hprogram,yrecfm,ssb%NLVL,iresp,hcomment=ycomment)
109 !
110 !* altitudes
111 !
112 DO jlayer=1,ssb%NLVL
113  WRITE(yrecfm,'(A9,I2.2,A1)') 'SEA_SBL_Z',jlayer,' '
114  ycomment='altitudes of SBL levels (m)'
115  CALL write_surf(dgu, u, &
116  hprogram,yrecfm,ssb%XZ(:,jlayer),iresp,hcomment=ycomment)
117 END DO
118 !
119 IF (hwrite/='PRE') THEN
120  !
121  !* wind in SBL
122  !
123  DO jlayer=1,ssb%NLVL
124  WRITE(yrecfm,'(A9,I2.2,A1)') 'SEA_SBL_U',jlayer,' '
125  ycomment='wind at SBL levels (m/s)'
126  CALL write_surf(dgu, u, &
127  hprogram,yrecfm,ssb%XU(:,jlayer),iresp,hcomment=ycomment)
128  END DO
129  !
130  !* temperature in SBL
131  !
132  DO jlayer=1,ssb%NLVL
133  WRITE(yrecfm,'(A9,I2.2,A1)') 'SEA_SBL_T',jlayer,' '
134  ycomment='temperature at SBL levels (K)'
135  CALL write_surf(dgu, u, &
136  hprogram,yrecfm,ssb%XT(:,jlayer),iresp,hcomment=ycomment)
137  END DO
138  !
139  !* humidity in SBL
140  !
141  DO jlayer=1,ssb%NLVL
142  WRITE(yrecfm,'(A9,I2.2,A1)') 'SEA_SBL_Q',jlayer,' '
143  ycomment='humidity at SBL levels (kg/m3)'
144  CALL write_surf(dgu, u, &
145  hprogram,yrecfm,ssb%XQ(:,jlayer),iresp,hcomment=ycomment)
146  END DO
147  !
148  !* Tke in SBL
149  !
150  DO jlayer=1,ssb%NLVL
151  WRITE(yrecfm,'(A9,I2.2,A1)') 'SEA_SBL_E',jlayer,' '
152  ycomment='Tke at SBL levels (m2/s2)'
153  CALL write_surf(dgu, u, &
154  hprogram,yrecfm,ssb%XTKE(:,jlayer),iresp,hcomment=ycomment)
155  END DO
156  !
157  !* Monin-Obhukov length
158  !
159  yrecfm='SEA_SBL_LMO '
160  CALL write_surf(dgu, u, &
161  hprogram,yrecfm,ssb%XLMO(:),iresp,hcomment=ycomment)
162  !
163  !* Air pressure in SBL
164  !
165  DO jlayer=1,ssb%NLVL
166  WRITE(yrecfm,'(A9,I2.2,A1)') 'SEA_SBL_P',jlayer,' '
167  ycomment='Pressure at SBL levels (Pa)'
168  CALL write_surf(dgu, u, &
169  hprogram,yrecfm,ssb%XP(:,jlayer),iresp,hcomment=ycomment)
170  END DO
171  !
172 ENDIF
173 !
174 IF (lhook) CALL dr_hook('WRITESURF_SEAFLUX_SBL_N',1,zhook_handle)
175 !
176 !
177 !-------------------------------------------------------------------------------
178 !
179 END SUBROUTINE writesurf_seaflux_sbl_n
subroutine writesurf_seaflux_sbl_n(DGU, U, S, SSB, HPROGRAM, HWRITE)