7 use mom_coms, only : max_across_pes, min_across_pes
8 use mom_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end
12 use mom_domains, only : root_pe, to_all, scalar_pair, cgrid_ne, agrid
28 use mom_ale, only : ale_remap_scalar
30 implicit none ;
private 32 #include <MOM_memory.h> 34 public :: mom_initialize_tracer_from_z
41 character(len=40) :: mdl =
"MOM_tracer_initialization_from_Z" 46 subroutine mom_initialize_tracer_from_z(h, tr, G, GV, US, PF, src_file, src_var_nam, &
47 src_var_unit_conversion, src_var_record, homogenize, &
48 useALEremapping, remappingScheme, src_var_gridspec )
52 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
54 real,
dimension(:,:,:),
pointer :: tr
56 character(len=*),
intent(in) :: src_file
57 character(len=*),
intent(in) :: src_var_nam
58 real,
optional,
intent(in) :: src_var_unit_conversion
59 integer,
optional,
intent(in) :: src_var_record
60 logical,
optional,
intent(in) :: homogenize
61 logical,
optional,
intent(in) :: useALEremapping
62 character(len=*),
optional,
intent(in) :: remappingScheme
63 character(len=*),
optional,
intent(in) :: src_var_gridspec
66 real :: land_fill = 0.0
67 character(len=200) :: inputdir
68 character(len=200) :: mesg
71 character(len=10) :: remapScheme
72 logical :: homog,useALE
75 # include "version_variable.h" 76 character(len=40) :: mdl =
"MOM_initialize_tracers_from_Z" 78 integer :: is, ie, js, je, nz
79 integer :: isd, ied, jsd, jed
80 integer :: i, j, k, kd
81 real,
allocatable,
dimension(:,:,:),
target :: tr_z, mask_z
82 real,
allocatable,
dimension(:),
target :: z_edges_in, z_in
85 real,
dimension(:,:,:),
allocatable :: hSrc
86 real,
dimension(:),
allocatable :: h1
87 real :: zTopOfCell, zBottomOfCell, z_bathy
92 integer :: id_clock_routine, id_clock_ALE
93 logical :: answers_2018, default_2018_answers, hor_regrid_answers_2018
94 logical :: reentrant_x, tripolar_n
96 id_clock_routine = cpu_clock_id(
'(Initialize tracer from Z)', grain=clock_routine)
97 id_clock_ale = cpu_clock_id(
'(Initialize tracer from Z) ALE', grain=clock_loop)
99 call cpu_clock_begin(id_clock_routine)
101 is = g%isc ; ie = g%iec ; js = g%jsc ; je = g%jec ; nz = g%ke
102 isd = g%isd ; ied = g%ied ; jsd = g%jsd ; jed = g%jed
104 call calltree_enter(trim(mdl)//
"(), MOM_state_initialization.F90")
106 call get_param(pf, mdl,
"Z_INIT_HOMOGENIZE", homog, &
107 "If True, then horizontally homogenize the interpolated "//&
108 "initial conditions.", default=.false.)
109 call get_param(pf, mdl,
"Z_INIT_ALE_REMAPPING", useale, &
110 "If True, then remap straight to model coordinate from file.",&
112 call get_param(pf, mdl,
"Z_INIT_REMAPPING_SCHEME", remapscheme, &
113 "The remapping scheme to use if using Z_INIT_ALE_REMAPPING is True.", &
115 call get_param(pf, mdl,
"DEFAULT_2018_ANSWERS", default_2018_answers, &
116 "This sets the default value for the various _2018_ANSWERS parameters.", &
119 call get_param(pf, mdl,
"REMAPPING_2018_ANSWERS", answers_2018, &
120 "If true, use the order of arithmetic and expressions that recover the "//&
121 "answers from the end of 2018. Otherwise, use updated and more robust "//&
122 "forms of the same expressions.", default=default_2018_answers)
124 call get_param(pf, mdl,
"HOR_REGRID_2018_ANSWERS", hor_regrid_answers_2018, &
125 "If true, use the order of arithmetic for horizonal regridding that recovers "//&
126 "the answers from the end of 2018. Otherwise, use rotationally symmetric "//&
127 "forms of the same expressions.", default=default_2018_answers)
131 reentrant_x = .false. ;
call get_param(pf, mdl,
"REENTRANT_X", reentrant_x,default=.true.)
132 tripolar_n = .false. ;
call get_param(pf, mdl,
"TRIPOLAR_N", tripolar_n, default=.false.)
134 if (
PRESENT(homogenize)) homog=homogenize
135 if (
PRESENT(usealeremapping)) useale=usealeremapping
136 if (
PRESENT(remappingscheme)) remapscheme=remappingscheme
138 if (
PRESENT(src_var_record)) recnum = src_var_record
140 if (
PRESENT(src_var_unit_conversion)) convert = src_var_unit_conversion
143 g, tr_z, mask_z, z_in, z_edges_in, missing_value, reentrant_x, tripolar_n, &
144 homog, m_to_z=us%m_to_Z, answers_2018=hor_regrid_answers_2018)
146 kd =
size(z_edges_in,1)-1
153 call cpu_clock_begin(id_clock_ale)
156 allocate( hsrc(isd:ied,jsd:jed,kd) )
158 call initialize_remapping( remapcs, remapscheme, boundary_extrapolation=.false., answers_2018=answers_2018 )
161 do j = js, je ;
do i = is, ie
162 if (g%mask2dT(i,j)>0.)
then 164 ztopofcell = 0. ; zbottomofcell = 0. ; npoints = 0
165 z_bathy = g%bathyT(i,j)
167 if (mask_z(i,j,k) > 0.)
then 168 zbottomofcell = -min( z_edges_in(k+1), z_bathy )
170 zbottomofcell = -z_bathy
172 h1(k) = ztopofcell - zbottomofcell
173 if (h1(k)>0.) npoints = npoints + 1
174 ztopofcell = zbottomofcell
176 h1(kd) = h1(kd) + ( ztopofcell + z_bathy )
180 hsrc(i,j,:) = gv%Z_to_H * h1(:)
183 call ale_remap_scalar(remapcs, g, gv, kd, hsrc, tr_z, h, tr, all_cells=.false., answers_2018=answers_2018 )
189 call mystats(tr(:,:,k), missing_value, is, ie, js, je, k,
'Tracer from ALE()')
191 call cpu_clock_end(id_clock_ale)
195 do k=1,nz ;
do j=js,je ;
do i=is,ie
196 if (tr(i,j,k) == missing_value)
then 199 enddo ;
enddo ;
enddo 201 call calltree_leave(trim(mdl)//
'()')
202 call cpu_clock_end(id_clock_routine)
204 end subroutine mom_initialize_tracer_from_z
Extrapolate and interpolate data.
This module contains the main regridding routines.
Horizontal interpolation.
Ocean grid type. See mom_grid for details.
Calculates density of sea water from T, S and P.
A structure that can be parsed to read and document run-time parameters.
Provides the ocean grid type.
Generates vertical grids as part of the ALE algorithm.
Provides column-wise vertical remapping functions.
Wraps the MPP cpu clock functions.
The MOM6 facility to parse input files for runtime parameters.
An overloaded interface to log the values of various types of parameters.
Do a halo update on a pair of arrays representing the two components of a vector. ...
Container for remapping parameters.
Interfaces to non-domain-oriented communication subroutines, including the MOM6 reproducing sums faci...
Describes various unit conversion factors.
Regridding control structure.
Provides a transparent unit rescaling type to facilitate dimensional consistency testing.
Describes the decomposed MOM domain and has routines for communications across PEs.
Routines for error handling and I/O management.
Calculate the derivatives of density with temperature and salinity from T, S, and P...
Provides subroutines for quantities specific to the equation of state.
An overloaded interface to log version information about modules.
Describes the vertical ocean grid, including unit conversion factors.
Provides integrals of density.
An overloaded interface to read various types of parameters.
Pointers to an assortment of thermodynamic fields that may be available, including potential temperat...
Handy functions for manipulating strings.
Provides a transparent vertical ocean grid type and supporting routines.
Provides transparent structures with groups of MOM6 variables and supporting routines.
Initializes hydrography from z-coordinate climatology files.
Do a halo update on an array.
An overloaded interface to read and log the values of various types of parameters.
Provides checksumming functions for debugging.
A control structure for the equation of state.