<p><b>duda</b> 2012-02-17 13:32:30 -0700 (Fri, 17 Feb 2012)</p><p>BRANCH COMMIT<br>
<br>
Add special code (activated by defining the cpp variable ROTATED_GRID) to support<br>
the mountain wave test case (case 6), which uses a rotated grid.<br>
<br>
<br>
M    namelist.input.nhyd_atmos_mtn_wave<br>
M    src/core_nhyd_atmos/mpas_atm_time_integration.F<br>
M    src/core_nhyd_atmos/mpas_atm_test_cases.F<br>
M    src/core_init_nhyd_atmos/mpas_init_atm_test_cases.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/atmos_physics/namelist.input.nhyd_atmos_mtn_wave
===================================================================
--- branches/atmos_physics/namelist.input.nhyd_atmos_mtn_wave        2012-02-17 19:21:27 UTC (rev 1516)
+++ branches/atmos_physics/namelist.input.nhyd_atmos_mtn_wave        2012-02-17 20:32:30 UTC (rev 1517)
@@ -1,49 +1,73 @@
 &amp;nhyd_model
-   config_test_case = 6
+   config_test_case = 0
    config_time_integration = 'SRK3'
-   config_dt = 6.
-   config_ntimesteps = 3000
-   config_output_interval = 100
+   config_dt = 6.0
+   config_start_time = '0000-01-01_00:00:00'
+   config_run_duration = '05:00:00'
    config_number_of_sub_steps = 6
    config_h_mom_eddy_visc2 = 10.
    config_h_mom_eddy_visc4 = 0.
-   config_v_mom_eddy_visc2 = 10.
+   config_v_mom_eddy_visc2 = 10.0
    config_h_theta_eddy_visc2 = 10.
    config_h_theta_eddy_visc4 = 0.
    config_v_theta_eddy_visc2 = 10.
+   config_horiz_mixing = '2d_fixed'
    config_theta_adv_order = 3
    config_w_adv_order = 3
+   config_u_vadv_order = 3
+   config_w_vadv_order = 3
+   config_theta_vadv_order = 3
+   config_coef_3rd_order = 0.25
    config_scalar_advection = .false.
-   config_positive_definite = .false.
-   config_monotonic = .false.
-   config_mix_full = .false.
-   config_horiz_mixing = '2d_fixed'
-   config_coef_3rd_order = 0.25
-   config_epssm = 0.2
+   config_epssm = 0.1
+   config_smdiv = 0.1
    config_newpx = .false.
 /
 
-
 &amp;damping
-   config_zd = 22000.0
-   config_xnutr = 0.0
+   config_zd = 10500.0
+   config_xnutr = 0.1
 /
 
 &amp;dimensions
-   config_nvertlevels = 26
+   config_nvertlevels = 70
 /
 
 &amp;io
-   config_input_name = 'grid.nc'
+   config_input_name = 'mtn_wave_init.nc'
    config_output_name = 'output.nc'
    config_restart_name = 'restart.nc'
+   config_output_interval = '00:30:00'
+   config_frames_per_outfile = 0
 /
 
 &amp;restart
-   config_restart_interval = 3000
+   config_restart_interval = '1_00:00:00'
    config_do_restart = .false.
-   config_restart_time = 1036800.0
 /
 
 &amp;physics
+  config_frac_seaice         =  .false.
+  config_sfc_albedo          =  .false.
+  config_sst_update          =  .false.
+  config_sstdiurn_update     =  .false.
+  config_deepsoiltemp_update =  .false.
+
+  config_n_microp            =   5
+
+  config_radtlw_interval     = '00:00:00'
+  config_radtsw_interval     = '00:00:00'
+  config_conv_interval       = 'none'
+  config_pbl_interval        = 'none'
+
+  config_microp_scheme       =  'off'
+  config_conv_shallow_scheme =  'off'
+  config_conv_deep_scheme    =  'off'
+  config_eddy_scheme         =  'off'
+  config_lsm_scheme          =  'off'
+  config_pbl_scheme          =  'off'
+  config_radt_cld_scheme     =  'off'
+  config_radt_lw_scheme      =  'off'
+  config_radt_sw_scheme      =  'off'
+  config_sfclayer_scheme     =  'off'
 /

Modified: branches/atmos_physics/src/core_init_nhyd_atmos/mpas_init_atm_test_cases.F
===================================================================
--- branches/atmos_physics/src/core_init_nhyd_atmos/mpas_init_atm_test_cases.F        2012-02-17 19:21:27 UTC (rev 1516)
+++ branches/atmos_physics/src/core_init_nhyd_atmos/mpas_init_atm_test_cases.F        2012-02-17 20:32:30 UTC (rev 1517)
@@ -35,6 +35,28 @@
       type (block_type), pointer :: block_ptr
 
 
+
+      !
+      ! Do some quick checks to make sure compile options are compatible with the chosen test case
+      !
+      if (config_test_case == 6) then
+#ifndef ROTATED_GRID
+         write(0,*) '*** ERROR ***'
+         write(0,*) 'To initialize and run the mountain wave test case (case 6),'
+         write(0,*) '   you must compile with -DROTATE_GRID added to the specification'
+         write(0,*) '   of MODEL_FORMULATION at the top of the Makefile.'
+         call mpas_dmpar_abort(domain % dminfo)
+#endif
+      else
+#ifdef ROTATED_GRID
+         write(0,*) '*** ERROR ***'
+         write(0,*) 'Only test case 6 should use code compiled with -DROTATE_GRID specified in the Makefile.'
+         call mpas_dmpar_abort(domain % dminfo)
+#endif
+      end if
+
+
+
       if ((config_test_case == 1) .or. (config_test_case == 2) .or. (config_test_case == 3)) then
 
          write(0,*) ' Jablonowski and Williamson baroclinic wave test case '
@@ -1877,7 +1899,11 @@
                             +zgrid(k,cell2)+zgrid(k+1,cell2))
                u(k,i) = um
                if(i == 1 ) grid % u_init % array(k) = u(k,i) - us
-               u(k,i) = cos(grid % angleEdge % array(i)) * (u(k,i) - us) 
+#ifdef ROTATED_GRID
+               u(k,i) = sin(grid % angleEdge % array(i)) * (u(k,i) - us)
+#else
+               u(k,i) = cos(grid % angleEdge % array(i)) * (u(k,i) - us)
+#endif
             end do
             end if
          end do

Modified: branches/atmos_physics/src/core_nhyd_atmos/mpas_atm_test_cases.F
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/mpas_atm_test_cases.F        2012-02-17 19:21:27 UTC (rev 1516)
+++ branches/atmos_physics/src/core_nhyd_atmos/mpas_atm_test_cases.F        2012-02-17 20:32:30 UTC (rev 1517)
@@ -1865,7 +1865,11 @@
                             +zgrid(k,cell2)+zgrid(k+1,cell2))
                u(k,i) = um
                if(i == 1 ) grid % u_init % array(k) = u(k,i) - us
+#ifdef ROTATED_GRID
+               u(k,i) = sin(grid % angleEdge % array(i)) * (u(k,i) - us)
+#else
                u(k,i) = cos(grid % angleEdge % array(i)) * (u(k,i) - us) 
+#endif
             end do
             end if
          end do

Modified: branches/atmos_physics/src/core_nhyd_atmos/mpas_atm_time_integration.F
===================================================================
--- branches/atmos_physics/src/core_nhyd_atmos/mpas_atm_time_integration.F        2012-02-17 19:21:27 UTC (rev 1516)
+++ branches/atmos_physics/src/core_nhyd_atmos/mpas_atm_time_integration.F        2012-02-17 20:32:30 UTC (rev 1517)
@@ -2361,7 +2361,11 @@
             cell2 = cellsOnEdge(2,iEdge)
 
             do k=1,nVertLevels
+#ifdef ROTATED_GRID
+              u_mix(k) = u(k,iEdge) - grid % u_init % array(k) * sin( grid % angleEdge % array(iEdge) )
+#else
               u_mix(k) = u(k,iEdge) - grid % u_init % array(k) * cos( grid % angleEdge % array(iEdge) )
+#endif
             end do
 
             do k=2,nVertLevels-1

</font>
</pre>