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

Adding a wind gustiness parameterization #1105

Closed
rljacob opened this issue Feb 4, 2017 · 17 comments · Fixed by #1065 or #1123
Closed

Adding a wind gustiness parameterization #1105

rljacob opened this issue Feb 4, 2017 · 17 comments · Fixed by #1065 or #1123

Comments

@rljacob
Copy link
Member

rljacob commented Feb 4, 2017

The merge of PR #1065 proposed to introduce a gustiness parameterization. This issue discusses how its currently done and how best to do it.

In module seq_flux_mct:
In seq_flux_init_mct: allocate prec_gust and set it to 0.

In seq_flux_atmocnexch_mct: define gust_fac, set it to HUGE(1.0) and then overwrite with seq_infodata_GetData. pass prec_gust and gust_fac to shr_flux_atmocn;

In seq_flux_atmocn_mct: set prec_gust to a2x%rAttr(index_a2x_Faxa_rainc,n); define gust_fac, set it to HUGE(1.0) and then overwrite with seq_infodata_GetData (from drv_in). pass prec_gust and gust_fac to shr_flux_atmocn

In module seq_infodata_mod
Add gust_fac to seq_infodata_type

In seq_infodata_Init, declare gust_fac and add to /seq_infodata_inparm/ namelist block. Set initial value to huge(1.0_SHR_KIND_R8), read value from seq_infodata_inparm namelist; copy value to infodata%gust_fac,

In seq_infodata_GetData_explicit: If present, gust_fac = infodata%gust_fac
In seq_infodata_PutData_explicit: if present, infodata%gust_fac = gust_fac
In seq_infodata_bcast: broadcast infodata%gust_fac
In seq_infodata_print: print out gust_fac value.

In module shr_flux_mod
In shr_flux_atmOcn: Add gust_fac and prec_gust to arguments.
Define new function:
ugust(gprec) = gust_faclog(1._R8+57801.6_R8gprec-3.55332096e7_R8*(gprec**2.0_R8))
Alter vmag calculation to include gustiness:
vmag = max(umin, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) + ugust(min(prec_gust(n),6.94444e-4_R8)))

@mvertens
Copy link
Contributor

mvertens commented Feb 4, 2017 via email

@mvertens
Copy link
Contributor

mvertens commented Feb 4, 2017

I feel that since this is a new parameterization that ACME has introduced into share science code that also happens to be a key to CESM coupling, there should be an if-block that ensures that CESM does not use it. The way to do this is to pass cime_model to shr_flux_mct.F90 and have the following type of if-block

if (trim(cime_model) == 'acme') then
        vmag   = max(umin, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2) + ugust(min(prec_gust(n),6.94444e-4_R8)))
else
        !--- vmag+ugust (convective gustiness) Limit to a max precip 6 cm/day = 0.00069444 mm/s.
        !--- reverts to original formula if gust_fac=0 
        vmag   = max(umin, sqrt( (ubot(n)-us(n))**2 + (vbot(n)-vs(n))**2)
end if

@gold2718
Copy link

gold2718 commented Feb 4, 2017

Since this is a new issue, I will reiterate my concern with the proposed solution and my suggestion:

Every other science option is bracketed by logic, I do not see why this one is different. If folks do not like having model names (e.g., cesm & acme), then come up with a namelist parameter which indicates the scientific reason for the change and use that.

For instance, following usage in physics packages, introduce an XML variable, DO_GUSTINESS and an associated namelist parameter, do_gustiness, which will be always off in CESM (set by default in config_component_cesm.xml) and could always be on for ACME (config_component_acme.xml).

This makes the science choices explicit, just like other parameterization choices in the models.

@rljacob
Copy link
Member Author

rljacob commented Feb 4, 2017

There already is logic to turn this off; if gust_fac is 0, its off. gust_fac=0 will make the ugust function evaluate to 0. So it functions as both a DO_GUSTNISS logical and a value in the parameterization.

@gold2718
Copy link

gold2718 commented Feb 4, 2017

@rljacob, why are you insisting on changing how parameterizations have always been introduced? To take just one example, in the atmosphere physics package, the CLUBB SGS parameterization is bracketed by if(do_clubb_sgs), not by magic numbers.
It appears to me that you are upending many years of best practice by hiding a parameterization in math rather than by explicit code logic. Why do you feel this is important in this case? What SE principle is involved?

@rljacob
Copy link
Member Author

rljacob commented Feb 4, 2017

If you're choosing between two large blocks of code or calling a different subroutine, then yes something like if(do_gustiness) would be appropriate. But this is just one term in one line so gust_fac=0 or not is the more elegant and better solution. We can clarify with some inline documentation and the documentation for gust_fac.

@gold2718
Copy link

gold2718 commented Feb 4, 2017

Elegance is in the eye of the beholder and is not a software-engineering principle.
While the code is a bit shorter in this case, logically and scientifically, it is very similar to the introduction of the flux_diurnal parameterization.
Why do you feel that a departure from the standard protocol is "better" in this case?

@mvertens
Copy link
Contributor

mvertens commented Feb 5, 2017

Here is another summary of my understanding:

ugust in shr_flux_atmOcn is the following function:

ugust(gprec) = gust_fac*log(1._R8+57801.6_R8*gprec-3.55332096e7_R8*(gprec**2.0_R8))
gust_fac is being sent to shr_flux_atmOcn and this is being used to evaluate the function ugust.

By default gust_fac is hug(1._r8) - int value in shr_infodata_mod.F90). However, it is zero by default in the namelist input for ugust_fac.

The issue I am concerned about is whether CESM can accept a non-default value that a user could set other than zero in a CESM release.

@rljacob
Copy link
Member Author

rljacob commented Feb 5, 2017

I agree setting the initial value to HUGE(1.0) can be removed. That seems like an overly cautious way to make sure the namelist setting is taking effect.

@rljacob
Copy link
Member Author

rljacob commented Feb 5, 2017

"flux_dirunal" is different because that logical controls if a completely different subroutine is called, one that has dozens of lines different from the non-diurnal version. This is one term in one line of code.

@jgfouca
Copy link
Contributor

jgfouca commented Feb 6, 2017

@rljacob @mvertens @gold2718 , looking at this conversation, it's not clear to me what the resolution is.

@rljacob
Copy link
Member Author

rljacob commented Feb 6, 2017

Go ahead and merge it as-is. @mvertens will then do a PR with an implementation for CESM.

@mvertens
Copy link
Contributor

mvertens commented Feb 6, 2017 via email

@rljacob
Copy link
Member Author

rljacob commented Feb 6, 2017

Sure I'll make those changes.

@singhbalwinder
Copy link
Contributor

Sorry, just saw this conversation. Implementation is not complete yet as currently I don't know a way to turn this on based on a particular compset. Originally, I wanted to turn this on (gust_fac>0) only for a new compset but at that time, I couldn't quite figure out how to do it. I think I talked with @rljacob at that time but I don't remember if we were able to find a solution.

This was my first time to make changes in the coupler codes and it sounds like I might have broken some existing rules. I will try to answer based on how I understand it works.

  1. real(r8) :: gust_fac = huge(1.0_r8): I generally do that so that if this variable is used before it is initialized the simulation breaks (to be extra cautious). In this case, it is initialized right after so we can remove this. I also realize that it will be an automatic save variable (it is not required to be save and was not intentional) so I think it is a okay to just declare it without initializing. I followed flux_diurnal variable to add this variable.

  2. In seq_flux_init_mct: allocate prec_gust and set it to 0.: I followed prec variable to add this variable. prec was also allocated and set to zero just after that, so I just followed suit. This can also be changed if necessary.

Rest of the code is just to read gust_fac from the namelist and pass it along so that it can be used in shr_flux_atmOcn. I can re-organize the code if it doesn't fit the current way of adding code to the coupler.

After implementing this code, I ran tests to make sure the code stays BFB with the old code.

@rljacob
Copy link
Member Author

rljacob commented Feb 6, 2017

@mvertens what do you about not initializing gust_fac at all in the declaration? As @singhbalwinder said, that gives it an implied "save" attribute.

@mvertens
Copy link
Contributor

mvertens commented Feb 7, 2017 via email

@ghost ghost added the in progress label Feb 7, 2017
@ghost ghost removed the in progress label Feb 8, 2017
rljacob added a commit that referenced this issue Feb 8, 2017
Merge the maint-cime5.1 branch along with ACME's changes to 5.1

XML changes:
ACME compset additions, ACME PEs changes, ACME grids
ACME build system updates (Depends files, Makefiles)
ACME config changes (batch, compilers, machines)
Minor modifications to config_component to split out entry ids that are not the same between ACME and CESM
Lots of additions to config_component_acme

CPL/DRV changes:
Addition of gust_fac into driver
Addition of cron_script, cron equivalent of jenkins_script

Python changes:
Remove obsolete ACME env_mach_specific files
If model is ACME, auto-add compiler to baseline name (impacts create_test, bless_test_results, and compare_test_results)
Fix HOMME test, Updates to ACME performance archiving
Raise exception if batch job-id fails to match pattern
Bug fix for point calculation in pes.py
Changes to build.py because clm is not a shared lib in ACME
ACME now supports recommended test timings based on test-suite

Test suite: scripts_regression_tests.py
Test baseline: none
Test namelist changes:
Test status: bit for bit

Closes #1105
Fixes #834

User interface changes?: See above

Code review: Mariana Vertenstein, Jim Edwards, Steve Goldhaber, Rob Jacob

Conflicts:
	cime_config/acme/machines/config_compilers.xml - took ACME version
	 and made modes to add -DCPR
	cime_config/acme/machines/config_machines.xml - took branch version
	driver_cpl/shr/seq_infodata_mod.F90 - took ESMCI version and re-added declarations for gust_fac
@ghost ghost assigned jgfouca Feb 9, 2017
@ghost ghost added the in progress label Feb 9, 2017
rljacob added a commit that referenced this issue Feb 9, 2017
Merge the maint-cime5.1 branch along with ACME's changes to 5.1

XML changes:

ACME compset additions, ACME PEs changes
ACME grids ACME build system updates (Depends files, Makefiles)
ACME config changes (batch, compilers, machines)
Minor modifications to config_component to split out entry ids that are not the same between ACME and CESM
Lots of additions to config_component_acme

CPL/DRV changes:
Addition of gust_fac into driver
Addition of cron_script, cron equivalent of jenkins_script

Python changes:
Remove obsolete ACME env_mach_specific files
If model is ACME, auto-add compiler to baseline name (impacts create_test, bless_test_results, and compare_test_results)
Fix HOMME test, Updates to ACME performance archiving
Raise exception if batch job-id fails to match pattern
Bug fix for point calculation in pes.py
Changes to build.py because clm is not a shared lib in ACME
ACME now supports recommended test timings based on test-suite

Test suite: scripts_regression_tests.py
Test baseline: none
Test namelist changes:
Test status: bit for bit

Closes #1105
Fixes #834

User interface changes?: See above

Code review: Mariana Vertenstein, Jim Edwards, Steve Goldhaber, Rob Jacob

Conflicts:
	cime_config/acme/machines/config_compilers.xml - took ACME version
	cime_config/acme/machines/config_machines.xml - took branch version
	driver_cpl/shr/seq_infodata_mod.F90 - took ESMCI version with gust_fac added back
agsalin pushed a commit that referenced this issue Mar 23, 2017
Bring in new versions of MPAS framework and components.

This PR will bring in new versions of the MPAS framework and all three MPAS
components.
This PR fulfills the following Pull Requests:
* Enable threaded ocean and ice tests (1038)
* Ensures MPAS AM write/compute startup steps are performed (1191)
* Open streams to redirect per-process stream output to /dev/null (ACME/MPAS 5)
* Fix slow compilation of threaded MPAS-CICE on Mira (ACME/MPAS 6)
* Fix slow compilation of threaded MPAS-O on Mira (ACME/MPAS 7)
This PR fixes the following issues:
* Restore threading tests for MPAS when threading working (828)
* PET_Ln9.T62_oEC60to30.CMPASO-NYF Fails without baseline comparisons (1088)
* write to stderr in MPAS framework file generating redundant output (1105)
* option to build mpas-o without checking that using the correct cvmix (1111)
* issues with MPAS components writing from all ranks (1133)
* water cycle benchmark not deterministic when using threading in MPAS-O (1137)
* Build issue in mpas-o with Intel v17 on cori (1176)

Fixes #828, Fixes #1088, Fixes #1105, Fixes #1111, Fixes #1133, Fixes #1137, Fixes #1176

[BFB]
[NML]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment