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

Feature/clean up esoil #777

Merged
merged 17 commits into from
Apr 25, 2018
Merged

Conversation

tbohn
Copy link
Contributor

@tbohn tbohn commented Feb 3, 2018

Description:

  • Problem: the logic in computing soil evaporation (esoil) is not very clean nor does it make clear which portion of ET comes from esoil, until the partitioning is cleared up in put_data().
  • Solution: (a) introduce explicit esoil, transp, and evap terms into the layer struct; (b) remove the bare_evap_frac term; (c) modify logic in func_surf_energy_bal() and other functions to use these terms; and (d) make the logic cleaner

@tbohn tbohn force-pushed the feature/clean_up_esoil branch from 845cca0 to d071912 Compare February 3, 2018 16:52
@jhamman
Copy link
Member

jhamman commented Feb 13, 2018

This looks good to me. Let's sort out #779 before we merge this though.

@jhamman jhamman requested a review from dgergel February 13, 2018 08:52
evaporation is taken from the wetter layer. Otherwise layers
contribute to evapotransipration based on root fraction.
transpiration is taken from the wetter layer. Otherwise layers
contribute to transipration based on root fraction.
Copy link
Contributor

Choose a reason for hiding this comment

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

transipration --> transpiration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will fix.

@@ -494,32 +495,32 @@ transpiration(layer_data_struct *layer,
}

/****************************************************************
Check that evapotransipration does not cause soil moisture to
Check that transipration does not cause soil moisture to
Copy link
Contributor

Choose a reason for hiding this comment

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

transipration --> transpiration

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, will fix.

transp[i] = layer[i].evap;
layer[i].evap = 0.;
}
for (i=0; i<options.Nlayer; i++) {
Copy link
Contributor

Choose a reason for hiding this comment

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

did you already run uncrustify? this line has some formatting issues

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'll fix it by hand. Unfortunately, when I run uncrustify on my system, using the provided config file, it makes a ton of unwanted changes in files that I've never touched. Not sure why.

Evap = 0.;
if (!SNOWING) {
if (VEG && veg_var->fcanopy > 0) {
Evap = canopy_evap(layer, veg_var, true, veg_class, Wdew,
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not taking issue with this, but I don't understand the motivation behind separating out the (!SNOWING) from the VEG and veg_var->fcanopy into separate lines?

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 minimized redundant code. If you start with a condition that links the 3 conditions VEG, !SNOWING, and fcanopy > 0, you'll necessarily need further compound conditions later on to handle all possible cases. The most important case is simply !SNOWING. If it is snowing, Evap is 0. So, I separated that from the other conditions. Then, the nested check on VEG and fcanopy > 0 determines whether we call canopy_evap() and how SurfRad is set. Note: I'm now removing lines 782-784, since they were redundant with my initialization of Evap to 0 on line 751.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it - thanks for clarifying

veg_var->throughfall;
veg_var->canopyevap *= veg_var->fcanopy;
veg_var->Wdew *= veg_var->fcanopy;
SurfRad = surf_atten*NetBareRad;
Copy link
Contributor

Choose a reason for hiding this comment

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

more formatting issues

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix by hand (see previous formatting comment).

@dgergel
Copy link
Contributor

dgergel commented Feb 20, 2018

This looks good to me, just a few small comments and a question. Also it looks like uncrustify needs to be run before this is merged, there are some formatting issues

@tbohn tbohn force-pushed the feature/clean_up_esoil branch from d864718 to edf426f Compare February 20, 2018 05:31
@tbohn
Copy link
Contributor Author

tbohn commented Feb 20, 2018

Just to reiterate, I can't run uncrustify because for some reason it doesn't behave the same on my machine as it does on yours at UW. It changes lots of files that I haven't touched, and formats them in a way that I'm pretty sure you won't like. I don't know why; I'm using the accompanying config file. But until I get that fixed, my workaround is to do the formatting by hand.

@dgergel
Copy link
Contributor

dgergel commented Feb 20, 2018

I run uncrustify on my laptop locally - what version are you using @tbohn? My experience is that whenever I run uncrustify it often reformats things that are not visible to the (my) naked eye - so I think it is worth figuring out why it isn't working for you rather than manually fixing things. That's my two cents at least

@tbohn
Copy link
Contributor Author

tbohn commented Feb 20, 2018

Understood.

@tbohn
Copy link
Contributor Author

tbohn commented Feb 22, 2018

OK, fixed the uncrustify issue on my machine, and have run uncrustify on the code.

outflow,
storage,
save_data->
total_moist_storage);
Copy link
Contributor

Choose a reason for hiding this comment

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

this reformatting looks off to me

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, the original exceeded the 80-character limit, as far as I can tell, so it looks to me like the reformatting did the right thing in that respect... How exactly should it look?

I could change it by hand but then uncrustify might attempt to change it again in future PRs...

@dgergel
Copy link
Contributor

dgergel commented Feb 23, 2018

@tbohn looks good to me, I just had one small comment where the formatting looks funky

…en reformatted by uncrustify in a weird way.
@tbohn
Copy link
Contributor Author

tbohn commented Feb 23, 2018

I went ahead and changed the formatting by hand anyway.

@dgergel
Copy link
Contributor

dgergel commented Feb 26, 2018

I think this all looks good. @jhamman?

@jhamman jhamman merged commit 0aed9a1 into UW-Hydro:develop Apr 25, 2018
@tbohn tbohn deleted the feature/clean_up_esoil branch September 28, 2018 22:03
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.

3 participants