-
Notifications
You must be signed in to change notification settings - Fork 8
379 continue integrating the ground water hydrology work into cable #411
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
379 continue integrating the ground water hydrology work into cable #411
Conversation
ccarouge
left a comment
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.
There are a lot of things in there. I let you digest but for a few things to start with:
- revert the changes on soilparmnew. This isn't going to be introduced in this work. Happy to have it proposed as a standalone change.
- I would like to move the addition of
force_npatches_asalso as a standalone issue and PR. And it will need associated documentation changes.
Also, since with this PR we will be able to evaluate the impact of the changes on the simulation without GW and with GW, I will want to remove all commented alternate versions before we merge. This can be done at the end, just putting in on the list of tasks.
| nn = INDEX(inFile,'19') | ||
| READ(inFile(nn:nn+3),'(i4)') idummy | ||
| WRITE(inFile(nn:nn+3),'(i4.4)') ncciy | ||
| nn = INDEX(inFile,'19') | ||
| READ(inFile(nn:nn+3),'(i4)') idummy | ||
| WRITE(inFile(nn:nn+3),'(i4.4)') ncciy |
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.
why is it doing twice the same thing?
Is there any explanation anywhere of what this does?
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.
I traced this back to the code from MMY (phase 1). The only explanation is what you see "MMY for Princeton input". It could be intentional or a simple duplication error. We can ping MMY about it of you like
| !line below inserted to fix compilation error - rk4417 - phase2 | ||
| INTEGER :: force_npatches_as=-1 |
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.
This new namelist option needs an entry in the documentation to explain what it is.
It does not seem to be related to the GW so I would rather introduce it separately than within the GW changes.
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.
All I can say here is that I needed this line to get the code to compile at the time. Perhaps the present code will compile without it, I don't know. I suggest we leave this bit till the end to see whether it is still needed to get the code to compile.
ccarouge
left a comment
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.
There are a lot of things in there. I let you digest but for a few things to start with:
- revert the changes on soilparmnew. This isn't going to be introduced in this work. Happy to have it proposed as a standalone change.
- I would like to move the addition of
force_npatches_asalso as a standalone issue and PR. And it will need associated documentation changes.
Also, since with this PR we will be able to evaluate the impact of the changes on the simulation without GW and with GW, I will want to remove all commented alternate versions before we merge. This can be done at the end, just putting in on the list of tasks.
Reverted soilparmnew occurrence
revert occurrences of soilparmnew
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
Co-authored-by: Claire Carouge <ccarouge@users.noreply.github.com>
ccarouge
left a comment
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.
@rkutteh A new wave of comments but they are for me to do stuff, nothing new for you yet.
| ! Zero out lai where there is no vegetation acc. to veg. index | ||
| WHERE ( iveg%iveg(:) .GE. 14 ) iveg%vlai = 0. | ||
|
|
||
| ! WHERE ( iveg%iveg(:) .GE. 14 ) iveg%vlai = 0. | ||
| ! line above replaced by below - rk4417 - phase2 | ||
| WHERE ( veg%iveg(:) .GE. 14 ) veg%vlai = 0. ! MMY change from iveg%vlai to veg%vlai | ||
|
|
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.
This change looks correct but I'll need to double check (a note to myself...)
| ! WHERE ( iveg%iveg(:) .GE. 14 ) iveg%vlai = 0. | ||
| ! line above replaced by below - rk4417 - phase2 | ||
| WHERE ( veg%iveg(:) .GE. 14 ) veg%vlai = 0. ! MMY change from iveg%vlai to veg%vlai | ||
| ! Write time step's output to file if either: we're not spinning up |
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.
Same as above. Need to review the use of veg and iveg in the MPI implementation. (a note to myself)
| ! MMY start reading from gridinfo file ! 2 lines inserted by rk4417 - phase2 | ||
| ok = NF90_OPEN(filename%type, 0, ncid) | ||
| IF (ok /= NF90_NOERR) CALL nc_abort(ok, 'Error MMY finding gridinfo file.') ! MMY | ||
|
|
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.
Remove MMY from error message
| ! MMY start reading from gridinfo file ! 2 lines inserted by rk4417 - phase2 | |
| ok = NF90_OPEN(filename%type, 0, ncid) | |
| IF (ok /= NF90_NOERR) CALL nc_abort(ok, 'Error MMY finding gridinfo file.') ! MMY | |
| ! MMY start reading from gridinfo file ! 2 lines inserted by rk4417 - phase2 | |
| ok = NF90_OPEN(filename%type, 0, ncid) | |
| IF (ok /= NF90_NOERR) CALL nc_abort(ok, 'Error finding gridinfo file.') ! MMY | |
|
|
||
| IF( cable_runtime%um ) THEN | ||
|
|
||
| IF( cable_runtime%um_implicit ) THEN | ||
| IF (cable_user%gw_model) THEN | ||
| CALL soil_snow_gw(dels, soil, ssnow, canopy, met, bal,veg) | ||
| ELSE | ||
| CALL soil_snow(dels, soil, ssnow, canopy, met, bal,veg) | ||
| ENDIF | ||
| ENDIF | ||
|
|
||
| ELSE | ||
| IF(cable_user%SOIL_STRUC=='default') THEN | ||
| IF (cable_user%gw_model) THEN | ||
| CALL soil_snow_gw(dels, soil, ssnow, canopy, met, bal,veg) | ||
| ELSE | ||
| CALL soil_snow(dels, soil, ssnow, canopy, met, bal,veg) | ||
| ENDIF | ||
| ELSEIF (cable_user%SOIL_STRUC=='sli') THEN | ||
|
|
||
| IF (cable_user%test_new_gw) & | ||
| CALL sli_hydrology(dels,ssnow,soil,veg,canopy) | ||
|
|
||
| CALL sli_main(ktau,dels,veg,soil,ssnow,met,canopy,air,rad,0) | ||
| ENDIF | ||
| ENDIF | ||
|
|
||
| ! I have inserted the above block from MMY code which was deleted from the trunk | ||
| ! soil_snow_gw and sli_hydrology are crucial in the GW module - rk4417 - phase2 | ||
|
|
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.
This part of CABLE has change. This code is now only for offline with a different version of coupled, so the above block can be simplified as below:
| IF( cable_runtime%um ) THEN | |
| IF( cable_runtime%um_implicit ) THEN | |
| IF (cable_user%gw_model) THEN | |
| CALL soil_snow_gw(dels, soil, ssnow, canopy, met, bal,veg) | |
| ELSE | |
| CALL soil_snow(dels, soil, ssnow, canopy, met, bal,veg) | |
| ENDIF | |
| ENDIF | |
| ELSE | |
| IF(cable_user%SOIL_STRUC=='default') THEN | |
| IF (cable_user%gw_model) THEN | |
| CALL soil_snow_gw(dels, soil, ssnow, canopy, met, bal,veg) | |
| ELSE | |
| CALL soil_snow(dels, soil, ssnow, canopy, met, bal,veg) | |
| ENDIF | |
| ELSEIF (cable_user%SOIL_STRUC=='sli') THEN | |
| IF (cable_user%test_new_gw) & | |
| CALL sli_hydrology(dels,ssnow,soil,veg,canopy) | |
| CALL sli_main(ktau,dels,veg,soil,ssnow,met,canopy,air,rad,0) | |
| ENDIF | |
| ENDIF | |
| ! I have inserted the above block from MMY code which was deleted from the trunk | |
| ! soil_snow_gw and sli_hydrology are crucial in the GW module - rk4417 - phase2 | |
| IF(cable_user%SOIL_STRUC=='default') THEN | |
| IF (cable_user%gw_model) THEN | |
| CALL soil_snow_gw(dels, soil, ssnow, canopy, met, bal,veg) | |
| ELSE | |
| CALL soil_snow(dels, soil, ssnow, canopy, met, bal,veg) | |
| ENDIF | |
| ELSEIF (cable_user%SOIL_STRUC=='sli') THEN | |
| IF (cable_user%test_new_gw) & | |
| CALL sli_hydrology(dels,ssnow,soil,veg,canopy) | |
| CALL sli_main(ktau,dels,veg,soil,ssnow,met,canopy,air,rad,0) | |
| ENDIF | |
| ! I have inserted the above block from MMY code which was deleted from the trunk | |
| ! soil_snow_gw and sli_hydrology are crucial in the GW module - rk4417 - phase2 | |
|
|
||
| IF (cable_user%gw_model) THEN ! IF block inserted by rk4417 - phase2 | ||
| ! IF (call_number .eq. 1) call set_den_rat() | ||
| ssnow%wbliq(:,:) = ssnow%wb(:,:) - den_rat*ssnow%wbice(:,:) | ||
| ELSE | ||
| ssnow%wbliq(:,:) = ssnow%wb(:,:) - ssnow%wbice(:,:) | ||
| ENDIF | ||
|
|
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.
@har917 GW work introduces the calculation of wbliq at the start of cable_canopy.F90. Do you see anything here that would break the ACCESS coupling?
I also think we want the version with the ratio of liq/ice densities in all cases and not just for gw_model if we go with it. Can you confirm, please?
| ssnow%wetfac = 0.5*(ssnow%wetfac + ssnow%owetfac) | ||
|
|
||
|
|
||
| CALL calc_srf_wet_fraction(ssnow,soil,met,veg) |
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.
This part of the code has been moved in the main branch. Will need to resolve conflicts before going further.
| rwater = MAX(1.0e-9, & | ||
| SUM(veg%froot * MAX(1.0e-9,MIN(1.0, REAL((ssnow%wbliq - & | ||
| soil%swilt_vec)/(soil%sfc_vec-soil%swilt_vec)) )),2) ) | ||
| SUM(veg%froot * MAX(1.0e-9, MIN( 1.0, & | ||
| MAX(0., (real(ssnow%wbliq) - real(soil%swilt_vec)) )& | ||
| / (real(soil%sfc_vec) - real(soil%swilt_vec)) & | ||
| )) , 2)) |
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.
It's just uppercase.
| rwater = MAX(1.0e-9, & | ||
| SUM(veg%froot * MAX(1.0e-9,MIN(1.0, REAL(ssnow%wb) - & | ||
| SPREAD(soil%swilt, 2, ms))),2) /(soil%sfc-soil%swilt)) | ||
|
|
||
| ELSE | ||
| SUM(veg%froot * MAX(1.0e-9, MIN( 1.0, & | ||
| MAX(0., (real(ssnow%wb) - SPREAD(soil%swilt, 2, ms)) )& | ||
| / (SPREAD(soil%sfc, 2, ms) - SPREAD(soil%swilt, 2, ms)) & | ||
| )) , 2)) |
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.
Re-reading it, it's the same equation as before but with an added MAX(0,x) on something that should always be positive and added SPREAD(). So we can add it, no need to test the effect.
| / soil%zshh (k+1) + z2(:,k) * 0.5 * soil%zse( MAX( k-1, & | ||
| 1 ) ) / soil%zshh (k) + z3(:,k+1) + z3(:,k) ) | ||
|
|
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.
This seems it will impact all simulations, will need to test the impact on non-GW simulations then.
src/offline/cable_checks.F90
Outdated
|
|
||
| TYPE(ranges_type), SAVE :: ranges | ||
|
|
||
| IF (cable_user%GW_MODEL) ranges%sucs = [30., 800.] ! MMY the range [-0.8, -0.03] doesn't suit Mark Decker's version |
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.
Can't be done in the module definition part. This will require some more in-depth changes that will be done later.
eb6a56c to
d3e39e1
Compare
12b9505 to
a7a1c9a
Compare
|
A comparison of this branch with the previous version (at the end of stage 2 + fixes) show little statistical differences in results without GW, this suggests there is no obvious problem in the implementation in this branch for non-GW simulations. |
|
modelevaluation.org analysis shows results stay very close to the original with the ground water on, so all tests passed. We can use this branch as the base for further work. Next steps is to introduce changes that impact non-GW simulations separately (some of the issues might not need to be done before the GW work is adopted), then "rebase" (probably manually, too different for an automatic rebase). Then we should be good to get the rebased branch into the main. |
|
This branch has become too out-of-date with the main branch. An updated branch and PR #580 have been created to bring this work up-to-date with the main branch. I am closing this pull request and will use the new one to continue the work. I will keep this original branch around for longer just in case, we need to check if anything is missing from the updated branch. |
This pull request contains ALL remaining ground water hydrology work of Mengyuan Mu.
PLEASE do not delete any of my in-code comments (tagged rk4417) for now. Once the ground water hydrology functionality is confirmed to reproduce the results obtained already outside of the repo, I will clean-up all of my comments in a single pull request. Deleting any of my comments now will just make it much more difficult for me to track down and fix any issues that might arise during this process.
📚 Documentation preview 📚: https://cable--411.org.readthedocs.build/en/411/