[Dart-dev] [6211] DART/branches/development/models/am2: Final mods related to recent name change.
nancy at ucar.edu
nancy at ucar.edu
Fri May 31 09:20:05 MDT 2013
Revision: 6211
Author: thoar
Date: 2013-05-31 09:20:04 -0600 (Fri, 31 May 2013)
Log Message:
-----------
Final mods related to recent name change.
Added a few more comments.
Modified Paths:
--------------
DART/branches/development/models/am2/am2_to_dart.f90
DART/branches/development/models/am2/dart_to_am2.f90
DART/branches/development/models/am2/work/mkmf_am2_to_dart
DART/branches/development/models/am2/work/mkmf_dart_to_am2
DART/branches/development/models/am2/work/path_names_am2_to_dart
DART/branches/development/models/am2/work/path_names_dart_to_am2
-------------- next part --------------
Modified: DART/branches/development/models/am2/am2_to_dart.f90
===================================================================
--- DART/branches/development/models/am2/am2_to_dart.f90 2013-05-31 14:48:10 UTC (rev 6210)
+++ DART/branches/development/models/am2/am2_to_dart.f90 2013-05-31 15:20:04 UTC (rev 6211)
@@ -7,13 +7,15 @@
!----------------------------------------------------------------------
! purpose: interface between AM2 and DART
!
-! method: Read AM2 'initial' file for model state, but not time (netCDF format).
-! Get target time from assim_model_state_ic (temp_ic).
-! Reform fields into a state vector.
+! method: Read a namelist for run-time information.
+! Read AM2 'restart' file for model state
+! Read AM2 coupler.res file for model time (for some reason)
+! Reform fields into a DART state vector.
! Write out state vector in "proprietary" format for DART
!
-! author: Patrick Hofmann, updated: 6/2/2008
-! based on prog_var_to_vector and vector_to_prog_var by Jeff Anderson
+! author: Tim Hoar 31 May 2013
+! based on previous trans_pv_sv.f90 which used non-portable
+! command-line arguments.
!
!----------------------------------------------------------------------
@@ -21,12 +23,13 @@
use utilities_mod, only : initialize_utilities, finalize_utilities, &
nmlfileunit, do_nml_file, do_nml_term, &
find_namelist_in_file, check_namelist_read, &
- open_file, close_file
-use model_mod, only : model_type, init_model_instance, end_model_instance, &
- prog_var_to_vector, read_model_init
+ open_file, close_file, logfileunit
+use model_mod, only : model_type, static_init_model, init_model_instance, &
+ end_model_instance, prog_var_to_vector, read_model_init
use assim_model_mod, only : get_model_size, awrite_state_restart, &
open_restart_write, close_restart
-use time_manager_mod, only : time_type, set_time, set_date
+use time_manager_mod, only : time_type, set_time, set_date, &
+ print_time, print_date
implicit none
@@ -57,14 +60,11 @@
integer :: iunit, io, x_size, big_cld_iw, small_trcs
integer :: year, month, day, hour, minute, second
-!if(iargc() == 0) stop "You must specify State Vector and input AM2 files"
-!call getarg(1, am2_to_dart_output_file)
-!call getarg(2, restart_file)
-!call getarg(3, tracer_file)
+!------------------------------------------------------------------
call initialize_utilities('am2_to_dart')
-! Read the namelist entry
+! Read the namelist information
call find_namelist_in_file("input.nml", "am2_to_dart_nml", iunit)
read(iunit, nml = am2_to_dart_nml, iostat = io)
call check_namelist_read(iunit, io, "am2_to_dart_nml")
@@ -82,6 +82,7 @@
! Get to work
!----------------------------------------------------------------------
+call static_init_model()
x_size = get_model_size()
allocate(statevector(x_size))
@@ -118,6 +119,8 @@
! Set model_time
model_time = set_date(year, month, day, hour, minute, second)
+call print_date(model_time,'am2_to_dart: AM2 model date')
+call print_date(model_time,'am2_to_dart: AM2 model date',logfileunit)
! write out state vector in "proprietary" format
iunit = open_restart_write(am2_to_dart_output_file)
Modified: DART/branches/development/models/am2/dart_to_am2.f90
===================================================================
--- DART/branches/development/models/am2/dart_to_am2.f90 2013-05-31 14:48:10 UTC (rev 6210)
+++ DART/branches/development/models/am2/dart_to_am2.f90 2013-05-31 15:20:04 UTC (rev 6211)
@@ -7,24 +7,27 @@
!----------------------------------------------------------------------
! purpose: interface between AM2 and DART
!
-! method: Read DART state vector ("proprietary" format), but not time(s).
+! method: Read a namelist for run-time information.
+! Read DART state vector ("proprietary" format)
! Reform state vector back into AM2 fields.
! Replace those fields on the AM2 initial file with the new values,
! preserving all other information on the file.
+! If a new target model time is included in the header of the DART file,
+! the new time is written to "newappend.nml"
!
-! author: Patrick Hofmann 3/7/08
-! based on prog_var_to_vector and vector_to_prog_var by Robert Pincus
-! mod: to read temp_ic (assim_model_state_ic; 2 times) or temp_ud (1 time) and put
-! the fields into the AM2 initial files
+! author: Tim Hoar 31 May 2013
+! based on earlier trans_sv_pv.f90 which used non-portable
+! command-line arguments.
!
!----------------------------------------------------------------------
use types_mod, only : r8
use utilities_mod, only : get_unit, file_exist, open_file, logfileunit, &
initialize_utilities, finalize_utilities, &
- find_namelist_in_file, check_namelist_read, close_file
+ find_namelist_in_file, check_namelist_read, &
+ nmlfileunit, close_file, do_nml_file, do_nml_term
use model_mod, only : model_type, static_init_model, init_model_instance, &
- write_model_init, vector_to_prog_var
+ end_model_instance, vector_to_prog_var, write_model_init
use assim_model_mod, only : get_model_size, aread_state_restart, &
open_restart_read, close_restart
use time_manager_mod, only : time_type, read_time, get_time, &
@@ -73,10 +76,24 @@
call initialize_utilities('dart_to_am2')
+! Read the namelist information
call find_namelist_in_file("input.nml", "dart_to_am2_nml", iunit)
read(iunit, nml = dart_to_am2_nml, iostat = io)
call check_namelist_read(iunit, io, "dart_to_am2_nml")
+! Record the namelist values
+if (do_nml_file()) write(nmlfileunit, nml=dart_to_am2_nml)
+if (do_nml_term()) write( * , nml=dart_to_am2_nml)
+
+write(*,*)
+write(*,'(''dart_to_am2:converting am2 restart file '',A, &
+ &'' to DART file '',A)') &
+ trim(restart_file), trim(dart_to_am2_input_file)
+
+!----------------------------------------------------------------------
+! Get to work
+!----------------------------------------------------------------------
+
call static_init_model()
x_size = get_model_size()
allocate(statevector(x_size))
@@ -111,6 +128,7 @@
! write fields to the netCDF initial file
call write_model_init(restart_file, tracer_file, var)
+call end_model_instance(var)
!----------------------------------------------------------------------
! Write a new coupler namelist with advance-to-time if need be.
@@ -131,6 +149,8 @@
read(iunit, nml = coupler_nml, iostat = io)
call check_namelist_read(iunit, io, "coupler_nml")
+ ! TJH Comment: get_date() gets YYYY,MM,DD,HH,MM,SS, which seems
+ ! TJH : exactly what is needed ... why only change DD,SS
! Change days and hours to advance
days = day
hours = sec/3600
Modified: DART/branches/development/models/am2/work/mkmf_am2_to_dart
===================================================================
--- DART/branches/development/models/am2/work/mkmf_am2_to_dart 2013-05-31 14:48:10 UTC (rev 6210)
+++ DART/branches/development/models/am2/work/mkmf_am2_to_dart 2013-05-31 15:20:04 UTC (rev 6211)
@@ -6,8 +6,8 @@
#
# $Id$
-../../../mkmf/mkmf -p trans_pv_sv -t ../../../mkmf/mkmf.template -c "-Duse_netCDF" \
- -a "../../.." path_names_trans_pv_sv
+../../../mkmf/mkmf -p am2_to_dart -t ../../../mkmf/mkmf.template -c "-Duse_netCDF" \
+ -a "../../.." path_names_am2_to_dart
exit $status
Modified: DART/branches/development/models/am2/work/mkmf_dart_to_am2
===================================================================
--- DART/branches/development/models/am2/work/mkmf_dart_to_am2 2013-05-31 14:48:10 UTC (rev 6210)
+++ DART/branches/development/models/am2/work/mkmf_dart_to_am2 2013-05-31 15:20:04 UTC (rev 6211)
@@ -6,8 +6,8 @@
#
# $Id$
-../../../mkmf/mkmf -p trans_sv_pv -t ../../../mkmf/mkmf.template -c "-Duse_netCDF" \
- -a "../../.." path_names_trans_sv_pv
+../../../mkmf/mkmf -p dart_to_am2 -t ../../../mkmf/mkmf.template -c "-Duse_netCDF" \
+ -a "../../.." path_names_dart_to_am2
exit $status
Modified: DART/branches/development/models/am2/work/path_names_am2_to_dart
===================================================================
--- DART/branches/development/models/am2/work/path_names_am2_to_dart 2013-05-31 14:48:10 UTC (rev 6210)
+++ DART/branches/development/models/am2/work/path_names_am2_to_dart 2013-05-31 15:20:04 UTC (rev 6211)
@@ -1,8 +1,8 @@
assim_model/assim_model_mod.f90
common/types_mod.f90
location/threed_sphere/location_mod.f90
+models/am2/am2_to_dart.f90
models/am2/model_mod.f90
-models/am2/trans_pv_sv.f90
mpi_utilities/null_mpi_utilities_mod.f90
obs_kind/obs_kind_mod.f90
random_seq/random_seq_mod.f90
Modified: DART/branches/development/models/am2/work/path_names_dart_to_am2
===================================================================
--- DART/branches/development/models/am2/work/path_names_dart_to_am2 2013-05-31 14:48:10 UTC (rev 6210)
+++ DART/branches/development/models/am2/work/path_names_dart_to_am2 2013-05-31 15:20:04 UTC (rev 6211)
@@ -1,8 +1,8 @@
assim_model/assim_model_mod.f90
common/types_mod.f90
location/threed_sphere/location_mod.f90
+models/am2/dart_to_am2.f90
models/am2/model_mod.f90
-models/am2/trans_sv_pv.f90
mpi_utilities/null_mpi_utilities_mod.f90
obs_kind/obs_kind_mod.f90
random_seq/random_seq_mod.f90
More information about the Dart-dev
mailing list