[Dart-dev] [6210] DART/branches/development/models/am2: Renamed files to obviously reflect their purpose.
nancy at ucar.edu
nancy at ucar.edu
Fri May 31 08:48:11 MDT 2013
Revision: 6210
Author: thoar
Date: 2013-05-31 08:48:10 -0600 (Fri, 31 May 2013)
Log Message:
-----------
Renamed files to obviously reflect their purpose.
Removed unused files/programs.
Removed all shell scripts because they were completely
wrong - they were still for a proto cam/clm - nothing
to do with AM2.
Added 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
Removed Paths:
-------------
DART/branches/development/models/am2/full_experiment/
DART/branches/development/models/am2/shell_scripts/advance_model.csh
DART/branches/development/models/am2/shell_scripts/check_model.csh
DART/branches/development/models/am2/shell_scripts/diags.csh
DART/branches/development/models/am2/shell_scripts/job.simple.csh
DART/branches/development/models/am2/trans_pv_sv.f90
DART/branches/development/models/am2/trans_pv_sv_pert0.f90
DART/branches/development/models/am2/trans_pv_sv_time0.f90
DART/branches/development/models/am2/trans_sv_pv.f90
DART/branches/development/models/am2/work/mkmf_trans_pv_sv
DART/branches/development/models/am2/work/mkmf_trans_pv_sv_pert0
DART/branches/development/models/am2/work/mkmf_trans_pv_sv_time0
DART/branches/development/models/am2/work/mkmf_trans_sv_pv
DART/branches/development/models/am2/work/path_names_trans_pv_sv
DART/branches/development/models/am2/work/path_names_trans_pv_sv_pert0
DART/branches/development/models/am2/work/path_names_trans_pv_sv_time0
DART/branches/development/models/am2/work/path_names_trans_sv_pv
-------------- next part --------------
Copied: DART/branches/development/models/am2/am2_to_dart.f90 (from rev 6208, DART/branches/development/models/am2/trans_pv_sv.f90)
===================================================================
--- DART/branches/development/models/am2/am2_to_dart.f90 (rev 0)
+++ DART/branches/development/models/am2/am2_to_dart.f90 2013-05-31 14:48:10 UTC (rev 6210)
@@ -0,0 +1,136 @@
+! DART software - Copyright 2004 - 2011 UCAR. This open source software is
+! provided by UCAR, "as is", without charge, subject to all terms of use at
+! http://www.image.ucar.edu/DAReS/DART/DART_download
+
+program am2_to_dart
+
+!----------------------------------------------------------------------
+! 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.
+! 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
+!
+!----------------------------------------------------------------------
+
+use types_mod, only : r8
+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
+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
+
+implicit none
+
+! version controlled file description for error handling, do not edit
+character(len=128), parameter :: &
+ source = "$URL$", &
+ revision = "$Revision$", &
+ revdate = "$Date$"
+
+!-----------------------------------------------------------------------
+! namelist parameters with default values.
+!-----------------------------------------------------------------------
+
+character(len=128) :: restart_file = 'fv_rst.res.nc'
+character(len=128) :: tracer_file = 'atmos_tracers.res.nc'
+character(len=128) :: am2_to_dart_output_file = 'dart_ics'
+
+namelist /am2_to_dart_nml/ restart_file, tracer_file, am2_to_dart_output_file
+
+!----------------------------------------------------------------------
+! global storage
+!----------------------------------------------------------------------
+
+character(len=256) :: string1
+type(model_type) :: var
+type(time_type) :: model_time
+real(r8), allocatable :: statevector(:)
+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
+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")
+
+! Record the namelist values
+if (do_nml_file()) write(nmlfileunit, nml=am2_to_dart_nml)
+if (do_nml_term()) write( * , nml=am2_to_dart_nml)
+
+write(*,*)
+write(*,'(''am2_to_dart:converting am2 restart file '',A, &
+ &'' to DART file '',A)') &
+ trim(restart_file), trim(am2_to_dart_output_file)
+
+!----------------------------------------------------------------------
+! Get to work
+!----------------------------------------------------------------------
+
+x_size = get_model_size()
+allocate(statevector(x_size))
+
+! Allocate the instance of the AM2 model type for storage
+call init_model_instance(var)
+
+! Read the file AM2 state fragments into var, but not time
+call read_model_init(restart_file, tracer_file, var)
+
+! Ensure that all tracers that are <=1e-10 get set to zero.
+! Further, ensure that CF is <=1 and exit if CLW or CIW are >1e-1
+! Lastly, output error message that says how many values are getting adjusted.
+!if (any(var%tracers(:,:,:,1:2) > 1e-1)) then
+! big_cld_iw = count(var%tracers(:,:,:,1:2) > 1e-1)
+! print*, 'Stopping due to ', big_cld_iw, ' values of cloud ice and water > 1e-1'
+ !stop
+!endif
+!small_trcs = count(var%tracers < 1e-10)
+!print*, 'Number of tracer values < 1e-10 ', small_trcs
+
+!where(var%tracers < 1e-10) var%tracers = 0
+!where(var%tracers(:,:,:,3) > 1) var%tracers(:,:,:,3) = 1
+
+! transform fields into state vector for DART
+call prog_var_to_vector(var, statevector)
+call end_model_instance(var)
+
+! Get current model time from line 3 of coupler.res
+iunit = open_file('coupler.res',form = 'formatted', action = 'read')
+read(iunit,*) string1
+read(iunit,*) string1
+read(iunit,*) year, month, day, hour, minute, second
+call close_file(iunit)
+
+! Set model_time
+model_time = set_date(year, month, day, hour, minute, second)
+
+! write out state vector in "proprietary" format
+iunit = open_restart_write(am2_to_dart_output_file)
+call awrite_state_restart(model_time, statevector, iunit)
+call close_restart(iunit)
+
+call finalize_utilities('am2_to_dart')
+
+end program am2_to_dart
+
+! <next few lines under version control, do not edit>
+! $URL$
+! $Id$
+! $Revision$
+! $Date$
+
Copied: DART/branches/development/models/am2/dart_to_am2.f90 (from rev 6208, DART/branches/development/models/am2/trans_sv_pv.f90)
===================================================================
--- DART/branches/development/models/am2/dart_to_am2.f90 (rev 0)
+++ DART/branches/development/models/am2/dart_to_am2.f90 2013-05-31 14:48:10 UTC (rev 6210)
@@ -0,0 +1,160 @@
+! DART software - Copyright 2004 - 2011 UCAR. This open source software is
+! provided by UCAR, "as is", without charge, subject to all terms of use at
+! http://www.image.ucar.edu/DAReS/DART/DART_download
+
+program dart_to_am2
+
+!----------------------------------------------------------------------
+! purpose: interface between AM2 and DART
+!
+! method: Read DART state vector ("proprietary" format), but not time(s).
+! 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.
+!
+! 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
+!
+!----------------------------------------------------------------------
+
+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
+use model_mod, only : model_type, static_init_model, init_model_instance, &
+ write_model_init, vector_to_prog_var
+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, &
+ print_time, print_date, operator(-)
+
+implicit none
+
+! version controlled file description for error handling, do not edit
+character(len=128), parameter :: &
+ source = "$URL$", &
+ revision = "$Revision$", &
+ revdate = "$Date$"
+
+type(model_type) :: var
+type(time_type) :: adv_to_time, model_time, deltat
+real(r8), allocatable :: statevector(:)
+integer :: x_size, sec, day, iunit, io
+
+!------------------------------------------------------------------
+! The namelist variables
+!------------------------------------------------------------------
+
+character (len = 128) :: dart_to_am2_input_file = 'dart_restart'
+character (len = 128) :: restart_file = 'fv_rst.res.nc'
+character (len = 128) :: tracer_file = 'atmos_tracers.res.nc'
+logical :: advance_time_present = .false.
+
+namelist /dart_to_am2_nml/ dart_to_am2_input_file, &
+ restart_file, tracer_file, &
+ advance_time_present
+
+!------------------------------------------------------------------
+! Namelist coupler_nml default values
+!------------------------------------------------------------------
+
+integer :: months = 0, days = 0, hours = 0
+integer :: dt_atmos = 1800, dt_ocean = 21600, dt_cpld = 21600
+integer, dimension(6) :: current_date = (/2007,1,1,0,0,0/)
+character (len = 8) :: calendar = "'julian'"
+!character (len = 15) :: current_date = '2006,1,1,0,0,0,'
+
+namelist /coupler_nml/ &
+ months, days, hours, dt_atmos, dt_ocean, dt_cpld, current_date, calendar
+
+!------------------------------------------------------------------
+
+call initialize_utilities('dart_to_am2')
+
+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")
+
+call static_init_model()
+x_size = get_model_size()
+allocate(statevector(x_size))
+
+!----------------------------------------------------------------------
+! Reads the valid time, the state, and the target time.
+!----------------------------------------------------------------------
+
+iunit = open_restart_read(dart_to_am2_input_file)
+if ( advance_time_present ) then
+ call aread_state_restart(model_time, statevector, iunit, adv_to_time)
+else
+ call aread_state_restart(model_time, statevector, iunit)
+endif
+call close_restart(iunit)
+
+!----------------------------------------------------------------------
+! Update the current AM2 restart file
+!----------------------------------------------------------------------
+
+! Allocate the instance of the am2 model type
+call init_model_instance(var)
+
+! decompose vector back into AM2 fields
+call vector_to_prog_var (statevector, var)
+deallocate (statevector)
+
+! if any of the tracer fields are negative, change them to zero
+! also, restrain CF to be between 0 and 1
+where(var%tracers < 0) var%tracers = 0
+where(var%tracers(:,:,:,3) > 1) var%tracers(:,:,:,3) = 1
+
+! write fields to the netCDF initial file
+call write_model_init(restart_file, tracer_file, var)
+
+!----------------------------------------------------------------------
+! Write a new coupler namelist with advance-to-time if need be.
+!----------------------------------------------------------------------
+
+call print_date( model_time,'dart_to_am2: AM2 model date')
+call print_time( model_time,'dart_to_am2: DART model time')
+call print_date( model_time,'dart_to_am2: AM2 model date',logfileunit)
+call print_time( model_time,'dart_to_am2: DART model time',logfileunit)
+
+if (advance_time_present) then
+
+ deltat = adv_to_time - model_time
+ call get_time(deltat,sec,day)
+
+ ! Read append.nml's coupler_nml values
+ call find_namelist_in_file("append.nml","coupler_nml",iunit)
+ read(iunit, nml = coupler_nml, iostat = io)
+ call check_namelist_read(iunit, io, "coupler_nml")
+
+ ! Change days and hours to advance
+ days = day
+ hours = sec/3600
+
+ !Write newappend.nml with new days and hours variables
+ iunit = get_unit()
+ open(unit=iunit,file="newappend.nml",action='write')
+ write(iunit,nml = coupler_nml, iostat = io)
+ call close_file(iunit)
+
+ call print_time(adv_to_time,'dart_to_am2:advance_to time')
+ call print_date(adv_to_time,'dart_to_am2:advance_to date')
+ call print_time(adv_to_time,'dart_to_am2:advance_to time',logfileunit)
+ call print_date(adv_to_time,'dart_to_am2:advance_to date',logfileunit)
+
+endif
+
+call finalize_utilities('dart_to_am2')
+
+end program dart_to_am2
+
+! <next few lines under version control, do not edit>
+! $URL$
+! $Id$
+! $Revision$
+! $Date$
+
Deleted: DART/branches/development/models/am2/shell_scripts/advance_model.csh
===================================================================
--- DART/branches/development/models/am2/shell_scripts/advance_model.csh 2013-05-31 14:44:11 UTC (rev 6209)
+++ DART/branches/development/models/am2/shell_scripts/advance_model.csh 2013-05-31 14:48:10 UTC (rev 6210)
@@ -1,235 +0,0 @@
-#!/bin/csh
-#
-# DART software - Copyright 2004 - 2011 UCAR. This open source software is
-# provided by UCAR, "as is", without charge, subject to all terms of use at
-# http://www.image.ucar.edu/DAReS/DART/DART_download
-#
-# $Id$
-#
-#----------------------------------------------------------------------
-# advance_model.csh
-#
-# Script to advance one ensemble member one filter "time step"
-# when the model advance is executed as a separate process.
-# Called by the filter executable.
-# Calls run-cam.csh, the CAM execution script.
-# Calls 3 translation routines to translate time and model state.
-# Runs on one of the compute nodes allotted to the filter executable
-#
-# Arguments are the process number of caller, the number of state copies
-# belonging to that process, and the name of the filter_control_file for
-# that process
-
-# arg#1 is the name of the CENTRALDIR
-# arg#2 is the number of ensemble members
-# arg#3 is the name of the control file that determines which members will
-# be advanced on which processors.
-#----------------------------------------------------------------------
-
-set process = $1
-set num_states = $2
-set control_file = $3
-echo "advance_model.csh args = $1 $2 $3"
-
-set retry_max = 2
-
-# Get unique name for temporary working directory for this process's stuff
-set temp_dir = 'advance_temp'${process}
-
-# args to previous version of this script
-set myname = $0
-set CENTRALDIR = `pwd`
-
-# Create a clean temporary directory and go there
-\rm -rf $temp_dir
-mkdir -p $temp_dir
-cd $temp_dir
-
-# People have the craziest aliases. These prevent the obsessive-compulsive
-# from causing themselves no end of angst.
-if ( ! $?REMOVE ) then
- set REMOVE = 'rm -rf'
-endif
-if ( ! $?COPY ) then
- set COPY = 'cp -fp'
-endif
-if ( ! $?MOVE ) then
- set MOVE = 'mv -f'
-endif
-if ( ! $?LINK ) then
- set LINK = 'ln -fs'
-endif
-
-echo "CENTRALDIR is ${CENTRALDIR}" > cam_out_temp
-echo "temp_dir is $temp_dir" >> cam_out_temp
-
-# Get information about this experiment from file "casemodel",
-# created by the main controlling script (job.csh)
-
-# set $case = the case and
-# $model = the directory name (in the CAM source tree)
-# where CAM executable will be found.
-# set locations of the CAM and CLM input files
-set case = `head -1 ${CENTRALDIR}/casemodel | tail -1`
-set model = `head -2 ${CENTRALDIR}/casemodel | tail -1`
-set cam_init = `head -3 ${CENTRALDIR}/casemodel | tail -1`
-set clm_init = `head -4 ${CENTRALDIR}/casemodel | tail -1`
-
-# output diagnostic information to the same file as the CAM list-directed output
-echo "case $case model $model" >> cam_out_temp
-echo "cam init is $cam_init" >> cam_out_temp
-echo "clm init is $clm_init" >> cam_out_temp
-
-# Loop through each ensemble this task is responsible for advancing.
-set ensemble_number_line = 1
-set input_file_line = 2
-set output_file_line = 3
-set state_copy = 1
-while($state_copy <= $num_states)
-
- # loop through the control file, extracting lines in groups of 3.
- set ensemble_number = `head -$ensemble_number_line ../$control_file | tail -1`
- set input_file = `head -$input_file_line ../$control_file | tail -1`
- set output_file = `head -$output_file_line ../$control_file | tail -1`
-
- # the previous script used element instead of ensemble_number. make them
- # the same for now.
- set element = $ensemble_number
- touch cam_out_temp
- echo "starting ${myname} for ens member $element at "`date` >> cam_out_temp
-
- # get model state initial conditions for this ensemble member
- ${LINK} ${CENTRALDIR}/$input_file temp_ic
-
- # get filter namelists for use by cam
- ${COPY} ${CENTRALDIR}/input.nml input.nml
-
- # this just creates a file that helps you figure out which member is
- # being advanced in this directory. FYI only, you don't need it.
- echo $element >! element
- cp element element$element
-
- echo "ls $temp_dir for element $element" >> cam_out_temp
- ls -lRt >> cam_out_temp
-
- # Need a base CAM initial file into which to copy state vector from filter.
- # c[al]minput_$element also carry along CAM/CLM fields which are not updated
- # by the filter (not part of the filter model state).
- # First look for c[al]minput.nc resulting from the previous advance of this ensemble
- # member from within the same day/obs_seq.out time span (in CENTRALDIR)
- # Failing that, look for the results of the last advance of this ensemble member
- # of the previous obs_seq.out (i.e. in CENTRALDIR/exp_name/day/CAM)
- # Failing that (when starting an experiment which has no spun up set of members)
- # get a copy of a single CAM initial file (usually from somewhere independent
- # of this experiment, i.e. /scratch/.../New_state/T42_GWD/CAM/caminput_0.nc)
-
- if (-e ${CENTRALDIR}/caminput_${element}.nc) then
- ${COPY} ${CENTRALDIR}/caminput_${element}.nc caminput.nc
- echo "CENTRALDIR caminput comes from ${CENTRALDIR}/caminput_${element}.nc" >> cam_out_temp
- else if (-e ${cam_init}${element}.nc) then
- ${COPY} ${cam_init}${element}.nc caminput.nc
- echo "cam_init caminput comes from ${cam_init}${element}.nc" >> cam_out_temp
- else
- ${COPY} ${cam_init}0.nc caminput.nc
- echo "DEFAULT caminput comes from ${cam_init}0.nc" >> cam_out_temp
- endif
-
- if ( -e ${CENTRALDIR}/clminput_${element}.nc) then
- ${COPY} ${CENTRALDIR}/clminput_${element}.nc clminput.nc
- else if (-e ${clm_init}${element}.nc) then
- ${COPY} ${clm_init}${element}.nc clminput.nc
- else
- ${COPY} ${clm_init}0.nc clminput.nc
- endif
-
- ${LINK} ${CENTRALDIR}/topog_file.nc .
-
- # create 'times' file for CAM from DART times in assim_model_state_ic#
- # This info is passed to CAM through the creation of its namelist
- if (-e temp_ic && -e ${CENTRALDIR}/trans_time) then
- echo 'advance_model; executing trans_time '`date` >> cam_out_temp
- ${CENTRALDIR}/trans_time >> cam_out_temp
- ls -lt >> cam_out_temp
- ${COPY} times ${CENTRALDIR}
- else
- echo "ERROR: either ic file $element or trans_time not available for trans_time"
- exit 1
- endif
-
- # Create an initial CAM.nc file from the DART state vector
- # Times are handled separately in trans_time
- echo ' ' >> cam_out_temp
- echo 'Executing trans_sv_pv' >> cam_out_temp
- ${CENTRALDIR}/trans_sv_pv >> cam_out_temp
- ls -ltR >> cam_out_temp
-
- # advance cam
- # echo executing: ${model:h}/run-cam.csh ${case}-$element $model ${CENTRALDIR} >> cam_out_temp
- set retry = 0
- while ($retry < $retry_max)
- echo executing: ${CENTRALDIR}/run-cam.csh ${case}-$element $model ${CENTRALDIR} \
- >> cam_out_temp
- ${CENTRALDIR}/run-cam.csh ${case}-$element $model ${CENTRALDIR} >>& cam_out_temp
-
- grep 'END OF MODEL RUN' cam_out_temp > /dev/null
- if ($status == 0) then
- set retry = $retry_max
- # Extract the new state vector information from the new caminput.nc and
- # put it in temp_ud (time followed by state)
- echo ' ' >> cam_out_temp
- echo 'Executing trans_pv_sv' >> cam_out_temp
- ${CENTRALDIR}/trans_pv_sv >> cam_out_temp
-
- # Move updated state vector and new CAM/CLM initial files back to experiment
- # directory for use by filter and the next advance.
- ${MOVE} temp_ud ${CENTRALDIR}/$output_file
- ${MOVE} clminput.nc ${CENTRALDIR}/clminput_${element}.nc
- ${MOVE} caminput.nc ${CENTRALDIR}/caminput_${element}.nc
- ${MOVE} namelist ${CENTRALDIR}
-
- echo "finished ${myname} for ens member $element at "`date` >> cam_out_temp
- ${MOVE} cam_out_temp ${CENTRALDIR}/cam_out_temp$element
- else
- @ retry++
- if ($retry < $retry_max) then
- echo "WARNING - CAM $element stopped abnormally; will be retried"
- echo "WARNING - CAM $element stopped abnormally; will be retried" >> cam_out_temp
- echo "===========================================================" >> cam_out_temp
- else
- set DEADDIR = ${temp_dir}_dead
- echo "WARNING - CAM $element stopped abnormally; see $DEADDIR"
- echo "WARNING - CAM $element stopped abnormally; see $DEADDIR" >> cam_out_temp
- ${COPY} cam_out_temp ${CENTRALDIR}/cam_out_temp${element}_died
- mkdir $DEADDIR
- ${MOVE} * $DEADDIR
- exit -${element}
- endif
- endif
- end
-
- # if this process needs to advance more than one model, read the next set of
- # filenames and ensemble number at the top of this loop.
-
- @ state_copy++
- @ ensemble_number_line = $ensemble_number_line + 3
- @ input_file_line = $input_file_line + 3
- @ output_file_line = $output_file_line + 3
-end
-
-cd ${CENTRALDIR}
-
-# lightnings filesystem was misbehaving if you removed the directory.
-# it was more reliable if you just left the directory empty. It's bogus, but true.
-${REMOVE} $temp_dir/*
-
-# Remove the filter_control file to signal completion
-# Is there a need for any sleeps to avoid trouble on completing moves here?
-\rm -rf $control_file
-
-exit 0
-
-# <next few lines under version control, do not edit>
-# $URL$
-# $Revision$
-# $Date$
-
Deleted: DART/branches/development/models/am2/shell_scripts/check_model.csh
===================================================================
--- DART/branches/development/models/am2/shell_scripts/check_model.csh 2013-05-31 14:44:11 UTC (rev 6209)
+++ DART/branches/development/models/am2/shell_scripts/check_model.csh 2013-05-31 14:48:10 UTC (rev 6210)
@@ -1,27 +0,0 @@
-#!/bin/csh
-#
-# DART software - Copyright 2004 - 2011 UCAR. This open source software is
-# provided by UCAR, "as is", without charge, subject to all terms of use at
-# http://www.image.ucar.edu/DAReS/DART/DART_download
-#
-# $Id$
-
-if ($#argv < 1) then
- echo "usage; check_cam num_ens_members"
- exit
-endif
-
-set n = 1
-while ($n <= $1)
- tail -40 cam_out_temp$n | grep 'END OF MODEL RUN' > /dev/null
- if ($status != 0) echo cam_out_temp$n finished abnormally
- @ n++
-end
-
-exit 0
-
-# <next few lines under version control, do not edit>
-# $URL$
-# $Revision$
-# $Date$
-
Deleted: DART/branches/development/models/am2/shell_scripts/diags.csh
===================================================================
--- DART/branches/development/models/am2/shell_scripts/diags.csh 2013-05-31 14:44:11 UTC (rev 6209)
+++ DART/branches/development/models/am2/shell_scripts/diags.csh 2013-05-31 14:48:10 UTC (rev 6210)
@@ -1,90 +0,0 @@
-#!/bin/csh
-#
-# DART software - Copyright 2004 - 2011 UCAR. This open source software is
-# provided by UCAR, "as is", without charge, subject to all terms of use at
-# http://www.image.ucar.edu/DAReS/DART/DART_download
-#
-# $Id$
-
-# DART source directory on this machine
-
-set DART = ~/Pre-J/DART
-set exp_dir = `pwd`
-set innov_freq = 1
-
-if ($#argv == 0) then
- echo
- echo '1) Sets up environment for and runs the obs_diag program for'
- echo ' observation space diagnostics in the $exp directory.'
- echo '2) Runs the suite of matlab diagnostics.'
- echo '3) Generates some innovation files and optionally (securely)'
- echo 'copies the results to another machine.'
- echo 'Takes several arguments, but must be edited to change'
- echo 'other characteristics.'
- echo
- echo 'Usage: diags.csh last_obs_seq ps_direct [exp_mach:/directory]'
- exit
-else if ($#argv == 3) then
- set destin = $3
-endif
-
-set last_dir = $1
-set ps_dir = $2
-
-ln -s ../topog_file.nc topog_file.nc
-ln -s ../caminput.nc caminput.nc
-cp $last_dir/input.nml .
-vi input.nml
-$DART/models/cam/work/obs_diag >& diag.out
-
-# matlab batch job
-# addpath $DART/diagnostics/matlab
-# to do from home;
-# matlab -nodisplay >&! matlab.out << EOF
-# orig
-matlab >&! matlab.out << EOF
-fit_ens_mean_time
-fit_ens_spread_time
-obs_num_time
-obs_num_vertical
-fit_mean_spread_time
-fit_ens_mean_vertical
-fit_ens_bias_vertical
-exit
-EOF
-
-mkdir $ps_dir
-mv *.m *.dat *.ps input.nml $ps_dir
-tar c -f {$exp_dir:t}_${last_dir}_Diags.tar $ps_dir/*.ps $ps_dir/input.nml
-
-set n = 1
-set more = true
-while ($more == true)
- set obs_seq = 01_0$n
- if ($n > 9) set obs_seq = 01_$n
- if ($obs_seq == $last_dir) set more = false
-
- if (! -e $obs_seq/Innov.nc && $n % $innov_freq == 0) then
- cd $obs_seq
- innov
- cd ..
-# tar r -f {$exp_dir:t}_${last_dir}_Diags.tar $obs_seq/*.nc
-# tar r -f {$exp_dir:t}_${last_dir}_Diags.tar $obs_seq/*.nc $obs_seq/input.nml
- endif
-# orig
- tar r -f {$exp_dir:t}_${last_dir}_Diags.tar $obs_seq/P*.nc
- @ n++
-end
-
-if ($#argv == 3) then
- scp {$exp_dir:t}_${last_dir}_Diags.tar $destin
- scp ../explist $destin
-endif
-
-exit 0
-
-# <next few lines under version control, do not edit>
-# $URL$
-# $Revision$
-# $Date$
-
Deleted: DART/branches/development/models/am2/shell_scripts/job.simple.csh
===================================================================
--- DART/branches/development/models/am2/shell_scripts/job.simple.csh 2013-05-31 14:44:11 UTC (rev 6209)
+++ DART/branches/development/models/am2/shell_scripts/job.simple.csh 2013-05-31 14:48:10 UTC (rev 6210)
@@ -1,387 +0,0 @@
-#!/bin/csh
-#
-# DART software - Copyright 2004 - 2011 UCAR. This open source software is
-# provided by UCAR, "as is", without charge, subject to all terms of use at
-# http://www.image.ucar.edu/DAReS/DART/DART_download
-#
-# $Id$
-#
-#-----------------------------------------------------------------------------
-# job.simple.csh ... Top level script to run a single assimilation experiment.
-#
-# Unlike the more complex job.csh, this script only processes a single
-# observation file. Still fairly complex; requires a raft of
-# data files and most of them are in hardcoded locations.
-#
-# You need to know which of several batch systems you are using. The most
-# common one is LSF. PBS is also common. (POE is another but is
-# not supported directly by this script. It is not recommended that you have a
-# parallel cluster without a batch system (it schedules which nodes are assigned
-# to which processes) but it is possible to run that way -- you have to do
-# more work to get the information about which nodes are involved to the
-# parallel tasks -- but anyway, there is a section below that uses ssh and no
-# batch.
-#
-# How to submit this job:
-# 1. Look at the #BSUB or #PBS sections below and adjust any of the parameters
-# on your cluster. Queue names are very system specific; some systems
-# require wall-clock limits; some require an explicit charge code.
-# 2. Submit this script to the queue:
-# LSF: bsub < job.simple.csh
-# PBS: qsub job.simple.csh
-# NONE: job.simple.csh
-#
-# The script moves the necessary files to the current directory and then
-# starts 'filter' as a parallel job on all nodes; each of these tasks will
-# call some a separate model_advance.csh when necessary.
-#
-# The central directory is where the scripts reside and where script and
-# program I/O are expected to happen.
-#-----------------------------------------------------------------------------
-#
-#=============================================================================
-# This block of directives constitutes the preamble for the LSF queuing system
-# LSF is used on the IBM Linux cluster 'lightning'
-# LSF is used on the IMAGe Linux cluster 'coral'
-# LSF is used on the IBM 'bluevista'
-# The queues on lightning and bluevista are supposed to be similar.
-#
-# the normal way to submit to the queue is: bsub < job.simple.csh
-#
-# an explanation of the most common directives follows:
-# -J Job name
-# -o STDOUT filename
-# -e STDERR filename
-# -P account
-# -q queue cheapest == [standby, economy, (regular,debug), premium] == $$$$
-# -n number of processors (really)
-# -W hr:mn max wallclock time (required on some systems)
-##=============================================================================
-#BSUB -J DARTCAM
-#BSUB -o DARTCAM.%J.log
-#BSUB -q regular
-#BSUB -n 1
-#
-#
-##=============================================================================
-## This block of directives constitutes the preamble for the PBS queuing system
-## PBS is used on the CGD Linux cluster 'bangkok'
-## PBS is used on the CGD Linux cluster 'calgary'
-##
-## the normal way to submit to the queue is: qsub job.simple.csh
-##
-## an explanation of the most common directives follows:
-## -N Job name
-## -r n Declare job non-rerunable
-## -e <arg> filename for standard error
-## -o <arg> filename for standard out
-## -q <arg> Queue name (small, medium, long, verylong)
-## -l nodes=xx:ppn=2 requests BOTH processors on the node. On both bangkok
-## and calgary, there is no way to 'share' the processors
-## on the node with another job, so you might as well use
-## them both. (ppn == Processors Per Node)
-##=============================================================================
-#PBS -N DARTCAM
-#PBS -r n
-#PBS -e DARTCAM.err
-#PBS -o DARTCAM.log
-#PBS -q medium
-#PBS -l nodes=2:ppn=2
-
-# A common strategy for the beginning is to check for the existence of
-# some variables that get set by the different queuing mechanisms.
-# This way, we know which queuing mechanism we are working with,
-# and can set 'queue-independent' variables for use for the remainder
-# of the script.
-
-if ($?LS_SUBCWD) then
-
- # LSF has a list of processors already in a variable (LSB_HOSTS)
-
- set CENTRALDIR = $LS_SUBCWD
- set JOBNAME = $LSB_JOBNAME
- alias submit 'mpirun.lsf \!*'
-
-else if ($?PBS_O_WORKDIR) then
-
- # PBS has a list of processors in a file whose name is (PBS_NODEFILE)
-
- set CENTRALDIR = $PBS_O_WORKDIR
- set JOBNAME = $PBS_JOBNAME
- alias submit 'mpirun \!*'
-
-else if ($?OCOTILLO_NODEFILE) then
-
- # ocotillo is a 'special case'. It is the only cluster I know of with
- # no queueing system. You must generate a list of processors in a
- # file whose name is in $OCOTILLO_NODEFILE. For example ...
- # setenv OCOTILLO_NODEFILE my_favorite_processors
- # echo "node1" > $OCOTILLO_NODEFILE
- # echo "node5" >> $OCOTILLO_NODEFILE
- # echo "node7" >> $OCOTILLO_NODEFILE
- # echo "node3" >> $OCOTILLO_NODEFILE
-
- set CENTRALDIR = `pwd`
- set JOBNAME = DARTCAM
- # i think this is what we want, but csh will not let you do multiline
- # executions; this argues for using ksh (line 2 below)... (and maybe
- # it needs a cd as well?)
- #alias submit 'foreach i ($OCOTILLO_NODEFILE) ; ssh $i csh \!* ; end'
- #alias submit='for i in $OCOTILLO_NODEFILE ; do ssh $i (cd $CENTRALDIR; csh $*) ; done'
- alias submit 'csh \!*'
-
-else
-
- # interactive
- # YOU need to know if you are using the PBS or LSF queuing
- # system ... and set 'submit' accordingly.
-
- set CENTRALDIR = `pwd`
- set JOBNAME = DARTCAM
- alias submit 'csh \!*'
-
-endif
-
-set myname = $0 # this is the name of this script
-set nonomatch # suppress "rm" warnings if wildcard does not match anything
-
-# Set the experiment name.
-
-set experiment = CAM1X
-
-cd ${CENTRALDIR}
-
-# The FORCE options are not optional.
-# The VERBOSE options are useful for debugging though
-# some systems don't like the -v option to any of the following
-set OSTYPE = `uname -s`
-switch ( ${OSTYPE} )
- case IRIX64:
- setenv REMOVE 'rm -rf'
- setenv COPY 'cp -p'
- setenv MOVE 'mv -f'
- breaksw
- case AIX:
- setenv REMOVE 'rm -rf'
- setenv COPY 'cp -p'
- setenv MOVE 'mv -f'
- breaksw
- default:
- setenv REMOVE 'rm -rvf'
- setenv COPY 'cp -vp'
- setenv MOVE 'mv -fv'
- breaksw
-endsw
-
-echo " "
-echo "Running $JOBNAME on host "`hostname`
-echo "Initialized at "`date`
-echo "CENTRALDIR is "`pwd`
-
-#-----------------------------------------------------------------------------
-# Set variables containing various directory names where we will GET things
-#-----------------------------------------------------------------------------
-
-set DARTDIR = /home/coral/${user}/dart/DART
-set DARTCAMDIR = ${DARTDIR}/models/cam
-set CAMDATADIR = /fs/image/home/${user}/CAMDATA
-
-#-----------------------------------------------------------------------------
-# Get the DARTCAM executables and scripts
-#-----------------------------------------------------------------------------
-
-${COPY} ${DARTCAMDIR}/work/filter .
-${COPY} ${DARTCAMDIR}/work/assim_region .
-${COPY} ${DARTCAMDIR}/work/trans_date_to_dart .
-${COPY} ${DARTCAMDIR}/work/trans_pv_sv .
-${COPY} ${DARTCAMDIR}/work/trans_pv_sv_time0 .
-${COPY} ${DARTCAMDIR}/work/trans_sv_pv .
-${COPY} ${DARTCAMDIR}/work/trans_time .
-${COPY} ${DARTCAMDIR}/shell_scripts/advance_model.csh .
-${COPY} ${DARTCAMDIR}/shell_scripts/run-pc.csh .
-
-#-----------------------------------------------------------------------------
-# Get the necessary data files -- this is the hard part.
-# This script does not involve 'cold starting' CAM, nor spinning up DART.
-# The DARTics directory has one initial conditions file for
-# each ensemble member. We need one for each ...
-# The input.nml has a restart_in_file_name of 'filter_ic_old'
-# which must match the filename here.
-# Because that same namelist has 'single_restart_file_in' as .false.,
-# the restart_in_file_name gets an ensemble member number appended to it.
-#-----------------------------------------------------------------------------
-
-${COPY} ${CAMDATADIR}/input.nml .
-${COPY} ${CAMDATADIR}/obs_seq.out .
-
-# try to discover the ensemble size from the input.nml
-# this is some gory shell programming ... all to do 'something simple'
-
-grep ens_size input.nml >! ensstring.$$
-set STRING = "1,$ s#,##g"
-set ensstring = `sed -e "$STRING" ensstring.$$`
-set num_ens = $ensstring[3]
-
-${REMOVE} ensstring.$$
-
-echo "There are ${num_ens} ensemble members."
-
-# This just copies just the initial conditions for the correct number
-# of ensemble members.
-
-set DARTics = /ptmp/raeder/CAM_init/T21x80/03-01-01/DART_lunes
-
-set n = 1
-while($n <= ${num_ens})
- set from = ${DARTics}/filter_ic*[.0]$n
- ${COPY} $from filter_ic_old.$from:e
- @ n++
-end
-
-${COPY} ${CAMDATADIR}/namelistin .
-${COPY} ${CAMDATADIR}/caminput.nc .
-${COPY} ${CAMDATADIR}/clminput.nc .
-set CAMics = /ptmp/raeder/CAM_init/T21x80/03-01-01/CAM/caminput_
-set CLMics = /ptmp/raeder/CAM_init/T21x80/03-01-01/CLM/clminput_
-
-#-----------------------------------------------------------------------------
-# T21
-# inflate_1_ic is the wrong size, but I need to set it to something
-# The CAMsrc directory is MORE than just the location of the executable.
-# There are more support widgets expected in the directory tree.
-#-----------------------------------------------------------------------------
-
-# set inflate_1_ic = ../Pre-J/Exp4/01_62/DART
-
-set CAMsrc = /home/coral/raeder/Cam3/cam3.1/models/atm/cam/bld/T21-O2
-
-#-----------------------------------------------------------------------------
-# Ensure the (output) experiment directory exists
-# All the CAM-related files will get put in ${experiment}/CAM
-# All the CLM-related files will get put in ${experiment}/CLM
-# All the DART-related files will get put in ${experiment}/DART
-#-----------------------------------------------------------------------------
-
-if (-d ${experiment}) then
- echo "${experiment} already exists"
-else
- echo "Making run-time directory ${experiment} ..."
- mkdir -p ${experiment}
-endif
-mkdir -p ${experiment}/{CLM,CAM,DART}
-
-#-----------------------------------------------------------------------------
-# This is where I should check to make sure all the required files exist.
-#-----------------------------------------------------------------------------
-
-if (! -e namelistin ) then
- echo "ERROR ... need a namelistin file."
- exit 99
-endif
-
-#-----------------------------------------------------------------------------
-# get name of file containing PHIS from the CAM namelist. This will be used by
-# static_init_model to read in the PHIS field, which is used for height obs.
-#-----------------------------------------------------------------------------
- grep bnd_topo namelistin >! topo_file
- set STRING = "1,$ s#'##g"
- set ensstring = `sed -e "$STRING" topo_file`
- set topo_name = $ensstring[3]
-# ln -s $topo_name topog_file.nc
- cp $topo_name topog_file.nc
- chmod 644 topog_file.nc
- ${REMOVE} topo_file
-
-#-----------------------------------------------------------------------------
-# Some information about CAM must be made available to advance_model.csh
-# filter_server.csh spawns advance_ens.csh which spawns advance_model.csh
-# 'casemodel' is required (by advance_model.csh) to be in the Central directory
-#-----------------------------------------------------------------------------
-
-echo "${experiment} ${CAMsrc} ${CAMics} ${CLMics}" >! casemodel
-
-#-----------------------------------------------------------------------------
-# Runs filter which integrates the results of model advances (async=2).
-#
-# A 20 member ensemble @ T21 can take anywhere between 10-30 minutes.
-#-----------------------------------------------------------------------------
-
-submit filter
-
-#-----------------------------------------------------------------------------
-# When filter.f90 finished, it creates a file called 'go_end_filter' in this
-# runtime directory (i.e. CENTRALDIR). The existence of 'go_end_filter' is
-# enough to signal filter_server.csh
-#
-# time to end.
-# filter_server.csh is in an infinite loop looking for the existence
-# of any of three files:
-# go_advance_model (time to advance the ensemble members)
-# go_assim_regions (time to assimilate the observations)
-# go_end_filter (time to end)
-#-----------------------------------------------------------------------------
-
-echo "Finished at "`date`
-
-#-----------------------------------------------------------------------------
-# Move the output to storage after filter completes.
-# At this point, all the restart,diagnostic files are in the CENTRALDIR
-# and need to be moved to the 'experiment permanent' directory.
-# We have had problems with some, but not all, files being moved
-# correctly, so we are adding bulletproofing to check to ensure the filesystem
-# has completed writing the files, etc. Sometimes we get here before
-# all the files have finished being written.
-#-----------------------------------------------------------------------------
-
-echo "Listing contents of CENTRALDIR before archiving"
-ls -l
-
-${MOVE} clminput_[1-9]*.nc ${experiment}/CLM
-
-${MOVE} cam_out_temp[1-9]* ${experiment}/CAM
-${MOVE} caminput_[1-9]*.nc ${experiment}/CAM
-
-${MOVE} filter_ic_old* ${experiment}/DART
-${MOVE} filter_ic_new* ${experiment}/DART
-${MOVE} assim_model_state_ud[1-9]* ${experiment}/DART
-${MOVE} assim_model_state_ic[1-9]* ${experiment}/DART
-#${MOVE} inflate_ic_new ${experiment}/DART
-#${MOVE} filter_control ${experiment}/DART
-#${MOVE} run_job.log ${experiment}/DART # filter_server runtime log
-${MOVE} Posterior_Diag.nc ${experiment}/DART
-${MOVE} Prior_Diag.nc ${experiment}/DART
-${MOVE} obs_seq.final ${experiment}/DART
-${MOVE} dart_log.out ${experiment}/DART
-
-${COPY} namelistin ${experiment}
-${MOVE} namelist ${experiment}
@@ Diff output truncated at 40000 characters. @@
More information about the Dart-dev
mailing list