-
Notifications
You must be signed in to change notification settings - Fork 145
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
THM is mandatory WRF temp variable #733
Conversation
Besides documentation, perhaps I could have also forced the code to throw an error if temperature variable |
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.
Besides documentation, perhaps I could have also forced the code to throw an error if temperature variable T is used as the TYPE_T in wrf_state_variables?
Yup, it THM is required the model_mod should check
THM is in the state and type_t
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.
see #733 (review)
Yup, I am on it |
Now errors out if using T WRF variable with type_t. Should both prevent boundscheck error, and also an end-user unexpectedly using a diagnostic temperature variable instead of prognostic temperature variable (THM), which will deprecate forecast skill. |
Hi Brett, can you share a wrf restart file to test this code with? |
models/wrf/model_mod.f90
Outdated
! prevent boundscheck errors. For WRFv4 and later version variable 'T' is | ||
! diagnostic, thus updating the 'THM' variable (prognostic) is preferred. | ||
|
||
if ( wrf%dom(id)%type_t >= 0 .and. get_type_ind_from_type_string(id,'T') >=0) then |
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.
so at the comment, this check isn't checking that THM is in state and type_t
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.
so at the comment, this check isn't checking that THM is in state and type_t
I went back and forth on this -- yes, the code will error out if user includes 'T' as temperature variable. It does not error out if 'THM' is in the DART state, but does give that information in the error message.
I could expand the error by saying:
if ( wrf%dom(id)%type_t >= 0 .and. (get_type_ind_from_type_string(id,'T') >=0 .or. get_type_ind_from_type_string(id,'THM') <=0)) then
Is that preferable?
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.
Suggested edit will now error out if THM is not in DART state but type_t WRF variable is declared.
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.
line 702:
if ( wrf%dom(id)%type_t >= 0 .and. get_type_ind_from_type_string(id,'T') >=0)
then
wrf%dom(id)%type_t
isn't defined at this stage (unless I'm missing something) so this check wrf%dom(id)%type_t >= 0
is using an uninitialized value for type_t
line 713 is where wrf%dom(id)%type_t is set.
wrf%dom(id)%type_t = get_type_ind_from_type_string(id,'THM')
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.
so to back up a bit, what has to be true to run wrf-dart?
THM has to be in the state and type_t has to be THM?
What's not allowed?
T can not be in the state vector?
T can be in the state vector but can not be type_t?
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.
so to back up a bit, what has to be true to run wrf-dart?
THM has to be in the state and type_t has to be THM?
What's not allowed? T can not be in the state vector? T can be in the state vector but can not be type_t?
The only thing that is not allowed is having the WRF variable 'T' in the DART state because it can throw the 'boundscheck' error which gives a non-intuitive error as described in #728 . There are other secondary reasons to not include 'T' in WRF -- because its diagnostic in WRFv4+, not prognostic, so updating it will not improve the forecast. Users who are used to older WRF versions may not be aware of this.
I also believe that including a 'type_t' WRF variable in the DART state is mandatory because of the way the WRF model_mod.f90 works. Even if you don't intend the 'type_t' variable to be updated by DART, the code still does boundchecks on the type_t variable for many (all?) WRF-DART simulations.
Given the 'type_t' requirement, and secondly, that using variable 'T' is not permitted, this makes including 'THM' mandatory because it is the only replacement variable that I know of for 'T' (3D temperature).
Yes -- this wrf file has both T and THM to test out functionality: /glade/work/bmraczka/DART/models/wrf/Akeem_bug/wrfinput_d01.original |
934d82e Removes check of 'type_t' for error call. Only need to check for WRF variable 'T' |
The code is not enforcing "mandatory THM".
|
Yep -- trying again with 2d99f18 |
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.
Hi Brett, I checkout out the changes and confirmed they error out if no THM is present in model_nml, and error out if T is present in model_nml. So the code looks good.
You have a couple of places in the doc, where you say "Also, including T
can give boundscheck errors as described in `issue #728." Since this pull request will error out in static_init_model, if T is in the state, then you won't get to the boundscheck errors. I'd suggest removing these, because if someone gets a boundcheck error with this version of the code, it won't be because they have T in the state. If you think it is helpful to keep these notes in, let me know and we can release as is.
Cheers,
Helen
Yes -- let me update the docs to remove the boundscheck comments. This new check avoids the boundscheck issue, so we don't want to lead the user in the wrong direction if they actually get a boundscheck error for other reasons. |
Co-authored-by: Helen Kershaw <20047007+hkershaw-brown@users.noreply.github.com>
This is good on my end. |
Description:
Adding documentation in WRF and WRF-DART tutorial to make THM mandatory.
Fixes issue
#728
Types of changes
Documentation changes needed?
Checklist for merging
Checklist for release