-
Notifications
You must be signed in to change notification settings - Fork 25
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 most hamocc #ifdefs in favorite of new logicals #264
Conversation
…mediator OR send the fluxes back
…assed back from mediator
Dear @mvertens , @TomasTorsvik , @JorgSchwinger , as announced in the PM, we discussed the pull requests and the potential order of bringing in all the exciting new techniques and developments into iHAMOCC/BLOM. Since this pull request (#264) is quite invasive: @mvertens , would you be ok, if we would first i) add the boxatm routine, ii) potentially make minor changes in the sedshi.F90, routine and iii) , currently most useful, pull in #261 so that you would have to update this pull request (#264), before eventually merging it into master? We would let you know, once the We further discussed that the |
hamocc/aufw_bgc.F90
Outdated
|
||
|
||
use mo_ifdefs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and potentially in other routines: it would be nice to explicitly incorporate all used switches, coming from mo_ifdefs
(or potentially later from mo_control_bgc
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the latest changes I have pushed back there is no long the mo_ifdefs.F90
routine - all the logic has been migrated to mo_control_bgc.F90
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
@jmaerz- your plan sounds very good. However, we need to bring in #263 and #259 before we bring in #264.
|
I am preparing a PR based on current master with mo_boxatm added right now. If I encounter no further problems, this PR will be available in a few hours. |
@JorgSchwinger - thanks for the clarification. I have updated my comment. |
@JorgSchwinger - thanks so much for your work on 1. |
Merge #261 has now also been carried out - so point 2 of the above list is also done. |
Dear @mvertens, @TomasTorsvik , and @jmaerz This PR comes with a lot of fixes for missing variables in only lists. I'm currently trying to get current master up to date for running C-isotopes with sediment switched on (we want this for the upcoming release), so I need to put in many of these fixes that are here already. This is fine for me, but it will certainly lead to a bunch of merge conflicts when we want to merge this branch in. Any thoughts or advise on this? |
Hi @JorgSchwinger , @mvertens and @TomasTorsvik , if I got you right during talking to you over lunch, @JorgSchwinger , you would want to merge your changes for the carbon isotopes into Further, since #259 is also pending, the above scenario probably also holds for #259, which, if I understand it correctly, shall be pulled in before this pull request (#264). Since it is thus far a recurrent discussion issue: both #259 and #264 should not affect compatibility with MCT - somehow, we have to ensure this for the current version and at least until the INES interim release. |
@JorgSchwinger - please go ahead and bring your changes in. I am fine handling the merge conflicts when we decide to bring this in. In addition, I need to create baselines for the current code so that upcoming PRs can test against it. I should have done this as part of the previous PR - but got pulled into working for integrating the oslo aerosols code into the latest version of Noresm/CAM. I'm trying to generate those baselines now - but am running into some strange failures for some of the tests. I'll provide an update once I know more. |
@mvertens - would it be possible to merge this PR into BLOM master without doing #259 first? I was discussing with Jörg and Jöran today, and we see that removing CPP flags could be useful to have in the upcoming release, but we were wondering if this could somehow be done independently of the DMS and BROMO development. |
@TomasTorsvik - great idea. I think that's the right thing to do. Do you want this PR to go next? If so - let me work on this over the next day or two and make this PR no longer draft. I've created baselines for the previous tag - so it should be easy for me to validate that this will not change answers. |
This is a draft PR that is a prototype implementation to move away from #ifdefs in BLOM and particularly in HAMOCC to the greatest extent possible. Most modeling efforts have adopted the approach to have the least number of #ifdefs possible.
This is a result of the fact that the code itself is not really tested until all possible #ifdef combinations are invoked. The more #ifdefs there are - the greater is the challenge to do this. By minimizing #ifdefs - the compilation can at least detect if there are inconsistencies in various branches that would always be compiled regardless of if they are actually invoked run time.
The approach I am suggesting is to introduce a new module in hamocc -
mo_ifdefs.F90
that contains logicals that are parameters and that are triggerred by the presence of the #ifdefs.In the code itself - the majority of the #ifdefs are then replaced with logicals like (e.g. in aufw_bgc.F90):
Note that the work around to deal with ibromo values of -1 (when #BROMO is not defined) is to define loctre as
But to initialize locetra as
Multiple compilation errors were found when this was implemented. Below is a brief summary
The following were not defined when the ifdefs were removed - which means they would not have worked if the ifdefs were turned on
NOTE: I realize that this is an invasive PR and as such maybe its not the time to do it. But I wanted to get the idea out there regarding the downside of an #ifdef based approach.
NOTE: The hamocc arrays are still not being dynamically allocated - but are based on parameter values as before in this implementation.