-
Notifications
You must be signed in to change notification settings - Fork 155
Saltflux option for CICE #799
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
Changes from 17 commits
c489483
9db5da4
490b259
0d23ccd
675670d
758d2ac
853b6ec
df51c68
b13b728
9bb0281
33ea462
842d5c6
fbf9d59
d88e71e
ba6fe8a
71cf0fb
df5573f
4f8cf7e
8b1c232
f19faa7
3363e83
34dbeed
6201214
38103c5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,7 +151,7 @@ subroutine input_data | |
| kitd, kcatbound, ktransport | ||
|
|
||
| character (len=char_len) :: shortwave, albedo_type, conduct, fbot_xfer_type, & | ||
| tfrz_option, frzpnd, atmbndy, wave_spec_type, snwredist, snw_aging_table, & | ||
| tfrz_option, saltflux_option, frzpnd, atmbndy, wave_spec_type, snwredist, snw_aging_table, & | ||
| capping_method | ||
|
|
||
| logical (kind=log_kind) :: calc_Tsfc, formdrag, highfreq, calc_strair, wave_spec, & | ||
|
|
@@ -163,7 +163,7 @@ subroutine input_data | |
| integer (kind=int_kind) :: numin, numax ! unit number limits | ||
|
|
||
| integer (kind=int_kind) :: rplvl, rptopo | ||
| real (kind=dbl_kind) :: Cf, ksno, puny | ||
| real (kind=dbl_kind) :: Cf, ksno, puny, ice_ref_salinity | ||
| character (len=char_len) :: abort_list | ||
| character (len=128) :: tmpstr2 | ||
|
|
||
|
|
@@ -260,6 +260,7 @@ subroutine input_data | |
| highfreq, natmiter, atmiter_conv, calc_dragio, & | ||
| ustar_min, emissivity, iceruf, iceruf_ocn, & | ||
| fbot_xfer_type, update_ocn_f, l_mpond_fresh, tfrz_option, & | ||
| saltflux_option, ice_ref_salinity, & | ||
|
Contributor
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. ice_ref_salinity could be shifted left one space, align &.
Contributor
Author
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. Ok |
||
| oceanmixed_ice, restore_ice, restore_ocn, trestore, & | ||
| precip_units, default_season, wave_spec_type,nfreq, & | ||
| atm_data_type, ocn_data_type, bgc_data_type, fe_data_type, & | ||
|
|
@@ -497,6 +498,8 @@ subroutine input_data | |
| precip_units = 'mks' ! 'mm_per_month' or | ||
| ! 'mm_per_sec' = 'mks' = kg/m^2 s | ||
| tfrz_option = 'mushy' ! freezing temp formulation | ||
| saltflux_option = 'constant' ! saltflux calculation | ||
| ice_ref_salinity = 4.0_dbl_kind ! Ice reference salinity for coupling | ||
| oceanmixed_ice = .false. ! if true, use internal ocean mixed layer | ||
| wave_spec_type = 'none' ! type of wave spectrum forcing | ||
| nfreq = 25 ! number of wave frequencies | ||
|
|
@@ -758,8 +761,8 @@ subroutine input_data | |
| ! each task gets unique ice log filename when if test is true, for debugging | ||
| if (1 == 0) then | ||
| call get_fileUnit(nu_diag) | ||
| write(tmpstr,'(a,i4.4)') "ice.log.task_",my_task | ||
| open(nu_diag,file=tmpstr) | ||
| write(tmpstr2,'(a,i4.4)') "ice.log.task_",my_task | ||
| open(nu_diag,file=tmpstr2) | ||
| endif | ||
| end if | ||
| if (trim(ice_ic) /= 'default' .and. & | ||
|
|
@@ -979,6 +982,8 @@ subroutine input_data | |
| call broadcast_scalar(wave_spec_file, master_task) | ||
| call broadcast_scalar(nfreq, master_task) | ||
| call broadcast_scalar(tfrz_option, master_task) | ||
| call broadcast_scalar(saltflux_option, master_task) | ||
| call broadcast_scalar(ice_ref_salinity, master_task) | ||
| call broadcast_scalar(ocn_data_format, master_task) | ||
| call broadcast_scalar(bgc_data_type, master_task) | ||
| call broadcast_scalar(fe_data_type, master_task) | ||
|
|
@@ -1414,6 +1419,12 @@ subroutine input_data | |
| write(nu_diag,*) subname//' WARNING: For consistency, set tfrz_option = mushy' | ||
| endif | ||
| endif | ||
| if (ktherm == 1 .and. trim(saltflux_option) /= 'constant') then | ||
|
Contributor
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. should this be an error or just a warning that nobody will see?
Contributor
Author
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. I'm basically going with the example of tfrz_option here. It is not advisable to use ktherm = 1 and saltflux_option /= 'constant', but maybe people could do it if they wanted.
Contributor
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. fine by me, was just asking. |
||
| if (my_task == master_task) then | ||
| write(nu_diag,*) subname//' WARNING: ktherm = 1 and saltflux_option = ',trim(saltflux_option) | ||
| write(nu_diag,*) subname//' WARNING: For consistency, set saltflux_option = constant' | ||
| endif | ||
| endif | ||
| !tcraig | ||
| if (ktherm == 1 .and. .not.sw_redist) then | ||
| if (my_task == master_task) then | ||
|
|
@@ -1974,6 +1985,10 @@ subroutine input_data | |
| write(nu_diag,*) ' WARNING: will impact ocean forcing interaction' | ||
| write(nu_diag,*) ' WARNING: coupled forcing will be modified by mixed layer routine' | ||
| endif | ||
| write(nu_diag,1030) ' saltflux_option = ', trim(saltflux_option) | ||
| if (trim(saltflux_option) == 'constant') then | ||
| write(nu_diag,1002) ' ice_ref_salinity = ',ice_ref_salinity | ||
| endif | ||
| if (trim(tfrz_option) == 'minus1p8') then | ||
| tmpstr2 = ' : constant ocean freezing temperature (-1.8C)' | ||
| elseif (trim(tfrz_option) == 'linear_salt') then | ||
|
|
@@ -2378,6 +2393,7 @@ subroutine input_data | |
| wave_spec_type_in = wave_spec_type, & | ||
| wave_spec_in=wave_spec, nfreq_in=nfreq, & | ||
| tfrz_option_in=tfrz_option, kalg_in=kalg, fbot_xfer_type_in=fbot_xfer_type, & | ||
| saltflux_option_in=saltflux_option, ice_ref_salinity_in=ice_ref_salinity, & | ||
| Pstar_in=Pstar, Cstar_in=Cstar, iceruf_in=iceruf, iceruf_ocn_in=iceruf_ocn, calc_dragio_in=calc_dragio, & | ||
| windmin_in=windmin, drhosdwind_in=drhosdwind, & | ||
| rsnw_fall_in=rsnw_fall, rsnw_tmax_in=rsnw_tmax, rhosnew_in=rhosnew, & | ||
|
|
@@ -2793,7 +2809,7 @@ subroutine set_state_var (nx_block, ny_block, & | |
| indxi, indxj ! compressed indices for cells with aicen > puny | ||
|
|
||
| real (kind=dbl_kind) :: & | ||
| Tsfc, sum, hbar, abar, puny, rhos, Lfresh, rad_to_deg, rsnw_fall, dist_ratio | ||
| Tsfc, sum, hbar, abar, puny, rhos, Lfresh, rad_to_deg, rsnw_fall, dist_ratio, Tffresh | ||
|
|
||
| real (kind=dbl_kind), dimension(ncat) :: & | ||
| ainit, hinit ! initial area, thickness | ||
|
|
@@ -2835,7 +2851,7 @@ subroutine set_state_var (nx_block, ny_block, & | |
| nt_smice_out=nt_smice, nt_smliq_out=nt_smliq, & | ||
| nt_rhos_out=nt_rhos, nt_rsnw_out=nt_rsnw) | ||
| call icepack_query_parameters(rhos_out=rhos, Lfresh_out=Lfresh, puny_out=puny, & | ||
| rad_to_deg_out=rad_to_deg, rsnw_fall_out=rsnw_fall) | ||
| rad_to_deg_out=rad_to_deg, rsnw_fall_out=rsnw_fall, Tffresh_out=Tffresh) | ||
| call icepack_query_parameters(secday_out=secday, pi_out=pi) | ||
| call icepack_warnings_flush(nu_diag) | ||
| if (icepack_warnings_aborted()) call abort_ice(error_message=subname, & | ||
|
|
@@ -3074,6 +3090,8 @@ subroutine set_state_var (nx_block, ny_block, & | |
| if (tmask(i,j)) then | ||
| ! place ice in high latitudes where ocean sfc is cold | ||
| if ( (sst (i,j) <= Tf(i,j)+p2) .and. & | ||
| ! Option to use Tair instead. | ||
| ! if ( (Tair (i,j) <= Tffresh) .and. & | ||
| (TLAT(i,j) < edge_init_sh/rad_to_deg .or. & | ||
| TLAT(i,j) > edge_init_nh/rad_to_deg) ) then | ||
| icells = icells + 1 | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -116,7 +116,11 @@ subroutine init_fileunits | |
| ice_IOUnitsInUse(ice_stdout) = .true. ! reserve unit 6 | ||
| ice_IOUnitsInUse(ice_stderr) = .true. | ||
| if (nu_diag >= 1 .and. nu_diag <= ice_IOUnitsMaxUnit) & | ||
| ice_IOUnitsInUse(nu_diag) = .true. ! reserve unit nu_diag | ||
| ice_IOUnitsInUse(nu_diag) = .true. ! reserve unit nu_diag | ||
| #ifdef CESMCOUPLED | ||
| ! CESM can have negative unit numbers. | ||
| if (nu_diag < 0) nu_diag_set = .true. | ||
|
Contributor
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. Had a quick look at "nu_diag_set" usage and don't love it overall. Can we put #ifdef CESMCOUPLED" around it everywhere, so it's clear it has nothing to do with CICE.
Contributor
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. including in the declaration in ice_fileunits.F90.
Contributor
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. or could we get rid of nu_diag_set and use CESMCOUPLED cpp to "turn off" whatever CICE is doing to set/release nu_diag? With CESMCOUPLED, if we can assume nu_diag is set by the coupler layer, we shouldn't need "nu_diag_set".
Contributor
Author
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. This is fine. |
||
| #endif | ||
|
|
||
| call get_fileunit(nu_grid) | ||
| call get_fileunit(nu_kmt) | ||
|
|
@@ -239,7 +243,8 @@ subroutine release_all_fileunits | |
| call release_fileunit(nu_rst_pointer) | ||
| call release_fileunit(nu_history) | ||
| call release_fileunit(nu_hdr) | ||
| if (nu_diag /= ice_stdout) call release_fileunit(nu_diag) | ||
| ! CESM can have negative unit numbers | ||
| if (nu_diag > 0 .and. nu_diag /= ice_stdout) call release_fileunit(nu_diag) | ||
|
Contributor
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. Maybe rather than change this logic, it should just be #ifndef CESMCOUPLED
Contributor
Author
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. We still need to make sure not to release the negative file units here. However, I am fine with wrapping in a CESMCOUPLED.
Contributor
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. Overall, I think it would be nice if the unit number management in CICE is not altered by the coupled models. If we could come up with a few rules like
then it should be easy to clean up the unit number management, really just nu_diag, in CICE and make it a lot clearer. Does that make sense? |
||
|
|
||
| end subroutine release_all_fileunits | ||
|
|
||
|
|
||
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.
Looks like you could reuse work1 here rather than add new array, work2.
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.
Maybe. I thought they needed to be independent.
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.
In this code, we do not need work2, but in the print_points code we do. The array work2 is used in a number of places, so it is not really saving us memory.
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.
OK, it just looks like work2 was added in init_mass_diags just for the new salt diagnostic. work2 must exist separately in print_points and elsewhere.