← back to index

src/core/MOM_PressureForce.F90

portedportable, not yet portedexecuted, not portableexecutable, not hit by this run

1! This file is part of MOM6, the Modular Ocean Model version 6.
2! See the LICENSE file for licensing information.
3! SPDX-License-Identifier: Apache-2.0
4
5!> A thin wrapper for Boussinesq/non-Boussinesq forms of the pressure force calculation.
6module MOM_PressureForce
7
8use MOM_diag_mediator, only : diag_ctrl, time_type
9use MOM_error_handler, only : MOM_error, MOM_mesg, FATAL, WARNING, is_root_pe
10use MOM_file_parser, only : get_param, log_version, param_file_type
11use MOM_grid, only : ocean_grid_type
12use MOM_PressureForce_FV, only : PressureForce_FV_Bouss, PressureForce_FV_nonBouss
13use MOM_PressureForce_FV, only : PressureForce_FV_init
14use MOM_PressureForce_FV, only : PressureForce_FV_CS
15use MOM_PressureForce_Mont, only : PressureForce_Mont_Bouss, PressureForce_Mont_nonBouss
16use MOM_PressureForce_Mont, only : PressureForce_Mont_init
17use MOM_PressureForce_Mont, only : PressureForce_Mont_CS
18use MOM_self_attr_load, only : SAL_CS
19use MOM_tidal_forcing, only : tidal_forcing_CS
20use MOM_unit_scaling, only : unit_scale_type
21use MOM_variables, only : thermo_var_ptrs, accel_diag_ptrs
22use MOM_verticalGrid, only : verticalGrid_type
23use MOM_ALE, only: ALE_CS
24implicit none ; private
25
26#include <MOM_memory.h>
27
28public PressureForce, PressureForce_init
29
30!> Pressure force control structure
31type, public :: PressureForce_CS ; private
32 logical :: Analytic_FV_PGF !< If true, use the analytic finite volume form
33 !! (Adcroft et al., Ocean Mod. 2008) of the PGF.
34 !> Control structure for the analytically integrated finite volume pressure force
35 type(PressureForce_FV_CS) :: PressureForce_FV
36 !> Control structure for the Montgomery potential form of pressure force
37 type(PressureForce_Mont_CS) :: PressureForce_Mont
38end type PressureForce_CS
39
40contains
41
42!> A thin layer between the model and the Boussinesq and non-Boussinesq pressure force routines.
4348subroutine PressureForce(h, tv, PFu, PFv, G, GV, US, CS, ALE_CSp, ADp, p_atm, pbce, eta)
44 type(ocean_grid_type), intent(in) :: G !< The ocean's grid structure
45 type(verticalGrid_type), intent(in) :: GV !< The ocean's vertical grid structure
46 type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
47 real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
48 intent(in) :: h !< Layer thicknesses [H ~> m or kg m-2]
49 type(thermo_var_ptrs), intent(in) :: tv !< A structure pointing to various thermodynamic variables
50 real, dimension(SZIB_(G),SZJ_(G),SZK_(GV)), &
51 intent(out) :: PFu !< Zonal pressure force acceleration [L T-2 ~> m s-2]
52 real, dimension(SZI_(G),SZJB_(G),SZK_(GV)), &
53 intent(out) :: PFv !< Meridional pressure force acceleration [L T-2 ~> m s-2]
54 type(PressureForce_CS), intent(inout) :: CS !< Pressure force control structure
55 type(ALE_CS), pointer :: ALE_CSp !< ALE control structure
56 type(accel_diag_ptrs), pointer :: ADp !< Acceleration diagnostic pointers
57 real, dimension(:,:), pointer :: p_atm !< The pressure at the ice-ocean or
58 !! atmosphere-ocean interface [R L2 T-2 ~> Pa].
59 real, dimension(SZI_(G),SZJ_(G),SZK_(GV)), &
60 optional, intent(out) :: pbce !< The baroclinic pressure anomaly in each layer
61 !! due to eta anomalies [L2 T-2 H-1 ~> m s-2 or m4 s-2 kg-1].
62 real, dimension(SZI_(G),SZJ_(G)), &
63 optional, intent(out) :: eta !< The bottom mass used to calculate PFu and PFv,
64 !! [H ~> m or kg m-2], with any tidal contributions.
65
6624 if (CS%Analytic_FV_PGF) then
6724 if (GV%Boussinesq) then
68 call PressureForce_FV_Bouss(h, tv, PFu, PFv, G, GV, US, CS%PressureForce_FV, &
6924 ALE_CSp, ADp, p_atm, pbce, eta)
70 else
71 call PressureForce_FV_nonBouss(h, tv, PFu, PFv, G, GV, US, CS%PressureForce_FV, &
720 ALE_CSp, ADp, p_atm, pbce, eta)
73 endif
74 else
750 if (GV%Boussinesq) then
76 call PressureForce_Mont_Bouss(h, tv, PFu, PFv, G, GV, US, CS%PressureForce_Mont, &
770 p_atm, pbce, eta)
78 else
79 call PressureForce_Mont_nonBouss(h, tv, PFu, PFv, G, GV, US, CS%PressureForce_Mont, &
800 p_atm, pbce, eta)
81 endif
82 endif
83
8448end subroutine Pressureforce
85
86!> Initialize the pressure force control structure
871subroutine PressureForce_init(Time, G, GV, US, param_file, diag, CS, ADp, SAL_CSp, tides_CSp)
88 type(time_type), target, intent(in) :: Time !< Current model time
89 type(ocean_grid_type), intent(in) :: G !< Ocean grid structure
90 type(verticalGrid_type), intent(in) :: GV !< Vertical grid structure
91 type(unit_scale_type), intent(in) :: US !< A dimensional unit scaling type
92 type(param_file_type), intent(in) :: param_file !< Parameter file handles
93 type(diag_ctrl), target, intent(inout) :: diag !< Diagnostics control structure
94 type(PressureForce_CS), intent(inout) :: CS !< Pressure force control structure
95 type(accel_diag_ptrs), pointer :: ADp !< Acceleration diagnostic pointers
96 type(SAL_CS), intent(in), optional :: SAL_CSp !< SAL control structure
97 type(tidal_forcing_CS), intent(in), optional :: tides_CSp !< Tide control structure
98#include "version_variable.h"
99 character(len=40) :: mdl = "MOM_PressureForce" ! This module's name.
100
101 ! Read all relevant parameters and write them to the model log.
1021 call log_version(param_file, mdl, version, "")
103 call get_param(param_file, mdl, "ANALYTIC_FV_PGF", CS%Analytic_FV_PGF, &
104 "If true the pressure gradient forces are calculated "//&
105 "with a finite volume form that analytically integrates "//&
106 "the equations of state in pressure to avoid any "//&
107 "possibility of numerical thermobaric instability, as "//&
1081 "described in Adcroft et al., O. Mod. (2008).", default=.true.)
109
1101 if (CS%Analytic_FV_PGF) then
111 !$omp target enter data map(alloc: CS%PressureForce_FV)
112 call PressureForce_FV_init(Time, G, GV, US, param_file, diag, &
1131 CS%PressureForce_FV, ADp, SAL_CSp, tides_CSp)
114 else
115 call PressureForce_Mont_init(Time, G, GV, US, param_file, diag, &
1160 CS%PressureForce_Mont, SAL_CSp, tides_CSp)
117 endif
118 !$omp target update to(CS)
1191end subroutine PressureForce_init
120
121!> \namespace mom_pressureforce
122!!
123!! This thin module provides a branch to two forms of the horizontal accelerations
124!! due to pressure gradients. The two options currently available are a
125!! Montgomery potential form (used in traditional isopycnal layer models), and the
126!! analytic finite volume form.
127
1280end module MOM_PressureForce