From 158b4433b804bc40db40deb335bb9f33eaff5b7e Mon Sep 17 00:00:00 2001 From: David Bailey Date: Tue, 18 Feb 2020 13:59:40 -0700 Subject: [PATCH 1/8] Fix nt_zbgc_frac --- configuration/driver/icedrv_init_column.F90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configuration/driver/icedrv_init_column.F90 b/configuration/driver/icedrv_init_column.F90 index c708189f8..977d04fb2 100644 --- a/configuration/driver/icedrv_init_column.F90 +++ b/configuration/driver/icedrv_init_column.F90 @@ -1311,6 +1311,7 @@ subroutine init_zbgc nt_bgc_DMS = 0 nt_bgc_PON = 0 nt_bgc_hum = 0 + nt_zbgc_frac = 0 !----------------------------------------------------------------- ! Define array parameters @@ -1700,7 +1701,6 @@ subroutine init_zbgc endif ! tr_zaero !echmod keep trcr indices etc here but move zbgc_frac_init, zbgc_init_frac, tau_ret, tau_rel to icepack - nt_zbgc_frac = 0 if (nbtrcr > 0) then nt_zbgc_frac = ntrcr + 1 ntrcr = ntrcr + nbtrcr From e920664dbfe063fb03e169bee9f110ef8b5b495f Mon Sep 17 00:00:00 2001 From: David Bailey Date: Tue, 28 Jul 2020 15:44:15 -0600 Subject: [PATCH 2/8] New developer guide module on adding diagnostics --- .../developer_guide/dg_adding_diagnostics.rst | 57 +++++++++++++++++++ doc/source/developer_guide/index.rst | 1 + 2 files changed, 58 insertions(+) create mode 100755 doc/source/developer_guide/dg_adding_diagnostics.rst diff --git a/doc/source/developer_guide/dg_adding_diagnostics.rst b/doc/source/developer_guide/dg_adding_diagnostics.rst new file mode 100755 index 000000000..f0b381ca9 --- /dev/null +++ b/doc/source/developer_guide/dg_adding_diagnostics.rst @@ -0,0 +1,57 @@ +:tocdepth: 3 + +.. _adddiag: + +Adding diagnostics +================== + +Icepack only produces ASCII (text) log output for four points (full model with ITD, an initially ice free point, a land point, and a case with a slab ocean). Each of these files contains the state information for that point. Sometimes additional variables are required in this output. The procedure for adding diagnostic variables is outlined here. + +#. For non-BGC variables, one should edit **icedrv\_diagnostics.F90**: + + - If the variable is already defined within the code, then add it to a "use" statement in the subroutine + ``runtime_diags``. + + - If the variable is just a scalar, then follow the example of "aice". Copy the write statement for Qa to + a place in the output list where it is most appropriate. The format "900" is appropriate for most scalars. + Edit the copied statement to be the variable you want. The following example adds snow-melt (melts). + + .. code-block:: fortran + + use icedrv_flux, only: melts + + write(nu_diag_out+n-1,900) 'snow melt = ',melts(n)! snow melt + + - If the variable is an array, say depending on ncat, then follow the example of fiso_evap. This just requires + adding a loop for the print statement. Make sure ncat and a counter, nc are available. Say for example, + the category ice area, aicen. + + .. code-block:: fortran + + use icedrv_domain_size, only: ncat + + use icedrv_state, only: aicen + + ! local variables + + integer (kind=int_kind) :: & + n, nc, k + + do nc = 1,ncat + write(nu_diag_out+n-1,901) 'Category ice area = ',aicen(n,nc),nc ! category ice area + enddo + + - If the variable is a tracer, then in addition to the variable trcr or trcrn, you will need to have the tracer + index available. Here, you can look at the example of nt_Tsfc. + + - In some cases, a new format statement might be required if 900 or 901 are not correct. + +#. For BGC variables, one should edit **icedrv\_diagnostics\_bgc.F90**: + + - If the variable is already defined within the code, then add it to a "use" statement in the subroutine + ``hbrine_diags`` or ``bgc_diags`` or ``zsal_diags``. The similar procedure for state variables is used here. + + - Note that the BGC needs to be activited and the particular tracer turned on. + +In general, try to format the output statements to line up with the surrounding print messages. This may require a couple of tries to get it to compile and run. + diff --git a/doc/source/developer_guide/index.rst b/doc/source/developer_guide/index.rst index 31757e2a6..8206dbd3d 100755 --- a/doc/source/developer_guide/index.rst +++ b/doc/source/developer_guide/index.rst @@ -16,4 +16,5 @@ Developer Guide dg_driver.rst dg_scripts.rst dg_adding_tracers.rst + dg_adding_diagnostics.rst dg_other.rst From a12e4a94681f6777c6c232aec8bcba40963a1a60 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 14 Dec 2020 10:47:01 -0700 Subject: [PATCH 3/8] More on adding diagnostics --- doc/source/developer_guide/dg_adding_diagnostics.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/doc/source/developer_guide/dg_adding_diagnostics.rst b/doc/source/developer_guide/dg_adding_diagnostics.rst index f0b381ca9..490c756ac 100755 --- a/doc/source/developer_guide/dg_adding_diagnostics.rst +++ b/doc/source/developer_guide/dg_adding_diagnostics.rst @@ -5,13 +5,19 @@ Adding diagnostics ================== -Icepack only produces ASCII (text) log output for four points (full model with ITD, an initially ice free point, a land point, and a case with a slab ocean). Each of these files contains the state information for that point. Sometimes additional variables are required in this output. The procedure for adding diagnostic variables is outlined here. +Icepack only produces ASCII (text) log output for four points (full model with ITD, an initially ice free point, a land point, and a case with a slab ocean) designated by the variable ``n`` here. Each of these files contains the state information for that point. Sometimes additional variables are required in this output. The procedure for adding diagnostic variables is outlined here. #. For non-BGC variables, one should edit **icedrv\_diagnostics.F90**: - If the variable is already defined within the code, then add it to a "use" statement in the subroutine ``runtime_diags``. + - Note that if the variable is not readily accessible through a use statement, then a global variable needs to + be defined. This might be in **icedrv\_state.F90** or **icedrv\_flux.F90** for example. + + - Additionally, if the variable is a derived quantity, then one needs to include the variables from a use statement + to calculate the new quantity. For example, see how ``hiavg`` and ``hsavg`` are computed. + - If the variable is just a scalar, then follow the example of "aice". Copy the write statement for Qa to a place in the output list where it is most appropriate. The format "900" is appropriate for most scalars. Edit the copied statement to be the variable you want. The following example adds snow-melt (melts). @@ -24,7 +30,7 @@ Icepack only produces ASCII (text) log output for four points (full model with I - If the variable is an array, say depending on ncat, then follow the example of fiso_evap. This just requires adding a loop for the print statement. Make sure ncat and a counter, nc are available. Say for example, - the category ice area, aicen. + the category ice area, aicen. The variable ncat is the number of subgridscale categories. .. code-block:: fortran @@ -51,7 +57,7 @@ Icepack only produces ASCII (text) log output for four points (full model with I - If the variable is already defined within the code, then add it to a "use" statement in the subroutine ``hbrine_diags`` or ``bgc_diags`` or ``zsal_diags``. The similar procedure for state variables is used here. - - Note that the BGC needs to be activited and the particular tracer turned on. + - Note that the BGC needs to be activated and the particular tracer turned on. In general, try to format the output statements to line up with the surrounding print messages. This may require a couple of tries to get it to compile and run. From a7f961a91dc962309afa2621b8bd1afb4d9a5ef0 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 14 Dec 2020 11:01:57 -0700 Subject: [PATCH 4/8] test --- doc/source/developer_guide/dg_adding_diagnostics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/developer_guide/dg_adding_diagnostics.rst b/doc/source/developer_guide/dg_adding_diagnostics.rst index 490c756ac..a91a46eaa 100755 --- a/doc/source/developer_guide/dg_adding_diagnostics.rst +++ b/doc/source/developer_guide/dg_adding_diagnostics.rst @@ -57,7 +57,7 @@ Icepack only produces ASCII (text) log output for four points (full model with I - If the variable is already defined within the code, then add it to a "use" statement in the subroutine ``hbrine_diags`` or ``bgc_diags`` or ``zsal_diags``. The similar procedure for state variables is used here. - - Note that the BGC needs to be activated and the particular tracer turned on. + - Note that the BGC needs to be activated and and the particular tracer turned on. In general, try to format the output statements to line up with the surrounding print messages. This may require a couple of tries to get it to compile and run. From 88d35ce2d3164cde55e8ad726546a2e5a87f19ed Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 14 Dec 2020 15:43:43 -0700 Subject: [PATCH 5/8] fix errors --- doc/source/developer_guide/dg_adding_diagnostics.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/source/developer_guide/dg_adding_diagnostics.rst b/doc/source/developer_guide/dg_adding_diagnostics.rst index a91a46eaa..490c756ac 100755 --- a/doc/source/developer_guide/dg_adding_diagnostics.rst +++ b/doc/source/developer_guide/dg_adding_diagnostics.rst @@ -57,7 +57,7 @@ Icepack only produces ASCII (text) log output for four points (full model with I - If the variable is already defined within the code, then add it to a "use" statement in the subroutine ``hbrine_diags`` or ``bgc_diags`` or ``zsal_diags``. The similar procedure for state variables is used here. - - Note that the BGC needs to be activated and and the particular tracer turned on. + - Note that the BGC needs to be activated and the particular tracer turned on. In general, try to format the output statements to line up with the surrounding print messages. This may require a couple of tries to get it to compile and run. From 616a69a4e1f5f38c826b7b738d93774d9af7c405 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 14 Dec 2020 15:49:22 -0700 Subject: [PATCH 6/8] Fix version of bibtex --- doc/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 8788d6ac3..2ce4db46e 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ # # -sphinxcontrib-bibtex +sphinxcontrib-bibtex = {version = "<2.0.0"} # # From 9b6238adf0e9406bcaabcebadddf7e49cb06c94d Mon Sep 17 00:00:00 2001 From: David Bailey Date: Mon, 14 Dec 2020 16:04:12 -0700 Subject: [PATCH 7/8] Fix version of bibtex --- doc/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/requirements.txt b/doc/requirements.txt index 2ce4db46e..218e06d1f 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -1,5 +1,5 @@ # # -sphinxcontrib-bibtex = {version = "<2.0.0"} +sphinxcontrib-bibtex<2.0.0 # # From 25a27936913536f39e6122310852257348b2c7a9 Mon Sep 17 00:00:00 2001 From: David Bailey Date: Thu, 18 Mar 2021 10:25:14 -0600 Subject: [PATCH 8/8] Update documentation for diagnostics --- .../developer_guide/dg_adding_diagnostics.rst | 34 +++++++++---------- doc/source/science_guide/sg_thermo.rst | 6 ++-- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/doc/source/developer_guide/dg_adding_diagnostics.rst b/doc/source/developer_guide/dg_adding_diagnostics.rst index 490c756ac..ef5960830 100755 --- a/doc/source/developer_guide/dg_adding_diagnostics.rst +++ b/doc/source/developer_guide/dg_adding_diagnostics.rst @@ -5,32 +5,32 @@ Adding diagnostics ================== -Icepack only produces ASCII (text) log output for four points (full model with ITD, an initially ice free point, a land point, and a case with a slab ocean) designated by the variable ``n`` here. Each of these files contains the state information for that point. Sometimes additional variables are required in this output. The procedure for adding diagnostic variables is outlined here. +Icepack produces separate ASCII (text) log output for four cells, each with a different initial condition (full ITD, slab ice, ice free, land) designated by the variable ``n`` here. Each of the diagnostic files contains the state information for that cell. The procedure for adding diagnostic variables to the output is outlined here. -#. For non-BGC variables, one should edit **icedrv\_diagnostics.F90**: +#. For non-BGC variables, edit **icedrv\_diagnostics.F90**: - If the variable is already defined within the code, then add it to a "use" statement in the subroutine ``runtime_diags``. - - Note that if the variable is not readily accessible through a use statement, then a global variable needs to + - Note that if the variable is not readily accessible through a use statement, then a global variable may need to be defined. This might be in **icedrv\_state.F90** or **icedrv\_flux.F90** for example. - - Additionally, if the variable is a derived quantity, then one needs to include the variables from a use statement - to calculate the new quantity. For example, see how ``hiavg`` and ``hsavg`` are computed. + - Additionally, if the variable is a derived quantity, then the variables needed to calculate the new quantity + may need to be added to a use statement. For example, see how ``hiavg`` and ``hsavg`` are computed. - - If the variable is just a scalar, then follow the example of "aice". Copy the write statement for Qa to - a place in the output list where it is most appropriate. The format "900" is appropriate for most scalars. - Edit the copied statement to be the variable you want. The following example adds snow-melt (melts). + - If the variable is a scalar, then follow the example of ``aice`` or ``hiavg``, copying the write statement to + an appropriate place in the output list, and editing as needed. The format "900" is appropriate for most scalars. + The following example adds snow melt (``melts``). .. code-block:: fortran use icedrv_flux, only: melts - write(nu_diag_out+n-1,900) 'snow melt = ',melts(n)! snow melt + write(nu_diag_out+n-1,900) 'snow melt (m) = ',melts(n) ! snow melt - - If the variable is an array, say depending on ncat, then follow the example of fiso_evap. This just requires - adding a loop for the print statement. Make sure ncat and a counter, nc are available. Say for example, - the category ice area, aicen. The variable ncat is the number of subgridscale categories. + - If the variable is an array, then you can compute the mean value (e.g. ``hiavg``) or print the array values (e.g. ``fiso_evap``). + This may requires adding the array sizes and a counter for the loop(s). E.g. to print + the category ice area, ``aicen`` over ncat thickness categories: .. code-block:: fortran @@ -47,15 +47,15 @@ Icepack only produces ASCII (text) log output for four points (full model with I write(nu_diag_out+n-1,901) 'Category ice area = ',aicen(n,nc),nc ! category ice area enddo - - If the variable is a tracer, then in addition to the variable trcr or trcrn, you will need to have the tracer - index available. Here, you can look at the example of nt_Tsfc. + - If the variable is a tracer, then in addition to the variable trcr or trcrn, you will need the tracer + index (e.g. ``nt_Tsfc``). - - In some cases, a new format statement might be required if 900 or 901 are not correct. + - In some cases, a new format statement might be needed. -#. For BGC variables, one should edit **icedrv\_diagnostics\_bgc.F90**: +#. For BGC variables, edit **icedrv\_diagnostics\_bgc.F90**: - If the variable is already defined within the code, then add it to a "use" statement in the subroutine - ``hbrine_diags`` or ``bgc_diags`` or ``zsal_diags``. The similar procedure for state variables is used here. + ``hbrine_diags`` or ``bgc_diags`` or ``zsal_diags`` and follow a similar procedure for state variables as above. - Note that the BGC needs to be activated and the particular tracer turned on. diff --git a/doc/source/science_guide/sg_thermo.rst b/doc/source/science_guide/sg_thermo.rst index ad942f320..aff4f9ccc 100755 --- a/doc/source/science_guide/sg_thermo.rst +++ b/doc/source/science_guide/sg_thermo.rst @@ -743,9 +743,9 @@ Climate System Model (CCSM3), the albedo depends on the temperature and thickness of ice and snow and on the spectral distribution of the incoming solar radiation. Albedo parameters have been chosen to fit observations from the SHEBA field experiment. For -:math:`T_{sf} < -1^{\circ}C` and :math:`h_i > `\ ``ahmax``, the bare ice -albedo is 0.78 for visible wavelengths (:math:`<700`\ nm) and 0.36 for -near IR wavelengths (:math:`>700`\ nm). As :math:`h_i` decreases from +:math:`T_{sf} < -1^{\circ}C` and :math:`h_i >` \ `ahmax`, the bare ice +albedo is 0.78 for visible wavelengths (:math:`<700` \ nm) and 0.36 for +near IR wavelengths (:math:`>700` \ nm). As :math:`h_i` decreases from ahmax to zero, the ice albedo decreases smoothly (using an arctangent function) to the ocean albedo, 0.06. The ice albedo in both spectral bands decreases by 0.075 as :math:`T_{sf}` rises from