[Dart-dev] DART/branches Revision: 12056

dart at ucar.edu dart at ucar.edu
Mon Nov 6 17:05:43 MST 2017


nancy at ucar.edu
2017-11-06 17:05:42 -0700 (Mon, 06 Nov 2017)
174
fix the interfaces for the regular quad interp 
(still need to fix the test routines)

fleshed out more of the cam interp code.  NOT WORKING
and probably won't compile yet.




Modified: DART/branches/recam/models/cam-fv/new_model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/new_model_mod.f90	2017-11-06 23:58:52 UTC (rev 12055)
+++ DART/branches/recam/models/cam-fv/new_model_mod.f90	2017-11-07 00:05:42 UTC (rev 12056)
@@ -160,6 +160,7 @@
                             interp_u_staggered, &
                             interp_v_staggered
 
+
 contains
 
 
@@ -318,87 +319,172 @@
 !-----------------------------------------------------------------------
 !>
 !> Model interpolate will interpolate any DART state variable
-!> (i.e. S, T, U, V, Eta) to the given location given a state vector.
-!> The type of the variable being interpolated is obs_qty since
-!> normally this is used to find the expected value of an observation
-!> at some location. The interpolated value is returned in interp_vals
-!> and istatus is 0 for success. NOTE: This is a workhorse routine and is
-!> the basis for all the forward observation operator code.
+!> to the given location.
 !>
 !> @param state_handle DART ensemble handle
 !> @param ens_size DART ensemble size
 !> @param location the location of interest
 !> @param obs_qty the DART KIND of interest
-!> @param interp_val the estimated value of the DART state at the location
+!> @param interp_vals the estimated value of the DART state at the location
 !>          of interest (the interpolated value).
 !> @param istatus interpolation status ... 0 == success, /=0 is a failure
 !>
+!> istatus = 2    asked to interpolate an unknown/unsupported quantity
+!> istatus = 3    cannot locate horizontal quad
+!> istatus = 4    cannot locate enclosing vertical levels
+!> istatus = 5    cannot retrieve state vector values
+!> istatus = 6    cannot do vertical interpolation
+!> istatus = X
+!> istatus = 99   unknown error - shouldn't happen
+!>
 
-subroutine model_interpolate(state_handle, ens_size, location, obs_qty, interp_val, istatus)
+subroutine model_interpolate(state_handle, ens_size, location, obs_qty, interp_vals, istatus)
 
 type(ensemble_type), intent(in) :: state_handle
 integer,             intent(in) :: ens_size
 type(location_type), intent(in) :: location
 integer,             intent(in) :: obs_qty
+real(r8),           intent(out) :: interp_vals(ens_size) !< array of interpolated values
 integer,            intent(out) :: istatus(ens_size)
-real(r8),           intent(out) :: interp_val(ens_size) !< array of interpolated values
 
 integer  :: varid
 integer  :: lon_bot, lat_bot, lon_top, lat_top, lon_fract, lat_fract
-real(r8) :: lon_lat_vert(3)
+real(r8) :: lon_lat_vert(3), botvals(ens_size), topvals(ens_size)
+integer  :: which_vert, status, status1, status2, status_array(ens_size)
 type(quad_interp_handle) :: interp_handle
+integer  :: ijk(3)
+integer  :: four_lons(4), four_lats(4)
+integer  :: two_bots(2), two_tops(2)
+real(r8) :: two_horiz_fracts(2)
+integer  :: four_bot_levs(4, ens_size), four_top_levs(4, ens_size)
+real(r8) :: four_vert_fracts(4, ens_size)
+real(r8) :: quad_vals(4, ens_size)
 
 if ( .not. module_initialized ) call static_init_model
 
+! the overall strategy:
+! 1. figure out if the quantity to interpolate is
+! in the state.  if so, compute and return the value.
+! if not, is it something that is a simple function of
+! items in the state that we should compute here instead
+! of computing it in a separate forward operator?  ok, we'll
+! do it.. else error.
+! (if there *are* functions of state vars or others that we
+! need to compute here, put the rest of the interp code into
+! a separate subroutine for reuse.)
+! 2. compute the 4 horizontal i,j indices for the quad corners
+! that enclose the obs location.
+! 3. for each of the 4 quad corners compute the 2 vertical levels 
+! that enclose the obs in the vertical. also return the fraction
+! in the vertical - this needs a linear/log option.  (how set?)
+! 4. now we have 8 i,j,k index numbers and 3 fractions.
+! 5. compute the data values at each of the 4 horizontal i,j quad
+! corners, interpolating in the vertical using the k fraction
+! 6. compute the final horizontal obs value based on the i,j fractions
+
+
 ! Successful istatus is 0
-interp_val = MISSING_R8
-istatus    = 99
+interp_vals(:) = MISSING_R8
+istatus(:)    = 99
 
+! See if the state contains the obs quantity 
 varid = get_varid_from_kind(domain_id, obs_qty)
 
-if (varid < 0) then !>@todo FIXME there may be things we need to compute that
-                    !> has multiple variables involved


More information about the Dart-dev mailing list