[Dart-dev] [9541] DART/trunk: merging trunk_with_cam_style back into the trunk.

nancy at ucar.edu nancy at ucar.edu
Fri Jan 15 17:09:40 MST 2016


Revision: 9541
Author:   hendric
Date:     2016-01-15 17:09:40 -0700 (Fri, 15 Jan 2016)
Log Message:
-----------
merging trunk_with_cam_style back into the trunk.  

Notes from Kevin:

This is expected to be the last commit of the old code style model_mod.f90.
The next version will have extensive style changes, but bit-for-bit agreement
with this one.

It has important fixes for errors in model_heights, etc., which were introduced
in the upgrade from using the nearest grid point for calculating heights on model
levels to interpolating to the ob location.  There was an extra division of
the surface geopotential by grav.  There was also an error in the conversion from
a 'do while' loop to a 'do ... ; if' structure when searching for the bounding
heights of an ob at a height.

These had no effect on assimilations of obs which were not on heights,
and at worst resulted in obs on heights being ignored when they shouldn't
have been.

Notes from Johnny:

Bitwise tested to the trunk with FV and SE with both vert_coord=pressure and log_invP.
Assimilated with GPSRO_REFRACTIVITY observations and used large observation
sequence files and full ensembles.

Modified Paths:
--------------
    DART/trunk/models/cam/model_mod.f90

Property Changed:
----------------
    DART/trunk/
    DART/trunk/adaptive_inflate/
    DART/trunk/assim_tools/
    DART/trunk/assim_tools/assim_tools_mod.f90
    DART/trunk/doc/html/history/Fiji_release.html
    DART/trunk/doc/html/history/Guam_release.html
    DART/trunk/doc/html/history/I_diffs_from_workshop.html
    DART/trunk/doc/html/history/Iceland_release.html
    DART/trunk/doc/html/history/Jamaica_diffs_from_I.html
    DART/trunk/doc/html/history/Jamaica_release.html
    DART/trunk/doc/html/history/PostI_diffs_from_I.html
    DART/trunk/doc/html/history/Post_Iceland_release.html
    DART/trunk/doc/html/history/hawaii_release.html
    DART/trunk/doc/html/history/pre_guam_release.html
    DART/trunk/doc/html/history/pre_hawaii_release.html
    DART/trunk/doc/html/history/pre_j_release.html
    DART/trunk/matlab/GetClmInfo.m
    DART/trunk/models/ROMS/
    DART/trunk/models/bgrid_solo/model_mod.f90
    DART/trunk/models/cam/
    DART/trunk/models/cam/doc/
    DART/trunk/models/cam/shell_scripts/CESM_DART_config
    DART/trunk/models/cam/shell_scripts/assimilate.csh
    DART/trunk/models/cam/shell_scripts/perfect_model.csh
    DART/trunk/models/wrf/model_mod.f90
    DART/trunk/obs_kind/DEFAULT_obs_kind_mod.F90
    DART/trunk/observations/MADIS/
    DART/trunk/observations/NCEP/ascii_to_obs/real_obs_mod.f90
    DART/trunk/utilities/
    DART/trunk/utilities/closest_member_tool.f90

-------------- next part --------------

Property changes on: DART/trunk
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development:4680-6255
/DART/branches/gitm:5143-6215
/DART/branches/gitm_lanai:6571-6652
/DART/branches/helen:5995-6161
   + /DART/branches/development:4680-6255
/DART/branches/gitm:5143-6215
/DART/branches/gitm_lanai:6571-6652
/DART/branches/helen:5995-6161
/DART/branches/trunk_with_cam_style:9473-9540


Property changes on: DART/trunk/adaptive_inflate
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/cam/adaptive_inflate:6639-7729
/DART/branches/development/adaptive_inflate:4680-6255
/DART/branches/gitm/adaptive_inflate:5143-6215
/DART/branches/gitm_lanai/adaptive_inflate:6571-6652
/DART/branches/helen/adaptive_inflate:5995-6161
/DART/branches/inf_restart:4784-4812
   + /DART/branches/cam/adaptive_inflate:6639-7729
/DART/branches/development/adaptive_inflate:4680-6255
/DART/branches/gitm/adaptive_inflate:5143-6215
/DART/branches/gitm_lanai/adaptive_inflate:6571-6652
/DART/branches/helen/adaptive_inflate:5995-6161
/DART/branches/inf_restart:4784-4812
/DART/branches/trunk_with_cam_style/adaptive_inflate:9473-9540


Property changes on: DART/trunk/assim_tools
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/cam/assim_tools:6639-7729
/DART/branches/development/assim_tools:4680-6255
/DART/branches/gitm/assim_tools:5143-6215
/DART/branches/gitm_lanai/assim_tools:6571-6652
/DART/releases/Kodiak/assim_tools:5292-5577
   + /DART/branches/cam/assim_tools:6639-7729
/DART/branches/development/assim_tools:4680-6255
/DART/branches/gitm/assim_tools:5143-6215
/DART/branches/gitm_lanai/assim_tools:6571-6652
/DART/branches/trunk_with_cam_style/assim_tools:9473-9540
/DART/releases/Kodiak/assim_tools:5292-5577


Property changes on: DART/trunk/assim_tools/assim_tools_mod.f90
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/ROMS/assim_tools/assim_tools_mod.f90:5084-9438
/DART/branches/cam/assim_tools/assim_tools_mod.f90:6639-7729
/DART/branches/development/assim_tools/assim_tools_mod.f90:4680-6255
/DART/branches/gitm/assim_tools/assim_tools_mod.f90:5143-6215
/DART/branches/gitm_lanai/assim_tools/assim_tools_mod.f90:6571-6652
/DART/branches/helen/assim_tools/assim_tools_mod.f90:5995-6161
/DART/releases/Kodiak/assim_tools/assim_tools_mod.f90:5020-5583
   + /DART/branches/ROMS/assim_tools/assim_tools_mod.f90:5084-9438
/DART/branches/cam/assim_tools/assim_tools_mod.f90:6639-7729
/DART/branches/development/assim_tools/assim_tools_mod.f90:4680-6255
/DART/branches/gitm/assim_tools/assim_tools_mod.f90:5143-6215
/DART/branches/gitm_lanai/assim_tools/assim_tools_mod.f90:6571-6652
/DART/branches/helen/assim_tools/assim_tools_mod.f90:5995-6161
/DART/branches/trunk_with_cam_style/assim_tools/assim_tools_mod.f90:9473-9540
/DART/releases/Kodiak/assim_tools/assim_tools_mod.f90:5020-5583


Property changes on: DART/trunk/doc/html/history/Fiji_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/Fiji_release.html:4680-6255
/DART/branches/gitm/doc/html/Fiji_release.html:5143-6215
/DART/branches/helen/doc/html/Fiji_release.html:5995-6161
   + /DART/branches/development/doc/html/Fiji_release.html:4680-6255
/DART/branches/gitm/doc/html/Fiji_release.html:5143-6215
/DART/branches/helen/doc/html/Fiji_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/Fiji_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/Guam_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/Guam_release.html:4680-6255
/DART/branches/gitm/doc/html/Guam_release.html:5143-6215
/DART/branches/helen/doc/html/Guam_release.html:5995-6161
   + /DART/branches/development/doc/html/Guam_release.html:4680-6255
/DART/branches/gitm/doc/html/Guam_release.html:5143-6215
/DART/branches/helen/doc/html/Guam_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/Guam_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/I_diffs_from_workshop.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/I_diffs_from_workshop.html:4680-6255
/DART/branches/gitm/doc/html/I_diffs_from_workshop.html:5143-6215
/DART/branches/helen/doc/html/I_diffs_from_workshop.html:5995-6161
   + /DART/branches/development/doc/html/I_diffs_from_workshop.html:4680-6255
/DART/branches/gitm/doc/html/I_diffs_from_workshop.html:5143-6215
/DART/branches/helen/doc/html/I_diffs_from_workshop.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/I_diffs_from_workshop.html:9473-9540


Property changes on: DART/trunk/doc/html/history/Iceland_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/Iceland_release.html:4680-6255
/DART/branches/gitm/doc/html/Iceland_release.html:5143-6215
/DART/branches/helen/doc/html/Iceland_release.html:5995-6161
   + /DART/branches/development/doc/html/Iceland_release.html:4680-6255
/DART/branches/gitm/doc/html/Iceland_release.html:5143-6215
/DART/branches/helen/doc/html/Iceland_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/Iceland_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/Jamaica_diffs_from_I.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/Jamaica_diffs_from_I.html:4680-6255
/DART/branches/gitm/doc/html/Jamaica_diffs_from_I.html:5143-6215
/DART/branches/helen/doc/html/Jamaica_diffs_from_I.html:5995-6161
   + /DART/branches/development/doc/html/Jamaica_diffs_from_I.html:4680-6255
/DART/branches/gitm/doc/html/Jamaica_diffs_from_I.html:5143-6215
/DART/branches/helen/doc/html/Jamaica_diffs_from_I.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/Jamaica_diffs_from_I.html:9473-9540


Property changes on: DART/trunk/doc/html/history/Jamaica_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/Jamaica_release.html:4680-6255
/DART/branches/gitm/doc/html/Jamaica_release.html:5143-6215
/DART/branches/helen/doc/html/Jamaica_release.html:5995-6161
   + /DART/branches/development/doc/html/Jamaica_release.html:4680-6255
/DART/branches/gitm/doc/html/Jamaica_release.html:5143-6215
/DART/branches/helen/doc/html/Jamaica_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/Jamaica_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/PostI_diffs_from_I.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/PostI_diffs_from_I.html:4680-6255
/DART/branches/gitm/doc/html/PostI_diffs_from_I.html:5143-6215
/DART/branches/helen/doc/html/PostI_diffs_from_I.html:5995-6161
   + /DART/branches/development/doc/html/PostI_diffs_from_I.html:4680-6255
/DART/branches/gitm/doc/html/PostI_diffs_from_I.html:5143-6215
/DART/branches/helen/doc/html/PostI_diffs_from_I.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/PostI_diffs_from_I.html:9473-9540


Property changes on: DART/trunk/doc/html/history/Post_Iceland_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/Post_Iceland_release.html:4680-6255
/DART/branches/gitm/doc/html/Post_Iceland_release.html:5143-6215
/DART/branches/helen/doc/html/Post_Iceland_release.html:5995-6161
   + /DART/branches/development/doc/html/Post_Iceland_release.html:4680-6255
/DART/branches/gitm/doc/html/Post_Iceland_release.html:5143-6215
/DART/branches/helen/doc/html/Post_Iceland_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/Post_Iceland_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/hawaii_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/hawaii_release.html:4680-6255
/DART/branches/gitm/doc/html/hawaii_release.html:5143-6215
/DART/branches/helen/doc/html/hawaii_release.html:5995-6161
   + /DART/branches/development/doc/html/hawaii_release.html:4680-6255
/DART/branches/gitm/doc/html/hawaii_release.html:5143-6215
/DART/branches/helen/doc/html/hawaii_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/hawaii_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/pre_guam_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/pre_guam_release.html:4680-6255
/DART/branches/gitm/doc/html/pre_guam_release.html:5143-6215
/DART/branches/helen/doc/html/pre_guam_release.html:5995-6161
   + /DART/branches/development/doc/html/pre_guam_release.html:4680-6255
/DART/branches/gitm/doc/html/pre_guam_release.html:5143-6215
/DART/branches/helen/doc/html/pre_guam_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/pre_guam_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/pre_hawaii_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/pre_hawaii_release.html:4680-6255
/DART/branches/gitm/doc/html/pre_hawaii_release.html:5143-6215
/DART/branches/helen/doc/html/pre_hawaii_release.html:5995-6161
   + /DART/branches/development/doc/html/pre_hawaii_release.html:4680-6255
/DART/branches/gitm/doc/html/pre_hawaii_release.html:5143-6215
/DART/branches/helen/doc/html/pre_hawaii_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/pre_hawaii_release.html:9473-9540


Property changes on: DART/trunk/doc/html/history/pre_j_release.html
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/doc/html/pre_j_release.html:4680-6255
/DART/branches/gitm/doc/html/pre_j_release.html:5143-6215
/DART/branches/helen/doc/html/pre_j_release.html:5995-6161
   + /DART/branches/development/doc/html/pre_j_release.html:4680-6255
/DART/branches/gitm/doc/html/pre_j_release.html:5143-6215
/DART/branches/helen/doc/html/pre_j_release.html:5995-6161
/DART/branches/trunk_with_cam_style/doc/html/history/pre_j_release.html:9473-9540


Property changes on: DART/trunk/matlab/GetClmInfo.m
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/ROMS/matlab/GetClmInfo.m:7093-9438
/DART/branches/cam/matlab/GetClmInfo.m:6639-7729
/DART/branches/development/matlab/GetClmInfo.m:4680-5731
/DART/branches/gitm_lanai/matlab/GetClmInfo.m:6571-6652
/DART/branches/helen/matlab/GetClmInfo.m:5995-6161
   + /DART/branches/ROMS/matlab/GetClmInfo.m:7093-9438
/DART/branches/cam/matlab/GetClmInfo.m:6639-7729
/DART/branches/development/matlab/GetClmInfo.m:4680-5731
/DART/branches/gitm_lanai/matlab/GetClmInfo.m:6571-6652
/DART/branches/helen/matlab/GetClmInfo.m:5995-6161
/DART/branches/trunk_with_cam_style/matlab/GetClmInfo.m:9473-9540


Property changes on: DART/trunk/models/ROMS
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/development/models/ROMS:4680-6255
/DART/branches/gitm/models/ROMS:5143-6215
/DART/branches/gitm_lanai/models/ROMS:6571-6652
/DART/branches/helen/models/ROMS:5995-6161
/DART/trunk/models/ROMS:5084-9436
   + /DART/branches/development/models/ROMS:4680-6255
/DART/branches/gitm/models/ROMS:5143-6215
/DART/branches/gitm_lanai/models/ROMS:6571-6652
/DART/branches/helen/models/ROMS:5995-6161
/DART/branches/trunk_with_cam_style/models/ROMS:9473-9540
/DART/trunk/models/ROMS:5084-9436


Property changes on: DART/trunk/models/bgrid_solo/model_mod.f90
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/ROMS/models/bgrid_solo/model_mod.f90:5084-9438
/DART/branches/cam/models/bgrid_solo/model_mod.f90:6639-7729
/DART/branches/development/models/bgrid_solo/model_mod.f90:4680-6255
/DART/branches/gitm/models/bgrid_solo/model_mod.f90:5143-6215
/DART/branches/gitm_lanai/models/bgrid_solo/model_mod.f90:6571-6652
/DART/branches/helen/models/bgrid_solo/model_mod.f90:5995-6161
   + /DART/branches/ROMS/models/bgrid_solo/model_mod.f90:5084-9438
/DART/branches/cam/models/bgrid_solo/model_mod.f90:6639-7729
/DART/branches/development/models/bgrid_solo/model_mod.f90:4680-6255
/DART/branches/gitm/models/bgrid_solo/model_mod.f90:5143-6215
/DART/branches/gitm_lanai/models/bgrid_solo/model_mod.f90:6571-6652
/DART/branches/helen/models/bgrid_solo/model_mod.f90:5995-6161
/DART/branches/trunk_with_cam_style/models/bgrid_solo/model_mod.f90:9473-9540


Property changes on: DART/trunk/models/cam
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/cam-update:4903-4923
/DART/branches/development/models/cam:4680-6255
/DART/branches/gitm/models/cam:5143-6215
/DART/branches/gitm_lanai/models/cam:6571-6652
/DART/branches/helen/models/cam:5995-6161
   + /DART/branches/cam-update:4903-4923
/DART/branches/development/models/cam:4680-6255
/DART/branches/gitm/models/cam:5143-6215
/DART/branches/gitm_lanai/models/cam:6571-6652
/DART/branches/helen/models/cam:5995-6161
/DART/branches/trunk_with_cam_style/models/cam:9473-9540


Property changes on: DART/trunk/models/cam/doc
___________________________________________________________________
Modified: svn:mergeinfo
   - /DART/branches/cam/models/cam/doc:6639-7899
/DART/branches/cam-update/doc:4903-4923
/DART/branches/development/models/cam/doc:4680-6255
/DART/branches/gitm/models/cam/doc:5143-6215
/DART/branches/gitm_lanai/models/cam/doc:6571-6652
/DART/branches/helen/models/cam/doc:5995-6161
   + /DART/branches/cam/models/cam/doc:6639-7899
/DART/branches/cam-update/doc:4903-4923
/DART/branches/development/models/cam/doc:4680-6255
/DART/branches/gitm/models/cam/doc:5143-6215
/DART/branches/gitm_lanai/models/cam/doc:6571-6652
/DART/branches/helen/models/cam/doc:5995-6161
/DART/branches/trunk_with_cam_style/models/cam/doc:9473-9540

Modified: DART/trunk/models/cam/model_mod.f90
===================================================================
--- DART/trunk/models/cam/model_mod.f90	2016-01-15 22:03:26 UTC (rev 9540)
+++ DART/trunk/models/cam/model_mod.f90	2016-01-16 00:09:40 UTC (rev 9541)
@@ -1,34 +1,79 @@
 ! DART software - Copyright 2004 - 2013 UCAR. This open source software is
 ! provided by UCAR, "as is", without charge, subject to all terms of use at
 ! http://www.image.ucar.edu/DAReS/DART/DART_download
-!
+
 ! $Id$
 
+
+!>  This is the interface module between DART and the atmospheric components of CESM; 
+!>  CAM, WACCM, CAM-Chem (, ...?).  
+!>  It contains the required 16 interface procedures, as specified by DART.  
+!>  It also contains several utility routines which help translate between CAM and DART 
+!>  formats, and deal with time.
+!>  It is used by filter, perfect_model_obs, $dart/models/cam/{cam_to_dart,dart_to_cam}.
+!>
+!>  This module handles all of the eulerian, finite volume, and spectral element (HOMME)
+!>  dynamical core versions of CAM.  The first two have logically rectangular grids,
+!>  while CAM-SE uses the cubed sphere (non-rectangular) horizontal grid.
+!>
+!>  It contains a perturburbation routine for generating initial ensembles,
+!>  but does not provide adv_1step or init_conditions because CAM is a separate executable
+!>  and cannot be called as a subroutine.
+!>
+!>  This module intercepts the get_close_obs() calls and can alter the distances
+!>  for obs near the top of the model to reduce the impact on the state near the
+!>  top.
+!>
+!>  The coordinate orders of fields stored in various forms have also been simplified.
+!>  For example; various vintages of CAM 3D fields may be read in with (lon, lat, lev) or
+!>  (lon, lev, lat).  These are uniformly converted to (lev, lon, lat) for use in model_mod.
+!>  This latter form is different than pre MPI model_mods.  Then such fields are stored in
+!>  the state vector with the same coordinate order.  They are converted to the *modern*
+!>  CAM coordinate order when written to caminput.nc files.
+!>
+!>  If a user wants to add new TYPE_s to the state vector,
+!>  then more KIND_s may be needed in the obs_kind_mod and the 'use obs_kind_mod' statement.
+!> 
+!>  Observations below the lowest model level (including surface observations) and above
+!>  the highest model level cannot be assimilated (yet).  The spatial extent of observations
+!>  can be further restricted using model_nml namelist variables.
+!> 
+!>  MODULE ORGANIZATION (search for the following strings to find the corresponding section)
+!>
+!>      'use' statements
+!>       Global storage for describing cam model class
+!>       Namelist variables with default values
+!>       Derived parameters
+!>       static_init_model section
+!>       Module I/O to/from DART and files
+!>       model_interpolate section
+!>       Vector-field translations
+!>       get_close_obs section
+!>       Utility routines; called by several main subroutines
+!>       Stubs not used by cam/model_mod (this is not all of them)
+!>
+!>  See the subversion code logs for history of this module.
+!>  There is an html description of this module in ./model_mod.html.
+!>
+
 module model_mod
 
-! See 'Better damping' for the fix of the high level innovation damping algorithm.
+! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
-! See /glade/u/home/raeder/DART/Pre_lanai/models/cam for a version which is consistent
-! with the DART style guide.
+! CONTRIBUTORS  (aside from the DART team)
 
-!----------------------------------------------------------------------
-! Interface code between CAM and DART.  Contains the required 16 interfaces
-!  as specified by DART.  Also contains several utility routines which help
-!  translate between CAM and DART formats, and deal with time.
-!
-!  Contains a perturb routine for generating initial ensembles.  Does not
-!  provide adv_1step or init_conditions because CAM is a separate executable
-!  and cannot be called as a subroutine.
-!
-!  This module intercepts the get_close_obs() calls and can alter the distances
-!  for obs near the top of the model to reduce the impact on the state near the
-!  top.
-!
+!  Ave Arellano did the first work with CAM-Chem, assimilating MOPPITT CO observations
+!  into CAM-Chem using the FV core.  Jerome Barre and Benjamin Gaubert took up the development
+!  work from Ave, and prompted several additions to DART, as well as cam/model_mod.
+
+!  Nick Pedatella developed the first vert_coord = 'log_invP' capability
+!  to enable assimilation using WACCM and scale height vertical locations.
+
+! NOTES about the module.
+
 !  This module keeps a copy of the ensemble mean in module global storage and
 !  uses it for computing the pressure-to-height conversions.
 !
-!  See the subversion code logs for history of this module.
-!
 !  During the assimilation stage, only a piece of the state vector is available to each
 !  process, and each process calls parts of model_mod.  In order to handle the conversion
 !  of vertical coordinates of obs and/or state variables into a consistent coordinate,
@@ -39,18 +84,12 @@
 !  vertical location to that of the ob.  The highest_obs_level and ..._height_m variables 
 !  are derived from highest_obs_pressure_Pa namelist variable.
 !
-!  This module has been updated to handle both the eulerian and finite volume core versions
-!  of CAM (they have different logically rectangular grids),
-!  and the HOMME dynamical core of Spectral Element CAM which uses the cubed sphere
-!  (non-rectangular) horizontal grid.
-!
 !  The coordinate orders of fields stored in various forms have also been simplified.
 !  For example; various vintages of CAM 3D fields may be read in with (lon, lat, lev) or
 !  (lon, lev, lat).  These are uniformly converted to (lev, lon, lat) for use in model_mod.
 !  This latter form is different than pre MPI model_mods.  Then such fields are stored in
 !  the state vector with the same coordinate order.  They are converted back to the modern
 !  CAM coordinate order when written to caminput.nc files.
-!
 !  Surface pressure may be needed on the A-grid (thermodynamic variables) and grids staggered
 !  relative to the A-grid.   Currently, PS for the A-grid and for the 2 staggered grids is
 !  stored for global access for the (re)calculation of pressures and heights on model levels
@@ -65,7 +104,7 @@
 !
 !     MODULE ORGANIZATION (search for the following strings to find the corresponding section)
 !
-!         'use' statements
+!          USE statements
 !          Global storage for describing cam model class
 !          Namelist variables with default values
 !          Derived parameters
@@ -77,7 +116,8 @@
 !          Utility routines; called by several main subroutines
 !          Stubs not used by cam/model_mod (this is not all of them)
 
-!==============================================================================================
+!= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
+
 !  USE statements
 
 use netcdf
@@ -88,7 +128,7 @@
 ! FIXME; these constants should be consistent with CESM, not necessarily with DART.
 !          add after verification against Hui's tests;  gas_constant_v,gas_constant,ps0,PI,DEG2RAD
 
-use time_manager_mod,  only : time_type, set_time, set_date, print_time, print_date,  &
+use time_manager_mod,  only : time_type, set_time, set_date, print_time, print_date,    &
                               set_calendar_type, get_calendar_type, get_time, get_date, &
                               operator(-), operator(==)
 
@@ -99,7 +139,7 @@
 
 use mpi_utilities_mod, only : my_task_id, task_count
 
-!-------------------------------------------------------------------------
+!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 use location_mod,      only : location_type, get_location, set_location, query_location,         &
                               LocationDims, LocationName, LocationLName, horiz_dist_only,        &
                               vert_is_level, vert_is_pressure, vert_is_height, vert_is_surface,  &
@@ -109,9 +149,9 @@
                               get_close_type, get_close_maxdist_init, get_close_obs_init,        &
                               get_close_obs_destroy,get_dist,loc_get_close_obs => get_close_obs
 
-use xyz_location_mod, only : xyz_location_type, xyz_get_close_maxdist_init,    &
+use xyz_location_mod, only : xyz_location_type, xyz_get_close_maxdist_init,          &
                              xyz_get_close_type, xyz_set_location, xyz_get_location, &
-                             xyz_get_close_obs_init, xyz_get_close_obs_destroy, &
+                             xyz_get_close_obs_init, xyz_get_close_obs_destroy,      &
                              xyz_find_nearest
 
 ! get_close_maxdist_init, get_close_obs_init, can be modified here (i.e. to add vertical information
@@ -127,12 +167,12 @@
 ! Eventually it should go into a untilities module.
 ! use utilities_YYY, only : solve_quadratic
 
-!-----------------------------------------------------------------------------
-use     obs_kind_mod, only : KIND_U_WIND_COMPONENT, KIND_V_WIND_COMPONENT, KIND_PRESSURE,     &
-                             KIND_SURFACE_PRESSURE, KIND_TEMPERATURE, KIND_SPECIFIC_HUMIDITY, &
-                             KIND_CLOUD_LIQUID_WATER, KIND_CLOUD_ICE, KIND_CLOUD_FRACTION,    &
-                             KIND_GRAV_WAVE_DRAG_EFFIC, KIND_GRAV_WAVE_STRESS_FRACTION,       &
-                             KIND_SURFACE_ELEVATION,                                          &
+!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+use     obs_kind_mod, only : KIND_U_WIND_COMPONENT, KIND_V_WIND_COMPONENT, KIND_PRESSURE,       &
+                             KIND_SURFACE_PRESSURE, KIND_TEMPERATURE, KIND_SPECIFIC_HUMIDITY,   &
+                             KIND_CLOUD_LIQUID_WATER, KIND_CLOUD_ICE, KIND_CLOUD_FRACTION,      &
+                             KIND_GRAV_WAVE_DRAG_EFFIC, KIND_GRAV_WAVE_STRESS_FRACTION,         &
+                             KIND_SURFACE_ELEVATION,                                            &
                              KIND_CO, KIND_CO2, KIND_NO, KIND_NO2, KIND_CH4, KIND_NH3, KIND_O3, &
                              get_raw_obs_kind_index, get_raw_obs_kind_name, get_obs_kind_var_type
 
@@ -174,13 +214,13 @@
 
 ! Other fields which users may add to the CAM initial files are not listed here.
 ! Examples are EFGWORO, FRACLDV from the gravity wave drag parameterization study
-!-----------------------------------------------------------------------------
+!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
 use   random_seq_mod, only : random_seq_type, init_random_seq, random_gaussian
 
 ! end of use statements
-!=========================================================================================
-!
+!= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
+
 ! CAM global/module declarations
 
 implicit none
@@ -218,9 +258,9 @@
 ! This is allocated in static_init_model().
 real(r8), allocatable :: ens_mean(:)
 
-!----------------------------------------------------------------------
+! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! Global storage for describing cam model class
-!----------------------------------------------------------------------
+! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
 !-----------------------------------------------------------------------
 ! Definition of variable types
@@ -255,7 +295,7 @@
 
 integer, allocatable :: TYPE_0D(:), TYPE_1D(:), TYPE_2D(:), TYPE_3D(:)
 
-!----------------------------------------------------------------------
+!-----------------------------------------------------------------------
 
 ! A type for cam model.
 ! Each variable will be allowed to have different dimensions, even different from
@@ -263,7 +303,7 @@
 ! The maximum size for each dimension (for a given rank) will be used to allocate space
 ! when a model_type variable is initialized.
 type model_type
-    private
+   private
    real(r8), allocatable :: vars_0d(:)
    real(r8), allocatable :: vars_1d(:, :)
    real(r8), allocatable :: vars_2d(:, :, :)
@@ -279,7 +319,7 @@
 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! Grid fields
 ! These structures are used by nc_write_model_atts.
-! They are dimensioned in init_grid_1D_instance and filled in read_cam_coord.
+! They are dimensioned in create_grid_1d_instance and filled in read_cam_coord.
 
 ! Should this whole type be allocatable, since scalars can be allocated?
 ! No, not needed.  Deallocating just the allocatable components is enough cleaning.
@@ -301,12 +341,12 @@
 ! P0 now a "coordinate",  and may be removed entirely
 ! character(len=8),dimension(100) :: grid_names_0d = (/'P0',(' ',iii=1,100)/)
 
-integer                          :: grid_num_1d = 12   ! # of 1d grid fields to read from file
-character(len=8),dimension(100) :: grid_names_1d = &
+integer          :: grid_num_1d = 12   ! # of 1d grid fields to read from file
+character(len=8) :: grid_names_1d(100) = &
           (/ 'lon     ','lat     ','lev     ','gw      ', &
              'hyam    ','hybm    ','hyai    ','hybi    ', &
              'slon    ','slat    ','ilev    ','P0      ', &
-            ('        ',iii=1,88 )/)
+            ('        ',iii=1,88 ) /)
 ! These names should match the grid_names_1d to keep things clear.
 ! All the possible coordinates (not dimensions) on the caminput.nc file.
 type(grid_1d_type), target ::  lon ,lat ,lev ,gw ,hyam ,hybm ,hyai ,hybi, slon ,slat ,ilev, P0
@@ -321,8 +361,8 @@
 ! ? should phis be in grid_names_2d?
 ! character (len=8),dimension(100) :: grid_names_2d = (/(' ',iii=1,100)/)
 
-!
-!----------------------------------------------------------------------
+
+! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! Namelist variables with default values follow
 
 ! output_state_vector = .true.     results in a "state-vector" netCDF file
@@ -330,16 +370,17 @@
 logical :: output_state_vector = .false.
 
 ! Files where basic info about model configuration can be found
-character(len = 256) :: model_config_file = 'caminput.nc',             & ! An example cam initial file.
-                        cam_phis          = 'cam_phis.nc',             & ! Separate source of PHIS/topography.
-                        homme_map_file    = 'SEMapping.nc',            & ! Corners of each cubed sphere cell.
-                        cs_grid_file      = 'SEMapping_cs_grid.nc'       ! Relationships among corners/nodes.
-character(len = 32)  :: model_version     = '4.0'
+character(len=128) :: &
+   model_config_file = 'caminput.nc',             & ! An example cam initial file.
+   cam_phis          = 'cam_phis.nc',             & ! Separate source of PHIS/topography.
+   homme_map_file    = 'SEMapping.nc',            & ! Corners of each cubed sphere cell.
+   cs_grid_file      = 'SEMapping_cs_grid.nc',    & ! Relationships among corners/nodes.
+   model_version     = '5.0'
 
 
 ! Define location restrictions on which observations are assimilated
 ! (values are calculated anyway, but istatus is set to 2)
-character(len = 8) :: vert_coord = 'pressure'            ! or 'log_invP'
+character(len=8) :: vert_coord = 'pressure'            ! or 'log_invP'
 real(r8) :: max_obs_lat_degree        = 90.0_r8
 real(r8) :: highest_obs_pressure_Pa   = 1000.0_r8
 real(r8) :: highest_state_pressure_Pa = 9400.0_r8
@@ -357,19 +398,19 @@
 ! allocating, setting default values, then get values from second namelist.
 ! Or, allocate with defaults values, read in namelist, deallocate and reallocate.
 integer, parameter :: MAX_STATE_NAMES = 100
-character(len=8),dimension(MAX_STATE_NAMES) :: state_names_0d = ' '
-character(len=8),dimension(MAX_STATE_NAMES) :: state_names_1d = ' '
-character(len=8),dimension(MAX_STATE_NAMES) :: state_names_2d = ' '
-character(len=8),dimension(MAX_STATE_NAMES) :: state_names_3d = ' '
+character(len=8) :: state_names_0d(MAX_STATE_NAMES)  = ' '
+character(len=8) :: state_names_1d(MAX_STATE_NAMES)  = ' '
+character(len=8) :: state_names_2d(MAX_STATE_NAMES)  = ' '
+character(len=8) :: state_names_3d(MAX_STATE_NAMES)  = ' '
 
 ! NOVERT
 !         There's a danger of having a mismatch of which_vert_Xd with the state_names_Xd.
 !         Should this definition be part of a new structure state_names_Xd, which is parsed
 !         into a name and which_vert after being read?  Not for now.
 
-integer , dimension(MAX_STATE_NAMES) :: which_vert_1d = MISSING_I
-integer , dimension(MAX_STATE_NAMES) :: which_vert_2d = MISSING_I
-integer , dimension(MAX_STATE_NAMES) :: which_vert_3d = MISSING_I
+integer :: which_vert_1d(MAX_STATE_NAMES) = MISSING_I
+integer :: which_vert_2d(MAX_STATE_NAMES) = MISSING_I
+integer :: which_vert_3d(MAX_STATE_NAMES) = MISSING_I
 
 
 ! Is there a way to exclude state_nums from namelist and have those filled in
@@ -378,9 +419,9 @@
 
 ! List of fields which this code needs to perturb because they're
 ! constant valued model parameters and show no spread when start_from_restart = .true.
-character(len=8),dimension(MAX_STATE_NAMES) :: pert_names     = '        '
-real(r8)        ,dimension(MAX_STATE_NAMES) :: pert_sd        = MISSING_R8
-real(r8)        ,dimension(MAX_STATE_NAMES) :: pert_base_vals = MISSING_R8
+character(len=8) :: pert_names    (MAX_STATE_NAMES) = '        '
+real(r8)         :: pert_sd       (MAX_STATE_NAMES) = MISSING_R8
+real(r8)         :: pert_base_vals(MAX_STATE_NAMES) = MISSING_R8
 
 ! Special for an experiment.  Specify one string kind e.g KIND_CLOUD_LIQUID and
 ! observations of that kind will only impact other obs and state vars of that
@@ -411,7 +452,7 @@
 
 
 !---- end of namelist (found in file input.nml) ----
-!----------------------------------------------------------------------
+! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! Derived parameters
 
 ! make sure static init code only called once
@@ -428,7 +469,7 @@
 logical                 :: first_pert_call = .true.
 type(random_seq_type)   :: random_seq
 integer                 :: ens_member = 0
-logical                 :: do_out
+logical                 :: output_task0
 
 ! common message string used by many subroutines
 character(len=512) :: string1, string2, string3
@@ -450,14 +491,13 @@
 ! X_dimid_#d first dimension is 1 larger than # spatial dimensions to accomodate time dimension
 ! on caminit.nc files.
 ! These are filled in trans_coord
-
 integer              :: coord_order
 integer, allocatable :: s_dim_3d(:,:), s_dim_2d(:,:), s_dim_1d(  :),  &
                         f_dim_3d(:,:), f_dim_2d(:,:), f_dim_1d(:,:),  &
                         f_dimid_3d(:,:), f_dimid_2d(:,:), f_dimid_1d(:,:),  &
                         s_dimid_3d(:,:), s_dimid_2d(:,:), s_dimid_1d(  :)
-integer, dimension(3,3) :: s_dim_max
-integer, dimension(4,3) :: f_dim_max
+integer :: s_dim_max(3,3)
+integer :: f_dim_max(4,3)
 
 
 ! - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -565,8 +605,8 @@
 ! It's filled in map_kinds
 ! The max size of KIND_ should come from obs_kind_mod
 ! These should be dimensioned the same size as the total of state_names_Nd.
-integer, dimension(300) :: dart_to_cam_types = MISSING_I
-integer, dimension(300) :: cam_to_dart_kinds = MISSING_I
+integer :: dart_to_cam_types(300) = MISSING_I
+integer :: cam_to_dart_kinds(300) = MISSING_I
 !
 !-----------------------------------------------------------------------
 ! These are calculated from highest_obs_pressure_Pa
@@ -582,7 +622,7 @@
 
 !-----------------------------------------------------------------------
 
-!#######################################################################
+!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 
 contains
 
@@ -590,14 +630,26 @@
 
 ! static_init_model section
 
-!=======================================================================
+!-----------------------------------------------------------------------
+!>
+!> Static_init_model does many things which must be done once at the beginning 
+!> of the use of model_mod:
+!>   + set the calendar and time variables,
+!>   + read, check and archive the model_nml namelist,
+!>   + set some output level variables,
+!>   + set the state vector size,
+!>   + read coordinate variables from the CAM initial file,
+!>   + read the model topography
+!>   + read and/or generate cubed sphere grid arrays if CAM-SE is being used,
+!>   + make the connection between DART KINDs and local model TYPEs
+
 subroutine static_init_model()
-!
+
 ! Initializes class data for CAM model (all the stuff that needs to be done once).
 ! For now, does this by reading info from a fixed name netcdf file.
 
-integer  :: iunit, io, i, ncfileid
-integer  :: max_levs, ierr
+integer :: iunit, io, i, nc_file_ID
+integer :: max_levs, ierr
 
 ! only execute this code once
 if (module_initialized) return
@@ -624,14 +676,14 @@
 
 if (file_exist('element')) then
    iunit = get_unit()
-   open(unit = iunit, file='element', form = 'formatted')
+   open(unit=iunit, file='element', form='formatted')
    read(iunit,*) ens_member
    close(iunit)
-   do_out = .false.
-   if (ens_member == 1) do_out = .true.
+   output_task0 = .false.
+   if (ens_member == 1) output_task0 = .true.
 else
-   do_out = do_output()
-end if
+   output_task0 = do_output()
+endif
 
 ! Record the namelist values
 if (do_nml_file()) write(nmlfileunit, nml=model_nml)
@@ -639,32 +691,32 @@
 
 ! Set the model minimum time step from the namelist seconds and days input
 Time_step_atmos = set_time(Time_step_seconds, Time_step_days)
-if (print_details .and. do_out) call print_time(Time_step_atmos)
+if (print_details .and. output_task0) call print_time(Time_step_atmos)
 
 ! Open CAM 'initial' file to read dimensions and coordinates of fields.
-call nc_check(nf90_open(path = trim(model_config_file), mode = nf90_nowrite, ncid = ncfileid), &
+call nc_check(nf90_open(path=trim(model_config_file), mode=nf90_nowrite, ncid=nc_file_ID), &
              'static_init_model', 'opening '//trim(model_config_file))
 
 ! Get sizes of dimensions/coordinates from netcdf and put in global storage.
 ! Also may change l_rectang to .false.
-call read_cam_init_size(ncfileid)
+call read_cam_init_size(nc_file_ID)
 
 ! Compute overall model size and put in global storage
 ! s_dim_#d come from read_cam_init_size/trans_coord, and are in global storage
 model_size = state_num_0d
 do i=1,state_num_1d
    model_size = model_size + s_dim_1d(i)
-end do
+enddo
 do i=1,state_num_2d
    model_size = model_size + s_dim_2d(1,i) * s_dim_2d(2,i)
-end do
+enddo
 do i=1,state_num_3d
    model_size = model_size + s_dim_3d(1,i) * s_dim_3d(2,i) * s_dim_3d(3,i)
-end do
-if (do_out) then
+enddo
+if (output_task0) then
    write(string1, '(A,I9)') 'CAM state vector size: ', model_size
    call error_handler(E_MSG, 'static_init_model', string1)
-end if
+endif
 
 allocate(ens_mean(model_size))
 
@@ -673,23 +725,23 @@
 ! The second argument is a grid_1d_type structure
 ! CS; ncol is a dimension, but there's no coordinate variable of the same name.
 !     There are lat and lon arrays for the ncol grid points.
-call read_cam_coord(ncfileid, 'lon', lon)
-call read_cam_coord(ncfileid, 'lat', lat)
-call read_cam_coord(ncfileid, 'lev', lev)
-call read_cam_coord(ncfileid, 'ilev', ilev)
-call read_cam_coord(ncfileid, 'gw', gw)
-call read_cam_coord(ncfileid, 'slon', slon)
-call read_cam_coord(ncfileid, 'slat', slat)
+call read_cam_coord(nc_file_ID, 'lon', lon)
+call read_cam_coord(nc_file_ID, 'lat', lat)
+call read_cam_coord(nc_file_ID, 'lev', lev)
+call read_cam_coord(nc_file_ID, 'ilev', ilev)
+call read_cam_coord(nc_file_ID, 'gw', gw)
+call read_cam_coord(nc_file_ID, 'slon', slon)
+call read_cam_coord(nc_file_ID, 'slat', slat)
 
 ! read hybrid vert coord coefs
-call read_cam_coord(ncfileid, 'hyai', hyai)
-call read_cam_coord(ncfileid, 'hybi', hybi)
-call read_cam_coord(ncfileid, 'hyam', hyam)
-call read_cam_coord(ncfileid, 'hybm', hybm)
+call read_cam_coord(nc_file_ID, 'hyai', hyai)
+call read_cam_coord(nc_file_ID, 'hybi', hybi)
+call read_cam_coord(nc_file_ID, 'hyam', hyam)
+call read_cam_coord(nc_file_ID, 'hybm', hybm)
 
 ! It's a scalar, but I can put it into the same coord structure as previous fields.
 ! It's length will be 1
-call read_cam_coord(ncfileid, 'P0', P0)    ! thats a p-zero
+call read_cam_coord(nc_file_ID, 'P0', P0)    ! thats a p-zero
 
 !------------------------------------------------------------------------
 ! Better damping algorithm for state variables near/in the CAM damped levels
@@ -708,7 +760,7 @@
    ! damp_wght must be in the same units (dist = radians) as the distances in get_close_obs.
    if (highest_state_pressure_Pa /= model_top) then
       damp_wght = 1.0_r8/get_dist(highest_state_loc,model_top_loc,no_vert=.false.)
-   end if
+   endif
 else if (vert_coord == 'log_invP') then
    highest_state_scale_h = scale_height(p_surface=P0%vals(1), p_above=highest_state_pressure_Pa)
    model_top             = scale_height(p_surface=P0%vals(1), p_above=(hyai%vals(1)*P0%vals(1)) )
@@ -716,37 +768,37 @@
    model_top_loc     = set_location(1.0_r8,1.0_r8,model_top,            VERTISSCALEHEIGHT)
    if (highest_state_scale_h /= model_top) then
       damp_wght = 1.0_r8/get_dist(highest_state_loc,model_top_loc,no_vert=.false.)
-   end if
+   endif
 else
    write(string1, '(A,A)') 'Somehow vert_coord /= {pressure,log_invP}: ', vert_coord
    call error_handler(E_ERR,'static_init_model',string1,source,revision,revdate)
-end if
+endif
 
-!------------------------------------------------------------------------
+!- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 ! # fields to read
 nflds = state_num_0d + state_num_1d + state_num_2d + state_num_3d
 if (print_details) then
    write(string1, '(A,I3,A,4I3)') '# of fields in state vector =  ', nflds, &
         ' = sum of ', state_num_0d ,state_num_1d ,state_num_2d ,state_num_3d
    call error_handler(E_MSG,'static_init_model',string1,source,revision,revdate)
-end if
+endif
 

@@ Diff output truncated at 40000 characters. @@


More information about the Dart-dev mailing list