SCALE-RM
scale_ocean_dyn_offline.F90
Go to the documentation of this file.
1 !-------------------------------------------------------------------------------
10 !-------------------------------------------------------------------------------
11 #include "scalelib.h"
13  !-----------------------------------------------------------------------------
14  !
15  !++ used modules
16  !
17  use scale_precision
18  use scale_io
19  use scale_prof
20  use scale_debug
21  !-----------------------------------------------------------------------------
22  implicit none
23  private
24  !-----------------------------------------------------------------------------
25  !
26  !++ Public procedure
27  !
28  public :: ocean_dyn_offline_setup
29  public :: ocean_dyn_offline
30 
31  !-----------------------------------------------------------------------------
32  !
33  !++ Public parameters & variables
34  !
35  !-----------------------------------------------------------------------------
36  !
37  !++ Private procedure
38  !
39  !-----------------------------------------------------------------------------
40  !
41  !++ Private parameters & variables
42  !
43  !-----------------------------------------------------------------------------
44 contains
45  !-----------------------------------------------------------------------------
47  subroutine ocean_dyn_offline_setup
48  use scale_prc, only: &
49  prc_abort
50  use scale_const, only: &
51  undef => const_undef
52  use scale_file_external_input, only: &
54  implicit none
55 
56  character(len=H_LONG) :: ocean_dyn_offline_basename = ''
57  logical :: ocean_dyn_offline_basename_add_num = .false.
58  integer :: ocean_dyn_offline_number_of_files = 1
59  logical :: ocean_dyn_offline_enable_periodic_year = .false.
60  logical :: ocean_dyn_offline_enable_periodic_month = .false.
61  logical :: ocean_dyn_offline_enable_periodic_day = .false.
62  integer :: ocean_dyn_offline_step_fixed = 0
63  real(rp) :: ocean_dyn_offline_offset = 0.0_rp
64  real(rp) :: ocean_dyn_offline_defval != UNDEF
65  logical :: ocean_dyn_offline_check_coordinates = .true.
66  integer :: ocean_dyn_offline_step_limit = 0
67 
68  namelist / param_ocean_dyn_offline / &
69  ocean_dyn_offline_basename, &
70  ocean_dyn_offline_basename_add_num, &
71  ocean_dyn_offline_number_of_files, &
72  ocean_dyn_offline_enable_periodic_year, &
73  ocean_dyn_offline_enable_periodic_month, &
74  ocean_dyn_offline_enable_periodic_day, &
75  ocean_dyn_offline_step_fixed, &
76  ocean_dyn_offline_offset, &
77  ocean_dyn_offline_defval, &
78  ocean_dyn_offline_check_coordinates, &
79  ocean_dyn_offline_step_limit
80 
81  integer :: ierr
82  !---------------------------------------------------------------------------
83 
84  log_newline
85  log_info("OCEAN_DYN_OFFLINE_setup",*) 'Setup'
86 
87  ocean_dyn_offline_defval = undef
88 
89  !--- read namelist
90  rewind(io_fid_conf)
91  read(io_fid_conf,nml=param_ocean_dyn_offline,iostat=ierr)
92  if( ierr < 0 ) then !--- missing
93  log_info("OCEAN_DYN_OFFLINE_setup",*) 'Not found namelist. Default used.'
94  elseif( ierr > 0 ) then !--- fatal error
95  log_error("OCEAN_DYN_OFFLINE_setup",*) 'Not appropriate names in namelist PARAM_OCEAN_DYN_OFFLINE. Check!'
96  call prc_abort
97  endif
98  log_nml(param_ocean_dyn_offline)
99 
100  log_info("OCEAN_DYN_OFFLINE_setup",*) 'Use offline ocean'
101 
102  if ( ocean_dyn_offline_basename == '' ) then
103  log_error("OCEAN_DYN_OFFLINE_setup",*) 'OCEAN_DYN_OFFLINE_basename is necessary !!'
104  call prc_abort
105  endif
106 
107  call file_external_input_regist( ocean_dyn_offline_basename, & ! [IN]
108  ocean_dyn_offline_basename_add_num, & ! [IN]
109  ocean_dyn_offline_number_of_files, & ! [IN]
110  'OCEAN_TEMP', & ! [IN]
111  'OXY', & ! [IN]
112  ocean_dyn_offline_enable_periodic_year, & ! [IN]
113  ocean_dyn_offline_enable_periodic_month, & ! [IN]
114  ocean_dyn_offline_enable_periodic_day, & ! [IN]
115  ocean_dyn_offline_step_fixed, & ! [IN]
116  ocean_dyn_offline_offset, & ! [IN]
117  ocean_dyn_offline_defval, & ! [IN]
118  check_coordinates = ocean_dyn_offline_check_coordinates, & ! [IN]
119  step_limit = ocean_dyn_offline_step_limit ) ! [IN]
120 
121  return
122  end subroutine ocean_dyn_offline_setup
123 
124  !-----------------------------------------------------------------------------
126  subroutine ocean_dyn_offline( &
127  OKMAX, OKS, OKE, &
128  OIA, OIS, OIE, &
129  OJA, OJS, OJE, &
130  calc_flag, &
131  dt, NOWDAYSEC, &
132  OCEAN_TEMP )
133  use scale_prc, only: &
134  prc_abort
135  use scale_file_external_input, only: &
136  file_external_input_update
137  implicit none
138 
139  integer, intent(in) :: okmax, oks, oke
140  integer, intent(in) :: oia, ois, oie
141  integer, intent(in) :: oja, ojs, oje
142  logical, intent(in) :: calc_flag (oia,oja) ! to decide calculate or not
143  real(dp), intent(in) :: dt
144  real(dp), intent(in) :: nowdaysec
145  real(rp), intent(inout) :: ocean_temp(okmax,oia,oja)
146 
147  real(rp) :: ocean_temp_ref(okmax,oia,oja)
148 
149  logical :: error
150  integer :: i, j
151  !---------------------------------------------------------------------------
152 
153  log_progress(*) 'ocean / dynamics / offline'
154 
155  call file_external_input_update( 'OCEAN_TEMP', nowdaysec, ocean_temp_ref(:,:,:), error )
156 
157  if ( error ) then
158  log_error("OCEAN_DYN_OFFLINE",*) 'Requested data is not found!'
159  call prc_abort
160  endif
161 
162  do j = ojs, oje
163  do i = ois, oie
164  if ( calc_flag(i,j) ) then
165  ocean_temp(oks,i,j) = ocean_temp_ref(oks,i,j)
166  endif
167  enddo
168  enddo
169 
170  return
171  end subroutine ocean_dyn_offline
172 
173 end module scale_ocean_dyn_offline
scale_ocean_dyn_offline::ocean_dyn_offline_setup
subroutine, public ocean_dyn_offline_setup
Setup.
Definition: scale_ocean_dyn_offline.F90:48
scale_ocean_dyn_offline
module ocean / dynamics / offline
Definition: scale_ocean_dyn_offline.F90:12
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:342
scale_file_external_input::file_external_input_regist
subroutine, public file_external_input_regist(basename, basename_add_num, number_of_files, varname, axistype, enable_periodic_year, enable_periodic_month, enable_periodic_day, step_fixed, offset, defval, check_coordinates, aggregate, allow_missing, step_limit, exist)
Regist data.
Definition: scale_file_external_input.F90:324
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_prc
module PROCESS
Definition: scale_prc.F90:11
scale_precision::rp
integer, parameter, public rp
Definition: scale_precision.F90:41
scale_io
module STDIO
Definition: scale_io.F90:10
scale_const
module CONSTANT
Definition: scale_const.F90:11
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_precision::dp
integer, parameter, public dp
Definition: scale_precision.F90:32
scale_ocean_dyn_offline::ocean_dyn_offline
subroutine, public ocean_dyn_offline(OKMAX, OKS, OKE, OIA, OIS, OIE, OJA, OJS, OJE, calc_flag, dt, NOWDAYSEC, OCEAN_TEMP)
Slab ocean model.
Definition: scale_ocean_dyn_offline.F90:133
scale_debug
module DEBUG
Definition: scale_debug.F90:11
scale_file_external_input
module file / external_input
Definition: scale_file_external_input.F90:12
scale_const::const_undef
real(rp), public const_undef
Definition: scale_const.F90:41
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:56