Closed GreyREvenson closed 7 months ago
Tagging @SnowHydrology and @andywood is case you'd like to provide input/feedback on this PR's general approach.
@andywood previously wrote that 'In Fortran the ability to read large chunks at once is really valuable. The huge thing to avoid is unnecessary file open/close/inquire/read/write operations -- so we hopefully want to facilitate this.' This PR has the program reading in the whole of any given forcings file in one-go, which I believe takes advantage of Fortran's relative strength in reading in large arrays. However, the approach could be problematic if the user doesn't have the computing resources to read-in such a large file.
This PR is an optimization that reduces the number of times that a call that advances the model simulation time is invoked.
Purpose
This PR adds capacity to read-in gridded forcings when executed in standalone (i.e., outside of NextGen).
Additions
ReadForcings
andSetForcings
. These subroutines were added toforcinggrid_type
inForcingGridType.f90
.ReadForcings
subroutine finds/opens/reads the forcing file for an argument date. The forcings are read-into newly added 'read' arrays (e.g.,forcingsgrid_type%read_pcprate
holds read-in values for precipitate forcings).SetForcings
subroutine transfers forcing values from the added 'read' arrays to theforcinggrid_type
arrays that hold forcings for the current time step (e.g., values inforcingsgrid_type%read_pcprate
are transferred toforcingsgrid_type%PRCP
).Changes
domaingrid_type%nowdate
was calculated within a call toUtilitiesMain
viasolve_noahowp
.domaingrid_type%nowdate
was therefore recalculated for every grid cell. After this PR,domaingrid_type%nowdate
is calculated with a call toadvance_in_time
(inRunModule.f90
), which facilitates passingdomaingrid_type%nowdate
as an argument to the newly addedReadForcings
andSetForcings
subroutines and prevent the unnecessary recalculation ofdomaingrid_type%nowdate
with every grid cell.Testing