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
Ocean grid type. See mom_grid for details.
Definition: MOM_grid.F90:26
Reads the only Fortran name list needed to boot-strap the model.
A structure that can be parsed to read and document run-time parameters.
Provides the ocean grid type.
Definition: MOM_grid.F90:2
Open boundary segment data structure.
Describes the horizontal ocean grid with only dynamic memory arrays.
The MOM6 facility to parse input files for runtime parameters.
This module contains the tracer_registry_type and the subroutines that handle registration of tracers...
Type to carry basic tracer information.
Routines for error handling and I/O management.
An overloaded interface to log version information about modules.
Describes the vertical ocean grid, including unit conversion factors.
Dyed open boundary conditions.
Container for paths and parameter file names.
Pointers to an assortment of thermodynamic fields that may be available, including potential temperat...
Contains a shareable dynamic type for describing horizontal grids and metric data and utilty routines...
Controls where open boundary conditions are applied.
Provides a transparent vertical ocean grid type and supporting routines.
Provides transparent structures with groups of MOM6 variables and supporting routines.
An overloaded interface to read and log the values of various types of parameters.