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