MOM6
dyed_channel_initialization Module Reference

Detailed Description

Initialization for the dyed_channel configuration.

Setting dyes, one for painting the inflow on each side.

Data Types

type  dyed_channel_obc_cs
 Control structure for dyed-channel open boundaries. More...
 

Functions/Subroutines

logical function, public register_dyed_channel_obc (param_file, CS, OBC_Reg)
 Add dyed channel to OBC registry. More...
 
subroutine, public dyed_channel_obc_end (CS)
 Clean up the dyed_channel OBC from registry. More...
 
subroutine, public dyed_channel_set_obc_tracer_data (OBC, G, GV, param_file, tr_Reg)
 This subroutine sets the dye and flow properties at open boundary conditions. More...
 
subroutine, public dyed_channel_update_flow (OBC, CS, G, Time)
 This subroutine updates the long-channel flow. More...
 

Variables

integer ntr = 0
 Number of dye tracers. More...
 

Function/Subroutine Documentation

◆ dyed_channel_obc_end()

subroutine, public dyed_channel_initialization::dyed_channel_obc_end ( type(dyed_channel_obc_cs), pointer  CS)

Clean up the dyed_channel OBC from registry.

Parameters
csDyed channel control structure.

Definition at line 74 of file dyed_channel_initialization.F90.

74  type(dyed_channel_OBC_CS), pointer :: CS !< Dyed channel control structure.
75 
76  if (associated(cs)) then
77  deallocate(cs)
78  endif

◆ dyed_channel_set_obc_tracer_data()

subroutine, public dyed_channel_initialization::dyed_channel_set_obc_tracer_data ( type(ocean_obc_type), pointer  OBC,
type(ocean_grid_type), intent(in)  G,
type(verticalgrid_type), intent(in)  GV,
type(param_file_type), intent(in)  param_file,
type(tracer_registry_type), pointer  tr_Reg 
)

This subroutine sets the dye and flow properties at open boundary conditions.

Parameters
obcThis open boundary condition type specifies whether, where, and what open boundary conditions are used.
[in]gThe ocean's grid structure.
[in]gvThe ocean's vertical grid structure.
[in]param_fileA structure indicating the open file to parse for model parameter values.
tr_regTracer registry.

Definition at line 83 of file dyed_channel_initialization.F90.

83  type(ocean_OBC_type), pointer :: OBC !< This open boundary condition type specifies
84  !! whether, where, and what open boundary
85  !! conditions are used.
86  type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
87  type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure.
88  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
89  !! to parse for model parameter values.
90  type(tracer_registry_type), pointer :: tr_Reg !< Tracer registry.
91  ! Local variables
92  character(len=40) :: mdl = "dyed_channel_set_OBC_tracer_data" ! This subroutine's name.
93  character(len=80) :: name, longname
94  integer :: i, j, k, l, itt, isd, ied, jsd, jed, m, n
95  integer :: IsdB, IedB, JsdB, JedB
96  real :: dye
97  type(OBC_segment_type), pointer :: segment => null()
98  type(tracer_type), pointer :: tr_ptr => null()
99 
100  if (.not.associated(obc)) call mom_error(fatal, 'dyed_channel_initialization.F90: '// &
101  'dyed_channel_set_OBC_data() was called but OBC type was not initialized!')
102 
103  call get_param(param_file, mdl, "NUM_DYE_TRACERS", ntr, &
104  "The number of dye tracers in this run. Each tracer "//&
105  "should have a separate boundary segment.", default=0, &
106  do_not_log=.true.)
107 
108  if (obc%number_of_segments < ntr) then
109  call mom_error(warning, "Error in dyed_obc segment setup")
110  return !!! Need a better error message here
111  endif
112 
113 ! ! Set the inflow values of the dyes, one per segment.
114 ! ! We know the order: north, south, east, west
115  do m=1,ntr
116  write(name,'("dye_",I2.2)') m
117  write(longname,'("Concentration of dyed_obc Tracer ",I2.2, " on segment ",I2.2)') m, m
118  call tracer_name_lookup(tr_reg, tr_ptr, name)
119 
120  do n=1,obc%number_of_segments
121  if (n == m) then
122  dye = 1.0
123  else
124  dye = 0.0
125  endif
126  call register_segment_tracer(tr_ptr, param_file, gv, &
127  obc%segment(n), obc_scalar=dye)
128  enddo
129  enddo
130 

References mom_error_handler::mom_error(), and ntr.

Referenced by mom_state_initialization::mom_initialize_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dyed_channel_update_flow()

subroutine, public dyed_channel_initialization::dyed_channel_update_flow ( type(ocean_obc_type), pointer  OBC,
type(dyed_channel_obc_cs), pointer  CS,
type(ocean_grid_type), intent(in)  G,
type(time_type), intent(in)  Time 
)

This subroutine updates the long-channel flow.

Parameters
obcThis open boundary condition type specifies whether, where, and what open boundary conditions are used.
csDyed channel control structure.
[in]gThe ocean's grid structure.
[in]timemodel time.

Definition at line 135 of file dyed_channel_initialization.F90.

135  type(ocean_OBC_type), pointer :: OBC !< This open boundary condition type specifies
136  !! whether, where, and what open boundary
137  !! conditions are used.
138  type(dyed_channel_OBC_CS), pointer :: CS !< Dyed channel control structure.
139  type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure.
140  type(time_type), intent(in) :: Time !< model time.
141  ! Local variables
142  character(len=40) :: mdl = "dyed_channel_update_flow" ! This subroutine's name.
143  character(len=80) :: name
144  real :: flow, time_sec, PI
145  integer :: i, j, k, l, itt, isd, ied, jsd, jed, m, n
146  integer :: IsdB, IedB, JsdB, JedB
147  type(OBC_segment_type), pointer :: segment => null()
148 
149  if (.not.associated(obc)) call mom_error(fatal, 'dyed_channel_initialization.F90: '// &
150  'dyed_channel_update_flow() was called but OBC type was not initialized!')
151 
152  time_sec = time_type_to_real(time)
153  pi = 4.0*atan(1.0)
154 
155  do l=1, obc%number_of_segments
156  segment => obc%segment(l)
157  if (.not. segment%on_pe) cycle
158  if (segment%gradient) cycle
159  if (segment%oblique .and. .not. segment%nudged .and. .not. segment%Flather) cycle
160 
161  if (segment%is_E_or_W) then
162  jsd = segment%HI%jsd ; jed = segment%HI%jed
163  isdb = segment%HI%IsdB ; iedb = segment%HI%IedB
164  if (cs%frequency == 0.0) then
165  flow = g%US%m_s_to_L_T*cs%zonal_flow
166  else
167  flow = g%US%m_s_to_L_T*cs%zonal_flow + cs%tidal_amp * cos(2 * pi * cs%frequency * time_sec)
168  endif
169  do k=1,g%ke
170  do j=jsd,jed ; do i=isdb,iedb
171  if (segment%specified .or. segment%nudged) then
172  segment%normal_vel(i,j,k) = flow
173  endif
174  if (segment%specified) then
175  segment%normal_trans(i,j,k) = flow * g%dyCu(i,j)
176  endif
177  enddo ; enddo
178  enddo
179  do j=jsd,jed ; do i=isdb,iedb
180  segment%normal_vel_bt(i,j) = flow
181  enddo ; enddo
182  else
183  isd = segment%HI%isd ; ied = segment%HI%ied
184  jsdb = segment%HI%JsdB ; jedb = segment%HI%JedB
185  do j=jsdb,jedb ; do i=isd,ied
186  segment%normal_vel_bt(i,j) = 0.0
187  enddo ; enddo
188  endif
189  enddo
190 

References mom_error_handler::mom_error().

Here is the call graph for this function:

◆ register_dyed_channel_obc()

logical function, public dyed_channel_initialization::register_dyed_channel_obc ( type(param_file_type), intent(in)  param_file,
type(dyed_channel_obc_cs), pointer  CS,
type(obc_registry_type), pointer  OBC_Reg 
)

Add dyed channel to OBC registry.

Parameters
[in]param_fileparameter file.
csDyed channel control structure.
obc_regOBC registry.

Definition at line 41 of file dyed_channel_initialization.F90.

41  type(param_file_type), intent(in) :: param_file !< parameter file.
42  type(dyed_channel_OBC_CS), pointer :: CS !< Dyed channel control structure.
43  type(OBC_registry_type), pointer :: OBC_Reg !< OBC registry.
44  ! Local variables
45  logical :: register_dyed_channel_OBC
46  character(len=32) :: casename = "dyed channel" ! This case's name.
47  character(len=40) :: mdl = "register_dyed_channel_OBC" ! This subroutine's name.
48 
49  if (associated(cs)) then
50  call mom_error(warning, "register_dyed_channel_OBC called with an "// &
51  "associated control structure.")
52  return
53  endif
54  allocate(cs)
55 
56  call get_param(param_file, mdl, "CHANNEL_MEAN_FLOW", cs%zonal_flow, &
57  "Mean zonal flow imposed at upstream open boundary.", &
58  units="m/s", default=8.57)
59  call get_param(param_file, mdl, "CHANNEL_TIDAL_AMP", cs%tidal_amp, &
60  "Sloshing amplitude imposed at upstream open boundary.", &
61  units="m/s", default=0.0)
62  call get_param(param_file, mdl, "CHANNEL_FLOW_FREQUENCY", cs%frequency, &
63  "Frequency of oscillating zonal flow.", &
64  units="s-1", default=0.0)
65 
66  ! Register the open boundaries.
67  call register_obc(casename, param_file, obc_reg)
68  register_dyed_channel_obc = .true.
69 

References mom_error_handler::mom_error(), and mom_open_boundary::register_obc().

Here is the call graph for this function:

Variable Documentation

◆ ntr

integer dyed_channel_initialization::ntr = 0

Number of dye tracers.

Todo:
This is a module variable. Move this variable into the control structure.

Definition at line 34 of file dyed_channel_initialization.F90.

34 integer :: ntr = 0 !< Number of dye tracers

Referenced by dyed_channel_set_obc_tracer_data().