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

Documentation on adding diagnostic output. #331

Merged
merged 26 commits into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
158b443
Fix nt_zbgc_frac
dabail10 Feb 18, 2020
93c6ab4
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Feb 20, 2020
8f3263d
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Feb 24, 2020
776316e
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Apr 2, 2020
a2219bf
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Apr 6, 2020
2abbfa7
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Apr 22, 2020
9bb6df7
Merge branch 'master' of https://github.com/ESCOMP/Icepack
dabail10 Apr 22, 2020
b72c0bc
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 May 15, 2020
1f0195e
Merge branch 'master' of https://github.com/ESCOMP/Icepack
dabail10 May 15, 2020
78c0aef
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 May 29, 2020
6a603cd
Merge branch 'master' of https://github.com/ESCOMP/Icepack
dabail10 May 29, 2020
d353104
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Jun 10, 2020
d9273f1
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Jun 24, 2020
2ec16b0
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Jul 6, 2020
a40bbf9
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Jul 13, 2020
faa181f
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Jul 16, 2020
a2950cc
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack
dabail10 Jul 24, 2020
e920664
New developer guide module on adding diagnostics
dabail10 Jul 28, 2020
641b354
Merge branch 'master' of https://github.com/CICE-Consortium/Icepack i…
dabail10 Dec 14, 2020
a12e4a9
More on adding diagnostics
dabail10 Dec 14, 2020
a7f961a
test
dabail10 Dec 14, 2020
88d35ce
fix errors
dabail10 Dec 14, 2020
616a69a
Fix version of bibtex
dabail10 Dec 14, 2020
9b6238a
Fix version of bibtex
dabail10 Dec 14, 2020
dde8c27
Merge branch 'master' of git+ssh://github.com/CICE-Consortium/Icepack…
dabail10 Mar 18, 2021
25a2793
Update documentation for diagnostics
dabail10 Mar 18, 2021
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
57 changes: 57 additions & 0 deletions doc/source/developer_guide/dg_adding_diagnostics.rst
Original file line number Diff line number Diff line change
@@ -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).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is would add what n is, e.g.

The following example adds snow melt (melts) for each of the n points.

(no hyphen needed)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added a bit more here. Hopefully this is helpful.


.. 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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spell activated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


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.

1 change: 1 addition & 0 deletions doc/source/developer_guide/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,5 @@ Developer Guide
dg_driver.rst
dg_scripts.rst
dg_adding_tracers.rst
dg_adding_diagnostics.rst
dg_other.rst