Bug fix for HRLDAS urban array allocation with SF_URBAN_PHYSICS 2 and 3#241
Bug fix for HRLDAS urban array allocation with SF_URBAN_PHYSICS 2 and 3#241sashanksilwal wants to merge 16 commits into
Conversation
Sync with develop branch
Sync with Develop branch for bug fix
Sync with Develop branch for adding LIS driver folder
Sync with Develop branch for bug fix and new snow compaction
Sync with Develop branch
Merge develop branch for release of v5.1
Update RELEASE_NOTES for v5.1.0 release
Update README file for v5.1.0 release
Update RELEASE_NOTES.md
Update RELEASE_NOTES.md
version 5.1.1 release
Merge with Develop branch for v5.2.0
Update RELEASE_NOTES.md
tslin2
left a comment
There was a problem hiding this comment.
will also need to update HRLDAS driver codes
|
Thank you for identifying this issue. Instead of entirely removing the if-statement for SF_URBAN_PHYSICS = 1, I prefer identifying the variables shared by SF_URBAN_PHYSICS = 1-3 and then keep the if-statement for SF_URBAN_PHYSICS = 1 for those variables only used by SLUCM. |
There was a problem hiding this comment.
@sashanksilwal have you tested it? I am still getting error
I suggest we can revise codes in the module_sf_urban.f90 but not here, @cenlinhe how do you think
Because the issue happen in urban_param_init, urban_var_init, and noahmp_urban,
|
@tslin2 I do not suggest modifying module_sf_urban.F as these files should be as close as the version inside WRF model, so I would avoid additional code changes within module_sf_urban.F if it can be fixed on the noahmp part. However, if it cannot be fixed from the noahmp urban driver part only and it is indeed a bug inside module_sf_urban.F, then we can modify module_sf_urban.F. |
For example there is the issue below: Either change to IF (sf_urban_physics == 1) QC_URB2D(I,J)=0.01 for this line in module_sf_urban.F or need to allocate QC_URB2D in NoahmpIOVarInitMod.F90 Another example is https://github.com/NCAR/hrldas/blob/0dc57ea6cda02f89ca0eb8634ffcb3c5b55476a0/urban/wrf/module_sf_urban.F#L2826-L2840 can move to the loop inside IF ( sf_urban_physics == 1 ) THEN or allocate these four variables in NoahmpIOVarInitMod.F90 I think both method can fix this issue. |
|
OK, I see. I would recommend allocating those variables in NoahmpIOVarInitMod.F90 |
|
I submit a PR to fix this at #243 |
|
OK, I am closing this PR since the new PR #243 is submitted. |
In the HRLDAS driver's NoahmpIOVarInitMod.F90, urban arrays (e.g. TR_URB2D, QC_URB2D, DZR, DZB, DZG, TRL_URB3D) were only allocated and initialized inside the SF_URBAN_PHYSICS == 1 (SLUCM) block. These arrays are passed as non-optional arguments to urban_param_init, urban_var_init, and noahmp_urban, all called when SF_URBAN_PHYSICS > 0.
Issue I faced: Using BEP (SF_URBAN_PHYSICS=2) or BEM (SF_URBAN_PHYSICS=3) causes a segmentation fault due to unallocated arrays
Fix: remove the SF_URBAN_PHYSICS == 1 guards so these arrays are allocated/initialized for all urban modes. The WRF driver is unaffected as its equivalent section is disabled (if (0 == 1))