<p><b>duda</b> 2010-07-19 18:24:29 -0600 (Mon, 19 Jul 2010)</p><p>BRANCH COMMIT<br>
<br>
Initial scalar fields given through CAM_INIDAT_TO_MPAS() will be given as<br>
wet mixing ratios, so we need to convert these when doing a 'cold start'<br>
run; however, we are assuming that, since we provide dry mixing ratios<br>
through MPAS_RESTART_TO_CAM(), we will get back those same dry mixing ratios<br>
through CAM_RESTART_TO_MPAS() and will therefore not need to convert these<br>
in the case of a restart run.<br>
<br>
M    src/driver_cam_interface/module_mpas_cam_interface.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/mpas_cam_coupling/src/driver_cam_interface/module_mpas_cam_interface.F
===================================================================
--- branches/mpas_cam_coupling/src/driver_cam_interface/module_mpas_cam_interface.F        2010-07-19 22:40:45 UTC (rev 383)
+++ branches/mpas_cam_coupling/src/driver_cam_interface/module_mpas_cam_interface.F        2010-07-20 00:24:29 UTC (rev 384)
@@ -13,6 +13,7 @@
    real (kind=RKIND) :: dt_dynamics, dt_physics, p0
    integer :: itimestep, n_subcycle_steps
    type (io_output_object) :: output_obj
+   logical :: restart_run
 
 
    contains
@@ -48,6 +49,7 @@
       call read_namelist(dminfo)
 
       itimestep = 0
+      restart_run = .false.    ! If a restart run, this will be set to true in cam_restart_to_mpas
 
       !
       ! Set physics timestep and verify that it is evenly divided by dynamics timestep
@@ -466,6 +468,8 @@
 
       integer :: iCell, k, i
       type (block_type), pointer :: block
+
+      restart_run = .true.
    
       write(0,*) 'Called CAM_RESTART_TO_MPAS'
 
@@ -528,15 +532,41 @@
    
       implicit none
 
-      type (block_type), pointer :: block_ptr
+      integer :: i, iCell, k, iScalar
+      real (kind=RKIND), dimension(:,:,:), pointer :: scalars
+      type (block_type), pointer :: block
 
+      !
+      ! If this is not a restart run, we first need to transform the initial scalar fields
+      !   from wet mixing ratios to dry mixing ratios
+      !
+      if (.not. restart_run) then
+         block =&gt; domain % blocklist
+         do while (associated(block))
+            scalars =&gt; block % time_levs(1) % state % scalars % array
 
+            do iCell=1,block % mesh % nCells
+               do k=1,block % mesh % nVertLevels
+                  do iScalar=1,num_scalars
+                     scalars(iScalar,k,iCell) = scalars(iScalar,k,iCell) * (1.0 + scalars(index_qv,k,iCell))
+                  end do
+               end do
+            end do
+
+            do i=2,nTimeLevs
+               block % time_levs(i) % state % scalars % array(:,:,:) = block % time_levs(1) % state % scalars % array(:,:,:)
+            end do
+
+            block =&gt; block % next
+         end do
+      end if
+
       ! Compute diagnostic fields needed in solve loop, and initialize
       !    simulation time to 0 for all blocks
-      block_ptr =&gt; domain % blocklist
-      do while (associated(block_ptr))
-         call mpas_init(block_ptr, block_ptr % mesh, dt_dynamics)
-         block_ptr =&gt; block_ptr % next
+      block =&gt; domain % blocklist
+      do while (associated(block))
+         call mpas_init(block, block % mesh, dt_dynamics)
+         block =&gt; block % next
       end do
 
       output_frame = 1

</font>
</pre>