[Dart-dev] DART/branches Revision: 12340

dart at ucar.edu dart at ucar.edu
Tue Jan 16 15:50:29 MST 2018


nancy at ucar.edu
2018-01-16 15:50:27 -0700 (Tue, 16 Jan 2018)
220
still doesn't work - but needs something like this.
trying to convert state to pressure - if the state is
2d (like surface pressure) then we need to get the
pressure from the surface instead of from the pressure
field.




Modified: DART/branches/recam/models/cam-fv/model_mod.f90
===================================================================
--- DART/branches/recam/models/cam-fv/model_mod.f90	2018-01-16 22:26:40 UTC (rev 12339)
+++ DART/branches/recam/models/cam-fv/model_mod.f90	2018-01-16 22:50:27 UTC (rev 12340)
@@ -2918,17 +2918,28 @@
 integer(i8),         intent(in)    :: location_indx
 integer,             intent(in)    :: qty
 
-integer  :: iloc, jloc, vloc
+integer  :: iloc, jloc, vloc, myqty, level_one, status1
 integer  :: my_status(ens_size)
-real(r8) :: pressure_array(grid_data%lev%nsize)
+real(r8) :: pressure_array(grid_data%lev%nsize), surface_pressure(ens_size)
 
-call get_model_variable_indices(location_indx, iloc, jloc, vloc)
 
-call cam_pressure_levels(ens_handle, ens_size, iloc, jloc, grid_data%lev%nsize, &
-                         qty, pressure_array, my_status)
+call get_model_variable_indices(location_indx, iloc, jloc, vloc, kind_index=myqty)
 
-call set_vertical(location, pressure_array(vloc), VERTISPRESSURE)
+if (is_surface_field(myqty)) then
+   
+   level_one = 1
+   call get_staggered_values_from_qty(ens_handle, ens_size, QTY_SURFACE_PRESSURE, &
+                                      iloc, jloc, level_one, qty, surface_pressure, status1)
 
+   if (status1 /= 0) return
+   call set_vertical(location, surface_pressure(1), VERTISPRESSURE)
+else
+   call cam_pressure_levels(ens_handle, ens_size, iloc, jloc, grid_data%lev%nsize, &
+                            qty, pressure_array, my_status)
+
+   call set_vertical(location, pressure_array(vloc), VERTISPRESSURE)
+endif
+
 end subroutine state_vertical_to_pressure
 
 !--------------------------------------------------------------------
@@ -3640,6 +3651,16 @@
 
 !--------------------------------------------------------------------
 
+function is_surface_field(qty)
+integer, intent(in) :: qty
+logical :: is_surface_field
+
+is_surface_field = (qty == QTY_SURFACE_PRESSURE .or. qty == QTY_SURFACE_ELEVATION)
+   
+end function is_surface_field
+
+!--------------------------------------------------------------------
+
 !===================================================================
 ! End of model_mod
 !===================================================================


More information about the Dart-dev mailing list