forked from mom-ocean/MOM6
-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
*Updates in FPMix and Stokes Most #283
Merged
alperaltuntas
merged 23 commits into
NCAR:dev/ncar
from
gustavo-marques:fpmix_updates_june24
Sep 9, 2024
Merged
Changes from 13 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
158d60c
Uncomment omega_w2x allocation and calculation
gustavo-marques c916e3e
Uncomment omega_w2x diagnostic handle and deallocation
gustavo-marques dcb1dee
Uncomment copy of omega_w2x into CS
gustavo-marques e38ee1c
Updates in FPMix
gustavo-marques 58c1cd5
Move declaration to the right subroutine
gustavo-marques e5ed1a4
Merge branch 'omega_w2x_changes' into fpmix_updates_june24
gustavo-marques 8c86cfe
Add STOKES_MOST interface
gustavo-marques db4f712
Add comments and define units, improve numerics
gustavo-marques 688f11f
Make CEMP_NL an user-defined parameter
gustavo-marques 4d12830
Merge branch 'dev/ncar' into fpmix_updates_june24
gustavo-marques 4acea91
MARBL: convert salt_flux to tracer flux and add to STF
klindsay28 1e1f390
Added use statement for MOM_diabatic_driver module
gustavo-marques 621107b
Modify NUOPC cap to accept separate glc runoff fluxes (#288)
alperaltuntas f8f76f2
remove doxygen formatting on local variables
klindsay28 add51a9
Add arguments lost during merge and use u_inst/v_inst
gustavo-marques 373fd39
Merge branch 'fpmix_updates_sep01' into fpmix_updates_june24
gustavo-marques b5641af
Merge pull request #298 from klindsay28/marbl_stf_salt_fluxes
mnlevy1981 a077a61
Use longString in MAX_LAYER_THICKNESS (#299)
gustavo-marques 63d2420
Merge branch 'pr283_b' into dev/ncar
alperaltuntas bc29680
update CVMix
alperaltuntas 37fe24c
fix minor FPMix bugs and restore answers for non-FPMix runs
alperaltuntas f3bd9f0
add doxygen documentation to vertvisc
alperaltuntas b70aa46
Fix omp directive in KPP_compute_BLD
alperaltuntas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ module MOM_dynamics_split_RK2 | |
use MOM_cpu_clock, only : cpu_clock_id, cpu_clock_begin, cpu_clock_end | ||
use MOM_cpu_clock, only : CLOCK_COMPONENT, CLOCK_SUBCOMPONENT | ||
use MOM_cpu_clock, only : CLOCK_MODULE_DRIVER, CLOCK_MODULE, CLOCK_ROUTINE | ||
use MOM_diabatic_driver, only : diabatic_CS, extract_diabatic_member | ||
use MOM_diag_mediator, only : diag_mediator_init, enable_averages | ||
use MOM_diag_mediator, only : disable_averaging, post_data, safe_alloc_ptr | ||
use MOM_diag_mediator, only : post_product_u, post_product_sum_u | ||
|
@@ -45,7 +46,9 @@ module MOM_dynamics_split_RK2 | |
use MOM_continuity, only : continuity_init, continuity_stencil | ||
use MOM_CoriolisAdv, only : CorAdCalc, CoriolisAdv_CS | ||
use MOM_CoriolisAdv, only : CoriolisAdv_init, CoriolisAdv_end | ||
use MOM_CVMix_KPP, only : KPP_get_BLD, KPP_CS | ||
use MOM_debugging, only : check_redundant | ||
use MOM_energetic_PBL, only : energetic_PBL_get_MLD, energetic_PBL_CS | ||
use MOM_grid, only : ocean_grid_type | ||
use MOM_hor_index, only : hor_index_type | ||
use MOM_hor_visc, only : horizontal_viscosity, hor_visc_CS, hor_visc_vel_stencil | ||
|
@@ -137,14 +140,16 @@ module MOM_dynamics_split_RK2 | |
real ALLOCABLE_, dimension(NIMEM_,NJMEM_,NKMEM_) :: pbce !< pbce times eta gives the baroclinic pressure | ||
!! anomaly in each layer due to free surface height | ||
!! anomalies [L2 H-1 T-2 ~> m s-2 or m4 kg-1 s-2]. | ||
type(KPP_CS), pointer :: KPP_CSp => NULL() !< KPP control structure needed to ge | ||
type(energetic_PBL_CS), pointer :: energetic_PBL_CSp => NULL() !< ePBL control structure | ||
|
||
real, pointer, dimension(:,:) :: taux_bot => NULL() !< frictional x-bottom stress from the ocean | ||
!! to the seafloor [R L Z T-2 ~> Pa] | ||
real, pointer, dimension(:,:) :: tauy_bot => NULL() !< frictional y-bottom stress from the ocean | ||
!! to the seafloor [R L Z T-2 ~> Pa] | ||
type(BT_cont_type), pointer :: BT_cont => NULL() !< A structure with elements that describe the | ||
!! effective summed open face areas as a function | ||
!! of barotropic flow. | ||
real, pointer, dimension(:,:) :: taux_bot => NULL() !< frictional x-bottom stress from the ocean | ||
!! to the seafloor [R L Z T-2 ~> Pa] | ||
real, pointer, dimension(:,:) :: tauy_bot => NULL() !< frictional y-bottom stress from the ocean | ||
!! to the seafloor [R L Z T-2 ~> Pa] | ||
type(BT_cont_type), pointer :: BT_cont => NULL() !< A structure with elements that describe the | ||
!! effective summed open face areas as a function | ||
!! of barotropic flow. | ||
|
||
! This is to allow the previous, velocity-based coupling with between the | ||
! baroclinic and barotropic modes. | ||
|
@@ -174,13 +179,13 @@ module MOM_dynamics_split_RK2 | |
!! the extent to which the treatment of gravity waves | ||
!! is forward-backward (0) or simulated backward | ||
!! Euler (1) [nondim]. 0 is often used. | ||
logical :: debug !< If true, write verbose checksums for debugging purposes. | ||
real :: Cemp_NL !< Empirical coefficient of non-local momentum mixing [nondim] | ||
logical :: debug !< If true, write verbose checksums for debugging purposes. | ||
logical :: debug_OBC !< If true, do debugging calls for open boundary conditions. | ||
logical :: fpmix = .false. !< If true, applies profiles of momentum flux magnitude and direction. | ||
logical :: fpmix !< If true, add non-local momentum flux increments and diffuse down the Eulerian gradient. | ||
logical :: module_is_initialized = .false. !< Record whether this module has been initialized. | ||
|
||
!>@{ Diagnostic IDs | ||
integer :: id_uold = -1, id_vold = -1 | ||
integer :: id_uh = -1, id_vh = -1 | ||
integer :: id_umo = -1, id_vmo = -1 | ||
integer :: id_umo_2d = -1, id_vmo_2d = -1 | ||
|
@@ -267,6 +272,7 @@ module MOM_dynamics_split_RK2 | |
public register_restarts_dyn_split_RK2 | ||
public initialize_dyn_split_RK2 | ||
public remap_dyn_split_RK2_aux_vars | ||
public init_dyn_split_RK2_diabatic | ||
public end_dyn_split_RK2 | ||
|
||
!>@{ CPU time clock IDs | ||
|
@@ -394,7 +400,8 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f | |
logical :: Use_Stokes_PGF ! If true, add Stokes PGF to hydrostatic PGF | ||
!---For group halo pass | ||
logical :: showCallTree, sym | ||
|
||
logical :: lFPpost ! Used to only post diagnostics in vertFPmix when fpmix=true and | ||
! in the corrector step (not the predict) | ||
integer :: i, j, k, is, ie, js, je, Isq, Ieq, Jsq, Jeq, nz | ||
integer :: cont_stencil, obc_stencil, vel_stencil | ||
|
||
|
@@ -710,16 +717,22 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f | |
call thickness_to_dz(h, tv, dz, G, GV, US, halo_size=1) | ||
call vertvisc_coef(up, vp, h, dz, forces, visc, tv, dt_pred, G, GV, US, CS%vertvisc_CSp, & | ||
CS%OBC, VarMix) | ||
call vertvisc(up, vp, h, forces, visc, dt_pred, CS%OBC, CS%AD_pred, CS%CDp, G, & | ||
GV, US, CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, waves=waves) | ||
|
||
if (CS%fpmix) then | ||
hbl(:,:) = 0.0 | ||
if (associated(visc%h_ML)) hbl(:,:) = visc%h_ML(:,:) | ||
call vertFPmix(up, vp, uold, vold, hbl, h, forces, & | ||
dt_pred, G, GV, US, CS%vertvisc_CSp, CS%OBC) | ||
call vertvisc(up, vp, h, forces, visc, dt_pred, CS%OBC, CS%ADp, CS%CDp, G, & | ||
GV, US, CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, waves=waves) | ||
if (ASSOCIATED(CS%KPP_CSp)) call KPP_get_BLD(CS%KPP_CSp, hbl, G, US, m_to_BLD_units=GV%m_to_H) | ||
if (ASSOCIATED(CS%energetic_PBL_CSp)) & | ||
call energetic_PBL_get_MLD(CS%energetic_PBL_CSp, hbl, G, US, m_to_MLD_units=GV%m_to_H) | ||
|
||
! lFPpost must be false in the predictor step to avoid averaging into the diagnostics | ||
lFPpost = .false. | ||
call vertFPmix(up, vp, uold, vold, hbl, h, forces, dt_pred, lFPpost, CS%Cemp_NL, & | ||
G, GV, US, CS%vertvisc_CSp, CS%OBC, waves=waves) | ||
call vertvisc(up, vp, h, forces, visc, dt_pred, CS%OBC, CS%AD_pred, CS%CDp, G, & | ||
GV, US, CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, fpmix=CS%fpmix, waves=waves) | ||
else | ||
call vertvisc(up, vp, h, forces, visc, dt_pred, CS%OBC, CS%AD_pred, CS%CDp, G, & | ||
GV, US, CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, waves=waves) | ||
endif | ||
|
||
if (showCallTree) call callTree_wayPoint("done with vertvisc (step_MOM_dyn_split_RK2)") | ||
|
@@ -960,12 +973,15 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f | |
|
||
call thickness_to_dz(h, tv, dz, G, GV, US, halo_size=1) | ||
call vertvisc_coef(u_inst, v_inst, h, dz, forces, visc, tv, dt, G, GV, US, CS%vertvisc_CSp, CS%OBC, VarMix) | ||
call vertvisc(u_inst, v_inst, h, forces, visc, dt, CS%OBC, CS%ADp, CS%CDp, G, GV, US, & | ||
CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot,waves=waves) | ||
|
||
if (CS%fpmix) then | ||
call vertFPmix(u_inst, v_inst, uold, vold, hbl, h, forces, dt, & | ||
G, GV, US, CS%vertvisc_CSp, CS%OBC) | ||
lFPpost = .true. | ||
call vertFPmix(u_inst, v_inst, uold, vold, hbl, h, forces, dt, lFPpost, CS%Cemp_NL, & | ||
G, GV, US, CS%vertvisc_CSp, CS%OBC, Waves=Waves) | ||
call vertvisc(u_inst, v_inst, h, forces, visc, dt, CS%OBC, CS%ADp, CS%CDp, G, GV, US, & | ||
CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, fpmix=CS%fpmix, waves=waves) | ||
|
||
else | ||
call vertvisc(u_inst, v_inst, h, forces, visc, dt, CS%OBC, CS%ADp, CS%CDp, G, GV, US, & | ||
CS%vertvisc_CSp, CS%taux_bot, CS%tauy_bot, waves=waves) | ||
endif | ||
|
@@ -1052,11 +1068,6 @@ subroutine step_MOM_dyn_split_RK2(u_inst, v_inst, h, tv, visc, Time_local, dt, f | |
CS%CAu_pred_stored = .false. | ||
endif | ||
|
||
if (CS%fpmix) then | ||
if (CS%id_uold > 0) call post_data(CS%id_uold, uold, CS%diag) | ||
if (CS%id_vold > 0) call post_data(CS%id_vold, vold, CS%diag) | ||
endif | ||
|
||
! The time-averaged free surface height has already been set by the last call to btstep. | ||
|
||
! Deallocate this memory to avoid a memory leak. ### We should revisit how this array is declared. -RWH | ||
|
@@ -1290,6 +1301,17 @@ subroutine remap_dyn_split_RK2_aux_vars(G, GV, CS, h_old_u, h_old_v, h_new_u, h_ | |
|
||
end subroutine remap_dyn_split_RK2_aux_vars | ||
|
||
!> Initializes aspects of the dyn_split_RK2 that depend on diabatic processes. | ||
!! Needed when BLDs are used in the dynamics. | ||
subroutine init_dyn_split_RK2_diabatic(diabatic_CSp, CS) | ||
type(diabatic_CS), intent(in) :: diabatic_CSp !< diabatic structure | ||
type(MOM_dyn_split_RK2_CS), pointer :: CS !< module control structure | ||
|
||
call extract_diabatic_member(diabatic_CSp, KPP_CSp=CS%KPP_CSp) | ||
call extract_diabatic_member(diabatic_CSp, energetic_PBL_CSp=CS%energetic_PBL_CSp) | ||
|
||
end subroutine init_dyn_split_RK2_diabatic | ||
|
||
!> This subroutine initializes all of the variables that are used by this | ||
!! dynamic core, including diagnostics and the cpu clocks. | ||
subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, param_file, & | ||
|
@@ -1402,8 +1424,13 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p | |
"timestep for use in the predictor step of the next split RK2 timestep.", & | ||
default=.true.) | ||
call get_param(param_file, mdl, "FPMIX", CS%fpmix, & | ||
"If true, apply profiles of momentum flux magnitude and "//& | ||
" direction", default=.false.) | ||
"If true, add non-local momentum flux increments and diffuse down the Eulerian gradient.", & | ||
default=.false.) | ||
if (CS%fpmix) then | ||
call get_param(param_file, "MOM", "CEMP_NL", CS%Cemp_NL, & | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MOM? |
||
"Empirical coefficient of non-local momentum mixing.", & | ||
units="nondim", default=3.6) | ||
endif | ||
call get_param(param_file, mdl, "REMAP_AUXILIARY_VARS", CS%remap_aux, & | ||
"If true, apply ALE remapping to all of the auxiliary 3-dimensional "//& | ||
"variables that are needed to reproduce across restarts, similarly to "//& | ||
|
@@ -1480,7 +1507,8 @@ subroutine initialize_dyn_split_RK2(u, v, h, tv, uh, vh, eta, Time, G, GV, US, p | |
call PressureForce_init(Time, G, GV, US, param_file, diag, CS%PressureForce_CSp, & | ||
CS%SAL_CSp, CS%tides_CSp) | ||
call hor_visc_init(Time, G, GV, US, param_file, diag, CS%hor_visc, ADp=CS%ADp) | ||
call vertvisc_init(MIS, Time, G, GV, US, param_file, diag, CS%ADp, dirs, ntrunc, CS%vertvisc_CSp) | ||
call vertvisc_init(MIS, Time, G, GV, US, param_file, diag, CS%ADp, dirs, & | ||
ntrunc, CS%vertvisc_CSp, CS%fpmix) | ||
CS%set_visc_CSp => set_visc | ||
call updateCFLtruncationValue(Time, CS%vertvisc_CSp, US, activate=is_new_run(restart_CS) ) | ||
|
||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lowercase keywords