SCALE-RM
scale_atmos_phy_sf_const.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
18 !-------------------------------------------------------------------------------
19 #include "inc_openmp.h"
21  !-----------------------------------------------------------------------------
22  !
23  !++ used modules
24  !
25  use scale_precision
26  use scale_stdio
27  use scale_prof
29  use scale_tracer
30  !-----------------------------------------------------------------------------
31  implicit none
32  private
33  !-----------------------------------------------------------------------------
34  !
35  !++ Public procedure
36  !
37  public :: atmos_phy_sf_const_setup
38  public :: atmos_phy_sf_const
39 
40  !-----------------------------------------------------------------------------
41  !
42  !++ Public parameters & variables
43  !
44  !-----------------------------------------------------------------------------
45  !
46  !++ Private procedure
47  !
48  !-----------------------------------------------------------------------------
49  !
50  !++ Private parameters & variables
51  !
52  integer, private :: ATMOS_PHY_SF_FLG_MOM_FLUX = 0 ! application type for momentum flux
53  ! 0: Bulk coefficient is constant
54  ! 1: Friction velocity is constant
55 
56  real(RP), private, parameter :: ATMOS_PHY_SF_U_maxM = 100.0_rp ! maximum limit of absolute velocity for momentum [m/s]
57  real(RP), private :: ATMOS_PHY_SF_U_minM = 0.0_rp ! minimum limit of absolute velocity for momentum [m/s]
58  real(RP), private, parameter :: ATMOS_PHY_SF_Cm_max = 2.5e-3_rp ! maximum limit of bulk coefficient for momentum [NIL]
59  real(RP), private :: ATMOS_PHY_SF_Cm_min = 1.0e-5_rp ! minimum limit of bulk coefficient for momentum [NIL]
60 
61  real(RP), private :: ATMOS_PHY_SF_Const_Ustar = 0.25_rp ! constant friction velocity [m/s]
62  real(RP), private :: ATMOS_PHY_SF_Const_Cm = 0.0011_rp ! constant bulk coefficient for momentum [NIL]
63  real(RP), private :: ATMOS_PHY_SF_Const_SH = 15.0_rp ! constant surface sensible heat flux [W/m2]
64  real(RP), private :: ATMOS_PHY_SF_Const_LH = 115.0_rp ! constant surface latent heat flux [W/m2]
65 
66  logical, private :: ATMOS_PHY_SF_FLG_SH_DIURNAL = .false. ! diurnal modulation for sensible heat flux?
67  real(RP), private :: ATMOS_PHY_SF_Const_FREQ = 24.0_rp ! frequency of sensible heat flux modulation [hour]
68 
69  !-----------------------------------------------------------------------------
70 contains
71  !-----------------------------------------------------------------------------
73  subroutine atmos_phy_sf_const_setup( ATMOS_PHY_SF_TYPE )
74  use scale_process, only: &
76  implicit none
77 
78  character(len=*), intent(in) :: atmos_phy_sf_type
79 
80  namelist / param_atmos_phy_sf_const / &
81  atmos_phy_sf_flg_mom_flux, &
82  atmos_phy_sf_u_minm, &
83  atmos_phy_sf_cm_min, &
84  atmos_phy_sf_const_ustar, &
85  atmos_phy_sf_const_cm, &
86  atmos_phy_sf_const_sh, &
87  atmos_phy_sf_const_lh, &
88  atmos_phy_sf_flg_sh_diurnal, &
89  atmos_phy_sf_const_freq
90 
91  integer :: ierr
92  !---------------------------------------------------------------------------
93 
94  if( io_l ) write(io_fid_log,*)
95  if( io_l ) write(io_fid_log,*) '++++++ Module[SURFACE FLUX] / Categ[ATMOS PHYSICS] / Origin[SCALElib]'
96  if( io_l ) write(io_fid_log,*) '*** Constant flux'
97 
98  if ( atmos_phy_sf_type /= 'CONST' ) then
99  write(*,*) 'xxx ATMOS_PHY_SF_TYPE is not CONST. Check!'
100  call prc_mpistop
101  endif
102 
103  !--- read namelist
104  rewind(io_fid_conf)
105  read(io_fid_conf,nml=param_atmos_phy_sf_const,iostat=ierr)
106  if( ierr < 0 ) then !--- missing
107  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
108  elseif( ierr > 0 ) then !--- fatal error
109  write(*,*) 'xxx Not appropriate names in namelist PARAM_ATMOS_PHY_SF_CONST. Check!'
110  call prc_mpistop
111  endif
112  if( io_nml ) write(io_fid_nml,nml=param_atmos_phy_sf_const)
113 
114  return
115  end subroutine atmos_phy_sf_const_setup
116 
117  !-----------------------------------------------------------------------------
119  subroutine atmos_phy_sf_const( &
120  ATM_TEMP, ATM_PRES, ATM_W, ATM_U, ATM_V, &
121  ATM_DENS, &
122  ATM_QTRC, &
123  ATM_Z1, dt, &
124  SFC_DENS, SFC_PRES, &
125  SFLX_LW_dn, SFLX_SW_dn, &
126  SFC_TEMP, SFC_albedo, &
127  SFC_Z0M, SFC_Z0H, SFC_Z0E, &
128  SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_LH, &
129  SFLX_QTRC, &
130  U10, V10, T2, Q2 )
132  use scale_tracer
133  use scale_const, only: &
134  pi => const_pi
135  use scale_atmos_hydrometeor, only: &
136  hydrometeor_lhv => atmos_hydrometeor_lhv, &
137  i_qv
138  use scale_time, only: &
140  implicit none
141 
142  real(RP), intent(in) :: atm_temp (ia,ja) ! temperature at the lowermost layer (cell center) [K]
143  real(RP), intent(in) :: atm_pres (ia,ja) ! pressure at the lowermost layer (cell center) [Pa]
144  real(RP), intent(in) :: atm_w (ia,ja) ! velocity w at the lowermost layer (cell center) [m/s]
145  real(RP), intent(in) :: atm_u (ia,ja) ! velocity u at the lowermost layer (cell center) [m/s]
146  real(RP), intent(in) :: atm_v (ia,ja) ! velocity v at the lowermost layer (cell center) [m/s]
147  real(RP), intent(in) :: atm_dens (ia,ja) ! density at the lowermost layer (cell center) [kg/m3]
148  real(RP), intent(in) :: atm_qtrc (ia,ja,qa) ! tracer at the lowermost layer (cell center) [kg/kg]
149  real(RP), intent(in) :: atm_z1 (ia,ja) ! height of the lowermost grid from surface (cell center) [m]
150  real(DP), intent(in) :: dt ! delta time
151  real(RP), intent(in) :: sfc_dens (ia,ja) ! density at the surface atmosphere [kg/m3]
152  real(RP), intent(in) :: sfc_pres (ia,ja) ! pressure at the surface atmosphere [Pa]
153  real(RP), intent(in) :: sflx_lw_dn(ia,ja) ! downward longwave radiation flux at the surface [J/m2/s]
154  real(RP), intent(in) :: sflx_sw_dn(ia,ja) ! downward shortwave radiation flux at the surface [J/m2/s]
155  real(RP), intent(in) :: sfc_temp (ia,ja) ! temperature at the surface skin [K]
156  real(RP), intent(in) :: sfc_albedo(ia,ja,2) ! surface albedo (LW/SW) (0-1)
157  real(RP), intent(inout) :: sfc_z0m (ia,ja) ! surface roughness length (momentum) [m]
158  real(RP), intent(inout) :: sfc_z0h (ia,ja) ! surface roughness length (heat) [m]
159  real(RP), intent(inout) :: sfc_z0e (ia,ja) ! surface roughness length (vapor) [m]
160  real(RP), intent(out) :: sflx_mw (ia,ja) ! surface flux for z-momentum (area center) [m/s*kg/m2/s]
161  real(RP), intent(out) :: sflx_mu (ia,ja) ! surface flux for x-momentum (area center) [m/s*kg/m2/s]
162  real(RP), intent(out) :: sflx_mv (ia,ja) ! surface flux for y-momentum (area center) [m/s*kg/m2/s]
163  real(RP), intent(out) :: sflx_sh (ia,ja) ! surface flux for sensible heat (area center) [J/m2/s]
164  real(RP), intent(out) :: sflx_lh (ia,ja) ! surface flux for latent heat (area center) [J/m2/s]
165  real(RP), intent(out) :: sflx_qtrc (ia,ja,qa) ! surface flux for tracer mass (area center) [kg/m2/s]
166  real(RP), intent(out) :: u10 (ia,ja) ! velocity u at 10m height
167  real(RP), intent(out) :: v10 (ia,ja) ! velocity v at 10m height
168  real(RP), intent(out) :: t2 (ia,ja) ! temperature t at 2m height
169  real(RP), intent(out) :: q2 (ia,ja) ! water vapor q at 2m height
170 
171  real(RP) :: atm_uabs(ia,ja) ! absolute velocity at z1 [m/s]
172 
173  real(RP) :: cm(ia,ja) ! bulk coefficient for momentum
174  real(RP) :: r10
175 
176  real(RP) :: modulation
177  real(RP) :: uabs_lim
178  real(RP) :: lhv(ia,ja)
179  integer :: i, j
180  !---------------------------------------------------------------------------
181 
182  if( io_l ) write(io_fid_log,*) '*** Atmos physics step: Surface flux(const)'
183 
184  do j = js, je
185  do i = is, ie
186  atm_uabs(i,j) = sqrt( atm_w(i,j)*atm_w(i,j) &
187  + atm_u(i,j)*atm_u(i,j) &
188  + atm_v(i,j)*atm_v(i,j) ) ! at cell center
189  enddo
190  enddo
191 
192  if ( atmos_phy_sf_flg_mom_flux == 0 ) then ! Bulk coefficient is constant
193  do j = js, je
194  do i = is, ie
195  cm(i,j) = atmos_phy_sf_const_cm
196  enddo
197  enddo
198  elseif( atmos_phy_sf_flg_mom_flux == 1 ) then ! Friction velocity is constant
199  do j = js, je
200  do i = is, ie
201  cm(i,j) = ( atmos_phy_sf_const_ustar / atm_uabs(i,j) )**2
202  cm(i,j) = min( max( cm(i,j), atmos_phy_sf_cm_min ), atmos_phy_sf_cm_max )
203  enddo
204  enddo
205  endif
206 
207  !-----< momentum >-----
208 
209  do j = js, je
210  do i = is, ie
211  uabs_lim = min( max( atm_uabs(i,j), atmos_phy_sf_u_minm ), atmos_phy_sf_u_maxm )
212 
213  sflx_mw(i,j) = -cm(i,j) * uabs_lim * sfc_dens(i,j) * atm_w(i,j)
214  sflx_mu(i,j) = -cm(i,j) * uabs_lim * sfc_dens(i,j) * atm_u(i,j)
215  sflx_mv(i,j) = -cm(i,j) * uabs_lim * sfc_dens(i,j) * atm_v(i,j)
216  enddo
217  enddo
218 
219  !-----< heat flux >-----
220 
221  if ( atmos_phy_sf_flg_sh_diurnal ) then
222  modulation = sin( 2.0_rp * pi * time_nowsec / 3600.0_rp / atmos_phy_sf_const_freq )
223  else
224  modulation = 1.0_rp
225  endif
226 
227  do j = js, je
228  do i = is, ie
229  sflx_sh(i,j) = atmos_phy_sf_const_sh * modulation
230  sflx_lh(i,j) = atmos_phy_sf_const_lh
231  enddo
232  enddo
233 
234  !-----< mass flux >-----
235  call hydrometeor_lhv( lhv(:,:), atm_temp(:,:) )
236 
237  sflx_qtrc(:,:,:) = 0.0_rp
238  if ( i_qv > 0 ) then
239  do j = js, je
240  do i = is, ie
241  sflx_qtrc(i,j,i_qv) = sflx_lh(i,j) / lhv(i,j)
242  enddo
243  enddo
244  end if
245 
246  !-----< U10, T2, q2 >-----
247 
248  do j = js, je
249  do i = is, ie
250  r10 = 10.0_rp / atm_z1(i,j)
251 
252  u10(i,j) = r10 * atm_u(i,j)
253  v10(i,j) = r10 * atm_v(i,j)
254  enddo
255  enddo
256 
257  do j = js, je
258  do i = is, ie
259  t2(i,j) = atm_temp(i,j)
260  enddo
261  enddo
262 
263  if ( i_qv > 0 ) then
264  do j = js, je
265  do i = is, ie
266  q2(i,j) = atm_qtrc(i,j,i_qv)
267  enddo
268  enddo
269  else
270  do j = js, je
271  do i = is, ie
272  q2(i,j) = 0.0_rp
273  enddo
274  enddo
275  end if
276 
277  return
278  end subroutine atmos_phy_sf_const
279 
280 end module scale_atmos_phy_sf_const
integer, public is
start point of inner domain: x, local
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
real(dp), public time_nowsec
subday part of current time [sec]
Definition: scale_time.F90:68
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
module STDIO
Definition: scale_stdio.F90:12
integer, public qa
module grid index
logical, public io_nml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:62
subroutine, public atmos_phy_sf_const(ATM_TEMP, ATM_PRES, ATM_W, ATM_U, ATM_V, ATM_DENS, ATM_QTRC, ATM_Z1, dt, SFC_DENS, SFC_PRES, SFLX_LW_dn, SFLX_SW_dn, SFC_TEMP, SFC_albedo, SFC_Z0M, SFC_Z0H, SFC_Z0E, SFLX_MW, SFLX_MU, SFLX_MV, SFLX_SH, SFLX_LH, SFLX_QTRC, U10, V10, T2, Q2)
Constant flux.
module TRACER
integer, public ia
of whole cells: x, local, with HALO
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
module PROCESS
module CONSTANT
Definition: scale_const.F90:14
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
module ATMOSPHERE / Physics Surface fluxes
module PRECISION
real(rp), public const_pi
pi
Definition: scale_const.F90:34
integer, public io_fid_conf
Config file ID.
Definition: scale_stdio.F90:55
integer, public io_fid_log
Log file ID.
Definition: scale_stdio.F90:56
integer, public io_fid_nml
Log file ID (only for output namelist)
Definition: scale_stdio.F90:57
subroutine, public atmos_phy_sf_const_setup(ATMOS_PHY_SF_TYPE)
Setup.
integer, public ja
of whole cells: y, local, with HALO