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

remove #ifdefs from HAMOCC #280

Merged
merged 59 commits into from
Oct 17, 2023

Conversation

mvertens
Copy link
Contributor

@mvertens mvertens commented Oct 13, 2023

This PR is a substitute for #264 (which I would like to close). It does not build upon the ability for CMEPS to calculate DMS and BROMO fluxes.
The current testing I have done is to compare relative to the latest baseline:

  1. ./create_test --xml-category aux_blom_noresm --xml-machine betzy --xml-compiler intel --gen aux_blom_noresm_13102023 --baseline-root /cluster/shared/noresm/noresm_baselines --compare aux_blom_noresm_27092023 --project nn2345k
    The following tests were run:
    ERP_Ld3.T62_tn14.NOINY.betzy_intel - passed
    ERS_Ld3.T62_tn14.NOINYOC.betzy_intel - passed
    ERS_Ld3.T62_tn14_wtn14nw.NOINY_WW3.betzy_intel - failed baseline comparison
    ERS_Ld3.T62_tn14_wtn14nw.NOINY_WW3.betzy_intel.blom-wavice - failed baseline comparison
    SMS_D_Ld1.T62_tn14.NOINYOC.betzy_intel - passed
    I think there is something problematic with the current ww3dev code that is leading to failures in the baseline comparison. The same tests without ww3 passed with no problem. I will raise an issue on this - but I don't think this should hold up this PR.
  2. Ran two tests using noresm2.0.6 - SMS.T62_tn14.NOINYOC.betzy_intel. The first used used BLOM master and the second tests used this PR for BLOM. The results were bfb after 5 days.
  3. Ran two fully coupled tests using noresm2.0.6 - SMS.f19_tn14.N1850esm.betzy_intel. The first used used BLOM master and the second tests used this PR for BLOM. The results were bfb after 5 days.

#ifdef cisonew
REAL :: beta13, alpha14, d14cat, d13c_atm
#endif
REAL :: dustd1, dustd2, dustsink !AGG
Copy link
Collaborator

@jmaerz jmaerz Oct 16, 2023

Choose a reason for hiding this comment

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

I am running into compilation problems - the line with dustd1, dustd2, dustsink needs to be deleted. (They are introduced now via mo_biomod - it was formerly a bit twisted written.)

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 don't understand this comment. I have no problems compiling.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @mvertens , dustd1, dustd2, dustsink are already included by use mo_biomod, only: above so that at least on my side, the compiler complains Symbol ‘dustd1’ at (1) conflicts with symbol from module ‘mo_biomod’, use-associated at (2) (compiled locally via meson). Similarly, dustd2 and dustsink are also already defined. As written, it was very twisted before (these were only included via use when AGG was switched on, while then the local variables were required inside the routine for some initialization). Deletion of the line

  REAL :: dustd1, dustd2, dustsink !AGG

should do the job.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes - you are right. Sorry for not seeing that.

Copy link
Collaborator

Choose a reason for hiding this comment

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

No worries - I am happy to be able to help :-)

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 pushed the fix back.

@mvertens mvertens requested review from gold2718, jmaerz and matsbn and removed request for gold2718 and matsbn October 16, 2023 12:38
@jmaerz
Copy link
Collaborator

jmaerz commented Oct 16, 2023

Out of curiosity: what was/is the purpose of ci.yml that has been removed - is this the setup to do the testing on github? - if so, why was it now removed?

Copy link
Contributor

Choose a reason for hiding this comment

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

This file is removed in commit 5957d2c
What was the background for this? If it is not working, is there some way to disable CI functionality instead of removing it completely?

Comment on lines +37 to +40
#ifdef HAMOCC
logical :: use_hamocc = .true.
#else
logical :: use_hamocc = .false.
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it make sense to move this to mod_ifdefs.F90, and make use of use_hamoccin both restart_trcrd.F90 and restart_wt.F? Not sure if this is a good idea, if the long term plan is to get rid of mod_ifdefs.F90.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could we defer deciding this to #281? I'd like to know from @matsbn with always compiling the hamocc code since there are no longer any #ifdefs.

@jmaerz
Copy link
Collaborator

jmaerz commented Oct 16, 2023

@mvertens , @JorgSchwinger , just to let you know, with #282, we updated the beyond-CMIP6 branch with the master - so that this PR can go next into master.

@mvertens mvertens removed the request for review from matsbn October 16, 2023 20:00
@mvertens
Copy link
Contributor Author

As an additional test - I compare master versus this PR for a SMS_D_Ld1.T62_tn14.NOINYOC.betzy_intel - but where I had the following xml variables set to TRUE:
HAMOCC_CFC: TRUE
HAMOCC_CISO: TRUE
HAMOCC_NATTRC: TRUE
HAMOCC_SEDBYPASS: TRUE
And the results were bit-for-bit in comparing the blom history files
*.hd.0001-01-01.nc
*.hbgcd.0001-01-01.nc
So this gives me more confidence that the tests that @JorgSchwinger was proposing will pass.

@mvertens
Copy link
Contributor Author

Once I reintroduce ci.yml - the test is now failing. In the past I did notice that periodically it would fail and then pass.

Comment on lines +93 to +95
if (use_HAMOCC) then
call hamocc_init(1,rstfnm_hamocc)
end if
Copy link
Contributor

@TomasTorsvik TomasTorsvik Oct 17, 2023

Choose a reason for hiding this comment

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

Suggested change
if (use_HAMOCC) then
call hamocc_init(1,rstfnm_hamocc)
end if
#ifdef HAMOCC
call hamocc_init(1,rstfnm_hamocc)
#endif

The CI intel compiler build fails on the call to hamocc_init. When meson builds without the 'ecosys' option it does not compile code in the hamocc directory, so then hamocc_init is not available.

It may be safer for now to keep the calls to hamocc funtions/subroutines in #ifdef, when called from outside hamocc.

Copy link
Contributor

Choose a reason for hiding this comment

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

I tried to update the ci.yml file to include tests with 'ecosys' enabled, but the tests are still failing. Not sure what's going on, but the meson build system doesn't seem to recognize ecosys=true.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@TomasTorsvik - thanks for looking into this. I agree that it makes sense at this point to keep the #ifdef HAMOCC on.
Are we okay with merging this PR - or do we want to resolve the meson build system problem first?

Copy link
Contributor

Choose a reason for hiding this comment

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

We can merge this now. I can add the meson build afterwards, I didn't enable it properly with ecosys==true.

@TomasTorsvik TomasTorsvik self-assigned this Oct 17, 2023
@TomasTorsvik TomasTorsvik added enhancement New feature or request iHAMOCC Issue mainly concerns the iHAMOCC code base labels Oct 17, 2023
@TomasTorsvik TomasTorsvik merged commit 264762e into NorESMhub:master Oct 17, 2023
@JorgSchwinger
Copy link
Contributor

@mvertens, @jmaerz, @TomasTorsvik I just tested this PR, and the results for the C-isotopes are NOT bfb!

I'm investigating this further, but this should be clarified before we move on

@mvertens
Copy link
Contributor Author

@JorgSchwinger - thanks for doing this test. Can you please point me to your rundir and caseroot.
I thought I had turned on isotopes last night and it was bfb - but clearly I'm not doing something right.

@TomasTorsvik
Copy link
Contributor

@mvertens , @JorgSchwinger , @jmaerz
I will open a new issue on this, with reference to PR #280. We will probably need to do a fix in a new PR anyway, so it's not convenient to keep the discussion in an already merged PR.

@mvertens mvertens deleted the feature/refactor_ifdefs2 branch May 15, 2024 10:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request iHAMOCC Issue mainly concerns the iHAMOCC code base
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

5 participants