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

dEdd aerosol fixes #400

Merged
merged 4 commits into from
Sep 28, 2022
Merged

dEdd aerosol fixes #400

merged 4 commits into from
Sep 28, 2022

Conversation

apcraig
Copy link
Contributor

@apcraig apcraig commented Sep 20, 2022

PR checklist

  • Short (1 sentence) summary of your PR:
    dEdd aerosol fixes

  • Developer(s):
    apcraig, eclare108213

  • Suggest PR reviewers from list in the column to the right.

  • Please copy the PR test results link or provide a summary of testing completed below.
    bit-for-bit against current Icepack trunk, https://github.com/CICE-Consortium/Test-Results/wiki/icepack_by_hash_forks#0717620693e6545c0c693cb17987a5e412162b79. Also testing CICE suite on cheyenne.

  • How much do the PR code changes differ from the unmodified code?

    • bit for bit except when tr_aero is on (added to test suite)
    • different at roundoff level
    • more substantial
  • Does this PR create or have dependencies on CICE or any other models?

    • Yes
    • No
  • Does this PR add any new test cases?

    • Yes, modal
    • No
  • Is the documentation being updated? ("Documentation" includes information on the wiki or in the .rst files from doc/source/, which are used to create the online technical docs at https://readthedocs.org/projects/cice-consortium-cice/.)

    • Yes
    • No, does the documentation need to be updated at a later time?
      • Yes
      • No
  • Please provide any additional information or relevant details below:

  • update g/w0/tau calculation, get rid of use of puny

  • add missing g/w0/tau calculation after "aerosol in snow" calculation

  • fix bug in computation of modal_aero taer/waer/gaer, changed divide to multiple of rnilyr/rnslyr

  • refactor divides of rnilyr/rnslyr to multiplies of real(nilyr/nslyr)

  • add modal option, update test suite

- update g/w0/tau calculation, get rid of use of puny
- add missing g/w0/tau calculation after "aerosol in snow" calculation
- fix bug in computation of modal_aero taer/waer/gaer, changed divide to multiple of rnilyr/rnslyr
- refactor divides of rnilyr/rnslyr to multiplies of real(nilyr/nslyr)

Generally changes answers for tr_aero
@apcraig
Copy link
Contributor Author

apcraig commented Sep 20, 2022

This is a draft because we should discuss whether these changes are correct and whether this is what we want to do. Otherwise, I think these changes are working.

@dabail10
Copy link
Contributor

I have to test this out in CESM.

Dave

Copy link
Contributor

@eclare108213 eclare108213 left a comment

Choose a reason for hiding this comment

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

This all looks correct to me. Since standard testing is BFB, the compiler/optimizer must be fixing the 1/(1/n)=n coding issues. Testing with tr_aero=T in a realistic simulation would be helpful, as a sanity check -- I would not expect those results to be BFB -- although these bugs should be fixed, regardless. Thanks much.

tau(k) = tau(k) + taer
enddo ! k
endif ! tr_aero

! pond
else !if( srftyp == 2 ) then
! pond water layers evenly spaced
dz = hp/(c1/rnslyr+c1)
dz = hp/(real(nslyr,kind=dbl_kind)+c1)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this change is correct, but I question the original expression -- does anyone understand why the +1 is in the denominator? It looks like the dEdd scheme is dividing the pond depth (volume) evenly among the snow layers, but then why is this not dz=hp/nslyr ?

Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this was the "surface scattering layer" versus the "internal layer". So, I think this is fine.

Copy link
Contributor

Choose a reason for hiding this comment

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

Okay, now I see that the loop immediately following this line is over k = 0, nslyr. So the ponds are simply divided into nslyr+1 equally-spaced layers for the dEdd calculations, and I won't worry about what "SSL" might mean for a pond -- it's just bookkeeping for consistency with the snow calculation, I guess. Thanks.

(w0(k)*tau(k) + waer)
w0(k) = (w0(k)*tau(k) + waer) / &
(tau(k) + taer)
tau(k) = tau(k) + taer
Copy link
Contributor

Choose a reason for hiding this comment

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

It does look like these three lines will impact tr_aero and model_aero = .false. I looked back in the CICE5 code and this was the original implementation. Trying it out now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The changes to the "puny" implementation elsewhere will change answers but only slightly. On the other hand, this block of changes was a bug and could be more consequential.

waer_tab(ns,(1+(na-1)/4))
gaer = gaer + &
(aero_mp(na+1)/rnslyr)*kaer_tab(ns,(1+(na-1)/4))* &
(aero_mp(na+1)*rnslyr)*kaer_tab(ns,(1+(na-1)/4))* &
Copy link
Contributor

Choose a reason for hiding this comment

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

This is almost comical ...

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 guess this is just modal aerosol. Not sure if you or others are using that. We haven't been testing it in CICE because it hasn't been working. But now it does and I have added tests to both Icepack and CICE. Still can't say whether answers are scientifically correct though.

g(k) = (g(k)*w0(k)*tau(k) + gaer) / &
(w0(k)*tau(k) + waer)
w0(k) = (w0(k)*tau(k) + waer) / &
(tau(k) + taer)
Copy link
Contributor

Choose a reason for hiding this comment

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

This also looks like it might impact answers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These changes should be round-off-ish.

@dabail10
Copy link
Contributor

After four years, the answers are definitely different. I want to run it longer to see if it is "climate" changing.

@eclare108213
Copy link
Contributor

I wouldn't be surprised if these mods are "climate changing" when tr_aero=T and modal_aero=F, when comparing CICE6 before/after this PR. Is that what you're testing @dabail10?

These are bugs in CICE6 that were not present in CICE5, and should be fixed regardless of whether they are deemed to be climate changing, right away. If this modified code produces reasonable-looking answers, then I think we should merge it and keep moving forward. More careful comparisons with CICE5 might be needed to understand differences between the code versions, but let's at least get the obvious bugs fixed ASAP. We may need to make further modifications later, as we continue the BGC merge. Is this plan okay with those of you reading this thread?

@apcraig
Copy link
Contributor Author

apcraig commented Sep 22, 2022

@eclare108213, I agree that these things need to be fixed. We should try to understand the impact of the bug and document that, but that could be done over days/weeks as needed.

@eclare108213
Copy link
Contributor

@dabail10 How are your runs going? I'd like to merge this one.

@dabail10
Copy link
Contributor

I have 20 years of both. Here are some diagnostics:

https://webext.cgd.ucar.edu/B1850/b.cesm3_cam058_mom_e.B1850WscMOM.ne30_L58_t061.camdev_cice6.026b2/ice/b.cesm3_cam058_mom_e.B1850WscMOM.ne30_L58_t061.camdev_cice6bugfix.026b-b.cesm3_cam058_mom_e.B1850WscMOM.ne30_L58_t061.camdev_cice6.026b/yrs1-21/

Basically I can't really tell as it is only 20 years, but it does not appear to be climate changing. I will run these out for 100 years.

Dave

to implementation consistent with E3SM Icepack snicar upgrades
This change is bit-for-bit for the full test suite  on cheyenne.
@apcraig
Copy link
Contributor Author

apcraig commented Sep 28, 2022

Can we merge while we continue to assess?

@dabail10
Copy link
Contributor

I would say go ahead.

@apcraig apcraig marked this pull request as ready for review September 28, 2022 22:55
@apcraig apcraig merged commit 460ddf8 into CICE-Consortium:main Sep 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants