Open Peter9192 opened 3 months ago
I made a call graph to see how data flows through wrf into the urban scheme.
flowchart TD
subgraph init
start_domain --> |grid| start_domain_em
start_domain_em --> |urb2d| phy_init
phy_init --> |urb2d| bl_init
bl_init --> |urb2d| urban_var_init
bl_init --> |urb2d| urban_var_init
end
subgraph physics
solve_em --> |grid| first_rk_step_part1
first_rk_step_part1 --> |urb2d| surface_driver
surface_driver ==> |urb2d| clmdrv
clmdrv --> |urb0d init | urban
surface_driver ==> |urb2d| lsm
lsm --> |urb0d | urban
surface_driver ==> |urb2d| lsm_mosaic
lsm_mosaic --> |urb0d | urban
lsm_mosaic --> |urb0d | urban
surface_driver --> |urb2d| noahmp_urban
noahmp_urban --> |urb0d| urban
end
Notice that:
urban_var_init
gets 2d arraysurban
gets scalar values only, i.e. one grid point at a timeurban
have a block that maps from 2d to scalar just before the call (and for some vars also after it)grid
. The grid contains all state variables, so we don't have to worry about passing on parameters down the call tree until the individual variables are first dereferenced from the grid. Therefore I excluded the upper part of the call tree.clmdrv
sets most nudapt params to 0 (initial values??). The other callers of urban
set it to actual values from the input array. They seem to be copies of each other.urban
or urban_var_init
. Again, they seem to be copies of each other.More notes:
subroutine urban_var_init:
subroutine urban_param_init:
bl_init
subroutine read_param:
subroutine urban:
In this project we want to make it possible to pass spatially explicit fields for albedo and emissivity into the model.
This issue is an inventory of the steps needed to make that work.
geo_em
orwrfinput
files after running geogrid/metgrid.urban_param_init
: https://github.com/Urban-M4/WRF/blob/0a11865f97680fdd6865b278ea29d910e5db3ed7/phys/module_sf_urban.F#L2099-L2473 And the values for each grid point are then inferred in subroutineread_param
: https://github.com/Urban-M4/WRF/blob/0a11865f97680fdd6865b278ea29d910e5db3ed7/phys/module_sf_urban.F#L1998-L2000 To change this, I think the easiest option is to change the relevant lines (e.g. 914-919) to use a different variable, which could be added as one of the input (and output!?) variables to the model, similar to e.g. nudapt params here: https://github.com/Urban-M4/WRF/blob/0a11865f97680fdd6865b278ea29d910e5db3ed7/phys/module_sf_urban.F#L392-L402 These variables then also need to be added as input to the subroutine, not sure whether they are passed directly to the urban subroutine, similar to here: https://github.com/Urban-M4/WRF/blob/0a11865f97680fdd6865b278ea29d910e5db3ed7/phys/module_sf_urban.F#L319 or tourban_var_init
as in here https://github.com/Urban-M4/WRF/blob/0a11865f97680fdd6865b278ea29d910e5db3ed7/phys/module_sf_urban.F#L2592 They also need to be passed in where the corresponding subroutines are called, e.g. here https://github.com/Urban-M4/WRF/blob/0a11865f97680fdd6865b278ea29d910e5db3ed7/phys/module_physics_init.F#L3331so far so good. I'm gonna see how far I get with this.
TODO: compare Jisk/wudapt/nudapt approaches