19 implicit none ;
private
21 #include <MOM_memory.h>
23 public continuity, continuity_init, continuity_end, continuity_stencil
27 integer :: continuity_scheme
35 integer,
parameter :: ppm_scheme = 1
36 character(len=20),
parameter :: ppm_string =
"PPM"
42 subroutine continuity(u, v, hin, h, uh, vh, dt, G, GV, US, CS, uhbt, vhbt, OBC, &
43 visc_rem_u, visc_rem_v, u_cor, v_cor, &
44 uhbt_aux, vhbt_aux, u_cor_aux, v_cor_aux, BT_cont)
47 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
49 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
51 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
53 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
55 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
58 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
61 real,
intent(in) :: dt
64 real,
dimension(SZIB_(G),SZJ_(G)), &
65 optional,
intent(in) :: uhbt
67 real,
dimension(SZI_(G),SZJB_(G)), &
68 optional,
intent(in) :: vhbt
71 optional,
pointer :: obc
72 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
73 optional,
intent(in) :: visc_rem_u
77 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
78 optional,
intent(in) :: visc_rem_v
82 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
83 optional,
intent(out) :: u_cor
85 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
86 optional,
intent(out) :: v_cor
88 real,
dimension(SZIB_(G),SZJ_(G)), &
89 optional,
intent(in) :: uhbt_aux
91 real,
dimension(SZI_(G),SZJB_(G)), &
92 optional,
intent(in) :: vhbt_aux
94 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
95 optional,
intent(inout) :: u_cor_aux
97 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
98 optional,
intent(inout) :: v_cor_aux
101 optional,
pointer :: bt_cont
104 if (
present(visc_rem_u) .neqv.
present(visc_rem_v))
call mom_error(fatal, &
105 "MOM_continuity: Either both visc_rem_u and visc_rem_v or neither"// &
106 " one must be present in call to continuity.")
107 if (
present(u_cor) .neqv.
present(v_cor))
call mom_error(fatal, &
108 "MOM_continuity: Either both u_cor and v_cor or neither"// &
109 " one must be present in call to continuity.")
110 if (
present(uhbt_aux) .neqv.
present(vhbt_aux))
call mom_error(fatal, &
111 "MOM_continuity: Either both uhbt_aux and uhbt_aux or neither"// &
112 " one must be present in call to continuity.")
113 if (
present(u_cor_aux) .neqv.
present(v_cor_aux))
call mom_error(fatal, &
114 "MOM_continuity: Either both u_cor_aux and v_cor_aux or neither"// &
115 " one must be present in call to continuity.")
116 if (
present(u_cor_aux) .neqv.
present(uhbt_aux))
call mom_error(fatal, &
117 "MOM_continuity: u_cor_aux can only be calculated if uhbt_aux is"// &
118 " provided, and uhbt_aux has no other purpose. Include both arguments"//&
121 if (cs%continuity_scheme == ppm_scheme)
then
122 call continuity_ppm(u, v, hin, h, uh, vh, dt, g, gv, us, cs%PPM_CSp, uhbt, vhbt, obc, &
123 visc_rem_u, visc_rem_v, u_cor, v_cor, &
124 uhbt_aux, vhbt_aux, u_cor_aux, v_cor_aux, bt_cont)
126 call mom_error(fatal,
"continuity: Unrecognized value of continuity_scheme")
129 end subroutine continuity
132 subroutine continuity_init(Time, G, GV, param_file, diag, CS)
133 type(time_type),
target,
intent(in) :: time
137 type(
diag_ctrl),
target,
intent(inout) :: diag
140 #include "version_variable.h"
141 character(len=40) :: mdl =
"MOM_continuity"
142 character(len=20) :: tmpstr
144 if (
associated(cs))
then
145 call mom_error(warning,
"continuity_init called with associated control structure.")
152 call get_param(param_file, mdl,
"CONTINUITY_SCHEME", tmpstr, &
153 "CONTINUITY_SCHEME selects the discretization for the "//&
154 "continuity solver. The only valid value currently is: \n"//&
155 "\t PPM - use a positive-definite (or monotonic) \n"//&
156 "\t piecewise parabolic reconstruction solver.", &
159 tmpstr = uppercase(tmpstr) ; cs%continuity_scheme = 0
160 select case (trim(tmpstr))
161 case (ppm_string) ; cs%continuity_scheme = ppm_scheme
163 call mom_mesg(
'continuity_init: CONTINUITY_SCHEME ="'//trim(tmpstr)//
'"', 0)
164 call mom_mesg(
"continuity_init: The only valid value is currently "// &
166 call mom_error(fatal,
"continuity_init: Unrecognized setting "// &
167 "#define CONTINUITY_SCHEME "//trim(tmpstr)//
" found in input file.")
170 if (cs%continuity_scheme == ppm_scheme)
then
171 call continuity_ppm_init(time, g, gv, param_file, diag, cs%PPM_CSp)
174 end subroutine continuity_init
178 function continuity_stencil(CS)
result(stencil)
184 if (cs%continuity_scheme == ppm_scheme)
then
185 stencil = continuity_ppm_stencil(cs%PPM_CSp)
188 end function continuity_stencil
191 subroutine continuity_end(CS)
194 if (cs%continuity_scheme == ppm_scheme)
then
195 call continuity_ppm_end(cs%PPM_CSp)
200 end subroutine continuity_end