SURFEX v8.1
General documentation of Surfex
soiltemp_arp_par.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 soiltemp_arp_par (IO, HPROGRAM)
7 ! ##############################################################
8 !
9 !!**** *SOILTEMP_ARP_PAR* Impose special pseudo depth for "force-restore"
10 !! multilayer deep temperature
11 !!
12 !! PURPOSE
13 !! -------
14 !!
15 !! METHOD
16 !! ------
17 !!
18 !
19 !! EXTERNAL
20 !! --------
21 !!
22 !! IMPLICIT ARGUMENTS
23 !! ------------------
24 !!
25 !! REFERENCE
26 !! ---------
27 !!
28 !! AUTHOR
29 !! ------
30 !!
31 !! B. Decharme Meteo-France
32 !!
33 !! MODIFICATION
34 !! ------------
35 !!
36 !! Original 03/2009
37 !!
38 !!
39 !----------------------------------------------------------------------------
40 !
41 !* 0. DECLARATION
42 ! -----------
43 !
45 !
46 USE modd_surf_par, ONLY : xundef
47 USE modd_read_namelist, ONLY : lnam_read
48 !
49 !
51 !
52 USE modi_get_luout
53 USE modi_open_namelist
54 USE modi_close_namelist
55 !
56 USE mode_pos_surf
57 !
58 !
59 USE yomhook ,ONLY : lhook, dr_hook
60 USE parkind1 ,ONLY : jprb
61 !
62 USE modi_abor1_sfx
63 !
64 IMPLICIT NONE
65 !
66 !* 0.1 Declaration of arguments
67 ! ------------------------
68 !
69 !
70 TYPE(isba_options_t), INTENT(INOUT) :: IO
71 !
72 
73  CHARACTER(LEN=6), INTENT(IN) :: HPROGRAM ! Type of program
74 !
75 !* 0.2 Declaration of local variables
76 ! ------------------------------
77 !
78 INTEGER :: ILUOUT ! output listing logical unit
79 INTEGER :: ILUNAM ! namelist file logical unit
80 LOGICAL :: GFOUND ! true if namelist is found
81 REAL(KIND=JPRB) :: ZHOOK_HANDLE
82 !
83 !* 0.3 Declaration of namelists
84 ! ------------------------
85 !
86 !
87 !-------------------------------------------------------------------------------
88 !
89 !* 1. Initializations
90 ! ---------------
91 !
92 
93 IF (lhook) CALL dr_hook('SOILTEMP_ARP_PAR',0,zhook_handle)
94 !
95  CALL get_luout(hprogram,iluout)
96 !
97 IF (lnam_read) THEN
98 
99  sodelx(:) = xundef
100  ltemp_arp = .false.
101  ntemplayer_arp = 4
102  !
103  !-------------------------------------------------------------------------------
104  !
105  !* 2. Input value for SODELX variable
106  ! -------------------------------
107  !
108  CALL open_namelist(hprogram,ilunam)
109  !
110  CALL posnam(ilunam,'NAM_SOILTEMP_ARP',gfound,iluout)
111  IF (gfound) READ(unit=ilunam,nml=nam_soiltemp_arp)
112  !
113  CALL close_namelist(hprogram,ilunam)
114 !
115 ENDIF
116 !
117 !-------------------------------------------------------------------------------
118 !
119 !* 3. Consistency
120 ! -----------
121 !
122 IF(ltemp_arp.AND.io%CISBA=='DIF')THEN
123  ltemp_arp=.false.
124  WRITE(iluout,*)'LTEMP_ARP put at False because you use the ISBA-DF scheme'
125 ENDIF
126 !
127 IF(ltemp_arp)THEN
128  IF(ntemplayer_arp>nmax_layer)THEN
129  WRITE(iluout,*)'NTEMPLAYER_ARP is too big (>10), NTEMPLAYER_ARP= ',ntemplayer_arp
130  CALL abor1_sfx('NTEMPLAYER_ARP is too big (>10)')
131  ELSEIF(ntemplayer_arp<4)THEN
132  WRITE(iluout,*)'NTEMPLAYER_ARP must be at least equal to 4, NTEMPLAYER_ARP= ',ntemplayer_arp
133  CALL abor1_sfx('NTEMPLAYER_ARP must be at least equal to 4')
134  ENDIF
135  IF(count(sodelx(1:ntemplayer_arp)/=xundef)>0.AND. &
137  WRITE(iluout,*)'Number of SODELX imposed values =',count(sodelx(1:ntemplayer_arp)/=xundef),&
138  ' /= NTEMPLAYER_ARP= ',ntemplayer_arp
139  CALL abor1_sfx('SODELX imposed values /= NTEMPLAYER_ARP')
140  ENDIF
141 ENDIF
142 !
143 !-------------------------------------------------------------------------------
144 !
145 !* 4. Initialization
146 ! -------------------------------
147 !
148 IF(ltemp_arp)THEN
149 !
150  ALLOCATE(io%XSODELX(ntemplayer_arp))
151 !
152  IF(all(sodelx(:)==xundef))THEN
153 !
154  io%XSODELX(1)=0.5
155  io%XSODELX(2)=1.5
156  io%XSODELX(3)=4.5
157  io%XSODELX(4)=13.5
158  WRITE(iluout,*)'SODELX default values : ',io%XSODELX(:)
159 !
160  ELSE
161 !
162  io%XSODELX(:)=sodelx(1:ntemplayer_arp)
163  WRITE(iluout,*)'SODELX imposed to : ',io%XSODELX(:)
164 !
165  ENDIF
166 !
167 ELSE
168 !
169  ALLOCATE(io%XSODELX(0))
170 !
171 ENDIF
172 !
173 io%LTEMP_ARP =ltemp_arp
174 io%NTEMPLAYER_ARP=ntemplayer_arp
175 IF (lhook) CALL dr_hook('SOILTEMP_ARP_PAR',1,zhook_handle)
176 !
177 !-------------------------------------------------------------------------------
178 !
179 END SUBROUTINE soiltemp_arp_par
real, dimension(nmax_layer) sodelx
subroutine posnam(KULNAM, HDNAML, OFOUND, KLUOUT)
subroutine abor1_sfx(YTEXT)
Definition: abor1_sfx.F90:7
real, parameter xundef
integer, parameter nmax_layer
integer, parameter jprb
Definition: parkind1.F90:32
subroutine close_namelist(HPROGRAM, KLUNAM)
subroutine get_luout(HPROGRAM, KLUOUT)
Definition: get_luout.F90:7
logical lhook
Definition: yomhook.F90:15
subroutine open_namelist(HPROGRAM, KLUNAM, HFILE)
subroutine soiltemp_arp_par(IO, HPROGRAM)
static int count
Definition: memory_hook.c:21