Closed gutmann closed 2 years ago
Thanks for tracking that down. We need to allocate albedo data3d in the domain structure initialization. I thought that happened, but maybe it doesn’t if the albedovar name isn’t set.
On Aug 8, 2022, at 6:43 PM, Soren Rasmussen @.***> wrote:
@scrasmussen commented on this pull request.
In src/physics/ra_driver.f90:
@@ -239,7 +239,13 @@ subroutine rad(domain, options, dt, halo, subset) qs = 0
cldfra=0
- albedo=0.17
- if (options%lsm_options%monthly_albedo) then
- ALBEDO = domain%albedo%data_3d(:, domain%model_time%month, :)
- else
- ALBEDO = domain%albedo%data_3d(:, 1, :) The CI is failing here since with our test case domain%albedo%data_3d hasn't been allocated.
Maybe we add a check for if it hasn't been allocated
if else (.not. associated(domain%albedo%data_3d)) then ALBEDO = 0.17 else .... Or do something else?
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.
Thanks for tracking that down. We need to allocate albedo data3d in the domain structure initialization. I thought that happened, but maybe it doesn’t if the albedovar name isn’t set.
Ok, nice. I think then this simple addition is what we're looking for? Tested it and it ran correctly. I think it will give the results you want?
diff --git a/src/objects/domain_obj.f90 b/src/objects/domain_obj.f90
index 3de7396..3a79418 100644
--- a/src/objects/domain_obj.f90
+++ b/src/objects/domain_obj.f90
@@ -2065,7 +2065,7 @@ contains
kVARS%latitude, kVARS%longitude, &
kVARS%u_latitude, kVARS%u_longitude, &
kVARS%v_latitude, kVARS%v_longitude, &
- kVars%temperature_interface ])
+ kVars%temperature_interface, kVARS%albedo ])
for this section of code:
!> -------------------------------
!! Add variables needed by all domains to the list of requested variables
!!
!! -------------------------------
module subroutine var_request(this, options)
class(domain_t), intent(inout) :: this
type(options_t), intent(inout) :: options
! List the variables that are required to be allocated for any domain
call options%alloc_vars( &
[kVARS%z, kVARS%z_interface, &
kVARS%dz, kVARS%dz_interface, &
kVARS%u, kVARS%v, &
kVARS%surface_pressure, kVARS%roughness_z0, &
kVARS%terrain, kVARS%pressure, &
kVARS%temperature, kVARS%pressure_interface, &
kVARS%exner, kVARS%potential_temperature, &
kVARS%latitude, kVARS%longitude, &
kVARS%u_latitude, kVARS%u_longitude, &
kVARS%v_latitude, kVARS%v_longitude, &
kVars%temperature_interface, kVARS%albedo ])
The allocation of albedo is already requested by RRTMG, but it is not allocated for any other radiation (or lack of radiation) options. To fix this crash, I have moved the use of the albedo variable inside the RRTMG only section of the ra_driver code.
TYPE: enhancement
KEYWORDS: albedo, initial conditions, lsm, radiation
SOURCE: Ethan Gutmann, NCAR
DESCRIPTION OF CHANGES: This PR adds the ability to read a grid of seasonally varying albedo from the init_conditions (geo_em) file. Also fixes the ability to use seasonally varying green vegetation fraction (previously it was only using a single value)
ISSUE: n/a
TESTS CONDUCTED: Ran western US domain with time varying albedo and confirmed that the correct albedo values were being read in and used.
NOTES: Worth testing further that no harm was done to vegetation fraction or albedo when these parameters are not specified...