<p><b>cnewman@lanl.gov</b> 2010-08-02 16:04:09 -0600 (Mon, 02 Aug 2010)</p><p>propogating latest changes to repo<br>
</p><hr noshade><pre><font color="gray">Modified: branches/implicit/src/core_sw/module_implicit_integration.F
===================================================================
--- branches/implicit/src/core_sw/module_implicit_integration.F        2010-07-30 21:18:46 UTC (rev 454)
+++ branches/implicit/src/core_sw/module_implicit_integration.F        2010-08-02 22:04:09 UTC (rev 455)
@@ -12,7 +12,7 @@
 
    contains
 
-   subroutine implicit_timestep(domain, dt)
+   subroutine implicit_timestep(dt)
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    ! Advance model state forward in time by the specified time step
    !
@@ -24,18 +24,17 @@
 
       implicit none
 
-      type (domain_type), intent(inout) ,target:: domain
-      real (kind=RKIND), intent(in) :: dt
+      type (block_type), pointer :: block
 
-      type (block_type), pointer :: block

-      dom=&gt;domain
+!cn this code may be better off in an init subroutine
+      real (kind=RKIND), intent(in) :: dt 
       d_t=dt
+!cn end this code may be better off in an init subroutine
+
       if (trim(config_time_integration) == 'NRK4') then
-         call nrk4()
+         call do_nrk4()
       else
          write(0,*) 'Unknown time integration option '//trim(config_time_integration)
-         write(0,*) 'Currently, only ''RK4'' is supported.'
          stop
       end if
 
@@ -47,6 +46,27 @@
 
    end subroutine implicit_timestep
 
+   subroutine do_nrk4()
+
+      real(kind=RKIND), allocatable,dimension(:)::narray
+      allocate(narray(dom%blocklist%mesh%nvertlevelssolve*dom%blocklist%mesh%nedgessolve &amp;
+        +dom%blocklist%mesh%nvertlevelssolve*dom%blocklist%mesh%ncellssolve &amp;
+        +dom%blocklist%mesh%ntracerssolve*dom%blocklist%mesh%nvertlevelssolve*dom%blocklist%mesh%ncellssolve))
+
+      call pack(narray, dom%blocklist % intermediate_step(2) % u % array(:,:), &amp;
+        dom%blocklist % intermediate_step(2) % h % array(:,:), &amp;
+        dom%blocklist % intermediate_step(2) % tracers % array(:,:,:))
+
+      call nrk4()
+   end subroutine do_nrk4
+
+  subroutine implicit_init(domain)
+      implicit none
+      type (domain_type), intent(inout) ,target:: domain
+      dom=&gt;domain
+  end subroutine implicit_init
+
+
    subroutine nrk4()
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    ! Advance model state forward in time by the specified time step using 
@@ -69,7 +89,12 @@
 
       real (kind=RKIND), dimension(4) :: rk_weights, rk_substep_weights
 
-      real (kind=RKIND), pointer :: uu(:,:)!cn
+
+      !real (kind=RKIND), pointer :: uu(:,:)!cn
+
+      !call unpack(narray, dom%blocklist % intermediate_step(TEND) % u % array(:,:), &amp;
+      !  dom%blocklist % intermediate_step(TEND) % h % array(:,:), &amp;
+      !  dom%blocklist % intermediate_step(TEND) % tracers % array(:,:,:))
      
       !
       ! Initialize time_levs(2) with state at current time
@@ -82,7 +107,7 @@
       do while (associated(block))
          block % time_levs(2) % state % u % array(:,:) = block % time_levs(1) % state % u % array(:,:)
          block % time_levs(2) % state % h % array(:,:) = block % time_levs(1) % state % h % array(:,:)
-         do iCell=1,block % mesh % nCells  ! couple tracers to h
+         do iCell=1,block % mesh % nCells ! couple tracers to h
            do k=1,block % mesh % nVertLevels
              block % time_levs(2) % state % tracers % array(:,k,iCell) = block % time_levs(1) % state % tracers % array(:,k,iCell) &amp;
                                                                        * block % time_levs(1) % state % h % array(k,iCell)
@@ -152,11 +177,11 @@
 !cn this is k1, k2, k3, k4
            block =&gt; dom % blocklist
            do while (associated(block))
-              uu=&gt;block % intermediate_step(PROVIS) % u % array(:,:) !cn experimenting here
-              uu = block % time_levs(1) % state % u % array(:,:)  &amp;
+              !uu=&gt;block % intermediate_step(PROVIS) % u % array(:,:) !cn experimenting here
+              !uu = block % time_levs(1) % state % u % array(:,:)  &amp;
+              !                           + rk_substep_weights(rk_step) * block % intermediate_step(TEND) % u % array(:,:)
+              block % intermediate_step(PROVIS) % u % array(:,:)       = block % time_levs(1) % state % u % array(:,:)  &amp;
                                          + rk_substep_weights(rk_step) * block % intermediate_step(TEND) % u % array(:,:)
-              !block % intermediate_step(PROVIS) % u % array(:,:)       = block % time_levs(1) % state % u % array(:,:)  &amp;
-              !                           + rk_substep_weights(rk_step) * block % intermediate_step(TEND) % u % array(:,:)
               block % intermediate_step(PROVIS) % h % array(:,:)       = block % time_levs(1) % state % h % array(:,:)  &amp;
                                          + rk_substep_weights(rk_step) * block % intermediate_step(TEND) % h % array(:,:)
               do iCell=1,block % mesh % nCells
@@ -226,4 +251,85 @@
 
    end subroutine nrk4
 
+      subroutine pack(noxarray, u, h, tracers)
+!this is acrude copy at this point, what about multiple blocks?
+
+!this will put all variables into one long array; might be better if noxarray was a pointer that lives on the mod....
+!u is nvertlevelssolve, nedgessolve
+!h is nvertlevelssolve, ncellssolve
+!t is ntracerssolve,nvertlevelssolve, ncellssolve is it ntracers?
+! =&gt; noxarray is nvertlevelssolve,*nedgessolve+nvertlevelssolve,*ncellssolve+ntracerssolve*nvertlevelssolve*ncellssolve
+      implicit none
+      real (kind=RKIND), dimension(:),intent(out):: noxarray
+      real (kind=RKIND), dimension(:,:),intent(in):: u  
+      real (kind=RKIND), dimension(:,:),intent(in):: h 
+      real (kind=RKIND), dimension(:,:,:),intent(in):: tracers 
+      integer :: nedge, nvert, ncell, ntracer
+      integer:: iedge, ivert, icell, itracer
+      integer :: n
+!     dom%blocklist%mesh%nvertlevelssolve*dom%blocklist%mesh%nedgessolve &amp;
+!      +dom%blocklist%mesh%nvertlevelssolve*dom%blocklist%mesh%ncellssolve &amp;
+!      +dom%blocklist%mesh%ntracerssolve*dom%blocklist%mesh%nvertlevelssolve*dom%blocklist%mesh%ncellssolve
+      nedge = dom%blocklist%mesh%nedgessolve
+      nvert = dom%blocklist%mesh%nvertlevelssolve
+      ncell = dom%blocklist%mesh%ncellssolve
+      ntracer = dom%blocklist%mesh%ntracerssolve
+      do iedge = 1, nedge
+         do ivert = 1, nvert
+            n=ivert+nvert*(iedge-1)
+            noxarray(n)=u(ivert, iedge)
+         end do
+      end do
+      do icell = 1, ncell
+         do ivert = 1, nvert
+            n=ivert+nvert*(icell-1)+nvert*nedge
+            noxarray(n)=h(ivert, icell)
+         end do
+      end do
+      do icell = 1, ncell  !cn this loop is unverified right now
+         do ivert = 1, nvert
+            do itracer = 1, ntracer
+               n=itracer+ntracer*(ivert-1)+ntracer*nvert*(icell-1)+nvert*nedge+nvert*ncell
+               noxarray(n)=tracers(itracer, ivert, icell)
+            end do
+         end do
+      end do
+      end subroutine pack
+
+      subroutine unpack(noxarray, u, h, tracers)
+      implicit none
+      real (kind=RKIND), dimension(:),intent(in):: noxarray
+      real (kind=RKIND), dimension(:,:),intent(out):: u 
+      real (kind=RKIND), dimension(:,:),intent(out):: h  
+      real (kind=RKIND), dimension(:,:,:),intent(out):: tracers 
+      integer :: nedge, nvert, ncell, ntracer
+      integer:: iedge, ivert, icell, itracer
+      integer :: n
+      nedge = dom%blocklist%mesh%nedgessolve
+      nvert = dom%blocklist%mesh%nvertlevelssolve
+      ncell = dom%blocklist%mesh%ncellssolve
+      ntracer = dom%blocklist%mesh%ntracerssolve
+      do iedge = 1, nedge
+         do ivert = 1, nvert
+            n=ivert+nvert*(iedge-1)
+            u(ivert, iedge)=noxarray(n)
+         end do
+      end do
+      do icell = 1, ncell
+         do ivert = 1, nvert
+            n=ivert+nvert*(icell-1)+nvert*nedge
+            h(ivert, icell)=noxarray(n)
+         end do
+      end do
+      do icell = 1, ncell  !cn this loop is unverified right now
+         do ivert = 1, nvert
+            do itracer = 1, ntracer
+               n=itracer+ntracer*(ivert-1)+ntracer*nvert*(icell-1)+nvert*nedge+nvert*ncell
+               tracers(itracer, ivert, icell)=noxarray(n)
+            end do
+         end do
+      end do
+      
+      end subroutine unpack
+
 end module implicit_integration

Modified: branches/implicit/src/core_sw/mpas_interface.F
===================================================================
--- branches/implicit/src/core_sw/mpas_interface.F        2010-07-30 21:18:46 UTC (rev 454)
+++ branches/implicit/src/core_sw/mpas_interface.F        2010-08-02 22:04:09 UTC (rev 455)
@@ -18,8 +18,6 @@
    use grid_types
    use time_integration
    use implicit_integration
-   
-   use implicit
 
    implicit none
 
@@ -31,9 +29,9 @@
    call init_reconstruct(mesh)
    call reconstruct(block % time_levs(1) % state, mesh)
    
-   !if (trim(config_time_integration) .ne. 'RK4') then !cn seem like we can initialize nox here
-   !  call implicit_init()
-   !endif
+   if (trim(config_time_integration) .ne. 'RK4') then !cn seem like we can initialize nox here, we would like to hava domain though
+      call implicit_init(block%domain)
+   endif
 
 end subroutine mpas_init
 
@@ -64,11 +62,10 @@
    integer, intent(in) :: itimestep
    real (kind=RKIND), intent(in) :: dt
 
-      if (trim(config_time_integration) == 'RK4') then !cn seem like we can initialize nox here
+      if (trim(config_time_integration) == 'RK4') then
          call timestep(domain, dt)
-                                !cn maybe we call implicit_timestep her
-      elseif (trim(config_time_integration) == 'NRK4') then !cn seem like we can initialize nox heree similar to init
-         call implicit_timestep(domain, dt)
+      elseif (trim(config_time_integration) == 'NRK4') then
+         call implicit_timestep(dt)
       else
          write(0,*) 'Unknown time integration option '//trim(config_time_integration)
          stop

Modified: branches/implicit/src/framework/module_implicit.F
===================================================================
--- branches/implicit/src/framework/module_implicit.F        2010-07-30 21:18:46 UTC (rev 454)
+++ branches/implicit/src/framework/module_implicit.F        2010-08-02 22:04:09 UTC (rev 455)
@@ -1,5 +1,5 @@
 module implicit
-
+!cn deprecated
 use grid_types
 
 !public :: implicit_init

</font>
</pre>