SCALE-RM
scale_coriolis.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  !-----------------------------------------------------------------------------
21  implicit none
22  private
23  !-----------------------------------------------------------------------------
24  !
25  !++ Public procedure
26  !
27  public :: coriolis_setup
28  public :: coriolis_finalize
29 
30  !-----------------------------------------------------------------------------
31  !
32  !++ Public parameters & variables
33  !
34  real(rp), public, allocatable :: coriolis_f(:,:)
35 
36 
37  character(len=H_SHORT), public :: coriolis_type = 'PLANE'
40  real(rp), public :: coriolis_f0 = 0.0_rp
41  real(rp), public :: coriolis_beta = 0.0_rp
42  real(rp), public :: coriolis_y0
43 
44  !-----------------------------------------------------------------------------
45  !
46  !++ Private procedure
47  !
48  !-----------------------------------------------------------------------------
49  !
50  !++ Private parameters & variables
51  !
52  !-----------------------------------------------------------------------------
53 contains
54  !-----------------------------------------------------------------------------
56  subroutine coriolis_setup( &
57  IA, JA, &
58  LAT, &
59  CY, DOMAIN_CENTER_Y )
60  use scale_prc, only: &
61  prc_abort
62  use scale_const, only: &
63  ohm => const_ohm
64  implicit none
65  integer, intent(in) :: ia, ja
66 
67  real(rp), intent(in) :: lat(ia,ja)
68  real(rp), intent(in) :: cy (ja)
69  real(rp), intent(in) :: domain_center_y
70 
71  namelist / param_coriolis / &
72  coriolis_type, &
73  coriolis_f0, &
74  coriolis_beta, &
76 
77  integer :: i, j
78 
79  integer :: ierr
80  !---------------------------------------------------------------------------
81 
82  log_newline
83  log_info("CORIOLIS_setup",*) 'Setup'
84 
85  coriolis_y0 = domain_center_y
86 
87  !--- read namelist
88  rewind(io_fid_conf)
89  read(io_fid_conf,nml=param_coriolis,iostat=ierr)
90 
91  if( ierr < 0 ) then !--- missing
92  log_info("CORIOLIS_setup",*) 'Not found namelist. Default used.'
93  elseif( ierr > 0 ) then !--- fatal error
94  log_error("CORIOLIS_setup",*) 'Not appropriate names in namelist PARAM_CORIOLIS. Check!'
95  call prc_abort
96  endif
97  log_nml(param_coriolis)
98 
99 
100  allocate( coriolis_f(ia,ja) )
101 
102  ! coriolis parameter
103  select case ( coriolis_type )
104  case ( 'PLANE' )
105  !omp parallel do collapse(2)
106  do j = 1, ja
107  do i = 1, ia
108  coriolis_f(i,j) = coriolis_f0 + coriolis_beta * ( cy(j) - coriolis_y0 )
109  end do
110  end do
111  case ( 'SPHERE' )
112  !omp parallel do collapse(2)
113  do j = 1, ja
114  do i = 1, ia
115  coriolis_f(i,j) = 2.0_rp * ohm * sin( lat(i,j) )
116  end do
117  end do
118  case default
119  log_error("CORIOLIS_setup",*) 'Coriolis type is invalid: ', trim(coriolis_type)
120  log_error_cont(*) 'The type must be PLANE or SPHERE'
121  call prc_abort
122  end select
123 
124  !$acc enter data copyin(CORIOLIS_f)
125 
126  return
127  end subroutine coriolis_setup
128 
129  !-----------------------------------------------------------------------------
131  subroutine coriolis_finalize
132  implicit none
133  !---------------------------------------------------------------------------
134 
135  !$acc exit data delete(CORIOLIS_f)
136  deallocate( coriolis_f )
137 
138  return
139  end subroutine coriolis_finalize
140 
141 end module scale_coriolis
scale_prc::prc_abort
subroutine, public prc_abort
Abort Process.
Definition: scale_prc.F90:350
scale_precision
module PRECISION
Definition: scale_precision.F90:14
scale_coriolis
module Coriolis
Definition: scale_coriolis.F90:12
scale_coriolis::coriolis_y0
real(rp), public coriolis_y0
Definition: scale_coriolis.F90:42
scale_coriolis::coriolis_setup
subroutine, public coriolis_setup(IA, JA, LAT, CY, DOMAIN_CENTER_Y)
Setup.
Definition: scale_coriolis.F90:60
scale_coriolis::coriolis_f0
real(rp), public coriolis_f0
'PLANE' : f = CORIOLIS_f0 + CORIOLIS_beta * ( CY - CORIOLIS_y0 ) 'SPHERE': f = 2 * CONST_OHM * sin( l...
Definition: scale_coriolis.F90:40
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_coriolis::coriolis_finalize
subroutine, public coriolis_finalize
Finalize.
Definition: scale_coriolis.F90:132
scale_coriolis::coriolis_beta
real(rp), public coriolis_beta
Definition: scale_coriolis.F90:41
scale_prof
module profiler
Definition: scale_prof.F90:11
scale_coriolis::coriolis_f
real(rp), dimension(:,:), allocatable, public coriolis_f
Definition: scale_coriolis.F90:34
scale_const::const_ohm
real(rp), public const_ohm
angular velocity of the planet [1/s]
Definition: scale_const.F90:48
scale_io::io_fid_conf
integer, public io_fid_conf
Config file ID.
Definition: scale_io.F90:57
scale_coriolis::coriolis_type
character(len=h_short), public coriolis_type
Definition: scale_coriolis.F90:37