Skip to content
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

Add MARBL to MOM6 #157

Merged
merged 205 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from 78 commits
Commits
Show all changes
205 commits
Select commit Hold shift + click to select a range
3c56f64
Update MOM6_DA_hooks submodule
mnlevy1981 May 16, 2019
253a0c4
Create a placeholder MARBL tracer module
mnlevy1981 May 23, 2019
fca200b
Add flag to turn on MARBL tracers
mnlevy1981 Jun 18, 2019
3752e3b
Add MARBL as submodule
mnlevy1981 Jun 18, 2019
22e2332
Add doxygen documentation to marbl_instances
mnlevy1981 Jun 18, 2019
31c25b5
Update submodules to use https not ssh
mnlevy1981 Jun 18, 2019
1018e9d
Softlink to MARBL source code
mnlevy1981 Jun 18, 2019
255b73b
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Sep 6, 2019
d6e37c3
Remove diag_to_Z_CS
mnlevy1981 Sep 6, 2019
5bfd467
Move MARBL%init out of register_MARBL_tracers
mnlevy1981 Sep 10, 2019
4ace7c9
Read marbl_in from run directory
mnlevy1981 Sep 13, 2019
b4e5e3f
Add ability to write MARBL log to stdout
mnlevy1981 Sep 19, 2019
cb72bdc
Add doxygen documentation for print_marbl_log()
mnlevy1981 Sep 19, 2019
0b625ab
Call MARBL's shutdown() routine
mnlevy1981 Sep 19, 2019
dd4408b
Erase MARBL log after printing to stdout
mnlevy1981 Sep 19, 2019
2256335
Read in MARBL tracers IC file
mnlevy1981 Sep 26, 2019
4c2b7d6
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Oct 9, 2019
e629a49
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Feb 13, 2020
00006b8
Update MARBL to latest development commit
mnlevy1981 Feb 13, 2020
eb0d391
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Mar 11, 2020
79ebe63
Change git submodule commit for MOM6_DA_hooks
mnlevy1981 Mar 11, 2020
ba4142b
Make configure_MARBL_tracers() private
mnlevy1981 May 1, 2020
2448731
Removed MARBL as submodule
mnlevy1981 May 1, 2020
f5a2a63
Add pkg/MARBL to .gitignore
mnlevy1981 May 1, 2020
0309b56
Introduce _USE_MARBL_TRACERS macro
mnlevy1981 May 2, 2020
cd0eb5a
Register MARBL diagnostics
mnlevy1981 May 5, 2020
34481ed
call MARBL_tracers_surface_state()
mnlevy1981 May 12, 2020
e993457
Move call to surface_flux_compute()
mnlevy1981 May 14, 2020
49618f1
add surface flux diags to history output
mnlevy1981 May 15, 2020
c61e7b7
Initialize surface flux forcings better
mnlevy1981 May 29, 2020
14a2a3d
Move module memory into CS type
mnlevy1981 May 29, 2020
eff17a4
Provide T & S for surface forcing
mnlevy1981 Jun 11, 2020
3845500
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Jun 12, 2020
7ed2327
Add saved state for surface fluxes
mnlevy1981 Jun 12, 2020
778a67f
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Jul 26, 2020
b14db56
Get ice fraction from the coupler
mnlevy1981 Aug 28, 2020
e84ffa9
Get u10_sqr from coupler
mnlevy1981 Sep 3, 2020
16db0c8
Clean up old comment
mnlevy1981 Sep 3, 2020
84065e9
Better unit conversion
mnlevy1981 Sep 3, 2020
fb08983
Module parameters for unit conversion
mnlevy1981 Sep 4, 2020
a6d2b42
Easy clean-up based on feedback from Andrew
mnlevy1981 Sep 11, 2020
d3ff402
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Sep 17, 2020
91367ab
Add missing variable declaration
mnlevy1981 Sep 17, 2020
6986cdf
Add saved state to restart file
mnlevy1981 Sep 17, 2020
b6d6392
Add surface flux to tracer_vertdiff call
mnlevy1981 Sep 21, 2020
8336b94
If tracers mandatory in restart, so is saved state
mnlevy1981 Sep 21, 2020
b108898
Move call to setup_saved_state()
mnlevy1981 Sep 22, 2020
c5034a2
Get dust and iron fluxes from coupler
mnlevy1981 Sep 23, 2020
3d4ac94
Add option to read NDEP from a file
mnlevy1981 Oct 2, 2020
bebce72
Update NDEP scale factor, work to interior_tend
mnlevy1981 Oct 29, 2020
dc7431e
More support for interior_tendency_compute() call
mnlevy1981 Oct 29, 2020
318a777
Update MARBL domain per-column
mnlevy1981 Oct 30, 2020
7255b9a
Add indices for interior tendency forcings
mnlevy1981 Nov 12, 2020
e5db1e8
Copy t & s -> interior_tendency_forcing
mnlevy1981 Nov 13, 2020
17578a0
Call marbl_interior_tendency_compute()
mnlevy1981 Dec 4, 2020
f8a6f9d
Add parameters to read in fe sed / vent fluxes
mnlevy1981 Dec 4, 2020
7b34469
Get FESEDFLUX into MARBL
mnlevy1981 Dec 17, 2020
fc18d15
Had a few issues in last commit
mnlevy1981 Dec 18, 2020
09f12d1
Use time_interp_external() not MOM_read_data()
mnlevy1981 Jan 8, 2021
8d1250b
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Jan 20, 2021
5b22d46
Add surface_flux and tendency to diagnostic output
mnlevy1981 Feb 6, 2021
59b05ca
Fix bug in units of z-coordinate vars
mnlevy1981 Feb 17, 2021
2bd7f86
Remove _USE_MARBL_TRACERS CPP macro
mnlevy1981 Feb 18, 2021
8371d68
Update ndep file
mnlevy1981 Feb 22, 2021
9b89eb4
Ignore levels below kmt from marbl_instance object
mnlevy1981 Feb 23, 2021
e605d20
Refactor where MARBL forcings are defined
mnlevy1981 Feb 26, 2021
222026e
Finish refactoring mct driver
mnlevy1981 Feb 26, 2021
5e6ecbb
Start updating forcings in nuopc cap
mnlevy1981 Feb 27, 2021
14c3280
Add several new diagnostics for tracers
mnlevy1981 Mar 18, 2021
3f650c5
Register and post FLUX_CPL diagnostics
mnlevy1981 Apr 2, 2021
ead44e3
First pass at adding support for river fluxes
mnlevy1981 Apr 3, 2021
9a8afd0
Merge tag 'dev/ncar_20210409' into mnlevy1981/add_MARBL
mnlevy1981 Apr 19, 2021
280b13e
Fix to read_attribute_str()
mnlevy1981 Apr 19, 2021
d617ca5
Code clean-up:
mnlevy1981 Apr 22, 2021
174bd40
Update doxygen documentation
mnlevy1981 Apr 23, 2021
c2511a0
One more round of formatting clean-up
mnlevy1981 Apr 23, 2021
e526b26
Proper units for _zint and _zint_100m
mnlevy1981 Apr 23, 2021
023e698
More river flux clean-up
mnlevy1981 May 5, 2021
ac2e7a3
Add more fluxes to nuopc cap
mnlevy1981 Jun 17, 2021
31844b6
Remove marbl_work from mom_cap_methods
mnlevy1981 Jun 17, 2021
94babe3
Refactor interacting with time_interp_external
mnlevy1981 Jun 24, 2021
576267b
Fix formatting to make doxygen happy
mnlevy1981 Jul 1, 2021
ec04d3b
Pass bot_flux_to_tend to MARBL
mnlevy1981 Jul 9, 2021
6b2b55a
Use bot_flux_to_tend from tracer_vertdiff
mnlevy1981 Jul 10, 2021
cc56f66
Remove KMT kludge
mnlevy1981 Jul 10, 2021
3e38eef
Add bot_flux_to_tend to diagnostic output
mnlevy1981 Jul 13, 2021
df92110
Avoid allocating MARBL memory unless needed
mnlevy1981 Jul 30, 2021
1c0d456
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Aug 13, 2021
15d9df6
Add bot_flux_to_tend to dummy interface
mnlevy1981 Aug 13, 2021
2060aeb
Split long line that doxygen flagged
mnlevy1981 Aug 13, 2021
af91fee
Add BOT_FLUX_MIX_THICKNESS parameter
mnlevy1981 Aug 23, 2021
b097bc7
Reformulate bot_flux_to_tend algorithm
mnlevy1981 Aug 24, 2021
cdb8940
Set default thickness for bot_flux_to_tend to 1m
mnlevy1981 Sep 1, 2021
7551f21
Set tracer_inds outside of (.not. restart) block
mnlevy1981 Sep 15, 2021
143a7f6
Clean up how / where tracer_inds are set
mnlevy1981 Sep 17, 2021
d036fe7
Clean up some comments
mnlevy1981 Sep 23, 2021
7a28f8b
Check ref_depth for 2D diagnostics from MARBL
mnlevy1981 Oct 7, 2021
0ad88d5
Initialize negative tracer concentrations to 0
mnlevy1981 Oct 7, 2021
c75eb89
Fix bugs in iron_flux computation
mnlevy1981 Oct 7, 2021
37c0d5a
Need marbl_constants_mod.F90 for non-MARBL builds
mnlevy1981 Oct 7, 2021
a9fa070
Update doxygen documentation
mnlevy1981 Oct 7, 2021
689c59d
Clean up how we read FESEDFLUX files
mnlevy1981 Oct 26, 2021
1bda6a2
Don't modify values read from restart!
mnlevy1981 Oct 26, 2021
1b67e5f
Fix bug in accumulating 2D fields at ref_depth
mnlevy1981 Oct 26, 2021
c3ce30b
Only allocate memory we plan to use
mnlevy1981 Nov 8, 2021
faf9965
Include (i,j) indices in MARBL errors
mnlevy1981 Nov 8, 2021
00eb8e3
Merge tag 'dev/ncar_220225' into mnlevy1981/add_MARBL
mnlevy1981 Apr 8, 2022
91f9624
NUOPC cap improvements
mnlevy1981 Apr 14, 2022
6bad5fc
Bugfix in NUOPC cap
mnlevy1981 Apr 14, 2022
9bff1e1
Fix formatting
mnlevy1981 Apr 14, 2022
a7d0320
Merge remote-tracking branch 'upstream/dev/ncar' into mnlevy1981/add_…
mnlevy1981 Apr 14, 2022
37b07d0
Add KPP Nonlocal Terms to MARBL tracers
mnlevy1981 Apr 25, 2022
604b784
Convert dust_flux to cgs before sending to MARBL
mnlevy1981 Apr 25, 2022
cc5bd4e
Move riv_flux to applyTracerBoundaryFluxesInOut
mnlevy1981 Apr 25, 2022
416679c
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Sep 14, 2022
966286d
Major refactor of MARBL forcing fields
mnlevy1981 Sep 22, 2022
b6029fe
REVERT MCT CAP
mnlevy1981 Sep 22, 2022
03aa05c
Rename marbl_forcing_type_mod.F90
mnlevy1981 Sep 22, 2022
bad9af5
NUOPC cap set to receive all ice cat fields
mnlevy1981 Sep 22, 2022
ce78ef5
More per-category forcing updates
mnlevy1981 Sep 23, 2022
480b1a8
More ice category cleanup
mnlevy1981 Sep 24, 2022
b51c5a9
More ice category bug fixes
mnlevy1981 Oct 5, 2022
1d77f97
don't post diagnostics if not requested
mnlevy1981 Oct 5, 2022
271ac14
Remove kludgy threshold
mnlevy1981 Oct 5, 2022
609adbc
Rudimentary MARBL support in solo_driver
mnlevy1981 Oct 5, 2022
a0497d5
Change dust / iron parameter defaults
mnlevy1981 Oct 13, 2022
94bf089
atm_press = 1 atm when p_surf_full is unavailable
mnlevy1981 Oct 14, 2022
2d84e5c
Update IC file and units of RIV_FLUXES
mnlevy1981 Nov 3, 2022
f9d5206
update fesedflux files
mnlevy1981 Nov 8, 2022
c9913aa
Merge branch 'resolve_conflict' into mnlevy1981/add_MARBL
mnlevy1981 Nov 22, 2022
bcefb34
Merge tag 'dev/ncar_230121' into HEAD
mnlevy1981 Jan 28, 2023
2002d82
Use data_override for some MARBL forcing
mnlevy1981 Feb 2, 2023
5c6fddd
Support CHL_FROM_FILE=FALSE when using with MARBL
mnlevy1981 Feb 22, 2023
a40dc6e
Expand dummy cap for MARBL
mnlevy1981 Feb 22, 2023
5492c81
Refactor to use MARBL's get_output_for_GCM()
mnlevy1981 Feb 23, 2023
d192329
API for MARBL's get_output_for_GCM() changed
mnlevy1981 Feb 23, 2023
becd34f
Use MOM_initialize_tracer_from_Z not tracer_Z_init
mnlevy1981 Mar 7, 2023
f3f75e6
More updates for reading IC file
mnlevy1981 Mar 23, 2023
0683622
Update dummy interface for get_output_from_GCM()
mnlevy1981 Mar 23, 2023
a2d5500
Get NDEP from NUOPC instead of reading from file
mnlevy1981 Mar 28, 2023
78d6f44
Update solo_driver to handle ndep
mnlevy1981 Mar 29, 2023
3d8e164
Remove NDEP_SCALE_FACTOR from parameters file
mnlevy1981 Mar 29, 2023
6401386
Add MARBL_TRACERS_INIT_VERTICAL_REMAP_ONLY option
mnlevy1981 Mar 31, 2023
579e18a
Update MARBL tracer IC file
mnlevy1981 Apr 6, 2023
c4d46b3
Move atm_co2 and atm_alt_co2 to MOM_forcing_type
mnlevy1981 Apr 18, 2023
2500ee4
NUOPC cap can receive CO2 if provided
mnlevy1981 Apr 18, 2023
251e0f9
Support using coupler-provided atm_co2
mnlevy1981 Apr 19, 2023
4c77695
Replace logical flags with integer
mnlevy1981 Apr 19, 2023
bb7fb60
NUOPC cap can pass CO2_FLUX to atmosphere
mnlevy1981 Apr 20, 2023
60b640e
Only copy co2 to srf_state if memory was allocated
mnlevy1981 Apr 21, 2023
c6e3e37
Code clean-up following review
mnlevy1981 Apr 22, 2023
64fd101
Remove spaces in "end if" and "end do"
mnlevy1981 Apr 22, 2023
9758657
More code clean-up
mnlevy1981 Apr 22, 2023
96fe9dc
Clean up NUOPC cap
mnlevy1981 May 22, 2023
f2eae66
Updates to use support_mks branch of MARBL
mnlevy1981 Aug 8, 2023
12f7e80
Update dummy driver to add unit_system args
mnlevy1981 Aug 8, 2023
0ee6d3d
Use MARBL in mks, not cgs
mnlevy1981 Aug 9, 2023
10eba6c
Merge tag 'dev/ncar_230504' into mnlevy1981/add_MARBL
mnlevy1981 Aug 14, 2023
977bc63
Update default for iron forcing files
mnlevy1981 Aug 17, 2023
fdaeca2
Updated pkg/MARBL, which changed API
mnlevy1981 Aug 24, 2023
10e6998
Dummy MARBL API needs one more function
mnlevy1981 Aug 25, 2023
e2212a3
MARBL API changed
mnlevy1981 Aug 25, 2023
fafa0b9
Don't need to overwrite tracer_restore_vars
mnlevy1981 Oct 18, 2023
97a801f
Use time_interp_external for restoring
mnlevy1981 Oct 27, 2023
670f8f4
First pass at implementing tracer restoring
mnlevy1981 Nov 13, 2023
e63b412
Clean-up to avoid truncation errors
mnlevy1981 Nov 14, 2023
cd7cd2f
Switch from interpolate_column to remapping_core_h
mnlevy1981 Nov 15, 2023
0e42cf4
Merge tag 'dev/ncar_231107' into mnlevy1981/add_MARBL
mnlevy1981 Nov 28, 2023
69202f7
enable_averaging -> enable_averages
mnlevy1981 Dec 1, 2023
5540525
Move river flux code into MARBL_tracers
mnlevy1981 Dec 15, 2023
f8fe7ec
move post_data calls for river nutrient fluxes
mnlevy1981 Dec 19, 2023
2235a02
Code cleanup: doxygen test
mnlevy1981 Dec 19, 2023
82a2da3
More doxygen clean-up
mnlevy1981 Dec 19, 2023
16a7ae0
Missing "<" in one comment
mnlevy1981 Dec 19, 2023
3c2ed29
First pass at adding ABIO
mnlevy1981 Dec 21, 2023
d4e9b2d
Add MARBL_TRACERS_MAY_REINIT to param file
mnlevy1981 Dec 29, 2023
c2bd1d0
Add dummy get_setting() to marbl_interface_class
mnlevy1981 Dec 29, 2023
bd80540
Skip some processes when not base_bio_on
mnlevy1981 Jan 29, 2024
aca2c9a
Add support for reading d14c forcing from netcdf
mnlevy1981 Feb 2, 2024
25f378d
Update to support marbl0.46.0
mnlevy1981 Feb 29, 2024
5aa6c93
Update interface to build without MARBL
mnlevy1981 Feb 29, 2024
37dc940
Shorten line that exceeded max length
mnlevy1981 Mar 1, 2024
7bb68c5
Fix whitespace
mnlevy1981 Mar 12, 2024
ddd5d46
Merge tag 'dev/ncar_240311' into mnlevy1981/add_MARBL
mnlevy1981 Mar 15, 2024
3c8beb7
Check abio_dic_on and base_bio_on before posting
mnlevy1981 Apr 3, 2024
315e1cd
Updates for dimensional scaling test
mnlevy1981 Apr 4, 2024
7679e52
More dimensional scaling updates
mnlevy1981 Apr 4, 2024
615e0b3
Clean up line-lengths in some comments
mnlevy1981 Apr 4, 2024
44bbed7
pass phys units to convert_marbl_IOB_to_forcings()
mnlevy1981 Apr 5, 2024
e70b913
scale riv flux
mnlevy1981 Apr 11, 2024
1dae9e0
Introduce MARBL_IC_MIN_VAL for testing
mnlevy1981 Apr 11, 2024
5477f56
Fixed a few area correction bugs
mnlevy1981 Apr 15, 2024
39bd3b3
No support for global ops yet
mnlevy1981 Apr 19, 2024
dfbc658
Add chksum calls for MARBL forcings
mnlevy1981 Apr 19, 2024
05b7ea1
MARBL input data is now in INPUTDATA
mnlevy1981 May 2, 2024
5039f3e
Merge tag 'dev/ncar_240510' into HEAD
mnlevy1981 May 16, 2024
21529b9
Changes following code review
mnlevy1981 Jul 12, 2024
bbffde0
Call MARBL_tracers_stock()
mnlevy1981 Jul 15, 2024
bbf3f7f
Only use MARBL for Chl when using base_bio tracers
mnlevy1981 Jul 15, 2024
afd71b1
tracer_forcing_utils moved into MOM_interpolate
mnlevy1981 Jul 15, 2024
97c0917
Fix whitespace in comments
mnlevy1981 Jul 15, 2024
7163ff3
Add some variable descriptions
mnlevy1981 Jul 16, 2024
3934d5f
Merge branch 'dev/ncar' into mnlevy1981/add_MARBL
mnlevy1981 Aug 1, 2024
8ba02c2
Use do loops instead of ':'
mnlevy1981 Aug 1, 2024
232b65d
Add parameter to change restoring time scale name
mnlevy1981 Aug 2, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@
html


# Build output
*.o
*.mod
MOM6
build/
deps/
pkg/MARBL


# Autoconf output
aclocal.m4
autom4te.cache/
Expand Down
15 changes: 15 additions & 0 deletions config_src/drivers/mct_cap/mom_surface_forcing_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ module MOM_surface_forcing_mct
use time_interp_external_mod, only : init_external_field, time_interp_external
use time_interp_external_mod, only : time_interp_external_init
use MOM_io, only: stdout
use marbl_forcing_type_mod, only : marbl_forcing_CS, marbl_forcing_init, marbl_forcing_type_init
use marbl_forcing_type_mod, only : marbl_ice_ocean_boundary_type, convert_marbl_IOB_to_forcings

implicit none ; private

Expand Down Expand Up @@ -142,6 +144,8 @@ module MOM_surface_forcing_mct
type(forcing_diags), public :: handles !< diagnostics handles
type(MOM_restart_CS), pointer :: restart_CSp => NULL() !< restart pointer
type(user_revise_forcing_CS), pointer :: urf_CS => NULL() !< user revise pointer

type(marbl_forcing_CS), pointer :: marbl_forcing_CSp => NULL() !< parameters for getting MARBL forcing
end type surface_forcing_CS

!> Structure corresponding to forcing, but with the elements, units, and conventions
Expand Down Expand Up @@ -185,6 +189,9 @@ module MOM_surface_forcing_mct
!! flux-exchange code, based on what the sea-ice
!! model is providing. Otherwise, the value from
!! the surface_forcing_CS is used.

type(marbl_ice_ocean_boundary_type), pointer :: MARBL_IOB => NULL() !< Structure containing IOB fields
!! (only needed by MARBL)
end type ice_ocean_boundary_type

integer :: id_clock_forcing
Expand Down Expand Up @@ -313,6 +320,8 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,

if (restore_temp) call safe_alloc_ptr(fluxes%heat_added,isd,ied,jsd,jed)

call marbl_forcing_type_init(isd,ied,jsd,jed,fluxes%MARBL_forcing)

endif ! endif for allocation and initialization


Expand Down Expand Up @@ -524,6 +533,9 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,

enddo; enddo

! Copy MARBL-specific IOB fields into fluxes%MARBL_forcing
call convert_marbl_IOB_to_forcings(IOB%MARBL_IOB, Time, G, US, i0, j0, fluxes%MARBL_forcing, CS%marbl_forcing_CSp)

! applied surface pressure from atmosphere and cryosphere
if (associated(IOB%p)) then
if (CS%max_p_surf >= 0.0) then
Expand Down Expand Up @@ -1295,6 +1307,9 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
call data_override_init(Ocean_domain_in=G%Domain%mpp_domain)
endif

! Set up MARBL forcing control structure
call marbl_forcing_init(G, param_file, CS%diag, Time, CS%inputdir, CS%marbl_forcing_CSp)

if (present(restore_salt)) then ; if (restore_salt) then
salt_file = trim(CS%inputdir) // trim(CS%salt_restore_file)
CS%id_srestore = init_external_field(salt_file, CS%salt_restore_var_name, domain=G%Domain%mpp_domain)
Expand Down
31 changes: 30 additions & 1 deletion config_src/drivers/mct_cap/ocn_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module ocn_cap_methods
contains
!=======================================================================

!> Maps incomping ocean data to MOM6 data structures
!> Maps incoming ocean data to MOM6 data structures
subroutine ocn_import(x2o, ind, grid, ice_ocean_boundary, ocean_public, logunit, Eclock, c1, c2, c3, c4)
real(kind=8) , intent(in) :: x2o(:,:) !< incoming data
type(cpl_indices_type) , intent(in) :: ind !< Structure with MCT attribute vects and indices
Expand Down Expand Up @@ -105,6 +105,35 @@ subroutine ocn_import(x2o, ind, grid, ice_ocean_boundary, ocean_public, logunit,
ice_ocean_boundary%sw_flux_nir_dir(i,j) = x2o(ind%x2o_Faxa_swndr,k) * GRID%mask2dT(i,j)
ice_ocean_boundary%sw_flux_nir_dif(i,j) = x2o(ind%x2o_Faxa_swndf,k) * GRID%mask2dT(i,j)
endif

! MARBL-specific forcing fields
! Dust and iron fluxes (Do I need the GRID%mask2dT terms? I have them in convert_IOB_to_fluxes())
! TODO: these are in units kg/m^2/s, want g/cm^2/s => multiply by 0.1 somewhere
! currently the conversion is done in MARBL_tracers:MARBL_tracers_column_physics when copying
! into surface_flux_forcings but maybe we should convert somewhere else because we want to
! register these IOB fields as diagnostics (in g/cm^2/s for now)
ice_ocean_boundary%MARBL_IOB%atm_fine_dust_flux(i,j) = (x2o(ind%x2o_Faxa_dstwet1,k) + &
x2o(ind%x2o_Faxa_dstdry1,k)) * &
GRID%mask2dT(i,j)
ice_ocean_boundary%MARBL_IOB%atm_coarse_dust_flux(i,j) = (x2o(ind%x2o_Faxa_dstwet2,k) + &
x2o(ind%x2o_Faxa_dstwet3,k) + &
x2o(ind%x2o_Faxa_dstwet4,k) + &
x2o(ind%x2o_Faxa_dstdry2,k) + &
x2o(ind%x2o_Faxa_dstdry3,k) + &
x2o(ind%x2o_Faxa_dstdry4,k)) * &
GRID%mask2dT(i,j)
ice_ocean_boundary%MARBL_IOB%seaice_dust_flux(i,j) = x2o(ind%x2o_Fioi_flxdst,k) * GRID%mask2dT(i,j)
ice_ocean_boundary%MARBL_IOB%atm_bc_flux(i,j) = (x2o(ind%x2o_Faxa_bcphidry,k) + x2o(ind%x2o_Faxa_bcphodry,k) + &
x2o(ind%x2o_Faxa_bcphiwet,k)) * GRID%mask2dT(i,j)
ice_ocean_boundary%MARBL_IOB%seaice_bc_flux(i,j) = (x2o(ind%x2o_Fioi_bcpho,k) + x2o(ind%x2o_Fioi_bcphi,k)) * &
GRID%mask2dT(i,j)

! ice fraction
ice_ocean_boundary%MARBL_IOB%ice_fraction(i,j) = x2o(ind%x2o_Si_ifrac,k) * GRID%mask2dT(i,j)

! 10m wind
ice_ocean_boundary%MARBL_IOB%u10_sqr(i,j) = x2o(ind%x2o_So_duu10n,k) * GRID%mask2dT(i,j)

enddo
enddo

Expand Down
6 changes: 4 additions & 2 deletions config_src/drivers/mct_cap/ocn_comp_mct.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ module ocn_comp_mct
use mpp_domains_mod, only: mpp_get_compute_domain
use MOM_io, only: stdout

use marbl_forcing_type_mod, only: marbl_iob_allocate

! Previously inlined - now in separate modules
use MOM_ocean_model_mct, only: ocean_public_type, ocean_state_type
use MOM_ocean_model_mct, only: ocean_model_init , update_ocean_model, ocean_model_end
Expand Down Expand Up @@ -812,8 +814,6 @@ end subroutine ocean_model_init_sfc
!! mi, mass of ice (kg/m2)
!!
!! Variables in the coupler that are **NOT** used in MOM6 (i.e., no corresponding field in fluxes):
!! x2o_Si_ifrac, fractional ice wrt ocean
!! x2o_So_duu10n, 10m wind speed squared (m^2/s^2)
!! x2o_Sa_co2prog, bottom atm level prognostic CO2
!! x2o_Sa_co2diag, bottom atm level diagnostic CO2
!!
Expand Down Expand Up @@ -907,6 +907,8 @@ subroutine IOB_allocate(IOB, isc, iec, jsc, jec)
IOB%mi = 0.0
IOB%p = 0.0

call marbl_iob_allocate(isc, iec, jsc, jec, IOB%MARBL_IOB)

end subroutine IOB_allocate

end module ocn_comp_mct
6 changes: 6 additions & 0 deletions config_src/drivers/nuopc_cap/mom_cap.F90
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ module MOM_cap_mod
use shr_mpi_mod, only : shr_mpi_min, shr_mpi_max
#endif
use time_utils_mod, only: esmf2fms_time
use marbl_forcing_type_mod, only: marbl_iob_allocate

use, intrinsic :: iso_fortran_env, only: output_unit

Expand Down Expand Up @@ -687,6 +688,8 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
Ice_ocean_boundary%vstkb = 0.0
endif

call marbl_iob_allocate(isc, iec, jsc, jec, Ice_ocean_boundary%MARBL_IOB)

ocean_internalstate%ptr%ocean_state_type_ptr => ocean_state
call ESMF_GridCompSetInternalState(gcomp, ocean_internalstate, rc)
if (ChkErr(rc,__LINE__,u_FILE_u)) return
Expand Down Expand Up @@ -727,6 +730,9 @@ subroutine InitializeAdvertise(gcomp, importState, exportState, clock, rc)
call fld_list_add(fldsToOcn_num, fldsToOcn, "Foxx_rofi" , "will provide") !-> ice runoff
call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_fresh_water_to_ocean_rate", "will provide")
call fld_list_add(fldsToOcn_num, fldsToOcn, "net_heat_flx_to_ocn" , "will provide")
call fld_list_add(fldsToOcn_num, fldsToOcn, "Si_ifrac" , "will provide") !-> ice runoff
call fld_list_add(fldsToOcn_num, fldsToOcn, "So_duu10n" , "will provide") !-> ice runoff
call fld_list_add(fldsToOcn_num, fldsToOcn, "Fioi_flxdst" , "will provide") !-> ice runoff
!These are not currently used and changing requires a nuopc dictionary change
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_runoff_heat_flx" , "will provide")
!call fld_list_add(fldsToOcn_num, fldsToOcn, "mean_calving_heat_flx" , "will provide")
Expand Down
37 changes: 37 additions & 0 deletions config_src/drivers/nuopc_cap/mom_cap_methods.F90
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,43 @@ subroutine mom_import(ocean_public, ocean_grid, importState, ice_ocean_boundary,
deallocate(stkx1,stkx2,stkx3,stky1,stky2,stky3)
endif

! MARBL fields

!----
! ice fraction
!----
ice_ocean_boundary%MARBL_IOB%ice_fraction(:,:) = 0._ESMF_KIND_R8
call state_getimport(importState, 'Si_ifrac', &
isc, iec, jsc, jec, ice_ocean_boundary%MARBL_IOB%ice_fraction, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out

!----
! 10m wind squared
!----
ice_ocean_boundary%MARBL_IOB%u10_sqr(:,:) = 0._ESMF_KIND_R8
call state_getimport(importState, 'So_duu10n', &
isc, iec, jsc, jec, ice_ocean_boundary%MARBL_IOB%u10_sqr, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out

!----
! seaice_dust_flux is a single field from the coupler
! atm_fine_dust_flux, atm_coarse_dust_flux, atm_bc_flux, and seaice_bc_flux
! are all sums of multiple fields and will be treated slightly differently
!----
ice_ocean_boundary%MARBL_IOB%seaice_dust_flux(:,:) = 0._ESMF_KIND_R8
call state_getimport(importState, 'Fioi_flxdst', &
isc, iec, jsc, jec, ice_ocean_boundary%MARBL_IOB%seaice_dust_flux, rc=rc)
if (ESMF_LogFoundError(rcToCheck=rc, msg=ESMF_LOGERR_PASSTHRU, &
line=__LINE__, &
file=__FILE__)) &
return ! bail out

end subroutine mom_import

!> Maps outgoing ocean data to ESMF State
Expand Down
15 changes: 15 additions & 0 deletions config_src/drivers/nuopc_cap/mom_surface_forcing_nuopc.F90
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ module MOM_surface_forcing_nuopc
use mpp_mod, only : mpp_chksum
use time_interp_external_mod, only : init_external_field, time_interp_external
use time_interp_external_mod, only : time_interp_external_init
use marbl_forcing_type_mod, only : marbl_forcing_CS, marbl_forcing_init, marbl_forcing_type_init
use marbl_forcing_type_mod, only : marbl_ice_ocean_boundary_type, convert_marbl_IOB_to_forcings

implicit none ; private

Expand Down Expand Up @@ -150,6 +152,8 @@ module MOM_surface_forcing_nuopc

type(MOM_restart_CS), pointer :: restart_CSp => NULL()
type(user_revise_forcing_CS), pointer :: urf_CS => NULL()

type(marbl_forcing_CS), pointer :: marbl_forcing_CSp => NULL() !< parameters for getting MARBL forcing
end type surface_forcing_CS

!> Structure corresponding to forcing, but with the elements, units, and conventions
Expand Down Expand Up @@ -201,6 +205,9 @@ module MOM_surface_forcing_nuopc
!! flux-exchange code, based on what the sea-ice
!! model is providing. Otherwise, the value from
!! the surface_forcing_CS is used.

type(marbl_ice_ocean_boundary_type), pointer :: MARBL_IOB => NULL() !< Structure containing IOB fields
!! (only needed by MARBL)
end type ice_ocean_boundary_type

integer :: id_clock_forcing
Expand Down Expand Up @@ -327,6 +334,8 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,

if (restore_temp) call safe_alloc_ptr(fluxes%heat_added,isd,ied,jsd,jed)

call marbl_forcing_type_init(isd,ied,jsd,jed,fluxes%MARBL_forcing)

endif ! endif for allocation and initialization

if (((associated(IOB%ustar_berg) .and. (.not.associated(fluxes%ustar_berg))) &
Expand Down Expand Up @@ -534,6 +543,9 @@ subroutine convert_IOB_to_fluxes(IOB, fluxes, index_bounds, Time, valid_time, G,

enddo ; enddo

! Copy MARBL-specific IOB fields into fluxes%MARBL_forcing
call convert_marbl_IOB_to_forcings(IOB%MARBL_IOB, Time, G, US, i0, j0, fluxes%MARBL_forcing, CS%marbl_forcing_CSp)

! applied surface pressure from atmosphere and cryosphere
if (associated(IOB%p)) then
if (CS%max_p_surf >= 0.0) then
Expand Down Expand Up @@ -1335,6 +1347,9 @@ subroutine surface_forcing_init(Time, G, US, param_file, diag, CS, restore_salt,
call data_override_init(Ocean_domain_in=G%Domain%mpp_domain)
endif

! Set up MARBL forcing control structure
call marbl_forcing_init(G, param_file, CS%diag, Time, CS%inputdir, CS%marbl_forcing_CSp)

if (present(restore_salt)) then ; if (restore_salt) then
salt_file = trim(CS%inputdir) // trim(CS%salt_restore_file)
CS%id_srestore = init_external_field(salt_file, CS%salt_restore_var_name, domain=G%Domain%mpp_domain)
Expand Down
6 changes: 6 additions & 0 deletions config_src/external/MARBL/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
GFDL_ocean_BGC
==============

These APIs reflect those for the MARBL library available at https://github.com/marbl-ecosys/MARBL

The modules in this directory do not do any computations. They simply reflect the APIs of the above package.
102 changes: 102 additions & 0 deletions config_src/external/MARBL/marbl_interface.F90
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
!> A non-functioning template of the MARBL interface
module marbl_interface

use MOM_error_handler, only : MOM_error, FATAL
use marbl_logging, only : marbl_log_type
use marbl_interface_public_types, only : marbl_forcing_fields_type
use marbl_interface_public_types, only : marbl_tracer_metadata_type
use marbl_interface_public_types, only : marbl_saved_state_type
use marbl_interface_public_types, only : marbl_diagnostics_type
use marbl_interface_public_types, only : marbl_domain_type
implicit none
private ! Only want marbl_interface_class to be public, not supporting functions

!> A non-functioning template of the MARBL_interface class
!!
!> All variables are dummy representations of actual members of the real marbl_interface_class
!! that are used in the MARBL tracer routines.
type, public :: marbl_interface_class
type(marbl_log_type) :: StatusLog !< dummy log
type(marbl_forcing_fields_type), allocatable :: surface_flux_forcings(:) !< dummy forcing array
type(marbl_forcing_fields_type), allocatable :: interior_tendency_forcings(:) !< dummy forcing array
type(marbl_tracer_metadata_type), allocatable :: tracer_metadata(:) !< dummy metadata array
type(marbl_domain_type) :: domain !< dummy domain
type(marbl_saved_state_type) :: surface_flux_saved_state !< dummy saved state
type(marbl_saved_state_type) :: interior_tendency_saved_state !< dummy saved state
type(marbl_diagnostics_type) :: interior_tendency_diags !< dummy diagnostics
type(marbl_diagnostics_type) :: surface_flux_diags !< dummy diagnostics
real, allocatable :: tracers(:,:) !< dummy tracer array
real, allocatable :: tracers_at_surface(:,:) !< dummy tracer surface array
real, allocatable :: surface_fluxes(:,:) !< dummy fluxes
real, allocatable :: interior_tendencies(:,:) !< dummy tendencies
contains
procedure, public :: init !< dummy routine
procedure, public :: surface_flux_compute !< dummy surface flux routine
procedure, public :: interior_tendency_compute !< dummy interior tendency routine
procedure, public :: shutdown !< dummy shutdown routine
procedure, public :: put_setting !< dummy put_setting routine
end type marbl_interface_class

!> Error message that appears if the dummy interface is called
character(len=*), parameter :: error_msg = "MOM6 built the MARBL stubs rather than the full library"

contains

!> Dummy version of MARBL's put_setting() function
subroutine put_setting(self, str_in)
class(marbl_interface_class), intent(in) :: self
character(len=*), intent(in) :: str_in

call MOM_error(FATAL, error_msg)
end subroutine put_setting

!> Dummy version of MARBL's init() function
subroutine init(self, &
gcm_num_levels, &
gcm_num_PAR_subcols, &
gcm_num_elements_surface_flux, &
gcm_delta_z, &
gcm_zw, &
gcm_zt, &
lgcm_has_global_ops)

class(marbl_interface_class), intent(inout) :: self
integer, intent(in) :: gcm_num_levels
integer, intent(in) :: gcm_num_PAR_subcols
integer, intent(in) :: gcm_num_elements_surface_flux
real, intent(in) :: gcm_delta_z(gcm_num_levels)
real, intent(in) :: gcm_zw(gcm_num_levels)
real, intent(in) :: gcm_zt(gcm_num_levels)
logical, intent(in) :: lgcm_has_global_ops

call MOM_error(FATAL, error_msg)
end subroutine init

!> Dummy version of MARBL's surface_flux_compute() function
subroutine surface_flux_compute(self)

class(marbl_interface_class), intent(inout) :: self

call MOM_error(FATAL, error_msg)

end subroutine surface_flux_compute

!> Dummy version of MARBL's interior_tendency_compute() function
subroutine interior_tendency_compute(self)

class(marbl_interface_class), intent(inout) :: self

call MOM_error(FATAL, error_msg)

end subroutine interior_tendency_compute

!> Dummy version of MARBL's shutdown() function
subroutine shutdown(self)

class(marbl_interface_class), intent(inout) :: self

call MOM_error(FATAL, error_msg)

end subroutine shutdown

end module marbl_interface
Loading