MOM6
dyed_obcs_initialization.F90
1 !> Dyed open boundary conditions
3 
4 ! This file is part of MOM6. See LICENSE.md for the license.
5 
7 use mom_error_handler, only : mom_mesg, mom_error, fatal, warning, is_root_pe
9 use mom_get_input, only : directories
10 use mom_grid, only : ocean_grid_type
11 use mom_open_boundary, only : ocean_obc_type, obc_none, obc_simple
12 use mom_open_boundary, only : obc_segment_type, register_segment_tracer
13 use mom_tracer_registry, only : tracer_registry_type, tracer_name_lookup
17 
18 implicit none ; private
19 
20 #include <MOM_memory.h>
21 
22 public dyed_obcs_set_obc_data
23 
24 integer :: ntr = 0 !< Number of dye tracers
25  !! \todo This is a module variable. Move this variable into the control structure.
26 
27 contains
28 
29 !> This subroutine sets the dye properties at open boundary conditions.
30 subroutine dyed_obcs_set_obc_data(OBC, G, GV, param_file, tr_Reg)
31  type(ocean_obc_type), pointer :: obc !< This open boundary condition type specifies
32  !! whether, where, and what open boundary
33  !! conditions are used.
34  type(ocean_grid_type), intent(in) :: g !< The ocean's grid structure.
35  type(verticalgrid_type), intent(in) :: gv !< The ocean's vertical grid structure.
36  type(param_file_type), intent(in) :: param_file !< A structure indicating the open file
37  !! to parse for model parameter values.
38  type(tracer_registry_type), pointer :: tr_reg !< Tracer registry.
39  ! Local variables
40  character(len=40) :: mdl = "dyed_obcs_set_OBC_data" ! This subroutine's name.
41  character(len=80) :: name, longname
42  integer :: i, j, k, itt, is, ie, js, je, isd, ied, jsd, jed, m, n, nz
43  integer :: isdb, iedb, jsdb, jedb
44  real :: dye
45  type(obc_segment_type), pointer :: segment => null()
46  type(tracer_type), pointer :: tr_ptr => null()
47 
48  is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
49  isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
50  isdb = g%IsdB ; iedb = g%IedB ; jsdb = g%JsdB ; jedb = g%JedB
51 
52  if (.not.associated(obc)) return
53 
54  call get_param(param_file, mdl, "NUM_DYE_TRACERS", ntr, &
55  "The number of dye tracers in this run. Each tracer "//&
56  "should have a separate boundary segment.", default=0, &
57  do_not_log=.true.)
58 
59  if (obc%number_of_segments < ntr) then
60  call mom_error(warning, "Error in dyed_obc segment setup")
61  return !!! Need a better error message here
62  endif
63 
64 ! ! Set the inflow values of the dyes, one per segment.
65 ! ! We know the order: north, south, east, west
66  do m=1,ntr
67  write(name,'("dye_",I2.2)') m
68  write(longname,'("Concentration of dyed_obc Tracer ",I2.2, " on segment ",I2.2)') m, m
69  call tracer_name_lookup(tr_reg, tr_ptr, name)
70 
71  do n=1,obc%number_of_segments
72  if (n == m) then
73  dye = 1.0
74  else
75  dye = 0.0
76  endif
77  call register_segment_tracer(tr_ptr, param_file, gv, &
78  obc%segment(n), obc_scalar=dye)
79  enddo
80  enddo
81 
82 end subroutine dyed_obcs_set_obc_data
83 
84 !> \namespace dyed_obcs_initialization
85 !!
86 !! Setting dyes, one for painting the inflow on each side.
87 end module dyed_obcs_initialization
mom_verticalgrid
Provides a transparent vertical ocean grid type and supporting routines.
Definition: MOM_verticalGrid.F90:2
mom_tracer_registry::tracer_type
The tracer type.
Definition: MOM_tracer_registry.F90:37
mom_file_parser::log_version
An overloaded interface to log version information about modules.
Definition: MOM_file_parser.F90:109
mom_variables::thermo_var_ptrs
Pointers to an assortment of thermodynamic fields that may be available, including potential temperat...
Definition: MOM_variables.F90:82
mom_get_input::directories
Container for paths and parameter file names.
Definition: MOM_get_input.F90:20
mom_dyn_horgrid
Contains a shareable dynamic type for describing horizontal grids and metric data and utilty routines...
Definition: MOM_dyn_horgrid.F90:3
mom_tracer_registry
This module contains the tracer_registry_type and the subroutines that handle registration of tracers...
Definition: MOM_tracer_registry.F90:5
mom_file_parser::param_file_type
A structure that can be parsed to read and document run-time parameters.
Definition: MOM_file_parser.F90:54
mom_file_parser::get_param
An overloaded interface to read and log the values of various types of parameters.
Definition: MOM_file_parser.F90:102
mom_get_input
Reads the only Fortran name list needed to boot-strap the model.
Definition: MOM_get_input.F90:6
dyed_obcs_initialization
Dyed open boundary conditions.
Definition: dyed_obcs_initialization.F90:2
mom_verticalgrid::verticalgrid_type
Describes the vertical ocean grid, including unit conversion factors.
Definition: MOM_verticalGrid.F90:24
mom_variables
Provides transparent structures with groups of MOM6 variables and supporting routines.
Definition: MOM_variables.F90:2
mom_open_boundary
Controls where open boundary conditions are applied.
Definition: MOM_open_boundary.F90:2
mom_file_parser
The MOM6 facility to parse input files for runtime parameters.
Definition: MOM_file_parser.F90:2
mom_tracer_registry::tracer_registry_type
Type to carry basic tracer information.
Definition: MOM_tracer_registry.F90:122
mom_grid
Provides the ocean grid type.
Definition: MOM_grid.F90:2
mom_open_boundary::ocean_obc_type
Open-boundary data.
Definition: MOM_open_boundary.F90:186
mom_open_boundary::obc_segment_type
Open boundary segment data structure.
Definition: MOM_open_boundary.F90:107
mom_error_handler
Routines for error handling and I/O management.
Definition: MOM_error_handler.F90:2
mom_dyn_horgrid::dyn_horgrid_type
Describes the horizontal ocean grid with only dynamic memory arrays.
Definition: MOM_dyn_horgrid.F90:22
mom_grid::ocean_grid_type
Ocean grid type. See mom_grid for details.
Definition: MOM_grid.F90:25