Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Can't recompile WRF after minor changes to code

Rtsquared

New member
Hello,
I am trying to recompile WRFv4.5.2 on Derecho after making some small changes to module_bl_ysu.F. For some reason when both YSU and BEP-BEM are active, winds drop to nearly 0 in urban areas (see attached). At fault might be lines 1535-1538 of module_bl_ysu.F:

ad(i,k) = ad(i,k) - a_u2d(i,k)*dt2
ad1(i,k) = ad1(i,k) - a_v2d(i,k)*dt2
f1(i,k) = f1(i,k) + b_u2d(i,k)*dt2
f2(i,k) = f2(i,k) + b_v2d(i,k)*dt2
Where the first half is the already calculated momentum flux and the second half is the addition from bep-bem. I tried changing those lines to this:
if(a_u2d(i,k).and.a_v2d(i,k).ne.0.0) then
ad(i,k) = -a_u2d(i,k)*dt2
ad1(i,k) = -a_v2d(i,k)*dt2
f1(i,k) = b_u2d(i,k)*dt2
f2(i,k) = b_v2d(i,k)*dt2
endif
So that when there is data from bep-bem (in my case only the a_u2d and a_v2d parts exist because of my street directions) only that momentum flux is used instead of adding them together. I'm not sure if this will work to fix the problem, but I can't even test it because making this minor change prevents recompiling WRF (see log, I didn't let it complete once I saw the cascade of errors beginning). I can confirm that with the change reverted WRF compiles fine (option 78, default loaded modules).

The errors- showed up in console, but seemingly not the log:
module_pbl_driver.f90(162): error #7002: Error in opening the compiled module file. Check INCLUDE paths. [MODULE_BL_YSU]
USE module_bl_ysu
-------^
module_pbl_driver.f90(1168): error #6632: Keyword arguments are invalid without an explicit interface. [U3D]
U3D=u_phytmp,V3D=v_phytmp,TH3D=th_phy,T3D=t_phy &
---------------^
module_pbl_driver.f90(1168): error #6632: Keyword arguments are invalid without an explicit interface. [V3D]
U3D=u_phytmp,V3D=v_phytmp,TH3D=th_phy,T3D=t_phy &
----------------------------^
module_pbl_driver.f90(1168): error #6632: Keyword arguments are invalid without an explicit interface. [TH3D]
U3D=u_phytmp,V3D=v_phytmp,TH3D=th_phy,T3D=t_phy &
-----------------------------------------^
module_pbl_driver.f90(1168): error #6632: Keyword arguments are invalid without an explicit interface. [T3D]
U3D=u_phytmp,V3D=v_phytmp,TH3D=th_phy,T3D=t_phy &
-----------------------------------------------------^
module_pbl_driver.f90(1169): error #6632: Keyword arguments are invalid without an explicit interface. [QV3D]
,QV3D=qv_curr,QC3D=qc_curr,QI3D=qi_curr &
---------------^
module_pbl_driver.f90(1169): error #6632: Keyword arguments are invalid without an explicit interface. [QC3D]
,QV3D=qv_curr,QC3D=qc_curr,QI3D=qi_curr &
----------------------------^
module_pbl_driver.f90(1169): error #6632: Keyword arguments are invalid without an explicit interface. [QI3D]
,QV3D=qv_curr,QC3D=qc_curr,QI3D=qi_curr &
-----------------------------------------^
module_pbl_driver.f90(1170): error #6632: Keyword arguments are invalid without an explicit interface. [P3D]
,P3D=p_phy,P3DI=p8w,PI3D=pi_phy &
---------------^
module_pbl_driver.f90(1170): error #6632: Keyword arguments are invalid without an explicit interface. [P3DI]
,P3D=p_phy,P3DI=p8w,PI3D=pi_phy &
-------------------------^
module_pbl_driver.f90(1170): error #6632: Keyword arguments are invalid without an explicit interface. [PI3D]
,P3D=p_phy,P3DI=p8w,PI3D=pi_phy &
----------------------------------^
module_pbl_driver.f90(1171): error #6632: Keyword arguments are invalid without an explicit interface. [RUBLTEN]
,RUBLTEN=rublten,RVBLTEN=rvblten &
---------------^
module_pbl_driver.f90(1171): error #6632: Keyword arguments are invalid without an explicit interface. [RVBLTEN]
,RUBLTEN=rublten,RVBLTEN=rvblten &
-------------------------------^
module_pbl_driver.f90(1172): error #6632: Keyword arguments are invalid without an explicit interface. [RTHBLTEN]
,RTHBLTEN=rthblten,RQVBLTEN=rqvblten &
---------------^
module_pbl_driver.f90(1172): error #6632: Keyword arguments are invalid without an explicit interface. [RQVBLTEN]
,RTHBLTEN=rthblten,RQVBLTEN=rqvblten &
---------------------------------^
module_pbl_driver.f90(1173): error #6632: Keyword arguments are invalid without an explicit interface. [RQCBLTEN]
,RQCBLTEN=rqcblten,RQIBLTEN=rqiblten &
---------------^
module_pbl_driver.f90(1173): error #6632: Keyword arguments are invalid without an explicit interface. [RQIBLTEN]
,RQCBLTEN=rqcblten,RQIBLTEN=rqiblten &
---------------------------------^
module_pbl_driver.f90(1174): error #6632: Keyword arguments are invalid without an explicit interface. [FLAG_QI]
,FLAG_QI=flag_qi &
---------------^
module_pbl_driver.f90(1175): error #6632: Keyword arguments are invalid without an explicit interface. [CP]
,CP=cp,G=g,ROVCP=rcp,RD=r_D,ROVG=rovg &
---------------^
module_pbl_driver.f90(1175): error #6632: Keyword arguments are invalid without an explicit interface. [G]
,CP=cp,G=g,ROVCP=rcp,RD=r_D,ROVG=rovg &
---------------------^
module_pbl_driver.f90(1175): error #6632: Keyword arguments are invalid without an explicit interface. [ROVCP]
,CP=cp,G=g,ROVCP=rcp,RD=r_D,ROVG=rovg &
-------------------------^
module_pbl_driver.f90(1175): error #6632: Keyword arguments are invalid without an explicit interface. [RD]
,CP=cp,G=g,ROVCP=rcp,RD=r_D,ROVG=rovg &
-----------------------------------^
module_pbl_driver.f90(1175): error #6632: Keyword arguments are invalid without an explicit interface. [ROVG]
,CP=cp,G=g,ROVCP=rcp,RD=r_D,ROVG=rovg &
------------------------------------------^
module_pbl_driver.f90(1176): error #6632: Keyword arguments are invalid without an explicit interface. [DZ8W]
,DZ8W=dz8w,XLV=XLV,RV=r_v,PSFC=PSFC &
---------------^
module_pbl_driver.f90(1176): error #6632: Keyword arguments are invalid without an explicit interface. [XLV]
,DZ8W=dz8w,XLV=XLV,RV=r_v,PSFC=PSFC &
-------------------------^
module_pbl_driver.f90(1176): error #6632: Keyword arguments are invalid without an explicit interface. [RV]
,DZ8W=dz8w,XLV=XLV,RV=r_v,PSFC=PSFC &
---------------------------------^
module_pbl_driver.f90(1176): error #6632: Keyword arguments are invalid without an explicit interface. [PSFC]
,DZ8W=dz8w,XLV=XLV,RV=r_v,PSFC=PSFC &
----------------------------------------^
module_pbl_driver.f90(1177): error #6632: Keyword arguments are invalid without an explicit interface. [ZNT]
,ZNT=znt,UST=ust,HPBL=pblh &
---------------^
module_pbl_driver.f90(1177): error #6632: Keyword arguments are invalid without an explicit interface. [UST]
,ZNT=znt,UST=ust,HPBL=pblh &
-----------------------^
module_pbl_driver.f90(1177): error #6632: Keyword arguments are invalid without an explicit interface. [HPBL]
,ZNT=znt,UST=ust,HPBL=pblh &
-------------------------------^
module_pbl_driver.f90(2718): catastrophic error: Too many errors, exiting
compilation aborted for module_pbl_driver.f90 (code 1)

Any idea why this tiny change stops WRF from compiling (no option works)? How do I get WRF to compile with the change or something to the same effect?

Thanks,
Roger
 

Attachments

  • base BEM u10 after 6 hours.PNG
    base BEM u10 after 6 hours.PNG
    135.8 KB · Views: 1
  • compile.log
    788.2 KB · Views: 1
I've also tried a version using a where statement to create a masking array outside of the loop my original change is in, but get the same result. Why does changing a few lines like this kill everything?
 
Hi,
Apologies for the delay in response. Before we try to tackle this, as a test, can you try V4.6.0 to see if it makes a difference? There were a lot of code changes to the YSU scheme and BEP/BEM between V4.5.2 and V4.6.0.
 
Just did a test to see the difference and it looks like the 10-meter winds are a little lighter outside of urban areas in V4.6.0 but remain pretty similar within (about 0.5m/s for U10). It appears that one of the changes was that the majority of YSU was moved to /phys/physics_mmm/bl_ysu.f90, though the code where momentum is added from bep remains the same. I tried applying my potential fix to that code and have gotten the same result as before (see log, this time with all output).
 

Attachments

  • WRFv4.5.2 Pheonix U10 after 2 hours.PNG
    WRFv4.5.2 Pheonix U10 after 2 hours.PNG
    213.4 KB · Views: 0
  • WRFv4.5.2 Pheonix V10 after 2 hours.PNG
    WRFv4.5.2 Pheonix V10 after 2 hours.PNG
    130.8 KB · Views: 0
  • WRFv4.6.0 Pheonix U10 after 2 hours.PNG
    WRFv4.6.0 Pheonix U10 after 2 hours.PNG
    199.7 KB · Views: 0
  • WRFv4.6.0 Pheonix V10 after 2 hours.PNG
    WRFv4.6.0 Pheonix V10 after 2 hours.PNG
    123.1 KB · Views: 0
  • compile.log
    1,017.8 KB · Views: 1
The change is in lines 1367-1372 (the original file is a .F90, but that couldn't be uploaded). I also found a typo in the file from my earlier attempt to compile (one too many parenthesis in the if statement) but it had no effect on the outcome (most likely the new log is no different than the last).
 

Attachments

  • bl_ysu.F
    60.2 KB · Views: 4
  • compile.log
    1,017.9 KB · Views: 3
When I compare the bl_ysu.F file you shared with the default module_bl_ysu.F from V4.6.0, there are 29 differences in the two files, and many more that are not just simply the 6 lines you mention. Have you made additional modifications to this file, as well? Have you made any changes to other files? I would also like to see the module_bl_ysu.f90 file that's produced during compiling. If the issue is that the extension isn't accepted by this forum, just rename the file to module_bl_ysu.f90.txt and that should work. If it's too large to attach, take a look at the home page for this forum for instructions on sharing large files.
 
That is strange. I copied over the pre-compiled derecho codes and only changed those 6 lines in the way shown in my first post before trying to recompile it. I'd attach the compiled bl_ysu.f90 file for you to check (assuming it even compiled, I'm not sure it did) but right now when I try to log in I get told it is currently locked out to normal users (looking at it's status there are only 4 people currently logged in).

Wallis- I'm not sure the problem is limited to the merge of the ccpp code as I think that happened in V4.6.0 and I couldn't get it to recompile in V4.5.2 either.
 
I'd attach the compiled bl_ysu.f90 file for you to check (assuming it even compiled, I'm not sure it did) but right now when I try to log in I get told it is currently locked out to normal users (looking at it's status there are only 4 people currently logged in).
I'm sorry you're having trouble getting into your system. That's frustrating. When you are able to, I would like to advise that you post a new thread about this. I will be out of the office starting this afternoon, and won't be back until the end of June, so I don't want you to have to wait that long for help. Since I'm the support person who has been helping you, I'm the one who gets the notifications when you respond to this thread. If you start a new thread, the other support members will be able to see it and respond.
 
most likely the new log is no different than the last
They both look similar since the same module fails but the output from the compiler is very different The first one is as you noted, a typo in the if-statement:

Code:
physics_mmm/bl_ysu.f90(1360): error #5082: Syntax error, found IDENTIFIER 'THEN' when expecting one of: :: ) , : * <END-OF-STATEMENT> ; . (/ + - ] /) ' ** / // > PRIVATE ...
       if((a_u2d(i,k).and.a_v2d(i,k).ne.0.0) then
---------------------------------------------^
physics_mmm/bl_ysu.f90(1365): error #6317: An ENDIF occurred without a corresponding IF THEN or ELSE statement.
       endif
-------^

The other log is now just pointing to the calls & comparisons in the if-statement not having the correct types :
Code:
physics_mmm/bl_ysu.f90(1360): error #6385: The highest data type rank permitted is INTEGER(KIND=8).   [A_U2D]
       if(a_u2d(i,k).and.a_v2d(i,k).ne.0.0) then
----------^
physics_mmm/bl_ysu.f90(1360): error #6385: The highest data type rank permitted is INTEGER(KIND=8).
       if(a_u2d(i,k).and.a_v2d(i,k).ne.0.0) then
--------------------^
physics_mmm/bl_ysu.f90(1360): error #6341: A logical data type is required in this context.
       if(a_u2d(i,k).and.a_v2d(i,k).ne.0.0) then
--------------------^
 
Thanks for pointing that out, I had trouble finding anything of use in the log. It looks like this whole thing was me not knowing fortran well enough as I can now get it to compile after slightly changing the if statement. Now I need to figure out why WRF is only running for 10 seconds before crashing due to the change...
 
Top