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

Cesm2 1 x rel #38

Merged
merged 3 commits into from
Jun 29, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
27 changes: 27 additions & 0 deletions BranchChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
===============================================================
Tag Creator: mlevy
Developers: klindsay
Tag Date: 26 Jun 2020
Tag Name: pop2_cesm2_1_rel_n11
Tag Summary: add Newton-Krylov related tavg vars to abio_dic_dic14

Testing: passes aux_pop on cheyenne/intel, compared to pop2_cesm2_1_rel_n10
expected NLCOMP & BASELINE failures for new test
some MEMCOMP failures

computation and inclusion of vars in tavg file controlled with nml var abio_dic_dic14_ltavg_NK

nml var enabled in new test ERS_Ld5_D.T62_g37.C.cheyenne_intel.pop-abio_dic_dic14_ltavg_NK

mv io_read_fallback_register_field call for 'ABIO_PH_SURF' outside of all_fields_exist_in_restfile conditional

Changes to be committed:
modified: bld/build-namelist
modified: bld/namelist_files/namelist_defaults_pop.xml
modified: bld/namelist_files/namelist_definition_pop.xml
modified: cime_config/testdefs/testlist_pop.xml
new file: cime_config/testdefs/testmods_dirs/pop/abio_dic_dic14_ltavg_NK/include_user_mods
new file: cime_config/testdefs/testmods_dirs/pop/abio_dic_dic14_ltavg_NK/user_nl_pop
modified: input_templates/ocn.abio_dic_dic14.tavg.csh
modified: source/abio_dic_dic14_mod.F90

===============================================================================
Tag Creator: mlevy
Developers: mlevy
Expand Down
3 changes: 3 additions & 0 deletions bld/build-namelist
Original file line number Diff line number Diff line change
Expand Up @@ -2751,6 +2751,9 @@ sub module_tavg_script_args() {
my $nl = shift;
my $module = shift;
my $cfg = shift;
if ($module eq "abio_dic_dic14") {
return ($nl->get_value('abio_dic_dic14_ltavg_NK'));
}
if ($module eq "ecosys") {
return ($nl->get_value('lecosys_tavg_all'),
$nl->get_value('lecosys_tavg_alt_co2'));
Expand Down
6 changes: 6 additions & 0 deletions bld/namelist_files/namelist_defaults_pop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1333,6 +1333,12 @@
<abio_atm_model_year>1</abio_atm_model_year>
<abio_atm_data_year>1</abio_atm_data_year>

<!--------------------------------->
<!-- abio_dic_dic14 derived vars -->
<!--------------------------------->

<abio_dic_dic14_ltavg_NK>.false.</abio_dic_dic14_ltavg_NK>

<!---------------------------->
<!-- ecosys derived vars -->
<!---------------------------->
Expand Down
14 changes: 14 additions & 0 deletions bld/namelist_files/namelist_definition_pop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5883,6 +5883,20 @@ Year in data that corresponds to abio_atm_model_year.
Default: 1
</entry>

<!-- - - - - - - - - - - - - - - - - - - - -->
<!-- Group: abio_dic_dic14 derived vars - -->
<!-- - - - - - - - - - - - - - - - - - - - -->

<entry
id="abio_dic_dic14_ltavg_NK"
type="logical"
category="Passive Tracers (Abiotic DIC & DIC14)"
group="derived" >
add Newton-Krylov spinup related tavg variables
Default:
.false.
</entry>


<!-- - - - - - - - - - - - - - - - - - -->
<!-- Group: ecosys derived vars - -->
Expand Down
5 changes: 5 additions & 0 deletions cime_config/testdefs/testlist_pop.xml
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,11 @@
<machine name="cheyenne" compiler="intel" category="aux_pop_MARBL"/>
</machines>
</test>
<test name="ERS_Ld5_D" grid="T62_g37" compset="C" testmods="pop/abio_dic_dic14_ltavg_NK">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_pop"/>
</machines>
</test>
<test name="ERS_Ld5_D" grid="T62_g37" compset="C1850ECO" testmods="pop/ciso_abio_dic_dic14">
<machines>
<machine name="cheyenne" compiler="intel" category="aux_pop"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
../abio_dic_dic14
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
abio_dic_dic14_ltavg_NK = .true.
10 changes: 10 additions & 0 deletions input_templates/ocn.abio_dic_dic14.tavg.csh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ endif

@ s1 = 1 # use base-model stream 1

set abio_dic_dic14_ltavg_NK = $2

cat >! $CASEROOT/Buildconf/popconf/abio_dic_dic14_tavg_contents << EOF
$s1 ABIO_DIC
$s1 ABIO_DIC14
Expand All @@ -38,6 +40,14 @@ $s1 STF_ABIO_DIC14
$s1 Jint_ABIO_DIC14
EOF

if ($abio_dic_dic14_ltavg_NK == ".true.") then
cat >> $CASEROOT/Buildconf/popconf/abio_dic_dic14_tavg_contents << EOF
$s1 d_SF_ABIO_DIC_d_ABIO_DIC
$s1 d_SF_ABIO_DIC14_d_ABIO_DIC
$s1 d_SF_ABIO_DIC14_d_ABIO_DIC14
EOF
endif

if ($OCN_TAVG_TRACER_BUDGET == TRUE) then
cat >> $CASEROOT/Buildconf/popconf/abio_dic_dic14_tavg_contents << EOF
$s1 KPP_SRC_ABIO_DIC14
Expand Down
79 changes: 75 additions & 4 deletions source/abio_dic_dic14_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,10 @@ module abio_dic_dic14_mod
tavg_FG_ABIO_DIC14, & ! tavg id for surface gas flux of C14
tavg_FG_ABIO_DIC, & ! tavg id for surface gas flux of CO2
tavg_ABIO_ALK, & ! tavg id for surface Alkalinity
tavg_ABIO_PH ! tavg id for surface PH
tavg_ABIO_PH, & ! tavg id for surface PH
tavg_d_SF_ABIO_DIC_d_ABIO_DIC, & ! tavg id for derivative of SF_ABIO_DIC wrt ABIO_DIC
tavg_d_SF_ABIO_DIC14_d_ABIO_DIC, & ! tavg id for derivative of SF_ABIO_DIC14 wrt ABIO_DIC
tavg_d_SF_ABIO_DIC14_d_ABIO_DIC14 ! tavg id for derivative of SF_ABIO_DIC14 wrt ABIO_DIC14

!-----------------------------------------------------------------------
! define tavg id for 3d fields related to surface fluxes
Expand Down Expand Up @@ -566,10 +569,11 @@ subroutine abio_dic_dic14_init(abio_dic_dic14_ind_begin, init_ts_file_fmt, read_
call document(subname, 'some abio_dic_dic14 fields missing from restfile, ' /&
&/ 'using abio_dic_dic14_restfile_fallback')
abio_dic_dic14_restart_filename = abio_dic_dic14_restfile_fallback
call io_read_fallback_register_field('ABIO_PH_SURF', &
fallback_opt='const', const_val=c0)
endif

call io_read_fallback_register_field('ABIO_PH_SURF', &
fallback_opt='const', const_val=c0)

call rest_read_tracer_block(abio_dic_dic14_ind_begin, &
init_abio_dic_dic14_init_file_fmt, &
abio_dic_dic14_restart_filename, &
Expand Down Expand Up @@ -817,6 +821,23 @@ subroutine abio_dic_dic14_init_tavg
coordinates='TLONG TLAT time')
var_cnt = var_cnt+1

call define_tavg_field(tavg_d_SF_ABIO_DIC_d_ABIO_DIC,'d_SF_ABIO_DIC_d_ABIO_DIC',2, &
long_name='derivative of SF_ABIO_DIC wrt ABIO_DIC', &
units='cm/s', grid_loc='2110', &
coordinates='TLONG TLAT time')
var_cnt = var_cnt+1

call define_tavg_field(tavg_d_SF_ABIO_DIC14_d_ABIO_DIC,'d_SF_ABIO_DIC14_d_ABIO_DIC',2, &
long_name='derivative of SF_ABIO_DIC14 wrt ABIO_DIC', &
units='cm/s', grid_loc='2110', &
coordinates='TLONG TLAT time')
var_cnt = var_cnt+1

call define_tavg_field(tavg_d_SF_ABIO_DIC14_d_ABIO_DIC14,'d_SF_ABIO_DIC14_d_ABIO_DIC14',2, &
long_name='derivative of SF_ABIO_DIC14 wrt ABIO_DIC14', &
units='cm/s', grid_loc='2110', &
coordinates='TLONG TLAT time')
var_cnt = var_cnt+1

!-----------------------------------------------------------------------
! Allocate variable to save surface variables to in surf_flux,
Expand Down Expand Up @@ -958,6 +979,7 @@ subroutine abio_dic_dic14_set_sflux(U10_SQR,IFRAC,PRESS,SST,SSS, &
use named_field_mod, only: named_field_get
use grid, only: REGION_MASK
use c14_atm_forcing_mod, only: c14_atm_forcing_update_data, c14_atm_forcing_get_data
use tavg, only: accumulate_tavg_now

! !INPUT PARAMETERS:

Expand Down Expand Up @@ -1012,6 +1034,7 @@ subroutine abio_dic_dic14_set_sflux(U10_SQR,IFRAC,PRESS,SST,SSS, &
PHHI, & ! upper bound for ph in solver
ABIO_DIC_ROW, & ! row of DIC values for solver
CO2STAR_ROW, & ! CO2STAR from solver
CO2STAR_ROW_TMP, & ! CO2STAR from solver
DCO2STAR_ROW, & ! DCO2STAR from solver
pCO2SURF_ROW, & ! pCO2SURF from solver
DpCO2_ROW, & ! DpCO2 from solver
Expand Down Expand Up @@ -1058,7 +1081,7 @@ subroutine abio_dic_dic14_set_sflux(U10_SQR,IFRAC,PRESS,SST,SSS, &
!$OMP PARALLEL DO PRIVATE(iblock,j,XKW_ICE,CO2_SCHMIDT_USED,PV,SiO2, PO4,&
!$OMP pCO2, D14C,SURF_VALS_DIC,SURF_VALS_DIC14,&
!$OMP R14C_ocn,R14C_atm,PHLO,PHHI,ABIO_DIC_ROW,&
!$OMP ALK_ROW,PH_NEW,CO2STAR_ROW, DCO2STAR_ROW,&
!$OMP ALK_ROW,PH_NEW,CO2STAR_ROW,CO2STAR_ROW_TMP,DCO2STAR_ROW,&
!$OMP pCO2SURF_ROW,DpCO2_ROW,GAS_FLUX_ABIO_DIC,&
!$OMP GAS_FLUX_ABIO_DIC14,CO3_ROW)

Expand Down Expand Up @@ -1225,6 +1248,51 @@ subroutine abio_dic_dic14_set_sflux(U10_SQR,IFRAC,PRESS,SST,SSS, &
ABIO_DIC_SFLUX_TAVG(:,j,13,iblock) = DpCO2_ROW
ABIO_DIC_SFLUX_TAVG(:,j,14,iblock) = ALK_ROW

!-----------------------------------------------------------------------
! compute derivatives of surface flux terms, if requested
!-----------------------------------------------------------------------

if (accumulate_tavg_now(tavg_d_SF_ABIO_DIC14_d_ABIO_DIC14)) then

! d_SF_ABIO_DIC14_d_ABIO_DIC14
where (SURF_VALS_DIC(:,j) /= c0)
ABIO_DIC_SFLUX_TAVG(:,j,18,iblock) = (-1) * PV(:,j) * CO2STAR_ROW / SURF_VALS_DIC(:,j)
elsewhere
ABIO_DIC_SFLUX_TAVG(:,j,18,iblock) = c0
endwhere

endif

if (accumulate_tavg_now(tavg_d_SF_ABIO_DIC_d_ABIO_DIC) .or. &
accumulate_tavg_now(tavg_d_SF_ABIO_DIC14_d_ABIO_DIC)) then

call co2calc_row(iblock, j, LAND_MASK(:,j,iblock), .true., &
.false., SST(:,j,iblock), SSS(:,j,iblock), &
ABIO_DIC_ROW + c1, ALK_ROW, PO4(:,j), SiO2(:,j), &
PHLO, PHHI, PH_NEW, pCO2(:,j), &
AP_USED(:,j,iblock), CO2STAR_ROW_TMP, &
DCO2STAR_ROW, pCO2SURF_ROW, DpCO2_ROW, CO3_ROW)

call co2calc_row(iblock, j, LAND_MASK(:,j,iblock), .true., &
.false., SST(:,j,iblock), SSS(:,j,iblock), &
ABIO_DIC_ROW - c1, ALK_ROW, PO4(:,j), SiO2(:,j), &
PHLO, PHHI, PH_NEW, pCO2(:,j), &
AP_USED(:,j,iblock), CO2STAR_ROW, &
DCO2STAR_ROW, pCO2SURF_ROW, DpCO2_ROW, CO3_ROW)

! d_SF_ABIO_DIC_d_ABIO_DIC
ABIO_DIC_SFLUX_TAVG(:,j,16,iblock) = (-1) * PV(:,j) * &
(CO2STAR_ROW_TMP - CO2STAR_ROW) * p5

! d_SF_ABIO_DIC14_d_ABIO_DIC
where (SURF_VALS_DIC(:,j) /= c0)
ABIO_DIC_SFLUX_TAVG(:,j,17,iblock) = (-1) * PV(:,j) * SURF_VALS_DIC14(:,j) * &
(CO2STAR_ROW_TMP / (SURF_VALS_DIC(:,j) + c1) - CO2STAR_ROW / (SURF_VALS_DIC(:,j) - c1)) * p5
elsewhere
ABIO_DIC_SFLUX_TAVG(:,j,17,iblock) = c0
endwhere

endif

end do !j = 1,ny_block
!-----------------------------------------------------------------------
Expand Down Expand Up @@ -1406,6 +1474,9 @@ subroutine abio_dic_dic14_tavg_forcing
call accumulate_tavg_field(ABIO_DIC_SFLUX_TAVG(:,:,13,iblock),tavg_ABIO_DpCO2,iblock,1)
call accumulate_tavg_field(ABIO_DIC_SFLUX_TAVG(:,:,14,iblock),tavg_ABIO_ALK,iblock,1)
call accumulate_tavg_field(ABIO_DIC_SFLUX_TAVG(:,:,15,iblock),tavg_ABIO_D14Catm,iblock,1)
call accumulate_tavg_field(ABIO_DIC_SFLUX_TAVG(:,:,16,iblock),tavg_d_SF_ABIO_DIC_d_ABIO_DIC,iblock,1)
call accumulate_tavg_field(ABIO_DIC_SFLUX_TAVG(:,:,17,iblock),tavg_d_SF_ABIO_DIC14_d_ABIO_DIC,iblock,1)
call accumulate_tavg_field(ABIO_DIC_SFLUX_TAVG(:,:,18,iblock),tavg_d_SF_ABIO_DIC14_d_ABIO_DIC14,iblock,1)
end do


Expand Down