-
Notifications
You must be signed in to change notification settings - Fork 16
Instructions for Adding a New Diagnostic in COBALT
This example demonstrates how to add a new diagnostic in COBALT. Consider we want to add a new diagnostic for the iron adsorption integral in the upper 100m (jfe_ads_100
), simply follow these steps:
Currently COBALT uses the MOM6 register_daig_field function to handle single diagnostic field registry. This can be done by
First, declare new diagnostic ID id_jfe_ads_100
in cobalt_types.F90
:
# find line 1192 in cobalt_types.F90 and add the following then save the file
id_jfe_ads_100 = -1, &
Then register new diagnostic in cobalt_reg_diag.F90
:
# find line 2330 in cobalt_reg_diag.F90 and add the following to register jfe_ads_100
vardesc_temp = vardesc("jfe_ads_100","Iron adsorption integral in upper 100m",'h','1','s','mol m-2 s-1','f')
cobalt%id_jfe_ads_100 = register_diag_field(package_name, vardesc_temp%name, axes(1:2),&
init_time, vardesc_temp%longname,vardesc_temp%units, missing_value = missing_value1)
The primary calculations for COBALT
are performed in generic_COBALT.F90
, while new variables must be declared in cobalt_types.F90
. To implement the jfe_ads_100
diagnostic, which calculates iron absorption in the upper 100m, follow the steps outlined below.
First, declare a 2d jfe_ads_100
real array under generic_COBALT_type
in cobalt_types.F90
:
# find line 793 and add the following
jfe_ads_100, &
Then modify the main source code to include calculation of iron absorption in the upper 100m:
# find line 5945 and add the following
cobalt%jfe_ads_100(i,j) = cobalt%jfe_ads(i,j,1) * rho_dzt(i,j,1)
# find line 6074 and add the following
cobalt%jfe_ads_100(i,j) = cobalt%jfe_ads_100(i,j) + cobalt%jfe_ads(i,j,k) * rho_dzt(i,j,k)
# find line 6210 and add the following
cobalt%jfe_ads_100(i,j) = cobalt%jfe_ads_100(i,j) + cobalt%jfe_ads(i,j,k_100)* &
drho_dzt
# find line 7353 and add the following
allocate(cobalt%jfe_ads_100(isd:ied,jsd:jed)) ; cobalt%jfe_ads_100 = 0.0
# find line 7821 and add the following
deallocate(cobalt%jfe_ads_100)
The final step is to send COBALT diagnostic back to MOM6 diag mediator. This can be done by modifying cobalt_send_diag.F90
# find line 1050 and add the following
used = g_send_data(cobalt%id_jfe_ads_100, cobalt%jfe_ads_100, &
model_time, rmask = grid_tmask(:,:,1),&
is_in=isc, js_in=jsc, ie_in=iec, je_in=jec)
Once you have completed the steps above and rebuilt your code, be sure to add your new diagnostic to the diag_table to ensure it is output during model runtime.
# Example of how to add jfe_ads_100 to the diag_table
"generic_cobalt","jfe_ads_100", "jfe_ads_100", "ocean_cobalt_fluxes_int","all","mean","none",2
-
- Conduct Retrospective Run with FRE Workflow on Gaea C6
- The Anatomy of a Regional MOM6 xml
- Specifying Model Diagnostics