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

clarification on prt_mass diag function #749

Open
aschuh opened this issue Jan 3, 2024 · 0 comments
Open

clarification on prt_mass diag function #749

aschuh opened this issue Jan 3, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@aschuh
Copy link

aschuh commented Jan 3, 2024

I was hoping to get clarification on the prt_mass and z_sum subroutines in the FV3/atmos_cubed_sphere/tools/fv_diagnostics.F90 file. I'm dumping emissions of a passive tracer into the q tracer array and hoping to sum up the atmos burden to verify that everything is working.

First, I'm confused by the is, ie, js, and je. I'm assuming they are tied to domain decomp and MPI and hence should try to "leave them alone" as much as possible and mimic existing code. Nevertheless, I'm also confused by the argument "n_g" and use the back and forth use of different subarrays of the q tracer array. Some sort of buffer or offset?

For example, q and psq are allocated early as:

real, intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km, nq)
real psq(is:ie,js:je,nwat)

But these are often fed into "z_sum" subroutine as:

if (liq_wat > 0) &
call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,liq_wat), psq(is,js,liq_wat))

In this case, q() basically becomes a scalar input. However, it is also assigned from is-n_g,js-n_g position to is,js position in psq. Furthermore in the z_sum function, the expected input is a non-trivial array (see q() below):

subroutine z_sum(is, ie, js, je, km, n_g, delp, q, sum2)
integer, intent(in):: is, ie, js, je, n_g, km
real, intent(in):: delp(is-n_g:ie+n_g, js-n_g:je+n_g, km)
real, intent(in):: q(is-n_g:ie+n_g, js-n_g:je+n_g, km)

This back and forth between q(is-n_g:ie+n_g, js-n_g:je+n_g, km) and q(is-n_g, js-n_g, km) and inconsistency in expected args makes me concerned that it isn't summing my tracers right (which it doesn't look to be).

Furthermore, it often appears that the tracer array is often only being summed over the 1st vertical level (unless I'm missing something?). It seems like it should be q(is-n_g,js-n_g,:,liq_wat) instead of q(is-n_g,js-n_g,1,liq_wat) if you want ALL liq water summed.

if (liq_wat > 0) &
call z_sum(is, ie, js, je, km, n_g, delp, q(is-n_g,js-n_g,1,liq_wat), psq(is,js,liq_wat))

Basically, a lot of confusing stuff here and I can't follow the domain decomp/MPI stuff well enough to understand the indexing that is going on.

Any help or advice would be appreciate, thanks.
andrew

@aschuh aschuh added the bug Something isn't working label Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant