-
Notifications
You must be signed in to change notification settings - Fork 25
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
Hamocc hybrid coord2 #179
Hamocc hybrid coord2 #179
Conversation
phy/mod_difest.F
Outdated
@@ -1161,7 +1162,7 @@ subroutine difest_vertical_hyb(m,n,mm,nn,k1m,k1n) | |||
. cellHeight,OBLdepth(i,j)) | |||
|
|||
! gets index of the level and interface above hbl | |||
kOBL = CVMix_kpp_compute_kOBL_depth(iFaceHeight, | |||
kOBL(i,j) = CVMix_kpp_compute_kOBL_depth(iFaceHeight, |
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.
I am a bit uncertain, but CVMix_kpp_compute_kopb_depth()
i) seem to return a real value and ii) depending on which index one wants, it potentially requires to subtract 1 (not sure about the vertical grid layout in BLOM) iii) why calculating it again - and not using hOBL? - from CVMix:
! !DESCRIPTION:
! Computes the index of the level and interface above OBL\_depth. The index is
! stored as a real number, and the integer index can be solved for in the
! following way:\\
! \verb|kt| = index of cell center above OBL\_depth = \verb|nint(kOBL_depth)-1|
! \verb|kw| = index of interface above OBL\_depth = \verb|floor(kOBL_depth)|
In any case, to be clean, I guess it would be good to explicitly convert from real to integer for the k-index. This applies again below.
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.
Thanks @jmaerz !
@matsbn @milicak I would like to hear from you about this issue.
I did not look into the CVMix routine itself when I made these code changes, but I agree that this looks suspicious. For iHAMOCC we probably want the index of the cell center above OBL_depth
, not the index of the interface.
hOBL
is computed twice, first by the subroutine CVMix_kpp_compute_OBL_depth
and later by function CVMix_kpp_compute_kOBL_depth
. The function CVMix_kpp_compute_kOBL_depth
is used internally in CVMix_kpp_compute_OBL_depth
, so there should be no need to do this again. Then kOBL
is computed (twice) by the function CVMix_kpp_compute_kOBL_depth
.
kOBL
is used in the calculation of buoyancy flux acting on the OBL, so in this case the index may need to reference the interface. If so, we may want to define a new index OBL_cell_center = nint(hOBL) - 1
for use in iHAMOCC.
de64243
to
5c60b24
Compare
Will update this PR depending on feedback for PR #182 |
Thanks for keeping that going! |
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.
I haven't dived into the kOBL-issue, but from the HAMOCC side this looks fine to me.
Define kmle according to CVMix definition of surface mixed layer for hybrid coordinates.
189b866
to
eb9b960
Compare
Hi, I have revived this PR after changing the dependency between BLOM and iHAMOCC, so now I'm porting the real value surface mixed layer depth hOBL, corresponding to the fractional depth in the index space, instead of the integer index value kOBL. @matsbn , @milicak @jmaerz , @JorgSchwinger |
In routine inivar_difest, you could initialise hOBL(:,:) with the following code block at the end of the routine:
This should give kmle = 2 always at ocean grid cells, except when vcoord_type_tag == cntiso_hybrid. Maybe then you do not have to access the mod_vcoord variables in iHAMOCC for now. |
Hi @TomasTorsvik , just to understand the problem with the As minor thing: are the line breaks (the re-formatting) in Apart from that the changes look fine to me. |
No, I changed it back to the the original form. |
Hi @jmaerz ,
the loop should not encounter any I have changed the initiation for |
Ok, I see, so it was more of a theoretical problem and you haven't encountered it really. Good to know about it and thanks for the information! From my side, you've my approval to merge. |
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.
Approved.
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.
It should be OK now. I would prefer that hOBL is first set to spval everywhere, also including the halo, then initialised to hOBL_static only for wet points. The purpose of first initialising to a very large value, spval, is that the code would typically crash if using the variable where one shouldn't (e.g at land points). This can be corrected later.
Thanks @matsbn , I see that iHAMOCC is referencing the wet points indexing at some places, but I'm not sure if this is done consistently. I therefore prefer to merge this version of the PR, and make a separate issue on the use of wet points indexing in iHAMOCC. |
Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.
Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.
* Dynamic mapping of pore water tracers to ocean tracers (#192) * Initial restructuring of sediment-related tracer declaration and initialization * Introducing mapping function * Remove unncessary comments * Fixed diagnostics bug and updated index naming * Added initial support for NUOPC driver. * Lon-lat variable sediment porosity (#189) Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting. * Added wave forcing fields. * Renamed folder for MCT driver. * Moved MCT specific file from drivers/cpl_share/ to drivers/mct/. * Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90. * Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran. * Remove redundant definition of kOBL. * Redefine kOBL, cast as integer * Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (#198) * Removing bodensed - Initialization of sediment parameters and fields now in mo_sedmnt * Hamocc hybrid coord2 (#179) Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates. * Fix porosity read (#201) * Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926 * Provide number of layers (3rd dim) via ks and not hard-coded * minor clean-up * Correct unit of diagnostic variable dp_trc. * Made conservation and checksum diagnostics selectable by namelist options (default off). * pCO2, Piston velocity and solubility output (#202) * add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility) * Bugfix pnetcdf (#208) * Add variables used by PNETCDF to explicit use staements. * Move implicit none statments * update explicit use statement for pnetcdf * fixed units and renamed calcium burial to CaCO3 burial (#212) Fixed sediment clay units. * Add option for surface pH output (#221) * Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90 * Import get_bgc_namelist only in subroutine where it is needed. (#225) Co-authored-by: Mats Bentsen <mben@norceresearch.no> Co-authored-by: Tomas Torsvik <tomas.torsvik.work@gmail.com> Co-authored-by: Tomas Torsvik <43031053+TomasTorsvik@users.noreply.github.com> Co-authored-by: Jörg Schwinger <jorg.schwinger@norceresearch.no>
* Dynamic mapping of pore water tracers to ocean tracers (#192) * Initial restructuring of sediment-related tracer declaration and initialization * Introducing mapping function * Remove unncessary comments * Fixed diagnostics bug and updated index naming * Added initial support for NUOPC driver. * Lon-lat variable sediment porosity (#189) Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting. * Added wave forcing fields. * Renamed folder for MCT driver. * Moved MCT specific file from drivers/cpl_share/ to drivers/mct/. * Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90. * Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran. * Remove redundant definition of kOBL. * Redefine kOBL, cast as integer * Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (#198) * Removing bodensed - Initialization of sediment parameters and fields now in mo_sedmnt * This is the first commit of MKS units. All variables in the subroutines have been converted to MKS [meter, kg, seconds] instead of CGS [cm, gram, seconds] with necessary coefficients. The default option which is CGS reproduce old results. The new option MKS cannot reproduce because of machine precision. * Hamocc hybrid coord2 (#179) Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates. * BLOM CIME cpp updates to run in NorESM * bug fixes for the CGS MKS conversion * cesm thermal forcing bug fixes for reproducibility * BLOM MKS update to export winds into the CESM using proper units. * input values in ocn_in case is updated for mks setup * default cgsmks value changed * Initialize some variables in the k-epsilon model. * Fix porosity read (#201) * Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926 * Provide number of layers (3rd dim) via ks and not hard-coded * minor clean-up * Correct unit of diagnostic variable dp_trc. * Made conservation and checksum diagnostics selectable by namelist options (default off). * pCO2, Piston velocity and solubility output (#202) * add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility) * Bugfix pnetcdf (#208) * Add variables used by PNETCDF to explicit use staements. * Move implicit none statments * update explicit use statement for pnetcdf * fixed units and renamed calcium burial to CaCO3 burial (#212) Fixed sediment clay units. * - Made the "fuk95" configuration work with MKS units. - Removed "CGS" CPP flag. - Changed some unit conversion factors from variables to parameters. - Introduced rho0 (= 1/alpha0) parameter. - Updated copyright statements. * Correct unit conversion of mixed layer depth to pressure. * Updated NorESM coupling scripts for the use of MKS units. * Fixed check of unit system when building as NorESM component. * Add option for surface pH output (#221) * Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90 * Import get_bgc_namelist only in subroutine where it is needed. (#225) * fix missing ' (#228) Fixing a missing ' that only showed up when using `cisonew` --------- Co-authored-by: Mats Bentsen <mben@norceresearch.no> Co-authored-by: Tomas Torsvik <tomas.torsvik.work@gmail.com> Co-authored-by: Mehmet Ilicak <milicak@itu.edu.tr> Co-authored-by: Tomas Torsvik <43031053+TomasTorsvik@users.noreply.github.com> Co-authored-by: Jörg Schwinger <jorg.schwinger@norceresearch.no>
Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.
Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates.
* Dynamic mapping of pore water tracers to ocean tracers (NorESMhub#192) * Initial restructuring of sediment-related tracer declaration and initialization * Introducing mapping function * Remove unncessary comments * Fixed diagnostics bug and updated index naming * Added initial support for NUOPC driver. * Lon-lat variable sediment porosity (NorESMhub#189) Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting. * Added wave forcing fields. * Renamed folder for MCT driver. * Moved MCT specific file from drivers/cpl_share/ to drivers/mct/. * Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90. * Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran. * Remove redundant definition of kOBL. * Redefine kOBL, cast as integer * Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (NorESMhub#198) * Removing bodensed - Initialization of sediment parameters and fields now in mo_sedmnt * Hamocc hybrid coord2 (NorESMhub#179) Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates. * Fix porosity read (NorESMhub#201) * Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926 * Provide number of layers (3rd dim) via ks and not hard-coded * minor clean-up * Correct unit of diagnostic variable dp_trc. * Made conservation and checksum diagnostics selectable by namelist options (default off). * pCO2, Piston velocity and solubility output (NorESMhub#202) * add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility) * Bugfix pnetcdf (NorESMhub#208) * Add variables used by PNETCDF to explicit use staements. * Move implicit none statments * update explicit use statement for pnetcdf * fixed units and renamed calcium burial to CaCO3 burial (NorESMhub#212) Fixed sediment clay units. * Add option for surface pH output (NorESMhub#221) * Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90 * Import get_bgc_namelist only in subroutine where it is needed. (NorESMhub#225) Co-authored-by: Mats Bentsen <mben@norceresearch.no> Co-authored-by: Tomas Torsvik <tomas.torsvik.work@gmail.com> Co-authored-by: Tomas Torsvik <43031053+TomasTorsvik@users.noreply.github.com> Co-authored-by: Jörg Schwinger <jorg.schwinger@norceresearch.no>
…b#232) * Dynamic mapping of pore water tracers to ocean tracers (NorESMhub#192) * Initial restructuring of sediment-related tracer declaration and initialization * Introducing mapping function * Remove unncessary comments * Fixed diagnostics bug and updated index naming * Added initial support for NUOPC driver. * Lon-lat variable sediment porosity (NorESMhub#189) Introducing a static 3D sediment porosity field that can be optionally read in with effects on molecular pore water diffusion and shifting. * Added wave forcing fields. * Renamed folder for MCT driver. * Moved MCT specific file from drivers/cpl_share/ to drivers/mct/. * Rename drivers/mct/mod_swtfrz.F to drivers/mct/mod_swtfrz.F90. * Rewrite to drivers/mct/mod_swtfrz.F90 to free format Fortran. * Remove redundant definition of kOBL. * Redefine kOBL, cast as integer * Fixing variable sediment porosity - field initialization in case of `sedbypass=true` (NorESMhub#198) * Removing bodensed - Initialization of sediment parameters and fields now in mo_sedmnt * This is the first commit of MKS units. All variables in the subroutines have been converted to MKS [meter, kg, seconds] instead of CGS [cm, gram, seconds] with necessary coefficients. The default option which is CGS reproduce old results. The new option MKS cannot reproduce because of machine precision. * Hamocc hybrid coord2 (NorESMhub#179) Make the surface mixed layer depth fractional index `hOBL` available for use in iHAMOCC, and adjust the internal iHAMOCC index `kmle` according to `hOBL`. Default value `kmle = 2` is retained for consistency with isopycnic coordinates. * BLOM CIME cpp updates to run in NorESM * bug fixes for the CGS MKS conversion * cesm thermal forcing bug fixes for reproducibility * BLOM MKS update to export winds into the CESM using proper units. * input values in ocn_in case is updated for mks setup * default cgsmks value changed * Initialize some variables in the k-epsilon model. * Fix porosity read (NorESMhub#201) * Fixing the reading of variable porosity input field in preparation for the NorESM 2.0.6 release Cherry-picked from private Ncycleprivate branch 0d56930e2fdd62caba964d375b57304942568926 * Provide number of layers (3rd dim) via ks and not hard-coded * minor clean-up * Correct unit of diagnostic variable dp_trc. * Made conservation and checksum diagnostics selectable by namelist options (default off). * pCO2, Piston velocity and solubility output (NorESMhub#202) * add pCO2m (moist), CO2 piston velocity and solubility output - caution: kwco2 piston velocity now really holds only piston velocity (and not times solubility) * Bugfix pnetcdf (NorESMhub#208) * Add variables used by PNETCDF to explicit use staements. * Move implicit none statments * update explicit use statement for pnetcdf * fixed units and renamed calcium burial to CaCO3 burial (NorESMhub#212) Fixed sediment clay units. * - Made the "fuk95" configuration work with MKS units. - Removed "CGS" CPP flag. - Changed some unit conversion factors from variables to parameters. - Introduced rho0 (= 1/alpha0) parameter. - Updated copyright statements. * Correct unit conversion of mixed layer depth to pressure. * Updated NorESM coupling scripts for the use of MKS units. * Fixed check of unit system when building as NorESM component. * Add option for surface pH output (NorESMhub#221) * Remove unused parameters in wrt* subroutine calls in ncout_hamocc.F90 * Import get_bgc_namelist only in subroutine where it is needed. (NorESMhub#225) * fix missing ' (NorESMhub#228) Fixing a missing ' that only showed up when using `cisonew` --------- Co-authored-by: Mats Bentsen <mben@norceresearch.no> Co-authored-by: Tomas Torsvik <tomas.torsvik.work@gmail.com> Co-authored-by: Mehmet Ilicak <milicak@itu.edu.tr> Co-authored-by: Tomas Torsvik <43031053+TomasTorsvik@users.noreply.github.com> Co-authored-by: Jörg Schwinger <jorg.schwinger@norceresearch.no>
For hybrid cooridinates, define depth of surface mixed layer in HAMOCC by the ocean boundary layer (OBL) variable provided by CVmix. Default value kml(i,j) = 2 used for isopycnic variables for consistency with the bulk mixed layer formulation.