24 implicit none ;
private
26 #include <MOM_memory.h>
28 public pressureforce, pressureforce_init, pressureforce_end
32 logical :: analytic_fv_pgf
34 logical :: blocked_afv
47 subroutine pressureforce(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm, pbce, eta)
51 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
54 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
56 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
59 type(
ale_cs),
pointer :: ale_csp
60 real,
dimension(:,:), &
61 optional,
pointer :: p_atm
63 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
64 optional,
intent(out) :: pbce
66 real,
dimension(SZI_(G),SZJ_(G)), &
67 optional,
intent(out) :: eta
70 if (cs%Analytic_FV_PGF .and. cs%blocked_AFV)
then
71 if (gv%Boussinesq)
then
72 call pressureforce_blk_afv_bouss(h, tv, pfu, pfv, g, gv, us, &
73 cs%PressureForce_blk_AFV_CSp, ale_csp, p_atm, pbce, eta)
75 call pressureforce_blk_afv_nonbouss(h, tv, pfu, pfv, g, gv, us, &
76 cs%PressureForce_blk_AFV_CSp, p_atm, pbce, eta)
78 elseif (cs%Analytic_FV_PGF)
then
79 if (gv%Boussinesq)
then
80 call pressureforce_afv_bouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_AFV_CSp, &
81 ale_csp, p_atm, pbce, eta)
83 call pressureforce_afv_nonbouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_AFV_CSp, &
84 ale_csp, p_atm, pbce, eta)
87 if (gv%Boussinesq)
then
88 call pressureforce_mont_bouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_Mont_CSp, &
91 call pressureforce_mont_nonbouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_Mont_CSp, &
96 end subroutine pressureforce
99 subroutine pressureforce_init(Time, G, GV, US, param_file, diag, CS, tides_CSp)
100 type(time_type),
target,
intent(in) :: time
105 type(
diag_ctrl),
target,
intent(inout) :: diag
108 #include "version_variable.h"
109 character(len=40) :: mdl =
"MOM_PressureForce"
111 if (
associated(cs))
then
112 call mom_error(warning,
"PressureForce_init called with an associated "// &
113 "control structure.")
115 else ;
allocate(cs) ;
endif
119 call get_param(param_file, mdl,
"ANALYTIC_FV_PGF", cs%Analytic_FV_PGF, &
120 "If true the pressure gradient forces are calculated "//&
121 "with a finite volume form that analytically integrates "//&
122 "the equations of state in pressure to avoid any "//&
123 "possibility of numerical thermobaric instability, as "//&
124 "described in Adcroft et al., O. Mod. (2008).", default=.true.)
125 call get_param(param_file, mdl,
"BLOCKED_ANALYTIC_FV_PGF", cs%blocked_AFV, &
126 "If true, used the blocked version of the ANALYTIC_FV_PGF "//&
127 "code. The value of this parameter should not change answers.", &
128 default=.false., do_not_log=.true., debuggingparam=.true.)
130 if (cs%Analytic_FV_PGF .and. cs%blocked_AFV)
then
131 call pressureforce_blk_afv_init(time, g, gv, us, param_file, diag, &
132 cs%PressureForce_blk_AFV_CSp, tides_csp)
133 elseif (cs%Analytic_FV_PGF)
then
134 call pressureforce_afv_init(time, g, gv, us, param_file, diag, &
135 cs%PressureForce_AFV_CSp, tides_csp)
137 call pressureforce_mont_init(time, g, gv, us, param_file, diag, &
138 cs%PressureForce_Mont_CSp, tides_csp)
141 end subroutine pressureforce_init
144 subroutine pressureforce_end(CS)
147 if (cs%Analytic_FV_PGF .and. cs%blocked_AFV)
then
148 call pressureforce_blk_afv_end(cs%PressureForce_blk_AFV_CSp)
149 elseif (cs%Analytic_FV_PGF)
then
150 call pressureforce_afv_end(cs%PressureForce_AFV_CSp)
152 call pressureforce_mont_end(cs%PressureForce_Mont_CSp)
155 if (
associated(cs))
deallocate(cs)
156 end subroutine pressureforce_end