21 implicit none ;
private
23 #include <MOM_memory.h>
25 public pressureforce, pressureforce_init, pressureforce_end
29 logical :: analytic_fv_pgf
40 subroutine pressureforce(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, p_atm, pbce, eta)
44 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
47 real,
dimension(SZIB_(G),SZJ_(G),SZK_(G)), &
49 real,
dimension(SZI_(G),SZJB_(G),SZK_(G)), &
52 type(
ale_cs),
pointer :: ale_csp
53 real,
dimension(:,:), &
54 optional,
pointer :: p_atm
56 real,
dimension(SZI_(G),SZJ_(G),SZK_(G)), &
57 optional,
intent(out) :: pbce
59 real,
dimension(SZI_(G),SZJ_(G)), &
60 optional,
intent(out) :: eta
63 if (cs%Analytic_FV_PGF)
then
64 if (gv%Boussinesq)
then
65 call pressureforce_fv_bouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_FV_CSp, &
66 ale_csp, p_atm, pbce, eta)
68 call pressureforce_fv_nonbouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_FV_CSp, &
69 ale_csp, p_atm, pbce, eta)
72 if (gv%Boussinesq)
then
73 call pressureforce_mont_bouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_Mont_CSp, &
76 call pressureforce_mont_nonbouss(h, tv, pfu, pfv, g, gv, us, cs%PressureForce_Mont_CSp, &
81 end subroutine pressureforce
84 subroutine pressureforce_init(Time, G, GV, US, param_file, diag, CS, tides_CSp)
85 type(time_type),
target,
intent(in) :: time
90 type(
diag_ctrl),
target,
intent(inout) :: diag
93 #include "version_variable.h"
94 character(len=40) :: mdl =
"MOM_PressureForce"
96 if (
associated(cs))
then
97 call mom_error(warning,
"PressureForce_init called with an associated "// &
100 else ;
allocate(cs) ;
endif
104 call get_param(param_file, mdl,
"ANALYTIC_FV_PGF", cs%Analytic_FV_PGF, &
105 "If true the pressure gradient forces are calculated "//&
106 "with a finite volume form that analytically integrates "//&
107 "the equations of state in pressure to avoid any "//&
108 "possibility of numerical thermobaric instability, as "//&
109 "described in Adcroft et al., O. Mod. (2008).", default=.true.)
111 if (cs%Analytic_FV_PGF)
then
112 call pressureforce_fv_init(time, g, gv, us, param_file, diag, &
113 cs%PressureForce_FV_CSp, tides_csp)
115 call pressureforce_mont_init(time, g, gv, us, param_file, diag, &
116 cs%PressureForce_Mont_CSp, tides_csp)
119 end subroutine pressureforce_init
122 subroutine pressureforce_end(CS)
125 if (cs%Analytic_FV_PGF)
then
126 call pressureforce_fv_end(cs%PressureForce_FV_CSp)
128 call pressureforce_mont_end(cs%PressureForce_Mont_CSp)
131 if (
associated(cs))
deallocate(cs)
132 end subroutine pressureforce_end