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: &
55  implicit none
56 
57  character(len=H_LONG) :: OCEAN_DYN_OFFLINE_basename(file_external_input_file_limit) = ''
58  logical :: OCEAN_DYN_OFFLINE_enable_periodic_year = .false.
59  logical :: OCEAN_DYN_OFFLINE_enable_periodic_month = .false.
60  logical :: OCEAN_DYN_OFFLINE_enable_periodic_day = .false.
61  integer :: OCEAN_DYN_OFFLINE_step_fixed = 0
62  real(RP) :: OCEAN_DYN_OFFLINE_offset = 0.0_rp
63  real(RP) :: OCEAN_DYN_OFFLINE_defval != UNDEF
64  logical :: OCEAN_DYN_OFFLINE_check_coordinates = .true.
65  integer :: OCEAN_DYN_OFFLINE_step_limit = 0
66 
67  namelist / param_ocean_dyn_offline / &
68  ocean_dyn_offline_basename, &
69  ocean_dyn_offline_enable_periodic_year, &
70  ocean_dyn_offline_enable_periodic_month, &
71  ocean_dyn_offline_enable_periodic_day, &
72  ocean_dyn_offline_step_fixed, &
73  ocean_dyn_offline_offset, &
74  ocean_dyn_offline_defval, &
75  ocean_dyn_offline_check_coordinates, &
76  ocean_dyn_offline_step_limit
77 
78  integer :: ierr
79  !---------------------------------------------------------------------------
80 
81  log_newline
82  log_info("OCEAN_DYN_OFFLINE_setup",*) 'Setup'
83 
84  ocean_dyn_offline_defval = undef
85 
86  !--- read namelist
87  rewind(io_fid_conf)
88  read(io_fid_conf,nml=param_ocean_dyn_offline,iostat=ierr)
89  if( ierr < 0 ) then !--- missing
90  log_info("OCEAN_DYN_OFFLINE_setup",*) 'Not found namelist. Default used.'
91  elseif( ierr > 0 ) then !--- fatal error
92  log_error("OCEAN_DYN_OFFLINE_setup",*) 'Not appropriate names in namelist PARAM_OCEAN_DYN_OFFLINE. Check!'
93  call prc_abort
94  endif
95  log_nml(param_ocean_dyn_offline)
96 
97  log_info("OCEAN_DYN_OFFLINE_setup",*) 'Use offline ocean'
98 
99  if ( ocean_dyn_offline_basename(1) == '' ) then
100  log_error("OCEAN_DYN_OFFLINE_setup",*) 'OCEAN_DYN_OFFLINE_basename is necessary !!'
101  call prc_abort
102  endif
103 
104  call file_external_input_regist( ocean_dyn_offline_basename(:), & ! [IN]
105  'OCEAN_TEMP', & ! [IN]
106  'OXY', & ! [IN]
107  ocean_dyn_offline_enable_periodic_year, & ! [IN]
108  ocean_dyn_offline_enable_periodic_month, & ! [IN]
109  ocean_dyn_offline_enable_periodic_day, & ! [IN]
110  ocean_dyn_offline_step_fixed, & ! [IN]
111  ocean_dyn_offline_offset, & ! [IN]
112  ocean_dyn_offline_defval, & ! [IN]
113  ocean_dyn_offline_check_coordinates, & ! [IN]
114  ocean_dyn_offline_step_limit ) ! [IN]
115 
116  return
117  end subroutine ocean_dyn_offline_setup
118 
119  !-----------------------------------------------------------------------------
121  subroutine ocean_dyn_offline( &
122  OKMAX, OKS, OKE, &
123  OIA, OIS, OIE, &
124  OJA, OJS, OJE, &
125  calc_flag, &
126  dt, NOWDAYSEC, &
127  OCEAN_TEMP )
128  use scale_prc, only: &
129  prc_abort
130  use scale_file_external_input, only: &
131  file_external_input_update
132  implicit none
133 
134  integer, intent(in) :: OKMAX, OKS, OKE
135  integer, intent(in) :: OIA, OIS, OIE
136  integer, intent(in) :: OJA, OJS, OJE
137  logical, intent(in) :: calc_flag (oia,oja) ! to decide calculate or not
138  real(DP), intent(in) :: dt
139  real(DP), intent(in) :: NOWDAYSEC
140  real(RP), intent(inout) :: OCEAN_TEMP(okmax,oia,oja)
141 
142  real(RP) :: OCEAN_TEMP_ref(okmax,oia,oja)
143 
144  logical :: error
145  integer :: i, j
146  !---------------------------------------------------------------------------
147 
148  log_progress(*) 'ocean / dynamics / offline'
149 
150  call file_external_input_update( 'OCEAN_TEMP', nowdaysec, ocean_temp_ref(:,:,:), error )
151 
152  if ( error ) then
153  log_error("OCEAN_DYN_OFFLINE",*) 'Requested data is not found!'
154  call prc_abort
155  endif
156 
157  do j = ojs, oje
158  do i = ois, oie
159  if ( calc_flag(i,j) ) then
160  ocean_temp(oks,i,j) = ocean_temp_ref(oks,i,j)
161  endif
162  enddo
163  enddo
164 
165  return
166  end subroutine ocean_dyn_offline
167 
168 end module scale_ocean_dyn_offline
module DEBUG
Definition: scale_debug.F90:11
subroutine, public ocean_dyn_offline(OKMAX, OKS, OKE, OIA, OIS, OIE, OJA, OJS, OJE, calc_flag, dt, NOWDAYSEC, OCEAN_TEMP)
Slab ocean model.
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:55
module file / external_input
subroutine, public file_external_input_regist(basename, varname, axistype, enable_periodic_year, enable_periodic_month, enable_periodic_day, step_fixed, offset, defval, check_coordinates, step_limit, exist)
Regist data.
real(rp), public const_undef
Definition: scale_const.F90:41
integer, parameter, public file_external_input_file_limit
limit of file (for one item)
module PROCESS
Definition: scale_prc.F90:11
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:338
module ocean / dynamics / offline
module CONSTANT
Definition: scale_const.F90:11
module profiler
Definition: scale_prof.F90:11
subroutine, public ocean_dyn_offline_setup
Setup.
module PRECISION
module STDIO
Definition: scale_io.F90:10