[Dart-dev] [3283] DART/trunk/models/MITgcm_ocean: Allocate space for snapshot arrays before calling

nancy at subversion.ucar.edu nancy at subversion.ucar.edu
Thu Mar 27 15:53:31 MDT 2008


An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/dart-dev/attachments/20080327/38f29ef1/attachment.html
-------------- next part --------------
Modified: DART/trunk/models/MITgcm_ocean/trans_pv_sv.f90
===================================================================
--- DART/trunk/models/MITgcm_ocean/trans_pv_sv.f90	2008-03-27 20:45:52 UTC (rev 3282)
+++ DART/trunk/models/MITgcm_ocean/trans_pv_sv.f90	2008-03-27 21:53:31 UTC (rev 3283)
@@ -30,7 +30,7 @@
                              error_handler
 use        model_mod, only : MIT_meta_type, read_meta, read_snapshot, &
                              prog_var_to_vector, static_init_model, &
-                             get_model_size
+                             get_model_size, get_gridsize
 use  assim_model_mod, only : assim_model_type, static_init_assim_model, &
                              init_assim_model, get_model_size, set_model_state_vector, &
                              write_state_restart, set_model_time, open_restart_read, &
@@ -76,7 +76,7 @@
 real(r8), allocatable  :: x_state(:)
 
 integer                :: file_unit, x_size
-
+integer                :: Nx, Ny, Nz
 type(MIT_meta_type) :: mitmeta
 
 !
@@ -100,10 +100,19 @@
 
 write(*,*)'model size is ',get_model_size()
 
+! figure out the size the model code thinks the grid is
+call get_gridsize(Nx, Ny, Nz)
+
 ! Read the [meta,data] files 
 
 mitmeta = read_meta(file_base,'U')
 
+allocate(S(Nx,Ny,Nz)) 
+allocate(T(Nx,Ny,Nz))
+allocate(U(Nx,Ny,Nz))
+allocate(V(Nx,Ny,Nz))
+allocate(SSH(Nx,Ny))
+
 call read_snapshot(file_base,S,timestep,'S')
 call read_snapshot(file_base,T,timestep,'T')
 call read_snapshot(file_base,U,timestep,'U')
@@ -129,6 +138,8 @@
 ! transform fields into state vector for DART
 call prog_var_to_vector(S,T,U,V,SSH,x_state)
 
+deallocate(S,T,U,V,SSH)
+
 ! use the MIT namelist and timestepcount in the meta file to construct
 ! the current time.  we do not have a restart file to read; this program
 ! is creating one.

Modified: DART/trunk/models/MITgcm_ocean/trans_sv_pv.f90
===================================================================
--- DART/trunk/models/MITgcm_ocean/trans_sv_pv.f90	2008-03-27 20:45:52 UTC (rev 3282)
+++ DART/trunk/models/MITgcm_ocean/trans_sv_pv.f90	2008-03-27 21:53:31 UTC (rev 3283)
@@ -30,7 +30,7 @@
                              error_handler
 use        model_mod, only : MIT_meta_type, read_meta, read_snapshot, &
                              prog_var_to_vector, static_init_model, &
-                             get_model_size
+                             get_model_size, get_gridsize
 use  assim_model_mod, only : assim_model_type, static_init_assim_model, &
                              init_assim_model, get_model_size, set_model_state_vector, &
                              write_state_restart, set_model_time, open_restart_read, &
@@ -74,7 +74,7 @@
 real(r8), allocatable  :: x_state(:)
 
 integer                :: file_unit, x_size, timestep
-
+integer                :: Nx,Ny,Nz
 type(MIT_meta_type) :: mitmeta
 
 !
@@ -101,6 +101,8 @@
 write(*,*)'dimensions are ',shape(SSH)
 write(*,*)'model size is ',get_model_size()
 
+print *, ' !! THIS FILE IS NOT DONE -- IT WAS A COPY OF PV -> SV'
+print *, ' !! IN REALITY IT NEEDS TO GO SV -> PV'
 stop
 
 ! Read the [meta,data] files 
@@ -108,11 +110,17 @@
 mitmeta = read_meta(file_base,'U')
 write(*,*)'timestep is ',timestep
 
+allocate(S(Nx,Ny,Nz))
+allocate(T(Nx,Ny,Nz))
+allocate(U(Nx,Ny,Nz))
+allocate(V(Nx,Ny,Nz))
+allocate(SSH(Nx,Ny))
+
 call read_snapshot(file_base,S,timestep,'S')
 call read_snapshot(file_base,T,timestep,'T')
 call read_snapshot(file_base,U,timestep,'U')
 call read_snapshot(file_base,V,timestep,'V')
-call read_snapshot(file_base,SSH,timestep,'SSH')
+call read_snapshot(file_base,SSH,timestep,'ETA')
 
 ! matlab debug messages
 ! write(8)mitmeta%dimList


More information about the Dart-dev mailing list