<p><b>duda</b> 2010-03-30 18:43:35 -0600 (Tue, 30 Mar 2010)</p><p>BRANCH COMMIT<br>
<br>
Add code in CAM test driver to read input fields from test driver<br>
input files (one file per process; created by modified MPAS driver)<br>
<br>
M src/driver_cam_interface/test_driver.F<br>
</p><hr noshade><pre><font color="gray">Modified: branches/mpas_cam_coupling/src/driver_cam_interface/test_driver.F
===================================================================
--- branches/mpas_cam_coupling/src/driver_cam_interface/test_driver.F        2010-03-31 00:35:34 UTC (rev 173)
+++ branches/mpas_cam_coupling/src/driver_cam_interface/test_driver.F        2010-03-31 00:43:35 UTC (rev 174)
@@ -4,29 +4,63 @@
implicit none
+ integer :: k
+ integer :: mpi_procID, mpi_nprocs, mpi_ierr
+ character (len=32) :: filename
+
integer :: nCellsSolve, maxEdges, nVertLevels, nScalars
real (kind=RKIND) :: Pref, Ptop
- real (kind=RKIND), dimension(:), pointer :: Psd, Phis, Ae, Be, Ac, Bc
+ real (kind=RKIND), dimension(26) :: Ac, Bc
+ real (kind=RKIND), dimension(27) :: Ae, Be
+ real (kind=RKIND), dimension(:), pointer :: Psd, Phis
real (kind=RKIND), dimension(:,:), pointer :: T, Ux, Uy, Omega
real (kind=RKIND), dimension(:,:), pointer :: T_tend, Ux_tend, Uy_tend
real (kind=RKIND), dimension(:,:,:), pointer :: U, Tracer
- integer :: mpi_ierr
call MPI_Init(mpi_ierr)
+ call MPI_Comm_rank(MPI_COMM_WORLD, mpi_procID, mpi_ierr)
+ call MPI_Comm_size(MPI_COMM_WORLD, mpi_nprocs, mpi_ierr)
+
+
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+ ! Initialize arrays that will be passed from CAM driver to MPAS
+ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+ data Ae / 0.002194067, 0.004895209, 0.009882418, 0.018052010, &
+ 0.029837240, 0.044623340, 0.061605870, 0.078512430, &
+ 0.077312710, 0.075901310, 0.074240860, 0.072287440, &
+ 0.069989330, 0.067285740, 0.064105090, 0.060363220, &
+ 0.055961110, 0.050782250, 0.044689600, 0.037521910, &
+ 0.029089490, 0.020847390, 0.013344430, 0.007084990, &
+ 0.002521360, 0.000000000, 0.000000000 /
+
+ data Be / 0.000000000, 0.000000000, 0.000000000, 0.000000000, &
+ 0.000000000, 0.000000000, 0.000000000, 0.000000000, &
+ 0.015053090, 0.032762280, 0.053596220, 0.078106270, &
+ 0.106941100, 0.140863700, 0.180772000, 0.227722000, &
+ 0.282956200, 0.347936400, 0.424382200, 0.514316800, &
+ 0.620120200, 0.723535500, 0.817676800, 0.896215300, &
+ 0.953476103, 0.985112200, 1.000000000 /
+
+ do k=1,26
+ Ac(k) = 0.5*(Ae(k) + Ae(k+1))
+ Bc(k) = 0.5*(Be(k) + Be(k+1))
+ end do
+
Pref = 100000.
- Ptop = 21900.
- nCellsSolve = 100
- maxEdges = 10
- nVertLevels = 26
- nScalars = 3
+ Ptop = Pref * Ae(1) * 100.0
+ write(filename, '(a,i4.4)') 'test_driver_input.', mpi_procID
+ open(22, file=trim(filename), form='unformatted', status='old')
+
+ read(22) nCellsSolve
+ read(22) maxEdges
+ read(22) nVertLevels
+ read(22) nScalars
+
allocate(Psd(nCellsSolve))
allocate(Phis(nCellsSolve))
- allocate(Ae(nVertLevels+1))
- allocate(Be(nVertLevels+1))
- allocate(Ac(nVertLevels))
- allocate(Bc(nVertLevels))
allocate(T(nCellsSolve,nVertLevels))
allocate(U(nCellsSolve,maxEdges,nVertLevels))
allocate(Ux(nCellsSolve,nVertLevels))
@@ -37,6 +71,17 @@
allocate(Ux_tend(nCellsSolve,nVertLevels))
allocate(Uy_tend(nCellsSolve,nVertLevels))
+ read(22) Psd
+ read(22) Phis
+ read(22) T
+ read(22) U
+
+ close(22)
+
+ Tracer(:,:,:) = 0.0
+
+
+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
! Begin calling CAM-MAS interface routines
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
@@ -62,12 +107,9 @@
! Finish calling CAM-MAS interface routines
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
deallocate(Psd)
deallocate(Phis)
- deallocate(Ae)
- deallocate(Be)
- deallocate(Ac)
- deallocate(Bc)
deallocate(T)
deallocate(U)
deallocate(Ux)
</font>
</pre>