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

Update to 4.0.3 and add Cray compiler support #6

Merged
merged 63 commits into from
Jan 6, 2019
Merged

Conversation

letmaik
Copy link

@letmaik letmaik commented Jan 5, 2019

This PR adds all changes up to and including WRF 4.0.3 and also adds Cray compiler support by adding new architecture files and including a small number of code syntax related fixes.
NOTE: Do NOT squash merge so that we keep original history.

JJ Guerrette and others added 30 commits September 13, 2018 17:26
TYPE: bug fix

KEYWORDS: moist, analysis update

SOURCE: Internal (JJG)

DESCRIPTION OF CHANGES: 
xatowrf now requires cloud_cv_options that match packaging defined in registry.var
for xa%qrn, xa%qcw, xa%qci, xa%qsn, and xa%qgr.

This bugfix is connected to PR wrf-model#283 from  11 AUG 2017 (wrf-model@c7405bb#diff-fe8b020143d32583d82b945e2bd66f50)

The array bounds error this avoids occurs when mp_physics ~= [0, 98] and cloud_cv_options==0.

LIST OF MODIFIED FILES: 
M       var/da/da_transfer_model/da_transfer_xatowrf.inc

TESTS CONDUCTED: 
The following error at the end of rsl.error.0000 is avoided with this fix when "debug" build is used for WRFDA:

>``forrtl: severe (408): fort: (2): Subscript #1 of the array QCW has value 2 which is greater than the upper bound of 1``
>
>``Image              PC                Routine            Line        Source
da_wrfvar.exe      00000000060CF996  Unknown               Unknown  Unknown
da_wrfvar.exe      00000000017EDB3B  da_transfer_model        2224  da_transfer_model.f
da_wrfvar.exe      00000000018A4263  da_transfer_model        3399  da_transfer_model.f
da_wrfvar.exe      00000000004C5D92  da_wrfvar_top_mp_        3675  da_wrfvar_top.f
da_wrfvar.exe      00000000004B0699  da_wrfvar_top_mp_        2779  da_wrfvar_top.f
da_wrfvar.exe      00000000004B0559  da_wrfvar_top_mp_        2749  da_wrfvar_top.f
da_wrfvar.exe      0000000000459863  MAIN__                     34  da_wrfvar_main.f
da_wrfvar.exe      0000000000405C1E  Unknown               Unknown  Unknown
libc-2.19.so       00002AAAAB7E5B25  __libc_start_main     Unknown  Unknown
da_wrfvar.exe      0000000000405B29  Unknown               Unknown  Unknown``


The WRFDA Regression test was not run.  The changes are minor and fix the known bug.
…ing (wrf-model#644)

TYPE: no impact (except for WRFDA regtests)

KEYWORDS: WRFDA, crtm_coeffs

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
Make var/run/crtm_coeffs point to the updated /glade/work path for release-v4.0.1.

LIST OF MODIFIED FILES:
M var/run/crtm_coeffs

TESTS CONDUCTED:
WRFDA regtests run with the updated path.
… sfc wind correction (wrf-model#599)

TYPE: bug fix

KEYWORDS: WRFDA, sfc wind correction

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
The current if-elseif coding in the code is not consistent with the intended formulation
as in figure 2 of Stauffer et al. 1991, MWR,
0<z0<0.2 : u40/u10=1.000+0.320z0**0.2
z0>=0.2 : u40/u10=1.169+0.315z0

Notes:
1. the sfc wind correction is applied only when
(1) sfc_assi_options=1.
(2) The obs height is below the model lowest half level height and the height difference is larger than 10 meters.
(3) Bulk Richardson number<0.0 and h/L>1.5.
2. My personal comment is that the concept of the empirical correction derived 25+ years ago
(when the lowest model level was 40 meters) is not applicable to current models that have
much higher vertical resolutions near surface. The proposed fix corrects a coding error
but the impact is not too meaningful and is expected to be small.

LIST OF MODIFIED FILES:
M var/da/da_tools/da_mo_correction.inc

TESTS CONDUCTED: none

RELEASE NOTE:
Not worth mentioning this fix for release.
…iv prints. (wrf-model#639)

TYPE: bug fix

KEYWORDS: WRFDA, radar rf/rv, obs error

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
1. Missing rv are set incorrectly as no-rain rf in NCAR-processed radar data.
    The fix is to set qc to missing_data for -999.99 rv in var/da/da_radar/da_get_innov_vector_radar.inc
2. Missing rv/rf has error of missing_r in CWB-processed radar data.
    The fix is to set a default error value in var/da/da_obs_io/da_read_obs_radar.inc.

NCAR-processed radar data sample
FM-128 RADAR   2017-06-02_03:06:00        22.961       117.830      38.0       1
         5158.0    -999.990   0       0.500      -999.990   0       0.000     -8888.880

CWB-processed radar data sample 1
FM-128 RADAR   2017-07-06_06:00:00        19.570       117.335       0.0       1
        12000.0 -888888.000 -88 -888888.000      -999.990   0       0.000

CWB-processed radar data sample 2
FM-128 RADAR   2017-07-06_06:02:00        24.134       122.223      63.0       1
          946.0       1.300   0       2.000   -888888.000 -88 -888888.000

LIST OF MODIFIED FILES:
M var/da/da_obs_io/da_read_obs_radar.inc
M var/da/da_radar/da_get_innov_vector_radar.inc

TESTS CONDUCTED:
1. After the fix, radar rf and rv errors are assigned proper values in the code when the info is not provided in the input ob.radar.
2. WRFDA regtests with intel-17.0.1 on cheyenne passed.

RELEASE NOTE:
Bug fix for ob.radar that contains rv=-999.99, rv_err=-888888.0, rf_err=-888888.0.
TYPE: bug fix

KEYWORDS: WRFDA, cloud control variable, outerloop

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
1. Add cloud and w control variables that were not included in the original BE rescaling code.
2. Only root processor writes out the intermediate file for BE rescaling.
3. Change the log message from Jb factor used() to var_scaling used().

LIST OF MODIFIED FILES:
M var/da/da_minimisation/da_get_var_diagnostics.inc
M var/da/da_minimisation/da_minimisation.f90
M var/da/da_setup_structures/da_scale_background_errors.inc
M var/da/da_setup_structures/da_setup_be_regional.inc

TESTS CONDUCTED:
1. Results remain the same when var_scaling[6..11] do not vary with outerloops.
2. WRFDA regtests with intel 17.0.1 on cheyenne passed.

RELEASE NOTE:
Bug fix for max_ext_its>=2 and cloud BE scaling factors (i.e. var_scaling6..11 and len_scaling6..11) vary with outerloops.
TYPE: bug fix

    KEYWORDS: WRF-Chem,convert_emiss,emi_conv,Compilation

    SOURCE: Ka Yee Wong, NOAA/GSD(CIRA)

    DESCRIPTION OF CHANGES: convert_emiss compilation bug-fix

    ISSUE:
    Fixes wrf-model#601

    LIST OF MODIFIED FILES:
    modified:   compile

    TESTS CONDUCTED: None
TYPE: text only

KEYWORDS: README, WRFV3, WRF

SOURCE: Jim Bresch (NCAR)

DESCRIPTION OF CHANGES: It was pointed out that we still had a 'WRFV3' in the top-level README file. I changed that to 'WRF.'

ISSUE: none

Fixes: none

LIST OF MODIFIED FILES: 
m    README

TESTS CONDUCTED: no tests necessary
TYPE: bug fix

KEYWORDS: HVC, hybrid, coefficients, half, full

SOURCE: internal, found by May Wong (NCAR)

DESCRIPTION OF CHANGES:
In the original implementation of the hybrid vertical coordinate (v3.9), the
cpp directives utilized capitalization to differentiate between the use
of full-level (c1f, for example) and half-level (c1h, for example) 1d
coeffieicent arrays. For several locations in the small_step, the use of the
"mu" array with the "t_2" field incorrectly was assigned to full levels.

In three statements where the half-level t_2 array is used, the half-level
c1h and c2h 1d arrays replace the incorrect full-level 1d arrays c1f and c2f.

ISSUE:
Fixes wrf-model#604

LIST OF MODIFIED FILES: 
M	dyn_em/module_small_step_em.F

TESTS CONDUCTED: 
1. Look at diffs of fields. 
   a. theta fixed (new code) MINUS theta busted (original code) at k=26, though the difference pattern and magnitude was similar throughout the vertical levels
![screen shot 2018-09-10 at 10 57 41 am](https://user-images.githubusercontent.com/12666234/45312136-831e1800-b4e8-11e8-8809-3d964236f406.png)


2. Regression test.
 - [x] Regression test passes

RELEASE NOTE: 
This bug was introduced with the start of the hybrid vertical coordinate option. This 
same functionality of modification for v4.0 would need to go into v3.9, v3.9.1, and
v3.9.1.1. The differences are typical of a small perturbation in an initial condition:
the differences do not look unphysical.
…f-model#621)

TYPE: bug fix

KEYWORDS: use_theta_m, moist theta

SOURCE: Several users pointed out problem, solution from Wei Wang

DESCRIPTION OF CHANGES:
In the porting of the theta_m mods from being ONLY inside of the WRF model
to being part of the initialization step in the real and ideal programs,
the start_em file was modified. Part of the computation of the pressure
involves dry_theta * ( 1 + rv/Rd Qv ).

When the incoming data from the real or ideal program has the namelist
option use_theta_m==1, then the factor ( 1 + Rv/Rd Qv ) is already included
in the theta field. An IF test based on the namelist option use_theta_m
tests whether or not to assign the factor qvf as either 1 or ( 1 + Rv/Rd Qv ).


ISSUE:
Fixes wrf-model#608

LIST OF MODIFIED FILES:
M	dyn_em/start_em.F

TESTS CONDUCTED:

1. Differences at 0h (since the mod is in start_em.F). Compare original (busted)
code with use_theta_m=1 to fixed code. Differences shown are: 

LEFT: t=0, use_theta_m=0 MINUS  use_theta_m=1_FIXED.

RIGHT: t=0, use_theta_m=0 MINUS  use_theta_m=1_BUSTED.

The differences are supposed to be very small, for example a few hundredths
of a Pa.
![screen shot 2018-09-10 at 9 27 04 am](https://user-images.githubusercontent.com/12666234/45308687-4b5ea280-b4df-11e8-9db7-709ee35521e0.png)

2. The error is introduced in the initialization routine in WRF. After that initial
p' error (3000 Pa), the imbalance quickly decays. However, the perturbations
are enough to change the larger scale solution, which leads to pressure
differences around 300 Pa. Shown is the differences of the p' field at 3h and 12h,
where the differences are wrfout_FIXED - wrfout_BUSTED.
![screen shot 2018-09-10 at 10 05 36 am](https://user-images.githubusercontent.com/12666234/45310519-b14d2900-b4e3-11e8-9484-d4ae96631ed5.png)

3. Regression test on cheyenne.
- [x] Reggie looks OK 

RELEASE NOTE:
This bug was introduced in v4.0. This is a critical modification because 
the option use_theta_m=1 is the default, and the results are unphysical.
…l#626)

TYPE:  Text only

KEYWORDS: WRF-FIRE, namelist

SOURCE: internal

DESCRIPTION OF CHANGES: In the sample namelist.input.fire that comes with the released WRF.tar file, the syntax for some variables is different than the ones in the registry.fire. 

A few namelist options were spelled incorrectly in the sample namelist.input.fire. This PR corrects the spelling. I compared the namelist options with those in registry.fire to make sure they are correctly spelled in the sample namelist.

LIST OF MODIFIED FILES: 
M test/em_real/namelist.input.fire

TESTS CONDUCTED: Regression test is not necessary
…wrf-model#605)

TYPE: bug fix

KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

PSISAT sign change incorrectly introduced in Noah-MP subroutine noahmp_init (PR wrf-model#287; commit 45d1945). This sign change is already taken into account in the equation where it is used and should not have been added. The sign change added to subroutine groundwater_init in PR wrf-model#287 is correct.

Only affects the initialization of frozen soil but can have large effect on soil temperature and moisture simulations when soil temperature is below freezing.
    
LIST OF MODIFIED FILES: 

M       phys/module_sf_noahmpdrv.F

TESTS CONDUCTED:
1. Summer and winter 24-hr case
TYPE: bug fix 

KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

Change in Noah-MP subroutine SNOWH2O to update snow liquid water as water passes to layers below. Without this fix, more water is allowed to move to layer than pore space available. This results in unrealistic snow density values during melt season.

Mods to release-v4.0.1, not develop. Replaces PR wrf-model#632 

LIST OF MODIFIED FILES:

M phys/module_sf_noahmplsm.F

TESTS CONDUCTED:

Summer and winter 24-hr case
wrf-model#646)

TYPE: bug fix

KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

Bug fix introduced in wrf-model#399 where divide by zero can occur if LAI is zero. Added check in IF statement. This calculation is only for diagnostics so shouldn't change answers, except to prevent model crash.

Mods to release-v4.0.1, not develop. Replaces PR wrf-model#633 

LIST OF MODIFIED FILES:

M phys/module_sf_noahmpdrv.F

TESTS CONDUCTED:

Summer and winter 24-hr case
TYPE: bug fix

KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

Change in Noah-MP subroutine RAGRB to limit leaf aerodynamic resistance (RB). Currently there is no lower limit. This can result is very large canopy exchange coefficients and subsequent canopy fluxes. Can result in model blow-up with high wind speed.

Mods to release-v4.0.1, not develop. Replaces PR wrf-model#634 

LIST OF MODIFIED FILES:

M phys/module_sf_noahmplsm.F

TESTS CONDUCTED:

Summer and winter 24-hr case
…odel#648)

TYPE: bugfix

KEYWORDS: Noah-MP

SOURCE: Michael Barlage (NCAR)

DESCRIPTION OF CHANGES:

One Noah-MP runoff option (opt_run=2) creates a 100-layer soil using soil properties from Noah-MP parameters data structure. Fix possible/likely array out of bounds by assuming homogeneous soil with depth. A more general fix should be completed later.

Mods to release-v4.0.1, not develop. Replaces PR wrf-model#635 

LIST OF MODIFIED FILES:

M phys/module_sf_noahmplsm.F

TESTS CONDUCTED:

Summer and winter 24-hr case
…ecip, allow high model tops, higher min dust conc (wrf-model#649)

TYPE: bug fix

KEYWORDS:

SOURCE: Greg Thompson (NCAR)

DESCRIPTION OF CHANGES:

1. Line 2694:  bug fix; has been wrong in the code by skipping a reduced number of rain for approx 10 years
2. Increased maximum ice concentration permitting 10000/Liter whereas previously 500/Liter upper limit.
3. Line 3036:  minor bug fix.
4. A series of new checks using "EQV" construct to provide some loops to be skipped.
5. Minor changes to lower limits of precip to eliminate really tiny values (~1E-9).
6. Removed extraneous ELSE blocks in reading lookup tables; also removed a comment block.
7. New line number 3498 and 3500 eliminate air density - fix for extreme model top heights by Tanya S. for FIM model (and MPAS).
8. New line number 4937 - set a higher value for min dust concentration when nucleating ice.

LIST OF MODIFIED FILES:
phys/module_mp_thompson.F

TESTS CONDUCTED:
1. Using mp_physics=28, aer_opt=1, and dust_emis=1
This is a 24-h precip from a 3-km domain. The "greg" plot is with the new mods, the "release" plot is with the v4.0 (baseline) code.
![greg_precip](https://user-images.githubusercontent.com/12666234/46317974-34691880-c592-11e8-81fe-f9209c7702b9.png)
TYPE: no impact

KEYWORDS: version

SOURCE: internal

DESCRIPTION OF CHANGES:
Update text string used in the WRF sytem (wrf, real, ideal, ndown) to
identify the release version.

LIST OF MODIFIED FILES:
M		inc/version_decl

TESTS CONDUCTED:
Code builds, and the expected output message is OK.
TYPE: text only

KEYWORDS: README, release, v4.0.1

SOURCE: internal

DESCRIPTION OF CHANGES: Updated the top of the README file to indicate V4.0.1, and added a release notes section for this version, pointing to the GitHub WRF Release page.

LIST OF MODIFIED FILES:
M README

TESTS CONDUCTED: no tests conducted - text only
Finalize WRFV4.0.1 by merging bug fixes from release-v4.0.1 branch onto master. See the annotation of the v4.0.1 tag for full release notes (git show v4.0.1).
TYPE: bug fix

KEYWORDS: WRFDA, 4DVAR, jcdfi

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
1. When jcdfi_diag==1, one of the packaged variable names should be jcdfi_v, not dfi_v.
    This fix does not affect results.
2. Correct the error message in check-a-mundo when jcdfi_use=1 and jcdfi_diag=0.
    The message before the fix:
    --- ERROR: If jcdfi_use = 1, then jcdfi_io must also = 1 for that domain
    -------------- FATAL CALLED ---------------
    FATAL CALLED FROM FILE: LINE: 1541
    --- Change jcdfi_io in namelist.input
  (1) jcdfi_io should be jcdfi_diag. There is no jcdfi_io anywhere else in the code.
  (2) 'for that domain' should be removed because jcdfi_diag is a single value.

LIST OF MODIFIED FILES:
M Registry/registry.wrfplus
M share/module_check_a_mundo.F

TESTS CONDUCTED:
1. a 4dvar surface DA case
2. DA regtest 4dvar_small and radar_4dvar_cv7 cases that have jcdfi_use=true produced identical results.
TYPE: bug fix

KEYWORDS: optical_prep_gocart, volume-averaged refractive index, WRF-Chem

SOURCE: Alexander Ukhov, KAUST

DESCRIPTION OF CHANGES: 
Problem: It was found that the dust particles having radii less than 0.46 microns are not accounted in the calculation of volume-averaged refractive index needed by Mie calculations. Since the finer particles have a bigger influence on AOD in comparison to the coarser particles (per unit of mass), it eventually led to the underestimation of the AOD. 

Solution: 0.46 was replaced by 0.1, where the value 0.1 corresponds to the beginning of the first GOCART bin (radii: 0.1-1.0 μm).

Left column (1-5) - GOCART dust bins.
other columns are 8 MOZAIC size bins.

dustfrc_goc8bin BEFORE CORRECTION:
![image](https://user-images.githubusercontent.com/5716976/47048874-58d50f80-d1a4-11e8-852c-ceb39c0594a0.png)

dustfrc_goc8bin AFTER CORRECTION:
![image](https://user-images.githubusercontent.com/5716976/47048860-51156b00-d1a4-11e8-8f6e-488af4812e12.png)


LIST OF MODIFIED FILES: 
M       chem/module_optical_averaging.F
M       phys/module_data_gocart_dust.F

TESTS CONDUCTED: 
Test case was run. The obtained result is expected: the AOD level has increased.
![result](https://user-images.githubusercontent.com/5716976/47048622-9edda380-d1a3-11e8-8db8-15b4f8106355.png)
TYPE: bug fix

KEYWORDS: WRFDA, compile, RTTOV-v11, HDF5

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
1. Add two more libs (hdf5hl_fortran and hdf5_hl) to CONFIGURE_HDF5_LIB_PATH
2. Add one more lib (rttov11_hdf) to RTTOV_LIB when RTTOV-v11 is built with HDF5-enabled.
**Note that this fix is specific to WRFDA with RTTOV-v11 and
should NOT be merged to the develop branch that has different RTTOV-v12 implementation.**

LIST OF MODIFIED FILES:
M       arch/Config.pl
M       compile

TESTS CONDUCTED:
1. DA compiles after the fix.
2. Without the fix, users have to manually edit configure.wrf to add missing libs to LIB_EXTERNAL in order to compile.
TYPE: bug fix

KEYWORDS: scm_vegfra, vegfra, seabreeze, convrad, scm, percentage, fraction

SOURCE: found by @sodoesaburningbus

DESCRIPTION OF CHANGES:
Idealized cases were initializing vegfra as a fraction (default setting of 0.5). Modified this to change to a percentage (default 50.) to be consistent with Noah driver. This setting was only used for the idealized cases em_convrad, em_seabreeze2d_x, and scm_xy. Since convrad is all water points, it should never matter, but modified the code for consistency. Seabreeze will only be affected if one turns on the Noah LSM. Convrad and seabreeze are controlled in module_initialize_ideal and scm is controlled by the namelist/registry.

ISSUE:
fixes wrf-model/Users_Guide#30

LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON
M dyn_em/module_initialize_ideal.F
M test/em_scm_xy/namelist.input

TESTS CONDUCTED:
Ran before/after tests to determine that variables Q2 and latent heat flux were more realistic after the modification (see attached files for Q2 comparison).
q2_after
q2_before

RELEASE NOTE: The default value for vegfra in idealized cases was modified from a fraction to a percentage, consistent with the Noah LSM driver.
)

TYPE: no impact

KEYWORDS: dust emission and Thompson scheme

SOURCE: internal

DESCRIPTION OF CHANGES:
When surface dust emissions scheme is linked to the ice-friend aerosol variable of Thompson microphysics, in solve_em.F, the line is changed from

       IF (config_flags%dust_emis.eq.1 .AND. config_flags%mp_physics.eq.28)  then
to

       IF (config_flags%dust_emis.eq.1 .AND. config_flags%mp_physics.eq.thompsonaero)  then
This is not technically a bug fix, but a code clean-up that makes reading solve_em easier.

LIST OF MODIFIED FILES:
M dyn_em/solve_em.F

TESTS CONDUCTED: reggie OK
TYPE: no impact

KEYWORDS: stochastic perturbation, moist tendency

SOURCE: internal

DESCRIPTION OF CHANGES:
In the code dyn_em/module_first_rk_step_part2.F for stochastic perturbation, the index for Qvapor in the moist tendency term should be p_qv (as in moist_tend(ims,kms,jms,p_qv) ) instead of assuming that the index is 2 (as in moist_tend(ims,kms,jms,2)).

This is code clean up.

LIST OF MODIFIED FILES:
M dyn_em/module_first_rk_step_part2.F

TESTS CONDUCTED: reggie conducted, OK
TYPE: bug fix

KEYWORDS: chemical reaction rate constant

SOURCE: internal

DESCRIPTION OF CHANGES:

Correct the reaction rate constant for reaction:

SO2 + OH -> SO4         (tag usr23)

The prior code had the expression:

    fc    = 3.e-11_dp * (300._dp/temp) ** 3.3_dp

which has been corrected to:

    fc    = 3.e-31_dp * (300._dp/temp) ** 3.3_dp

Although the coefficient change from 3.e-11 to 3.e-31 is large
this change is only part of a complex expression for the rate
constant and leads to much smaller and expected changes in
the chemical species SO4 and OH. (See pdf at end of this listing)

This change applies only to the following chem_opt options:

MOZART_KPP,MOZCART_KPP,T1_MOZCART_KPP,MOZART_MOSAIC_4BIN_KPP,MOZART_MOSAIC_4BIN_AQ_KPP

LIST OF MODIFIED FILES:

M       chem/KPP/mechanisms/mozart/mozart.def
M       chem/KPP/mechanisms/mozart_mosaic_4bin/mozart_mosaic_4bin.def
M       chem/KPP/mechanisms/mozart_mosaic_4bin_aq/mozart_mosaic_4bin_aq.def
M       chem/KPP/mechanisms/mozcart/mozcart.def
M       chem/KPP/mechanisms/t1_mozcart/t1_mozcart.def

TESTS CONDUCTED:

Gabi Pfister has compared simulations with the old and new rate constant.
Differences are consistent with the modification and are within an expected
range.

[usr23_changes.pdf](https://github.com/wrf-model/WRF/files/2503503/usr23_changes.pdf)
…#668)

TYPE: bug fix

KEYWORDS: write syntax, character string continuation

SOURCE: Alexander Davies (US Naval Academy)

DESCRIPTION OF CHANGES:
1. Remove comma after write statement.
2. Clean up continuation of string across more than one line.

LIST OF MODIFIED FILES:
M	phys/module_cu_mskf.F

TESTS CONDUCTED:
1. Without mods, code does not compile on Cray with ftn.
2. With mods, code compiles and runs.
….F (wrf-model#669)

TYPE: bug fix

KEYWORDS: cray, 1.e-39, small, tiny

SOURCE: Alexander Davies (US Naval Academy)

DESCRIPTION OF CHANGES:
In place of a constant that is too small to represent with single precision
on a Cray compiler, explicitly name a small value as a PARAMETER, and
use that value in the comparison. That small value is the smallest representable
value.

Here is a sample test code
```
program foo
  real, parameter :: real_tiny = tiny(1.0)
  print *,'real tiny = ',real_tiny
end
```

Here is the single and double precision build:
```
> gfortran foo.f90
> a.out
 real tiny =    1.17549435E-38
```
```
> gfortran -fdefault-real-8 foo.f90
> a.out
 real tiny =    2.2250738585072014E-308
```

LIST OF MODIFIED FILES: 
M   module_mp_morr_two_moment_aero.F

TESTS CONDUCTED:
1. Without this mod, the code does not compile.
2. With this mod, the code compiles and runs.
saneku and others added 25 commits November 6, 2018 15:13
…-model#677)

TYPE: bug fix

KEYWORDS: optical_prep_gocart, volume-averaged refractive index, mass redistribution, AOD, WRF-Chem

SOURCE: Alexander Ukhov, KAUST

DESCRIPTION OF CHANGES: 
Problem: There is a code in _optical_prep_gocart_ procedure which calculates the contribution of the dust and sea salt bins into the MOZAIC bins. The code uses the interpolation over the linear axis but should use the interpolation over log axis. The similar bug was fixed In wrf-model#536 "fixed coefficients for calculation of PM10 and PM2.5. For GOCART aerosol scheme".

Solution: use interpolation over the log axis instead of linear axis.

Effect: Interpolation over log axis changes the mass redistribution between the MOZAIC bins.
It leads to the increased contribution of the small dust and sea salt particles into the Aerosol Optical Depth (AOD). As a result of the correction, AOD is increasing.

DUST_1..5 are GOCART dust bins
MOZ0...7 are MOZAIC bins

**dustfrc_goc8bin BEFORE THE CORRECTION:**
![image](https://user-images.githubusercontent.com/5716976/47463793-f2796e00-d7ef-11e8-84e4-9fc8c043d1a2.png)


**dustfrc_goc8bin AFTER THE CORRECTION:**
![image](https://user-images.githubusercontent.com/5716976/47462862-40d93d80-d7ed-11e8-9041-1b98897efd3d.png)


LIST OF MODIFIED FILES: M       chem/module_optical_averaging.F

TESTS CONDUCTED:
The test case was run. The obtained result is expected: the AOD level has increased.

![image](https://user-images.githubusercontent.com/5716976/47462750-f5269400-d7ec-11e8-8fee-ca7f137416c5.png)
TYPE: bug fix

KEYWORDS: NOAH LSM, divided by zero

SOURCE: internal

DESCRIPTION OF CHANGES: when the leaf area index is derived from static input data (rdlai2d=true), the value could be zero at certain areas. This leads to extremely large, unrealistic HFX and the model eventually crashed.

LIST OF MODIFIED FILES:
M phys/module_sf_noahdrv.F

TESTS CONDUCTED:
One case has been tested. The case crashed immediately without the fix. The same case can be done successfully with the fix.
…ation of LAI with .rdlai2d=.false. (wrf-model#665)

*  1. Bug fix for use of MYJ PBL with RUC LSM. Special treatment should
    be applied when the MYJ boundary layer is used, and not the MYJ surface
    layer. Therefore, a new variable - myjpbl - is introduced in the surface
    driver, and it is passed into RUC LSM.
2.  Bug fix in RUC LSM for seasonal variation of LAI with rdlai2d=.false.
3.  Clean-up in RUC LSM, several commented pieces are removed.

* Pass bl_pbl_physics to surface driver to use in creating logical MYJPBL.

* Fixed codes that work for NMM
TYPE:  text only

KEYWORDS: README.namelist

SOURCE: internal

DESCRIPTION OF CHANGES: 
The option mp_physics=40, which is missing previously, is added to README.namelist.  

LIST OF MODIFIED FILES
M      run/README.namelist

TESTS CONDUCTED: 
Not needed as this is a text-only modification from a README file.

RELEASE NOTE:  
Do not need to include any mention of this modification
Finalize WRFV4.0.2 by merging bug fixes from release-v4.0.2 branch onto master.
See the annotation of the v4.0.2 tag for full release notes (git show v4.0.2).
…taset is used (wrf-model#702)

TYPE: bug fix

KEYWORDS: urban, land use, MODIS, REAL, NLCD

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
When NLCD and MODIS are used together, the land use type will be adjusted for all grid cells where the urban fraction is greater than 0.5 in the real program. Due to an incorrect application of DeMorgan's Law, all of the urban land use categories became category 13. While 13 for MODIS is indeed urban, 13 is not the NLCD high-resolution urban categories: 24, 25, 26. These NLCD urban categories should be preferentially used if available.

Solution:
The logic is supposed to be:
if ( the grid point is urban (based on percentage) ) and
( the grid cell is not one of the special NLCD points ) then
reset this to the MODIS urban category.

if (urban>0.5)
   if ((cat != 24) AND cat(!=25) AND cat(!=26))
      cat = 13
Note that with our incorrect implementation of the logic, the if test above is ALWAYS true: we always reset the urban points to the MODIS value. Here is the line that we need:

if ((cat != 24) OR cat(!=25) OR cat(!=26))
The incorrect logic in the IF test means that all urban points (based on percentage) become category 13, which is the MODIS urban category. The correct logic excludes urban points that are identified as NLCD urban points.

This bug fix retains the correct urban type defined in NLCD.

LIST OF MODIFIED FILES:
M dyn_em/module_initialize_real.F

TESTS CONDUCTED:

Application to a user case confirms the modified code works as expected.
…l#710)

TYPE:  Bug fix 

KEYWORDS: WRF Plus, module_wrf_top.F, OpenMP error

SOURCE: Carlos Ross (DFM Consultores)

DESCRIPTION OF CHANGES: 
Problem: 
Getting an error when compiling WRF Plus with Intel compiler
```
../main/module_wrf_top.f90(756): error #6099: An ENDDO statement occurred without a corresponding DO or DO WHILE statement.
```
A DO loop in wrf_adtl_check_spot had a syntax error and a formulation error for one of the 
OpenMP parallel directives. 
1. A unnecessary trailing "&" on the last OpenMP directive caused the following  first line of the
    Fortran DO loop to not be recognized.
2. The OpenMP loop was missing closing directive, "!$OMP END PARALLEL DO",  after the DO loop.

Solution:
Remove the trailing "&" and add in the missing OpenMP directive after the DO loop.
I wasn't trying to compile with OpenMP, I actually chose 
```
option 10. (dmpar) INTEL (ifort/icc): Xeon (SNB with AVX mods) 
```
when I ran the configure. This error occurs only when I was building WRFPLUS.

Fixes wrf-model#709

LIST OF MODIFIED FILES:  
M main/module_wrf_top.F

TESTS CONDUCTED: 
The code successfully compiled after including the modifications with Intel 19.0.1.

RELEASE NOTE: 
A syntax error was introduced with the v4.0 release that breaks the build of the WRFPLUS code (and only the WRFPLUS code) v19.0.1 of the Intel compiler. An OpenMP parallel loop was incorrectly constructed. That syntax error has been removed, though it is important to note that WRFPLUS never was intended to work with OpenMP, and the WRFPLUS code continues to only work with serial or DM build options.
TYPE: bug fix

KEYWORDS: ideal, check-a-mundo, namelist consistency, physics, num_soil_layers

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
The WRF ideal runs were not using any of the routines from module_check_a_mundo, so there were no namelist consistency checks and no physics configurations set.

For example, in the subroutine "set_physics_rconfigs" the num_soil_layers is set to the appropriate number of layers, depending on the LSM used. If a user is not using a LSM physics option with 5 layers (which is default in the registry), an error would occur when running ideal.

Starting with v4.0, we removed the namelist option "num_soil_layers" from all the namelists because "num_soil_layers" was supposedly redundant information, as "set_physics_rconfigs" from check_a_mundo assigns the correct number of soil layers. However, because check_a_mundo wasn't actually being used by ideal, the only thing assigning num_soil_layers was the namelist option. With the removal of "num_soil_layers" from the namelist, it defaults to 5 layers. Prior to the modification, the default em_scm_xy fails when you try to run ideal.exe, as the default LSM in that case is Noah (which uses 4 layers).

Solution:
This modification adds a USE statement for module_check_a_mundo, and makes CALLs to both set_physics_rconfigs and check_nml_consistency for the main program of the ideal executable.

LIST OF MODIFIED FILES:
M main/ideal_em.F

TESTS CONDUCTED:
Confirmed that all ideal cases are able to compile and give bit-for-bit results before and after modification.

RELEASE NOTE:
Idealized cases will now utilize the "set_physics_rconfigs" and "check_nml_consistency" subroutines from share/module_check_a_mundo.F. This will ensure that namelist requirements are not overlooked, and that the correct number of soil layers is assigned to cases, depending on what (if any) LSM scheme is used.
…rf-model#695)

TYPE: bug fix

KEYWORDS: Intel, ifort, OpenMP, deprecated

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
Starting with ifort/18.0.1 on cheyenne, the `-openmp` option is no longer available.
The WRF code cannot be built with OpenMP with a compiler that is v18.0 or newer.

Solution:
The Intel compiler has mentioned for years that the `-openmp` flag was deprecated
and that users should select `-qopenmp` instead. The older existing cheyenne Intel
compilers (16.0.1 and 17.0.1) both work with `-openmp` and `-qopenmp`. The new Intel
compiler requires `-qopenmp`.

ISSUE:
Fixes wrf-model#694 "Intel ifort 18 compiler replaces -openmp with -qopenmp"

LIST OF MODIFIED FILES:
M	configure.defaults

TESTS CONDUCTED:
1. New compiler - WRF and test OpenMP code
 - [x] The intel/18.0.1 builds with OpenMP when the `-qopenmp` option replaces the deprecated `-openmp`.
 - [x] The intel/18.0.1 _does not_ build with OpenMP with the `-openmp` option.

2. Older compiler - WRF and test OpenMP code
 - [x] The intel/17.0.1 builds with OpenMP when the `-qopenmp` option replaces the deprecated `-openmp`.
 - [x] The intel/17.0.1 builds with OpenMP with the `-openmp` option.

3. Even older compiler  - test OpenMP code
 - [x] The intel/16.0.1 builds with OpenMP when the `-qopenmp` option replaces the deprecated `-openmp`.
 - [x] The intel/16.0.1 builds with OpenMP with the `-openmp` option.

RELEASE NOTE: WRF now supports the correct compiler flag for OpenMP builds with newer Intel compilers, v18.0 and later. The Intel recommended flag, -qopenmp, was tested successfully with Intel 16.0.1, 17.0.1, and 18.0.1.
…odel#721)

TYPE: bug fix

KEYWORDS: WRFDA, warning print

SOURCE: Jamie Bresch (NCAR)

DESCRIPTION OF CHANGES:
cloud_cv_options is reset to be 0 in var/da/da_main/da_solve.inc when cv_options = 3.
The second line of the warning messages stating that the cloud_cv_options = 0 were not originally printed.

LIST OF MODIFIED FILES:
M       var/da/da_main/da_solve.inc

TESTS CONDUCTED:
1. After the fix, the intended full warning messages are printed.
```
--------------------------- WARNING ---------------------------
WARNING FROM FILE:  da_solve.inc  LINE:     205
Cloud control variables are not implemented for cv_options = 3
Resetting cloud_cv_options = 0 for cv_options = 3
---------------------------------------------------------------
```

RELEASE NOTE: (too minor to be mentioned)
…ro in fine-grid ndown run. (wrf-model#717)

TYPE: bug fix

KEYWORDS: ndown, nesting run

SOURCE: internal, problem discovered by researchers at Shanghai Typhoon Institute

DESCRIPTION OF CHANGES:
Problem:
A few variables are identically zero in the fine-grid ndown run or nesting run with input_from_file = .false..

Solution:
The particular variables are those static fields that go from geogrid -> metgrid -> real -> WRF. The fields must all be "i2" variables (static fields from geogrid that should be in the wrfinput file during ndown). These are also fields that need to be horizontally interpolated in case there is no fine grid input file (requiring a "d").

The Registry.EM_COMMON file is modified to ensure these variables are available for fine-grid.

VAR_SSO and FRC_URB2D have "i2" added
EROD and SNOALB have "d" added
LIST OF MODIFIED FILES:
M Registry/Registry.EM_COMMON

To make sure that we have not overlooked any other similar variables, we follow the steps below to conduct a complete check:

Run geogrid, and get a list of all of the fields in the geo_em* file.
Identify all fields in the geo_em file (they are all passed out of metgrid unchanged) that ALSO have an "i01" setting in the WRF Registry (basically identifying fields that meet the criteria that the field came in from metgrid and that the field that MUST go into the WRF model).
Make sure that those identified fields have two settings: "i2" (so that they are identified as static fields for the fine grid for ndown, for example) and the nested option "d" (to interpolate down to the fine grid from the coarse grid).
TESTS CONDUCTED:
Tests are conducted with and without the fix. Results indicate that these previously missing variables are available for fine-grid. Figures below show the differences in VAR_SSO between wrfinput_d02 with and without the bug fix. Similar differences can be found for other variables (i.e., EROD, SNOALB, FRC_URB2D)
TYPE: bug fix

KEYWORDS: obs nudging, max number of tasks

SOURCE: internal

DESCRIPTION OF CHANGES:
Problem:
The max number of processors, 1024, is hard coded in module_dm.F for observation nudging.
If a user requests more MPI tasks than this max number, this leads to segmentation fault.

Solution:
In the routine where the dimension of the variables is defined as the maximum number of MPI
tasks, those two variables are now declared as ALLOCATABLE, and then they are allocated based on
the total number of MPI ranks.

LIST OF MODIFIED FILES:
M external/RSL_LITE/module_dm.F

TESTS CONDUCTED:

Applied new code to a user's case, which shows the code works as expected.
No bit-wise diffs with smaller test case, before vs after mods: I built the code with ./configure -d option, and run a small test case with 1 processor and 36 processors, respectively. OBS nudging is turned on. Both runs cover a 3-hour period. Results are identical.
Test case with > 1024 MPI tasks: A large case (derived from a user's case) is also tested. In this case, the code is built with ./configure -D option. Without the change, the case crashed immediately. The error message is:
OBS NUDGING is requested on a total of  2 domain(s).
++++++CALL ERROB AT KTAU =     0 AND INEST =  1:  NSTA =     0 ++++++
At line 5741 of file module_dm.f90
Fortran runtime error: Index '1025' of dimension 1 of array 'idisplacement' above upper bound of 1024
Error termination. Backtrace:
#0  0x782093 in __module_dm_MOD_get_full_obs_vector
	at /glade/scratch/chenming/WRFHELP/WRFV3.9.1.1_intel_dmpar_large-file/frame/module_dm.f90:5741
#1  0xffffffffffffffff in ???
With the code change, the case can run successfully for 6 hours.

RELEASE NOTE: After removing a hard-coded limit for an assumed maximum number of MPI tasks, the observation nudging code for WRF now supports more than 1024 MPI tasks. If users previously ran the obs nudging code with 1024 or fewer MPI tasks, the original code is OK. However, if users tried to run obs nudging with > 1024 MPI tasks, likely the code died from a segmentation fault, while trying to access an address for an array index that was not available.
TYPE: bug fix

KEYWORDS: diff_6th_opt, restart

SOURCE: internal, reported by Jorge Navarro Instituto de Geociencias (UCM-CSIC) of Spain

DESCRIPTION OF CHANGES:
When diff_6th_opt is turned on, restart fails in producing bit-for-bit results in real-data (reported) as well as idealized cases. This is due to the start and end indices too close to the domain boundaries when doing 6th order horizontal diffusions. This is a bug since this option was put in in V3.1. Because of the loop indices are changed, the results from any run that uses this option will also change.

LIST OF MODIFIED FILES: list of changed files:
M dyn_em/module_big_step_utilities_em.F

TESTS CONDUCTED:
No regression test yet. But tested with real-data case, quarter_ss case with periodic and open boundary conditions, and b_wave case with symmetric boundary condition in y, the restart gives bit-for-bit results.

RELEASE NOTE:
Fixed a non bit-for-bit restart problem with diff_6th_opt option. The error was due to the start and end indices too close to the domain boundaries when doing 6th order horizontal diffusions. Because the loop indices are changed, the results from any run that uses this option will also change. This was a bug since this option was added to the model in V3.1. Thanks for Jorge Navarro for the initial report that let to the discovering of the bug.
TYPE: bug-fix

KEYWORDS: LES option, use_theta_m=1, V4.0 bug in surface flux fixed, calculate_N2 minor change

SOURCE: internal plus Xu Zhang (Shanghai Typhoon Institute)

DESCRIPTION OF CHANGES: 
When use_theta_m was updated to V4.0, diffusion was also applied to theta_m. However the surface flux was not modified to include a QFX term. This leads to a cooler PBL than in V3.9 with use_theta_m=1 and is incorrect. The fix is to add a QFX term that restores temperatures to correct values.

ISSUE: none posted

LIST OF MODIFIED FILES:
M       dyn_em/module_diffusion_em.F
M       dyn_em/module_first_rk_step_part2.F

TESTS CONDUCTED: 
No WTF yet. 
LES tests with fix have corrected the problem and give use_theta_m=1 results more like V3.9.1.
Theta profile plots show the cool anomaly with the old use_theta_m=1 (green) code compared to both the fixed version (red) and and use_theta_m=0 (blue). The fixed code shows more similarity with V3.9 too (not shown). The U profile shows more difference in the fixed code from the use_theta_m=0 case.
![profile](https://user-images.githubusercontent.com/17932284/50034495-52072500-ffba-11e8-9fa4-ecfe51869f22.png)


RELEASE NOTE: 
LES options in V4.0 with use_theta_m=1 (default) contained an error with surface fluxes leading to a cooler PBL. QFX term has been added to surface theta_m flux to correct this problem.
TYPE: bug fix

KEYWORDS: Stability N2 in LES

SOURCE: internal

DESCRIPTION OF CHANGES: 
calculate_N2 routine contains 1.61 instead of 0.61 when calculating moist version of N2. This has been since the beginning. Extremely small effect on results. Affects both use_theta_m=0 and 1.

ISSUE: no issue reported

LIST OF MODIFIED FILES: 
M       dyn_em/module_diffusion_em.F

TESTS CONDUCTED: 
No WTF. Compare use_theta_m=0 before and after (see fig of theta difference in LES case after 4 hours).

<img width="345" alt="screen shot 2018-12-17 at 9 32 13 am" src="https://user-images.githubusercontent.com/17932284/50101675-76444b00-01e0-11e9-9ccb-e680c1996ef1.png">
RELEASE NOTE: 
LES calculation of N2 slightly corrected. Very small effect.
TYPE: text only

KEYWORDS:
microphysics_driver, git compatibility

SOURCE: internal
DESCRIPTION OF CHANGES:
Reduce lines over 150 characters to less than 150 characters (2 comment lines only).
When git shows subroutines in its modification listing it is fooled by long lines.
This always shows up with mods in the microphysics_driver (e.g. see recent Jensen PR). There may be others.

ISSUE: none reported

LIST OF MODIFIED FILES:
M phys/module_microphysics_driver.F

TESTS CONDUCTED: None

RELEASE NOTE: None
TYPE: bug-fix revert

KEYWORDS: calculate_N2 in LES option

SOURCE: internal

DESCRIPTION OF CHANGES:
Turns out that 1.61qv is needed because later qv is subtracted as part of the calculation of N2.

ISSUE: none reported

LIST OF MODIFIED FILES:
M dyn_em/module_diffusion_em.F

TESTS CONDUCTED:
This is a return to the previous code. No test needed.

RELEASE NOTE:
(remove reference to calculate_N2 fix).
TYPE: bug-fix revert

KEYWORDS: calculate_N2 in LES option

SOURCE: internal

DESCRIPTION OF CHANGES:
Turns out that 1.61qv is needed because later qv is subtracted as part of the calculation of N2.

ISSUE: none reported

LIST OF MODIFIED FILES:
M dyn_em/module_diffusion_em.F

TESTS CONDUCTED:
This is a return to the previous code. No test needed.

RELEASE NOTE:
(remove reference to calculate_N2 fix).
This reverts commit a244741.
Reverts wrf-model#739
merged to incorrect branch
TYPE: text only

KEYWORDS: README, version_decl, release-v4.0.3

SOURCE: internal

DESCRIPTION OF CHANGES: Updated the README and inc/version_decl files to reflect the upcoming release version (4.0.3), and correct date (December 18, 2018)

LIST OF MODIFIED FILES:
M README
M inc/version_decl

TESTS CONDUCTED: None - text only
@letmaik letmaik requested a review from dmey January 5, 2019 14:54
For PRs originating from the source repository (= not forks) there is
still a Travis CI build for the branch which will set the necessary checks
for PRs. External PRs are unsupported due to lack of access to secrets
for pushing artifacts etc.
@letmaik letmaik merged commit 498e327 into wrf-cmake Jan 6, 2019
@letmaik letmaik deleted the letmaik/4.0.3 branch January 6, 2019 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet