[Dart-dev] DART/branches Revision: 12172

dart at ucar.edu dart at ucar.edu
Mon Dec 4 11:32:23 MST 2017


nancy at ucar.edu
2017-12-04 11:32:21 -0700 (Mon, 04 Dec 2017)
585
make several routines take an ensemble size and compute
multiple values in one call.

add staggering to the quad routines so you can get
2d fields underneath U and V locations.

start to streamline the height column routines and
supporting subroutines.

change the interface to the quad code for regular
grids.  return an array of 4 lon/lat indices, so
subsequent code can do i=1,4 and pick up the right
pairs of values in the right order, so when you call
the evaluate routine you have the field values in
the right order.

also add some doxygen and fix up some misleading
comments.




Modified: DART/branches/recam/models/cam-fv/model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/model_mod.f90	2017-12-04 17:26:20 UTC (rev 12171)
+++ DART/branches/recam/models/cam-fv/model_mod.f90	2017-12-04 18:32:21 UTC (rev 12172)
@@ -2,7 +2,7 @@
 ! by ucar, "as is", without charge, subject to all terms of use at
 ! http://www.image.ucar.edu/dares/dart/dart_download
 !
-! $id: new_model_mod.f90 12058 2017-11-07 16:42:42z nancy at ucar.edu $
+! $Id$
 !----------------------------------------------------------------
 !>
 !> this is the interface between the cam-fv atmosphere model and dart.
@@ -16,7 +16,7 @@
 !>further into writing the coded
 
 use             types_mod, only : MISSING_R8, MISSING_I, i8, r8, vtablenamelength, &
-                                  gravity  
+                                  gravity, DEG2RAD
 use      time_manager_mod, only : set_time, time_type, set_date, &
                                   set_calendar_type, get_date
 use          location_mod, only : location_type, set_vertical, set_location, &
@@ -53,8 +53,7 @@
                                    nc_close, nc_variable_exists
 !#!use       location_io_mod
 use        quad_utils_mod,  only : quad_interp_handle, init_quad_interp, &
-                                   set_quad_coords, &! finalize_quad_interp, &
-                                   !>@todo FIXME need to call finalize_quad_interp
+                                   set_quad_coords, finalize_quad_interp, &
                                    quad_lon_lat_locate, quad_lon_lat_evaluate, &
                                    GRID_QUAD_IRREG_SPACED_REGULAR,  &
                                    QUAD_LOCATED_CELL_CENTERS
@@ -101,6 +100,7 @@
 character(len=32)  :: vertical_localization_coord     = 'PRESSURE'
 integer            :: assimilation_period_days        = 0
 integer            :: assimilation_period_seconds     = 21600
+logical            :: use_log_vertical_scale          = .false.
 integer            :: no_assim_above_this_model_level = 5
 logical            :: use_damping_ramp_at_model_top   = .false.  
 integer            :: debug_level                     = 0
@@ -385,7 +385,7 @@
 real(r8),            intent(out) :: vals(ens_size)
 integer,             intent(out) :: my_status
 
-integer :: next_lat, next_lon, stagger
+integer :: next_lat, prev_lon, stagger
 real(r8) :: vals_bot(ens_size), vals_top(ens_size)
 
 stagger = grid_stagger%qty_stagger(stagger_qty)
@@ -395,24 +395,21 @@
 
 select case (stagger)
   case (STAGGER_U)
+   call stagger_quad(lon_index, lat_index, prev_lon, next_lat)
+
    call get_values_from_qty(ens_handle, ens_size, qty, lon_index, lat_index, lev_index, vals_bot, my_status)
+   call get_values_from_qty(ens_handle, ens_size, qty, lon_index, next_lat,  lev_index, vals_top, my_status)
 
-   next_lat = lat_index+1
-   if (next_lat > grid_data%lat%nsize) next_lat = grid_data%lat%nsize
-   call get_values_from_qty(ens_handle, ens_size, qty, lon_index, next_lat, lev_index, vals_top, my_status)
+   vals = (vals_bot + vals_top) * 0.5_r8
 
-   vals = (vals_bot + vals_top) / 2.0_r8
+  case (STAGGER_V)
+   call stagger_quad(lon_index, lat_index, prev_lon, next_lat)
 
-  case (STAGGER_V)
    call get_values_from_qty(ens_handle, ens_size, qty, lon_index, lat_index, lev_index, vals_bot, my_status)
+   call get_values_from_qty(ens_handle, ens_size, qty, prev_lon,  lat_index, lev_index, vals_top, my_status)
 
-   next_lon = lon_index-1
-   if (next_lon < 1) next_lon = grid_data%lon%nsize
-   call get_values_from_qty(ens_handle, ens_size, qty, next_lon, lat_index, lev_index, vals_top, my_status)
+   vals = (vals_bot + vals_top) * 0.5_r8
 
-   vals = (vals_bot + vals_top) / 2.0_r8
-   !print*, 'vals, vals_bot, vals_top', vals, vals_bot, vals_top
-
   ! no stagger - cell centers, or W stagger
   case default
    call get_values_from_qty(ens_handle, ens_size, qty, lon_index, lat_index, lev_index, vals, my_status)
@@ -643,7 +640,7 @@
 ! get the indices for the 4 corners of the quad in the horizontal, plus
 ! the fraction across the quad for the obs location
 call quad_lon_lat_locate(interp_handle, lon_lat_vert(1), lon_lat_vert(2) , &
-                         lon_bot, lat_bot, lon_top, lat_top, lon_fract, lat_fract, &
+                         four_lons, four_lats, lon_fract, lat_fract, &
                          status1)
 
 if (status1 /= 0) then
@@ -658,8 +655,9 @@
 !  (lon_bot, lat_bot), (lon_top, lat_bot), (lon_top, lat_top), (lon_bot, lat_top)
 ! stuff this info into arrays of length 4 so we can loop over them easier.
 
-call index_setup(lon_bot, lat_bot, lon_top, lat_top, lon_fract, lat_fract, &
-                 four_lons, four_lats, two_horiz_fracts)
+! changed interface to locate - remove me once this tests ok
+!call index_setup(lon_bot, lat_bot, lon_top, lat_top, lon_fract, lat_fract, &i
+!                 four_lons, four_lats, two_horiz_fracts)
 


More information about the Dart-dev mailing list