1
1
! > Inline harmonic analysis (conventional)
2
2
module MOM_harmonic_analysis
3
3
4
- use MOM_time_manager, only : time_type, real_to_time, time_type_to_real, &
5
- set_date, get_date, increment_date, &
6
- operator (+ ), operator (- ), operator (<), operator (>), operator (>= )
4
+ use MOM_time_manager, only : time_type, real_to_time, time_type_to_real
5
+ use MOM_time_manager, only : set_date, get_date, increment_date
6
+ use MOM_time_manager, only : operator (+ ), operator (- ), operator (<), operator (>), operator (>= )
7
7
use MOM_grid, only : ocean_grid_type
8
8
use MOM_unit_scaling, only : unit_scale_type
9
9
use MOM_file_parser, only : param_file_type, get_param
10
- use MOM_io, only : file_exists, open_ASCII_file, READONLY_FILE, close_file, &
11
- MOM_infra_file, vardesc, MOM_field, &
12
- var_desc, create_MOM_file, SINGLE_FILE, MOM_write_field
10
+ use MOM_io, only : file_exists, open_ASCII_file, READONLY_FILE, close_file
11
+ use MOM_io, only : MOM_infra_file, vardesc, MOM_field
12
+ use MOM_io, only : var_desc, create_MOM_file, SINGLE_FILE, MOM_write_field
13
13
use MOM_error_handler, only : MOM_mesg, MOM_error, NOTE
14
14
use MOM_tidal_forcing, only : astro_longitudes, astro_longitudes_init, eq_phase, nodal_fu, tidal_frequency
15
15
@@ -54,7 +54,7 @@ module MOM_harmonic_analysis
54
54
integer :: length ! < Number of fields of which harmonic analysis is to be performed
55
55
character (len= 4 ), allocatable , dimension (:) :: const_name ! < The name of each constituent
56
56
character (len= 255 ) :: path ! < Path to directory where output will be written
57
- type (ocean_grid_type) :: G ! < The ocean's grid structure
57
+ type (ocean_grid_type), pointer :: G ! < The ocean's grid structure
58
58
type (unit_scale_type) :: US ! < A dimensional unit scaling type
59
59
type (HA_node), pointer :: list = > NULL () ! < A linked list for storing the HA info of different fields
60
60
end type harmonic_analysis_CS
@@ -65,7 +65,7 @@ module MOM_harmonic_analysis
65
65
! ! THIS MUST BE CALLED AT THE END OF tidal_forcing_init.
66
66
subroutine HA_init (Time , G , US , param_file , nc , CS )
67
67
type (time_type), intent (in ) :: Time ! < The current model time
68
- type (ocean_grid_type), intent ( in ) :: G ! < The ocean's grid structure
68
+ type (ocean_grid_type), target :: G ! < The ocean's grid structure
69
69
type (unit_scale_type), intent (in ) :: US ! < A dimensional unit scaling type
70
70
type (param_file_type), intent (in ) :: param_file ! < A structure to parse for run-time parameters
71
71
integer , intent (in ) :: nc ! < The number of tidal constituents in use
@@ -164,7 +164,28 @@ subroutine HA_init(Time, G, US, param_file, nc, CS)
164
164
CS% freq(c), " Frequency of the " // trim (CS% const_name(c))// &
165
165
" constituent. This is used if USE_HA is true and " // trim (CS% const_name(c))// &
166
166
" is in HA_CONSTITUENTS." , units= " rad s-1" , scale= US% T_to_s, default= 0.0 )
167
- if (CS% freq(c)<= 0.0 ) CS% freq(c) = tidal_frequency(trim (CS% const_name(c)))
167
+ if (CS% freq(c)<= 0.0 ) then
168
+ select case (trim (CS% const_name(c)))
169
+ case (' M4' )
170
+ CS% freq(c) = tidal_frequency(' M2' ) * 2
171
+ case (' M6' )
172
+ CS% freq(c) = tidal_frequency(' M2' ) * 3
173
+ case (' M8' )
174
+ CS% freq(c) = tidal_frequency(' M2' ) * 4
175
+ case (' S4' )
176
+ CS% freq(c) = tidal_frequency(' S2' ) * 2
177
+ case (' S6' )
178
+ CS% freq(c) = tidal_frequency(' S2' ) * 3
179
+ case (' MK3' )
180
+ CS% freq(c) = tidal_frequency(' M2' ) + tidal_frequency(' K1' )
181
+ case (' MS4' )
182
+ CS% freq(c) = tidal_frequency(' M2' ) + tidal_frequency(' S2' )
183
+ case (' MN4' )
184
+ CS% freq(c) = tidal_frequency(' M2' ) + tidal_frequency(' N2' )
185
+ case default
186
+ CS% freq(c) = tidal_frequency(trim (CS% const_name(c)))
187
+ end select
188
+ endif
168
189
169
190
call get_param(param_file, mdl, " HA_" // trim (CS% const_name(c))// " _PHASE_T0" , CS% phase0(c), &
170
191
" Phase of the " // trim (CS% const_name(c))// " tidal constituent at time 0. " // &
@@ -236,7 +257,7 @@ subroutine HA_init(Time, G, US, param_file, nc, CS)
236
257
! Populate some parameters of the control structure
237
258
CS% nc = nc
238
259
CS% length = 0
239
- CS% G = G
260
+ CS% G = > G
240
261
CS% US = US
241
262
242
263
! Initialize CS%list
0 commit comments