SCALE-RM
scale_ocean_phy_file.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
12  !-----------------------------------------------------------------------------
13  !
14  !++ used modules
15  !
16  use scale_precision
17  use scale_stdio
18  use scale_prof
19  use scale_debug
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
28  public :: ocean_phy_file_setup
29  public :: ocean_phy_file
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  !-----------------------------------------------------------------------------
36  !
37  !++ Private procedure
38  !
39  !-----------------------------------------------------------------------------
40  !
41  !++ Private parameters & variables
42  !
43  logical, allocatable, private :: is_OCN(:,:)
44 
45  !-----------------------------------------------------------------------------
46 contains
47  !-----------------------------------------------------------------------------
49  subroutine ocean_phy_file_setup( OCEAN_TYPE )
50  use scale_process, only: &
52  use scale_landuse, only: &
54  use scale_external_input, only: &
56  use scale_const, only: &
57  undef => const_undef
58  implicit none
59 
60  character(len=*), intent(in) :: ocean_type
61 
62  character(len=H_LONG) :: ocean_phy_file_basename = ''
63  logical :: ocean_phy_file_enable_periodic_year = .false.
64  logical :: ocean_phy_file_enable_periodic_month = .false.
65  logical :: ocean_phy_file_enable_periodic_day = .false.
66  integer :: ocean_phy_file_step_fixed = 0
67  real(RP) :: ocean_phy_file_offset = 0.0_rp
68  real(RP) :: ocean_phy_file_defval ! = UNDEF
69  logical :: ocean_phy_file_check_coordinates = .true.
70  integer :: ocean_phy_file_step_limit = 0
71 
72  namelist / param_ocean_phy_file / &
73  ocean_phy_file_basename, &
74  ocean_phy_file_enable_periodic_year, &
75  ocean_phy_file_enable_periodic_month, &
76  ocean_phy_file_enable_periodic_day, &
77  ocean_phy_file_step_fixed, &
78  ocean_phy_file_offset, &
79  ocean_phy_file_defval, &
80  ocean_phy_file_check_coordinates, &
81  ocean_phy_file_step_limit
82 
83  integer :: i, j
84  integer :: ierr
85  !---------------------------------------------------------------------------
86 
87  if( io_l ) write(io_fid_log,*)
88  if( io_l ) write(io_fid_log,*) '++++++ Module[FILE] / Categ[OCEAN PHY] / Origin[SCALElib]'
89 
90  if ( ocean_type /= 'FILE' ) then
91  write(*,*) 'xxx wrong OCEAN_TYPE. Check!'
92  call prc_mpistop
93  end if
94 
95  ocean_phy_file_defval = undef
96 
97  !--- read namelist
98  rewind(io_fid_conf)
99  read(io_fid_conf,nml=param_ocean_phy_file,iostat=ierr)
100  if( ierr < 0 ) then !--- missing
101  if( io_l ) write(io_fid_log,*) '*** Not found namelist. Default used.'
102  elseif( ierr > 0 ) then !--- fatal error
103  write(*,*) 'xxx Not appropriate names in namelist PARAM_OCEAN_PHY_FILE. Check!'
104  call prc_mpistop
105  endif
106  if( io_nml ) write(io_fid_nml,nml=param_ocean_phy_file)
107 
108  if ( ocean_phy_file_basename == '' ) then
109  write(*,*) 'xxx OCEAN_PHY_FILE_basename is necessary'
110  call prc_mpistop
111  end if
112 
113  call extin_regist( ocean_phy_file_basename, & ! [IN]
114  'OCEAN_TEMP', & ! [IN]
115  'XY', & ! [IN]
116  ocean_phy_file_enable_periodic_year, & ! [IN]
117  ocean_phy_file_enable_periodic_month, & ! [IN]
118  ocean_phy_file_enable_periodic_day, & ! [IN]
119  ocean_phy_file_step_fixed, & ! [IN]
120  ocean_phy_file_offset, & ! [IN]
121  ocean_phy_file_defval, & ! [IN]
122  ocean_phy_file_check_coordinates, & ! [IN]
123  ocean_phy_file_step_limit ) ! [IN]
124 
125  ! judge to run slab ocean model
126  allocate( is_ocn(ia,ja) )
127 
128  do j = js, je
129  do i = is, ie
130  if ( landuse_fact_ocean(i,j) > 0.0_rp ) then
131  is_ocn(i,j) = .true.
132  else
133  is_ocn(i,j) = .false.
134  end if
135  end do
136  end do
137 
138  return
139  end subroutine ocean_phy_file_setup
140 
141  !-----------------------------------------------------------------------------
143  subroutine ocean_phy_file( &
144  OCEAN_TEMP_t, &
145  OCEAN_TEMP, &
146  OCEAN_SFLX_WH, &
147  OCEAN_SFLX_prec, &
148  OCEAN_SFLX_evap, &
149  dt )
151  use scale_time, only: &
152  nowdaysec => time_nowdaysec
153  use scale_process, only: &
155  use scale_external_input, only: &
156  extin_update
157  implicit none
158 
159  real(RP), intent(out) :: ocean_temp_t (ia,ja)
160  real(RP), intent(in) :: ocean_temp (ia,ja)
161  real(RP), intent(in) :: ocean_sflx_wh (ia,ja)
162  real(RP), intent(in) :: ocean_sflx_prec(ia,ja)
163  real(RP), intent(in) :: ocean_sflx_evap(ia,ja)
164  real(DP), intent(in) :: dt
165 
166  real(RP) :: ocean_temp_new(ia,ja)
167 
168  logical :: error
169 
170  integer :: i, j
171  !---------------------------------------------------------------------------
172 
173  if( io_l ) write(io_fid_log,*) '*** Ocean physics step: File'
174 
175  call extin_update( &
176  ocean_temp_new, & ! (out)
177  'OCEAN_TEMP', & ! (in)
178  nowdaysec, & ! (in)
179  error ) ! (out)
180  if ( error ) then
181  write(*,*) 'xxx Requested data is not found!'
182  call prc_mpistop
183  end if
184 
185  do j = js, je
186  do i = is, ie
187  if( is_ocn(i,j) ) then
188  ocean_temp_t(i,j) = ( ocean_temp_new(i,j) - ocean_temp(i,j) ) / dt
189  else
190  ocean_temp_t(i,j) = 0.0_rp
191  endif
192  enddo
193  enddo
194 
195  return
196  end subroutine ocean_phy_file
197 
198 end module scale_ocean_phy_file
integer, public is
start point of inner domain: x, local
module DEBUG
Definition: scale_debug.F90:13
integer, public je
end point of inner domain: y, local
subroutine, public prc_mpistop
Abort MPI.
logical, public io_l
output log or not? (this process)
Definition: scale_stdio.F90:61
real(dp), public time_nowdaysec
second of current time [sec]
Definition: scale_time.F90:69
module STDIO
Definition: scale_stdio.F90:12
real(rp), public const_undef
Definition: scale_const.F90:43
module grid index
logical, public io_nml
output log or not? (for namelist, this process)
Definition: scale_stdio.F90:62
integer, public ia
of whole cells: x, local, with HALO
module LANDUSE
real(rp), dimension(:,:), allocatable, public landuse_fact_ocean
ocean factor
integer, public js
start point of inner domain: y, local
module TIME
Definition: scale_time.F90:15
module PROCESS
subroutine, public extin_regist(basename, varname, axistype, enable_periodic_year, enable_periodic_month, enable_periodic_day, step_fixed, offset, defval, check_coordinates, step_limit, exist)
Regist data.
module CONSTANT
Definition: scale_const.F90:14
module EXTERNAL INPUT
subroutine, public ocean_phy_file(OCEAN_TEMP_t, OCEAN_TEMP, OCEAN_SFLX_WH, OCEAN_SFLX_prec, OCEAN_SFLX_evap, dt)
Slab ocean model.
module OCEAN / Physics File
module profiler
Definition: scale_prof.F90:10
integer, public ie
end point of inner domain: x, local
module PRECISION
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 ocean_phy_file_setup(OCEAN_TYPE)
Setup.
integer, public ja
of whole cells: y, local, with HALO