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

GitHub Issue NOAA-EMC/GSI#219. Improve minimization and fix bug in vqc #242

Merged
merged 1 commit into from
Nov 15, 2021

Conversation

jderber-NOAA
Copy link
Contributor

This change fixes bug in the vqc for winds. Also, in modifies the minimization algorithm so that it can detect nonlinearities. The minimization algorithm should produce the same results within round-off. Two new options are included. 1. To allow supersaturation (superfact). 2. To limit qobs to a value equal to superfact*qsat. The second option was included because there was a case found where there were many hurricane recon obs that produced q values greater than the supersaturated value with the analysis. This resulted in slow convergence. Both of these factors are set to values that will not impact the results (superfact=1.0, limitqobs = .false.

The resulting changes make resets very unlikely when the vqc option is used. Also, the nonlinearity diagnostic is very useful when determining minimization issues. Note it has indicated that the old variational quality control should not be used in any GSI runs.

A few small optimization and clean-ups were also included.

@RussTreadon-NOAA RussTreadon-NOAA self-requested a review October 22, 2021 15:33
Copy link
Contributor

@RussTreadon-NOAA RussTreadon-NOAA left a comment

Choose a reason for hiding this comment

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

Minor comments on first sweep. Will clone jderber-NOAA:master to look more closely at the changes.

@jderber-NOAA
Copy link
Contributor Author

jderber-NOAA commented Oct 22, 2021 via email

Copy link
Contributor

@XiujuanSu-NOAA XiujuanSu-NOAA left a comment

Choose a reason for hiding this comment

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

The changes in setupw.f90 and stpw.f90 are ok with me.

@RussTreadon-NOAA
Copy link
Contributor

RussTreadon-NOAA commented Oct 26, 2021 via email

@jderber-NOAA
Copy link
Contributor Author

jderber-NOAA commented Oct 26, 2021 via email

@jderber-NOAA
Copy link
Contributor Author

jderber-NOAA commented Oct 26, 2021 via email

@RussTreadon-NOAA
Copy link
Contributor

RussTreadon-NOAA commented Oct 26, 2021 via email

@jderber-NOAA
Copy link
Contributor Author

jderber-NOAA commented Oct 26, 2021 via email

@MichaelLueken
Copy link
Contributor

@jderber-NOAA @RussTreadon-NOAA We can add different clean up options. With respect to debugging, all files are saved if the regression tests fail before a job completes. This doesn't help if you are expecting identical results and a test comes back with non-reproducible results. We can set the flag on which clean to use in regression_test and regression_test_enkf. If the reproducibility test fails, then keep stdout and the fort* files. Otherwise, clean up the regression test directory.

@jderber-NOAA
Copy link
Contributor Author

jderber-NOAA commented Oct 27, 2021 via email

@MichaelLueken
Copy link
Contributor

@jderber-NOAA @RussTreadon-NOAA

By "with respect to debugging, all files are saved if the regression tests fail before a job completes," I meant that when the regression test returns a non-zero return code, then the directory will not be removed. So, as you say, "before the code completes," is the key part of the sentence. Currently, the regression tests aren't particularly useful for tracking reproducibility issues.

The clean function was only added due to no scrubbing on Hera and Jet. Moving forward, we can rename clean to be cleanmost, and maintain this for only Hera and Jet.

We can go into regression/regression_test.sh and force the removal of all input files and internal processor based files after the test is complete - without using clean, just remove these as default behavior. Where clean currently is, we would replace with cleanmost, and remove all files except for the stdout and fort.* files.

Copy link
Collaborator

@CatherineThomas-NOAA CatherineThomas-NOAA left a comment

Choose a reason for hiding this comment

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

The changes look good to me.

Any thoughts on whether the NL diagnostic could/should be added to the regression tests? We already flag large increases in run time, memory, etc.

Copy link
Contributor

@RussTreadon-NOAA RussTreadon-NOAA left a comment

Choose a reason for hiding this comment

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

Changes look good. Need to work with Mike to reduce commits from 5 to 1.

@MichaelLueken MichaelLueken linked an issue Nov 4, 2021 that may be closed by this pull request
Copy link
Contributor

@MichaelLueken MichaelLueken left a comment

Choose a reason for hiding this comment

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

I have completed my review. You will need to reduce the number of commits from five to one. I will include the steps to do this.

  • In src/gsi/genqsat.f90, keeping line 165 commented is fine for now.
  • In src/gsi/observer.F90, rather than commenting out lines 176-181, please remove these.
  • In src/gsi/pcgsoi.f90, please add proper precision to real value on line 356 (0.5).

To correct the commit messages and remove the change in regression/regression_var.sh:

  • git clone --recursive git@github.com:jderber-NOAA/GSI.git update
  • cd update
  • git reset --hard HEAD~1
  • git reset --hard HEAD~1
  • git reset --hard HEAD~1
  • git reset --hard HEAD~1
  • git reset --hard HEAD~1
  • git remote add upstream git@github.com:NOAA-EMC/GSI.git
  • git fetch upstream
  • git merge upstream/master
  • git checkout minimfixes
  • git checkout master
  • git merge --squash minimfixes
  • git reset HEAD regression/regression_var.sh
  • git checkout -- regression/regression_var.sh
  • Please apply changes to src/gsi/observer.F90 and src/gsi/pcgsoi.f90
  • git add src/gsi/observer.F90 src/gsi/pcgsoi.f90
  • git commit -m "GitHub Issue NOAA-EMC/GSI#219. Improve minimization and fix bug in vqc."
  • git push origin master --force

The regression tests were run and the results are the same as those that you noted in issue #219. The code was compiled in debug mode and no new warning messages were seen. The debug tests ran through to completion.

if(mype == 0)then
aindex=abs(dprod(3)/dprod(2))
write(iout_iter,*) 'NL Index ',aindex
if(aindex > 0.5 .or. print_verbose) write(iout_iter,*) 'NL Values ', dprod(3),dprod(2)
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add proper precision to real value, 0.5 (i.e., 0.5_r_kind).

Copy link
Contributor

@MichaelLueken MichaelLueken left a comment

Choose a reason for hiding this comment

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

After recompiling in debug mode, there were some unused variables. Please remove the noted unused variables while updating your master.

@@ -385,7 +383,6 @@ subroutine set_predictors_var

Copy link
Contributor

Choose a reason for hiding this comment

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

While compiling in debug mode, ostats (line 378) and ostats_t (line 379) were identified as unused. Please remove unused variables.

@@ -171,8 +171,6 @@ module crtm_interface
real(r_kind) , save ,allocatable,dimension(:,:) :: cloud_efr ! effective radius of cloud type in CRTM
real(r_kind) , save ,allocatable,dimension(:) :: cf ! effective radius of cloud type in CRTM
real(r_kind) , save ,allocatable,dimension(:) :: hwp_guess ! column total for each hydrometeor

real(r_kind) , save ,allocatable,dimension(:,:,:,:) :: gesqsat ! qsat to calc rh for aero particle size estimate
real(r_kind) , save ,allocatable,dimension(:) :: table,table2,tablew ! GFDL saturation water vapor pressure tables
real(r_kind) , save ,allocatable,dimension(:) :: des2,desw ! GFDL saturation water vapor presure
real(r_kind) , save ,allocatable,dimension(:) :: lcloud4crtm_wk ! cloud info usage index for each channel
Copy link
Contributor

Choose a reason for hiding this comment

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

While compiling in debug mode - ges_tsen, ges_prsl, nfldsig (line 327), iderivative (line 348), and ice (line 350) - were identified as unused. Please remove unused variables.

@@ -89,7 +89,7 @@ subroutine compute_derived(mype,init_pass)
use kinds, only: r_kind,i_kind
use jfunc, only: jiter,jiterstart,&
qoption,switch_on_derivatives,&
tendsflag,clip_supersaturation
tendsflag,superfact,clip_supersaturation
Copy link
Contributor

Choose a reason for hiding this comment

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

While compiling in debug mode, superfact was identified as being unused. Please remove unused variable.

real(r_kind) residual,ressw,ress,val,vals,val2,valqc2,dudiff,dvdiff
real(r_kind) valqc,valu,valv,dx10,rlow,rhgh,drpx,prsfc,var_jb
real(r_kind) cg_t,cvar,wgt,term,rat_err2,qcgross
real(r_kind) residual,ressw,ress,vals,val2,valqc2,dudiff,dvdiff,rat_err2u
Copy link
Contributor

Choose a reason for hiding this comment

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

While compiling in debug mode, valqc2 was identified as unused. Please remove unused variable.

real(r_kind) cg_t,cvar,wgt,term,rat_err2,qcgross
real(r_kind) residual,ressw,ress,vals,val2,valqc2,dudiff,dvdiff,rat_err2u
real(r_kind) valqc,valu,valv,dx10,rlow,rhgh,drpx,prsfc,var_jb,rat_err2v
real(r_kind) cg_t,cvar,wgt,term,rat_err2,qcgross,valqcu,valqcv
Copy link
Contributor

Choose a reason for hiding this comment

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

While compiling in debug mode, rat_err2 was identified as unused. Please remove unused variable.

@jderber-NOAA
Copy link
Contributor Author

jderber-NOAA commented Nov 4, 2021 via email

@MichaelLueken MichaelLueken changed the title GitHub Issue NOAA-EMC/GSI#219 Improve minimization and fix bug in vqc GitHub Issue NOAA-EMC/GSI#219. Improve minimization and fix bug in vqc Nov 15, 2021
@MichaelLueken
Copy link
Contributor

The due date for the review committee has past, with no feedback. I will now give final approval to these changes, then merge them to the authoritative master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve minimization and fix bug in vqc
5 participants