43 lcpl_land, lcpl_gw, lcpl_flood, &
44 lcpl_calving, lcpl_lake, &
50 USE modi_open_namelist
51 USE modi_close_namelist
55 USE yomhook
,ONLY : lhook, dr_hook
56 USE parkind1
,ONLY : jprb
63 CHARACTER(LEN=6),
INTENT(IN) :: hprogram
64 REAL,
INTENT(IN) :: ptstep_surf
65 CHARACTER(LEN=3),
INTENT(IN),
OPTIONAL :: hinit
70 INTEGER,
PARAMETER :: kin = 1
71 INTEGER,
PARAMETER :: kout = 0
72 CHARACTER(LEN=5),
PARAMETER :: yland =
'land'
73 CHARACTER(LEN=5),
PARAMETER :: ylake =
'lake'
74 CHARACTER(LEN=5),
PARAMETER :: ysea =
'ocean'
82 CHARACTER(LEN=20) :: ykey
83 CHARACTER(LEN=50) :: ycomment
84 CHARACTER(LEN=3) :: yinit
86 REAL(KIND=JPRB) :: zhook_handle
90 IF (lhook) CALL dr_hook(
'SFX_OASIS_READ_NAM',0,zhook_handle)
99 lcpl_calving = .false.
102 lcpl_seaice = .false.
105 IF (lhook) CALL dr_hook(
'SFX_OASIS_READ_NAM',1,zhook_handle)
110 IF(present(hinit))yinit=hinit
119 CALL
posnam(ilunam,
'NAM_SFX_LAND_CPL',gfound,iluout)
122 READ(unit=ilunam,nml=nam_sfx_land_cpl)
124 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
125 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
126 WRITE(iluout,*)
'NAM_SFX_LAND_CPL not found : Surfex land not coupled with river routing'
127 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
128 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
131 CALL
posnam(ilunam,
'NAM_SFX_SEA_CPL',gfound,iluout)
134 READ(unit=ilunam,nml=nam_sfx_sea_cpl)
136 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
137 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
138 WRITE(iluout,*)
'NAM_SFX_SEA_CPL not found : Surfex sea not coupled with ocean model'
139 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
140 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
143 CALL
posnam(ilunam,
'NAM_SFX_LAKE_CPL',gfound,iluout)
146 READ(unit=ilunam,nml=nam_sfx_lake_cpl)
148 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
149 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
150 WRITE(iluout,*)
'NAM_SFX_LAKE_CPL not found : Surfex lake not coupled with ocean model'
151 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
152 WRITE(iluout,*)
'!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'
157 IF(xtstep_cpl_land>0.0)lcpl_land=.true.
158 IF(xtstep_cpl_lake>0.0)lcpl_lake=.true.
159 IF(xtstep_cpl_sea >0.0)lcpl_sea =.true.
161 IF(.NOT.lcpl_land.AND..NOT.lcpl_sea)
THEN
162 CALL
abor1_sfx(
'SFX_OASIS_READ_NAM: OASIS USED BUT NAMELIST NOT FOUND')
171 IF(mod(xruntime,ptstep_surf)/=0.)
THEN
172 WRITE(iluout,*)
'! MOD(XRUNTIME,XTSTEP_SURF)/=0 !!!'
173 WRITE(iluout,*)
'! XTSTEP_SURF (model timestep) must be a multiple of $RUNTIME in oasis namcouple !!!'
174 CALL
abor1_sfx(
'SFX_OASIS_READ_NAM: XTSTEP_SURF must be a multiple of $RUNTIME in oasis namcouple !!!')
186 IF(mod(xtstep_cpl_land,ptstep_surf)/=0.)
THEN
187 WRITE(iluout,*)
'! MOD(XTSTEP_SURF,XTSTEP_CPL_LAND) /= 0 !'
188 WRITE(iluout,*)
'XTSTEP_SURF =',ptstep_surf,
'XTSTEP_CPL_LAND = ',xtstep_cpl_land
189 IF(ptstep_surf>xtstep_cpl_land) &
190 WRITE(iluout,*)
'! XTSTEP_SURF (model timestep) is superiror to XTSTEP_CPL_LAND !'
191 CALL
abor1_sfx(
'SFX_OASIS_READ_NAM: XTSTEP_SURF and XTSTEP_CPL_LAND not consistent !!!')
198 ycomment=
'Surface runoff'
202 ycomment=
'Deep drainage'
207 IF(len_trim(ccalving)>0)
THEN
208 lcpl_calving = .true.
213 ycomment=
'Calving flux'
214 CALL
check_field(ccalving,ykey,ycomment,yland,kout)
219 IF(len_trim(cwtd)>0.OR.len_trim(cfwtd)>0.OR.len_trim(crecharge)>0)
THEN
228 ycomment=
'Groundwater recharge'
229 CALL
check_field(crecharge,ykey,ycomment,yland,kout)
234 ycomment=
'Water table depth'
238 ycomment=
'Fraction of WTD to rise'
245 IF(len_trim(csrcflood)>0.OR.len_trim(cfflood)>0.OR.len_trim(cpiflood)>0)
THEN
254 ycomment=
'flood freshwater flux'
255 CALL
check_field(csrcflood,ykey,ycomment,yland,kout)
260 ycomment=
'Flood fraction'
264 ycomment=
'Flood potential infiltration'
279 IF(mod(xtstep_cpl_lake,ptstep_surf)/=0.)
THEN
280 WRITE(iluout,*)
'! MOD(XTSTEP_SURF,XTSTEP_CPL_LAKE) /= 0 !'
281 WRITE(iluout,*)
'XTSTEP_SURF =',ptstep_surf,
'XTSTEP_CPL_LAKE = ',xtstep_cpl_lake
282 IF(ptstep_surf>xtstep_cpl_lake) &
283 WRITE(iluout,*)
'! XTSTEP_SURF (model timestep) is superiror to XTSTEP_CPL_LAKE !'
284 CALL
abor1_sfx(
'SFX_OASIS_READ_NAM: XTSTEP_SURF and XTSTEP_CPL_LAKE not consistent !!!')
291 ycomment=
'Evaporation rate'
292 CALL
check_field(clake_evap,ykey,ycomment,ylake,kout)
295 ycomment=
'Rainfall rate'
296 CALL
check_field(clake_rain,ykey,ycomment,ylake,kout)
299 ycomment=
'Snowfall rate'
300 CALL
check_field(clake_snow,ykey,ycomment,ylake,kout)
303 ycomment=
'Freshwater flux'
304 CALL
check_field(clake_watf,ykey,ycomment,ylake,kout)
316 IF(mod(xtstep_cpl_sea,ptstep_surf)/=0.)
THEN
317 WRITE(iluout,*)
'! MOD(XTSTEP_SURF,XTSTEP_CPL_SEA) /= 0 !'
318 WRITE(iluout,*)
'XTSTEP_SURF =',ptstep_surf,
'XTSTEP_CPL_SEA = ',xtstep_cpl_sea
319 IF(ptstep_surf>xtstep_cpl_sea) &
320 WRITE(iluout,*)
'! XTSTEP_SURF (model timestep) is superiror to XTSTEP_CPL_SEA !'
321 CALL
abor1_sfx(
'SFX_OASIS_READ_NAM: XTSTEP_SURF and XTSTEP_CPL_SEA not consistent !!!')
328 ycomment=
'zonal wind stress'
329 CALL
check_field(csea_fwsu,ykey,ycomment,ysea,kout)
332 ycomment=
'meridian wind stress'
333 CALL
check_field(csea_fwsv,ykey,ycomment,ysea,kout)
336 ycomment=
'Non solar net heat flux'
337 CALL
check_field(csea_heat,ykey,ycomment,ysea,kout)
340 ycomment=
'Solar net heat flux'
341 CALL
check_field(csea_snet,ykey,ycomment,ysea,kout)
344 ycomment=
'module of 10m wind speed'
345 CALL
check_field(csea_wind,ykey,ycomment,ysea,kout)
348 ycomment=
'module of wind stress'
349 CALL
check_field(csea_fwsm,ykey,ycomment,ysea,kout)
352 ycomment=
'Evaporation rate'
353 CALL
check_field(csea_evap,ykey,ycomment,ysea,kout)
356 ycomment=
'Rainfall rate'
357 CALL
check_field(csea_rain,ykey,ycomment,ysea,kout)
360 ycomment=
'Snowfall rate'
361 CALL
check_field(csea_snow,ykey,ycomment,ysea,kout)
364 ycomment=
'Freshwater flux'
365 CALL
check_field(csea_watf,ykey,ycomment,ysea,kout)
370 ycomment=
'Sea surface temperature'
374 ycomment=
'Sea u-current stress'
378 ycomment=
'Sea v-current stress'
383 IF(len_trim(cseaice_heat)>0.OR.len_trim(cseaice_snet)>0.OR. &
384 len_trim(cseaice_evap)>0.OR.len_trim(cseaice_sit )>0.OR. &
385 len_trim(cseaice_cvr )>0.OR.len_trim(cseaice_alb )>0 )
THEN
394 ycomment=
'Sea-ice non solar net heat flux'
395 CALL
check_field(cseaice_heat,ykey,ycomment,ysea,kout)
398 ycomment=
'Sea-ice solar net heat flux'
399 CALL
check_field(cseaice_snet,ykey,ycomment,ysea,kout)
402 ycomment=
'Sea-ice sublimation'
403 CALL
check_field(cseaice_evap,ykey,ycomment,ysea,kout)
408 ycomment=
'Sea-ice temperature'
409 CALL
check_field(cseaice_sit,ykey,ycomment,ysea,kin)
412 ycomment=
'Sea-ice cover'
413 CALL
check_field(cseaice_cvr,ykey,ycomment,ysea,kin)
416 ycomment=
'Sea-ice albedo'
417 CALL
check_field(cseaice_alb,ykey,ycomment,ysea,kin)
423 IF (lhook) CALL dr_hook(
'SFX_OASIS_READ_NAM',1,zhook_handle)
433 CHARACTER(LEN=*),
INTENT(IN) :: hfield
434 CHARACTER(LEN=*),
INTENT(IN) :: hkey
435 CHARACTER(LEN=*),
INTENT(IN) :: hcomment
436 CHARACTER(LEN=*),
INTENT(IN) :: htyp
437 INTEGER,
INTENT(IN) :: kid
439 CHARACTER(LEN=20) :: ywork
440 CHARACTER(LEN=20) :: ynamelist
441 CHARACTER(LEN=128) :: ycomment1
442 CHARACTER(LEN=128) :: ycomment2
445 REAL(KIND=JPRB) :: zhook_handle
447 IF (lhook) CALL dr_hook(
'SFX_OASIS_READ_NAM:CHECK_FIELD',0,zhook_handle)
449 IF(len_trim(hfield)==0)
THEN
452 ywork=trim(htyp)//
' - SFX'
454 ywork=
'SFX - '//trim(htyp)
459 ynamelist=
'NAM_SFX_LAND_CPL'
461 ynamelist=
'NAM_SFX_SEA_CPL'
463 ynamelist=
'NAM_SFX_LAKE_CPL'
465 CALL
abor1_sfx(
'SFX_OASIS_READ_NAM: TYPE NOT SUPPORTED OR IMPLEMENTD : '//trim(htyp))
468 ycomment1=
'SFX_OASIS_READ_NAM: '//trim(hcomment)//
' is not done for '//trim(ywork)//
' coupling'
469 ycomment2=
'SFX_OASIS_READ_NAM: Namelist key '//trim(hkey)//
' is not in '//trim(ynamelist)
471 WRITE(iluout,*)trim(ycomment1)
472 WRITE(iluout,*)trim(ycomment2)
477 IF(kid==0.AND.htyp/=yland)
THEN
489 IF (lhook) CALL dr_hook(
'SFX_OASIS_READ_NAM:CHECK_FIELD',1,zhook_handle)
subroutine sfx_oasis_read_nam(HPROGRAM, PTSTEP_SURF, HINIT)
subroutine abor1_sfx(YTEXT)
subroutine close_namelist(HPROGRAM, KLUNAM)
subroutine posnam(KULNAM, HDNAML, OFOUND, KLUOUT)
subroutine get_luout(HPROGRAM, KLUOUT)
subroutine check_field(HFIELD, HKEY, HCOMMENT, HTYP, KID)
subroutine open_namelist(HPROGRAM, KLUNAM, HFILE)