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

New parameter: config_gvf_update #49

Merged
merged 11 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/core_atmosphere/Registry.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2227,6 +2227,11 @@
description="logical for configuration of sea-surface temperature"
possible_values=".true. for time-varying sea-surface temperatures; .false., otherwise"/>

<nml_option name="config_gvf_update" type="logical" default_value="true"
units="-"
description="logical for configuration of green vegetation fraction"
possible_values=".true. for time-varying green fraction; .false., otherwise"/>

<nml_option name="config_sstdiurn_update" type="logical" default_value="false"
units="-"
description="logical for configuration of diurnal cycle of sea-surface temperatures"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,14 +161,15 @@ subroutine physics_initialize_real(mesh, fg, dminfo, dims, configs)
if(landmask(iCell) .eq. 0) sfc_albbck(iCell) = 0.08_RKIND
enddo

if(nvegopt == 1) then ! clim from static
if(nvegopt == 1 .or. (minval(vegfra) == 0.0 .and. maxval(vegfra) == 0.0) ) then ! clim from static
!initialization of the green-ness (vegetation) fraction: interpolation of the monthly values to
!the initial date. get the min/max for each cell for the monthly green-ness fraction:
initial_date = trim(config_start_time)
call monthly_interp_to_date(nCellsSolve,initial_date,greenfrac,vegfra)

!calculates the maximum and minimum green-ness (vegetation) fraction:
call monthly_min_max(nCellsSolve,greenfrac,shdmin,shdmax)
if (nvegopt == 2) call mpas_log_write('--- WARNING: nevgopt=2, but there is no VEGFRA in the RAP/RRFS grib file')
endif

!initialization of the flag indicating the presence of snow (0 or 1) and of the snow depth
Expand Down
14 changes: 10 additions & 4 deletions src/core_atmosphere/physics/mpas_atmphys_manager.F
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ subroutine physics_timetracker(domain,dt,clock,itimestep,xtime_s)
config_o3climatology, &
config_sfc_albedo, &
config_sst_update, &
config_gvf_update, &
config_sstdiurn_update, &
config_deepsoiltemp_update

Expand Down Expand Up @@ -194,6 +195,7 @@ subroutine physics_timetracker(domain,dt,clock,itimestep,xtime_s)
call mpas_pool_get_config(domain%blocklist%configs,'config_o3climatology' ,config_o3climatology )
call mpas_pool_get_config(domain%blocklist%configs,'config_sfc_albedo' ,config_sfc_albedo )
call mpas_pool_get_config(domain%blocklist%configs,'config_sst_update' ,config_sst_update )
call mpas_pool_get_config(domain%blocklist%configs,'config_gvf_update' ,config_gvf_update )
call mpas_pool_get_config(domain%blocklist%configs,'config_sstdiurn_update' ,config_sstdiurn_update )
call mpas_pool_get_config(domain%blocklist%configs,'config_deepsoiltemp_update',config_deepsoiltemp_update)

Expand Down Expand Up @@ -231,7 +233,7 @@ subroutine physics_timetracker(domain,dt,clock,itimestep,xtime_s)
if(mpas_is_alarm_ringing(clock,greenAlarmID,ierr=ierr)) then
call mpas_reset_clock_alarm(clock,greenAlarmID,ierr=ierr)
call mpas_log_write('--- time to update background surface albedo, greeness fraction.')
call physics_update_surface(timeStamp,config_sfc_albedo,mesh,sfc_input,diag_physics)
call physics_update_surface(timeStamp,config_sfc_albedo,config_gvf_update,mesh,sfc_input,diag_physics)
endif

!update surface boundary conditions with input sea-surface temperatures and fractional
Expand Down Expand Up @@ -398,6 +400,7 @@ subroutine physics_run_init(configs,mesh,state,clock,stream_manager)
config_camrad_abs_update, &
config_greeness_update

logical,pointer:: config_gvf_update
logical,pointer:: config_sst_update
logical,pointer:: config_frac_seaice
logical,pointer:: config_microp_re
Expand Down Expand Up @@ -433,6 +436,7 @@ subroutine physics_run_init(configs,mesh,state,clock,stream_manager)
call mpas_pool_get_config(configs,'config_bucket_update' ,config_bucket_update )
call mpas_pool_get_config(configs,'config_camrad_abs_update',config_camrad_abs_update)
call mpas_pool_get_config(configs,'config_greeness_update' ,config_greeness_update )
call mpas_pool_get_config(configs,'config_gvf_update' ,config_gvf_update )
call mpas_pool_get_config(configs,'config_sst_update' ,config_sst_update )
call mpas_pool_get_config(configs,'config_frac_seaice' ,config_frac_seaice )
call mpas_pool_get_config(configs,'config_microp_re' ,config_microp_re )
Expand Down Expand Up @@ -547,11 +551,13 @@ subroutine physics_run_init(configs,mesh,state,clock,stream_manager)
endif

!set alarm for updating the background surface albedo and the greeness fraction:
call mpas_set_timeInterval(alarmTimeStep,timeString=config_greeness_update,ierr=ierr)
alarmStartTime = startTime
call mpas_add_clock_alarm(clock,greenAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
if (config_gvf_update) then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tanyasmirnova this if block seems unnecessary now and maybe even not working correctly if you want to update albedo and not vegetation, in that case greenAlarmID needs to be set and ringing

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barlage To begin with, it is a very bad set-up to do albedo and greenness updating connected to each other. Our situation proves it not robust, because we treat greenness in a special way. I would rewrite surface updating but as you said there wil be more issues with merging in future.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I chose the least invasive solution to get the real-time greenness vegetation fraction from the parent model to MPAS. I see some problems in MPAS with surface updating, but my understanding that we are not supposed to change any of their code, it is "untouchable" because of future commits. Therefore, I added a new config_gvf_update parameter to achieve our goal.

@tanyasmirnova this if block seems unnecessary now and maybe even not working correctly if you want to update albedo and not vegetation, in that case greenAlarmID needs to be set and ringing

I have removed the if(config_gvf_update) from line 554. So - the "green" alarm will be still created, but I pass config_gvf_update into physics_update_surface, and when it is set to false, the GVF will not be overwritten with climatology, but background albedo will be created. At initial forecast time surface_update repeats what was already done in mpas_atmphys_initialize_real.F at the INIT step. Therefore, background albedo was already computed. And we do not want update the background albedo in our MPAS runs. The actual albedo will be updated for grid points covered with snow. In RRFS we also update it for low solar angles, but so far not in MPAS.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@barlage Mike, could you please revisit my PR. I think I took into account all your comments and the PR should be ready to merge. Thank you.

call mpas_set_timeInterval(alarmTimeStep,timeString=config_greeness_update,ierr=ierr)
alarmStartTime = startTime
call mpas_add_clock_alarm(clock,greenAlarmID,alarmStartTime,alarmTimeStep,ierr=ierr)
if(ierr /= 0) &
call physics_error_fatal('subroutine physics_init: error creating alarm greeness')
endif

!set alarm for updating the surface boundary conditions:
if (config_sst_update) then
Expand Down
9 changes: 6 additions & 3 deletions src/core_atmosphere/physics/mpas_atmphys_update_surface.F
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ module mpas_atmphys_update_surface


!=================================================================================================================
subroutine physics_update_surface(current_date,config_sfc_albedo,mesh,sfc_input,diag_physics)
subroutine physics_update_surface(current_date,config_sfc_albedo,config_gvf_update,mesh,sfc_input,diag_physics)
!=================================================================================================================

!input variables:
type(mpas_pool_type),intent(in):: mesh
character(len=*),intent(in):: current_date
logical,intent(in):: config_sfc_albedo
logical,intent(in):: config_gvf_update

!inout variables:
type(mpas_pool_type),intent(inout):: sfc_input
Expand Down Expand Up @@ -110,8 +111,10 @@ subroutine physics_update_surface(current_date,config_sfc_albedo,mesh,sfc_input,
!updates the green-ness fraction for the current date as a function of the monthly-mean green-
!ness valid on the 15th day of the month. get the min/max for each cell for the monthly green-
!ness fraction:
call monthly_interp_to_date(nCellsSolve,current_date,greenfrac,vegfra)
call monthly_min_max(nCellsSolve,greenfrac,shdmin,shdmax)
if(config_gvf_update) then
call monthly_interp_to_date(nCellsSolve,current_date,greenfrac,vegfra)
call monthly_min_max(nCellsSolve,greenfrac,shdmin,shdmax)
endif

!updates the leaf area index for the current date as a function of the leaf area index
!valid on the 15th day of the month :
Expand Down